Experimental U-Boot payload (32-bit dtb, U-Boot)
NOTE: Support added for xarch target x86_64-elf, but U-Boot failed to build with this error: OBJCOPY lib/efi_loader/helloworld.efi x86_64-elf-objcopy: lib/efi_loader/helloworld_efi.so: invalid bfd target make[2]: *** [scripts/Makefile.lib:476: lib/efi_loader/helloworld.efi] Error 1 Since I'm building U-Boot for x86_64 *on* an x86-64 host, and since that is currently the recommended type of machine to use for lbmk development, and since the other x86 payloads currently don't cross compile anyway, this is an acceptable compromise for now. This is because at present, I'm not making U-Boot the primary payload on x86, instead preferring to chain it from GRUB and SeaBIOS. The target.cfg file for x86 u-boot shows xarch/xtree commented. Uncomment these to compile on crossgcc instead of hostcc. I mention 64-bit because I initially did this first, but decided to do 32-bit first. I'll work on the 64-bit one next (SPL). It's only enabled in QEMU for now. Signed-off-by: Leah Rowe <leah@libreboot.org>master
parent
14b4838d49
commit
c0017c7357
|
@ -3,3 +3,4 @@ xarch="i386-elf"
|
|||
payload_grub="y"
|
||||
payload_seabios="y"
|
||||
payload_memtest="y"
|
||||
payload_uboot_i386="y"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
. "include/rom.sh"
|
||||
|
||||
makeargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
|
||||
build_depend="seabios/default grub/default memtest86plus"
|
||||
build_depend="seabios/default grub/default memtest86plus u-boot/i386coreboot"
|
||||
|
||||
seavgabiosrom="elf/seabios/default/libgfxinit/vgabios.bin"
|
||||
|
||||
|
|
|
@ -4,3 +4,5 @@ u-boot.dtb
|
|||
u-boot.img
|
||||
u-boot.itb
|
||||
u-boot.elf
|
||||
u-boot-dtb.bin
|
||||
u-boot-x86-with-spl.bin
|
||||
|
|
|
@ -216,6 +216,12 @@ menuentry 'Load test configuration (grubtest.cfg) inside of CBFS [t]' --hotkey=
|
|||
fi
|
||||
}
|
||||
fi
|
||||
if [ -f (cbfsdisk)/u-boot ]; then
|
||||
menuentry 'Load U-Boot (payload) [b]' --hotkey='u' {
|
||||
set root='cbfsdisk'
|
||||
chainloader /u-boot
|
||||
}
|
||||
fi
|
||||
if [ -f (cbfsdisk)/seabios.elf ]; then
|
||||
menuentry 'Load SeaBIOS (payload) [b]' --hotkey='b' {
|
||||
set root='cbfsdisk'
|
||||
|
|
|
@ -234,6 +234,12 @@ menuentry 'Load test configuration (grubtest.cfg) inside of CBFS [t]' --hotkey=
|
|||
fi
|
||||
}
|
||||
fi
|
||||
if [ -f (cbfsdisk)/u-boot ]; then
|
||||
menuentry 'Load U-Boot (payload) [b]' --hotkey='u' {
|
||||
set root='cbfsdisk'
|
||||
chainloader /u-boot
|
||||
}
|
||||
fi
|
||||
if [ -f (cbfsdisk)/seabios.elf ]; then
|
||||
menuentry 'Load SeaBIOS (payload) [b]' --hotkey='b' {
|
||||
set root='cbfsdisk'
|
||||
|
|
|
@ -235,6 +235,12 @@ menuentry 'Load test configuration (grubtest.cfg) in CBFS [t]' --hotkey='t' {
|
|||
fi
|
||||
}
|
||||
fi
|
||||
if [ -f (cbfsdisk)/u-boot ]; then
|
||||
menuentry 'Load U-Boot (payload) [b]' --hotkey='u' {
|
||||
set root='cbfsdisk'
|
||||
chainloader /u-boot
|
||||
}
|
||||
fi
|
||||
if [ -f (cbfsdisk)/seabios.elf ]; then
|
||||
menuentry 'Load SeaBIOS (payload) [b]' --hotkey='b' {
|
||||
set root='cbfsdisk'
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,5 @@
|
|||
tree="x86"
|
||||
# test building with x86_64 hostcc by commenting these:
|
||||
# xtree="default" # coreboot tree containing crossgcc
|
||||
# xarch="i386-elf"
|
||||
# or uncomment them to use crossgcc(buggy)
|
|
@ -0,0 +1 @@
|
|||
test/lib/strlcat.c
|
|
@ -0,0 +1,2 @@
|
|||
tree="x86"
|
||||
rev="3f772959501c99fbe5aa0b22a36efe3478d1ae1c" # v2024.07
|
|
@ -209,9 +209,24 @@ vendor_checksum()
|
|||
|
||||
cbfs()
|
||||
{
|
||||
fRom="$1" # image to operate on
|
||||
fAdd="$2" # file to add
|
||||
fName="$3" # filename when added in CBFS
|
||||
|
||||
ccmd="add-payload" && [ $# -gt 3 ] && ccmd="add"
|
||||
lzma="-c lzma" && [ $# -gt 3 ] && lzma="-t raw"
|
||||
x_ "$cbfstool" "$1" $ccmd -f "$2" -n "$3" $lzma
|
||||
lzma="-c lzma" && [ $# -gt 3 ] && [ $# -lt 5 ] && lzma="-t $4"
|
||||
|
||||
# hack. TODO: do it better. this whole function is cursed
|
||||
if [ $# -gt 4 ]; then
|
||||
# add flat binary for U-Boot (u-boot.bin) on x86
|
||||
if [ "$5" = "0x1110000" ]; then
|
||||
ccmd="add-flat-binary"
|
||||
lzma="-c lzma -l 0x1110000 -e 0x1110000"
|
||||
fi
|
||||
fi
|
||||
|
||||
"$cbfstool" "$fRom" $ccmd -f "$fAdd" -n "$fName" $lzma || \
|
||||
$err "CBFS fail: $fRom $ccmd -f '$fAdd' -n '$fName' $lzma"; :
|
||||
}
|
||||
|
||||
mk()
|
||||
|
|
|
@ -111,6 +111,7 @@ mkcorebootbin()
|
|||
|
||||
[ "$payload_memtest" = "y" ] || payload_memtest="n"
|
||||
[ "$(uname -m)" = "x86_64" ] || payload_memtest="n"
|
||||
|
||||
if $dry grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
|
||||
[ "$payload_seabios" = "y" ] && pname="seabios" && \
|
||||
$dry add_seabios
|
||||
|
@ -136,6 +137,8 @@ add_seabios()
|
|||
[ "$payload_memtest" = "y" ] && cbfs "$tmprom" \
|
||||
"elf/memtest86plus/memtest.bin" img/memtest
|
||||
|
||||
[ "$payload_uboot_i386" = "y" ] && $dry add_uboot
|
||||
|
||||
[ "$payload_grub" = "y" ] && add_grub
|
||||
|
||||
cprom && [ "$payload_grub" = "y" ] && pname="seagrub" && mkseagrub; :
|
||||
|
@ -159,12 +162,26 @@ mkseagrub()
|
|||
|
||||
add_uboot()
|
||||
{
|
||||
ubdir="elf/u-boot/$target/$uboot_config"
|
||||
# TODO: re-work to allow each coreboot target to say which ub tree
|
||||
# instead of hardcoding as in the current logic below:
|
||||
|
||||
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"
|
||||
|
||||
ubdir="elf/u-boot/$ubtarget/$uboot_config"
|
||||
ubootelf="$ubdir/u-boot.elf" && [ ! -f "$ubootelf" ] && \
|
||||
ubootelf="$ubdir/u-boot"
|
||||
[ -f "$ubootelf" ] || $err "cb/$target: Can't find u-boot"
|
||||
[ "$payload_uboot_i386" = "y" ] && ubootelf="$ubdir/u-boot-dtb.bin"
|
||||
|
||||
cbfs "$tmprom" "$ubootelf" "fallback/payload"; cprom
|
||||
[ -f "$ubootelf" ] || $err "cb/$ubtarget: Can't find u-boot"
|
||||
cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs; cprom
|
||||
}
|
||||
|
||||
cprom()
|
||||
|
|
|
@ -199,10 +199,12 @@ check_cross_compiler()
|
|||
export CROSS_COMPILE="${xarch% *}-"
|
||||
[ -n "$xlang" ] && export BUILD_LANGUAGES="$xlang"
|
||||
|
||||
xfix="${_xarch%-*}" && [ "$xfix" = "x86_64" ] && xfix="x64"
|
||||
|
||||
# sometimes buildgcc fails for like no reason. try twice.
|
||||
make -C "$cbdir" crossgcc-${_xarch%-*} $xgccargs || \
|
||||
make -C "$cbdir" crossgcc-${_xarch%-*} $xgccargs || \
|
||||
$err "!mkxgcc $project/$xtree '${_xarch%-*}' '$xgccargs'"
|
||||
make -C "$cbdir" crossgcc-$xfix $xgccargs || \
|
||||
make -C "$cbdir" crossgcc-$xfix $xgccargs || \
|
||||
$err "!mkxgcc $project/$xtree '$xfix' '$xgccargs'"
|
||||
done; return 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue