[coreboot] Loading Linux payloads on RISC-V

王翔 wxjstz at 126.com
Thu Sep 27 05:14:57 CEST 2018


Yes, kernel can be start at any address.
You can refer to BBL implementation : https://github.com/riscv/riscv-pk

BBL converts vmlinux to binary and inserts it into the section named .payload which is one section of BBL.
Because the size of the BBL cannot be known before compiling and linking, the address of the payload is not specific.


在2018年09月27 04时29分, "Philipp Hug"<philipp at hug.cx>写道:


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


Philipp


 




 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot/attachments/20180927/c911501a/attachment.html>


More information about the coreboot mailing list