Add U-Boot x86_64 payload

Currently seems to stall when booted from the GRUB
payload, but works when booted from the SeaBIOS menu.

I also tested it as a standalone payload and it seems
to boot. Will test on hardware next, and start adding
it to more mainboards.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2024-11-18 22:33:26 +00:00
parent 3bf3ef557e
commit 747b6514ea
13 changed files with 3054 additions and 17 deletions
+1 -1
View File
@@ -213,7 +213,7 @@ cbfs()
fAdd="$2" # file to add
fName="$3" # filename when added in CBFS
ccmd="add-payload" && [ $# -gt 3 ] && ccmd="add"
ccmd="add-payload" && [ $# -gt 3 ] && [ $# -lt 5 ] && ccmd="add"
lzma="-c lzma" && [ $# -gt 3 ] && [ $# -lt 5 ] && lzma="-t $4"
# hack. TODO: do it better. this whole function is cursed
+30 -8
View File
@@ -98,11 +98,21 @@ mkcorebootbin()
[ -n "$displaymode" ] && displaymode="_$displaymode"
cbfstool="elf/cbfstool/$tree/cbfstool"
[ "$payload_uboot_i386" = "y" ] && \
[ "$payload_uboot_amd64" = "y" ] && \
$err "'$target' enables 32- and 64-bit x86 U-Boot"
if [ "$payload_uboot_i386" = "y" ] || \
[ "$payload_uboot_amd64" = "y" ]; then
printf "'$target' has x86 U-Boot; assuming SeaBIOS=y\n" 1>&2
payload_seabios="y"
fi
[ -n "$uboot_config" ] || uboot_config="default"
[ "$payload_uboot" = "y" ] || payload_seabios="y"
[ "$payload_grub" = "y" ] && payload_seabios="y"
[ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "y" ] && \
$dry $err "$target: U-Boot and SeaBIOS/GRUB are both enabled."
$dry $err "$target: U-Boot(arm64) and SeaBIOS/GRUB both enabled."
[ -z "$grub_scan_disk" ] && grub_scan_disk="nvme ahci ata"
@@ -137,7 +147,10 @@ add_seabios()
[ "$payload_memtest" = "y" ] && cbfs "$tmprom" \
"elf/memtest86plus/memtest.bin" img/memtest
[ "$payload_uboot_i386" = "y" ] && $dry add_uboot
if [ "$payload_uboot_i386" = "y" ] || \
[ "$payload_uboot_amd64" = "y" ]; then
$dry add_uboot
fi
[ "$payload_grub" = "y" ] && add_grub
@@ -165,20 +178,29 @@ add_uboot()
# TODO: re-work to allow each coreboot target to say which ub tree
# instead of hardcoding as in the current logic below:
# aarch64 targets:
ubcbfsargs=""
[ "$payload_uboot_i386" = "y" ] && \
ubcbfsargs="-l 0x1110000 -e 0x1110000"
ubpath="fallback/payload"
[ "$payload_uboot_i386" = "y" ] && ubpath="u-boot"
ubtarget="$target"
[ "$payload_uboot_i386" = "y" ] && ubtarget="i386coreboot"
# override for x86/x86_64 targets:
if [ "$payload_uboot_i386" = "y" ] || \
[ "$payload_uboot_amd64" = "y" ]; then
ubcbfsargs="-l 0x1110000 -e 0x1110000" # 64-bit and 32-bit
# on 64-bit, 0x1120000 is the SPL, and stub before that
ubpath="img/u-boot"
ubtarget="amd64coreboot"
[ "$payload_uboot_i386" = "y" ] && ubtarget="i386coreboot"; :
fi
ubdir="elf/u-boot/$ubtarget/$uboot_config"
# aarch64 targets:
ubootelf="$ubdir/u-boot.elf" && [ ! -f "$ubootelf" ] && \
ubootelf="$ubdir/u-boot"
# override for x86/x86_64 targets:
[ "$payload_uboot_i386" = "y" ] && ubootelf="$ubdir/u-boot-dtb.bin"
[ "$payload_uboot_amd64" = "y" ] && \
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