summaryrefslogtreecommitdiff
path: root/include/rom.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-12-02 23:54:41 +0000
committerLeah Rowe <leah@libreboot.org>2024-12-03 14:52:53 +0000
commitfb497cec3bf3ca5fada8900cae2917c2af7643d8 (patch)
tree2a12bffd7136726eecc8ab1ac35fc2271f8c56c0 /include/rom.sh
parentefebfa992b6f64d610115502d47468bc039b3a59 (diff)
BROKEN/WIP: NEW MAINBOARD: Lenovo ThinkCentre M920 Tinym920qwip
WARNING!!!!! i915 driver crashes when loading (KMS driver). Could not use GRUB or SeaBIOS; SeaBIOS hangs and USB input fails in GRUB. U-Boot UEFI works, you can boot things. If you want to set upp a headless service this machine is totally fine, because you can just avoid loading i915 in Linux, and just use the EFI framebuffer or the coreboot framebuffer, or possibly boot xorg with nomodeset. DO NOT MERGE! This machine needs a lot work work. Initial notes: This should cover both the M920q and M920x, though the x variant is quite rare. This is a mITX desktop system, documented here: https://doc.coreboot.org/mainboard/lenovo/m920q.html Thanks go to Maciej Pijanowski, who ported coreboot to this board and submitted the code upstream. Libreboot is using the version that was recently merged upstream in the coreboot project. It's not yet known how to auto-download the ME, because the update images are incomplete. The only reliable way thus far is to extract the factory dump. However, it's also uncertain what modules to whitelist in me_cleaner, so for this board, we only: * Unlock all IFD regions, setting them read-write * Set the HAP bit, which is functionally equivalent to a valid me_cleaner setup The result will be a disabled ME, and read-write operation. No binary images will be provided for now, in releases. You must also create the directory: dump/m920q/ Then just extract from the factory dump using: ./ifdtool --platform cnl -x libreboot.rom Then just stick the files that it creates into there, and the build should work. I've made lbmk automatically set the HAP bit and unlock regions, when building with these. Also, SeaBIOS hung so I restored the possibility of using GRUB as primary, but GRUB USB input also didn't work! The board's port author tested edk2 only, it seems. I don't really want edk2 in lbmk just for this board. So, I made U-Boot the only payload. It seems to work fine. However, Debian Linux and OpenBSD both seemed to completely fail: On OpenBSD it had errors pertaining to i915 video driver. Debian Linux stalled at startup just when it's switching to KMS, which would use the i915 driver. Arch Linux installer, same thing: uses KMS, and failed. The port author said edk2 was tested. edk2 provides a decent GOP implementation, so maybe they were using an EFI framebuffer when booting Linux. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/rom.sh')
-rw-r--r--include/rom.sh49
1 files changed, 36 insertions, 13 deletions
diff --git a/include/rom.sh b/include/rom.sh
index f86e5e1a..a5fe2213 100644
--- a/include/rom.sh
+++ b/include/rom.sh
@@ -55,7 +55,7 @@ mkvendorfiles()
check_coreboot_utils "$tree"
printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \
$err "!mk $srcdir .coreboot-version"
- [ -z "$mode" ] && [ "$target" != "$tree" ] && \
+ [ -z "$mode" ] && [ "$target" != "$tree" ] && [ -n "$vcfg" ] && \
x_ ./vendor download $target; return 0
}
@@ -96,6 +96,7 @@ mkcorebootbin()
[ "$displaymode" = "$initmode" ] && displaymode="" # "normal" config
initmode="${initmode%%_*}"
cbfstool="elf/cbfstool/$tree/cbfstool"
+ ifdtool="elf/ifdtool/$tree/ifdtool"
[ "$payload_uboot_i386" = "y" ] && \
[ "$payload_uboot_amd64" = "y" ] && \
@@ -137,23 +138,28 @@ add_seabios()
$dry add_uboot
fi
+ [ -n "$seabiosname" ] || seabiosname="fallback/payload"
_seabioself="elf/seabios/default/$initmode/bios.bin.elf"
- cbfs "$tmprom" "$_seabioself" "fallback/payload"
- x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup
-
- _z="2"; [ "$initmode" = "vgarom" ] && _z="0"
- x_ "$cbfstool" "$tmprom" add-int -i $_z -n etc/pci-optionrom-exec
- x_ "$cbfstool" "$tmprom" add-int -i 0 -n etc/optionroms-checksum
- [ "$initmode" = "libgfxinit" ] && \
- cbfs "$tmprom" "$seavgabiosrom" vgaroms/seavgabios.bin raw
+ if [ "$seabiosname" != "none" ]; then
+ cbfs "$tmprom" "$_seabioself" "$seabiosname"
+ x_ "$cbfstool" "$tmprom" add-int -i 3000 \
+ -n etc/ps2-keyboard-spinup
+
+ _z="2"; [ "$initmode" = "vgarom" ] && _z="0"
+ x_ "$cbfstool" "$tmprom" add-int -i $_z \
+ -n etc/pci-optionrom-exec
+ x_ "$cbfstool" "$tmprom" add-int -i 0 -n etc/optionroms-checksum
+ [ "$initmode" = "libgfxinit" ] && \
+ cbfs "$tmprom" "$seavgabiosrom" vgaroms/seavgabios.bin raw
+ fi
[ "$payload_memtest" = "y" ] && cbfs "$tmprom" \
"elf/memtest86plus/memtest.bin" img/memtest
[ "$payload_grub" = "y" ] && add_grub
- cprom
+ [ "$seabiosname" = "fallback/payload" ] && cprom
[ "$payload_uboot_amd64" = "y" ] && [ "$displaymode" != "txtmode" ] && \
[ "$initmode" != "normal" ] && pname="seauboot" && cprom "seauboot"
[ "$payload_grub" = "y" ] && pname="seagrub" && mkseagrub; :
@@ -161,7 +167,10 @@ add_seabios()
add_grub()
{
- cbfs "$tmprom" "$grubelf" "img/grub2"
+ [ "$grubname" = "none" ] && return 0
+ [ "$grubname" = "fallback/payload" ] && pname="grub"
+ [ -n "$grubname" ] || grubname="img/grub2"
+ cbfs "$tmprom" "$grubelf" "$grubname"
printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" \
> "$TMPDIR/tmpcfg" || $err "$target: !insert scandisk"
cbfs "$tmprom" "$TMPDIR/tmpcfg" scan.cfg raw
@@ -169,6 +178,8 @@ add_grub()
mkseagrub()
{
+ [ "$grubname" = "none" ] && return 0
+ [ "$grubname" = "fallback/payload" ] && pname="grub"
cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
for keymap in config/data/grub/keymap/*.gkb; do
[ -f "$keymap" ] && cprom "${keymap##*/}"; :
@@ -200,7 +211,9 @@ add_uboot()
ubpath="img/u-boot" # 64-bit
ubtarget="amd64coreboot"
[ "$payload_uboot_i386" = "y" ] && ubpath="u-boot" # 32-bit
- [ "$payload_uboot_i386" = "y" ] && ubtarget="i386coreboot"; :
+ [ "$payload_uboot_i386" = "y" ] && ubtarget="i386coreboot"
+
+ [ -n "$ubootname" ] && ubpath="$ubootname"; :
fi
ubdir="elf/u-boot/$ubtarget/$uboot_config"
@@ -214,11 +227,15 @@ add_uboot()
ubootelf="$ubdir/u-boot-x86-with-spl.bin" # EFI-compatible
[ -f "$ubootelf" ] || $err "cb/$ubtarget: Can't find u-boot"
- cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs; cprom
+ cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs
+ [ "$seabiosname" != "none" ] && cprom; :
}
cprom()
{
+ [ "$pname" = "seauboot" ] && [ "$ubootname" = "fallback/payload" ] && \
+ pname="uboot"
+
newrom="bin/$target/${pname}_${target}_$initmode.rom"
[ -n "$displaymode" ] && newrom="${newrom%.rom}_$displaymode.rom"
[ $# -gt 0 ] && [ "$1" != "seauboot" ] && \
@@ -230,6 +247,12 @@ cprom()
[ $# -gt 0 ] && [ "$1" = "seauboot" ] && \
cbfs "$newrom" "config/data/grub/bootorder_uboot" "bootorder" raw
+ _setplatform="" && [ -n "$IFD_platform" ] \
+ && _setplatform="--platform $IFD_platform"
+ [ "$HAPdisable" != "y" ] || "$ifdtool" $_setplatform --altmedisable 1 \
+ "$newrom" -O "$newrom" || \
+ $err "Cannot set HAP bit in '$newrom'"
+
[ "$XBMK_RELEASE" = "y" ] || return 0
$dry mksha512sum "$newrom" "vendorhashes"; $dry ./vendor inject \
-r "$newrom" -b "$target" -n nuke || $err "!nuke $newrom"