[coreboot] Loading Linux payloads on RISC-V

Patrick Rudolph siro at das-labor.org
Thu Sep 27 09:03:26 CEST 2018


On 2018-09-26 10:29 PM, Philipp Hug wrote:
> In my local tree I just added the ram address in selfboot.
> Doing this beforehand with cbfstool would be even better. (E.g. only
> when choosing linux payload)
> 
The proposed mechanism was already implemented here:
https://review.coreboot.org/#/c/coreboot/+/13762/

We decided to use FIT instead, as it has the following advantages:
* Supports architecture specific calling conventions
* Supports devicetree and initrd
* Supports PIE

> The FIT probably needs to be created by distro tools: assembling
> kernel, dt and initramfs.
> 
> On Wed, Sep 26, 2018, 17:42 ron minnich <rminnich at gmail.com> wrote:
> 
>> 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 at 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.
>>
>> 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 at hug.cx>写道:
>>
>> Am Di., 25. Sep. 2018 um 13:50 Uhr schrieb Jonathan Neuschäfer
>> <j.neuschaefer at 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.c#L29
>>

As the riscv kernel doesn't have a header, just place it anywhere in
usable
RAM and set the entrypoint to the same address.
It looks like it's very easy to add FIT support.

Regards,
Patrick

>>
>> Philipp



More information about the coreboot mailing list