From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elFhb-0000U4-QI for qemu-devel@nongnu.org; Mon, 12 Feb 2018 10:07:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elFhY-0004Vu-Vb for qemu-devel@nongnu.org; Mon, 12 Feb 2018 10:07:31 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:57478 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1elFhY-0004P1-QZ for qemu-devel@nongnu.org; Mon, 12 Feb 2018 10:07:28 -0500 Date: Mon, 12 Feb 2018 15:07:04 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20180212150703.GB2545@work-vm> References: <20180205181846.29996-1-dgilbert@redhat.com> <20180212133227.4lmmxomnddrb2vmt@kamzik.brq.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180212133227.4lmmxomnddrb2vmt@kamzik.brq.redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] tests/migration: Add source to PC boot block List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrew Jones Cc: qemu-devel@nongnu.org, quintela@redhat.com, peter.maydell@linaro.org, wei@redhat.com, peterx@redhat.com * Andrew Jones (drjones@redhat.com) wrote: > On Mon, Feb 05, 2018 at 06:18:46PM +0000, Dr. David Alan Gilbert (git) wrote: > > diff --git a/tests/migration/rebuild-x86-bootblock.sh b/tests/migration/rebuild-x86-bootblock.sh > > new file mode 100755 > > index 0000000000..c40f025e1a > > --- /dev/null > > +++ b/tests/migration/rebuild-x86-bootblock.sh > > @@ -0,0 +1,37 @@ > > +#!/bin/sh > > +# Copyright (c) 2016 Red Hat, Inc. and/or its affiliates > > +# This work is licensed under the terms of the GNU GPL, version 2 or later. > > +# See the COPYING file in the top-level directory. > > +# > > +# Author: dgilbert@redhat.com > > + > > +ASMFILE=tests/migration/x86-a-b-bootblock.s > > +HEADER=tests/migration/x86-a-b-bootblock.h > > + > > +if [ ! -e "$ASMFILE" ] > > +then > > + echo "Couldn't find $ASMFILE" >&2 > > + exit 1 > > +fi > > + > > +ASM_WORK_DIR=/tmp/X86BB$$ > > mktemp? Yes, that's probably fair. > > +mkdir $ASM_WORK_DIR && > > +as --32 -march=i486 "$ASMFILE" -o $ASM_WORK_DIR/bb.o && > > +objcopy -O binary $ASM_WORK_DIR/bb.o $ASM_WORK_DIR/bb.boot && > > +dd if=$ASM_WORK_DIR/bb.boot of=$ASM_WORK_DIR/bb.bootsect \ > > + bs=256 count=2 skip=124 && > > +xxd -i $ASM_WORK_DIR/bb.bootsect | > > Is xxd now considered a common enough tool for portable scripts? I've > always liked xxd for manual use, but scripted with 'od'. This script isn't part of a normal build or make check or anything, so jumping through hoops to make it portable for the mythical other person who might ever run it seems OTT, especially since xxd is very common, and I'm not sure how much I'd bet on the portability of od's output format either. Dave > > +sed -e 's/_tmp.*_bootsect/x86_bootsect/' -e 's/.*int.*//' > \ > > + $ASM_WORK_DIR/bb.hex && > > +cat - $ASM_WORK_DIR/bb.hex < "$HEADER" > > +/* This file is automatically generated from > > + * tests/migration/x86-a-b-bootblock.s, edit that and then run > > + * tests/migration/rebuild-x86-bootblock.sh to update, > > + * and then remember to send both in your patch submission. > > + */ > > +HERE > > + > > +rm $ASM_WORK_DIR/bb.hex $ASM_WORK_DIR/bb.bootsect $ASM_WORK_DIR/bb.boot > > +rm $ASM_WORK_DIR/bb.o > > +rmdir $ASM_WORK_DIR > > + > > Thanks, > drew -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK