Coreboot on the x230
After living with my old coreboot installation for more than 18 month, i recently decided to build a new image and flash it. So i downloaded a coreboot 4.7 archive, extracted it and started building. I wanted a coreboot image with grub as a payload, but this time i didn’t want to build the grub payload myself, but let coreboot do the dirty work. To these are the changes i made to the default coreboot config:
Mainboard vendor (Lenovo)
Mainboard model (ThinkPad X230)
ROM chip size (4096 KB (4 MB))
Add a payload (GRUB2) --->
GRUB2 version (2.02) --->
(cryptodisk luks lvm gcry_rijndael gcry_sha256 usbserial_ftdi usbserial_pl2303) Extra modules to include in GRUB image
Include GRUB2 runtime config file into ROM image
(grub.cfg) Path of mygrub.cfg
and this is the corresponding mygrub.cfg file- it is based on the common.cfg grub config from the libreboot project:
function try_isolinux_config {
set root="${1}"
for dir in '' /boot; do
if [ -f "${dir}"/isolinux/isolinux.cfg ]; then
syslinux_configfile -i "${dir}"/isolinux/isolinux.cfg
elif [ -f "${dir}"/syslinux/syslinux.cfg ]; then
syslinux_configfile -s "${dir}"/syslinux/syslinux.cfg
fi
done
}
function search_isolinux {
for i in 0 1; do
# raw devices
try_isolinux_config "(${1}${i})"
for part in 1 2 3 4 5; do
# MBR/GPT partitions
try_isolinux_config "(${1}${i},${part})"
done
done
}
function decrypt {
insmod luks
insmod cryptodisk
cryptomount (ahci0,msdos1)
insmod lvm
}
menuentry 'Load Operating System (incl. fully encrypted disks) [l]' --hotkey='l' {
decrypt
if [ -f (lvm/vg--x230-root)/boot/grub.cfg ] ; then
root=(lvm/vg--x230-root)
configfile /boot/grub.cfg
fi
}
menuentry 'Debian GNU/Linux [d]' --hotkey='d' {
decrypt
root=(lvm/vg--x230-root)
linux /vmlinuz
initrd /initrd.img
}
menuentry 'Debian GNU/Linux Old [o]' --hotkey='o' {
decrypt
root=(lvm/vg--x230-root)
linux /vmlinuz.old
initrd /initrd.img.old
}
menuentry 'Search ISOLINUX menu (AHCI) [a]' --hotkey='a' {
search_isolinux ahci
}
menuentry 'Search ISOLINUX menu (USB) [u]' --hotkey='u' {
search_isolinux usb
}
menuentry 'Search ISOLINUX menu (CD/DVD) [c]' --hotkey='c' {
insmod ata
for dev in ata0 ata1 ata2 ata3 ahci1; do
try_isolinux_config "(${dev})"
done
}
menuentry 'Poweroff [p]' --hotkey='p' {
halt
}
menuentry 'Reboot [r]' --hotkey='r' {
reboot
}
coreboot grub