summaryrefslogtreecommitdiff
path: root/include/rom.sh
diff options
context:
space:
mode:
Diffstat (limited to 'include/rom.sh')
-rw-r--r--include/rom.sh105
1 files changed, 25 insertions, 80 deletions
diff --git a/include/rom.sh b/include/rom.sh
index ed3dddf2..c0e5f8c5 100644
--- a/include/rom.sh
+++ b/include/rom.sh
@@ -6,32 +6,12 @@
# Copyright (c) 2022-2023 Alper Nebi Yasak <alpernebiyasak@gmail.com>
# Copyright (c) 2023 Riku Viitanen <riku.viitanen@protonmail.com>
-mkserprog()
-{
- [ "$_f" = "-d" ] && return 0 # dry run
- basename -as .h "$serdir/"*.h > "$TMPDIR/ser" || $err "!mk $1 $TMPDIR"
-
- while read -r sertarget; do
- [ "$1" = "rp2040" ] && x_ cmake -DPICO_BOARD="$sertarget" \
- -DPICO_SDK_PATH="$picosdk" -B "$sersrc/build" "$sersrc" \
- && x_ cmake --build "$sersrc/build"
- [ "$1" = "stm32" ] && x_ make -C "$sersrc" \
- libopencm3-just-make BOARD=$sertarget && x_ make -C \
- "$sersrc" BOARD=$sertarget; x_ mkdir -p "bin/serprog_$1"
- x_ mv "$serx" "bin/serprog_$1/serprog_$sertarget.${serx##*.}"
- done < "$TMPDIR/ser"
-
- [ "$XBMK_RELEASE" = "y" ] && mkrom_tarball "bin/serprog_$1"; return 0
-}
-
mkpayload_grub()
{
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" \
+ $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/" \
--fonts= --themes= --locales= --modules="$grub_modules" \
--install-modules="$grub_install_modules" \
@@ -43,68 +23,49 @@ mkpayload_grub()
mkvendorfiles()
{
- check_coreboot_utils "$tree"
- printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \
- $err "!mk $srcdir .coreboot-version"
- [ -z "$mode" ] && [ "$target" != "$tree" ] && \
- x_ ./vendor download $target; return 0
+ check_cbfstool "$tree"; printf "69\n" > "$srcdir/.coreboot-version" \
+ || $err "!cbver $srcdir"; [ -z "$mode" ] && \
+ [ "$target" != "$tree" ] && x_ ./vendor download $target; return 0
}
-check_coreboot_utils()
+check_cbfstool()
{
- for util in cbfstool ifdtool; do
- [ "$badhash" = "n" ] || rm -f "elf/$util/$1/$util" || \
- $err "!rm badelf elf/$util/$1/$util"
- e "elf/$util/$1/$util" f && continue
-
- utilelfdir="elf/$util/$1"
- utilsrcdir="src/coreboot/$1/util/$util"
-
- 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
- done; return 0
+ [ "$badhash" = "n" ] || rm -f "elf/cbfstool/$1/cbfstool" || \
+ $err "!rm badelf elf/cbfstool/$1/cbfstool"
+ e "elf/cbfstool/$1/cbfstool" f && return 0
+
+ utilelfdir="elf/cbfstool/$1"
+ utilsrcdir="src/coreboot/$1/util/cbfstool"
+
+ utilmode="" && [ -n "$mode" ] && utilmode="clean"
+ x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs
+ [ -z "$mode" ] && [ ! -f "$utilelfdir/cbfstool" ] && \
+ x_ mkdir -p "$utilelfdir" && \
+ x_ cp "$utilsrcdir/cbfstool" "elf/cbfstool/$1"
+ [ -z "$mode" ] || x_ rm -Rf "$utilelfdir"; :
}
mkcorebootbin()
{
[ "$target" = "$tree" ] && return 0
- tmprom="$srcdir/build/coreboot.rom"
- initmode="${defconfig##*/}"; displaymode="${initmode##*_}"
- initmode="${initmode%%_*}"
+ tmprom="$srcdir/build/coreboot.rom"; initmode="${defconfig##*/}";
+ displaymode="${initmode##*_}"; initmode="${initmode%%_*}"
[ -n "$displaymode" ] && displaymode="_$displaymode"
cbfstool="elf/cbfstool/$tree/cbfstool"
- [ -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."
-
[ -z "$grub_scan_disk" ] && grub_scan_disk="nvme ahci ata"
-
[ -n "$grubtree" ] || grubtree="default"
grubelf="elf/grub/$grubtree/payload/grub.elf"
[ "$payload_memtest" = "y" ] || payload_memtest="n"
[ "$(uname -m)" = "x86_64" ] || payload_memtest="n"
- if grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
- [ "$payload_seabios" = "y" ] && pname="seabios" && \
- $dry add_seabios
- [ "$payload_uboot" = "y" ] && pname="uboot" && $dry add_uboot
- else
- pname="custom" # coreboot's build system added payloads
- fi
+
+ pname="custom" && grep "CONFIG_PAYLOAD_NONE=y" "$defconfig" && \
+ pname="seabios"; $dry add_seabios
+
newrom="bin/$target/${pname}_${target}_$initmode$displaymode.rom"
$dry x_ mkdir -p "${newrom%/*}"; $dry x_ mv "$tmprom" "$newrom"
-
- [ "$XBMK_RELEASE" = "y" ] || return 0
- $dry mksha512sum "$newrom" "vendorhashes"; $dry ./vendor inject \
- -r "$newrom" -b "$target" -n nuke || $err "!nuke $newrom"
}
add_seabios()
@@ -134,19 +95,3 @@ add_grub()
cbfs "$tmprom" "$TMPDIR/tmpcfg" scan.cfg raw
cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
}
-
-add_uboot()
-{
- ubdir="elf/u-boot/$target/$uboot_config"
- ubootelf="$ubdir/u-boot.elf" && [ ! -f "$ubootelf" ] && \
- ubootelf="$ubdir/u-boot"
- [ -f "$ubootelf" ] || $err "cb/$target: Can't find u-boot"
-
- cbfs "$tmprom" "$ubootelf" "fallback/payload"
-}
-
-mkcoreboottar()
-{
- [ "$target" = "$tree" ] && return 0; [ "$XBMK_RELEASE" = "y" ] && \
- [ "$release" != "n" ] && $dry mkrom_tarball "bin/$target"; return 0
-}