]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
RISC-V: Add an Image header that boot loader can parse.
authorAtish Patra <atish.patra@wdc.com>
Thu, 6 Jun 2019 23:08:00 +0000 (16:08 -0700)
committerPaul Walmsley <paul.walmsley@sifive.com>
Thu, 11 Jul 2019 18:58:20 +0000 (11:58 -0700)
commit0f327f2aaad6a87356cbccfa390d4d3b64d0d3b6
tree5c7b353f5d10434675cbb37a87cb4b21e6af9eb6
parent671f9a3e2e24cdeb2d2856abee7422f093e23e29
RISC-V: Add an Image header that boot loader can parse.

Currently, the last stage boot loaders such as U-Boot can accept only
uImage which is an unnecessary additional step in automating boot
process.

Add an image header that boot loader understands and boot Linux from
flat Image directly.

This header is based on ARM64 boot image header and provides an
opportunity to combine both ARM64 & RISC-V image headers in future.

Also make sure that PE/COFF header can co-exist in the same image so
that EFI stub can be supported for RISC-V in future. EFI specification
needs PE/COFF image header in the beginning of the kernel image in order
to load it as an EFI application. In order to support EFI stub, code0
should be replaced with "MZ" magic string and res4(at offset 0x3c)
should point to the rest of the PE/COFF header (which will be added
during EFI support).

Tested on both QEMU and HiFive Unleashed using OpenSBI + U-Boot + Linux.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Karsten Merker <merker@debian.org>
Tested-by: Karsten Merker <merker@debian.org> (QEMU+OpenSBI+U-Boot)
Tested-by: Kevin Hilman <khilman@baylibre.com> (OpenSBI + U-Boot + Linux)
[paul.walmsley@sifive.com: fixed whitespace in boot-image-header.txt;
 converted structure comment to kernel-doc format and added some detail]
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
Documentation/riscv/boot-image-header.txt [new file with mode: 0644]
arch/riscv/include/asm/image.h [new file with mode: 0644]
arch/riscv/kernel/head.S