All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: Wei Huang <wei@redhat.com>,
	lvivier@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com,
	peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH V8 1/4] tests/migration: Convert x86 boot block compilation script into Makefile
Date: Mon, 3 Sep 2018 14:14:01 +0200	[thread overview]
Message-ID: <20180903121401.ncz2n7rlahh6xtat@kamzik.brq.redhat.com> (raw)
In-Reply-To: <87k1o23iua.fsf@trasno.org>

On Mon, Sep 03, 2018 at 01:45:33PM +0200, Juan Quintela wrote:
> Andrew Jones <drjones@redhat.com> wrote:
> > On Sat, Sep 01, 2018 at 01:11:12AM -0400, Wei Huang wrote:
> >> The x86 boot block header currently is generated with a shell script.
> >> To better support other CPUs (e.g. aarch64), we convert the script
> >> into Makefile. This allows us to 1) support cross-compilation easily,
> >> and 2) avoid creating a script file for every architecture.
> >> 
> >> Note that, in the new design, the cross compiler prefix can be specified by
> >> setting the CROSS_PREFIX in "make" command. Also to allow gcc pre-processor
> >> to include the C-style file correctly, it also renames the
> >> x86-a-b-bootblock.s file extension from .s to .S.
> >> + * tests/migration/rebuild-x86-bootblock.sh to update,
> >> + * and then remember to send both in your patch submission.
> >> + */
> >> +endef
> >> +export __note
> >> +
> >> +.PHONY: all clean
> >> +all: x86-a-b-bootblock.h
> >> +
> >> +x86-a-b-bootblock.h: x86.bootsect
> >> +	echo "$$__note" > header.tmp
> >> +	xxd -i $< | sed -e 's/.*int.*//' >> header.tmp
> >> +	mv header.tmp $@
> >
> > The shell script this Makefile is replacing used mktemp
> > for a randomly named tmp dir. Shouldn't we continue to
> > use random names?
> 
> We shouldn't be trying to create the file twice in parallel, no?

Yeah, you're right. This should be safe.

> 
> >
> >> +
> >> +x86.bootsect: x86.boot
> >> +	dd if=$< of=$@ bs=256 count=2 skip=124
> >> +
> >> +x86.boot: x86.o
> >> +	$(CROSS_PREFIX)objcopy -O binary $< $@
> >> +
> >> +x86.o: x86-a-b-bootblock.S
> >> +	$(CROSS_PREFIX)gcc -m32 -march=i486 -c $< -o $@
> >> +
> >> +clean:
> >> +	@rm -rf *.boot *.o *.bootsect
> >
> > We don't want to remove the generated header file when cleaning?
> 
> No, because we only generated the header file when running native, have
> the right crosscompilers, etc.  In general we only recompile it when we
> change the test file, otherwise we store the generated ones.
> 
> Idea is:
> We have a c file that does what we want.
> We compile it (when we have a propper compiler) and store it on the
> tree.
> We compile it for each test.
> 
> This is more "like firmware" than normal "qemu" source code.
>

Right. I momentarily forget that when replying to this patch.

Thanks,
drew

  reply	other threads:[~2018-09-03 12:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-01  5:11 [Qemu-devel] [PATCH V8 0/4] tests: Add migration test for aarch64 Wei Huang
2018-09-01  5:11 ` [Qemu-devel] [PATCH V8 1/4] tests/migration: Convert x86 boot block compilation script into Makefile Wei Huang
2018-09-03  9:32   ` Juan Quintela
2018-09-03 11:08   ` Andrew Jones
2018-09-03 11:45     ` Juan Quintela
2018-09-03 12:14       ` Andrew Jones [this message]
2018-09-04 15:51     ` Wei Huang
2018-09-01  5:11 ` [Qemu-devel] [PATCH V8 2/4] tests/migration: Support cross compilation in generating boot header file Wei Huang
2018-09-03  9:43   ` Juan Quintela
2018-09-03 11:26   ` Andrew Jones
2018-09-04 17:04     ` Wei Huang
2018-09-04 18:05       ` Andrew Jones
2018-09-01  5:11 ` [Qemu-devel] [PATCH V8 3/4] tests/migration: Add migration-test " Wei Huang
2018-09-03  9:35   ` Juan Quintela
2018-09-03 11:34   ` Andrew Jones
2018-09-01  5:11 ` [Qemu-devel] [PATCH V8 4/4] tests: Add migration test for aarch64 Wei Huang
2018-09-01 10:07   ` Peter Maydell
2018-09-02  5:00     ` Wei Huang
2018-09-03 11:46     ` Andrew Jones
2018-09-03  9:42   ` Juan Quintela
2018-09-03 11:53   ` Andrew Jones
2018-09-04 17:07     ` Wei Huang
2018-09-04 18:02       ` Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180903121401.ncz2n7rlahh6xtat@kamzik.brq.redhat.com \
    --to=drjones@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.