|
1 年之前 | |
---|---|---|
.. | ||
Makefile | 4 年之前 | |
OLVASSEL.md | 4 年之前 | |
README.md | 4 年之前 | |
bootboot.c | 3 年之前 | |
fs.h | 1 年之前 | |
lib.config | 4 年之前 | |
smp.S | 3 年之前 | |
tinf.h | 4 年之前 | |
tinflate.c | 4 年之前 |
See BOOTBOOT Protocol for common details.
Implements the BOOTBOOT Protocol as a coreboot payload. Must be compiled using the coreboot build environment.
First, install the coreboot dependencies: bison, build-essentials, curl, flex, git, gnat, libncurses5-dev, m4, zlib. Please refer to the linked doc for up-to-date list of dependencies.
Download coreboot and its submodules
$ git clone https://review.coreboot.org/coreboot
$ cd coreboot
$ git submodule update --init
It is very important to initialize submodules, otherwise you won't be able to compile coreboot.
This step could take a while. Replace $(nproc) with the number of CPU cores you have.
$ make crossgcc-i386 CPUS=$(nproc)
Now configure coreboot for your motherboard (or qemu) and BOOTBOOT.
$ make menuconfig
select 'Mainboard' menu
Beside 'Mainboard vendor' should be '(Emulation)'
Beside 'Mainboard model' should be 'QEMU x86 i440fx/piix4'
select 'Exit'
select 'Devices' menu
select 'Display' menu
Beside 'Framebuffer mode' should be 'Linear "high-resolution" framebuffer'
select 'Exit'
select 'Exit'
select 'Payload' menu
select 'Add a Payload'
choose 'BOOTBOOT'
select 'Exit'
select 'Exit'
select 'Yes'
It is important to set the display to "linear framebuffer", because BOOTBOOT does not handle the legacy, non-portable VGA text mode. Sadly there's no way of configuring this in run-time with libpayload.
$ make
For more information, read the coreboot docs. In the images directory you can find a precompiled coreboot-x86.rom binary.
$ qemu-system-x86_64 -bios build/coreboot.rom -drive file=$(BOOTBOOT)/images/disk-x86.img,format=raw -serial stdio
To add an initrd into ROM, first you have to generate one. It can be an (optionally gzipped) tar, cpio, etc. archive. You can also create it using the mkbootimg utility:
$ ./mkbootimg myos.json initrd.bin
Then use the cbfstool
utility in the coreboot repository to add the initrd image into the ROM image:
$ ./build/cbfstool build/coreboot.rom add -t raw -f $(BOOTBOOT)/initrd.bin -n bootboot/initrd
You can add a fallback environment configuration similarily (only used if environment cannot be loaded from the usual places):
$ ./build/cbfstool build/coreboot.rom add -t raw -f $(BOOTBOOT)/environment.txt -n bootboot/config
Obviously this can only work if libpayload was compiled with CONFIG_LP_CBFS=y
. Without you can still place the initrd on
a Flashmap partition named "INITRD" (however using the fmaptool and dealing with the fmd format is a rocket science).
IRQs masked. GDT unspecified, but valid, IDT unset. SSE, SMP enabled. Code is running in supervisor mode in ring 0 on all cores.
Once you have compiled a coreboot ROM with the BOOTBOOT payload, you can flash the build/coreboot.rom file to your mainboard.