On 10/04/2018 10:30 AM, Philippe Mathieu-Daudé wrote:
> On 04/10/2018 17:27, Wei Huang wrote:
>> On 10/04/2018 10:07 AM, Philippe Mathieu-Daudé wrote:
>>> On 28/09/2018 21:47, Wei Huang wrote:
>>> [...]> +++ b/tests/migration/aarch64/Makefile
>>>> @@ -0,0 +1,20 @@
>>>> +# To specify cross compiler prefix, use CROSS_PREFIX=
>>>> +# $ make CROSS_PREFIX=aarch64-linux-gnu-
>>>> +
>>>> +.PHONY: all clean
>>>> +all: a-b-kernel.h
>>>> +
>>>> +a-b-kernel.h: aarch64.kernel
>>>> + echo "$$__note" > header.tmp
>>>
>>> This won't work on a read-only fs.
>>
>> Under which setting? If tmp file can't be generated on a read-only fs,
>> wouldn't $@ have the same problem?
>
> Yes you are right :)
>
>>>
>>> Why don't you use $@ directly?
>
> What about this?
Yes, I can address it with the following, along with $(RM) as Drew
pointed it out.
a-b-kernel.h: aarch64.kernel
echo "$$__note" > $@
xxd -i $< | sed -e 's/.*int.*//' >> $@
>
>>>
>>>> + xxd -i $< | sed -e 's/.*int.*//' >> header.tmp
>>>
>>> Please use:
>>>
>>> xxd -g4 ...
>>
>> This option doesn't work with -i (the include file style output) which
>> is what we want. From xxd manual:
>>
>> "-g bytes | -groupsize bytes
>> separate the output of every <bytes> bytes (two hex characters or
>> eight bit-digits each) by a whitespace. Specify -g 0 to suppress
>> grouping. <Bytes> defaults to 2 in normal mode and 1 in bits
>> mode. Grouping does not apply to postscript or include style."
>
> Indeed, too bad.
>
>>>
>>> xxd might not be installed on the host.
>>
>> xxd is provided by vim packages. So it should be available in most distros.
>>
>>>
>>> That said we should however install it on the docker cross images.
>>
>> Agreed.
>>
>>>
>>>> + mv header.tmp $@
>>>> +
>>>> +aarch64.kernel: aarch64.elf
>>>> + $(CROSS_PREFIX)objcopy -O binary $< $@
>>>> +
>>>> +aarch64.elf: a-b-kernel.S
>>>> + $(CROSS_PREFIX)gcc -o $@ -nostdlib -Wl,--build-id=none $<
>>>> +
>>>> +clean:
>>>> + @rm -rf *.kernel *.elf
>>>