This elf file is position-independent and can be loaded to any location. We can add a simple script to handle it.
1. Convert vmlinux to binary by objcopy, the binary file name is flat_file
2. Write a simple assembly file (tmp.S), convert binary to object, the file name is obj_file ``` .section .text .globl _start _start: .incbin "flat_file" ``` command: as tmp.S -o obj_file
3. Relink. Linker script like this(tmp.ld): ``` ENTRY(_start)
SECTIONS { . = target_address; .text : { *(.text) } } ``` command: ld -T tmp.ld obj_file
在2018年09月25 20时51分, "Philipp Hug"philipp@hug.cx写道:
Am Di., 25. Sep. 2018 um 13:50 Uhr schrieb Jonathan Neuschäfer j.neuschaefer@gmx.net:
Would FIT support require discussion/cooperation with other projects like Linux or u-boot?
What seems to be missing is the kernel image format to be used within the FIT. e.g. look at arm64: https://github.com/torvalds/linux/blob/master/arch/arm64/kernel/head.S#L73 https://github.com/coreboot/coreboot/blob/master/src/arch/arm64/fit_payload....
Philipp
But the kernel can start anywhere. I don't see a reason to do this complex objcopy step when all that is needed is to have cbfstool set some entries in the SELF or just have selfboot use "0" to mean "somewhere useful"? Did I miss something?
On Tue, Sep 25, 2018 at 10:32 PM 王翔 wxjstz@126.com wrote:
This elf file is position-independent and can be loaded to any location. We can add a simple script to handle it.
Convert vmlinux to binary by objcopy, the binary file name is flat_file
Write a simple assembly file (tmp.S), convert binary to object, the
file name is obj_file
.section .text .globl _start _start: .incbin "flat_file"
command: as tmp.S -o obj_file
- Relink. Linker script like this(tmp.ld):
ENTRY(_start) SECTIONS { . = target_address; .text : { *(.text) } }
command: ld -T tmp.ld obj_file
在2018年09月25 20时51分, "Philipp Hug"philipp@hug.cx写道:
Am Di., 25. Sep. 2018 um 13:50 Uhr schrieb Jonathan Neuschäfer < j.neuschaefer@gmx.net>:
Would FIT support require discussion/cooperation with other projects like Linux or u-boot?
What seems to be missing is the kernel image format to be used within the
FIT. e.g. look at arm64: https://github.com/torvalds/linux/blob/master/arch/arm64/kernel/head.S#L73
https://github.com/coreboot/coreboot/blob/master/src/arch/arm64/fit_payload....
Philipp