diff options
Diffstat (limited to 'include/rom.sh')
-rw-r--r-- | include/rom.sh | 72 |
1 files changed, 52 insertions, 20 deletions
diff --git a/include/rom.sh b/include/rom.sh index f21b6302..3e8c9c9b 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -1,18 +1,30 @@ # SPDX-License-Identifier: GPL-3.0-or-later -# Copyright (c) 2014-2016,2020-2021,2023-2024 Leah Rowe <leah@libreboot.org> +# Copyright (c) 2014-2016,2020-2021,2023-2025 Leah Rowe <leah@libreboot.org> # Copyright (c) 2021-2022 Ferass El Hafidi <vitali64pmemail@protonmail.com> # Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com> # Copyright (c) 2022-2023 Alper Nebi Yasak <alpernebiyasak@gmail.com> -# Copyright (c) 2023 Riku Viitanen <riku.viitanen@protonmail.com> +# Copyright (c) 2023-2024 Riku Viitanen <riku.viitanen@protonmail.com> mkserprog() { + [ $# -lt 1 ] && $err "mkserprog: no arguments provided" [ "$_f" = "-d" ] && return 0 # dry run + + [ "$1" = "pico" ] && mkpicotool + basename -as .h "$serdir/"*.h > "$TMPDIR/ser" || $err "!mk $1 $TMPDIR" while read -r sertarget; do - [ "$1" = "rp2040" ] && x_ cmake -DPICO_BOARD="$sertarget" \ + [ "$1" = "pico" ] && + x_ rm -rf "$sersrc/build" \ + && (pt=$(x_ grep "pico_cmake_set" \ + "$picosdk/src/boards/include/boards/$sertarget.h" \ + | grep "PICO_PLATFORM" | cut -d= -f2 | tr -d [:blank:]) + mkdir -p "$sersrc/build_$pt" + ln -srf "$sersrc/build_$pt/" "$sersrc/build") \ + && x_ cmake -DPICO_BOARD="$sertarget" \ -DPICO_SDK_PATH="$picosdk" -B "$sersrc/build" "$sersrc" \ + -Dpicotool_DIR="$picotool/picotool" \ && x_ cmake --build "$sersrc/build" [ "$1" = "stm32" ] && x_ make -C "$sersrc" \ libopencm3-just-make BOARD=$sertarget && x_ make -C \ @@ -23,6 +35,18 @@ mkserprog() [ "$XBMK_RELEASE" = "y" ] && mkrom_tarball "bin/serprog_$1"; return 0 } +mkpicotool() +{ + rm -Rf "$picotool" || $err "Can't remove picotool builddir" + ( + x_ cd src/picotool + cmake -DCMAKE_INSTALL_PREFIX=xbmkbin -DPICOTOOL_FLAT_INSTALL=1 \ + -DPICO_SDK_PATH=../pico-sdk || \ + $err "Can't prep picotool" + make install || $err "Can't build picotool"; : + ) || $err "Can't build picotool"; : +} + copyps1bios() { x_ rm -Rf bin/playstation @@ -36,8 +60,8 @@ copyps1bios() mkpayload_grub() { - eval `setvars "" grub_modules grub_install_modules` - $dry eval `setcfg "$grubdata/module/$tree"` + eval "`setvars "" grub_modules grub_install_modules`" + $dry eval "`setcfg "$grubdata/module/$tree"`" $dry x_ rm -f "$srcdir/grub.elf"; $dry \ "$srcdir/grub-mkstandalone" --grub-mkimage="$srcdir/grub-mkimage" \ -O i386-coreboot -o "$srcdir/grub.elf" -d "${srcdir}/grub-core/" \ @@ -55,7 +79,7 @@ mkvendorfiles() printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \ $err "!mk $srcdir .coreboot-version" [ -z "$mode" ] && [ "$target" != "$tree" ] && \ - x_ ./vendor download $target; return 0 + x_ ./mk download "$target"; return 0 } cook_coreboot_config() @@ -77,10 +101,14 @@ check_coreboot_utils() utilmode="" && [ -n "$mode" ] && utilmode="clean" x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs - [ -z "$mode" ] && [ ! -f "$utilelfdir/$util" ] && \ - x_ mkdir -p "$utilelfdir" && \ - x_ cp "$utilsrcdir/$util" "elf/$util/$1" - [ -z "$mode" ] || x_ rm -Rf "$utilelfdir"; continue + if [ -z "$mode" ] && [ ! -f "$utilelfdir/$util" ]; then + x_ mkdir -p "$utilelfdir" + x_ cp "$utilsrcdir/$util" "$utilelfdir" + [ "$util" = "cbfstool" ] || continue + x_ cp "$utilsrcdir/rmodtool" "$utilelfdir" + elif [ -n "$mode" ]; then + x_ rm -Rf "$utilelfdir" + fi; continue done; return 0 } @@ -102,7 +130,8 @@ mkcorebootbin() if [ "$payload_uboot_i386" = "y" ] || \ [ "$payload_uboot_amd64" = "y" ]; then - printf "'$target' has x86 U-Boot; assuming SeaBIOS=y\n" 1>&2 + printf "'%s' has x86 U-Boot; assuming SeaBIOS=y\n" \ + "$target" 1>&2 payload_seabios="y" fi @@ -193,10 +222,12 @@ mkseagrub() add_uboot() { if [ "$displaymode" = "txtmode" ]; then - printf "cb/$target: Cannot use U-Boot in text mode\n" 1>&2 + printf "cb/%s: Cannot use U-Boot in text mode\n" \ + "$target" 1>&2 return 0 elif [ "$initmode" = "normal" ]; then - printf "cb/$target: Cannot use U-Boot in normal initmode\n" 1>&2 + printf "cb/%s: Cannot use U-Boot in normal initmode\n" \ + "$target" 1>&2 return 0 fi @@ -244,15 +275,16 @@ cprom() x_ cp "$tmprom" "$newrom" && [ $# -gt 0 ] && [ "$1" != "seauboot" ] && \ cbfs "$newrom" "config/data/grub/keymap/$1" keymap.gkb raw [ $# -gt 0 ] && [ "$1" = "seauboot" ] && \ - cbfs "$newrom" "config/data/grub/bootorder_uboot" "bootorder" raw - - [ "$XBMK_RELEASE" = "y" ] || return 0 - $dry mksha512sum "$newrom" "vendorhashes"; $dry ./vendor inject \ - -r "$newrom" -b "$target" -n nuke || $err "!nuke $newrom" + cbfs "$newrom" "config/data/grub/bootorder_uboot" bootorder raw; : } mkcoreboottar() { - [ "$target" = "$tree" ] && return 0; [ "$XBMK_RELEASE" = "y" ] && \ - [ "$release" != "n" ] && $dry mkrom_tarball "bin/$target"; : + [ "$target" = "$tree" ] && return 0 + [ "$XBMK_RELEASE" = "y" ] || return 0 + [ "$release" != "n" ] || return 0 + $dry mkrom_tarball "bin/$target" + $dry ./mk inject "bin/${relname}_${target}.tar.xz" nuke || \ + $err "Can't delete vendorfiles in 'bin/${relname}_$target.tar.xz'" + return 0 } |