Setting up Coreboot + GRUB

follow the instructions until step 5 and then

grub.cfg

vi grub.cfg

set default=0
set timeout=5

menuentry "Linux" {
    insmod ext2
    set root=(ata0)
    linux /vmlinuz root=/dev/sda ro ipv6.disable=1 init=/bin/sh
    #console=ttyS1,9600 console=tty0
    #init=/linuxrc
}

Note ata0 instead of hd0. You can also troubleshoot and find out about devices and file-systems from the GRUB command line, once you get there

c

set
ls
set root=ata0
insmod ext2
ls /

build

#make distclean
rm -f .config
make menuconfig

Mainboard  --->
ROM chip size (1024 KB (1 MB))

notice the CBFS size also changed

(0x100000) Size of CBFS filesystem in ROM (NEW)

Payload  --->
Add a payload (GRUB2)
GRUB2 version (2.04)
[*] Include GRUB2 runtime config file into ROM image
(grub.cfg) Path of grub.cfg (NEW)

make savedefconfig
cat defconfig
nice make -j5 > ../corebootgrub.log && echo BUILT

quick & dirty system

cd ../
dd if=/dev/zero of=disk.sparse bs=1M count=0 seek=1000

mkfs.ext2 disk.sparse
mkdir -p lala/
mount -o loop disk.sparse lala/
cp /vmlinuz lala/

#wget https://busybox.net/downloads/busybox-1.31.0.tar.bz2
#tar xjf busybox-1.31.0.tar.bz2 
#cd busybox-1.31.0/
git clone git://git.busybox.net/busybox
cd busybox/
#make distclean

#make allyesconfig
#make menuconfig
#...disable selinux
#...disable pam
#...
#grep SELINUX .config
#grep PAM .config
#grep ... .config

make defconfig
make menuconfig
[*] Build static binary (no shared libs)
#echo CONFIG_STATIC=y >> .config
#make oldconfig
grep STATIC .config

nice make -j5 > ../busybox.log && echo BUILT
ldd busybox #not a dynamic executable

rm -rf ../busybox.built/
mkdir ../busybox.built/
make CONFIG_PREFIX=../busybox.built install
cd ../

cp -af busybox.built/* lala/
ll lala/
du -sh lala/ #13M
umount lala/

ready to go

emulate a guest

qemu-system-x86_64 -h | less
qemu-system-x86_64 -bios coreboot/build/coreboot.rom -hda disk.sparse
#-serial stdio

troubles

E: Could not add [payloads/external/GRUB2/grub2/build/default_payload.elf, 451892 bytes (441 KB)@0x0]; too big?
E: Failed to add 'payloads/external/GRUB2/grub2/build/default_payload.elf' into ROM image.

–> increase the ROM size and CBFS size

FMAP       build/util/cbfstool/fmaptool -h build/fmap_config.h build/fmap.fmd build/fmap.fmap
syntax error
FATAL: Failed while processing provided descriptor
Makefile.inc:1019: recipe for target 'build/fmap.fmap' failed

–> rm -f .config && make menuconfig

resources

Tutorial, part 1: Starting from scratch https://doc.coreboot.org/tutorial/part1.html

Lesson1 https://www.coreboot.org/Lesson1

coreboot v3 + OpenBIOS https://www.coreboot.org/QEMU#coreboot_v3_.2B_OpenBIOS

QEMU https://www.coreboot.org/QEMU

grub command line

Grub2/Troubleshooting https://help.ubuntu.com/community/Grub2/Troubleshooting

16.3 The list of command-line and menu entry commands https://www.gnu.org/software/grub/manual/grub/html_node/Command_002dline-and-menu-entry-commands.html

busybox

Why do I keep getting “sh: can’t access tty; job control turned off” errors? Why doesn’t Control-C work within my shell? https://www.busybox.net/FAQ.html#job_control


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml