Closed
Description
Currently the build process is a bit strange:
- First, we build the kernel
- Then we convert the ELF file to a binary
- Then we append a 512 byte sized structure that contains the kernel length
- Finally we append the kernel
We could change it in the following way:
- We could create a build script that reads an
BOOTLOADER_KERNEL_PATH
environment variable, converts it to a binary blob and then back to an object file (e.g.cargo objcopy -- -I binary -O elf64-x86-64 target/x86_64-blog_os/debug/blog_os blog_os_bin.o --binary-architecture=i386:x86-64
) - Rename the default .data section to .kernel
- The build script then passes the object file to the linker
- This means that we can directly access the kernel blob in the linker script and directly access start/end/size of the kernel
The new build process would be:
- Build the kernel
- Build the bootloader (with an environment variable set to the kernel path)
- Convert the bootloader ELF file to a binary
The big disadvantage of this is that we need to rebuild the bootloader for each kernel change, so maybe it is better to keep the current build system.
Metadata
Metadata
Assignees
Labels
No labels