[riscv] Add a .lkrn build target resembling a Linux kernel binary

On x86 BIOS, it has been useful to be able to build iPXE to resemble a
Linux kernel, so that it can be loaded by programs such as syslinux
which already know how to handle Linux kernel binaries.

Add an equivalent .lkrn build target for RISC-V SBI, allowing for
build targets such as:

  make bin-riscv64/ipxe.lkrn

  make bin-riscv64/cgem.lkrn

The Linux kernel header format allows us to specify a required length
(including uninitialised-data portions) and defines that the image
will be loaded at a fixed offset from the start of RAM.  We can
therefore use known-safe areas of memory (within our own .bss) for the
initial temporary page table and stack.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-13 12:51:53 +01:00
parent 17fd67ce03
commit 8e38af800b
3 changed files with 131 additions and 0 deletions

View File

@@ -452,6 +452,7 @@ paging_mode_names:
* This can be used only once .bss is known to be writable.
*/
.section ".bss.page_table", "a", @nobits
.globl page_table
.balign PAGE_SIZE
page_table:
.space PAGE_SIZE