diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/lib.sh | 19 | ||||
-rw-r--r-- | include/rom.sh | 23 |
2 files changed, 37 insertions, 5 deletions
diff --git a/include/lib.sh b/include/lib.sh index c5df639c..9a5faabb 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -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() diff --git a/include/rom.sh b/include/rom.sh index 1d7be098..d04e9ee4 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -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() |