qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V8 1/4] tests/migration: Convert x86 boot block


From: Juan Quintela
Subject: Re: [Qemu-devel] [PATCH V8 1/4] tests/migration: Convert x86 boot block compilation script into Makefile
Date: Mon, 03 Sep 2018 13:45:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Andrew Jones <address@hidden> 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?

>
>> +
>> +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.

Later, Juan.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]