summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-11-18 22:33:26 +0000
committerLeah Rowe <leah@libreboot.org>2024-11-19 02:04:50 +0000
commit747b6514eaf00ac71af475daab98509bf8870b23 (patch)
treeb28c6c1b5bb569ccea44eae8400c06931401fc84 /include
parent3bf3ef557e4533af1e638b8f25e27c7cde0a418b (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/lib.sh2
-rw-r--r--include/rom.sh38
2 files changed, 31 insertions, 9 deletions
diff --git a/include/lib.sh b/include/lib.sh
index 9a5faabb..e439ef8b 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -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
diff --git a/include/rom.sh b/include/rom.sh
index d04e9ee4..808f83a4 100644
--- a/include/rom.sh
+++ b/include/rom.sh
@@ -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