From c073ee9d4fc4a631c16ff681bb62c29b952878ba Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 2 May 2025 02:18:19 +0100 Subject: [PATCH 001/267] Restore SeaBIOS 9029a010 update, but with AHCI fix I fixed the AHCI bug, with a patch that I wrote. It works by restoring the old SeaBIOS AHCI initialisation behaviour, whereby the AHCI controller is enabled from its current state; the patch that broke AHCI in coreboot (tested on ThinkPad T420), changed AHCI initialisation behaviour so that the controller's state is first reset, prior to enablement. However, my patch also retains the new AHCI initialisation behaviour, when a CSM is in use. The AHCI reset patch was done, by the author, specifically for SeaBIOS in CSM mode, so it makes sense to only change the behaviour conditionally according to that. This reverts commit 8245f0b3211812ac818adadd6526b0b39c63f3f0. Signed-off-by: Leah Rowe --- ...1-romfile-implement-a-generic-loader.patch | 12 ++-- ...ionroms-implement-mxm-3.0-interrupts.patch | 6 +- ...ibreboot-version-in-the-SeaBIOS-menu.patch | 6 +- ...04-ahci-Only-reset-controller-on-CSM.patch | 63 +++++++++++++++++++ config/seabios/default/target.cfg | 2 +- 5 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 config/seabios/default/patches/0004-ahci-Only-reset-controller-on-CSM.patch diff --git a/config/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch b/config/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch index 2c042776..dc1464bb 100644 --- a/config/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch +++ b/config/seabios/default/patches/0001-romfile-implement-a-generic-loader.patch @@ -1,7 +1,7 @@ -From 2aff8adc1dcd1315877fdb4ac4ef5e649c5b7d11 Mon Sep 17 00:00:00 2001 +From 04e972e14191f3a480e569e972c195ba8eb53a30 Mon Sep 17 00:00:00 2001 From: Riku Viitanen Date: Sat, 10 Feb 2024 21:23:33 +0200 -Subject: [PATCH 1/2] romfile: implement a generic loader +Subject: [PATCH 1/4] romfile: implement a generic loader romfile_loadfile_g: Based on romfile_loadfile but more flexible. User has to supply pointer @@ -18,7 +18,7 @@ Signed-off-by: Riku Viitanen 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/romfile.c b/src/romfile.c -index b598274edc09..8ccf5139ece8 100644 +index 8072a915..f4d5f82d 100644 --- a/src/romfile.c +++ b/src/romfile.c @@ -47,10 +47,12 @@ romfile_find(const char *name) @@ -69,7 +69,7 @@ index b598274edc09..8ccf5139ece8 100644 } diff --git a/src/romfile.h b/src/romfile.h -index 3e0f820047dd..1b967d86551f 100644 +index ae2f4ac7..f62b2fee 100644 --- a/src/romfile.h +++ b/src/romfile.h @@ -13,6 +13,8 @@ struct romfile_s { @@ -80,7 +80,7 @@ index 3e0f820047dd..1b967d86551f 100644 + void *(*malloc_fn)(u32), int add_len); void *romfile_loadfile(const char *name, int *psize); u64 romfile_loadint(const char *name, u64 defval); - + u32 romfile_loadbool(const char *name, u32 defval); -- -2.43.0 +2.39.5 diff --git a/config/seabios/default/patches/0002-vgahooks-optionroms-implement-mxm-3.0-interrupts.patch b/config/seabios/default/patches/0002-vgahooks-optionroms-implement-mxm-3.0-interrupts.patch index f05a34c2..5224d768 100644 --- a/config/seabios/default/patches/0002-vgahooks-optionroms-implement-mxm-3.0-interrupts.patch +++ b/config/seabios/default/patches/0002-vgahooks-optionroms-implement-mxm-3.0-interrupts.patch @@ -1,7 +1,7 @@ -From 1e7c443d069ef817c4e699bd6675efff4ebddb86 Mon Sep 17 00:00:00 2001 +From 270ac30b862c58c69455dbdace716044d29b20e2 Mon Sep 17 00:00:00 2001 From: Riku Viitanen Date: Sat, 10 Feb 2024 21:38:17 +0200 -Subject: [PATCH 2/2] vgahooks, optionroms: implement mxm 3.0 interrupts +Subject: [PATCH 2/4] vgahooks, optionroms: implement mxm 3.0 interrupts VGAROMs on MXM graphics cards need certain int15h functions present. @@ -184,5 +184,5 @@ index 00000000..f0c203af + +#endif // vgahooks.h -- -2.43.0 +2.39.5 diff --git a/config/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch b/config/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch index bff93e9d..acde7f20 100644 --- a/config/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch +++ b/config/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch @@ -1,7 +1,7 @@ -From ebd8293eb1af20c204beb3aa1394865185e2f3f0 Mon Sep 17 00:00:00 2001 +From cc6b13ddea9086586d34621d0b82d820af5ae785 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 6 Jan 2025 18:49:58 +0000 -Subject: [PATCH 1/1] Print the Libreboot version in the SeaBIOS menu +Subject: [PATCH 3/4] Print the Libreboot version in the SeaBIOS menu Signed-off-by: Leah Rowe --- @@ -9,7 +9,7 @@ Signed-off-by: Leah Rowe 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootsplash.c b/src/bootsplash.c -index 538b316d..8746098c 100644 +index 538b316d..9eed0b12 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -48,7 +48,7 @@ enable_vga_console(void) diff --git a/config/seabios/default/patches/0004-ahci-Only-reset-controller-on-CSM.patch b/config/seabios/default/patches/0004-ahci-Only-reset-controller-on-CSM.patch new file mode 100644 index 00000000..43f2b8a9 --- /dev/null +++ b/config/seabios/default/patches/0004-ahci-Only-reset-controller-on-CSM.patch @@ -0,0 +1,63 @@ +From 5fe2215bc5196d836b54e1e5fb00b63fa096fda7 Mon Sep 17 00:00:00 2001 +From: Leah Rowe +Date: Thu, 1 May 2025 15:46:54 +0100 +Subject: [PATCH 4/4] ahci: Only reset controller on CSM + +Please refer to this commit: + +commit 8863cbbd15a73b03153553c562f5b1fb939ad4d7 +Author: Gerd Hoffmann +Date: Thu Feb 6 12:10:21 2025 +0100 + + ahci: add controller reset + +This commit broke AHCI init on the Lenovo ThinkPad T420, +when tested with SeaBIOS as a coreboot payload. + +Since the above commit was made with CSMs in mind, to make +the AHCI driver work there, that change has been re-worked +so as to only apply when a CSM is in use. + +Signed-off-by: Leah Rowe +--- + src/hw/ahci.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/src/hw/ahci.c b/src/hw/ahci.c +index 2285d33d..b09b198a 100644 +--- a/src/hw/ahci.c ++++ b/src/hw/ahci.c +@@ -637,7 +637,7 @@ static void + ahci_controller_setup(struct pci_device *pci) + { + struct ahci_port_s *port; +- u32 pnr, max; ++ u32 val, pnr, max; + + if (create_bounce_buf() < 0) + return; +@@ -660,8 +660,19 @@ ahci_controller_setup(struct pci_device *pci) + + pci_enable_busmaster(pci); + +- ahci_ctrl_writel(ctrl, HOST_CTL, HOST_CTL_RESET); +- ahci_ctrl_writel(ctrl, HOST_CTL, HOST_CTL_AHCI_EN); ++ /* AHCI controller reset, but only for CSM. Commit 8863cbbd ++ introduced this universally, to make AHCI drivers work in ++ CSM mode, but it broke AHCI setup on the ThinkPad T420 when ++ SeaBIOS is used as a coreboot payload, hence the else clause: */ ++ if (CONFIG_CSM) { ++ /* Enable AHCI controller after resetting its state */ ++ ahci_ctrl_writel(ctrl, HOST_CTL, HOST_CTL_RESET); ++ ahci_ctrl_writel(ctrl, HOST_CTL, HOST_CTL_AHCI_EN); ++ } else { ++ /* Enable AHCI controller from its current state */ ++ val = ahci_ctrl_readl(ctrl, HOST_CTL); ++ ahci_ctrl_writel(ctrl, HOST_CTL, val | HOST_CTL_AHCI_EN); ++ } + + ctrl->caps = ahci_ctrl_readl(ctrl, HOST_CAP); + ctrl->ports = ahci_ctrl_readl(ctrl, HOST_PORTS_IMPL); +-- +2.39.5 + diff --git a/config/seabios/default/target.cfg b/config/seabios/default/target.cfg index 9ff1db3e..92b906f2 100644 --- a/config/seabios/default/target.cfg +++ b/config/seabios/default/target.cfg @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later tree="default" -rev="1602647f1be24fe63d11138d802e735c8e674e63" +rev="9029a010ec413e6c3c0eb52c29c252a5b9a9f774" From 2ae565ba93a84add3dd891e31e894d61cd4be42b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 2 May 2025 05:54:36 +0100 Subject: [PATCH 002/267] init.sh: move setvars/err_ to lib.sh these functions make more sense in lib.sh i made mk link lib.sh first, so that the functions on init.sh can still use them. Signed-off-by: Leah Rowe --- include/init.sh | 21 --------------------- include/lib.sh | 21 +++++++++++++++++++++ mk | 3 ++- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/include/init.sh b/include/init.sh index 1b8432ce..c06d937a 100644 --- a/include/init.sh +++ b/include/init.sh @@ -16,27 +16,6 @@ xbmkpath="$PATH" err="err_" -setvars() -{ - _setvars="" - if [ $# -lt 2 ]; then - printf "\$err \"setvars: too few args\\n\"" - return 0 - fi - val="$1" - shift 1 - for var in "$@"; do - _setvars="$var=\"$val\"; $_setvars" - done - printf "%s\n" "${_setvars% }" -} - -err_() -{ - printf "ERROR %s: %s\n" "$0" "$1" 1>&2 - exit 1 -} - eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \ datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver`" diff --git a/include/lib.sh b/include/lib.sh index 7a5f2621..853ad654 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -115,3 +115,24 @@ check_defconfig() [ -f "$x" ] && printf "%s\n" "$x" && return 1 done; : } + +setvars() +{ + _setvars="" + if [ $# -lt 2 ]; then + printf "\$err \"setvars: too few args\\n\"" + return 0 + fi + val="$1" + shift 1 + for var in "$@"; do + _setvars="$var=\"$val\"; $_setvars" + done + printf "%s\n" "${_setvars% }" +} + +err_() +{ + printf "ERROR %s: %s\n" "$0" "$1" 1>&2 + exit 1 +} diff --git a/mk b/mk index 7b4d69ae..0ae35b6d 100755 --- a/mk +++ b/mk @@ -12,8 +12,9 @@ if [ "./${0##*/}" != "${0}" ] || [ ! -f "mk" ] || [ -L "mk" ]; then exit 1 fi -. "include/init.sh" . "include/lib.sh" + +. "include/init.sh" . "include/inject.sh" . "include/mrc.sh" From 6c4d88f2686558ef910bed2ebcc024d0347076fd Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 2 May 2025 07:24:11 +0100 Subject: [PATCH 003/267] move x_() to lib.sh Signed-off-by: Leah Rowe --- include/init.sh | 5 ----- include/lib.sh | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/init.sh b/include/init.sh index c06d937a..b8839921 100644 --- a/include/init.sh +++ b/include/init.sh @@ -224,9 +224,4 @@ xbmk_child_exec() exit $xbmk_rval } -x_() -{ - [ $# -lt 1 ] || "$@" || $err "Unhandled error for: $(echo "$@")"; : -} - xbmk_init "$@" diff --git a/include/lib.sh b/include/lib.sh index 853ad654..f5007c7d 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -131,6 +131,11 @@ setvars() printf "%s\n" "${_setvars% }" } +x_() +{ + [ $# -lt 1 ] || "$@" || $err "Unhandled error for: $(echo "$@")"; : +} + err_() { printf "ERROR %s: %s\n" "$0" "$1" 1>&2 From f3ae3dbbbe4f9c0ef6a1d68ed1faf7e9ca19f391 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 2 May 2025 07:26:17 +0100 Subject: [PATCH 004/267] lib.sh: simplify remkdir() Signed-off-by: Leah Rowe --- include/lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index f5007c7d..59676150 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -9,8 +9,8 @@ rmodtool="elf/cbfstool/default/rmodtool" remkdir() { - rm -Rf "$1" || $err "remkdir: !rm -Rf \"$1\"" - mkdir -p "$1" || $err "remkdir: !mkdir -p \"$1\"" + x_ rm -Rf "$1" + x_ mkdir -p "$1" } mkrom_tarball() From 15b76bc202f91156b3cc8234ffac1d3901763309 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 2 May 2025 07:26:39 +0100 Subject: [PATCH 005/267] lib.sh: support multiple arguments in remkdir() Signed-off-by: Leah Rowe --- include/lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 59676150..87061f2b 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -9,8 +9,8 @@ rmodtool="elf/cbfstool/default/rmodtool" remkdir() { - x_ rm -Rf "$1" - x_ mkdir -p "$1" + x_ rm -Rf "$@" + x_ mkdir -p "$@" } mkrom_tarball() From acb0ea202f2629c13edc278126f09b043037c8bc Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 2 May 2025 10:52:38 +0100 Subject: [PATCH 006/267] lib.sh: Simplify rmgit() Signed-off-by: Leah Rowe --- include/lib.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 87061f2b..bef2a16f 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -39,11 +39,8 @@ mksha512sum() rmgit() { - ( - cd "$1" || $err "!cd gitrepo $1" - find . -name ".git" -exec rm -Rf {} + || $err "!rm .git $1" - find . -name ".gitmodules" -exec rm -Rf {} + || $err "!rm .gitmod $1" - ) || $err "Cannot remove .git/.gitmodules in $1" + x_ find "$1" -name ".git" -exec rm -Rf {} + + x_ find "$1" -name ".gitmodules" -exec rm -Rf {} + } # can grab from the internet, or copy locally. From 1f7e4b35cb2e95c7bbf1e3d39b10189b26f8d6ed Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 2 May 2025 10:56:14 +0100 Subject: [PATCH 007/267] mk: Download vendorfiles before building release Do it just after creating the src archive. This way, everything is downloaded all at once. Otherwise, a momentary lapse of internet uptime will cause a release build to fail later on, and one of lbmk's flaws is that this would then mean you must re-build from scratch. If we assume that the internet is working within a short period of time, then this change would mitigate that possibility. If something did happen during tar archive creation, that's a much shorter amount of time that is "wasted". Signed-off-by: Leah Rowe --- mk | 1 + 1 file changed, 1 insertion(+) diff --git a/mk b/mk index 0ae35b6d..ec42d097 100755 --- a/mk +++ b/mk @@ -85,6 +85,7 @@ build_release() touch "$srcdir/lock" || $err "can't make lock file in $srcdir/" ( cd "$srcdir" || $err "$vdir: 2 !cd \"$srcdir\"" + x_ ./mk -d coreboot mk -b coreboot pico-serprog stm32-vserprog pcsx-redux x_ mv bin ../roms ) || $err "can't build rom images" From 9b11e93686c6b8298a1b4be912da339ac60ba65f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 2 May 2025 11:20:55 +0100 Subject: [PATCH 008/267] mk: include rom.sh directly remove it from mkhelper files, because rom.sh doesn't initialise any variables globally, except one that never changes. Signed-off-by: Leah Rowe --- config/data/coreboot/mkhelper.cfg | 2 -- config/data/grub/mkhelper.cfg | 2 -- config/data/pcsx-redux/mkhelper.cfg | 2 -- config/data/pico-serprog/mkhelper.cfg | 2 -- config/data/stm32-vserprog/mkhelper.cfg | 2 -- mk | 1 + 6 files changed, 1 insertion(+), 10 deletions(-) diff --git a/config/data/coreboot/mkhelper.cfg b/config/data/coreboot/mkhelper.cfg index 624d4ec2..c993fbd4 100644 --- a/config/data/coreboot/mkhelper.cfg +++ b/config/data/coreboot/mkhelper.cfg @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -. "include/rom.sh" - makeargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" build_depend="seabios/default grub/default memtest86plus u-boot/amd64coreboot" diff --git a/config/data/grub/mkhelper.cfg b/config/data/grub/mkhelper.cfg index 5d66f42f..8c250f6b 100644 --- a/config/data/grub/mkhelper.cfg +++ b/config/data/grub/mkhelper.cfg @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -. "include/rom.sh" - bootstrapargs="--gnulib-srcdir=gnulib/ --no-git" autoconfargs="--with-platform=coreboot --disable-werror" makeargs="FS_PAYLOAD_MODULES=\"\"" diff --git a/config/data/pcsx-redux/mkhelper.cfg b/config/data/pcsx-redux/mkhelper.cfg index af744685..6ad20de5 100644 --- a/config/data/pcsx-redux/mkhelper.cfg +++ b/config/data/pcsx-redux/mkhelper.cfg @@ -1,5 +1,3 @@ # SPDX-License-Identifier: GPL-3.0-or-later -. "include/rom.sh" - postmake="copyps1bios" diff --git a/config/data/pico-serprog/mkhelper.cfg b/config/data/pico-serprog/mkhelper.cfg index ccfdc0df..8e902bda 100644 --- a/config/data/pico-serprog/mkhelper.cfg +++ b/config/data/pico-serprog/mkhelper.cfg @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -. "include/rom.sh" - sersrc="src/pico-serprog" serx="$sersrc/build/pico_serprog.uf2" picosdk="src/pico-sdk" diff --git a/config/data/stm32-vserprog/mkhelper.cfg b/config/data/stm32-vserprog/mkhelper.cfg index 54b05caf..907e890f 100644 --- a/config/data/stm32-vserprog/mkhelper.cfg +++ b/config/data/stm32-vserprog/mkhelper.cfg @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -. "include/rom.sh" - sersrc="src/stm32-vserprog" serx="$sersrc/stm32-vserprog.hex" serdir="$sersrc/boards" diff --git a/mk b/mk index ec42d097..6a46f93c 100755 --- a/mk +++ b/mk @@ -17,6 +17,7 @@ fi . "include/init.sh" . "include/inject.sh" . "include/mrc.sh" +. "include/rom.sh" eval "`setvars "" vdir src_dirname srcdir mode`" From 773d2deaca05cdee754ef4ec79bae9ddd1f3383c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 2 May 2025 17:05:56 +0100 Subject: [PATCH 009/267] NEW MAINBOARD: Dell Precision T1700 SFF and MT This is similar to the 9020SFF, but this board has ECC support. However, the native raminit isn't used here, even though it is otherwise compatible, because the native init doesn't do ECC yet. The broadwell mrc.bin has ECC support, which is also used on the HP EliteBook 820 G2. The MRC for broadwell can be used on haswell boards such as the T1700. Add both the SFF and MT variants. Since these are identical to the 9020 variants, except for slightly different PCH enabling ECC, we can just re-use the 9020 port without issue. We *could* add a variant to coreboot, for T1700, but there is not really any pressing need. It is simply the 9020sff/mt with mrc.bin Signed-off-by: Leah Rowe --- .../config/libgfxinit_corebootfb | 691 ++++++++++++++++++ .../config/libgfxinit_txtmode | 688 +++++++++++++++++ config/coreboot/t1700mt_bmrc_12mb/target.cfg | 12 + .../config/libgfxinit_corebootfb | 691 ++++++++++++++++++ .../config/libgfxinit_txtmode | 688 +++++++++++++++++ config/coreboot/t1700sff_bmrc_12mb/target.cfg | 12 + config/vendor/t1700/pkg.cfg | 9 + include/inject.sh | 2 + include/mrc.sh | 57 +- 9 files changed, 2825 insertions(+), 25 deletions(-) create mode 100644 config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_corebootfb create mode 100644 config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_txtmode create mode 100644 config/coreboot/t1700mt_bmrc_12mb/target.cfg create mode 100644 config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_corebootfb create mode 100644 config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_txtmode create mode 100644 config/coreboot/t1700sff_bmrc_12mb/target.cfg create mode 100644 config/vendor/t1700/pkg.cfg diff --git a/config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_corebootfb b/config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_corebootfb new file mode 100644 index 00000000..969d2c0e --- /dev/null +++ b/config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_corebootfb @@ -0,0 +1,691 @@ +# +# Automatically generated file; DO NOT EDIT. +# coreboot configuration +# + +# +# General setup +# +CONFIG_LOCALVERSION="" +CONFIG_CBFS_PREFIX="fallback" +CONFIG_COMPILER_GCC=y +# CONFIG_COMPILER_LLVM_CLANG is not set +# CONFIG_ANY_TOOLCHAIN is not set +# CONFIG_CCACHE is not set +# CONFIG_LTO is not set +# CONFIG_IWYU is not set +# CONFIG_FMD_GENPARSER is not set +# CONFIG_UTIL_GENPARSER is not set +# CONFIG_OPTION_BACKEND_NONE is not set +CONFIG_USE_OPTION_TABLE=y +# CONFIG_USE_CBFS_FILE_OPTION_BACKEND is not set +CONFIG_STATIC_OPTION_TABLE=y +CONFIG_COMPRESS_RAMSTAGE_LZMA=y +# CONFIG_COMPRESS_RAMSTAGE_LZ4 is not set +CONFIG_SEPARATE_ROMSTAGE=y +CONFIG_INCLUDE_CONFIG_FILE=y +CONFIG_COLLECT_TIMESTAMPS=y +# CONFIG_TIMESTAMPS_ON_CONSOLE is not set +CONFIG_USE_BLOBS=y +# CONFIG_USE_AMD_BLOBS is not set +# CONFIG_USE_QC_BLOBS is not set +# CONFIG_COVERAGE is not set +# CONFIG_UBSAN is not set +CONFIG_HAVE_ASAN_IN_ROMSTAGE=y +CONFIG_HAVE_ASAN_IN_RAMSTAGE=y +# CONFIG_ASAN is not set +CONFIG_NO_STAGE_CACHE=y +# CONFIG_TSEG_STAGE_CACHE is not set +# CONFIG_UPDATE_IMAGE is not set +# CONFIG_BOOTSPLASH_IMAGE is not set + +# +# Software Bill Of Materials (SBOM) +# +# CONFIG_SBOM is not set +# end of Software Bill Of Materials (SBOM) +# end of General setup + +# +# Mainboard +# + +# +# Important: Run 'make distclean' before switching boards +# +# CONFIG_VENDOR_51NB is not set +# CONFIG_VENDOR_ACER is not set +# CONFIG_VENDOR_AMD is not set +# CONFIG_VENDOR_AOOSTAR is not set +# CONFIG_VENDOR_AOPEN is not set +# CONFIG_VENDOR_APPLE is not set +# CONFIG_VENDOR_ARM is not set +# CONFIG_VENDOR_ASROCK is not set +# CONFIG_VENDOR_ASUS is not set +# CONFIG_VENDOR_BIOSTAR is not set +# CONFIG_VENDOR_BOSTENTECH is not set +# CONFIG_VENDOR_BYTEDANCE is not set +# CONFIG_VENDOR_CAVIUM is not set +# CONFIG_VENDOR_CLEVO is not set +# CONFIG_VENDOR_COMPULAB is not set +# CONFIG_VENDOR_CWWK is not set +CONFIG_VENDOR_DELL=y +# CONFIG_VENDOR_EMULATION is not set +# CONFIG_VENDOR_ERYING is not set +# CONFIG_VENDOR_EXAMPLE is not set +# CONFIG_VENDOR_FACEBOOK is not set +# CONFIG_VENDOR_FOXCONN is not set +# CONFIG_VENDOR_FRAMEWORK is not set +# CONFIG_VENDOR_GETAC is not set +# CONFIG_VENDOR_GIGABYTE is not set +# CONFIG_VENDOR_GOOGLE is not set +# CONFIG_VENDOR_HARDKERNEL is not set +# CONFIG_VENDOR_HP is not set +# CONFIG_VENDOR_IBASE is not set +# CONFIG_VENDOR_IBM is not set +# CONFIG_VENDOR_INTEL is not set +# CONFIG_VENDOR_INVENTEC is not set +# CONFIG_VENDOR_KONTRON is not set +# CONFIG_VENDOR_LATTEPANDA is not set +# CONFIG_VENDOR_LENOVO is not set +# CONFIG_VENDOR_LIBRETREND is not set +# CONFIG_VENDOR_MITAC_COMPUTING is not set +# CONFIG_VENDOR_MSI is not set +# CONFIG_VENDOR_NOVACUSTOM is not set +# CONFIG_VENDOR_OCP is not set +# CONFIG_VENDOR_OPENCELLULAR is not set +# CONFIG_VENDOR_PACKARDBELL is not set +# CONFIG_VENDOR_PCENGINES is not set +# CONFIG_VENDOR_PINE64 is not set +# CONFIG_VENDOR_PORTWELL is not set +# CONFIG_VENDOR_PRODRIVE is not set +# CONFIG_VENDOR_PROTECTLI is not set +# CONFIG_VENDOR_PURISM is not set +# CONFIG_VENDOR_RAPTOR_CS is not set +# CONFIG_VENDOR_RAZER is not set +# CONFIG_VENDOR_RODA is not set +# CONFIG_VENDOR_SAMSUNG is not set +# CONFIG_VENDOR_SAPPHIRE is not set +# CONFIG_VENDOR_SIEMENS is not set +# CONFIG_VENDOR_SIFIVE is not set +# CONFIG_VENDOR_STARLABS is not set +# CONFIG_VENDOR_SUPERMICRO is not set +# CONFIG_VENDOR_SYSTEM76 is not set +# CONFIG_VENDOR_TI is not set +# CONFIG_VENDOR_TOPTON is not set +# CONFIG_VENDOR_UP is not set +# CONFIG_VENDOR_VIA is not set +CONFIG_BOARD_SPECIFIC_OPTIONS=y +CONFIG_MAINBOARD_PART_NUMBER="Precision T1700 MT" +CONFIG_MAINBOARD_VERSION="1.0" +CONFIG_MAINBOARD_DIR="dell/optiplex_9020" +CONFIG_VGA_BIOS_ID="8086,0166" +CONFIG_DIMM_MAX=4 +CONFIG_DIMM_SPD_SIZE=256 +CONFIG_FMDFILE="" +# CONFIG_NO_POST is not set +CONFIG_MAINBOARD_VENDOR="Dell Inc." +CONFIG_CBFS_SIZE=0x800000 +CONFIG_CONSOLE_SERIAL=y +CONFIG_LINEAR_FRAMEBUFFER_MAX_HEIGHT=2160 +CONFIG_LINEAR_FRAMEBUFFER_MAX_WIDTH=3840 +CONFIG_MAX_CPUS=8 +# CONFIG_ONBOARD_VGA_IS_PRIMARY is not set +CONFIG_POST_DEVICE=y +CONFIG_POST_IO=y +CONFIG_UART_FOR_CONSOLE=0 +CONFIG_OVERRIDE_DEVICETREE="overridetree_mt.cb" +CONFIG_DEVICETREE="devicetree.cb" +# CONFIG_VBOOT is not set +# CONFIG_VGA_BIOS is not set +CONFIG_PCIEXP_ASPM=y +CONFIG_PCIEXP_L1_SUB_STATE=y +CONFIG_PCIEXP_CLK_PM=y +CONFIG_MAINBOARD_SMBIOS_MANUFACTURER="Dell Inc." +CONFIG_ECAM_MMCONF_BASE_ADDRESS=0xf0000000 +CONFIG_ECAM_MMCONF_BUS_NUMBER=64 +CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld" +# CONFIG_FATAL_ASSERTS is not set +CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt" +CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00 +CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF" +# CONFIG_CONSOLE_POST is not set +CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default" +CONFIG_CMOS_LAYOUT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.layout" +CONFIG_MAX_SOCKET=1 +CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0 +CONFIG_TPM_PIRQ=0x0 +# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set +# CONFIG_BOARD_DELL_E4300 is not set +# CONFIG_BOARD_DELL_E6400 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_3050 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_780_MT is not set +# CONFIG_BOARD_DELL_OPTIPLEX_780_USFF is not set +# CONFIG_BOARD_DELL_OPTIPLEX_9020_SFF is not set +CONFIG_BOARD_DELL_OPTIPLEX_9020_MT=y +# CONFIG_BOARD_DELL_LATITUDE_E5420 is not set +# CONFIG_BOARD_DELL_LATITUDE_E5520 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6220 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6320 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6420 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6520 is not set +# CONFIG_BOARD_DELL_LATITUDE_E5530 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6230 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6330 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6430 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6530 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_9010 is not set +# CONFIG_BOARD_DELL_PRECISION_T1650 is not set +# CONFIG_BOARD_DELL_XPS_8300 is not set +CONFIG_DCACHE_RAM_BASE=0xff7c0000 +CONFIG_DCACHE_RAM_SIZE=0x10000 +CONFIG_C_ENV_BOOTBLOCK_SIZE=0x40000 +CONFIG_DCACHE_BSP_STACK_SIZE=0x2000 +CONFIG_MAX_ACPI_TABLE_SIZE_KB=144 +CONFIG_HAVE_INTEL_FIRMWARE=y +CONFIG_MRC_SETTINGS_CACHE_SIZE=0x10000 +CONFIG_SPI_FLASH_INCLUDE_ALL_DRIVERS=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_DRIVERS_INTEL_WIFI=y +CONFIG_IFD_BIN_PATH="../../../config/ifd/dell9020mt/12_ifd" +CONFIG_ME_BIN_PATH="../../../vendorfiles/t440p/me.bin" +CONFIG_GBE_BIN_PATH="../../../config/ifd/dell9020mt/gbe" +CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x20000 +# CONFIG_ENABLE_DDR_2X_REFRESH is not set +CONFIG_PCIEXP_AER=y +CONFIG_CARDBUS_PLUGIN_SUPPORT=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_STMICRO=y +# CONFIG_DEBUG_SMI is not set +CONFIG_HAVE_IFD_BIN=y +CONFIG_PS2K_EISAID="PNP0303" +CONFIG_PS2M_EISAID="PNP0F13" +CONFIG_GFX_GMA_PANEL_1_PORT="eDP" +CONFIG_TTYS0_BAUD=115200 +CONFIG_D3COLD_SUPPORT=y +CONFIG_GFX_GMA_PANEL_1_ON_EDP=y +CONFIG_DRIVERS_UART_8250IO=y +CONFIG_PC_CMOS_BASE_PORT_BANK1=0x72 +CONFIG_HEAP_SIZE=0x100000 +CONFIG_EC_GPE_SCI=0x50 +CONFIG_EC_STARLABS_BATTERY_MODEL="Unknown" +CONFIG_EC_STARLABS_BATTERY_TYPE="LION" +CONFIG_EC_STARLABS_BATTERY_OEM="Unknown" +# CONFIG_TPM_MEASURED_BOOT is not set +CONFIG_BOARD_ROMSIZE_KB_12288=y +# CONFIG_COREBOOT_ROMSIZE_KB_256 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_512 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_1024 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_2048 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_4096 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_5120 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_6144 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_8192 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_10240 is not set +CONFIG_COREBOOT_ROMSIZE_KB_12288=y +# CONFIG_COREBOOT_ROMSIZE_KB_16384 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_24576 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_32768 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_65536 is not set +CONFIG_COREBOOT_ROMSIZE_KB=12288 +CONFIG_ROM_SIZE=0x00c00000 +CONFIG_HAVE_POWER_STATE_AFTER_FAILURE=y +CONFIG_HAVE_POWER_STATE_PREVIOUS_AFTER_FAILURE=y +CONFIG_POWER_STATE_OFF_AFTER_FAILURE=y +# CONFIG_POWER_STATE_ON_AFTER_FAILURE is not set +# CONFIG_POWER_STATE_PREVIOUS_AFTER_FAILURE is not set +CONFIG_MAINBOARD_POWER_FAILURE_STATE=0 +# end of Mainboard + +# +# Chipset +# + +# +# SoC +# +CONFIG_CHIPSET_DEVICETREE="" +CONFIG_CBFS_MCACHE_SIZE=0x4000 +CONFIG_ROMSTAGE_ADDR=0x2000000 +CONFIG_VERSTAGE_ADDR=0x2000000 +CONFIG_SMM_TSEG_SIZE=0x800000 +CONFIG_SMM_RESERVED_SIZE=0x100000 +CONFIG_SMM_MODULE_STACK_SIZE=0x400 +CONFIG_SERIRQ_CONTINUOUS_MODE=y +CONFIG_PRERAM_CBFS_CACHE_SIZE=0x4000 +CONFIG_DOMAIN_RESOURCE_32BIT_LIMIT=0xf0000000 +CONFIG_EHCI_BAR=0xd8000000 +CONFIG_ACPI_CPU_STRING="CP%02X" +CONFIG_STACK_SIZE=0x2000 +CONFIG_IED_REGION_SIZE=0x400000 +CONFIG_INTEL_GMA_BCLV_OFFSET=0x48254 +CONFIG_INTEL_GMA_BCLV_WIDTH=16 +CONFIG_INTEL_GMA_BCLM_OFFSET=0xc8256 +CONFIG_INTEL_GMA_BCLM_WIDTH=16 +CONFIG_BOOTBLOCK_IN_CBFS=y +CONFIG_HAVE_MRC=y +CONFIG_MRC_FILE="../../../mrc/broadwell/mrc.bin" +CONFIG_DCACHE_RAM_MRC_VAR_SIZE=0x30000 +CONFIG_HPET_MIN_TICKS=0x80 +CONFIG_FIXED_MCHBAR_MMIO_BASE=0xfed10000 +CONFIG_FIXED_DMIBAR_MMIO_BASE=0xfed18000 +CONFIG_FIXED_EPBAR_MMIO_BASE=0xfed19000 +CONFIG_PCIEXP_COMMON_CLOCK=y +CONFIG_DISABLE_ME_PCI=y +CONFIG_CPU_INTEL_NUM_FIT_ENTRIES=6 +CONFIG_SOC_PHYSICAL_ADDRESS_WIDTH=0 +# CONFIG_ALWAYS_ALLOW_ABOVE_4G_ALLOCATION is not set +CONFIG_FIXED_SMBUS_IO_BASE=0x400 +CONFIG_CBFS_CACHE_ALIGN=8 + +# +# CPU +# +CONFIG_CPU_INTEL_HASWELL=y +CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE=y +CONFIG_CPU_INTEL_COMMON=y +CONFIG_ENABLE_VMX=y +CONFIG_SET_IA32_FC_LOCK_BIT=y +CONFIG_SET_MSR_AESNI_LOCK_BIT=y +CONFIG_CPU_INTEL_COMMON_TIMEBASE=y +CONFIG_CPU_INTEL_COMMON_VOLTAGE=y +CONFIG_CPU_INTEL_COMMON_SMM=y +CONFIG_PARALLEL_MP=y +CONFIG_XAPIC_ONLY=y +# CONFIG_X2APIC_ONLY is not set +# CONFIG_X2APIC_RUNTIME is not set +# CONFIG_X2APIC_LATE_WORKAROUND is not set +CONFIG_UDELAY_TSC=y +CONFIG_TSC_MONOTONIC_TIMER=y +CONFIG_TSC_SYNC_MFENCE=y +CONFIG_HAVE_SMI_HANDLER=y +CONFIG_CPU_PT_ROM_MAP_GB=512 +CONFIG_SMM_TSEG=y +CONFIG_SMM_PCI_RESOURCE_STORE_NUM_SLOTS=8 +CONFIG_AP_STACK_SIZE=0x800 +CONFIG_SMP=y +CONFIG_SSE=y +CONFIG_SSE2=y +CONFIG_SUPPORT_CPU_UCODE_IN_CBFS=y +CONFIG_USE_CPU_MICROCODE_CBFS_BINS=y +CONFIG_CPU_MICROCODE_CBFS_DEFAULT_BINS=y +# CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS is not set +# CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER is not set +# CONFIG_CPU_MICROCODE_CBFS_NONE is not set + +# +# Northbridge +# +CONFIG_NORTHBRIDGE_INTEL_HASWELL=y +# CONFIG_USE_NATIVE_RAMINIT is not set +CONFIG_USE_BROADWELL_MRC=y +# CONFIG_HASWELL_HIDE_PEG_FROM_MRC is not set + +# +# Southbridge +# +# CONFIG_PCIEXP_HOTPLUG is not set +CONFIG_INTEL_DESCRIPTOR_MODE_REQUIRED=y +CONFIG_SOUTHBRIDGE_INTEL_LYNXPOINT=y +CONFIG_FINALIZE_USB_ROUTE_XHCI=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RESET=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RTC=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PMCLIB=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PMBASE=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_GPIO=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_EARLY_SMBUS=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SMBUS=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SPI=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SPI_ICH9=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PIRQ_ACPI_GEN=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RCBA_PIRQ=y +CONFIG_HAVE_INTEL_CHIPSET_LOCKDOWN=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_FINALIZE=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_USB_DEBUG=y +CONFIG_INTEL_DESCRIPTOR_MODE_CAPABLE=y +# CONFIG_VALIDATE_INTEL_DESCRIPTOR is not set +CONFIG_INTEL_CHIPSET_LOCKDOWN=y +CONFIG_TCO_SPACE_NOT_YET_SPLIT=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_WATCHDOG=y +CONFIG_FIXED_RCBA_MMIO_BASE=0xfed1c000 +CONFIG_RCBA_LENGTH=0x4000 + +# +# Super I/O +# +CONFIG_SUPERIO_SMSC_SCH555x=y + +# +# Embedded Controllers +# + +# +# Intel Firmware +# +CONFIG_HAVE_ME_BIN=y +# CONFIG_STITCH_ME_BIN is not set +# CONFIG_CHECK_ME is not set +# CONFIG_ME_REGION_ALLOW_CPU_READ_ACCESS is not set +# CONFIG_USE_ME_CLEANER is not set +CONFIG_MAINBOARD_USES_IFD_GBE_REGION=y +CONFIG_HAVE_GBE_BIN=y +# CONFIG_DO_NOT_TOUCH_DESCRIPTOR_REGION is not set +# CONFIG_LOCK_MANAGEMENT_ENGINE is not set +CONFIG_UNLOCK_FLASH_REGIONS=y +CONFIG_ACPI_FNKEY_GEN_SCANCODE=0 +# CONFIG_GOOGLE_PVMFW_CBMEM is not set +CONFIG_ARCH_X86=y +CONFIG_ARCH_BOOTBLOCK_X86_32=y +CONFIG_ARCH_VERSTAGE_X86_32=y +CONFIG_ARCH_ROMSTAGE_X86_32=y +CONFIG_ARCH_POSTCAR_X86_32=y +CONFIG_ARCH_RAMSTAGE_X86_32=y +CONFIG_ARCH_ALL_STAGES_X86_32=y +CONFIG_RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT=y +CONFIG_X86_TOP4G_BOOTMEDIA_MAP=y +CONFIG_POSTRAM_CBFS_CACHE_IN_BSS=y +CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000 +CONFIG_PC80_SYSTEM=y +CONFIG_HAVE_CMOS_DEFAULT=y +CONFIG_POSTCAR_STAGE=y +CONFIG_BOOTBLOCK_SIMPLE=y +# CONFIG_BOOTBLOCK_NORMAL is not set +CONFIG_COLLECT_TIMESTAMPS_TSC=y +CONFIG_HAVE_CF9_RESET=y +CONFIG_DEBUG_HW_BREAKPOINTS=y +CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS=y +# CONFIG_DUMP_SMBIOS_TYPE17 is not set +CONFIG_X86_BOOTBLOCK_EXTRA_PROGRAM_SZ=0 +CONFIG_DEFAULT_EBDA_LOWMEM=0x100000 +CONFIG_DEFAULT_EBDA_SEGMENT=0xF600 +CONFIG_DEFAULT_EBDA_SIZE=0x400 +# end of Chipset + +# +# Devices +# +CONFIG_HAVE_VGA_TEXT_FRAMEBUFFER=y +CONFIG_HAVE_LINEAR_FRAMEBUFFER=y +CONFIG_MAINBOARD_HAS_LIBGFXINIT=y +CONFIG_MAINBOARD_USE_LIBGFXINIT=y +# CONFIG_VGA_ROM_RUN is not set +# CONFIG_NO_GFX_INIT is not set +CONFIG_NO_EARLY_GFX_INIT=y + +# +# Display +# +# CONFIG_VGA_TEXT_FRAMEBUFFER is not set +CONFIG_GENERIC_LINEAR_FRAMEBUFFER=y +CONFIG_LINEAR_FRAMEBUFFER=y +# CONFIG_BOOTSPLASH is not set +CONFIG_DEFAULT_SCREEN_ROTATION_INT=0 +# end of Display + +CONFIG_PCI=y +CONFIG_ECAM_MMCONF_SUPPORT=y +CONFIG_PCIX_PLUGIN_SUPPORT=y +CONFIG_AZALIA_HDA_CODEC_SUPPORT=y +CONFIG_PCIEXP_PLUGIN_SUPPORT=y +CONFIG_ECAM_MMCONF_LENGTH=0x04000000 +CONFIG_PCI_ALLOW_BUS_MASTER=y +CONFIG_PCI_SET_BUS_MASTER_PCI_BRIDGES=y +CONFIG_PCI_ALLOW_BUS_MASTER_ANY_DEVICE=y +# CONFIG_PCIEXP_SUPPORT_RESIZABLE_BARS is not set +# CONFIG_PCIEXP_LANE_ERR_STAT_CLEAR is not set +# CONFIG_EARLY_PCI_BRIDGE is not set +CONFIG_SUBSYSTEM_VENDOR_ID=0x0000 +CONFIG_SUBSYSTEM_DEVICE_ID=0x0000 +CONFIG_INTEL_GMA_HAVE_VBT=y +CONFIG_INTEL_GMA_ADD_VBT=y +# CONFIG_SOFTWARE_I2C is not set +CONFIG_I2C_TRANSFER_TIMEOUT_US=500000 +CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y +CONFIG_USE_DDR3=y +# end of Devices + +# +# Generic Drivers +# +CONFIG_CRB_TPM_BASE_ADDRESS=0xfed40000 +# CONFIG_ELOG is not set +CONFIG_CACHE_MRC_SETTINGS=y +# CONFIG_MRC_SETTINGS_PROTECT is not set +# CONFIG_DRIVERS_OPTION_CFR is not set +# CONFIG_SMMSTORE is not set +CONFIG_SPI_FLASH=y +CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP=y +CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY=y +# CONFIG_SPI_FLASH_NO_FAST_READ is not set +CONFIG_SPI_FLASH_ADESTO=y +CONFIG_SPI_FLASH_AMIC=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_ISSI=y +CONFIG_HAVE_EM100PRO_SPI_CONSOLE_SUPPORT=y +CONFIG_TPM_INIT_RAMSTAGE=y +# CONFIG_TPM_PPI is not set +CONFIG_DRIVERS_UART=y +# CONFIG_DRIVERS_UART_OXPCIE is not set +CONFIG_HAVE_USBDEBUG=y +CONFIG_HAVE_USBDEBUG_OPTIONS=y +# CONFIG_USBDEBUG is not set +# CONFIG_VPD is not set +# CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG is not set +# CONFIG_DRIVERS_GENERIC_CBFS_SERIAL is not set +# CONFIG_DRIVERS_GENERIC_CBFS_UUID is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9750 is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9755 is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9763E is not set +# CONFIG_DRIVERS_I2C_MAX98396 is not set +CONFIG_INTEL_DDI=y +CONFIG_INTEL_INT15=y +CONFIG_INTEL_GMA_ACPI=y +CONFIG_VBT_CBFS_COMPRESSION_LZMA=y +# CONFIG_VBT_CBFS_COMPRESSION_LZ4 is not set +# CONFIG_VBT_CBFS_COMPRESSION_NONE is not set +CONFIG_VBT_CBFS_COMPRESSION_ALGORITHM="lzma" +CONFIG_GFX_GMA=y +CONFIG_GFX_GMA_DYN_CPU=y +CONFIG_GFX_GMA_GENERATION="Haswell" +CONFIG_GFX_GMA_PCH="Lynx_Point" +CONFIG_GFX_GMA_PANEL_2_PORT="Disabled" +CONFIG_GFX_GMA_ANALOG_I2C_PORT="PCH_DAC" +# CONFIG_DRIVERS_NXP_UWB_SR1XX is not set +# CONFIG_DRIVERS_PS2_KEYBOARD is not set +CONFIG_DRIVERS_MC146818=y +# CONFIG_USE_PC_CMOS_ALTCENTURY is not set +CONFIG_PC_CMOS_BASE_PORT_BANK0=0x70 +CONFIG_MEMORY_MAPPED_TPM=y +CONFIG_TPM_TIS_BASE_ADDRESS=0xfed40000 +# CONFIG_DRIVERS_SIL_3114 is not set +CONFIG_DRIVERS_WIFI_GENERIC=y +CONFIG_DRIVERS_MTK_WIFI=y +# end of Generic Drivers + +# +# Security +# + +# +# CBFS verification +# +# CONFIG_CBFS_VERIFICATION is not set +# end of CBFS verification + +# +# Verified Boot (vboot) +# +# end of Verified Boot (vboot) + +# +# Trusted Platform Module +# +CONFIG_TPM1=y +# CONFIG_TPM2 is not set +CONFIG_TPM=y +CONFIG_MAINBOARD_HAS_TPM1=y +# CONFIG_TPM_DEACTIVATE is not set +# CONFIG_DEBUG_TPM is not set +CONFIG_PCR_BOOT_MODE=1 +CONFIG_PCR_HWID=1 +CONFIG_PCR_SRTM=2 +CONFIG_PCR_FW_VER=10 +CONFIG_PCR_RUNTIME_DATA=3 +# end of Trusted Platform Module + +# +# Memory initialization +# +CONFIG_PLATFORM_HAS_DRAM_CLEAR=y +CONFIG_SECURITY_CLEAR_DRAM_ON_REGULAR_BOOT=y +# end of Memory initialization + +# CONFIG_INTEL_TXT is not set +# CONFIG_STM is not set +# CONFIG_INTEL_CBNT_SUPPORT is not set +CONFIG_BOOTMEDIA_LOCK_NONE=y +# CONFIG_BOOTMEDIA_LOCK_CONTROLLER is not set +# CONFIG_BOOTMEDIA_LOCK_CHIP is not set +# CONFIG_BOOTMEDIA_SMM_BWP is not set +# end of Security + +CONFIG_ACPI_HAVE_PCAT_8259=y +CONFIG_ACPI_INTEL_HARDWARE_SLEEP_VALUES=y +CONFIG_ACPI_SOC_NVS=y +CONFIG_ACPI_NO_CUSTOM_MADT=y +CONFIG_ACPI_COMMON_MADT_LAPIC=y +CONFIG_ACPI_COMMON_MADT_IOAPIC=y +CONFIG_HAVE_ACPI_TABLES=y +CONFIG_BOOT_DEVICE_SPI_FLASH=y +CONFIG_BOOT_DEVICE_MEMORY_MAPPED=y +CONFIG_BOOT_DEVICE_SUPPORTS_WRITES=y +CONFIG_RTC=y + +# +# Console +# +CONFIG_BOOTBLOCK_CONSOLE=y +CONFIG_POSTCAR_CONSOLE=y +CONFIG_SQUELCH_EARLY_SMP=y + +# +# I/O mapped, 8250-compatible +# +CONFIG_TTYS0_BASE=0x3f8 + +# +# Serial port base address = 0x3f8 +# +# CONFIG_CONSOLE_SERIAL_921600 is not set +# CONFIG_CONSOLE_SERIAL_460800 is not set +# CONFIG_CONSOLE_SERIAL_230400 is not set +CONFIG_CONSOLE_SERIAL_115200=y +# CONFIG_CONSOLE_SERIAL_57600 is not set +# CONFIG_CONSOLE_SERIAL_38400 is not set +# CONFIG_CONSOLE_SERIAL_19200 is not set +# CONFIG_CONSOLE_SERIAL_9600 is not set +CONFIG_TTYS0_LCS=3 +# CONFIG_SPKMODEM is not set +# CONFIG_CONSOLE_NE2K is not set +CONFIG_CONSOLE_CBMEM=y +# CONFIG_CONSOLE_SPI_FLASH is not set +# CONFIG_CONSOLE_I2C_SMBUS is not set +# CONFIG_EM100PRO_SPI_CONSOLE is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_8 is not set +CONFIG_DEFAULT_CONSOLE_LOGLEVEL_7=y +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_6 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_5 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_4 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_3 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_2 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_1 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0 is not set +CONFIG_DEFAULT_CONSOLE_LOGLEVEL=7 +CONFIG_CONSOLE_USE_LOGLEVEL_PREFIX=y +CONFIG_CONSOLE_USE_ANSI_ESCAPES=y +# CONFIG_CMOS_POST is not set +CONFIG_POST_DEVICE_NONE=y +# CONFIG_POST_DEVICE_LPC is not set +# CONFIG_POST_DEVICE_PCI_PCIE is not set +CONFIG_POST_IO_PORT=0x80 +CONFIG_HWBASE_DEBUG_CB=y +# end of Console + +CONFIG_HAVE_ACPI_RESUME=y +CONFIG_RESUME_PATH_SAME_AS_BOOT=y +CONFIG_HAVE_MONOTONIC_TIMER=y +CONFIG_HAVE_OPTION_TABLE=y +CONFIG_IOAPIC=y +CONFIG_USE_WATCHDOG_ON_BOOT=y + +# +# System tables +# +CONFIG_GENERATE_SMBIOS_TABLES=y +CONFIG_BIOS_VENDOR="coreboot" +CONFIG_MAINBOARD_SERIAL_NUMBER="123456789" +# end of System tables + +# +# Payload +# +CONFIG_PAYLOAD_NONE=y +# end of Payload + +# +# Debugging +# + +# +# CPU Debug Settings +# +# CONFIG_DISPLAY_MTRRS is not set + +# +# Vendorcode Debug Settings +# + +# +# BLOB Debug Settings +# + +# +# General Debug Settings +# +# CONFIG_GDB_STUB is not set +# CONFIG_DEBUG_CBFS is not set +CONFIG_HAVE_DEBUG_SMBUS=y +# CONFIG_DEBUG_SMBUS is not set +# CONFIG_DEBUG_MALLOC is not set +# CONFIG_DEBUG_CONSOLE_INIT is not set +# CONFIG_DEBUG_SPI_FLASH is not set +# CONFIG_DEBUG_BOOT_STATE is not set +# CONFIG_DEBUG_ADA_CODE is not set +CONFIG_HAVE_EM100_SUPPORT=y +# CONFIG_EM100 is not set +# CONFIG_DEBUG_ACPICA_COMPATIBLE is not set +# end of Debugging + +CONFIG_RAMSTAGE_ADA=y +CONFIG_RAMSTAGE_LIBHWBASE=y +CONFIG_HWBASE_DYNAMIC_MMIO=y +CONFIG_HWBASE_DEFAULT_MMCONF=0xf0000000 +CONFIG_HWBASE_DIRECT_PCIDEV=y +CONFIG_DECOMPRESS_OFAST=y + +# +# Boot Logo Configuration +# +# CONFIG_BMP_LOGO is not set +# end of Boot Logo Configuration + +CONFIG_WARNINGS_ARE_ERRORS=y +CONFIG_MAX_REBOOT_CNT=3 +CONFIG_RELOCATABLE_MODULES=y +CONFIG_HAVE_BOOTBLOCK=y +CONFIG_HAVE_ROMSTAGE=y +CONFIG_HAVE_RAMSTAGE=y diff --git a/config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_txtmode b/config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_txtmode new file mode 100644 index 00000000..d16adf1e --- /dev/null +++ b/config/coreboot/t1700mt_bmrc_12mb/config/libgfxinit_txtmode @@ -0,0 +1,688 @@ +# +# Automatically generated file; DO NOT EDIT. +# coreboot configuration +# + +# +# General setup +# +CONFIG_LOCALVERSION="" +CONFIG_CBFS_PREFIX="fallback" +CONFIG_COMPILER_GCC=y +# CONFIG_COMPILER_LLVM_CLANG is not set +# CONFIG_ANY_TOOLCHAIN is not set +# CONFIG_CCACHE is not set +# CONFIG_LTO is not set +# CONFIG_IWYU is not set +# CONFIG_FMD_GENPARSER is not set +# CONFIG_UTIL_GENPARSER is not set +# CONFIG_OPTION_BACKEND_NONE is not set +CONFIG_USE_OPTION_TABLE=y +# CONFIG_USE_CBFS_FILE_OPTION_BACKEND is not set +CONFIG_STATIC_OPTION_TABLE=y +CONFIG_COMPRESS_RAMSTAGE_LZMA=y +# CONFIG_COMPRESS_RAMSTAGE_LZ4 is not set +CONFIG_SEPARATE_ROMSTAGE=y +CONFIG_INCLUDE_CONFIG_FILE=y +CONFIG_COLLECT_TIMESTAMPS=y +# CONFIG_TIMESTAMPS_ON_CONSOLE is not set +CONFIG_USE_BLOBS=y +# CONFIG_USE_AMD_BLOBS is not set +# CONFIG_USE_QC_BLOBS is not set +# CONFIG_COVERAGE is not set +# CONFIG_UBSAN is not set +CONFIG_HAVE_ASAN_IN_ROMSTAGE=y +CONFIG_HAVE_ASAN_IN_RAMSTAGE=y +# CONFIG_ASAN is not set +CONFIG_NO_STAGE_CACHE=y +# CONFIG_TSEG_STAGE_CACHE is not set +# CONFIG_UPDATE_IMAGE is not set +# CONFIG_BOOTSPLASH_IMAGE is not set + +# +# Software Bill Of Materials (SBOM) +# +# CONFIG_SBOM is not set +# end of Software Bill Of Materials (SBOM) +# end of General setup + +# +# Mainboard +# + +# +# Important: Run 'make distclean' before switching boards +# +# CONFIG_VENDOR_51NB is not set +# CONFIG_VENDOR_ACER is not set +# CONFIG_VENDOR_AMD is not set +# CONFIG_VENDOR_AOOSTAR is not set +# CONFIG_VENDOR_AOPEN is not set +# CONFIG_VENDOR_APPLE is not set +# CONFIG_VENDOR_ARM is not set +# CONFIG_VENDOR_ASROCK is not set +# CONFIG_VENDOR_ASUS is not set +# CONFIG_VENDOR_BIOSTAR is not set +# CONFIG_VENDOR_BOSTENTECH is not set +# CONFIG_VENDOR_BYTEDANCE is not set +# CONFIG_VENDOR_CAVIUM is not set +# CONFIG_VENDOR_CLEVO is not set +# CONFIG_VENDOR_COMPULAB is not set +# CONFIG_VENDOR_CWWK is not set +CONFIG_VENDOR_DELL=y +# CONFIG_VENDOR_EMULATION is not set +# CONFIG_VENDOR_ERYING is not set +# CONFIG_VENDOR_EXAMPLE is not set +# CONFIG_VENDOR_FACEBOOK is not set +# CONFIG_VENDOR_FOXCONN is not set +# CONFIG_VENDOR_FRAMEWORK is not set +# CONFIG_VENDOR_GETAC is not set +# CONFIG_VENDOR_GIGABYTE is not set +# CONFIG_VENDOR_GOOGLE is not set +# CONFIG_VENDOR_HARDKERNEL is not set +# CONFIG_VENDOR_HP is not set +# CONFIG_VENDOR_IBASE is not set +# CONFIG_VENDOR_IBM is not set +# CONFIG_VENDOR_INTEL is not set +# CONFIG_VENDOR_INVENTEC is not set +# CONFIG_VENDOR_KONTRON is not set +# CONFIG_VENDOR_LATTEPANDA is not set +# CONFIG_VENDOR_LENOVO is not set +# CONFIG_VENDOR_LIBRETREND is not set +# CONFIG_VENDOR_MITAC_COMPUTING is not set +# CONFIG_VENDOR_MSI is not set +# CONFIG_VENDOR_NOVACUSTOM is not set +# CONFIG_VENDOR_OCP is not set +# CONFIG_VENDOR_OPENCELLULAR is not set +# CONFIG_VENDOR_PACKARDBELL is not set +# CONFIG_VENDOR_PCENGINES is not set +# CONFIG_VENDOR_PINE64 is not set +# CONFIG_VENDOR_PORTWELL is not set +# CONFIG_VENDOR_PRODRIVE is not set +# CONFIG_VENDOR_PROTECTLI is not set +# CONFIG_VENDOR_PURISM is not set +# CONFIG_VENDOR_RAPTOR_CS is not set +# CONFIG_VENDOR_RAZER is not set +# CONFIG_VENDOR_RODA is not set +# CONFIG_VENDOR_SAMSUNG is not set +# CONFIG_VENDOR_SAPPHIRE is not set +# CONFIG_VENDOR_SIEMENS is not set +# CONFIG_VENDOR_SIFIVE is not set +# CONFIG_VENDOR_STARLABS is not set +# CONFIG_VENDOR_SUPERMICRO is not set +# CONFIG_VENDOR_SYSTEM76 is not set +# CONFIG_VENDOR_TI is not set +# CONFIG_VENDOR_TOPTON is not set +# CONFIG_VENDOR_UP is not set +# CONFIG_VENDOR_VIA is not set +CONFIG_BOARD_SPECIFIC_OPTIONS=y +CONFIG_MAINBOARD_PART_NUMBER="Precision T1700 MT" +CONFIG_MAINBOARD_VERSION="1.0" +CONFIG_MAINBOARD_DIR="dell/optiplex_9020" +CONFIG_VGA_BIOS_ID="8086,0166" +CONFIG_DIMM_MAX=4 +CONFIG_DIMM_SPD_SIZE=256 +CONFIG_FMDFILE="" +# CONFIG_NO_POST is not set +CONFIG_MAINBOARD_VENDOR="Dell Inc." +CONFIG_CBFS_SIZE=0x800000 +CONFIG_CONSOLE_SERIAL=y +CONFIG_MAX_CPUS=8 +# CONFIG_ONBOARD_VGA_IS_PRIMARY is not set +CONFIG_POST_DEVICE=y +CONFIG_POST_IO=y +CONFIG_UART_FOR_CONSOLE=0 +CONFIG_OVERRIDE_DEVICETREE="overridetree_mt.cb" +CONFIG_DEVICETREE="devicetree.cb" +# CONFIG_VBOOT is not set +# CONFIG_VGA_BIOS is not set +CONFIG_PCIEXP_ASPM=y +CONFIG_PCIEXP_L1_SUB_STATE=y +CONFIG_PCIEXP_CLK_PM=y +CONFIG_MAINBOARD_SMBIOS_MANUFACTURER="Dell Inc." +CONFIG_ECAM_MMCONF_BASE_ADDRESS=0xf0000000 +CONFIG_ECAM_MMCONF_BUS_NUMBER=64 +CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld" +# CONFIG_FATAL_ASSERTS is not set +CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt" +CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00 +CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF" +# CONFIG_CONSOLE_POST is not set +CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default" +CONFIG_CMOS_LAYOUT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.layout" +CONFIG_MAX_SOCKET=1 +CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0 +CONFIG_TPM_PIRQ=0x0 +# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set +# CONFIG_BOARD_DELL_E4300 is not set +# CONFIG_BOARD_DELL_E6400 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_3050 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_780_MT is not set +# CONFIG_BOARD_DELL_OPTIPLEX_780_USFF is not set +# CONFIG_BOARD_DELL_OPTIPLEX_9020_SFF is not set +CONFIG_BOARD_DELL_OPTIPLEX_9020_MT=y +# CONFIG_BOARD_DELL_LATITUDE_E5420 is not set +# CONFIG_BOARD_DELL_LATITUDE_E5520 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6220 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6320 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6420 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6520 is not set +# CONFIG_BOARD_DELL_LATITUDE_E5530 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6230 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6330 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6430 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6530 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_9010 is not set +# CONFIG_BOARD_DELL_PRECISION_T1650 is not set +# CONFIG_BOARD_DELL_XPS_8300 is not set +CONFIG_DCACHE_RAM_BASE=0xff7c0000 +CONFIG_DCACHE_RAM_SIZE=0x10000 +CONFIG_C_ENV_BOOTBLOCK_SIZE=0x40000 +CONFIG_DCACHE_BSP_STACK_SIZE=0x2000 +CONFIG_MAX_ACPI_TABLE_SIZE_KB=144 +CONFIG_HAVE_INTEL_FIRMWARE=y +CONFIG_MRC_SETTINGS_CACHE_SIZE=0x10000 +CONFIG_SPI_FLASH_INCLUDE_ALL_DRIVERS=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_DRIVERS_INTEL_WIFI=y +CONFIG_IFD_BIN_PATH="../../../config/ifd/dell9020mt/12_ifd" +CONFIG_ME_BIN_PATH="../../../vendorfiles/t440p/me.bin" +CONFIG_GBE_BIN_PATH="../../../config/ifd/dell9020mt/gbe" +CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x20000 +# CONFIG_ENABLE_DDR_2X_REFRESH is not set +CONFIG_PCIEXP_AER=y +CONFIG_CARDBUS_PLUGIN_SUPPORT=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_STMICRO=y +# CONFIG_DEBUG_SMI is not set +CONFIG_HAVE_IFD_BIN=y +CONFIG_PS2K_EISAID="PNP0303" +CONFIG_PS2M_EISAID="PNP0F13" +CONFIG_GFX_GMA_PANEL_1_PORT="eDP" +CONFIG_TTYS0_BAUD=115200 +CONFIG_D3COLD_SUPPORT=y +CONFIG_GFX_GMA_PANEL_1_ON_EDP=y +CONFIG_DRIVERS_UART_8250IO=y +CONFIG_PC_CMOS_BASE_PORT_BANK1=0x72 +CONFIG_HEAP_SIZE=0x100000 +CONFIG_EC_GPE_SCI=0x50 +CONFIG_EC_STARLABS_BATTERY_MODEL="Unknown" +CONFIG_EC_STARLABS_BATTERY_TYPE="LION" +CONFIG_EC_STARLABS_BATTERY_OEM="Unknown" +# CONFIG_TPM_MEASURED_BOOT is not set +CONFIG_BOARD_ROMSIZE_KB_12288=y +# CONFIG_COREBOOT_ROMSIZE_KB_256 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_512 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_1024 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_2048 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_4096 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_5120 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_6144 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_8192 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_10240 is not set +CONFIG_COREBOOT_ROMSIZE_KB_12288=y +# CONFIG_COREBOOT_ROMSIZE_KB_16384 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_24576 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_32768 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_65536 is not set +CONFIG_COREBOOT_ROMSIZE_KB=12288 +CONFIG_ROM_SIZE=0x00c00000 +CONFIG_HAVE_POWER_STATE_AFTER_FAILURE=y +CONFIG_HAVE_POWER_STATE_PREVIOUS_AFTER_FAILURE=y +CONFIG_POWER_STATE_OFF_AFTER_FAILURE=y +# CONFIG_POWER_STATE_ON_AFTER_FAILURE is not set +# CONFIG_POWER_STATE_PREVIOUS_AFTER_FAILURE is not set +CONFIG_MAINBOARD_POWER_FAILURE_STATE=0 +# end of Mainboard + +# +# Chipset +# + +# +# SoC +# +CONFIG_CHIPSET_DEVICETREE="" +CONFIG_CBFS_MCACHE_SIZE=0x4000 +CONFIG_ROMSTAGE_ADDR=0x2000000 +CONFIG_VERSTAGE_ADDR=0x2000000 +CONFIG_SMM_TSEG_SIZE=0x800000 +CONFIG_SMM_RESERVED_SIZE=0x100000 +CONFIG_SMM_MODULE_STACK_SIZE=0x400 +CONFIG_SERIRQ_CONTINUOUS_MODE=y +CONFIG_PRERAM_CBFS_CACHE_SIZE=0x4000 +CONFIG_DOMAIN_RESOURCE_32BIT_LIMIT=0xf0000000 +CONFIG_EHCI_BAR=0xd8000000 +CONFIG_ACPI_CPU_STRING="CP%02X" +CONFIG_STACK_SIZE=0x2000 +CONFIG_IED_REGION_SIZE=0x400000 +CONFIG_INTEL_GMA_BCLV_OFFSET=0x48254 +CONFIG_INTEL_GMA_BCLV_WIDTH=16 +CONFIG_INTEL_GMA_BCLM_OFFSET=0xc8256 +CONFIG_INTEL_GMA_BCLM_WIDTH=16 +CONFIG_BOOTBLOCK_IN_CBFS=y +CONFIG_HAVE_MRC=y +CONFIG_MRC_FILE="../../../mrc/broadwell/mrc.bin" +CONFIG_DCACHE_RAM_MRC_VAR_SIZE=0x30000 +CONFIG_HPET_MIN_TICKS=0x80 +CONFIG_FIXED_MCHBAR_MMIO_BASE=0xfed10000 +CONFIG_FIXED_DMIBAR_MMIO_BASE=0xfed18000 +CONFIG_FIXED_EPBAR_MMIO_BASE=0xfed19000 +CONFIG_PCIEXP_COMMON_CLOCK=y +CONFIG_DISABLE_ME_PCI=y +CONFIG_CPU_INTEL_NUM_FIT_ENTRIES=6 +CONFIG_SOC_PHYSICAL_ADDRESS_WIDTH=0 +# CONFIG_ALWAYS_ALLOW_ABOVE_4G_ALLOCATION is not set +CONFIG_FIXED_SMBUS_IO_BASE=0x400 +CONFIG_CBFS_CACHE_ALIGN=8 + +# +# CPU +# +CONFIG_CPU_INTEL_HASWELL=y +CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE=y +CONFIG_CPU_INTEL_COMMON=y +CONFIG_ENABLE_VMX=y +CONFIG_SET_IA32_FC_LOCK_BIT=y +CONFIG_SET_MSR_AESNI_LOCK_BIT=y +CONFIG_CPU_INTEL_COMMON_TIMEBASE=y +CONFIG_CPU_INTEL_COMMON_VOLTAGE=y +CONFIG_CPU_INTEL_COMMON_SMM=y +CONFIG_PARALLEL_MP=y +CONFIG_XAPIC_ONLY=y +# CONFIG_X2APIC_ONLY is not set +# CONFIG_X2APIC_RUNTIME is not set +# CONFIG_X2APIC_LATE_WORKAROUND is not set +CONFIG_UDELAY_TSC=y +CONFIG_TSC_MONOTONIC_TIMER=y +CONFIG_TSC_SYNC_MFENCE=y +CONFIG_HAVE_SMI_HANDLER=y +CONFIG_CPU_PT_ROM_MAP_GB=512 +CONFIG_SMM_TSEG=y +CONFIG_SMM_PCI_RESOURCE_STORE_NUM_SLOTS=8 +CONFIG_AP_STACK_SIZE=0x800 +CONFIG_SMP=y +CONFIG_SSE=y +CONFIG_SSE2=y +CONFIG_SUPPORT_CPU_UCODE_IN_CBFS=y +CONFIG_USE_CPU_MICROCODE_CBFS_BINS=y +CONFIG_CPU_MICROCODE_CBFS_DEFAULT_BINS=y +# CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS is not set +# CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER is not set +# CONFIG_CPU_MICROCODE_CBFS_NONE is not set + +# +# Northbridge +# +CONFIG_NORTHBRIDGE_INTEL_HASWELL=y +# CONFIG_USE_NATIVE_RAMINIT is not set +CONFIG_USE_BROADWELL_MRC=y +# CONFIG_HASWELL_HIDE_PEG_FROM_MRC is not set + +# +# Southbridge +# +# CONFIG_PCIEXP_HOTPLUG is not set +CONFIG_INTEL_DESCRIPTOR_MODE_REQUIRED=y +CONFIG_SOUTHBRIDGE_INTEL_LYNXPOINT=y +CONFIG_FINALIZE_USB_ROUTE_XHCI=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RESET=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RTC=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PMCLIB=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PMBASE=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_GPIO=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_EARLY_SMBUS=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SMBUS=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SPI=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SPI_ICH9=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PIRQ_ACPI_GEN=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RCBA_PIRQ=y +CONFIG_HAVE_INTEL_CHIPSET_LOCKDOWN=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_FINALIZE=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_USB_DEBUG=y +CONFIG_INTEL_DESCRIPTOR_MODE_CAPABLE=y +# CONFIG_VALIDATE_INTEL_DESCRIPTOR is not set +CONFIG_INTEL_CHIPSET_LOCKDOWN=y +CONFIG_TCO_SPACE_NOT_YET_SPLIT=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_WATCHDOG=y +CONFIG_FIXED_RCBA_MMIO_BASE=0xfed1c000 +CONFIG_RCBA_LENGTH=0x4000 + +# +# Super I/O +# +CONFIG_SUPERIO_SMSC_SCH555x=y + +# +# Embedded Controllers +# + +# +# Intel Firmware +# +CONFIG_HAVE_ME_BIN=y +# CONFIG_STITCH_ME_BIN is not set +# CONFIG_CHECK_ME is not set +# CONFIG_ME_REGION_ALLOW_CPU_READ_ACCESS is not set +# CONFIG_USE_ME_CLEANER is not set +CONFIG_MAINBOARD_USES_IFD_GBE_REGION=y +CONFIG_HAVE_GBE_BIN=y +# CONFIG_DO_NOT_TOUCH_DESCRIPTOR_REGION is not set +# CONFIG_LOCK_MANAGEMENT_ENGINE is not set +CONFIG_UNLOCK_FLASH_REGIONS=y +CONFIG_ACPI_FNKEY_GEN_SCANCODE=0 +# CONFIG_GOOGLE_PVMFW_CBMEM is not set +CONFIG_ARCH_X86=y +CONFIG_ARCH_BOOTBLOCK_X86_32=y +CONFIG_ARCH_VERSTAGE_X86_32=y +CONFIG_ARCH_ROMSTAGE_X86_32=y +CONFIG_ARCH_POSTCAR_X86_32=y +CONFIG_ARCH_RAMSTAGE_X86_32=y +CONFIG_ARCH_ALL_STAGES_X86_32=y +CONFIG_RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT=y +CONFIG_X86_TOP4G_BOOTMEDIA_MAP=y +CONFIG_POSTRAM_CBFS_CACHE_IN_BSS=y +CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000 +CONFIG_PC80_SYSTEM=y +CONFIG_HAVE_CMOS_DEFAULT=y +CONFIG_POSTCAR_STAGE=y +CONFIG_BOOTBLOCK_SIMPLE=y +# CONFIG_BOOTBLOCK_NORMAL is not set +CONFIG_COLLECT_TIMESTAMPS_TSC=y +CONFIG_HAVE_CF9_RESET=y +CONFIG_DEBUG_HW_BREAKPOINTS=y +CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS=y +# CONFIG_DUMP_SMBIOS_TYPE17 is not set +CONFIG_X86_BOOTBLOCK_EXTRA_PROGRAM_SZ=0 +CONFIG_DEFAULT_EBDA_LOWMEM=0x100000 +CONFIG_DEFAULT_EBDA_SEGMENT=0xF600 +CONFIG_DEFAULT_EBDA_SIZE=0x400 +# end of Chipset + +# +# Devices +# +CONFIG_HAVE_VGA_TEXT_FRAMEBUFFER=y +CONFIG_HAVE_LINEAR_FRAMEBUFFER=y +CONFIG_MAINBOARD_HAS_LIBGFXINIT=y +CONFIG_MAINBOARD_USE_LIBGFXINIT=y +# CONFIG_VGA_ROM_RUN is not set +# CONFIG_NO_GFX_INIT is not set +CONFIG_NO_EARLY_GFX_INIT=y + +# +# Display +# +CONFIG_VGA_TEXT_FRAMEBUFFER=y +# CONFIG_GENERIC_LINEAR_FRAMEBUFFER is not set +CONFIG_DEFAULT_SCREEN_ROTATION_INT=0 +# end of Display + +CONFIG_PCI=y +CONFIG_ECAM_MMCONF_SUPPORT=y +CONFIG_PCIX_PLUGIN_SUPPORT=y +CONFIG_AZALIA_HDA_CODEC_SUPPORT=y +CONFIG_PCIEXP_PLUGIN_SUPPORT=y +CONFIG_ECAM_MMCONF_LENGTH=0x04000000 +CONFIG_PCI_ALLOW_BUS_MASTER=y +CONFIG_PCI_SET_BUS_MASTER_PCI_BRIDGES=y +CONFIG_PCI_ALLOW_BUS_MASTER_ANY_DEVICE=y +# CONFIG_PCIEXP_SUPPORT_RESIZABLE_BARS is not set +# CONFIG_PCIEXP_LANE_ERR_STAT_CLEAR is not set +# CONFIG_EARLY_PCI_BRIDGE is not set +CONFIG_SUBSYSTEM_VENDOR_ID=0x0000 +CONFIG_SUBSYSTEM_DEVICE_ID=0x0000 +CONFIG_INTEL_GMA_HAVE_VBT=y +CONFIG_INTEL_GMA_ADD_VBT=y +# CONFIG_SOFTWARE_I2C is not set +CONFIG_I2C_TRANSFER_TIMEOUT_US=500000 +CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y +CONFIG_USE_DDR3=y +# end of Devices + +# +# Generic Drivers +# +CONFIG_CRB_TPM_BASE_ADDRESS=0xfed40000 +# CONFIG_ELOG is not set +CONFIG_CACHE_MRC_SETTINGS=y +# CONFIG_MRC_SETTINGS_PROTECT is not set +# CONFIG_DRIVERS_OPTION_CFR is not set +# CONFIG_SMMSTORE is not set +CONFIG_SPI_FLASH=y +CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP=y +CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY=y +# CONFIG_SPI_FLASH_NO_FAST_READ is not set +CONFIG_SPI_FLASH_ADESTO=y +CONFIG_SPI_FLASH_AMIC=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_ISSI=y +CONFIG_HAVE_EM100PRO_SPI_CONSOLE_SUPPORT=y +CONFIG_TPM_INIT_RAMSTAGE=y +# CONFIG_TPM_PPI is not set +CONFIG_DRIVERS_UART=y +# CONFIG_DRIVERS_UART_OXPCIE is not set +CONFIG_HAVE_USBDEBUG=y +CONFIG_HAVE_USBDEBUG_OPTIONS=y +# CONFIG_USBDEBUG is not set +# CONFIG_VPD is not set +# CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG is not set +# CONFIG_DRIVERS_GENERIC_CBFS_SERIAL is not set +# CONFIG_DRIVERS_GENERIC_CBFS_UUID is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9750 is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9755 is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9763E is not set +# CONFIG_DRIVERS_I2C_MAX98396 is not set +CONFIG_INTEL_DDI=y +CONFIG_INTEL_INT15=y +CONFIG_INTEL_GMA_ACPI=y +CONFIG_VBT_CBFS_COMPRESSION_LZMA=y +# CONFIG_VBT_CBFS_COMPRESSION_LZ4 is not set +# CONFIG_VBT_CBFS_COMPRESSION_NONE is not set +CONFIG_VBT_CBFS_COMPRESSION_ALGORITHM="lzma" +CONFIG_GFX_GMA=y +CONFIG_GFX_GMA_DYN_CPU=y +CONFIG_GFX_GMA_GENERATION="Haswell" +CONFIG_GFX_GMA_PCH="Lynx_Point" +CONFIG_GFX_GMA_PANEL_2_PORT="Disabled" +CONFIG_GFX_GMA_ANALOG_I2C_PORT="PCH_DAC" +# CONFIG_DRIVERS_NXP_UWB_SR1XX is not set +# CONFIG_DRIVERS_PS2_KEYBOARD is not set +CONFIG_DRIVERS_MC146818=y +# CONFIG_USE_PC_CMOS_ALTCENTURY is not set +CONFIG_PC_CMOS_BASE_PORT_BANK0=0x70 +CONFIG_MEMORY_MAPPED_TPM=y +CONFIG_TPM_TIS_BASE_ADDRESS=0xfed40000 +CONFIG_VGA=y +# CONFIG_DRIVERS_SIL_3114 is not set +CONFIG_DRIVERS_WIFI_GENERIC=y +CONFIG_DRIVERS_MTK_WIFI=y +# end of Generic Drivers + +# +# Security +# + +# +# CBFS verification +# +# CONFIG_CBFS_VERIFICATION is not set +# end of CBFS verification + +# +# Verified Boot (vboot) +# +# end of Verified Boot (vboot) + +# +# Trusted Platform Module +# +CONFIG_TPM1=y +# CONFIG_TPM2 is not set +CONFIG_TPM=y +CONFIG_MAINBOARD_HAS_TPM1=y +# CONFIG_TPM_DEACTIVATE is not set +# CONFIG_DEBUG_TPM is not set +CONFIG_PCR_BOOT_MODE=1 +CONFIG_PCR_HWID=1 +CONFIG_PCR_SRTM=2 +CONFIG_PCR_FW_VER=10 +CONFIG_PCR_RUNTIME_DATA=3 +# end of Trusted Platform Module + +# +# Memory initialization +# +CONFIG_PLATFORM_HAS_DRAM_CLEAR=y +CONFIG_SECURITY_CLEAR_DRAM_ON_REGULAR_BOOT=y +# end of Memory initialization + +# CONFIG_INTEL_TXT is not set +# CONFIG_STM is not set +# CONFIG_INTEL_CBNT_SUPPORT is not set +CONFIG_BOOTMEDIA_LOCK_NONE=y +# CONFIG_BOOTMEDIA_LOCK_CONTROLLER is not set +# CONFIG_BOOTMEDIA_LOCK_CHIP is not set +# CONFIG_BOOTMEDIA_SMM_BWP is not set +# end of Security + +CONFIG_ACPI_HAVE_PCAT_8259=y +CONFIG_ACPI_INTEL_HARDWARE_SLEEP_VALUES=y +CONFIG_ACPI_SOC_NVS=y +CONFIG_ACPI_NO_CUSTOM_MADT=y +CONFIG_ACPI_COMMON_MADT_LAPIC=y +CONFIG_ACPI_COMMON_MADT_IOAPIC=y +CONFIG_HAVE_ACPI_TABLES=y +CONFIG_BOOT_DEVICE_SPI_FLASH=y +CONFIG_BOOT_DEVICE_MEMORY_MAPPED=y +CONFIG_BOOT_DEVICE_SUPPORTS_WRITES=y +CONFIG_RTC=y + +# +# Console +# +CONFIG_BOOTBLOCK_CONSOLE=y +CONFIG_POSTCAR_CONSOLE=y +CONFIG_SQUELCH_EARLY_SMP=y + +# +# I/O mapped, 8250-compatible +# +CONFIG_TTYS0_BASE=0x3f8 + +# +# Serial port base address = 0x3f8 +# +# CONFIG_CONSOLE_SERIAL_921600 is not set +# CONFIG_CONSOLE_SERIAL_460800 is not set +# CONFIG_CONSOLE_SERIAL_230400 is not set +CONFIG_CONSOLE_SERIAL_115200=y +# CONFIG_CONSOLE_SERIAL_57600 is not set +# CONFIG_CONSOLE_SERIAL_38400 is not set +# CONFIG_CONSOLE_SERIAL_19200 is not set +# CONFIG_CONSOLE_SERIAL_9600 is not set +CONFIG_TTYS0_LCS=3 +# CONFIG_SPKMODEM is not set +# CONFIG_CONSOLE_NE2K is not set +CONFIG_CONSOLE_CBMEM=y +# CONFIG_CONSOLE_SPI_FLASH is not set +# CONFIG_CONSOLE_I2C_SMBUS is not set +# CONFIG_EM100PRO_SPI_CONSOLE is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_8 is not set +CONFIG_DEFAULT_CONSOLE_LOGLEVEL_7=y +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_6 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_5 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_4 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_3 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_2 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_1 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0 is not set +CONFIG_DEFAULT_CONSOLE_LOGLEVEL=7 +CONFIG_CONSOLE_USE_LOGLEVEL_PREFIX=y +CONFIG_CONSOLE_USE_ANSI_ESCAPES=y +# CONFIG_CMOS_POST is not set +CONFIG_POST_DEVICE_NONE=y +# CONFIG_POST_DEVICE_LPC is not set +# CONFIG_POST_DEVICE_PCI_PCIE is not set +CONFIG_POST_IO_PORT=0x80 +CONFIG_HWBASE_DEBUG_CB=y +# end of Console + +CONFIG_HAVE_ACPI_RESUME=y +CONFIG_RESUME_PATH_SAME_AS_BOOT=y +CONFIG_HAVE_MONOTONIC_TIMER=y +CONFIG_HAVE_OPTION_TABLE=y +CONFIG_IOAPIC=y +CONFIG_USE_WATCHDOG_ON_BOOT=y + +# +# System tables +# +CONFIG_GENERATE_SMBIOS_TABLES=y +CONFIG_BIOS_VENDOR="coreboot" +CONFIG_MAINBOARD_SERIAL_NUMBER="123456789" +# end of System tables + +# +# Payload +# +CONFIG_PAYLOAD_NONE=y +# end of Payload + +# +# Debugging +# + +# +# CPU Debug Settings +# +# CONFIG_DISPLAY_MTRRS is not set + +# +# Vendorcode Debug Settings +# + +# +# BLOB Debug Settings +# + +# +# General Debug Settings +# +# CONFIG_GDB_STUB is not set +# CONFIG_DEBUG_CBFS is not set +CONFIG_HAVE_DEBUG_SMBUS=y +# CONFIG_DEBUG_SMBUS is not set +# CONFIG_DEBUG_MALLOC is not set +# CONFIG_DEBUG_CONSOLE_INIT is not set +# CONFIG_DEBUG_SPI_FLASH is not set +# CONFIG_DEBUG_BOOT_STATE is not set +# CONFIG_DEBUG_ADA_CODE is not set +CONFIG_HAVE_EM100_SUPPORT=y +# CONFIG_EM100 is not set +# CONFIG_DEBUG_ACPICA_COMPATIBLE is not set +# end of Debugging + +CONFIG_RAMSTAGE_ADA=y +CONFIG_RAMSTAGE_LIBHWBASE=y +CONFIG_HWBASE_DYNAMIC_MMIO=y +CONFIG_HWBASE_DEFAULT_MMCONF=0xf0000000 +CONFIG_HWBASE_DIRECT_PCIDEV=y +CONFIG_DECOMPRESS_OFAST=y + +# +# Boot Logo Configuration +# +# CONFIG_BMP_LOGO is not set +# end of Boot Logo Configuration + +CONFIG_WARNINGS_ARE_ERRORS=y +CONFIG_MAX_REBOOT_CNT=3 +CONFIG_RELOCATABLE_MODULES=y +CONFIG_HAVE_BOOTBLOCK=y +CONFIG_HAVE_ROMSTAGE=y +CONFIG_HAVE_RAMSTAGE=y diff --git a/config/coreboot/t1700mt_bmrc_12mb/target.cfg b/config/coreboot/t1700mt_bmrc_12mb/target.cfg new file mode 100644 index 00000000..06de408c --- /dev/null +++ b/config/coreboot/t1700mt_bmrc_12mb/target.cfg @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +tree="default" +xarch="i386-elf" +payload_seabios="y" +payload_grub="y" +payload_memtest="y" +grub_scan_disk="nvme ahci" +grubtree="xhci" +vcfg="t1700" +build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" +payload_uboot_amd64="y" diff --git a/config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_corebootfb b/config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_corebootfb new file mode 100644 index 00000000..56f97e4c --- /dev/null +++ b/config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_corebootfb @@ -0,0 +1,691 @@ +# +# Automatically generated file; DO NOT EDIT. +# coreboot configuration +# + +# +# General setup +# +CONFIG_LOCALVERSION="" +CONFIG_CBFS_PREFIX="fallback" +CONFIG_COMPILER_GCC=y +# CONFIG_COMPILER_LLVM_CLANG is not set +# CONFIG_ANY_TOOLCHAIN is not set +# CONFIG_CCACHE is not set +# CONFIG_LTO is not set +# CONFIG_IWYU is not set +# CONFIG_FMD_GENPARSER is not set +# CONFIG_UTIL_GENPARSER is not set +# CONFIG_OPTION_BACKEND_NONE is not set +CONFIG_USE_OPTION_TABLE=y +# CONFIG_USE_CBFS_FILE_OPTION_BACKEND is not set +CONFIG_STATIC_OPTION_TABLE=y +CONFIG_COMPRESS_RAMSTAGE_LZMA=y +# CONFIG_COMPRESS_RAMSTAGE_LZ4 is not set +CONFIG_SEPARATE_ROMSTAGE=y +CONFIG_INCLUDE_CONFIG_FILE=y +CONFIG_COLLECT_TIMESTAMPS=y +# CONFIG_TIMESTAMPS_ON_CONSOLE is not set +CONFIG_USE_BLOBS=y +# CONFIG_USE_AMD_BLOBS is not set +# CONFIG_USE_QC_BLOBS is not set +# CONFIG_COVERAGE is not set +# CONFIG_UBSAN is not set +CONFIG_HAVE_ASAN_IN_ROMSTAGE=y +CONFIG_HAVE_ASAN_IN_RAMSTAGE=y +# CONFIG_ASAN is not set +CONFIG_NO_STAGE_CACHE=y +# CONFIG_TSEG_STAGE_CACHE is not set +# CONFIG_UPDATE_IMAGE is not set +# CONFIG_BOOTSPLASH_IMAGE is not set + +# +# Software Bill Of Materials (SBOM) +# +# CONFIG_SBOM is not set +# end of Software Bill Of Materials (SBOM) +# end of General setup + +# +# Mainboard +# + +# +# Important: Run 'make distclean' before switching boards +# +# CONFIG_VENDOR_51NB is not set +# CONFIG_VENDOR_ACER is not set +# CONFIG_VENDOR_AMD is not set +# CONFIG_VENDOR_AOOSTAR is not set +# CONFIG_VENDOR_AOPEN is not set +# CONFIG_VENDOR_APPLE is not set +# CONFIG_VENDOR_ARM is not set +# CONFIG_VENDOR_ASROCK is not set +# CONFIG_VENDOR_ASUS is not set +# CONFIG_VENDOR_BIOSTAR is not set +# CONFIG_VENDOR_BOSTENTECH is not set +# CONFIG_VENDOR_BYTEDANCE is not set +# CONFIG_VENDOR_CAVIUM is not set +# CONFIG_VENDOR_CLEVO is not set +# CONFIG_VENDOR_COMPULAB is not set +# CONFIG_VENDOR_CWWK is not set +CONFIG_VENDOR_DELL=y +# CONFIG_VENDOR_EMULATION is not set +# CONFIG_VENDOR_ERYING is not set +# CONFIG_VENDOR_EXAMPLE is not set +# CONFIG_VENDOR_FACEBOOK is not set +# CONFIG_VENDOR_FOXCONN is not set +# CONFIG_VENDOR_FRAMEWORK is not set +# CONFIG_VENDOR_GETAC is not set +# CONFIG_VENDOR_GIGABYTE is not set +# CONFIG_VENDOR_GOOGLE is not set +# CONFIG_VENDOR_HARDKERNEL is not set +# CONFIG_VENDOR_HP is not set +# CONFIG_VENDOR_IBASE is not set +# CONFIG_VENDOR_IBM is not set +# CONFIG_VENDOR_INTEL is not set +# CONFIG_VENDOR_INVENTEC is not set +# CONFIG_VENDOR_KONTRON is not set +# CONFIG_VENDOR_LATTEPANDA is not set +# CONFIG_VENDOR_LENOVO is not set +# CONFIG_VENDOR_LIBRETREND is not set +# CONFIG_VENDOR_MITAC_COMPUTING is not set +# CONFIG_VENDOR_MSI is not set +# CONFIG_VENDOR_NOVACUSTOM is not set +# CONFIG_VENDOR_OCP is not set +# CONFIG_VENDOR_OPENCELLULAR is not set +# CONFIG_VENDOR_PACKARDBELL is not set +# CONFIG_VENDOR_PCENGINES is not set +# CONFIG_VENDOR_PINE64 is not set +# CONFIG_VENDOR_PORTWELL is not set +# CONFIG_VENDOR_PRODRIVE is not set +# CONFIG_VENDOR_PROTECTLI is not set +# CONFIG_VENDOR_PURISM is not set +# CONFIG_VENDOR_RAPTOR_CS is not set +# CONFIG_VENDOR_RAZER is not set +# CONFIG_VENDOR_RODA is not set +# CONFIG_VENDOR_SAMSUNG is not set +# CONFIG_VENDOR_SAPPHIRE is not set +# CONFIG_VENDOR_SIEMENS is not set +# CONFIG_VENDOR_SIFIVE is not set +# CONFIG_VENDOR_STARLABS is not set +# CONFIG_VENDOR_SUPERMICRO is not set +# CONFIG_VENDOR_SYSTEM76 is not set +# CONFIG_VENDOR_TI is not set +# CONFIG_VENDOR_TOPTON is not set +# CONFIG_VENDOR_UP is not set +# CONFIG_VENDOR_VIA is not set +CONFIG_BOARD_SPECIFIC_OPTIONS=y +CONFIG_MAINBOARD_PART_NUMBER="Precision T1700 SFF" +CONFIG_MAINBOARD_VERSION="1.0" +CONFIG_MAINBOARD_DIR="dell/optiplex_9020" +CONFIG_VGA_BIOS_ID="8086,0166" +CONFIG_DIMM_MAX=4 +CONFIG_DIMM_SPD_SIZE=256 +CONFIG_FMDFILE="" +# CONFIG_NO_POST is not set +CONFIG_MAINBOARD_VENDOR="Dell Inc." +CONFIG_CBFS_SIZE=0x800000 +CONFIG_CONSOLE_SERIAL=y +CONFIG_LINEAR_FRAMEBUFFER_MAX_HEIGHT=2160 +CONFIG_LINEAR_FRAMEBUFFER_MAX_WIDTH=3840 +CONFIG_MAX_CPUS=8 +# CONFIG_ONBOARD_VGA_IS_PRIMARY is not set +CONFIG_POST_DEVICE=y +CONFIG_POST_IO=y +CONFIG_UART_FOR_CONSOLE=0 +CONFIG_OVERRIDE_DEVICETREE="" +CONFIG_DEVICETREE="devicetree.cb" +# CONFIG_VBOOT is not set +# CONFIG_VGA_BIOS is not set +CONFIG_PCIEXP_ASPM=y +CONFIG_PCIEXP_L1_SUB_STATE=y +CONFIG_PCIEXP_CLK_PM=y +CONFIG_MAINBOARD_SMBIOS_MANUFACTURER="Dell Inc." +CONFIG_ECAM_MMCONF_BASE_ADDRESS=0xf0000000 +CONFIG_ECAM_MMCONF_BUS_NUMBER=64 +CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld" +# CONFIG_FATAL_ASSERTS is not set +CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt" +CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00 +CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF" +# CONFIG_CONSOLE_POST is not set +CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default" +CONFIG_CMOS_LAYOUT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.layout" +CONFIG_MAX_SOCKET=1 +CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0 +CONFIG_TPM_PIRQ=0x0 +# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set +# CONFIG_BOARD_DELL_E4300 is not set +# CONFIG_BOARD_DELL_E6400 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_3050 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_780_MT is not set +# CONFIG_BOARD_DELL_OPTIPLEX_780_USFF is not set +CONFIG_BOARD_DELL_OPTIPLEX_9020_SFF=y +# CONFIG_BOARD_DELL_OPTIPLEX_9020_MT is not set +# CONFIG_BOARD_DELL_LATITUDE_E5420 is not set +# CONFIG_BOARD_DELL_LATITUDE_E5520 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6220 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6320 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6420 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6520 is not set +# CONFIG_BOARD_DELL_LATITUDE_E5530 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6230 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6330 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6430 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6530 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_9010 is not set +# CONFIG_BOARD_DELL_PRECISION_T1650 is not set +# CONFIG_BOARD_DELL_XPS_8300 is not set +CONFIG_DCACHE_RAM_BASE=0xff7c0000 +CONFIG_DCACHE_RAM_SIZE=0x10000 +CONFIG_C_ENV_BOOTBLOCK_SIZE=0x40000 +CONFIG_DCACHE_BSP_STACK_SIZE=0x2000 +CONFIG_MAX_ACPI_TABLE_SIZE_KB=144 +CONFIG_HAVE_INTEL_FIRMWARE=y +CONFIG_MRC_SETTINGS_CACHE_SIZE=0x10000 +CONFIG_SPI_FLASH_INCLUDE_ALL_DRIVERS=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_DRIVERS_INTEL_WIFI=y +CONFIG_IFD_BIN_PATH="../../../config/ifd/dell9020mt/12_ifd" +CONFIG_ME_BIN_PATH="../../../vendorfiles/t440p/me.bin" +CONFIG_GBE_BIN_PATH="../../../config/ifd/dell9020mt/gbe" +CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x20000 +# CONFIG_ENABLE_DDR_2X_REFRESH is not set +CONFIG_PCIEXP_AER=y +CONFIG_CARDBUS_PLUGIN_SUPPORT=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_STMICRO=y +# CONFIG_DEBUG_SMI is not set +CONFIG_HAVE_IFD_BIN=y +CONFIG_PS2K_EISAID="PNP0303" +CONFIG_PS2M_EISAID="PNP0F13" +CONFIG_GFX_GMA_PANEL_1_PORT="eDP" +CONFIG_TTYS0_BAUD=115200 +CONFIG_D3COLD_SUPPORT=y +CONFIG_GFX_GMA_PANEL_1_ON_EDP=y +CONFIG_DRIVERS_UART_8250IO=y +CONFIG_PC_CMOS_BASE_PORT_BANK1=0x72 +CONFIG_HEAP_SIZE=0x100000 +CONFIG_EC_GPE_SCI=0x50 +CONFIG_EC_STARLABS_BATTERY_MODEL="Unknown" +CONFIG_EC_STARLABS_BATTERY_TYPE="LION" +CONFIG_EC_STARLABS_BATTERY_OEM="Unknown" +# CONFIG_TPM_MEASURED_BOOT is not set +CONFIG_BOARD_ROMSIZE_KB_12288=y +# CONFIG_COREBOOT_ROMSIZE_KB_256 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_512 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_1024 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_2048 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_4096 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_5120 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_6144 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_8192 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_10240 is not set +CONFIG_COREBOOT_ROMSIZE_KB_12288=y +# CONFIG_COREBOOT_ROMSIZE_KB_16384 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_24576 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_32768 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_65536 is not set +CONFIG_COREBOOT_ROMSIZE_KB=12288 +CONFIG_ROM_SIZE=0x00c00000 +CONFIG_HAVE_POWER_STATE_AFTER_FAILURE=y +CONFIG_HAVE_POWER_STATE_PREVIOUS_AFTER_FAILURE=y +CONFIG_POWER_STATE_OFF_AFTER_FAILURE=y +# CONFIG_POWER_STATE_ON_AFTER_FAILURE is not set +# CONFIG_POWER_STATE_PREVIOUS_AFTER_FAILURE is not set +CONFIG_MAINBOARD_POWER_FAILURE_STATE=0 +# end of Mainboard + +# +# Chipset +# + +# +# SoC +# +CONFIG_CHIPSET_DEVICETREE="" +CONFIG_CBFS_MCACHE_SIZE=0x4000 +CONFIG_ROMSTAGE_ADDR=0x2000000 +CONFIG_VERSTAGE_ADDR=0x2000000 +CONFIG_SMM_TSEG_SIZE=0x800000 +CONFIG_SMM_RESERVED_SIZE=0x100000 +CONFIG_SMM_MODULE_STACK_SIZE=0x400 +CONFIG_SERIRQ_CONTINUOUS_MODE=y +CONFIG_PRERAM_CBFS_CACHE_SIZE=0x4000 +CONFIG_DOMAIN_RESOURCE_32BIT_LIMIT=0xf0000000 +CONFIG_EHCI_BAR=0xd8000000 +CONFIG_ACPI_CPU_STRING="CP%02X" +CONFIG_STACK_SIZE=0x2000 +CONFIG_IED_REGION_SIZE=0x400000 +CONFIG_INTEL_GMA_BCLV_OFFSET=0x48254 +CONFIG_INTEL_GMA_BCLV_WIDTH=16 +CONFIG_INTEL_GMA_BCLM_OFFSET=0xc8256 +CONFIG_INTEL_GMA_BCLM_WIDTH=16 +CONFIG_BOOTBLOCK_IN_CBFS=y +CONFIG_HAVE_MRC=y +CONFIG_MRC_FILE="../../../mrc/broadwell/mrc.bin" +CONFIG_DCACHE_RAM_MRC_VAR_SIZE=0x30000 +CONFIG_HPET_MIN_TICKS=0x80 +CONFIG_FIXED_MCHBAR_MMIO_BASE=0xfed10000 +CONFIG_FIXED_DMIBAR_MMIO_BASE=0xfed18000 +CONFIG_FIXED_EPBAR_MMIO_BASE=0xfed19000 +CONFIG_PCIEXP_COMMON_CLOCK=y +CONFIG_DISABLE_ME_PCI=y +CONFIG_CPU_INTEL_NUM_FIT_ENTRIES=6 +CONFIG_SOC_PHYSICAL_ADDRESS_WIDTH=0 +# CONFIG_ALWAYS_ALLOW_ABOVE_4G_ALLOCATION is not set +CONFIG_FIXED_SMBUS_IO_BASE=0x400 +CONFIG_CBFS_CACHE_ALIGN=8 + +# +# CPU +# +CONFIG_CPU_INTEL_HASWELL=y +CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE=y +CONFIG_CPU_INTEL_COMMON=y +CONFIG_ENABLE_VMX=y +CONFIG_SET_IA32_FC_LOCK_BIT=y +CONFIG_SET_MSR_AESNI_LOCK_BIT=y +CONFIG_CPU_INTEL_COMMON_TIMEBASE=y +CONFIG_CPU_INTEL_COMMON_VOLTAGE=y +CONFIG_CPU_INTEL_COMMON_SMM=y +CONFIG_PARALLEL_MP=y +CONFIG_XAPIC_ONLY=y +# CONFIG_X2APIC_ONLY is not set +# CONFIG_X2APIC_RUNTIME is not set +# CONFIG_X2APIC_LATE_WORKAROUND is not set +CONFIG_UDELAY_TSC=y +CONFIG_TSC_MONOTONIC_TIMER=y +CONFIG_TSC_SYNC_MFENCE=y +CONFIG_HAVE_SMI_HANDLER=y +CONFIG_CPU_PT_ROM_MAP_GB=512 +CONFIG_SMM_TSEG=y +CONFIG_SMM_PCI_RESOURCE_STORE_NUM_SLOTS=8 +CONFIG_AP_STACK_SIZE=0x800 +CONFIG_SMP=y +CONFIG_SSE=y +CONFIG_SSE2=y +CONFIG_SUPPORT_CPU_UCODE_IN_CBFS=y +CONFIG_USE_CPU_MICROCODE_CBFS_BINS=y +CONFIG_CPU_MICROCODE_CBFS_DEFAULT_BINS=y +# CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS is not set +# CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER is not set +# CONFIG_CPU_MICROCODE_CBFS_NONE is not set + +# +# Northbridge +# +CONFIG_NORTHBRIDGE_INTEL_HASWELL=y +# CONFIG_USE_NATIVE_RAMINIT is not set +CONFIG_USE_BROADWELL_MRC=y +# CONFIG_HASWELL_HIDE_PEG_FROM_MRC is not set + +# +# Southbridge +# +# CONFIG_PCIEXP_HOTPLUG is not set +CONFIG_INTEL_DESCRIPTOR_MODE_REQUIRED=y +CONFIG_SOUTHBRIDGE_INTEL_LYNXPOINT=y +CONFIG_FINALIZE_USB_ROUTE_XHCI=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RESET=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RTC=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PMCLIB=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PMBASE=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_GPIO=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_EARLY_SMBUS=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SMBUS=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SPI=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SPI_ICH9=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PIRQ_ACPI_GEN=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RCBA_PIRQ=y +CONFIG_HAVE_INTEL_CHIPSET_LOCKDOWN=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_FINALIZE=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_USB_DEBUG=y +CONFIG_INTEL_DESCRIPTOR_MODE_CAPABLE=y +# CONFIG_VALIDATE_INTEL_DESCRIPTOR is not set +CONFIG_INTEL_CHIPSET_LOCKDOWN=y +CONFIG_TCO_SPACE_NOT_YET_SPLIT=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_WATCHDOG=y +CONFIG_FIXED_RCBA_MMIO_BASE=0xfed1c000 +CONFIG_RCBA_LENGTH=0x4000 + +# +# Super I/O +# +CONFIG_SUPERIO_SMSC_SCH555x=y + +# +# Embedded Controllers +# + +# +# Intel Firmware +# +CONFIG_HAVE_ME_BIN=y +# CONFIG_STITCH_ME_BIN is not set +# CONFIG_CHECK_ME is not set +# CONFIG_ME_REGION_ALLOW_CPU_READ_ACCESS is not set +# CONFIG_USE_ME_CLEANER is not set +CONFIG_MAINBOARD_USES_IFD_GBE_REGION=y +CONFIG_HAVE_GBE_BIN=y +# CONFIG_DO_NOT_TOUCH_DESCRIPTOR_REGION is not set +# CONFIG_LOCK_MANAGEMENT_ENGINE is not set +CONFIG_UNLOCK_FLASH_REGIONS=y +CONFIG_ACPI_FNKEY_GEN_SCANCODE=0 +# CONFIG_GOOGLE_PVMFW_CBMEM is not set +CONFIG_ARCH_X86=y +CONFIG_ARCH_BOOTBLOCK_X86_32=y +CONFIG_ARCH_VERSTAGE_X86_32=y +CONFIG_ARCH_ROMSTAGE_X86_32=y +CONFIG_ARCH_POSTCAR_X86_32=y +CONFIG_ARCH_RAMSTAGE_X86_32=y +CONFIG_ARCH_ALL_STAGES_X86_32=y +CONFIG_RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT=y +CONFIG_X86_TOP4G_BOOTMEDIA_MAP=y +CONFIG_POSTRAM_CBFS_CACHE_IN_BSS=y +CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000 +CONFIG_PC80_SYSTEM=y +CONFIG_HAVE_CMOS_DEFAULT=y +CONFIG_POSTCAR_STAGE=y +CONFIG_BOOTBLOCK_SIMPLE=y +# CONFIG_BOOTBLOCK_NORMAL is not set +CONFIG_COLLECT_TIMESTAMPS_TSC=y +CONFIG_HAVE_CF9_RESET=y +CONFIG_DEBUG_HW_BREAKPOINTS=y +CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS=y +# CONFIG_DUMP_SMBIOS_TYPE17 is not set +CONFIG_X86_BOOTBLOCK_EXTRA_PROGRAM_SZ=0 +CONFIG_DEFAULT_EBDA_LOWMEM=0x100000 +CONFIG_DEFAULT_EBDA_SEGMENT=0xF600 +CONFIG_DEFAULT_EBDA_SIZE=0x400 +# end of Chipset + +# +# Devices +# +CONFIG_HAVE_VGA_TEXT_FRAMEBUFFER=y +CONFIG_HAVE_LINEAR_FRAMEBUFFER=y +CONFIG_MAINBOARD_HAS_LIBGFXINIT=y +CONFIG_MAINBOARD_USE_LIBGFXINIT=y +# CONFIG_VGA_ROM_RUN is not set +# CONFIG_NO_GFX_INIT is not set +CONFIG_NO_EARLY_GFX_INIT=y + +# +# Display +# +# CONFIG_VGA_TEXT_FRAMEBUFFER is not set +CONFIG_GENERIC_LINEAR_FRAMEBUFFER=y +CONFIG_LINEAR_FRAMEBUFFER=y +# CONFIG_BOOTSPLASH is not set +CONFIG_DEFAULT_SCREEN_ROTATION_INT=0 +# end of Display + +CONFIG_PCI=y +CONFIG_ECAM_MMCONF_SUPPORT=y +CONFIG_PCIX_PLUGIN_SUPPORT=y +CONFIG_AZALIA_HDA_CODEC_SUPPORT=y +CONFIG_PCIEXP_PLUGIN_SUPPORT=y +CONFIG_ECAM_MMCONF_LENGTH=0x04000000 +CONFIG_PCI_ALLOW_BUS_MASTER=y +CONFIG_PCI_SET_BUS_MASTER_PCI_BRIDGES=y +CONFIG_PCI_ALLOW_BUS_MASTER_ANY_DEVICE=y +# CONFIG_PCIEXP_SUPPORT_RESIZABLE_BARS is not set +# CONFIG_PCIEXP_LANE_ERR_STAT_CLEAR is not set +# CONFIG_EARLY_PCI_BRIDGE is not set +CONFIG_SUBSYSTEM_VENDOR_ID=0x0000 +CONFIG_SUBSYSTEM_DEVICE_ID=0x0000 +CONFIG_INTEL_GMA_HAVE_VBT=y +CONFIG_INTEL_GMA_ADD_VBT=y +# CONFIG_SOFTWARE_I2C is not set +CONFIG_I2C_TRANSFER_TIMEOUT_US=500000 +CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y +CONFIG_USE_DDR3=y +# end of Devices + +# +# Generic Drivers +# +CONFIG_CRB_TPM_BASE_ADDRESS=0xfed40000 +# CONFIG_ELOG is not set +CONFIG_CACHE_MRC_SETTINGS=y +# CONFIG_MRC_SETTINGS_PROTECT is not set +# CONFIG_DRIVERS_OPTION_CFR is not set +# CONFIG_SMMSTORE is not set +CONFIG_SPI_FLASH=y +CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP=y +CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY=y +# CONFIG_SPI_FLASH_NO_FAST_READ is not set +CONFIG_SPI_FLASH_ADESTO=y +CONFIG_SPI_FLASH_AMIC=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_ISSI=y +CONFIG_HAVE_EM100PRO_SPI_CONSOLE_SUPPORT=y +CONFIG_TPM_INIT_RAMSTAGE=y +# CONFIG_TPM_PPI is not set +CONFIG_DRIVERS_UART=y +# CONFIG_DRIVERS_UART_OXPCIE is not set +CONFIG_HAVE_USBDEBUG=y +CONFIG_HAVE_USBDEBUG_OPTIONS=y +# CONFIG_USBDEBUG is not set +# CONFIG_VPD is not set +# CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG is not set +# CONFIG_DRIVERS_GENERIC_CBFS_SERIAL is not set +# CONFIG_DRIVERS_GENERIC_CBFS_UUID is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9750 is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9755 is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9763E is not set +# CONFIG_DRIVERS_I2C_MAX98396 is not set +CONFIG_INTEL_DDI=y +CONFIG_INTEL_INT15=y +CONFIG_INTEL_GMA_ACPI=y +CONFIG_VBT_CBFS_COMPRESSION_LZMA=y +# CONFIG_VBT_CBFS_COMPRESSION_LZ4 is not set +# CONFIG_VBT_CBFS_COMPRESSION_NONE is not set +CONFIG_VBT_CBFS_COMPRESSION_ALGORITHM="lzma" +CONFIG_GFX_GMA=y +CONFIG_GFX_GMA_DYN_CPU=y +CONFIG_GFX_GMA_GENERATION="Haswell" +CONFIG_GFX_GMA_PCH="Lynx_Point" +CONFIG_GFX_GMA_PANEL_2_PORT="Disabled" +CONFIG_GFX_GMA_ANALOG_I2C_PORT="PCH_DAC" +# CONFIG_DRIVERS_NXP_UWB_SR1XX is not set +# CONFIG_DRIVERS_PS2_KEYBOARD is not set +CONFIG_DRIVERS_MC146818=y +# CONFIG_USE_PC_CMOS_ALTCENTURY is not set +CONFIG_PC_CMOS_BASE_PORT_BANK0=0x70 +CONFIG_MEMORY_MAPPED_TPM=y +CONFIG_TPM_TIS_BASE_ADDRESS=0xfed40000 +# CONFIG_DRIVERS_SIL_3114 is not set +CONFIG_DRIVERS_WIFI_GENERIC=y +CONFIG_DRIVERS_MTK_WIFI=y +# end of Generic Drivers + +# +# Security +# + +# +# CBFS verification +# +# CONFIG_CBFS_VERIFICATION is not set +# end of CBFS verification + +# +# Verified Boot (vboot) +# +# end of Verified Boot (vboot) + +# +# Trusted Platform Module +# +CONFIG_TPM1=y +# CONFIG_TPM2 is not set +CONFIG_TPM=y +CONFIG_MAINBOARD_HAS_TPM1=y +# CONFIG_TPM_DEACTIVATE is not set +# CONFIG_DEBUG_TPM is not set +CONFIG_PCR_BOOT_MODE=1 +CONFIG_PCR_HWID=1 +CONFIG_PCR_SRTM=2 +CONFIG_PCR_FW_VER=10 +CONFIG_PCR_RUNTIME_DATA=3 +# end of Trusted Platform Module + +# +# Memory initialization +# +CONFIG_PLATFORM_HAS_DRAM_CLEAR=y +CONFIG_SECURITY_CLEAR_DRAM_ON_REGULAR_BOOT=y +# end of Memory initialization + +# CONFIG_INTEL_TXT is not set +# CONFIG_STM is not set +# CONFIG_INTEL_CBNT_SUPPORT is not set +CONFIG_BOOTMEDIA_LOCK_NONE=y +# CONFIG_BOOTMEDIA_LOCK_CONTROLLER is not set +# CONFIG_BOOTMEDIA_LOCK_CHIP is not set +# CONFIG_BOOTMEDIA_SMM_BWP is not set +# end of Security + +CONFIG_ACPI_HAVE_PCAT_8259=y +CONFIG_ACPI_INTEL_HARDWARE_SLEEP_VALUES=y +CONFIG_ACPI_SOC_NVS=y +CONFIG_ACPI_NO_CUSTOM_MADT=y +CONFIG_ACPI_COMMON_MADT_LAPIC=y +CONFIG_ACPI_COMMON_MADT_IOAPIC=y +CONFIG_HAVE_ACPI_TABLES=y +CONFIG_BOOT_DEVICE_SPI_FLASH=y +CONFIG_BOOT_DEVICE_MEMORY_MAPPED=y +CONFIG_BOOT_DEVICE_SUPPORTS_WRITES=y +CONFIG_RTC=y + +# +# Console +# +CONFIG_BOOTBLOCK_CONSOLE=y +CONFIG_POSTCAR_CONSOLE=y +CONFIG_SQUELCH_EARLY_SMP=y + +# +# I/O mapped, 8250-compatible +# +CONFIG_TTYS0_BASE=0x3f8 + +# +# Serial port base address = 0x3f8 +# +# CONFIG_CONSOLE_SERIAL_921600 is not set +# CONFIG_CONSOLE_SERIAL_460800 is not set +# CONFIG_CONSOLE_SERIAL_230400 is not set +CONFIG_CONSOLE_SERIAL_115200=y +# CONFIG_CONSOLE_SERIAL_57600 is not set +# CONFIG_CONSOLE_SERIAL_38400 is not set +# CONFIG_CONSOLE_SERIAL_19200 is not set +# CONFIG_CONSOLE_SERIAL_9600 is not set +CONFIG_TTYS0_LCS=3 +# CONFIG_SPKMODEM is not set +# CONFIG_CONSOLE_NE2K is not set +CONFIG_CONSOLE_CBMEM=y +# CONFIG_CONSOLE_SPI_FLASH is not set +# CONFIG_CONSOLE_I2C_SMBUS is not set +# CONFIG_EM100PRO_SPI_CONSOLE is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_8 is not set +CONFIG_DEFAULT_CONSOLE_LOGLEVEL_7=y +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_6 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_5 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_4 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_3 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_2 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_1 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0 is not set +CONFIG_DEFAULT_CONSOLE_LOGLEVEL=7 +CONFIG_CONSOLE_USE_LOGLEVEL_PREFIX=y +CONFIG_CONSOLE_USE_ANSI_ESCAPES=y +# CONFIG_CMOS_POST is not set +CONFIG_POST_DEVICE_NONE=y +# CONFIG_POST_DEVICE_LPC is not set +# CONFIG_POST_DEVICE_PCI_PCIE is not set +CONFIG_POST_IO_PORT=0x80 +CONFIG_HWBASE_DEBUG_CB=y +# end of Console + +CONFIG_HAVE_ACPI_RESUME=y +CONFIG_RESUME_PATH_SAME_AS_BOOT=y +CONFIG_HAVE_MONOTONIC_TIMER=y +CONFIG_HAVE_OPTION_TABLE=y +CONFIG_IOAPIC=y +CONFIG_USE_WATCHDOG_ON_BOOT=y + +# +# System tables +# +CONFIG_GENERATE_SMBIOS_TABLES=y +CONFIG_BIOS_VENDOR="coreboot" +CONFIG_MAINBOARD_SERIAL_NUMBER="123456789" +# end of System tables + +# +# Payload +# +CONFIG_PAYLOAD_NONE=y +# end of Payload + +# +# Debugging +# + +# +# CPU Debug Settings +# +# CONFIG_DISPLAY_MTRRS is not set + +# +# Vendorcode Debug Settings +# + +# +# BLOB Debug Settings +# + +# +# General Debug Settings +# +# CONFIG_GDB_STUB is not set +# CONFIG_DEBUG_CBFS is not set +CONFIG_HAVE_DEBUG_SMBUS=y +# CONFIG_DEBUG_SMBUS is not set +# CONFIG_DEBUG_MALLOC is not set +# CONFIG_DEBUG_CONSOLE_INIT is not set +# CONFIG_DEBUG_SPI_FLASH is not set +# CONFIG_DEBUG_BOOT_STATE is not set +# CONFIG_DEBUG_ADA_CODE is not set +CONFIG_HAVE_EM100_SUPPORT=y +# CONFIG_EM100 is not set +# CONFIG_DEBUG_ACPICA_COMPATIBLE is not set +# end of Debugging + +CONFIG_RAMSTAGE_ADA=y +CONFIG_RAMSTAGE_LIBHWBASE=y +CONFIG_HWBASE_DYNAMIC_MMIO=y +CONFIG_HWBASE_DEFAULT_MMCONF=0xf0000000 +CONFIG_HWBASE_DIRECT_PCIDEV=y +CONFIG_DECOMPRESS_OFAST=y + +# +# Boot Logo Configuration +# +# CONFIG_BMP_LOGO is not set +# end of Boot Logo Configuration + +CONFIG_WARNINGS_ARE_ERRORS=y +CONFIG_MAX_REBOOT_CNT=3 +CONFIG_RELOCATABLE_MODULES=y +CONFIG_HAVE_BOOTBLOCK=y +CONFIG_HAVE_ROMSTAGE=y +CONFIG_HAVE_RAMSTAGE=y diff --git a/config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_txtmode b/config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_txtmode new file mode 100644 index 00000000..84f97bde --- /dev/null +++ b/config/coreboot/t1700sff_bmrc_12mb/config/libgfxinit_txtmode @@ -0,0 +1,688 @@ +# +# Automatically generated file; DO NOT EDIT. +# coreboot configuration +# + +# +# General setup +# +CONFIG_LOCALVERSION="" +CONFIG_CBFS_PREFIX="fallback" +CONFIG_COMPILER_GCC=y +# CONFIG_COMPILER_LLVM_CLANG is not set +# CONFIG_ANY_TOOLCHAIN is not set +# CONFIG_CCACHE is not set +# CONFIG_LTO is not set +# CONFIG_IWYU is not set +# CONFIG_FMD_GENPARSER is not set +# CONFIG_UTIL_GENPARSER is not set +# CONFIG_OPTION_BACKEND_NONE is not set +CONFIG_USE_OPTION_TABLE=y +# CONFIG_USE_CBFS_FILE_OPTION_BACKEND is not set +CONFIG_STATIC_OPTION_TABLE=y +CONFIG_COMPRESS_RAMSTAGE_LZMA=y +# CONFIG_COMPRESS_RAMSTAGE_LZ4 is not set +CONFIG_SEPARATE_ROMSTAGE=y +CONFIG_INCLUDE_CONFIG_FILE=y +CONFIG_COLLECT_TIMESTAMPS=y +# CONFIG_TIMESTAMPS_ON_CONSOLE is not set +CONFIG_USE_BLOBS=y +# CONFIG_USE_AMD_BLOBS is not set +# CONFIG_USE_QC_BLOBS is not set +# CONFIG_COVERAGE is not set +# CONFIG_UBSAN is not set +CONFIG_HAVE_ASAN_IN_ROMSTAGE=y +CONFIG_HAVE_ASAN_IN_RAMSTAGE=y +# CONFIG_ASAN is not set +CONFIG_NO_STAGE_CACHE=y +# CONFIG_TSEG_STAGE_CACHE is not set +# CONFIG_UPDATE_IMAGE is not set +# CONFIG_BOOTSPLASH_IMAGE is not set + +# +# Software Bill Of Materials (SBOM) +# +# CONFIG_SBOM is not set +# end of Software Bill Of Materials (SBOM) +# end of General setup + +# +# Mainboard +# + +# +# Important: Run 'make distclean' before switching boards +# +# CONFIG_VENDOR_51NB is not set +# CONFIG_VENDOR_ACER is not set +# CONFIG_VENDOR_AMD is not set +# CONFIG_VENDOR_AOOSTAR is not set +# CONFIG_VENDOR_AOPEN is not set +# CONFIG_VENDOR_APPLE is not set +# CONFIG_VENDOR_ARM is not set +# CONFIG_VENDOR_ASROCK is not set +# CONFIG_VENDOR_ASUS is not set +# CONFIG_VENDOR_BIOSTAR is not set +# CONFIG_VENDOR_BOSTENTECH is not set +# CONFIG_VENDOR_BYTEDANCE is not set +# CONFIG_VENDOR_CAVIUM is not set +# CONFIG_VENDOR_CLEVO is not set +# CONFIG_VENDOR_COMPULAB is not set +# CONFIG_VENDOR_CWWK is not set +CONFIG_VENDOR_DELL=y +# CONFIG_VENDOR_EMULATION is not set +# CONFIG_VENDOR_ERYING is not set +# CONFIG_VENDOR_EXAMPLE is not set +# CONFIG_VENDOR_FACEBOOK is not set +# CONFIG_VENDOR_FOXCONN is not set +# CONFIG_VENDOR_FRAMEWORK is not set +# CONFIG_VENDOR_GETAC is not set +# CONFIG_VENDOR_GIGABYTE is not set +# CONFIG_VENDOR_GOOGLE is not set +# CONFIG_VENDOR_HARDKERNEL is not set +# CONFIG_VENDOR_HP is not set +# CONFIG_VENDOR_IBASE is not set +# CONFIG_VENDOR_IBM is not set +# CONFIG_VENDOR_INTEL is not set +# CONFIG_VENDOR_INVENTEC is not set +# CONFIG_VENDOR_KONTRON is not set +# CONFIG_VENDOR_LATTEPANDA is not set +# CONFIG_VENDOR_LENOVO is not set +# CONFIG_VENDOR_LIBRETREND is not set +# CONFIG_VENDOR_MITAC_COMPUTING is not set +# CONFIG_VENDOR_MSI is not set +# CONFIG_VENDOR_NOVACUSTOM is not set +# CONFIG_VENDOR_OCP is not set +# CONFIG_VENDOR_OPENCELLULAR is not set +# CONFIG_VENDOR_PACKARDBELL is not set +# CONFIG_VENDOR_PCENGINES is not set +# CONFIG_VENDOR_PINE64 is not set +# CONFIG_VENDOR_PORTWELL is not set +# CONFIG_VENDOR_PRODRIVE is not set +# CONFIG_VENDOR_PROTECTLI is not set +# CONFIG_VENDOR_PURISM is not set +# CONFIG_VENDOR_RAPTOR_CS is not set +# CONFIG_VENDOR_RAZER is not set +# CONFIG_VENDOR_RODA is not set +# CONFIG_VENDOR_SAMSUNG is not set +# CONFIG_VENDOR_SAPPHIRE is not set +# CONFIG_VENDOR_SIEMENS is not set +# CONFIG_VENDOR_SIFIVE is not set +# CONFIG_VENDOR_STARLABS is not set +# CONFIG_VENDOR_SUPERMICRO is not set +# CONFIG_VENDOR_SYSTEM76 is not set +# CONFIG_VENDOR_TI is not set +# CONFIG_VENDOR_TOPTON is not set +# CONFIG_VENDOR_UP is not set +# CONFIG_VENDOR_VIA is not set +CONFIG_BOARD_SPECIFIC_OPTIONS=y +CONFIG_MAINBOARD_PART_NUMBER="Precision T1700 SFF" +CONFIG_MAINBOARD_VERSION="1.0" +CONFIG_MAINBOARD_DIR="dell/optiplex_9020" +CONFIG_VGA_BIOS_ID="8086,0166" +CONFIG_DIMM_MAX=4 +CONFIG_DIMM_SPD_SIZE=256 +CONFIG_FMDFILE="" +# CONFIG_NO_POST is not set +CONFIG_MAINBOARD_VENDOR="Dell Inc." +CONFIG_CBFS_SIZE=0x800000 +CONFIG_CONSOLE_SERIAL=y +CONFIG_MAX_CPUS=8 +# CONFIG_ONBOARD_VGA_IS_PRIMARY is not set +CONFIG_POST_DEVICE=y +CONFIG_POST_IO=y +CONFIG_UART_FOR_CONSOLE=0 +CONFIG_OVERRIDE_DEVICETREE="" +CONFIG_DEVICETREE="devicetree.cb" +# CONFIG_VBOOT is not set +# CONFIG_VGA_BIOS is not set +CONFIG_PCIEXP_ASPM=y +CONFIG_PCIEXP_L1_SUB_STATE=y +CONFIG_PCIEXP_CLK_PM=y +CONFIG_MAINBOARD_SMBIOS_MANUFACTURER="Dell Inc." +CONFIG_ECAM_MMCONF_BASE_ADDRESS=0xf0000000 +CONFIG_ECAM_MMCONF_BUS_NUMBER=64 +CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld" +# CONFIG_FATAL_ASSERTS is not set +CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt" +CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00 +CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF" +# CONFIG_CONSOLE_POST is not set +CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default" +CONFIG_CMOS_LAYOUT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.layout" +CONFIG_MAX_SOCKET=1 +CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0 +CONFIG_TPM_PIRQ=0x0 +# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set +# CONFIG_BOARD_DELL_E4300 is not set +# CONFIG_BOARD_DELL_E6400 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_3050 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_780_MT is not set +# CONFIG_BOARD_DELL_OPTIPLEX_780_USFF is not set +CONFIG_BOARD_DELL_OPTIPLEX_9020_SFF=y +# CONFIG_BOARD_DELL_OPTIPLEX_9020_MT is not set +# CONFIG_BOARD_DELL_LATITUDE_E5420 is not set +# CONFIG_BOARD_DELL_LATITUDE_E5520 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6220 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6320 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6420 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6520 is not set +# CONFIG_BOARD_DELL_LATITUDE_E5530 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6230 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6330 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6430 is not set +# CONFIG_BOARD_DELL_LATITUDE_E6530 is not set +# CONFIG_BOARD_DELL_OPTIPLEX_9010 is not set +# CONFIG_BOARD_DELL_PRECISION_T1650 is not set +# CONFIG_BOARD_DELL_XPS_8300 is not set +CONFIG_DCACHE_RAM_BASE=0xff7c0000 +CONFIG_DCACHE_RAM_SIZE=0x10000 +CONFIG_C_ENV_BOOTBLOCK_SIZE=0x40000 +CONFIG_DCACHE_BSP_STACK_SIZE=0x2000 +CONFIG_MAX_ACPI_TABLE_SIZE_KB=144 +CONFIG_HAVE_INTEL_FIRMWARE=y +CONFIG_MRC_SETTINGS_CACHE_SIZE=0x10000 +CONFIG_SPI_FLASH_INCLUDE_ALL_DRIVERS=y +CONFIG_SPI_FLASH_WINBOND=y +CONFIG_DRIVERS_INTEL_WIFI=y +CONFIG_IFD_BIN_PATH="../../../config/ifd/dell9020mt/12_ifd" +CONFIG_ME_BIN_PATH="../../../vendorfiles/t440p/me.bin" +CONFIG_GBE_BIN_PATH="../../../config/ifd/dell9020mt/gbe" +CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x20000 +# CONFIG_ENABLE_DDR_2X_REFRESH is not set +CONFIG_PCIEXP_AER=y +CONFIG_CARDBUS_PLUGIN_SUPPORT=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_STMICRO=y +# CONFIG_DEBUG_SMI is not set +CONFIG_HAVE_IFD_BIN=y +CONFIG_PS2K_EISAID="PNP0303" +CONFIG_PS2M_EISAID="PNP0F13" +CONFIG_GFX_GMA_PANEL_1_PORT="eDP" +CONFIG_TTYS0_BAUD=115200 +CONFIG_D3COLD_SUPPORT=y +CONFIG_GFX_GMA_PANEL_1_ON_EDP=y +CONFIG_DRIVERS_UART_8250IO=y +CONFIG_PC_CMOS_BASE_PORT_BANK1=0x72 +CONFIG_HEAP_SIZE=0x100000 +CONFIG_EC_GPE_SCI=0x50 +CONFIG_EC_STARLABS_BATTERY_MODEL="Unknown" +CONFIG_EC_STARLABS_BATTERY_TYPE="LION" +CONFIG_EC_STARLABS_BATTERY_OEM="Unknown" +# CONFIG_TPM_MEASURED_BOOT is not set +CONFIG_BOARD_ROMSIZE_KB_12288=y +# CONFIG_COREBOOT_ROMSIZE_KB_256 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_512 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_1024 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_2048 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_4096 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_5120 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_6144 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_8192 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_10240 is not set +CONFIG_COREBOOT_ROMSIZE_KB_12288=y +# CONFIG_COREBOOT_ROMSIZE_KB_16384 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_24576 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_32768 is not set +# CONFIG_COREBOOT_ROMSIZE_KB_65536 is not set +CONFIG_COREBOOT_ROMSIZE_KB=12288 +CONFIG_ROM_SIZE=0x00c00000 +CONFIG_HAVE_POWER_STATE_AFTER_FAILURE=y +CONFIG_HAVE_POWER_STATE_PREVIOUS_AFTER_FAILURE=y +CONFIG_POWER_STATE_OFF_AFTER_FAILURE=y +# CONFIG_POWER_STATE_ON_AFTER_FAILURE is not set +# CONFIG_POWER_STATE_PREVIOUS_AFTER_FAILURE is not set +CONFIG_MAINBOARD_POWER_FAILURE_STATE=0 +# end of Mainboard + +# +# Chipset +# + +# +# SoC +# +CONFIG_CHIPSET_DEVICETREE="" +CONFIG_CBFS_MCACHE_SIZE=0x4000 +CONFIG_ROMSTAGE_ADDR=0x2000000 +CONFIG_VERSTAGE_ADDR=0x2000000 +CONFIG_SMM_TSEG_SIZE=0x800000 +CONFIG_SMM_RESERVED_SIZE=0x100000 +CONFIG_SMM_MODULE_STACK_SIZE=0x400 +CONFIG_SERIRQ_CONTINUOUS_MODE=y +CONFIG_PRERAM_CBFS_CACHE_SIZE=0x4000 +CONFIG_DOMAIN_RESOURCE_32BIT_LIMIT=0xf0000000 +CONFIG_EHCI_BAR=0xd8000000 +CONFIG_ACPI_CPU_STRING="CP%02X" +CONFIG_STACK_SIZE=0x2000 +CONFIG_IED_REGION_SIZE=0x400000 +CONFIG_INTEL_GMA_BCLV_OFFSET=0x48254 +CONFIG_INTEL_GMA_BCLV_WIDTH=16 +CONFIG_INTEL_GMA_BCLM_OFFSET=0xc8256 +CONFIG_INTEL_GMA_BCLM_WIDTH=16 +CONFIG_BOOTBLOCK_IN_CBFS=y +CONFIG_HAVE_MRC=y +CONFIG_MRC_FILE="../../../mrc/broadwell/mrc.bin" +CONFIG_DCACHE_RAM_MRC_VAR_SIZE=0x30000 +CONFIG_HPET_MIN_TICKS=0x80 +CONFIG_FIXED_MCHBAR_MMIO_BASE=0xfed10000 +CONFIG_FIXED_DMIBAR_MMIO_BASE=0xfed18000 +CONFIG_FIXED_EPBAR_MMIO_BASE=0xfed19000 +CONFIG_PCIEXP_COMMON_CLOCK=y +CONFIG_DISABLE_ME_PCI=y +CONFIG_CPU_INTEL_NUM_FIT_ENTRIES=6 +CONFIG_SOC_PHYSICAL_ADDRESS_WIDTH=0 +# CONFIG_ALWAYS_ALLOW_ABOVE_4G_ALLOCATION is not set +CONFIG_FIXED_SMBUS_IO_BASE=0x400 +CONFIG_CBFS_CACHE_ALIGN=8 + +# +# CPU +# +CONFIG_CPU_INTEL_HASWELL=y +CONFIG_CPU_INTEL_FIRMWARE_INTERFACE_TABLE=y +CONFIG_CPU_INTEL_COMMON=y +CONFIG_ENABLE_VMX=y +CONFIG_SET_IA32_FC_LOCK_BIT=y +CONFIG_SET_MSR_AESNI_LOCK_BIT=y +CONFIG_CPU_INTEL_COMMON_TIMEBASE=y +CONFIG_CPU_INTEL_COMMON_VOLTAGE=y +CONFIG_CPU_INTEL_COMMON_SMM=y +CONFIG_PARALLEL_MP=y +CONFIG_XAPIC_ONLY=y +# CONFIG_X2APIC_ONLY is not set +# CONFIG_X2APIC_RUNTIME is not set +# CONFIG_X2APIC_LATE_WORKAROUND is not set +CONFIG_UDELAY_TSC=y +CONFIG_TSC_MONOTONIC_TIMER=y +CONFIG_TSC_SYNC_MFENCE=y +CONFIG_HAVE_SMI_HANDLER=y +CONFIG_CPU_PT_ROM_MAP_GB=512 +CONFIG_SMM_TSEG=y +CONFIG_SMM_PCI_RESOURCE_STORE_NUM_SLOTS=8 +CONFIG_AP_STACK_SIZE=0x800 +CONFIG_SMP=y +CONFIG_SSE=y +CONFIG_SSE2=y +CONFIG_SUPPORT_CPU_UCODE_IN_CBFS=y +CONFIG_USE_CPU_MICROCODE_CBFS_BINS=y +CONFIG_CPU_MICROCODE_CBFS_DEFAULT_BINS=y +# CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS is not set +# CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER is not set +# CONFIG_CPU_MICROCODE_CBFS_NONE is not set + +# +# Northbridge +# +CONFIG_NORTHBRIDGE_INTEL_HASWELL=y +# CONFIG_USE_NATIVE_RAMINIT is not set +CONFIG_USE_BROADWELL_MRC=y +# CONFIG_HASWELL_HIDE_PEG_FROM_MRC is not set + +# +# Southbridge +# +# CONFIG_PCIEXP_HOTPLUG is not set +CONFIG_INTEL_DESCRIPTOR_MODE_REQUIRED=y +CONFIG_SOUTHBRIDGE_INTEL_LYNXPOINT=y +CONFIG_FINALIZE_USB_ROUTE_XHCI=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RESET=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RTC=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PMCLIB=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PMBASE=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_GPIO=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_EARLY_SMBUS=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SMBUS=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SPI=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_SPI_ICH9=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_PIRQ_ACPI_GEN=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_RCBA_PIRQ=y +CONFIG_HAVE_INTEL_CHIPSET_LOCKDOWN=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_FINALIZE=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_USB_DEBUG=y +CONFIG_INTEL_DESCRIPTOR_MODE_CAPABLE=y +# CONFIG_VALIDATE_INTEL_DESCRIPTOR is not set +CONFIG_INTEL_CHIPSET_LOCKDOWN=y +CONFIG_TCO_SPACE_NOT_YET_SPLIT=y +CONFIG_SOUTHBRIDGE_INTEL_COMMON_WATCHDOG=y +CONFIG_FIXED_RCBA_MMIO_BASE=0xfed1c000 +CONFIG_RCBA_LENGTH=0x4000 + +# +# Super I/O +# +CONFIG_SUPERIO_SMSC_SCH555x=y + +# +# Embedded Controllers +# + +# +# Intel Firmware +# +CONFIG_HAVE_ME_BIN=y +# CONFIG_STITCH_ME_BIN is not set +# CONFIG_CHECK_ME is not set +# CONFIG_ME_REGION_ALLOW_CPU_READ_ACCESS is not set +# CONFIG_USE_ME_CLEANER is not set +CONFIG_MAINBOARD_USES_IFD_GBE_REGION=y +CONFIG_HAVE_GBE_BIN=y +# CONFIG_DO_NOT_TOUCH_DESCRIPTOR_REGION is not set +# CONFIG_LOCK_MANAGEMENT_ENGINE is not set +CONFIG_UNLOCK_FLASH_REGIONS=y +CONFIG_ACPI_FNKEY_GEN_SCANCODE=0 +# CONFIG_GOOGLE_PVMFW_CBMEM is not set +CONFIG_ARCH_X86=y +CONFIG_ARCH_BOOTBLOCK_X86_32=y +CONFIG_ARCH_VERSTAGE_X86_32=y +CONFIG_ARCH_ROMSTAGE_X86_32=y +CONFIG_ARCH_POSTCAR_X86_32=y +CONFIG_ARCH_RAMSTAGE_X86_32=y +CONFIG_ARCH_ALL_STAGES_X86_32=y +CONFIG_RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT=y +CONFIG_X86_TOP4G_BOOTMEDIA_MAP=y +CONFIG_POSTRAM_CBFS_CACHE_IN_BSS=y +CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000 +CONFIG_PC80_SYSTEM=y +CONFIG_HAVE_CMOS_DEFAULT=y +CONFIG_POSTCAR_STAGE=y +CONFIG_BOOTBLOCK_SIMPLE=y +# CONFIG_BOOTBLOCK_NORMAL is not set +CONFIG_COLLECT_TIMESTAMPS_TSC=y +CONFIG_HAVE_CF9_RESET=y +CONFIG_DEBUG_HW_BREAKPOINTS=y +CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS=y +# CONFIG_DUMP_SMBIOS_TYPE17 is not set +CONFIG_X86_BOOTBLOCK_EXTRA_PROGRAM_SZ=0 +CONFIG_DEFAULT_EBDA_LOWMEM=0x100000 +CONFIG_DEFAULT_EBDA_SEGMENT=0xF600 +CONFIG_DEFAULT_EBDA_SIZE=0x400 +# end of Chipset + +# +# Devices +# +CONFIG_HAVE_VGA_TEXT_FRAMEBUFFER=y +CONFIG_HAVE_LINEAR_FRAMEBUFFER=y +CONFIG_MAINBOARD_HAS_LIBGFXINIT=y +CONFIG_MAINBOARD_USE_LIBGFXINIT=y +# CONFIG_VGA_ROM_RUN is not set +# CONFIG_NO_GFX_INIT is not set +CONFIG_NO_EARLY_GFX_INIT=y + +# +# Display +# +CONFIG_VGA_TEXT_FRAMEBUFFER=y +# CONFIG_GENERIC_LINEAR_FRAMEBUFFER is not set +CONFIG_DEFAULT_SCREEN_ROTATION_INT=0 +# end of Display + +CONFIG_PCI=y +CONFIG_ECAM_MMCONF_SUPPORT=y +CONFIG_PCIX_PLUGIN_SUPPORT=y +CONFIG_AZALIA_HDA_CODEC_SUPPORT=y +CONFIG_PCIEXP_PLUGIN_SUPPORT=y +CONFIG_ECAM_MMCONF_LENGTH=0x04000000 +CONFIG_PCI_ALLOW_BUS_MASTER=y +CONFIG_PCI_SET_BUS_MASTER_PCI_BRIDGES=y +CONFIG_PCI_ALLOW_BUS_MASTER_ANY_DEVICE=y +# CONFIG_PCIEXP_SUPPORT_RESIZABLE_BARS is not set +# CONFIG_PCIEXP_LANE_ERR_STAT_CLEAR is not set +# CONFIG_EARLY_PCI_BRIDGE is not set +CONFIG_SUBSYSTEM_VENDOR_ID=0x0000 +CONFIG_SUBSYSTEM_DEVICE_ID=0x0000 +CONFIG_INTEL_GMA_HAVE_VBT=y +CONFIG_INTEL_GMA_ADD_VBT=y +# CONFIG_SOFTWARE_I2C is not set +CONFIG_I2C_TRANSFER_TIMEOUT_US=500000 +CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y +CONFIG_USE_DDR3=y +# end of Devices + +# +# Generic Drivers +# +CONFIG_CRB_TPM_BASE_ADDRESS=0xfed40000 +# CONFIG_ELOG is not set +CONFIG_CACHE_MRC_SETTINGS=y +# CONFIG_MRC_SETTINGS_PROTECT is not set +# CONFIG_DRIVERS_OPTION_CFR is not set +# CONFIG_SMMSTORE is not set +CONFIG_SPI_FLASH=y +CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP=y +CONFIG_BOOT_DEVICE_SPI_FLASH_RW_NOMMAP_EARLY=y +# CONFIG_SPI_FLASH_NO_FAST_READ is not set +CONFIG_SPI_FLASH_ADESTO=y +CONFIG_SPI_FLASH_AMIC=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_SPI_FLASH_SPANSION=y +CONFIG_SPI_FLASH_SST=y +CONFIG_SPI_FLASH_ISSI=y +CONFIG_HAVE_EM100PRO_SPI_CONSOLE_SUPPORT=y +CONFIG_TPM_INIT_RAMSTAGE=y +# CONFIG_TPM_PPI is not set +CONFIG_DRIVERS_UART=y +# CONFIG_DRIVERS_UART_OXPCIE is not set +CONFIG_HAVE_USBDEBUG=y +CONFIG_HAVE_USBDEBUG_OPTIONS=y +# CONFIG_USBDEBUG is not set +# CONFIG_VPD is not set +# CONFIG_DRIVERS_EMULATION_QEMU_FW_CFG is not set +# CONFIG_DRIVERS_GENERIC_CBFS_SERIAL is not set +# CONFIG_DRIVERS_GENERIC_CBFS_UUID is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9750 is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9755 is not set +# CONFIG_DRIVERS_GENESYSLOGIC_GL9763E is not set +# CONFIG_DRIVERS_I2C_MAX98396 is not set +CONFIG_INTEL_DDI=y +CONFIG_INTEL_INT15=y +CONFIG_INTEL_GMA_ACPI=y +CONFIG_VBT_CBFS_COMPRESSION_LZMA=y +# CONFIG_VBT_CBFS_COMPRESSION_LZ4 is not set +# CONFIG_VBT_CBFS_COMPRESSION_NONE is not set +CONFIG_VBT_CBFS_COMPRESSION_ALGORITHM="lzma" +CONFIG_GFX_GMA=y +CONFIG_GFX_GMA_DYN_CPU=y +CONFIG_GFX_GMA_GENERATION="Haswell" +CONFIG_GFX_GMA_PCH="Lynx_Point" +CONFIG_GFX_GMA_PANEL_2_PORT="Disabled" +CONFIG_GFX_GMA_ANALOG_I2C_PORT="PCH_DAC" +# CONFIG_DRIVERS_NXP_UWB_SR1XX is not set +# CONFIG_DRIVERS_PS2_KEYBOARD is not set +CONFIG_DRIVERS_MC146818=y +# CONFIG_USE_PC_CMOS_ALTCENTURY is not set +CONFIG_PC_CMOS_BASE_PORT_BANK0=0x70 +CONFIG_MEMORY_MAPPED_TPM=y +CONFIG_TPM_TIS_BASE_ADDRESS=0xfed40000 +CONFIG_VGA=y +# CONFIG_DRIVERS_SIL_3114 is not set +CONFIG_DRIVERS_WIFI_GENERIC=y +CONFIG_DRIVERS_MTK_WIFI=y +# end of Generic Drivers + +# +# Security +# + +# +# CBFS verification +# +# CONFIG_CBFS_VERIFICATION is not set +# end of CBFS verification + +# +# Verified Boot (vboot) +# +# end of Verified Boot (vboot) + +# +# Trusted Platform Module +# +CONFIG_TPM1=y +# CONFIG_TPM2 is not set +CONFIG_TPM=y +CONFIG_MAINBOARD_HAS_TPM1=y +# CONFIG_TPM_DEACTIVATE is not set +# CONFIG_DEBUG_TPM is not set +CONFIG_PCR_BOOT_MODE=1 +CONFIG_PCR_HWID=1 +CONFIG_PCR_SRTM=2 +CONFIG_PCR_FW_VER=10 +CONFIG_PCR_RUNTIME_DATA=3 +# end of Trusted Platform Module + +# +# Memory initialization +# +CONFIG_PLATFORM_HAS_DRAM_CLEAR=y +CONFIG_SECURITY_CLEAR_DRAM_ON_REGULAR_BOOT=y +# end of Memory initialization + +# CONFIG_INTEL_TXT is not set +# CONFIG_STM is not set +# CONFIG_INTEL_CBNT_SUPPORT is not set +CONFIG_BOOTMEDIA_LOCK_NONE=y +# CONFIG_BOOTMEDIA_LOCK_CONTROLLER is not set +# CONFIG_BOOTMEDIA_LOCK_CHIP is not set +# CONFIG_BOOTMEDIA_SMM_BWP is not set +# end of Security + +CONFIG_ACPI_HAVE_PCAT_8259=y +CONFIG_ACPI_INTEL_HARDWARE_SLEEP_VALUES=y +CONFIG_ACPI_SOC_NVS=y +CONFIG_ACPI_NO_CUSTOM_MADT=y +CONFIG_ACPI_COMMON_MADT_LAPIC=y +CONFIG_ACPI_COMMON_MADT_IOAPIC=y +CONFIG_HAVE_ACPI_TABLES=y +CONFIG_BOOT_DEVICE_SPI_FLASH=y +CONFIG_BOOT_DEVICE_MEMORY_MAPPED=y +CONFIG_BOOT_DEVICE_SUPPORTS_WRITES=y +CONFIG_RTC=y + +# +# Console +# +CONFIG_BOOTBLOCK_CONSOLE=y +CONFIG_POSTCAR_CONSOLE=y +CONFIG_SQUELCH_EARLY_SMP=y + +# +# I/O mapped, 8250-compatible +# +CONFIG_TTYS0_BASE=0x3f8 + +# +# Serial port base address = 0x3f8 +# +# CONFIG_CONSOLE_SERIAL_921600 is not set +# CONFIG_CONSOLE_SERIAL_460800 is not set +# CONFIG_CONSOLE_SERIAL_230400 is not set +CONFIG_CONSOLE_SERIAL_115200=y +# CONFIG_CONSOLE_SERIAL_57600 is not set +# CONFIG_CONSOLE_SERIAL_38400 is not set +# CONFIG_CONSOLE_SERIAL_19200 is not set +# CONFIG_CONSOLE_SERIAL_9600 is not set +CONFIG_TTYS0_LCS=3 +# CONFIG_SPKMODEM is not set +# CONFIG_CONSOLE_NE2K is not set +CONFIG_CONSOLE_CBMEM=y +# CONFIG_CONSOLE_SPI_FLASH is not set +# CONFIG_CONSOLE_I2C_SMBUS is not set +# CONFIG_EM100PRO_SPI_CONSOLE is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_8 is not set +CONFIG_DEFAULT_CONSOLE_LOGLEVEL_7=y +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_6 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_5 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_4 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_3 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_2 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_1 is not set +# CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0 is not set +CONFIG_DEFAULT_CONSOLE_LOGLEVEL=7 +CONFIG_CONSOLE_USE_LOGLEVEL_PREFIX=y +CONFIG_CONSOLE_USE_ANSI_ESCAPES=y +# CONFIG_CMOS_POST is not set +CONFIG_POST_DEVICE_NONE=y +# CONFIG_POST_DEVICE_LPC is not set +# CONFIG_POST_DEVICE_PCI_PCIE is not set +CONFIG_POST_IO_PORT=0x80 +CONFIG_HWBASE_DEBUG_CB=y +# end of Console + +CONFIG_HAVE_ACPI_RESUME=y +CONFIG_RESUME_PATH_SAME_AS_BOOT=y +CONFIG_HAVE_MONOTONIC_TIMER=y +CONFIG_HAVE_OPTION_TABLE=y +CONFIG_IOAPIC=y +CONFIG_USE_WATCHDOG_ON_BOOT=y + +# +# System tables +# +CONFIG_GENERATE_SMBIOS_TABLES=y +CONFIG_BIOS_VENDOR="coreboot" +CONFIG_MAINBOARD_SERIAL_NUMBER="123456789" +# end of System tables + +# +# Payload +# +CONFIG_PAYLOAD_NONE=y +# end of Payload + +# +# Debugging +# + +# +# CPU Debug Settings +# +# CONFIG_DISPLAY_MTRRS is not set + +# +# Vendorcode Debug Settings +# + +# +# BLOB Debug Settings +# + +# +# General Debug Settings +# +# CONFIG_GDB_STUB is not set +# CONFIG_DEBUG_CBFS is not set +CONFIG_HAVE_DEBUG_SMBUS=y +# CONFIG_DEBUG_SMBUS is not set +# CONFIG_DEBUG_MALLOC is not set +# CONFIG_DEBUG_CONSOLE_INIT is not set +# CONFIG_DEBUG_SPI_FLASH is not set +# CONFIG_DEBUG_BOOT_STATE is not set +# CONFIG_DEBUG_ADA_CODE is not set +CONFIG_HAVE_EM100_SUPPORT=y +# CONFIG_EM100 is not set +# CONFIG_DEBUG_ACPICA_COMPATIBLE is not set +# end of Debugging + +CONFIG_RAMSTAGE_ADA=y +CONFIG_RAMSTAGE_LIBHWBASE=y +CONFIG_HWBASE_DYNAMIC_MMIO=y +CONFIG_HWBASE_DEFAULT_MMCONF=0xf0000000 +CONFIG_HWBASE_DIRECT_PCIDEV=y +CONFIG_DECOMPRESS_OFAST=y + +# +# Boot Logo Configuration +# +# CONFIG_BMP_LOGO is not set +# end of Boot Logo Configuration + +CONFIG_WARNINGS_ARE_ERRORS=y +CONFIG_MAX_REBOOT_CNT=3 +CONFIG_RELOCATABLE_MODULES=y +CONFIG_HAVE_BOOTBLOCK=y +CONFIG_HAVE_ROMSTAGE=y +CONFIG_HAVE_RAMSTAGE=y diff --git a/config/coreboot/t1700sff_bmrc_12mb/target.cfg b/config/coreboot/t1700sff_bmrc_12mb/target.cfg new file mode 100644 index 00000000..06de408c --- /dev/null +++ b/config/coreboot/t1700sff_bmrc_12mb/target.cfg @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +tree="default" +xarch="i386-elf" +payload_seabios="y" +payload_grub="y" +payload_memtest="y" +grub_scan_disk="nvme ahci" +grubtree="xhci" +vcfg="t1700" +build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" +payload_uboot_amd64="y" diff --git a/config/vendor/t1700/pkg.cfg b/config/vendor/t1700/pkg.cfg new file mode 100644 index 00000000..cc100683 --- /dev/null +++ b/config/vendor/t1700/pkg.cfg @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +DL_hash="f3d79aec805c8b0094a4081be76b3a22d329c479ad18210449b7acc3236ccfc4a2103eaa7c5b79a4872bfd699eede047efd46dfb06dc8f47e3216fc254612998" +DL_url="https://download.lenovo.com/pccbbs/mobiles/glrg22ww.exe" +DL_url_bkup="https://web.archive.org/web/20211120031520/https://download.lenovo.com/pccbbs/mobiles/glrg22ww.exe" +MRC_url="https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13904.77.0_samus_recovery_stable-channel_mp-v3.bin.zip" +MRC_url_bkup="https://web.archive.org/web/20220310155922/https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13904.77.0_samus_recovery_stable-channel_mp-v3.bin.zip" +MRC_hash="3ff1599c52539f0707a07a8664a84ce51cd3fed1569df4bb7aa6722fc8dec0af1754250333b6ca1a9794d970a4de7b29a5cf2499f5b61e4c3eab64d1314aaea9" +MRC_board="samus" diff --git a/include/inject.sh b/include/inject.sh index 6b316729..e5282861 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -86,6 +86,8 @@ getfiles() "$E6400_VGA_DL_url_bkup" "$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE" [ -z "$CONFIG_HAVE_MRC" ] || fetch "mrc" "$MRC_url" "$MRC_url_bkup" \ "$MRC_hash" "$CONFIG_MRC_FILE" + [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && fetch "refcode" "$MRC_url" \ + "$MRC_url_bkup" "$MRC_hash" "$CONFIG_REFCODE_BLOB_FILE" [ -z "$CONFIG_LENOVO_TBFW_BIN" ] || fetch "tbfw" "$TBFW_url" \ "$TBFW_url_bkup" "$TBFW_hash" "$CONFIG_LENOVO_TBFW_BIN" # diff --git a/include/mrc.sh b/include/mrc.sh index 6e00292b..eaf39dcb 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -7,6 +7,37 @@ eval "`setvars "" MRC_url MRC_url_bkup MRC_hash MRC_board SHELLBALL`" extract_mrc() +{ + extract_shellball + + "$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ + -f "$_dest" -r RO_SECTION || $err "extract_mrc: !$cbfstool $_dest" + + [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && extract_refcode extra; : +} + +extract_refcode() +{ + _refdest="${CONFIG_REFCODE_BLOB_FILE##*../}" + e "$_refdest" f && return 0 + + [ $# -lt 1 ] && extract_shellball + + # cbfstool changed the attributes scheme for stage files, + # incompatible with older versions before coreboot 4.14, + # so we need coreboot 4.13 cbfstool for certain refcode files + chkvars cbfstoolref + mkdir -p "${_refdest%/*}" || $err "ref: !mkdir -p ${_refdest%/*}" + + x_ "$cbfstoolref" "$appdir/bios.bin" extract \ + -m x86 -n fallback/refcode -f "$_refdest" -r RO_SECTION + + # enable the Intel GbE device, if told by offset MRC_refcode_gbe + [ -z "$MRC_refcode_gbe" ] || x_ dd if="config/ifd/hp820g2/1.bin" \ + of="$_refdest" bs=1 seek=$MRC_refcode_gbe count=1 conv=notrunc; : +} + +extract_shellball() { chkvars "MRC_board" "CONFIG_MRC_FILE" SHELLBALL="chromeos-firmwareupdate-$MRC_board" @@ -15,12 +46,7 @@ extract_mrc() x_ cd "$appdir" extract_partition "${MRC_url##*/}" extract_archive "$SHELLBALL" . - ) || $err "mrc download/extract failure" - - "$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ - -f "$_dest" -r RO_SECTION || $err "extract_mrc: !$cbfstool $_dest" - - [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && extract_refcode; : + ) || $err "mrc download/extract failure"; : } extract_partition() @@ -38,22 +64,3 @@ extract_partition() printf "cd /usr/sbin\ndump chromeos-firmwareupdate %s\nquit" \ "$SHELLBALL" | debugfs "root-a.ext2" || $err "!extract shellball" } - -extract_refcode() -{ - _refdest="${CONFIG_REFCODE_BLOB_FILE##*../}" - e "$_refdest" f && return 0 - - # cbfstool changed the attributes scheme for stage files, - # incompatible with older versions before coreboot 4.14, - # so we need coreboot 4.13 cbfstool for certain refcode files - chkvars cbfstoolref - mkdir -p "${_refdest%/*}" || $err "ref: !mkdir -p ${_refdest%/*}" - - x_ "$cbfstoolref" "$appdir/bios.bin" extract \ - -m x86 -n fallback/refcode -f "$_refdest" -r RO_SECTION - - # enable the Intel GbE device, if told by offset MRC_refcode_gbe - [ -z "$MRC_refcode_gbe" ] || x_ dd if="config/ifd/hp820g2/1.bin" \ - of="$_refdest" bs=1 seek=$MRC_refcode_gbe count=1 conv=notrunc; : -} From d18d1c2cae2c1c43c56d5c10adb469266d1eb08b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 04:16:10 +0100 Subject: [PATCH 010/267] lbmk: unified execution on find commands We have a lot of places in lbmk where the output of find is used, and then some function is executed on the result. This is messy, and bloats several of these functions. Now this is unified, into a new function: fx_ What fx_ does is execute a given function, for each result found, with the arguments for a find command appended. For example: find -name ".git" If you wanted to do: foo "$arg" Where "arg" is a search result from find, and you wanted to execute "foo" on each one, you would do: fx_ foo -name ".git" The find utility does have an -exec feature, but I've found that it only works for executables, not functions. fx_ does not return errors, so "foo" in this example would have to do its own error handling. Signed-off-by: Leah Rowe --- include/inject.sh | 43 ++++++++++++++++++------------------------- include/lib.sh | 11 +++++++++++ mk | 23 +++++++++-------------- 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index e5282861..0886adc8 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -282,19 +282,18 @@ extract_tbfw() { chkvars TBFW_size # size in bytes, matching TBFW's flash IC x_ mkdir -p tmp - x_ rm -f tmp/tb.bin - find "$appdir" -type f -name "TBT.bin" > "tmp/tb.txt" || \ - $err "extract_tbfw $_dest: Can't extract TBT.bin - $dontflash" - while read -r f; do - [ -f "$f" ] || continue - [ -L "$f" ] && continue - x_ cp "$f" "tmp/tb.bin" - break - done < "tmp/tb.txt" + + x_ rm -f tmp/tb.bin && fx_ copy_tbfw "$appdir" -type f -name "TBT.bin" + x_ dd if=/dev/null of=tmp/tb.bin bs=1 seek=$TBFW_size x_ cp "tmp/tb.bin" "$_dest" } +copy_tbfw() +{ + [ -f "$1" ] && [ ! -L "$1" ] && x_ cp "$1" "tmp/tb.bin" && return 1; : +} + extract_fspm() { copy_fsp M; : @@ -419,16 +418,10 @@ patch_release_roms() hashfile="$_hashes" && break; : done - x_ mkdir -p "tmp" && [ -L "tmp/rom.list" ] && \ - $err "'$archive' -> tmp/rom.list is a symlink - $dontflash" - - find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" > "tmp/rom.list" \ - || $err "'$archive' -> Can't make tmp/rom.list - $dontflash" + x_ mkdir -p "tmp" if readkconfig; then - while read -r _xrom ; do - process_release_rom "$_xrom" || break - done < "tmp/rom.list" + fx_ prep_rom "$tmpromdir" -maxdepth 1 -type f -name "*.rom" [ "$nukemode" != "nuke" ] || \ printf "Make sure you inserted vendor files: %s\n" \ "$vguide" > "$tmpromdir/README.md" || : @@ -462,7 +455,7 @@ patch_release_roms() "$archive" || $err "'$archive' -> Can't overwrite - $dontflash"; : } -process_release_rom() +prep_rom() { _xrom="$1" _xromname="${1##*/}" @@ -578,13 +571,7 @@ modify_mac() [ "$new_mac" != "restore" ] && x_ make -C util/nvmutil && \ x_ "$nvm" tmp/gbe setmac "$new_mac" - find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" > "tmp/rom.list" \ - || $err "'$archive' -> Can't make tmp/rom.list - $dontflash" - - while read -r _xrom; do - e "$_xrom" f && xchanged="y" && x_ \ - "$ifdtool" $ifdprefix -i GbE:tmp/gbe "$_xrom" -O "$_xrom" - done < "tmp/rom.list" + fx_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom" printf "\nGbE NVM written to '%s':\n" "$archive" x_ "$nvm" tmp/gbe dump | grep -v "bytes read from file" || : @@ -593,3 +580,9 @@ modify_mac() printf "\nDefault GbE file '%s' written, unmodified.\n" \ "${CONFIG_GBE_BIN_PATH##*../}"; : } + +newmac() +{ + e "$1" f && xchanged="y" && x_ \ + "$ifdtool" $ifdprefix -i GbE:tmp/gbe "$1" -O "$1"; : +} diff --git a/include/lib.sh b/include/lib.sh index bef2a16f..507a37c1 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -128,6 +128,17 @@ setvars() printf "%s\n" "${_setvars% }" } +fx_() +{ + fd="`mktemp`" + xx="$1" && shift 1 + find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\"" + while read -r fx; do + "$xx" "$fx" || break; : + done < "$fd" + x_ rm -f "$fd" +} + x_() { [ $# -lt 1 ] || "$@" || $err "Unhandled error for: $(echo "$@")"; : diff --git a/mk b/mk index 6a46f93c..8884d61e 100755 --- a/mk +++ b/mk @@ -278,20 +278,9 @@ check_project_hashes() [ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \ read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree" - x_ rm -f "$xbmktmp/project.list" "$xbmktmp/project.hash" \ - "$xbmktmp/project.tmp" - x_ touch "$xbmktmp/project.tmp" "$xbmktmp/project.hash" - - for rmchk in "$datadir" "$configdir/$tree" "$mdir"; do - [ ! -d "$rmchk" ] || find "$rmchk" -type f -not -path \ - "*/.git*/*" >> "$xbmktmp/project.tmp" || $err "!fh $rmchk" - done - sort "$xbmktmp/project.tmp" > "$xbmktmp/project.list" || $err "!pj srt" - - while read -r rmchk; do - [ ! -f "$rmchk" ] || x_ sha512sum "$rmchk" | awk \ - '{print $1}' >> "$xbmktmp/project.hash" || $err "!h $rmchk" - done < "$xbmktmp/project.list" + x_ rm -f "$xbmktmp/project.hash" + fx_ create_project_hash "$datadir" "$configdir/$tree" "$mdir" \ + -type f -not -path "*/.git*/*" pjhash="$(sha512sum "$xbmktmp/project.hash" | awk '{print $1}')" || : [ "$pjhash" != "$old_pjhash" ] && badhash="y" @@ -304,6 +293,12 @@ check_project_hashes() "elf/$project/$tree" "elf/$project/$target"; : } +create_project_hash() +{ + [ ! -f "$1" ] || x_ sha512sum "$1" | awk \ + '{print $1}' >> "$xbmktmp/project.hash" || $err "!h $1"; : +} + check_cross_compiler() { xgccargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" From 47762c84ad0f5e2a6fbe5ceec0bff623239e1e9a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 05:25:11 +0100 Subject: [PATCH 011/267] lib.sh: add fe_ which is fx_ but err on find In the mk script, we need fx_ to not return errors on the find command, since it's searching a bunch of directories where some of them may not exist. All other instances where fx_ is used, must return an error if the directory being searched doesn't exist. For this, fe_() is introduced, which does the same as fx_ but with this much stricter check. Signed-off-by: Leah Rowe --- include/inject.sh | 6 +++--- include/lib.sh | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 0886adc8..2e821d86 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -283,7 +283,7 @@ extract_tbfw() chkvars TBFW_size # size in bytes, matching TBFW's flash IC x_ mkdir -p tmp - x_ rm -f tmp/tb.bin && fx_ copy_tbfw "$appdir" -type f -name "TBT.bin" + x_ rm -f tmp/tb.bin && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" x_ dd if=/dev/null of=tmp/tb.bin bs=1 seek=$TBFW_size x_ cp "tmp/tb.bin" "$_dest" @@ -421,7 +421,7 @@ patch_release_roms() x_ mkdir -p "tmp" if readkconfig; then - fx_ prep_rom "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + fe_ prep_rom "$tmpromdir" -maxdepth 1 -type f -name "*.rom" [ "$nukemode" != "nuke" ] || \ printf "Make sure you inserted vendor files: %s\n" \ "$vguide" > "$tmpromdir/README.md" || : @@ -571,7 +571,7 @@ modify_mac() [ "$new_mac" != "restore" ] && x_ make -C util/nvmutil && \ x_ "$nvm" tmp/gbe setmac "$new_mac" - fx_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + fe_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom" printf "\nGbE NVM written to '%s':\n" "$archive" x_ "$nvm" tmp/gbe dump | grep -v "bytes read from file" || : diff --git a/include/lib.sh b/include/lib.sh index 507a37c1..3f5e5d37 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -128,11 +128,22 @@ setvars() printf "%s\n" "${_setvars% }" } +fe_() +{ + find_ex "x_" "$@" +} + fx_() { + find_ex "" "$@" +} + +find_ex() +{ + errx="$1" && shift 1 fd="`mktemp`" xx="$1" && shift 1 - find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\"" + $errx find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\"" while read -r fx; do "$xx" "$fx" || break; : done < "$fd" From fcc52b986e7612d8bb53e9b51f305c62f611a35b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 05:32:01 +0100 Subject: [PATCH 012/267] init.sh: unified handling of ./tmp not to be confused with /tmp we use ./tmp inside the lbmk work directory, for large files, because /tmp might not be very big, or might be a tmpfs Signed-off-by: Leah Rowe --- include/init.sh | 6 +++++- include/inject.sh | 8 +------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/include/init.sh b/include/init.sh index b8839921..9e0e3a37 100644 --- a/include/init.sh +++ b/include/init.sh @@ -194,6 +194,10 @@ xbmk_create_tmpdir() export TMPDIR="/tmp" export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" xbmktmp="$TMPDIR" + + # /tmp might be a tmpfs, so for large files we use ./tmp, + # not to be confused with xbmktmp (xbmktmp points to /tmp) + x_ mkdir -p tmp } xbmk_lock() @@ -219,7 +223,7 @@ xbmk_child_exec() { xbmk_rval=0 ( x_ ./mk "$@" ) || xbmk_rval=1 - rm -Rf "$xbmktmp" || xbmk_rval=1 + rm -Rf tmp "$xbmktmp" || xbmk_rval=1 rm -f lock || xbmk_rval=1 exit $xbmk_rval } diff --git a/include/inject.sh b/include/inject.sh index 2e821d86..26bcd02f 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -148,8 +148,6 @@ extract_intel_me() chkvars ME11delta ME11version ME11sku ME11pch [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard - x_ mkdir -p tmp - extract_intel_me_bruteforce if [ "$ME11bootguard" = "y" ]; then apply_me11_deguard_mod @@ -281,7 +279,6 @@ extract_sch5545ec() extract_tbfw() { chkvars TBFW_size # size in bytes, matching TBFW's flash IC - x_ mkdir -p tmp x_ rm -f tmp/tb.bin && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" @@ -418,8 +415,6 @@ patch_release_roms() hashfile="$_hashes" && break; : done - x_ mkdir -p "tmp" - if readkconfig; then fe_ prep_rom "$tmpromdir" -maxdepth 1 -type f -name "*.rom" [ "$nukemode" != "nuke" ] || \ @@ -551,7 +546,6 @@ insert() elif [ "$nukemode" = "nuke" ]; then x_ "$cbfstool" "$rom" remove -n "$cbfsname" elif [ "$_t" = "stage" ]; then # the only stage we handle is refcode - x_ mkdir -p tmp x_ rm -f "tmp/refcode" "$rmodtool" -i "$_dest" -o "tmp/refcode" || "!reloc refcode" "$cbfstool" "$rom" add-stage -f "tmp/refcode" -n "$cbfsname" \ @@ -567,7 +561,7 @@ modify_mac() { [ -n "$CONFIG_GBE_BIN_PATH" ] || return 1 - x_ mkdir -p tmp && x_ cp "${CONFIG_GBE_BIN_PATH##*../}" tmp/gbe + x_ cp "${CONFIG_GBE_BIN_PATH##*../}" tmp/gbe [ "$new_mac" != "restore" ] && x_ make -C util/nvmutil && \ x_ "$nvm" tmp/gbe setmac "$new_mac" From 0ffaf5c7331ae0fac9db8cf8a2b670e156fad7e9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 05:33:02 +0100 Subject: [PATCH 013/267] init.sh: Explicitly create the xbmktmp directory mktemp would normally do it, but we must not rely on that Signed-off-by: Leah Rowe --- include/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/init.sh b/include/init.sh index 9e0e3a37..c40894a1 100644 --- a/include/init.sh +++ b/include/init.sh @@ -197,7 +197,7 @@ xbmk_create_tmpdir() # /tmp might be a tmpfs, so for large files we use ./tmp, # not to be confused with xbmktmp (xbmktmp points to /tmp) - x_ mkdir -p tmp + x_ mkdir -p "$xbmktmp" tmp } xbmk_lock() From a17875c34593cf966e61aacb9285f324723bb245 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 05:57:39 +0100 Subject: [PATCH 014/267] lib.sh find_ex: explicitly create the tmp file Signed-off-by: Leah Rowe --- include/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lib.sh b/include/lib.sh index 3f5e5d37..8bad16ce 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -141,7 +141,7 @@ fx_() find_ex() { errx="$1" && shift 1 - fd="`mktemp`" + fd="`mktemp`" && x_ rm -f "$fd" && x_ touch rm -f "$fd" xx="$1" && shift 1 $errx find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\"" while read -r fx; do From 44a1cc9ef85626a0d45c7b838a3637ec9f316540 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 06:23:10 +0100 Subject: [PATCH 015/267] util/nvmutil: use x, not ?, for random characters A user reported that '?' causes an error on zsh. See: https://codeberg.org/libreboot/lbmk/issues/261 For example: ./mk inject libreboot-XXXXXX.tar.xz setmac ??:??:??:??:??:?? The user got: zsh: no matches found: ??:??:??:??:??:?? The mitigation here is to double-quote, e.g.: ./mk inject libreboot-XXXXXX.tar.xz setmac "??:??:??:??:??:??" However, a lot of people won't do that. Therefore, I will retain the current behaviour but support x/X for randomness. Now lbmk uses x by default, instead. I will now update the documentation, accordingly. Signed-off-by: Leah Rowe --- include/inject.sh | 2 +- util/nvmutil/nvmutil.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 26bcd02f..beaebf4d 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -328,7 +328,7 @@ inject() eval "`setvars "" nukemode new_mac xchanged`" archive="$1"; - new_mac="??:??:??:??:??:??" + new_mac="xx:xx:xx:xx:xx:xx" [ $# -gt 1 ] && case "$2" in nuke) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 12aabe4d..05459bb7 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -40,7 +40,7 @@ size_t partsize, gbe[2]; uint8_t nvmPartChanged[2] = {0, 0}, do_read[2] = {1, 1}; int flags, rfd, fd, part; -const char *strMac = NULL, *strRMac = "??:??:??:??:??:??", *filename = NULL; +const char *strMac = NULL, *strRMac = "xx:xx:xx:xx:xx:xx", *filename = NULL; typedef struct op { char *str; @@ -278,8 +278,11 @@ parseMacString(const char *strMac, uint16_t *mac) err(errno = EINVAL, "Invalid character '%c'", strMac[i + nib]); + /* If random, ensure that local/unicast bits are set */ if ((byte == 0) && (nib == 1)) - if (strMac[i + nib] == '?') /* ?=random */ + if ((strMac[i + nib] == '?') || + (strMac[i + nib] == 'x') || + (strMac[i + nib] == 'X')) /* random */ h = (h & 0xE) | 2; /* local, unicast */ mac[byte >> 1] |= ((uint16_t ) h) @@ -302,7 +305,10 @@ hextonum(char ch) return ch - 'A' + 10; else if ((ch >= 'a') && (ch <= 'f')) return ch - 'a' + 10; - return (ch == '?') ? rhex() : 16; + else if ((ch == '?') || (ch == 'x') || (ch == 'X')) + return rhex(); /* random hex value */ + else + return 16; /* error: invalid character */ } uint8_t From 308df9ca4061e66ca1bdfb4c5c23cc4153d3ce31 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 06:28:14 +0100 Subject: [PATCH 016/267] inject.sh: always re-build nvmutil it's not a lot of code, and takes less than a second. the previous change uses x instead of ?, but this would cause an error if the nvmutil was already built, because the makefile might cause a build to be skipped. therefore, force a re-build to mitigate the error. Signed-off-by: Leah Rowe --- include/inject.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/inject.sh b/include/inject.sh index beaebf4d..8fb0a34e 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -562,7 +562,8 @@ modify_mac() [ -n "$CONFIG_GBE_BIN_PATH" ] || return 1 x_ cp "${CONFIG_GBE_BIN_PATH##*../}" tmp/gbe - [ "$new_mac" != "restore" ] && x_ make -C util/nvmutil && \ + [ "$new_mac" != "restore" ] && x_ make -C util/nvmutil clean && \ + x_ make -C util/nvmutil && \ x_ "$nvm" tmp/gbe setmac "$new_mac" fe_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom" From 0b09d970732cb396f1868c41ee9842b4a96f0c36 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 06:35:48 +0100 Subject: [PATCH 017/267] inject.sh: Only build nvmutil once Signed-off-by: Leah Rowe --- include/inject.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 8fb0a34e..0aefc210 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -341,6 +341,11 @@ inject() esac [ "$new_mac" = "keep" ] && new_mac="" + if [ -n "$new_mac" ] && [ "$new_mac" != "restore" ]; then + x_ make -C util/nvmutil clean + x_ make -C util/nvmutil + fi + check_release "$archive" || $err "'$archive' is not a release archive" readcfg && need_files="y" @@ -562,8 +567,7 @@ modify_mac() [ -n "$CONFIG_GBE_BIN_PATH" ] || return 1 x_ cp "${CONFIG_GBE_BIN_PATH##*../}" tmp/gbe - [ "$new_mac" != "restore" ] && x_ make -C util/nvmutil clean && \ - x_ make -C util/nvmutil && \ + [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ x_ "$nvm" tmp/gbe setmac "$new_mac" fe_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom" From 7fadb17fd9ed7e916f62849132d73648ea9a099d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 06:36:43 +0100 Subject: [PATCH 018/267] lib.sh: Fix bad touch command Signed-off-by: Leah Rowe --- include/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lib.sh b/include/lib.sh index 8bad16ce..3c603bae 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -141,7 +141,7 @@ fx_() find_ex() { errx="$1" && shift 1 - fd="`mktemp`" && x_ rm -f "$fd" && x_ touch rm -f "$fd" + fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" xx="$1" && shift 1 $errx find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\"" while read -r fx; do From 0f7b3691abafdbb46ea8e7bc95332da9d4be80d2 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 06:41:20 +0100 Subject: [PATCH 019/267] lib.sh: redirect find errors to /dev/null this silences confusing error messages that the user sees on the screen, that are actually benign, and it will thus reduce the number of people who ask questions on #libreboot irc Signed-off-by: Leah Rowe --- include/lib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/lib.sh b/include/lib.sh index 3c603bae..d58716c3 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -143,7 +143,8 @@ find_ex() errx="$1" && shift 1 fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" xx="$1" && shift 1 - $errx find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\"" + $errx find "$@" 2>/dev/null | sort > "$fd" || \ + $err "!find $(echo "$@") > \"$fd\"" while read -r fx; do "$xx" "$fx" || break; : done < "$fd" From 00d22f20829251f55cd2e859d6fae9a61220c072 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 06:53:25 +0100 Subject: [PATCH 020/267] lbmk: Unified local ./tmp handling Make it an absolute directory, relative to xbmktmp. Signed-off-by: Leah Rowe --- include/git.sh | 2 +- include/init.sh | 8 +++++--- include/inject.sh | 32 +++++++++++++++++--------------- mk | 1 - 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/include/git.sh b/include/git.sh index 9be79527..37f5bbae 100644 --- a/include/git.sh +++ b/include/git.sh @@ -5,7 +5,7 @@ eval "`setvars "" loc url bkup_url subfile subhash subrepo subrepo_bkup \ depend subfile_bkup repofail`" -tmpgit="$xbmkpwd/tmp/gitclone" +tmpgit="$xbmklocal/gitclone" fetch_targets() { diff --git a/include/init.sh b/include/init.sh index c40894a1..a5180d07 100644 --- a/include/init.sh +++ b/include/init.sh @@ -17,11 +17,13 @@ xbmkpath="$PATH" err="err_" eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \ - datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver`" + datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver xbmklocal`" xbmk_init() { xbmkpwd="`pwd`" || $err "Cannot generate PWD" + xbmklocal="$xbmkpwd/tmp" + export PWD="$xbmkpwd" if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then @@ -197,7 +199,7 @@ xbmk_create_tmpdir() # /tmp might be a tmpfs, so for large files we use ./tmp, # not to be confused with xbmktmp (xbmktmp points to /tmp) - x_ mkdir -p "$xbmktmp" tmp + x_ mkdir -p "$xbmktmp" "$xbmklocal" } xbmk_lock() @@ -223,7 +225,7 @@ xbmk_child_exec() { xbmk_rval=0 ( x_ ./mk "$@" ) || xbmk_rval=1 - rm -Rf tmp "$xbmktmp" || xbmk_rval=1 + rm -Rf "$xbmklocal" "$xbmktmp" || xbmk_rval=1 rm -f lock || xbmk_rval=1 exit $xbmk_rval } diff --git a/include/inject.sh b/include/inject.sh index 0aefc210..805415ef 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -14,7 +14,7 @@ hashfiles="vendorhashes blobhashes" # blobhashes for backwards compatibility dontflash="!!! AN ERROR OCCURED! Please DO NOT flash if injection failed. !!!" vfix="DO_NOT_FLASH_YET._FIRST,_INJECT_FILES_VIA_INSTRUCTIONS_ON_LIBREBOOT.ORG_" vguide="https://libreboot.org/docs/install/ivy_has_common.html" -tmpromdel="$xbmkpwd/tmp/DO_NOT_FLASH" +tmpromdel="$xbmklocal/DO_NOT_FLASH" nvm="util/nvmutil/nvm" ifdtool="elf/ifdtool/default/ifdtool" @@ -142,7 +142,7 @@ extract_intel_me() cdir="$xbmkpwd/$appdir" _me="$xbmkpwd/$_dest" - _metmp="$xbmkpwd/tmp/me.bin" + _metmp="$xbmklocal/me.bin" mfs="" && [ "$ME11bootguard" = "y" ] && mfs="--whitelist MFS" && \ chkvars ME11delta ME11version ME11sku ME11pch @@ -280,15 +280,17 @@ extract_tbfw() { chkvars TBFW_size # size in bytes, matching TBFW's flash IC - x_ rm -f tmp/tb.bin && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" + tbtmp="$xbmklocal/tb.bin" + x_ rm -f "$tbtmp" && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" - x_ dd if=/dev/null of=tmp/tb.bin bs=1 seek=$TBFW_size - x_ cp "tmp/tb.bin" "$_dest" + x_ dd if=/dev/null of="$tbtmp" bs=1 seek=$TBFW_size + x_ cp "$tbtmp" "$_dest" } copy_tbfw() { - [ -f "$1" ] && [ ! -L "$1" ] && x_ cp "$1" "tmp/tb.bin" && return 1; : + [ -f "$1" ] && [ ! -L "$1" ] && x_ cp "$1" "$xbmklocal/tb.bin" && \ + return 1; : } extract_fspm() @@ -409,7 +411,7 @@ readcfg() patch_release_roms() { has_hashes="n" - tmpromdir="tmp/DO_NOT_FLASH/bin/$board" + tmpromdir="$xbmklocal/DO_NOT_FLASH/bin/$board" remkdir "${tmpromdir%"/bin/$board"}" x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}" @@ -551,10 +553,10 @@ insert() elif [ "$nukemode" = "nuke" ]; then x_ "$cbfstool" "$rom" remove -n "$cbfsname" elif [ "$_t" = "stage" ]; then # the only stage we handle is refcode - x_ rm -f "tmp/refcode" - "$rmodtool" -i "$_dest" -o "tmp/refcode" || "!reloc refcode" - "$cbfstool" "$rom" add-stage -f "tmp/refcode" -n "$cbfsname" \ - -t stage || $err "$rom: !add ref" + x_ rm -f "$xbmklocal/refcode" + "$rmodtool" -i "$_dest" -o "$xbmklocal/refcode" || "!reloc ref" + "$cbfstool" "$rom" add-stage -f "$xbmklocal/refcode" \ + -n "$cbfsname" -t stage || $err "$rom: !add ref" else "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \ -t $_t $_offset || $err "$rom !add $_t ($_dest)" @@ -566,14 +568,14 @@ modify_mac() { [ -n "$CONFIG_GBE_BIN_PATH" ] || return 1 - x_ cp "${CONFIG_GBE_BIN_PATH##*../}" tmp/gbe + x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbmklocal/gbe" [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ - x_ "$nvm" tmp/gbe setmac "$new_mac" + x_ "$nvm" "$xbmklocal/gbe" setmac "$new_mac" fe_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom" printf "\nGbE NVM written to '%s':\n" "$archive" - x_ "$nvm" tmp/gbe dump | grep -v "bytes read from file" || : + x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || : [ "$new_mac" = "restore" ] && \ printf "\nDefault GbE file '%s' written, unmodified.\n" \ @@ -583,5 +585,5 @@ modify_mac() newmac() { e "$1" f && xchanged="y" && x_ \ - "$ifdtool" $ifdprefix -i GbE:tmp/gbe "$1" -O "$1"; : + "$ifdtool" $ifdprefix -i GbE:"$xbmklocal/gbe" "$1" -O "$1"; : } diff --git a/mk b/mk index 8884d61e..312ffce3 100755 --- a/mk +++ b/mk @@ -68,7 +68,6 @@ build_release() cd "$srcdir" || $err "$vdir: !cd \"$srcdir\"" ./mk -f - x_ rm -Rf tmp rmgit . x_ mv src/docs docs ) || $err "can't create release files" From 498f5a26cc82db8063c37876058091e1b1279d45 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 07:04:34 +0100 Subject: [PATCH 021/267] init.sh: Always create xbmklocal If we're in a release work directory, TMPDIR is already set, so the local ./tmp won't be created, which would lead to an error. Fix it by creating xbmklocal before checking TMPDIR. Signed-off-by: Leah Rowe --- include/init.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/init.sh b/include/init.sh index a5180d07..c4650576 100644 --- a/include/init.sh +++ b/include/init.sh @@ -186,6 +186,8 @@ xbmk_git_init() xbmk_create_tmpdir() { + x_ mkdir -p "$xbmklocal" + # unify all temporary files/directories in a single TMPDIR [ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || \ unset TMPDIR From 530e4109a2b4ad2d26c3e29eda652e2ab180cf84 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 07:05:38 +0100 Subject: [PATCH 022/267] init.sh: *Re-create* tmpdirs on parent instance To make sure any old files are removed, always re-create. Signed-off-by: Leah Rowe --- include/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/init.sh b/include/init.sh index c4650576..3f813ea7 100644 --- a/include/init.sh +++ b/include/init.sh @@ -201,7 +201,7 @@ xbmk_create_tmpdir() # /tmp might be a tmpfs, so for large files we use ./tmp, # not to be confused with xbmktmp (xbmktmp points to /tmp) - x_ mkdir -p "$xbmktmp" "$xbmklocal" + remkdir "$xbmktmp" "$xbmklocal" } xbmk_lock() From 8de0ed811fb9bc48659f95918a36317f24be3d8e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 07:17:21 +0100 Subject: [PATCH 023/267] inject.sh: Stricter TBFW handling Don't copy it until it has been padded properly. Otherwise, erroneous padding would result in an error, and who knows what would be left in vendorfiles/ ? Signed-off-by: Leah Rowe --- include/inject.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 805415ef..c5e41f6d 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -278,19 +278,23 @@ extract_sch5545ec() # https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988 extract_tbfw() { - chkvars TBFW_size # size in bytes, matching TBFW's flash IC - - tbtmp="$xbmklocal/tb.bin" - x_ rm -f "$tbtmp" && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" - - x_ dd if=/dev/null of="$tbtmp" bs=1 seek=$TBFW_size - x_ cp "$tbtmp" "$_dest" + chkvars TBFW_size + fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" + [ -f "$_dest" ] || $err "$board: Could not extract tbfw"; : } copy_tbfw() { - [ -f "$1" ] && [ ! -L "$1" ] && x_ cp "$1" "$xbmklocal/tb.bin" && \ - return 1; : + [ -f "$1" ] || return 0 + [ -L "$1" ] && return 0 + + tbtmp="$xbmklocal/tb.bin" + x_ rm -f "$tbtmp" + + x_ dd if=/dev/null of="$1" bs=1 seek=$TBFW_size + x_ mv "$1" "$_dest" + + return 1 } extract_fspm() From bf569d2b4dcbf8efc648da1a87803eefd4b892dc Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 07:20:48 +0100 Subject: [PATCH 024/267] inject.sh: Remove redundant code in copy_tbfw We don't use the tbtmp variable anymore, in this function. Signed-off-by: Leah Rowe --- include/inject.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index c5e41f6d..b0f3f502 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -288,9 +288,6 @@ copy_tbfw() [ -f "$1" ] || return 0 [ -L "$1" ] && return 0 - tbtmp="$xbmklocal/tb.bin" - x_ rm -f "$tbtmp" - x_ dd if=/dev/null of="$1" bs=1 seek=$TBFW_size x_ mv "$1" "$_dest" From 72f4412a52df60bd2d3f01a4c8dc138334ffe434 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 13:15:40 +0100 Subject: [PATCH 025/267] inject.sh: simplified fsp extraction we know that _dest is always what's set in the coreboot config, without the ../../../ in it, so just copy both files in a single function, and call the function twice. if both files are done on the first call, the second call will be skipped. if only the first file was done on the first call, running the download script again will skip the first one, and grab the second one. this also avoids having to run the decat function twice, in most cases, so it's a tiny optimisation. this optimisation only works if both fsp files (s and m) are to be extracted into the same directory, which is the case anyway, and this will always be the case. Signed-off-by: Leah Rowe --- include/inject.sh | 51 ++++++++++++----------------------------------- 1 file changed, 13 insertions(+), 38 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index b0f3f502..a9d1350a 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -95,9 +95,9 @@ getfiles() # therefore, handle them separately, in case one of them is libre; if # one of them was, the path wouldn't be set. # - [ -z "$CONFIG_FSP_M_FILE" ] || fetch "fspm" "$CONFIG_FSP_FD_PATH" \ + [ -z "$CONFIG_FSP_M_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_M_FILE" copy - [ -z "$CONFIG_FSP_S_FILE" ] || fetch "fsps" "$CONFIG_FSP_FD_PATH" \ + [ -z "$CONFIG_FSP_S_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_S_FILE" copy; : } @@ -111,14 +111,12 @@ fetch() [ "$5" = "/dev/null" ] && return 0 _dl="$XBMK_CACHE/file/$dlsum" - if [ "$dl_type" = "fspm" ] || [ "$dl_type" = "fsps" ]; then - # HACK: if grabbing fsp from coreboot, fix the path for lbmk - for _cdl in dl dl_bkup; do - eval "$_cdl=\"\${$_cdl##*../}\"; _cdp=\"\$$_cdl\"" - [ -f "$_cdp" ] || _cdp="$cbdir/$_cdp" - [ -f "$_cdp" ] && eval "$_cdl=\"$_cdp\"" - done - fi + # HACK: if grabbing fsp from coreboot, fix the path for lbmk + [ "$dl_type" = "fsp" ] && for _cdl in dl dl_bkup; do + eval "$_cdl=\"\${$_cdl##*../}\"; _cdp=\"\$$_cdl\"" + [ -f "$_cdp" ] || _cdp="$cbdir/$_cdp" + [ -f "$_cdp" ] && eval "$_cdl=\"$_cdp\"" + done; : dlop="curl" && [ $# -gt 5 ] && dlop="$6" xbmkget "$dl" "$dl_bkup" "$_dl" "$dlsum" "$dlop" @@ -205,12 +203,9 @@ apply_me11_deguard_mod() extract_archive() { - if [ $# -gt 2 ]; then - if [ "$3" = "fspm" ] || [ "$3" = "fsps" ]; then - decat_fspfd "$1" "$2" - return 0 - fi - fi + [ $# -gt 2 ] && [ "$3" = "fsp" ] && x_ python \ + "$cbdir/3rdparty/fsp/Tools/SplitFspBin.py" split -f "$1" -o "$2" \ + -n "Fsp.fd" && return 0 innoextract "$1" -d "$2" || python "$pfs_extract" "$1" -e || 7z x \ "$1" -o"$2" || unar "$1" -o "$2" || unzip "$1" -d "$2" || return 1 @@ -219,15 +214,6 @@ extract_archive() $err "!mv '${_dl}_extracted' '$2' - $dontflash"; : } -decat_fspfd() -{ - _fspfd="$1" - _fspdir="$2" - _fspsplit="$cbdir/3rdparty/fsp/Tools/SplitFspBin.py" - - x_ $python "$_fspsplit" split -f "$_fspfd" -o "$_fspdir" -n "Fsp.fd" -} - extract_kbc1126ec() { x_ e "$kbc1126_ec_dump" f @@ -294,20 +280,9 @@ copy_tbfw() return 1 } -extract_fspm() +extract_fsp() { - copy_fsp M; : -} - -extract_fsps() -{ - copy_fsp S; : -} - -# this copies the fsp s/m; re-base is handled by ./mk inject -copy_fsp() -{ - x_ cp "$appdir/Fsp_$1.fd" "$_dest" + x_ cp "$appdir/"Fsp_*.fd "${_dest%/*}" } fail_inject() From 5499ae66bd8e7c36fd6f298b68365d39672a2cfa Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 13:35:28 +0100 Subject: [PATCH 026/267] inject.sh: simplify extract_archive() Signed-off-by: Leah Rowe --- include/inject.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index a9d1350a..a200981f 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -210,8 +210,7 @@ extract_archive() innoextract "$1" -d "$2" || python "$pfs_extract" "$1" -e || 7z x \ "$1" -o"$2" || unar "$1" -o "$2" || unzip "$1" -d "$2" || return 1 - [ ! -d "${_dl}_extracted" ] || cp -R "${_dl}_extracted" "$2" || \ - $err "!mv '${_dl}_extracted' '$2' - $dontflash"; : + [ ! -d "${_dl}_extracted" ] || x_ cp -R "${_dl}_extracted" "$2"; : } extract_kbc1126ec() From 46b968a6e859ca7a0406c1c446ff1a53d74ad887 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 13:49:49 +0100 Subject: [PATCH 027/267] inject.sh: minor code cleanup Signed-off-by: Leah Rowe --- include/inject.sh | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index a200981f..9bfda2db 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -228,9 +228,7 @@ extract_kbc1126ec() ) || $err "$board: can't extract kbc1126 ec firmware - $dontflash" x_ e "$appdir/ec.bin.fw1" f && x_ e "$appdir/ec.bin.fw2" f - - cp "$appdir/"ec.bin.fw* "${_dest%/*}/" || \ - $err "!cp 1126ec $_dest - $dontflash"; : + x_ cp "$appdir/"ec.bin.fw* "${_dest%/*}/" } extract_e6400vga() @@ -318,10 +316,8 @@ inject() esac [ "$new_mac" = "keep" ] && new_mac="" - if [ -n "$new_mac" ] && [ "$new_mac" != "restore" ]; then - x_ make -C util/nvmutil clean - x_ make -C util/nvmutil - fi + [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ + x_ make -C util/nvmutil clean && x_ make -C util/nvmutil check_release "$archive" || $err "'$archive' is not a release archive" @@ -510,11 +506,10 @@ insert() _offset="" - if [ "$_t" = "fsp" ]; then - [ $# -gt 3 ] && _offset="$4" - else - [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ] && \ - $err "insert $*, $rom: offset given but empty (undefined)" + if [ "$_t" = "fsp" ] && [ $# -gt 3 ]; then + _offset="$4" + elif [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ]; then + $err "insert $*, $rom: offset given but empty (undefined)" fi [ "$nukemode" = "nuke" ] || x_ e "$_dest" f @@ -551,10 +546,6 @@ modify_mac() printf "\nGbE NVM written to '%s':\n" "$archive" x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || : - - [ "$new_mac" = "restore" ] && \ - printf "\nDefault GbE file '%s' written, unmodified.\n" \ - "${CONFIG_GBE_BIN_PATH##*../}"; : } newmac() From 7a2f33264d713919bee5a6a4422f3664474b3420 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 18:04:47 +0100 Subject: [PATCH 028/267] mk: simplify check_gnu_path() the initial checks are unnecessary, since i always know what arguments are being provided. the -f check in the for loop is now an -x instead, more efficient and complete. Signed-off-by: Leah Rowe --- mk | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/mk b/mk index 312ffce3..06a77522 100755 --- a/mk +++ b/mk @@ -332,35 +332,25 @@ check_cross_compiler() # gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental" check_gnu_path() { - [ $# -lt 2 ] && $err "check_gnu_path: Too few arguments" - [ "$1" = "$2" ] && $err "check_gnu_path: Both arguments identical" - for _gnuarg in 1 2; do - eval "[ \"\$$_gnuarg\" = \"gcc\" ] && continue" - eval "[ \"\$$_gnuarg\" = \"gnat\" ] && continue" - $err "check_gnu_path: Invalid argument \"$_gnuarg\"" - done command -v "$1" 1>/dev/null || $err "Host '$1' unavailable" eval "`setvars "" gccver gccfull gnatver gnatfull gccdir gnatdir`" - gnu_setver "$1" "$1" || $err "Command '$1' unavailable." - gnu_setver "$2" "$2" || : + x_ gnu_setver "$1" "$1" && gnu_setver "$2" "$2" || : eval "[ -z \"\$$1ver\" ] && $err \"Cannot detect host '$1' version\"" [ "$gnatfull" = "$gccfull" ] && return 0 eval "$1dir=\"$(dirname "$(command -v "$1")")\"" eval "_gnudir=\"\$$1dir\"; _gnuver=\"\$$1ver\"" - for _gnubin in "$_gnudir/$2-"*; do - [ -f "$_gnubin" ] || continue - [ "${_gnubin#"$_gnudir/$2-"}" = "$_gnuver" ] || continue - _gnuver="${_gnubin#"$_gnudir/$2-"}"; break + for _bin in "$_gnudir/$2-"*; do + [ "${_bin#"$_gnudir/$2-"}" = "$_gnuver" ] && [ -x "$_bin" ] \ + && _gnuver="${_bin#"$_gnudir/$2-"}" && break; : done gnu_setver "$2" "$_gnudir/$2-$_gnuver" || return 1 [ "$gnatfull" = "$gccfull" ] || return 1 ( - rm -f "$XBMK_CACHE/gnupath/"* || $err "Cannot clear gnupath/" - cd "$XBMK_CACHE/gnupath" || $err "Can't cd to gnupath/" + remkdir "$XBMK_CACHE/gnupath" && x_ cd "$XBMK_CACHE/gnupath" for _gnubin in "$_gnudir/$2"*"-$_gnuver"; do _gnuutil="${_gnubin##*/}" && [ -e "$_gnubin" ] && \ x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}" From 8f828e6cd35d82b0a0fa20b202d49ab092161fa3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 18:14:59 +0100 Subject: [PATCH 029/267] mk: tidy up check_project_hashes() sha512sum check the extra function isn't needed at all. awk can just handle every line all at once. Signed-off-by: Leah Rowe --- mk | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mk b/mk index 06a77522..2020115b 100755 --- a/mk +++ b/mk @@ -277,9 +277,9 @@ check_project_hashes() [ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \ read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree" - x_ rm -f "$xbmktmp/project.hash" - fx_ create_project_hash "$datadir" "$configdir/$tree" "$mdir" \ - -type f -not -path "*/.git*/*" + fx_ sha512sum "$datadir" "$configdir/$tree" "$mdir" \ + -type f -not -path "*/.git*/*" | awk '{print $1}' > \ + "$xbmktmp/project.hash" || $err "!h $project $tree" pjhash="$(sha512sum "$xbmktmp/project.hash" | awk '{print $1}')" || : [ "$pjhash" != "$old_pjhash" ] && badhash="y" @@ -292,12 +292,6 @@ check_project_hashes() "elf/$project/$tree" "elf/$project/$target"; : } -create_project_hash() -{ - [ ! -f "$1" ] || x_ sha512sum "$1" | awk \ - '{print $1}' >> "$xbmktmp/project.hash" || $err "!h $1"; : -} - check_cross_compiler() { xgccargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" From aa4083443b14335c8ada088034434b584aacc789 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 3 May 2025 18:30:37 +0100 Subject: [PATCH 030/267] mk: Allow use of x_ on prefix functions Use this for the sha512sum command, on the main mk script at the function check_project_hashes(). Signed-off-by: Leah Rowe --- include/lib.sh | 2 +- mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index d58716c3..50813352 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -146,7 +146,7 @@ find_ex() $errx find "$@" 2>/dev/null | sort > "$fd" || \ $err "!find $(echo "$@") > \"$fd\"" while read -r fx; do - "$xx" "$fx" || break; : + $xx "$fx" || break; : done < "$fd" x_ rm -f "$fd" } diff --git a/mk b/mk index 2020115b..28a4cb0c 100755 --- a/mk +++ b/mk @@ -277,7 +277,7 @@ check_project_hashes() [ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \ read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree" - fx_ sha512sum "$datadir" "$configdir/$tree" "$mdir" \ + fx_ "x_ sha512sum" "$datadir" "$configdir/$tree" "$mdir" \ -type f -not -path "*/.git*/*" | awk '{print $1}' > \ "$xbmktmp/project.hash" || $err "!h $project $tree" From c33467df1e6119e07608e4e35193815bd2050b1c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:02:14 +0100 Subject: [PATCH 031/267] mk: reduce indentation in check_cross_compiler() we only call it in one place. the resulting code is still quite clear. Signed-off-by: Leah Rowe --- mk | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/mk b/mk index 28a4cb0c..765772b4 100755 --- a/mk +++ b/mk @@ -211,7 +211,9 @@ handle_defconfig() if [ "$mode" = "distclean" ] || [ "$mode" = "crossgcc-clean" ]; then [ -d "$srcdir" ] || return 0 fi - [ -z "$mode" ] && $dry check_cross_compiler + [ -z "$mode" ] && for _xarch in $xarch; do + $dry check_cross_compiler "$_xarch" + done; : for y in "$target_dir/config"/*; do [ "$_f" = "-d" ] || [ -f "$y" ] || continue @@ -295,29 +297,28 @@ check_project_hashes() check_cross_compiler() { xgccargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" - for _xarch in $xarch; do - cbdir="src/coreboot/$tree" - [ "$project" != "coreboot" ] && cbdir="src/coreboot/default" - [ -n "$xtree" ] && cbdir="src/coreboot/$xtree" - x_ ./mk -f coreboot "${cbdir#src/coreboot/}" + cbdir="src/coreboot/$tree" + [ "$project" != "coreboot" ] && cbdir="src/coreboot/default" + [ -n "$xtree" ] && cbdir="src/coreboot/$xtree" - export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH" - export CROSS_COMPILE="${xarch% *}-" - [ -n "$xlang" ] && export BUILD_LANGUAGES="$xlang" + x_ ./mk -f coreboot "${cbdir#src/coreboot/}" - xfix="${_xarch%-*}" && [ "$xfix" = "x86_64" ] && xfix="x64" + export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH" + export CROSS_COMPILE="${xarch% *}-" + [ -n "$xlang" ] && export BUILD_LANGUAGES="$xlang" - # match gnat-X to gcc - check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc + xfix="${1%-*}" && [ "$xfix" = "x86_64" ] && xfix="x64" - # sometimes buildgcc fails for like no reason. try twice. - make -C "$cbdir" crossgcc-$xfix $xgccargs || \ - x_ make -C "$cbdir" crossgcc-$xfix $xgccargs + # match gnat-X to gcc + check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc - # we only want to mess with hostcc to build xgcc - rm -f "$XBMK_CACHE/gnupath/"* || $err "Can't clear gnupath/"; : - done; : + # sometimes buildgcc fails for like no reason. try twice. + make -C "$cbdir" crossgcc-$xfix $xgccargs || \ + x_ make -C "$cbdir" crossgcc-$xfix $xgccargs + + # we only want to mess with hostcc to build xgcc + rm -f "$XBMK_CACHE/gnupath/"* || $err "Can't clear gnupath/"; : } # fix mismatching gcc/gnat versions on debian trixie/sid. as of december 2024, From 488d52e784f4520f679e5823ff2c48057037cbd8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:04:36 +0100 Subject: [PATCH 032/267] mk: re-make gnupath/ for each cross compiler it could be that some were left over before, for some reason. that isn't currently the case, but this will avoid the possibility in future. therefore, this is a preemptive bug fix. Signed-off-by: Leah Rowe --- mk | 1 + 1 file changed, 1 insertion(+) diff --git a/mk b/mk index 765772b4..4d7cf116 100755 --- a/mk +++ b/mk @@ -296,6 +296,7 @@ check_project_hashes() check_cross_compiler() { + remkdir "$XBMK_CACHE/gnupath" xgccargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" cbdir="src/coreboot/$tree" From 1b7a9fd637d2ca98d1da5ded0e2090bd311b4b8c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:07:06 +0100 Subject: [PATCH 033/267] mk: tidy up check_cross_compiler only initialise variables at the point they're needed. Signed-off-by: Leah Rowe --- mk | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mk b/mk index 4d7cf116..2dd9379b 100755 --- a/mk +++ b/mk @@ -297,7 +297,6 @@ check_project_hashes() check_cross_compiler() { remkdir "$XBMK_CACHE/gnupath" - xgccargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" cbdir="src/coreboot/$tree" [ "$project" != "coreboot" ] && cbdir="src/coreboot/default" @@ -309,12 +308,11 @@ check_cross_compiler() export CROSS_COMPILE="${xarch% *}-" [ -n "$xlang" ] && export BUILD_LANGUAGES="$xlang" - xfix="${1%-*}" && [ "$xfix" = "x86_64" ] && xfix="x64" - # match gnat-X to gcc check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc - # sometimes buildgcc fails for like no reason. try twice. + xfix="${1%-*}" && [ "$xfix" = "x86_64" ] && xfix="x64" + xgccargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" make -C "$cbdir" crossgcc-$xfix $xgccargs || \ x_ make -C "$cbdir" crossgcc-$xfix $xgccargs From f5b2bdb88681bd16f2a32c8fb3f51cfc65da9448 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:07:53 +0100 Subject: [PATCH 034/267] mk: re-make gnupath/ after handling crossgcc instead of deleting every file within Signed-off-by: Leah Rowe --- mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk b/mk index 2dd9379b..c87acfe7 100755 --- a/mk +++ b/mk @@ -317,7 +317,7 @@ check_cross_compiler() x_ make -C "$cbdir" crossgcc-$xfix $xgccargs # we only want to mess with hostcc to build xgcc - rm -f "$XBMK_CACHE/gnupath/"* || $err "Can't clear gnupath/"; : + remkdir "$XBMK_CACHE/gnupath" } # fix mismatching gcc/gnat versions on debian trixie/sid. as of december 2024, From b6a2dc4ea3ca18bff174014d1724aebd5dc28b84 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:10:36 +0100 Subject: [PATCH 035/267] init.sh: tidy up pathdir creation we can use remkdir here. it does the same thing. Signed-off-by: Leah Rowe --- include/init.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/init.sh b/include/init.sh index 3f813ea7..7026594a 100644 --- a/include/init.sh +++ b/include/init.sh @@ -212,8 +212,7 @@ xbmk_lock() xbmk_create_pathdirs() { - x_ rm -Rf "$XBMK_CACHE/xbmkpath" "$XBMK_CACHE/gnupath" - x_ mkdir -p "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" + remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH" ( # set up python v3.x in PATH, in case it's not set up correctly. From 184871bc17cdc5716d8d8bcfff03b0f7412b7a1a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:10:59 +0100 Subject: [PATCH 036/267] mk: remove useless code this was added a few commits ago, but the previous commit made me realise it's not needed at all. Signed-off-by: Leah Rowe --- mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/mk b/mk index c87acfe7..49cebaf1 100755 --- a/mk +++ b/mk @@ -296,8 +296,6 @@ check_project_hashes() check_cross_compiler() { - remkdir "$XBMK_CACHE/gnupath" - cbdir="src/coreboot/$tree" [ "$project" != "coreboot" ] && cbdir="src/coreboot/default" [ -n "$xtree" ] && cbdir="src/coreboot/$xtree" From fc71e52fdfc559d207ea54059a86edb81e928e33 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:14:44 +0100 Subject: [PATCH 037/267] mk: tidy up xgccargs handling Signed-off-by: Leah Rowe --- mk | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mk b/mk index 49cebaf1..5a4afadf 100755 --- a/mk +++ b/mk @@ -310,9 +310,8 @@ check_cross_compiler() check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc xfix="${1%-*}" && [ "$xfix" = "x86_64" ] && xfix="x64" - xgccargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" - make -C "$cbdir" crossgcc-$xfix $xgccargs || \ - x_ make -C "$cbdir" crossgcc-$xfix $xgccargs + xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" + make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs # we only want to mess with hostcc to build xgcc remkdir "$XBMK_CACHE/gnupath" From 93ba36ae456cad1e0766c1020ac2dfdb013b6411 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:19:17 +0100 Subject: [PATCH 038/267] rom.sh: tidy up copyps1bios() Signed-off-by: Leah Rowe --- include/rom.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/rom.sh b/include/rom.sh index f74912af..ec464d85 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -29,8 +29,7 @@ mkserprog() copyps1bios() { - x_ rm -Rf bin/playstation - x_ mkdir -p bin/playstation + remkdir "bin/playstation" x_ cp src/pcsx-redux/src/mips/openbios/openbios.bin bin/playstation printf "MIT License\n\nCopyright (c) 2019-2024 PCSX-Redux authors\n\n" \ From 7acec7a3a1d40a38b88b56e9c56087da263f30d1 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:29:19 +0100 Subject: [PATCH 039/267] init.sh: simplify dependencies handling Signed-off-by: Leah Rowe --- include/init.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/init.sh b/include/init.sh index 7026594a..fc321605 100644 --- a/include/init.sh +++ b/include/init.sh @@ -26,10 +26,7 @@ xbmk_init() export PWD="$xbmkpwd" - if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then - install_packages "$@" || exit 1 - exit 0 - fi + [ $# -gt 0 ] && [ "$1" = "dependencies" ] && x_ xbmkpkg "$@" && exit 0 id -u 1>/dev/null 2>/dev/null || $err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || $err "this command as root is not permitted" @@ -40,7 +37,7 @@ xbmk_init() done } -install_packages() +xbmkpkg() { [ $# -lt 2 ] && $err "fewer than two arguments" [ $# -gt 2 ] && reinstall="$3" From 7392f6fc8ecbff10661be6ae66306afd89f1a3e3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:33:17 +0100 Subject: [PATCH 040/267] init.sh: move non-init functions to lib.sh these were missed in a previous cleanup Signed-off-by: Leah Rowe --- include/init.sh | 16 ---------------- include/lib.sh | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/init.sh b/include/init.sh index fc321605..4807e1cf 100644 --- a/include/init.sh +++ b/include/init.sh @@ -51,22 +51,6 @@ xbmkpkg() printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; : } -setcfg() -{ - [ $# -gt 1 ] && printf "e \"%s\" f missing && return %s;\n" "$1" "$2" - [ $# -gt 1 ] || \ - printf "e \"%s\" f not && %s \"Missing config\";\n" "$1" "$err" - printf ". \"%s\" || %s \"Could not read config\";\n" "$1" "$err" -} - -chkvars() -{ - for var in "$@"; do - eval "[ -n \"\${$var+x}\" ] || \$err \"$var unset\"" - eval "[ -n \"\$$var\" ] || \$err \"$var unset\"" - done; : -} - xbmk_set_pyver() { pyv="import sys; print(sys.version_info[:])" diff --git a/include/lib.sh b/include/lib.sh index 50813352..93680cee 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -128,6 +128,22 @@ setvars() printf "%s\n" "${_setvars% }" } +setcfg() +{ + [ $# -gt 1 ] && printf "e \"%s\" f missing && return %s;\n" "$1" "$2" + [ $# -gt 1 ] || \ + printf "e \"%s\" f not && %s \"Missing config\";\n" "$1" "$err" + printf ". \"%s\" || %s \"Could not read config\";\n" "$1" "$err" +} + +chkvars() +{ + for var in "$@"; do + eval "[ -n \"\${$var+x}\" ] || \$err \"$var unset\"" + eval "[ -n \"\$$var\" ] || \$err \"$var unset\"" + done; : +} + fe_() { find_ex "x_" "$@" From 6e447876cca283434163328ce08b6e9d0b5a1d24 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:47:12 +0100 Subject: [PATCH 041/267] init.sh: tidy up the python version check Signed-off-by: Leah Rowe --- include/init.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/include/init.sh b/include/init.sh index 4807e1cf..9f6e7162 100644 --- a/include/init.sh +++ b/include/init.sh @@ -60,11 +60,9 @@ xbmk_set_pyver() pybin "$python" 1>/dev/null || pyver="" [ -z "$pyver" ] || "`pybin "$python"`" -c "$pyv" 1>/dev/null \ 2>/dev/null || $err "Cannot detect host Python version." - if [ -n "$pyver" ]; then - pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')" - pyver="${pyver#(}" - pyver="${pyver%,}" - fi + [ -n "$pyver" ] && \ + pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')" && \ + pyver="${pyver#(}" && pyver="${pyver%,}" [ "${pyver%%.*}" = "3" ] || $err "Bad python version (must by 3.x)"; : } @@ -94,8 +92,7 @@ pybin() [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \ [ -x "$pypath/$1" ] && printf "%s/%s\n" "$pypath" "$1" && \ return 0 - done - [ $venv -gt 0 ] && return 1 + done && return 1 # Defer to normal command -v if not a venv command -v "$1" 2>/dev/null || return 1 From 439020fbda5ca7862bf2eaf4d59ab68aae230c33 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:47:56 +0100 Subject: [PATCH 042/267] inject.sh: remove useless comment block Signed-off-by: Leah Rowe --- include/inject.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 9bfda2db..d956cdd1 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -90,11 +90,6 @@ getfiles() "$MRC_url_bkup" "$MRC_hash" "$CONFIG_REFCODE_BLOB_FILE" [ -z "$CONFIG_LENOVO_TBFW_BIN" ] || fetch "tbfw" "$TBFW_url" \ "$TBFW_url_bkup" "$TBFW_hash" "$CONFIG_LENOVO_TBFW_BIN" - # - # in the future, we might have libre fsp-s and then fsp-m. - # therefore, handle them separately, in case one of them is libre; if - # one of them was, the path wouldn't be set. - # [ -z "$CONFIG_FSP_M_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_M_FILE" copy [ -z "$CONFIG_FSP_S_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ From b19c4f8f674b04fdaa0b07b2c43766a76545ed09 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 08:50:23 +0100 Subject: [PATCH 043/267] inject.sh: tidy up TBFW handling Signed-off-by: Leah Rowe --- include/inject.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index d956cdd1..837f34c1 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -256,20 +256,14 @@ extract_sch5545ec() # https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988 extract_tbfw() { - chkvars TBFW_size - fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" + chkvars TBFW_size && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" [ -f "$_dest" ] || $err "$board: Could not extract tbfw"; : } copy_tbfw() { - [ -f "$1" ] || return 0 - [ -L "$1" ] && return 0 - - x_ dd if=/dev/null of="$1" bs=1 seek=$TBFW_size - x_ mv "$1" "$_dest" - - return 1 + [ -f "$1" ] && [ ! -L "$1" ] && x_ dd if=/dev/null of="$1" bs=1 \ + seek=$TBFW_size && x_ mv "$1" "$_dest" && return 1; : } extract_fsp() From 91bb6cbede0405f764c3f2a686fbba5c7aa9f2fb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 09:10:24 +0100 Subject: [PATCH 044/267] lib.sh: Make err_ always exit no matter what Always certainly redundant, since if -u -e isn't set, it'll continue to exit anyway. However, we want to be pedantic about this, since the safety of lbmk relies entirely on this function NOT misbehaving. Signed-off-by: Leah Rowe --- include/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lib.sh b/include/lib.sh index 93680cee..c5790bf7 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -174,6 +174,6 @@ x_() err_() { - printf "ERROR %s: %s\n" "$0" "$1" 1>&2 + [ $# -lt 1 ] || printf "ERROR %s: %s\n" "$0" "$1" 1>&2 || : exit 1 } From 59c94664e3e3382375e79ee478fc68d3802d794a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 09:14:09 +0100 Subject: [PATCH 045/267] lib.sh: Make x_ err if first arg is empty Signed-off-by: Leah Rowe --- include/lib.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/include/lib.sh b/include/lib.sh index c5790bf7..abf4de3b 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -169,6 +169,7 @@ find_ex() x_() { + [ $# -lt 1 ] || [ -n "$1" ] || $err "Empty first arg: x_ $(echo "$@")" [ $# -lt 1 ] || "$@" || $err "Unhandled error for: $(echo "$@")"; : } From 3f7dc2a55f5b2273e73e17e4cec75faffe65740f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 09:17:23 +0100 Subject: [PATCH 046/267] lib.sh: rename errx to xmsg Signed-off-by: Leah Rowe --- include/lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index abf4de3b..b2888fb6 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -156,10 +156,10 @@ fx_() find_ex() { - errx="$1" && shift 1 + xmsg="$1" && shift 1 fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" xx="$1" && shift 1 - $errx find "$@" 2>/dev/null | sort > "$fd" || \ + $xmsg find "$@" 2>/dev/null | sort > "$fd" || \ $err "!find $(echo "$@") > \"$fd\"" while read -r fx; do $xx "$fx" || break; : From 54291ebb7209c314bb52f507bc6a1ecf2a28fbc9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 09:56:21 +0100 Subject: [PATCH 047/267] lbmk: MUCH safer err function Don't directly call a variable. Call a function that checks the variable instead. The new err function also checks whether an exit was actually done, and exits 1 if not. If an exit was done by the given function, but the exit was zero, this is also corrected to perform an exit 1. This fixes a longstanding design flaw of lbmk. Signed-off-by: Leah Rowe --- include/git.sh | 24 +++++++-------- include/init.sh | 38 +++++++++++------------ include/inject.sh | 78 +++++++++++++++++++++++------------------------ include/lib.sh | 63 +++++++++++++++++++++++++++----------- include/mrc.sh | 10 +++--- include/rom.sh | 18 +++++------ mk | 68 ++++++++++++++++++++--------------------- 7 files changed, 163 insertions(+), 136 deletions(-) diff --git a/include/git.sh b/include/git.sh index 37f5bbae..ded12625 100644 --- a/include/git.sh +++ b/include/git.sh @@ -63,7 +63,7 @@ git_prep() [ "$XBMK_RELEASE" = "y" ] && rmgit "$tmpgit" [ "$_loc" = "${_loc%/*}" ] || x_ mkdir -p "${_loc%/*}" - mv "$tmpgit" "$_loc" || $err "git_prep: !mv $tmpgit $_loc" + mv "$tmpgit" "$_loc" || err "git_prep: !mv $tmpgit $_loc" } # return 0 if project is single-tree, otherwise 1 @@ -80,20 +80,20 @@ fetch_submodule() mcfgdir="$mdir/${1##*/}"; eval \ "`setvars "" subhash subrepo subrepo_bkup subfile subfile_bkup st`" [ ! -f "$mcfgdir/module.cfg" ] || . "$mcfgdir/module.cfg" || \ - $err "! . $mcfgdir/module.cfg" + err "! . $mcfgdir/module.cfg" for xt in repo file; do _seval="if [ -n \"\$sub$xt\" ] || [ -n \"\$sub${xt}_bkup\" ]" eval "$_seval; then st=\"\$st \$xt\"; fi" done - st="${st# }" && [ "$st" = "repo file" ] && $err "$mdir: repo+file" + st="${st# }" && [ "$st" = "repo file" ] && err "$mdir: repo+file" [ -z "$st" ] && return 0 # subrepo/subfile not defined chkvars "sub${st}" "sub${st}_bkup" "subhash" [ "$st" = "file" ] && xbmkget "$subfile" "$subfile_bkup" \ "$tmpgit/$1" "$subhash" && return 0 - rm -Rf "$tmpgit/$1" || $err "!rm '$mdir' '$1'" + rm -Rf "$tmpgit/$1" || err "!rm '$mdir' '$1'" tmpclone "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subhash" \ "$mdir/${1##*/}/patches" } @@ -105,25 +105,25 @@ tmpclone() repofail="n" - [ $# -lt 6 ] || rm -Rf "$3" || $err "git retry: !rm $3 ($1)" + [ $# -lt 6 ] || rm -Rf "$3" || err "git retry: !rm $3 ($1)" repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3" - mkdir -p "$XBMK_CACHE/repo" || $err "!rmdir $XBMK_CACHE/repo" + mkdir -p "$XBMK_CACHE/repo" || err "!rmdir $XBMK_CACHE/repo" if [ "$livepull" = "y" ] && [ ! -d "$repodir" ]; then git clone "$1" "$repodir" || git clone $2 "$repodir" || \ - $err "!clone $1 $2 $repodir $4 $5" # + err "!clone $1 $2 $repodir $4 $5" # elif [ -d "$repodir" ] && [ $# -lt 6 ]; then git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \ || sleep 3 || git -C "$repodir" pull || : fi ( - [ $# -gt 5 ] || git clone "$repodir" "$3" || $err "!clone $repodir $3" - git -C "$3" reset --hard "$4" || $err "!reset $1 $2 $3 $4 $5" + [ $# -gt 5 ] || git clone "$repodir" "$3" || err "!clone $repodir $3" + git -C "$3" reset --hard "$4" || err "!reset $1 $2 $3 $4 $5" git_am_patches "$3" "$5" ) || repofail="y" [ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry - [ "$repofail" = "y" ] && $err "!clone $1 $2 $3 $4 $5"; : + [ "$repofail" = "y" ] && err "!clone $1 $2 $3 $4 $5"; : } git_am_patches() @@ -132,7 +132,7 @@ git_am_patches() [ -L "$p" ] && continue [ -e "$p" ] || continue [ -d "$p" ] && git_am_patches "$1" "$p" && continue - [ ! -f "$p" ] || git -C "$1" am "$p" || $err "$1 $2: !am $p" + [ ! -f "$p" ] || git -C "$1" am "$p" || err "$1 $2: !am $p" done; : } @@ -140,6 +140,6 @@ nuke() { e "config/${1%/}/nuke.list" f missing || while read -r nukefile; do rmf="src/${2%/}/$nukefile" && [ -L "$rmf" ] && continue - e "$rmf" e missing || rm -Rf "$rmf" || $err "!rm $rmf, ${2%/}" + e "$rmf" e missing || rm -Rf "$rmf" || err "!rm $rmf, ${2%/}" done < "config/${1%/}/nuke.list"; : } diff --git a/include/init.sh b/include/init.sh index 9f6e7162..ce9cf9a9 100644 --- a/include/init.sh +++ b/include/init.sh @@ -14,22 +14,22 @@ projectsite="https://libreboot.org/" export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" xbmkpath="$PATH" -err="err_" +xbmk_err="err_" eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \ datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver xbmklocal`" xbmk_init() { - xbmkpwd="`pwd`" || $err "Cannot generate PWD" + xbmkpwd="`pwd`" || err "Cannot generate PWD" xbmklocal="$xbmkpwd/tmp" export PWD="$xbmkpwd" [ $# -gt 0 ] && [ "$1" = "dependencies" ] && x_ xbmkpkg "$@" && exit 0 - id -u 1>/dev/null 2>/dev/null || $err "suid check failed (id -u)" - [ "$(id -u)" != "0" ] || $err "this command as root is not permitted" + id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" + [ "$(id -u)" != "0" ] || err "this command as root is not permitted" for init_cmd in set_pyver set_env set_version git_init create_tmpdir \ lock create_pathdirs child_exec; do @@ -39,13 +39,13 @@ xbmk_init() xbmkpkg() { - [ $# -lt 2 ] && $err "fewer than two arguments" + [ $# -lt 2 ] && err "fewer than two arguments" [ $# -gt 2 ] && reinstall="$3" eval "`setcfg "config/dependencies/$2"`" chkvars pkg_add pkglist - $pkg_add $pkglist || $err "Cannot install packages" + $pkg_add $pkglist || err "Cannot install packages" [ -n "$aur_notice" ] && \ printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; : @@ -59,11 +59,11 @@ xbmk_set_pyver() pyver="2" && [ "$python" = "python3" ] && pyver="3" pybin "$python" 1>/dev/null || pyver="" [ -z "$pyver" ] || "`pybin "$python"`" -c "$pyv" 1>/dev/null \ - 2>/dev/null || $err "Cannot detect host Python version." + 2>/dev/null || err "Cannot detect host Python version." [ -n "$pyver" ] && \ pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')" && \ pyver="${pyver#(}" && pyver="${pyver%,}" - [ "${pyver%%.*}" = "3" ] || $err "Bad python version (must by 3.x)"; : + [ "${pyver%%.*}" = "3" ] || err "Bad python version (must by 3.x)"; : } # Use direct path, to prevent a hang if Python is using a virtual environment, @@ -104,9 +104,9 @@ xbmk_set_env() [ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache" [ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ - $err "cachedir '$xbmkpwd/cache' is a symlink" + err "cachedir '$xbmkpwd/cache' is a symlink" [ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" - [ -f "$XBMK_CACHE" ] && $err "cachedir '$XBMK_CACHE' is a file"; : + [ -f "$XBMK_CACHE" ] && err "cachedir '$XBMK_CACHE' is a file"; : # if "y": a coreboot target won't be built if target.cfg says release="n" # (this is used to exclude certain build targets from releases) @@ -124,9 +124,9 @@ xbmk_set_version() [ ! -f ".versiondate" ] || read -r versiondate < ".versiondate" || :; : [ -e ".git" ] || [ -f ".version" ] || printf "unknown\n" > ".version" \ - || $err "Cannot generate unknown .version file" + || err "Cannot generate unknown .version file" [ -e ".git" ] || [ -f ".versiondate" ] || printf "1716415872\n" > \ - ".versiondate" || $err "Can't generate unknown versiondate file"; : + ".versiondate" || err "Can't generate unknown versiondate file"; : version_="$version" [ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \ @@ -136,8 +136,8 @@ xbmk_set_version() --pretty='%ct' HEAD)" || versiondate="$versiondate_" chkvars version versiondate - printf "%s\n" "$version" > ".version" || $err "can't save version" - printf "%s\n" "$versiondate" > ".versiondate" || $err "can't save date" + printf "%s\n" "$version" > ".version" || err "can't save version" + printf "%s\n" "$versiondate" > ".versiondate" || err "can't save date" relname="$projectname-$version" export LOCALVERSION="-$projectname-${version%%-*}" @@ -157,7 +157,7 @@ xbmk_git_init() 2>/dev/null for gitarg in "--global user.name" "--global user.email"; do - gitcmd="git config $gitarg"; $gitcmd || $err \ + gitcmd="git config $gitarg"; $gitcmd || err \ "Please run this first: $gitcmd \"your ${gitcmd##*.}\"" done } @@ -184,8 +184,8 @@ xbmk_create_tmpdir() xbmk_lock() { - [ -f "lock" ] && $err "$xbmkpwd/lock exists. Is a build running?" - touch lock || $err "cannot create 'lock' file"; : + [ -f "lock" ] && err "$xbmkpwd/lock exists. Is a build running?" + touch lock || err "cannot create 'lock' file"; : } xbmk_create_pathdirs() @@ -195,9 +195,9 @@ xbmk_create_pathdirs() ( # set up python v3.x in PATH, in case it's not set up correctly. # see code above that detected the correct python3 command. - cd "$XBMK_CACHE/xbmkpath" || $err "can't cd $XBMK_CACHE/xbmkpath" + cd "$XBMK_CACHE/xbmkpath" || err "can't cd $XBMK_CACHE/xbmkpath" x_ ln -s "`pybin "$python"`" python - ) || $err "Can't set up python symlink in $XBMK_CACHE/xbmkpath"; : + ) || err "Can't set up python symlink in $XBMK_CACHE/xbmkpath"; : } xbmk_child_exec() diff --git a/include/inject.sh b/include/inject.sh index 837f34c1..e2987aad 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -41,7 +41,7 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ download() { - [ $# -gt 0 ] || $err "No argument given" + [ $# -gt 0 ] || err "No argument given" export PATH="$PATH:/sbin" board="$1" && readcfg && readkconfig && bootstrap && getfiles; : } @@ -116,22 +116,22 @@ fetch() dlop="curl" && [ $# -gt 5 ] && dlop="$6" xbmkget "$dl" "$dl_bkup" "$_dl" "$dlsum" "$dlop" - rm -Rf "${_dl}_extracted" || $err "!rm ${_ul}_extracted. $dontflash" + rm -Rf "${_dl}_extracted" || err "!rm ${_ul}_extracted. $dontflash" e "$_dest" f && return 0 x_ mkdir -p "${_dest%/*}" remkdir "$appdir" extract_archive "$_dl" "$appdir" "$dl_type" || \ - [ "$dl_type" = "e6400vga" ] || $err "$_dest $dl_type: !extract" + [ "$dl_type" = "e6400vga" ] || err "$_dest $dl_type: !extract" eval "extract_$dl_type" set -u -e - e "$_dest" f missing && $err "!extract_$dl_type. $dontflash"; : + e "$_dest" f missing && err "!extract_$dl_type. $dontflash"; : } extract_intel_me() { - e "$mecleaner" f not && $err "$cbdir: me_cleaner missing. $dontflash" + e "$mecleaner" f not && err "$cbdir: me_cleaner missing. $dontflash" cdir="$xbmkpwd/$appdir" _me="$xbmkpwd/$_dest" @@ -145,7 +145,7 @@ extract_intel_me() if [ "$ME11bootguard" = "y" ]; then apply_me11_deguard_mod else - mv "$_metmp" "$_me" || $err "!mv $_metmp $_me - $dontflash" + mv "$_metmp" "$_me" || err "!mv $_metmp $_me - $dontflash" fi } @@ -160,7 +160,7 @@ extract_intel_me_bruteforce() set +u +e ( [ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}" - cd "$cdir" || $err "extract_intel_me: !cd \"$cdir\" - $dontflash" + cd "$cdir" || err "extract_intel_me: !cd \"$cdir\" - $dontflash" for i in *; do e "$_metmp" f && break [ -L "$i" ] && continue @@ -182,7 +182,7 @@ extract_intel_me_bruteforce() cd "$cdir" || : done ) || : - rm -Rf "$sdir" || $err "extract_intel_me: !rm -Rf $sdir - $dontflash" + rm -Rf "$sdir" || err "extract_intel_me: !rm -Rf $sdir - $dontflash" } apply_me11_deguard_mod() @@ -193,7 +193,7 @@ apply_me11_deguard_mod() --version "$ME11version" \ --pch "$ME11pch" --sku "$ME11sku" --fake-fpfs data/fpfs/zero \ --input "$_metmp" --output "$_me" - ) || $err "Error running deguard for $_me - $dontflash" + ) || err "Error running deguard for $_me - $dontflash" } extract_archive() @@ -216,11 +216,11 @@ extract_kbc1126ec() mv Rompaq/68*.BIN ec.bin || : if [ ! -f "ec.bin" ]; then unar -D ROM.CAB Rom.bin || unar -D Rom.CAB Rom.bin || \ - unar -D 68*.CAB Rom.bin || $err "kbc1126 unar failed" + unar -D 68*.CAB Rom.bin || err "kbc1126 unar failed" x_ mv Rom.bin ec.bin fi x_ e ec.bin f && x_ "$kbc1126_ec_dump" ec.bin - ) || $err "$board: can't extract kbc1126 ec firmware - $dontflash" + ) || err "$board: can't extract kbc1126 ec firmware - $dontflash" x_ e "$appdir/ec.bin.fw1" f && x_ e "$appdir/ec.bin.fw2" f x_ cp "$appdir/"ec.bin.fw* "${_dest%/*}/" @@ -235,7 +235,7 @@ extract_e6400vga() x_ cd "$appdir" x_ e "bios.bin" f "$e6400_unpack" bios.bin || printf "TODO: fix dell extract util\n" - ) || $err "can't extract e6400 vga rom - $dontflosh" + ) || err "can't extract e6400 vga rom - $dontflosh" x_ cp "$appdir/$E6400_VGA_romname" "$_dest" } @@ -248,7 +248,7 @@ extract_sch5545ec() _sch5545ec_fw="$_sch5545ec_fw/54 D386BEB8-4B54-4E69-94F5-06091F67E0D3" _sch5545ec_fw="$_sch5545ec_fw/0 Raw section/body.bin" # <-- this! - "$uefiextract" "$_bios" || $err "sch5545 !extract - $dontflash" + "$uefiextract" "$_bios" || err "sch5545 !extract - $dontflash" x_ cp "$_sch5545ec_fw" "$_dest" } @@ -257,7 +257,7 @@ extract_sch5545ec() extract_tbfw() { chkvars TBFW_size && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" - [ -f "$_dest" ] || $err "$board: Could not extract tbfw"; : + [ -f "$_dest" ] || err "$board: Could not extract tbfw"; : } copy_tbfw() @@ -284,11 +284,11 @@ fail_inject() inject() { need_files="n" - err="fail_inject" + xbmk_err="fail_inject" remkdir "$tmpromdel" set +u +e - [ $# -lt 1 ] && $err "No options specified. - $dontflash" + [ $# -lt 1 ] && err "No options specified. - $dontflash" eval "`setvars "" nukemode new_mac xchanged`" archive="$1"; @@ -300,15 +300,15 @@ inject() nukemode="nuke" ;; setmac) [ $# -gt 2 ] && new_mac="$3" && \ - [ -z "$new_mac" ] && $err "Empty MAC address specified" ;; - *) $err "Unrecognised inject mode: '$2'" + [ -z "$new_mac" ] && err "Empty MAC address specified" ;; + *) err "Unrecognised inject mode: '$2'" esac [ "$new_mac" = "keep" ] && new_mac="" [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ x_ make -C util/nvmutil clean && x_ make -C util/nvmutil - check_release "$archive" || $err "'$archive' is not a release archive" + check_release "$archive" || err "'$archive' is not a release archive" readcfg && need_files="y" if [ "$need_files" = "y" ] || [ -n "$new_mac" ]; then @@ -324,20 +324,20 @@ inject() check_release() { - [ -L "$archive" ] && $err "'$archive' is a symlink. $dontflash" + [ -L "$archive" ] && err "'$archive' is a symlink. $dontflash" e "$archive" f missing && return 1 archivename="`basename "$archive"`" - [ -z "$archivename" ] && $err "Can't determine archive name. $dontflash" + [ -z "$archivename" ] && err "Can't determine archive name. $dontflash" case "$archivename" in *_src.tar.xz) - $err "'$archive' is a src archive, silly!" ;; + err "'$archive' is a src archive, silly!" ;; grub_*|seagrub_*|custom_*|seauboot_*|seabios_withgrub_*) return 1 ;; *.tar.xz) _stripped_prefix="${archivename#*_}" board="${_stripped_prefix%.tar.xz}" ;; - *) $err "'$archive': could not detect board type - $dontflash" + *) err "'$archive': could not detect board type - $dontflash" esac; : } @@ -355,8 +355,8 @@ readcfg() [ -z "$vcfg" ] && return 1 vfile="config/vendor/$vcfg/pkg.cfg" - [ -L "$vfile" ] && $err "'$archive', '$board': $vfile is a symlink" - [ -f "$vfile" ] || $err "'$archive', '$board': $vfile doesn't exist" + [ -L "$vfile" ] && err "'$archive', '$board': $vfile is a symlink" + [ -f "$vfile" ] || err "'$archive', '$board': $vfile doesn't exist" cbdir="src/coreboot/$tree" cbfstool="elf/cbfstool/$tree/cbfstool" @@ -394,14 +394,14 @@ patch_release_roms() ( [ "$need_files" = "y" ] || exit 0 - cd "$tmpromdir" || $err "patch '$archive': can't cd $tmpromdir" + cd "$tmpromdir" || err "patch '$archive': can't cd $tmpromdir" # NOTE: For compatibility with older rom releases, defer to sha1 if [ "$has_hashes" = "y" ] && [ "$nukemode" != "nuke" ]; then sha512sum --status -c "$hashfile" || \ x_ sha1sum --status -c "$hashfile" x_ rm -f "$hashfile" fi - ) || $err "'$archive' -> Can't verify vendor hashes. $dontflash" + ) || err "'$archive' -> Can't verify vendor hashes. $dontflash" [ -z "$new_mac" ] || modify_mac || printf "\nGbE not defined\n" 1>&2 @@ -411,10 +411,10 @@ patch_release_roms() ( x_ cd "${tmpromdir%"/bin/$board"}" mkrom_tarball "bin/$board" - ) || $err "Cannot re-generate '$archive' - $dontflash" + ) || err "Cannot re-generate '$archive' - $dontflash" mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \ - "$archive" || $err "'$archive' -> Can't overwrite - $dontflash"; : + "$archive" || err "'$archive' -> Can't overwrite - $dontflash"; : } prep_rom() @@ -425,16 +425,16 @@ prep_rom() [ "$nukemode" = "nuke" ] && _xromnew="${_xrom%/*}/$vfix${_xrom##*/}" e "$_xrom" f missing && return 0 - [ -z "${_xromname#"$vfix"}" ] && $err "$_xromname / $vfix: name match" + [ -z "${_xromname#"$vfix"}" ] && err "$_xromname / $vfix: name match" # Remove the prefix and 1-byte pad if [ "$nukemode" != "nuke" ] && \ [ "${_xromname#"$vfix"}" != "$_xromname" ]; then - xromsize="$(expr $(stat -c '%s' "$_xrom") - 1)" || $err "!int" - [ $xromsize -lt 524288 ] && $err "too small, $xromsize: $_xrom" + xromsize="$(expr $(stat -c '%s' "$_xrom") - 1)" || err "!int" + [ $xromsize -lt 524288 ] && err "too small, $xromsize: $_xrom" x_ dd if="$_xrom" of="$_xromnew" bs=$xromsize count=1 - rm -f "$_xrom" || $err "Can't rm $_xrom - $dontflash" + rm -f "$_xrom" || err "Can't rm $_xrom - $dontflash" _xrom="$_xromnew" fi @@ -445,7 +445,7 @@ prep_rom() [ "$nukemode" != "nuke" ] && return 0 # Rename the file, prefixing a warning saying not to flash - cat "$_xrom" config/data/coreboot/0 > "$_xromnew" || $err "!pad $_xrom" + cat "$_xrom" config/data/coreboot/0 > "$_xromnew" || err "!pad $_xrom" x_ rm -f "$_xrom" } @@ -498,7 +498,7 @@ insert() if [ "$_t" = "fsp" ] && [ $# -gt 3 ]; then _offset="$4" elif [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ]; then - $err "insert $*, $rom: offset given but empty (undefined)" + err "insert $*, $rom: offset given but empty (undefined)" fi [ "$nukemode" = "nuke" ] || x_ e "$_dest" f @@ -506,19 +506,19 @@ insert() if [ "$cbfsname" = "IFD" ]; then [ "$nukemode" = "nuke" ] || "$ifdtool" $ifdprefix -i \ $_t:$_dest "$rom" -O "$rom" || \ - $err "failed: insert '$_t' '$_dest' on '$rom'" + err "failed: insert '$_t' '$_dest' on '$rom'" [ "$nukemode" != "nuke" ] || "$ifdtool" $ifdprefix --nuke $_t \ - "$rom" -O "$rom" || $err "$rom: !nuke IFD/$_t" + "$rom" -O "$rom" || err "$rom: !nuke IFD/$_t" elif [ "$nukemode" = "nuke" ]; then x_ "$cbfstool" "$rom" remove -n "$cbfsname" elif [ "$_t" = "stage" ]; then # the only stage we handle is refcode x_ rm -f "$xbmklocal/refcode" "$rmodtool" -i "$_dest" -o "$xbmklocal/refcode" || "!reloc ref" "$cbfstool" "$rom" add-stage -f "$xbmklocal/refcode" \ - -n "$cbfsname" -t stage || $err "$rom: !add ref" + -n "$cbfsname" -t stage || err "$rom: !add ref" else "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \ - -t $_t $_offset || $err "$rom !add $_t ($_dest)" + -t $_t $_offset || err "$rom !add $_t ($_dest)" fi xchanged="y"; : } diff --git a/include/lib.sh b/include/lib.sh index b2888fb6..eb4cddca 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -15,8 +15,8 @@ remkdir() mkrom_tarball() { - printf "%s\n" "$version" > "$1/.version" || $err "$1 !version" - printf "%s\n" "$versiondate" > "$1/.versiondate" || $err "$1 !vdate" + printf "%s\n" "$version" > "$1/.version" || err "$1 !version" + printf "%s\n" "$versiondate" > "$1/.versiondate" || err "$1 !vdate" mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz" x_ rm -Rf "$1" @@ -26,15 +26,15 @@ mktarball() { printf "Creating tar archive '%s' from directory '%s'\n" "$2" "$1" [ "${2%/*}" = "$2" ] || x_ mkdir -p "${2%/*}" - x_ tar -c "$1" | xz -T$XBMK_THREADS -9e > "$2" || $err "mktarball2, $1" + x_ tar -c "$1" | xz -T$XBMK_THREADS -9e > "$2" || err "mktarball2, $1" } mksha512sum() { ( [ "${1%/*}" != "$1" ] && x_ cd "${1%/*}" - sha512sum ./"${1##*/}" >> "$2" || $err "!sha512sum \"$1\" > \"$2\"" - ) || $err "failed to create tarball checksum" + sha512sum ./"${1##*/}" >> "$2" || err "!sha512sum \"$1\" > \"$2\"" + ) || err "failed to create tarball checksum" } rmgit() @@ -58,7 +58,7 @@ xbmkget() for url in "$1" "$2"; do [ "$dl_fail" = "n" ] && break [ -z "$url" ] && continue - rm -f "$cached" || $err "!rm -f '$cached'" + rm -f "$cached" || err "!rm -f '$cached'" if [ "$_dlop" = "curl" ]; then curl --location --retry 3 -A "$_ua" "$url" \ -o "$cached" || wget --tries 3 -U "$_ua" "$url" \ @@ -72,11 +72,11 @@ xbmkget() "$1" "$2" "$3" "$4" "$url" 1>&2 && continue cp "$url" "$cached" || continue else - $err "$1 $2 $3 $4: Unsupported dlop type: '$_dlop'" + err "$1 $2 $3 $4: Unsupported dlop type: '$_dlop'" fi bad_checksum "$4" "$cached" || dl_fail="n" done - [ "$dl_fail" = "y" ] && $err "$1 $2 $3 $4: not downloaded" + [ "$dl_fail" = "y" ] && err "$1 $2 $3 $4: not downloaded" [ "$cached" = "$3" ] || x_ cp "$cached" "$3"; : } @@ -99,7 +99,7 @@ e() mk() { - mk_flag="$1" || $err "No argument given" + mk_flag="$1" || err "No argument given" shift 1 && for mk_arg in "$@"; do x_ ./mk $mk_flag $mk_arg done; : @@ -107,7 +107,7 @@ mk() check_defconfig() { - [ -d "$1" ] || $err "Target '$1' not defined." + [ -d "$1" ] || err "Target '$1' not defined." for x in "$1"/config/*; do [ -f "$x" ] && printf "%s\n" "$x" && return 1 done; : @@ -117,7 +117,7 @@ setvars() { _setvars="" if [ $# -lt 2 ]; then - printf "\$err \"setvars: too few args\\n\"" + printf "err \"setvars: too few args\\n\"" return 0 fi val="$1" @@ -132,15 +132,15 @@ setcfg() { [ $# -gt 1 ] && printf "e \"%s\" f missing && return %s;\n" "$1" "$2" [ $# -gt 1 ] || \ - printf "e \"%s\" f not && %s \"Missing config\";\n" "$1" "$err" - printf ". \"%s\" || %s \"Could not read config\";\n" "$1" "$err" + printf "e \"%s\" f not && err \"Missing config\";\n" "$1" + printf ". \"%s\" || err \"Could not read config\";\n" "$1" } chkvars() { for var in "$@"; do - eval "[ -n \"\${$var+x}\" ] || \$err \"$var unset\"" - eval "[ -n \"\$$var\" ] || \$err \"$var unset\"" + eval "[ -n \"\${$var+x}\" ] || err \"$var unset\"" + eval "[ -n \"\$$var\" ] || err \"$var unset\"" done; : } @@ -160,7 +160,7 @@ find_ex() fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" xx="$1" && shift 1 $xmsg find "$@" 2>/dev/null | sort > "$fd" || \ - $err "!find $(echo "$@") > \"$fd\"" + err "!find $(echo "$@") > \"$fd\"" while read -r fx; do $xx "$fx" || break; : done < "$fd" @@ -169,8 +169,35 @@ find_ex() x_() { - [ $# -lt 1 ] || [ -n "$1" ] || $err "Empty first arg: x_ $(echo "$@")" - [ $# -lt 1 ] || "$@" || $err "Unhandled error for: $(echo "$@")"; : + [ $# -lt 1 ] || [ -n "$1" ] || err "Empty first arg: x_ $(echo "$@")" + [ $# -lt 1 ] || "$@" || err "Unhandled error for: $(echo "$@")"; : +} + +err() +{ + xbmk_err_val=0 + + real_err="$xbmk_err" + if [ -z "$xbmk_err" ]; then + printf "WARNING: err not set. Args: %s\n" "$(echo "$@")" 1>&2 + printf "REMARK: Setting err to default 'err_' value\n" 1>&2 + real_err="err_" + fi + + ( + $real_err "$@" || printf \ + "WARNING: Err function '%s' *returned* 1. Will exit 1 anyway\n" \ + "$real_err" + printf "WARNING: Err function '%s' didn't exit. Will exit 1 anyway\n" \ + "$real_err" 1>&2 + exit 1 + ) || xbmk_err_val=1 # otherwise, it wrongly did exit 0, not exit 1 + + [ $xbmk_err_val -eq 0 ] && printf \ + "WARNING: Err function '%s' did exit 0. Will exit 1 anyway.\n" \ + "$real_err" 1>&2 + + exit 1 } err_() diff --git a/include/mrc.sh b/include/mrc.sh index eaf39dcb..a1dcb140 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -11,7 +11,7 @@ extract_mrc() extract_shellball "$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ - -f "$_dest" -r RO_SECTION || $err "extract_mrc: !$cbfstool $_dest" + -f "$_dest" -r RO_SECTION || err "extract_mrc: !$cbfstool $_dest" [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && extract_refcode extra; : } @@ -27,7 +27,7 @@ extract_refcode() # incompatible with older versions before coreboot 4.14, # so we need coreboot 4.13 cbfstool for certain refcode files chkvars cbfstoolref - mkdir -p "${_refdest%/*}" || $err "ref: !mkdir -p ${_refdest%/*}" + mkdir -p "${_refdest%/*}" || err "ref: !mkdir -p ${_refdest%/*}" x_ "$cbfstoolref" "$appdir/bios.bin" extract \ -m x86 -n fallback/refcode -f "$_refdest" -r RO_SECTION @@ -46,7 +46,7 @@ extract_shellball() x_ cd "$appdir" extract_partition "${MRC_url##*/}" extract_archive "$SHELLBALL" . - ) || $err "mrc download/extract failure"; : + ) || err "mrc download/extract failure"; : } extract_partition() @@ -59,8 +59,8 @@ extract_partition() SIZE=$(( $( echo $ROOTP | cut -f4 -d\ | tr -d "B" ) )) dd if="${1%.zip}" of="root-a.ext2" bs=1024 skip=$(( $START / 1024 )) \ - count=$(( $SIZE / 1024 )) || $err "ex dd ${1%.zip}, root-a.ext2" + count=$(( $SIZE / 1024 )) || err "ex dd ${1%.zip}, root-a.ext2" printf "cd /usr/sbin\ndump chromeos-firmwareupdate %s\nquit" \ - "$SHELLBALL" | debugfs "root-a.ext2" || $err "!extract shellball" + "$SHELLBALL" | debugfs "root-a.ext2" || err "!extract shellball" } diff --git a/include/rom.sh b/include/rom.sh index ec464d85..af739d92 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -11,7 +11,7 @@ mkserprog() { [ "$_f" = "-d" ] && return 0 # dry run basename -as .h "$serdir/"*.h > "$xbmktmp/ser" || \ - $err "!mk $1 $xbmktmp" + err "!mk $1 $xbmktmp" while read -r sertarget; do [ "$1" = "pico" ] && x_ cmake -DPICO_BOARD="$sertarget" \ @@ -33,8 +33,8 @@ copyps1bios() x_ cp src/pcsx-redux/src/mips/openbios/openbios.bin bin/playstation printf "MIT License\n\nCopyright (c) 2019-2024 PCSX-Redux authors\n\n" \ - > bin/playstation/COPYING.txt || $err "!pcsx-redux copyright" - cat config/snippet/mit >>bin/playstation/COPYING.txt || $err "!pcsx MIT" + > bin/playstation/COPYING.txt || err "!pcsx-redux copyright" + cat config/snippet/mit >>bin/playstation/COPYING.txt || err "!pcsx MIT" } mkpayload_grub() @@ -55,7 +55,7 @@ mkvendorfiles() [ -z "$mode" ] && $dry cook_coreboot_config check_coreboot_utils "$tree" printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \ - $err "!mk $srcdir .coreboot-version" + err "!mk $srcdir .coreboot-version" [ -z "$mode" ] && [ "$target" != "$tree" ] && \ x_ ./mk download "$target"; : } @@ -64,8 +64,8 @@ cook_coreboot_config() { [ -f "$srcdir/.config" ] || return 0 printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \ - $err "$srcdir/.config: Could not enable ccache" - make -C "$srcdir" oldconfig || $err "Could not cook $srcdir/.config"; : + err "$srcdir/.config: Could not enable ccache" + make -C "$srcdir" oldconfig || err "Could not cook $srcdir/.config"; : } check_coreboot_utils() @@ -105,7 +105,7 @@ mkcorebootbin() [ "$payload_uboot_i386" = "y" ] && \ [ "$payload_uboot_amd64" = "y" ] && \ - $err "'$target' enables 32- and 64-bit x86 U-Boot" + err "'$target' enables 32- and 64-bit x86 U-Boot" if [ "$payload_uboot_i386" = "y" ] || \ [ "$payload_uboot_amd64" = "y" ]; then @@ -118,7 +118,7 @@ mkcorebootbin() [ "$payload_uboot" = "y" ] || payload_seabios="y" [ "$payload_grub" = "y" ] && payload_seabios="y" [ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "y" ] && \ - $dry $err "$target: U-Boot(arm64) and SeaBIOS/GRUB both enabled." + $dry err "$target: U-Boot(arm64) and SeaBIOS/GRUB both enabled." [ -z "$grub_scan_disk" ] && grub_scan_disk="nvme ahci ata" @@ -180,7 +180,7 @@ add_grub() _grubname="fallback/payload" cbfs "$tmprom" "$grubelf" "$_grubname" printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" \ - > "$xbmktmp/tmpcfg" || $err "$target: !insert scandisk" + > "$xbmktmp/tmpcfg" || err "$target: !insert scandisk" cbfs "$tmprom" "$xbmktmp/tmpcfg" scan.cfg raw [ "$initmode" != "normal" ] && [ "$displaymode" != "txtmode" ] && \ cbfs "$tmprom" "$grubdata/background/background1280x800.png" \ diff --git a/mk b/mk index 5a4afadf..55f67a92 100755 --- a/mk +++ b/mk @@ -29,7 +29,7 @@ main() version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;; release|download|inject) $cmd "$@" ;; -*) return 1 ;; - *) $err "bad command" ;; + *) err "bad command" ;; esac set -u -e # some commands disable them. turn them on! } @@ -40,11 +40,11 @@ release() vdir="release" while getopts d:m: option; do - [ -z "$OPTARG" ] && $err "empty argument not allowed" + [ -z "$OPTARG" ] && err "empty argument not allowed" case "$option" in d) vdir="$OPTARG" ;; m) mode="$OPTARG" ;; - *) $err "invalid option '-$option'" ;; + *) err "invalid option '-$option'" ;; esac done @@ -52,10 +52,10 @@ release() src_dirname="${relname}_src" srcdir="$vdir/$src_dirname" - [ -e "$vdir" ] && $err "already exists: \"$vdir\"" - mkdir -p "$vdir" || $err "mkvdir: !mkdir -p \"$vdir\"" - git clone . "$srcdir" || $err "mkdir: !gitclone \"$srcdir\"" - touch "$srcdir/lock" || $err "can't make lock file in $srcdir/" + [ -e "$vdir" ] && err "already exists: \"$vdir\"" + mkdir -p "$vdir" || err "mkvdir: !mkdir -p \"$vdir\"" + git clone . "$srcdir" || err "mkdir: !gitclone \"$srcdir\"" + touch "$srcdir/lock" || err "can't make lock file in $srcdir/" build_release @@ -65,32 +65,32 @@ release() build_release() { ( - cd "$srcdir" || $err "$vdir: !cd \"$srcdir\"" + cd "$srcdir" || err "$vdir: !cd \"$srcdir\"" ./mk -f rmgit . x_ mv src/docs docs - ) || $err "can't create release files" + ) || err "can't create release files" git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \ - --abbrev-commit > "$srcdir/CHANGELOG" || $err "!gitlog $srcdir" - rm -f "$srcdir/lock" || $err "can't remove lock file in $srcdir" + --abbrev-commit > "$srcdir/CHANGELOG" || err "!gitlog $srcdir" + rm -f "$srcdir/lock" || err "can't remove lock file in $srcdir" ( - cd "${srcdir%/*}" || $err "$vdir: mktarball \"$srcdir\"" - mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || $err "$vdir: mksrc" - ) || $err "can't create src tarball" + cd "${srcdir%/*}" || err "$vdir: mktarball \"$srcdir\"" + mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || err "$vdir: mksrc" + ) || err "can't create src tarball" [ "$mode" = "src" ] && return 0 - touch "$srcdir/lock" || $err "can't make lock file in $srcdir/" + touch "$srcdir/lock" || err "can't make lock file in $srcdir/" ( - cd "$srcdir" || $err "$vdir: 2 !cd \"$srcdir\"" + cd "$srcdir" || err "$vdir: 2 !cd \"$srcdir\"" x_ ./mk -d coreboot mk -b coreboot pico-serprog stm32-vserprog pcsx-redux x_ mv bin ../roms - ) || $err "can't build rom images" + ) || err "can't build rom images" - rm -Rf "$srcdir" || $err "!rm -Rf $srcdir" + rm -Rf "$srcdir" || err "!rm -Rf $srcdir" } main "$@" && exit 0 @@ -110,7 +110,7 @@ trees() flags="f:b:m:u:c:x:s:l:n:d:" while getopts $flags option; do - [ -n "$_f" ] && $err "only one flag is permitted" + [ -n "$_f" ] && err "only one flag is permitted" _f="$1" case "$_f" in @@ -126,7 +126,7 @@ trees() -s) mode="savedefconfig" ;; -l) mode="olddefconfig" ;; -n) mode="nconfig" ;; - *) $err "invalid option '-$option'" ;; + *) err "invalid option '-$option'" ;; esac if [ -z "${OPTARG+x}" ]; then @@ -137,14 +137,14 @@ trees() project="${OPTARG#src/}" shift 2 done - [ -z "$_f" ] && $err "missing flag ($flags)" + [ -z "$_f" ] && err "missing flag ($flags)" if [ -z "$project" ]; then mk $_f $(ls -1 config/git) return 1 fi [ -f "config/git/$project/pkg.cfg" ] || \ - $err "config/git/$project/pkg.cfg missing" + err "config/git/$project/pkg.cfg missing" for d in "elf" "config/data" "config" "src"; do eval "${d#*/}dir=\"$d/$project\"" @@ -180,8 +180,8 @@ build_project() build_targets() { - [ -d "$configdir" ] || $err "directory, $configdir, does not exist" - [ $# -gt 0 ] || targets="$(ls -1 "$configdir")" || $err "!o $configdir" + [ -d "$configdir" ] || err "directory, $configdir, does not exist" + [ $# -gt 0 ] || targets="$(ls -1 "$configdir")" || err "!o $configdir" for x in $targets; do unset CROSS_COMPILE @@ -267,7 +267,7 @@ build_dependencies() for bd in $build_depend; do bd_p="${bd%%/*}" bd_t="${bd##*/}" - [ -z "$bd_p" ] && $dry $err "$project/$tree: !bd '$bd'" + [ -z "$bd_p" ] && $dry err "$project/$tree: !bd '$bd'" [ "${bd##*/}" = "$bd" ] && bd_t="" [ -z "$bd_p" ] || $dry x_ ./mk -b $bd_p $bd_t; : done; : @@ -281,14 +281,14 @@ check_project_hashes() fx_ "x_ sha512sum" "$datadir" "$configdir/$tree" "$mdir" \ -type f -not -path "*/.git*/*" | awk '{print $1}' > \ - "$xbmktmp/project.hash" || $err "!h $project $tree" + "$xbmktmp/project.hash" || err "!h $project $tree" pjhash="$(sha512sum "$xbmktmp/project.hash" | awk '{print $1}')" || : [ "$pjhash" != "$old_pjhash" ] && badhash="y" [ -f "$XBMK_CACHE/hash/$project$tree" ] || badhash="y" printf "%s\n" "$pjhash" > "$XBMK_CACHE/hash/$project$tree" || \ - $err "!mk $XBMK_CACHE/hash/$project$tree" + err "!mk $XBMK_CACHE/hash/$project$tree" [ "$badhash" != "y" ] || x_ rm -Rf "src/$project/$tree" \ "elf/$project/$tree" "elf/$project/$target"; : @@ -323,12 +323,12 @@ check_cross_compiler() # gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental" check_gnu_path() { - command -v "$1" 1>/dev/null || $err "Host '$1' unavailable" + command -v "$1" 1>/dev/null || err "Host '$1' unavailable" eval "`setvars "" gccver gccfull gnatver gnatfull gccdir gnatdir`" x_ gnu_setver "$1" "$1" && gnu_setver "$2" "$2" || : - eval "[ -z \"\$$1ver\" ] && $err \"Cannot detect host '$1' version\"" + eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\"" [ "$gnatfull" = "$gccfull" ] && return 0 eval "$1dir=\"$(dirname "$(command -v "$1")")\"" @@ -346,7 +346,7 @@ check_gnu_path() _gnuutil="${_gnubin##*/}" && [ -e "$_gnubin" ] && \ x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}" done - ) || $err "Cannot create $2-$_gnuver link in $_gnudir"; : + ) || err "Cannot create $2-$_gnuver link in $_gnudir"; : } gnu_setver() @@ -360,7 +360,7 @@ gnu_setver() check_defconfig() { - [ -f "$defconfig" ] || $dry $err "$project/$target: missing defconfig" + [ -f "$defconfig" ] || $dry err "$project/$target: missing defconfig" dest_dir="$elfdir/$target/${defconfig#"$target_dir/config/"}" $dry elfcheck || return 1 # skip build if a previous one exists @@ -383,7 +383,7 @@ handle_makefile() [ -n "$mode" ] || [ -n "$btype" ] || $dry make -C \ "$srcdir" silentoldconfig || make -C "$srcdir" oldconfig || : - run_make_command || $err "handle_makefile $srcdir: no makefile!" + run_make_command || err "handle_makefile $srcdir: no makefile!" _copy=".config" && [ "$mode" = "savedefconfig" ] && _copy="defconfig" [ "${mode%config}" = "$mode" ] || \ @@ -419,11 +419,11 @@ check_cmake() check_autoconf() { ( - cd "$1" || $err "!cd $1" + cd "$1" || err "!cd $1" [ -f "bootstrap" ] && x_ ./bootstrap $bootstrapargs [ -f "autogen.sh" ] && x_ ./autogen.sh $autogenargs [ -f "configure" ] && x_ ./configure $autoconfargs; : - ) || $err "can't bootstrap project: $1"; : + ) || err "can't bootstrap project: $1"; : } check_makefile() From 37ca0c90e1cc8dc3f85b9cdd96c9cd6faea0862a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 10:18:33 +0100 Subject: [PATCH 048/267] lib.sh err: add missing redirect to stderr Signed-off-by: Leah Rowe --- include/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lib.sh b/include/lib.sh index eb4cddca..1bfe2060 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -187,7 +187,7 @@ err() ( $real_err "$@" || printf \ "WARNING: Err function '%s' *returned* 1. Will exit 1 anyway\n" \ - "$real_err" + "$real_err" 1>&2 printf "WARNING: Err function '%s' didn't exit. Will exit 1 anyway\n" \ "$real_err" 1>&2 exit 1 From 9611c19e7ed1be42c8da8228235d9626eb853acf Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:03:34 +0100 Subject: [PATCH 049/267] init.sh: tidy up xbmk_child_exec() make the command style more consistent, for example relying on x_ inside a subshell to print the command and arguments if a command failed. this is a good style, and i'll probably use it in other places on lbmk. Signed-off-by: Leah Rowe --- include/init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/init.sh b/include/init.sh index ce9cf9a9..e8ff6b63 100644 --- a/include/init.sh +++ b/include/init.sh @@ -204,8 +204,8 @@ xbmk_child_exec() { xbmk_rval=0 ( x_ ./mk "$@" ) || xbmk_rval=1 - rm -Rf "$xbmklocal" "$xbmktmp" || xbmk_rval=1 - rm -f lock || xbmk_rval=1 + ( x_ rm -Rf "$xbmklocal" "$xbmktmp" ) || xbmk_rval=1 + ( x_ rm -f lock ) || xbmk_rval=1 exit $xbmk_rval } From 8b7bd992f66d554c50495fb87426bf3b8580dcb9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:12:23 +0100 Subject: [PATCH 050/267] init.sh: define lock file in a variable instead don't hardcode it. Signed-off-by: Leah Rowe --- include/init.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/init.sh b/include/init.sh index e8ff6b63..9e05d503 100644 --- a/include/init.sh +++ b/include/init.sh @@ -17,12 +17,14 @@ xbmkpath="$PATH" xbmk_err="err_" eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \ - datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver xbmklocal`" + datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver xbmklocal \ + xbmklock`" xbmk_init() { xbmkpwd="`pwd`" || err "Cannot generate PWD" xbmklocal="$xbmkpwd/tmp" + xbmklock="$xbmkpwd/lock" export PWD="$xbmkpwd" @@ -184,8 +186,8 @@ xbmk_create_tmpdir() xbmk_lock() { - [ -f "lock" ] && err "$xbmkpwd/lock exists. Is a build running?" - touch lock || err "cannot create 'lock' file"; : + [ -f "$xbmklock" ] && err "$xbmklock exists. Is a build running?" + touch "$xbmklock" || err "cannot create '$xbmklock'"; : } xbmk_create_pathdirs() @@ -205,7 +207,7 @@ xbmk_child_exec() xbmk_rval=0 ( x_ ./mk "$@" ) || xbmk_rval=1 ( x_ rm -Rf "$xbmklocal" "$xbmktmp" ) || xbmk_rval=1 - ( x_ rm -f lock ) || xbmk_rval=1 + ( x_ rm -f "$xbmklock" ) || xbmk_rval=1 exit $xbmk_rval } From b51846da6dead8f138858dcdb3da0b78d713e580 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:14:50 +0100 Subject: [PATCH 051/267] init.sh: single-quote xbmklock in xbmk_lock() Signed-off-by: Leah Rowe --- include/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/init.sh b/include/init.sh index 9e05d503..349d40ed 100644 --- a/include/init.sh +++ b/include/init.sh @@ -186,7 +186,7 @@ xbmk_create_tmpdir() xbmk_lock() { - [ -f "$xbmklock" ] && err "$xbmklock exists. Is a build running?" + [ -f "$xbmklock" ] && err "'$xbmklock' exists. Is a build running?" touch "$xbmklock" || err "cannot create '$xbmklock'"; : } From 4020fb432805cfc7ebd243b0873574f25182ba40 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:23:11 +0100 Subject: [PATCH 052/267] lib.sh: simplify err() Rely once again on err_, but still explicitly add an exit just below, in case I made a mistake one day. err() is essentially a trap that triggers in case I mess up an error function, so that it doesn't reliably exit. So, the idea is that everything calls err(), and err() is almost never modified, or modified very carefully. If error exits were ever broken, the result could be quite unpredictable, so lbmk has very strict error handling, and great care is taken to ensure that it does reliably exit. Signed-off-by: Leah Rowe --- include/lib.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 1bfe2060..e7b5bd3d 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -185,19 +185,13 @@ err() fi ( - $real_err "$@" || printf \ - "WARNING: Err function '%s' *returned* 1. Will exit 1 anyway\n" \ - "$real_err" 1>&2 - printf "WARNING: Err function '%s' didn't exit. Will exit 1 anyway\n" \ - "$real_err" 1>&2 - exit 1 + $real_err "$@" || err_ "Error function '$real_err' *returned* 1" + err_ "Error function '$real_err' didn't exit" + exit 1 # just in case! ) || xbmk_err_val=1 # otherwise, it wrongly did exit 0, not exit 1 - [ $xbmk_err_val -eq 0 ] && printf \ - "WARNING: Err function '%s' did exit 0. Will exit 1 anyway.\n" \ - "$real_err" 1>&2 - - exit 1 + [ $xbmk_err_val -eq 0 ] && err_ "Error function '$real_err' did exit 0" + exit 1 # just in case! } err_() From 61e5fd1a0b2791b2819a5d0e58fa76208a4e8774 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:28:22 +0100 Subject: [PATCH 053/267] lib.sh: Add warning if x_ is called without args Signed-off-by: Leah Rowe --- include/lib.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/include/lib.sh b/include/lib.sh index e7b5bd3d..fbbb92da 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -169,6 +169,7 @@ find_ex() x_() { + [ $# -lt 1 ] && printf "WARNING: x_ called without arguments\n" 1>&2 [ $# -lt 1 ] || [ -n "$1" ] || err "Empty first arg: x_ $(echo "$@")" [ $# -lt 1 ] || "$@" || err "Unhandled error for: $(echo "$@")"; : } From 51b2a1159d0d915c080565ba8d2f41203cef6f80 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:30:45 +0100 Subject: [PATCH 054/267] lib.sh: simplify err-not-set handling Signed-off-by: Leah Rowe --- include/lib.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index fbbb92da..e54fd6b4 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -180,8 +180,7 @@ err() real_err="$xbmk_err" if [ -z "$xbmk_err" ]; then - printf "WARNING: err not set. Args: %s\n" "$(echo "$@")" 1>&2 - printf "REMARK: Setting err to default 'err_' value\n" 1>&2 + printf "WARNING: err not set. Defaulting to 'err_'\n" 1>&2 real_err="err_" fi From a3b5626f53db69ed22dc395221ba515d3f74b728 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:32:03 +0100 Subject: [PATCH 055/267] lib.sh: stricter xbmk_err check in err() Signed-off-by: Leah Rowe --- include/lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index e54fd6b4..c9be740a 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -177,9 +177,9 @@ x_() err() { xbmk_err_val=0 + real_err="" && [ -n "${xbmk_err+x}" ] && real_err="$xbmk_err" - real_err="$xbmk_err" - if [ -z "$xbmk_err" ]; then + if [ -z "$real_err" ]; then printf "WARNING: err not set. Defaulting to 'err_'\n" 1>&2 real_err="err_" fi From 5e3aaa1eb8b6f0198723ca67cda07b0990744132 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:49:30 +0100 Subject: [PATCH 056/267] init.sh: Run git name/email check before init Otherwise, it returns if init is already done, which later leads to build errors in coreboot. Signed-off-by: Leah Rowe --- include/init.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/init.sh b/include/init.sh index 349d40ed..b9df34bb 100644 --- a/include/init.sh +++ b/include/init.sh @@ -147,6 +147,11 @@ xbmk_set_version() xbmk_git_init() { + for gitarg in "--global user.name" "--global user.email"; do + gitcmd="git config $gitarg"; $gitcmd || err \ + "Please run this first: $gitcmd \"your ${gitcmd##*.}\"" + done + [ -L ".git" ] && return 1 [ -e ".git" ] && return 0 eval "`setvars "$(date -Rud @$versiondate)" cdate _nogit`" @@ -156,12 +161,7 @@ xbmk_git_init() x_ git commit -m "$projectname $version" --date "$cdate" \ --author="xbmk " 1>/dev/null 2>/dev/null x_ git tag -a "$version" -m "$projectname $version" 1>/dev/null \ - 2>/dev/null - - for gitarg in "--global user.name" "--global user.email"; do - gitcmd="git config $gitarg"; $gitcmd || err \ - "Please run this first: $gitcmd \"your ${gitcmd##*.}\"" - done + 2>/dev/null; : } xbmk_create_tmpdir() From 35265731c5b1bfef4bd4e94722c67be8284c7d64 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:50:50 +0100 Subject: [PATCH 057/267] init.sh: Silence the output of git config --global Signed-off-by: Leah Rowe --- include/init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/init.sh b/include/init.sh index b9df34bb..8f5ab059 100644 --- a/include/init.sh +++ b/include/init.sh @@ -148,8 +148,8 @@ xbmk_set_version() xbmk_git_init() { for gitarg in "--global user.name" "--global user.email"; do - gitcmd="git config $gitarg"; $gitcmd || err \ - "Please run this first: $gitcmd \"your ${gitcmd##*.}\"" + gitcmd="git config $gitarg"; $gitcmd 1>/dev/null 2>/dev/null \ + || err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" done [ -L ".git" ] && return 1 From 20c873085874c277ce0e10ec7792bbee94d1c63f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 4 May 2025 16:53:02 +0100 Subject: [PATCH 058/267] lib.sh: Provide error message where none is given Signed-off-by: Leah Rowe --- include/lib.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/include/lib.sh b/include/lib.sh index c9be740a..71183874 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -196,6 +196,7 @@ err() err_() { + [ $# -lt 1 ] && printf "ERROR (but no error message provided)\n" 1>&2 [ $# -lt 1 ] || printf "ERROR %s: %s\n" "$0" "$1" 1>&2 || : exit 1 } From 428c46ca2b1fee04625d37bec65c30f0baf87530 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 05:20:47 +0100 Subject: [PATCH 059/267] lib.sh: set -u -e in err() Some parts of lbmk set +u +e, to be reset later on under normal conditions upon exit. We must ensure such level of integrity in err() as well. Signed-off-by: Leah Rowe --- include/lib.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/lib.sh b/include/lib.sh index 71183874..43b1a318 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -176,6 +176,8 @@ x_() err() { + set -u -e + xbmk_err_val=0 real_err="" && [ -n "${xbmk_err+x}" ] && real_err="$xbmk_err" From 153dd76a82e98a7260424cf37d5a139fff39d2ab Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 05:41:21 +0100 Subject: [PATCH 060/267] inject.sh: tidy up the deguard command Signed-off-by: Leah Rowe --- include/inject.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index e2987aad..0e81c63f 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -189,10 +189,9 @@ apply_me11_deguard_mod() { ( x_ cd src/deguard/ - x_ ./finalimage.py --delta "data/delta/$ME11delta" \ - --version "$ME11version" \ - --pch "$ME11pch" --sku "$ME11sku" --fake-fpfs data/fpfs/zero \ - --input "$_metmp" --output "$_me" + x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ + "$ME11version" --pch "$ME11pch" --sku "$ME11sku" --fake-fpfs \ + data/fpfs/zero --input "$_metmp" --output "$_me" ) || err "Error running deguard for $_me - $dontflash" } From eb882de94cbe78e575b97ced611a06553f94dbc7 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 05:43:38 +0100 Subject: [PATCH 061/267] inject.sh: tidy up intel me handling Signed-off-by: Leah Rowe --- include/inject.sh | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 0e81c63f..c6c8c2d2 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -142,8 +142,12 @@ extract_intel_me() [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard extract_intel_me_bruteforce - if [ "$ME11bootguard" = "y" ]; then - apply_me11_deguard_mod + if [ "$ME11bootguard" = "y" ]; then ( + x_ cd src/deguard/ + x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ + "$ME11version" --pch "$ME11pch" --sku "$ME11sku" \ + --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_me" + ) || err "Error running deguard for $_me - $dontflash" else mv "$_metmp" "$_me" || err "!mv $_metmp $_me - $dontflash" fi @@ -185,16 +189,6 @@ extract_intel_me_bruteforce() rm -Rf "$sdir" || err "extract_intel_me: !rm -Rf $sdir - $dontflash" } -apply_me11_deguard_mod() -{ - ( - x_ cd src/deguard/ - x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ - "$ME11version" --pch "$ME11pch" --sku "$ME11sku" --fake-fpfs \ - data/fpfs/zero --input "$_metmp" --output "$_me" - ) || err "Error running deguard for $_me - $dontflash" -} - extract_archive() { [ $# -gt 2 ] && [ "$3" = "fsp" ] && x_ python \ From b7ca59debe6e9895485c9c54e820161cb572aebc Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 06:00:23 +0100 Subject: [PATCH 062/267] inject.sh: Move FSP extraction only to extract_fsp Don't do FSP-specific extraction in extract_archive, as that is not what the latter is for. Signed-off-by: Leah Rowe --- include/inject.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index c6c8c2d2..80a691f2 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -121,10 +121,10 @@ fetch() x_ mkdir -p "${_dest%/*}" remkdir "$appdir" - extract_archive "$_dl" "$appdir" "$dl_type" || \ + [ "$dl_type" = "fsp" ] || extract_archive "$_dl" "$appdir" || \ [ "$dl_type" = "e6400vga" ] || err "$_dest $dl_type: !extract" - eval "extract_$dl_type" + x_ extract_$dl_type "$_dl" "$appdir" set -u -e e "$_dest" f missing && err "!extract_$dl_type. $dontflash"; : } @@ -191,10 +191,6 @@ extract_intel_me_bruteforce() extract_archive() { - [ $# -gt 2 ] && [ "$3" = "fsp" ] && x_ python \ - "$cbdir/3rdparty/fsp/Tools/SplitFspBin.py" split -f "$1" -o "$2" \ - -n "Fsp.fd" && return 0 - innoextract "$1" -d "$2" || python "$pfs_extract" "$1" -e || 7z x \ "$1" -o"$2" || unar "$1" -o "$2" || unzip "$1" -d "$2" || return 1 @@ -261,7 +257,8 @@ copy_tbfw() extract_fsp() { - x_ cp "$appdir/"Fsp_*.fd "${_dest%/*}" + x_ python "$cbdir/3rdparty/fsp/Tools/SplitFspBin.py" split -f "$1" \ + -o "$2" -n "Fsp.fd" && x_ cp "$appdir/"Fsp_*.fd "${_dest%/*}" } fail_inject() From f4057d7daab0eb22954d376372a4dad9578f7ba0 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 06:11:47 +0100 Subject: [PATCH 063/267] inject.sh extract_intel_me(): reduce indentation Signed-off-by: Leah Rowe --- include/inject.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 80a691f2..9726c57e 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -142,15 +142,14 @@ extract_intel_me() [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard extract_intel_me_bruteforce - if [ "$ME11bootguard" = "y" ]; then ( - x_ cd src/deguard/ - x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ - "$ME11version" --pch "$ME11pch" --sku "$ME11sku" \ - --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_me" - ) || err "Error running deguard for $_me - $dontflash" - else - mv "$_metmp" "$_me" || err "!mv $_metmp $_me - $dontflash" - fi + [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 + + ( + x_ cd src/deguard/ + x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ + "$ME11version" --pch "$ME11pch" --sku "$ME11sku" \ + --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_me" + ) || err "Error running deguard for $_me - $dontflash"; : } extract_intel_me_bruteforce() From e4edc2194d3aaaf8319fe681475caae5562b351e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 06:21:04 +0100 Subject: [PATCH 064/267] inject.sh: Remove unnecessary check _dest is already checked in the calling function fetch(), after extract_tbfw() has been called. Signed-off-by: Leah Rowe --- include/inject.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/inject.sh b/include/inject.sh index 9726c57e..667a03f8 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -245,7 +245,6 @@ extract_sch5545ec() extract_tbfw() { chkvars TBFW_size && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" - [ -f "$_dest" ] || err "$board: Could not extract tbfw"; : } copy_tbfw() From 61ec396ef6dbf3ce325f63791d634a78f45531a6 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 06:26:38 +0100 Subject: [PATCH 065/267] inject.sh: simplify extract_intel_me_bruteforce() Signed-off-by: Leah Rowe --- include/inject.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 667a03f8..6aceb52c 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -165,9 +165,11 @@ extract_intel_me_bruteforce() [ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}" cd "$cdir" || err "extract_intel_me: !cd \"$cdir\" - $dontflash" for i in *; do - e "$_metmp" f && break + c=0 && e "$_metmp" f && break [ -L "$i" ] && continue - if [ -f "$i" ]; then + [ -e "$i" ] || continue + [ -d "$i" ] && extract_intel_me_bruteforce "$cdir/$i" && c=1 + if [ $c -eq 0 ] && [ -f "$i" ]; then _r="-r" && [ -n "$mfs" ] && _r="" "$mecleaner" $mfs $_r -t -O "$sdir/vendorfile" \ -M "$_metmp" "$i" && break @@ -176,10 +178,6 @@ extract_intel_me_bruteforce() _7ztest="${_7ztest}a" extract_archive "$i" "$_7ztest" || continue extract_intel_me_bruteforce "$cdir/$_7ztest" - elif [ -d "$i" ]; then - extract_intel_me_bruteforce "$cdir/$i" - else - continue fi cdir="$1"; [ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}" cd "$cdir" || : From ee8bb28ba2158a003f7fbf3afb6b1bdb71c8a5cf Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 07:14:38 +0100 Subject: [PATCH 066/267] GRUB: Mark E820 reserved on coreboot memory See, coreboot bug report: https://ticket.coreboot.org/issues/590 We hadn't noticed this for quite a while, since we always just booted with iomem=relaxed when needing to run cbmem, since in practise it was always combined with other tasks that require access to lower memory. GRUB currently matches coreboot's own mmap for cbmem, but for example SeaBIOS marks cbmem as E820 reserved. Therefore, this change replicates the SeaBIOS behaviour. Without this patch, Linux needs to boot with iomem=relaxed for cbmem access, for example when running ./cbmem -1 With this patch, cbmem is now accessible regardless. This patch also prevents Linux from overwriting parts of CBMEM. Thanks go to Paul Menzel, who wrote this GRUB patch. Thanks also go to Nicholas Chin, who provided testing, all the way from Coreboot 25.03 back to Coreboot 4.20. It seems that this is just something the payloads have to handle. This means that both SeaBIOS and GRUB no longer have this bug, in Libreboot; now what remains is to replicate the test with our U-Boot payload. Signed-off-by: Leah Rowe --- ...4-kern-coreboot-mmap-Map-to-reserved.patch | 37 +++++++++++++++++++ ...5-kern-coreboot-mmap-Map-to-reserved.patch | 37 +++++++++++++++++++ ...6-kern-coreboot-mmap-Map-to-reserved.patch | 37 +++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 config/grub/default/patches/0014-kern-coreboot-mmap-Map-to-reserved.patch create mode 100644 config/grub/nvme/patches/0015-kern-coreboot-mmap-Map-to-reserved.patch create mode 100644 config/grub/xhci/patches/0026-kern-coreboot-mmap-Map-to-reserved.patch diff --git a/config/grub/default/patches/0014-kern-coreboot-mmap-Map-to-reserved.patch b/config/grub/default/patches/0014-kern-coreboot-mmap-Map-to-reserved.patch new file mode 100644 index 00000000..5d93ac1d --- /dev/null +++ b/config/grub/default/patches/0014-kern-coreboot-mmap-Map-to-reserved.patch @@ -0,0 +1,37 @@ +From d675307bfcac2f9e05ed119c5b5af3de48e56fb9 Mon Sep 17 00:00:00 2001 +From: Paul Menzel +Date: Mon, 17 May 2021 10:24:36 +0200 +Subject: [PATCH] kern/coreboot/mmap: Map to reserved + +https://git.savannah.gnu.org/cgit/grub.git/commit/?id=6de9ee86bf9ae50967413e6a73b5dfd13e5ffb50 + +Signed-off-by: Paul Menzel +--- + grub-core/kern/coreboot/mmap.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/coreboot/mmap.c b/grub-core/kern/coreboot/mmap.c +index caf8f7cef..2fc316e8d 100644 +--- a/grub-core/kern/coreboot/mmap.c ++++ b/grub-core/kern/coreboot/mmap.c +@@ -59,7 +59,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) + /* Multiboot mmaps match with the coreboot mmap + definition. Therefore, we can just pass type + through. */ +- mem_region->type, ++ (mem_region->type >= 13) ? 2 : mem_region->type, + ctx->hook_data)) + return 1; + if (start < 0xa0000) +@@ -81,7 +81,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) + /* Multiboot mmaps match with the coreboot mmap + definition. Therefore, we can just pass type + through. */ +- mem_region->type, ++ (mem_region->type >= 13) ? 2 : mem_region->type, + ctx->hook_data)) + return 1; + } +-- +2.31.1 + diff --git a/config/grub/nvme/patches/0015-kern-coreboot-mmap-Map-to-reserved.patch b/config/grub/nvme/patches/0015-kern-coreboot-mmap-Map-to-reserved.patch new file mode 100644 index 00000000..5d93ac1d --- /dev/null +++ b/config/grub/nvme/patches/0015-kern-coreboot-mmap-Map-to-reserved.patch @@ -0,0 +1,37 @@ +From d675307bfcac2f9e05ed119c5b5af3de48e56fb9 Mon Sep 17 00:00:00 2001 +From: Paul Menzel +Date: Mon, 17 May 2021 10:24:36 +0200 +Subject: [PATCH] kern/coreboot/mmap: Map to reserved + +https://git.savannah.gnu.org/cgit/grub.git/commit/?id=6de9ee86bf9ae50967413e6a73b5dfd13e5ffb50 + +Signed-off-by: Paul Menzel +--- + grub-core/kern/coreboot/mmap.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/coreboot/mmap.c b/grub-core/kern/coreboot/mmap.c +index caf8f7cef..2fc316e8d 100644 +--- a/grub-core/kern/coreboot/mmap.c ++++ b/grub-core/kern/coreboot/mmap.c +@@ -59,7 +59,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) + /* Multiboot mmaps match with the coreboot mmap + definition. Therefore, we can just pass type + through. */ +- mem_region->type, ++ (mem_region->type >= 13) ? 2 : mem_region->type, + ctx->hook_data)) + return 1; + if (start < 0xa0000) +@@ -81,7 +81,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) + /* Multiboot mmaps match with the coreboot mmap + definition. Therefore, we can just pass type + through. */ +- mem_region->type, ++ (mem_region->type >= 13) ? 2 : mem_region->type, + ctx->hook_data)) + return 1; + } +-- +2.31.1 + diff --git a/config/grub/xhci/patches/0026-kern-coreboot-mmap-Map-to-reserved.patch b/config/grub/xhci/patches/0026-kern-coreboot-mmap-Map-to-reserved.patch new file mode 100644 index 00000000..5d93ac1d --- /dev/null +++ b/config/grub/xhci/patches/0026-kern-coreboot-mmap-Map-to-reserved.patch @@ -0,0 +1,37 @@ +From d675307bfcac2f9e05ed119c5b5af3de48e56fb9 Mon Sep 17 00:00:00 2001 +From: Paul Menzel +Date: Mon, 17 May 2021 10:24:36 +0200 +Subject: [PATCH] kern/coreboot/mmap: Map to reserved + +https://git.savannah.gnu.org/cgit/grub.git/commit/?id=6de9ee86bf9ae50967413e6a73b5dfd13e5ffb50 + +Signed-off-by: Paul Menzel +--- + grub-core/kern/coreboot/mmap.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/coreboot/mmap.c b/grub-core/kern/coreboot/mmap.c +index caf8f7cef..2fc316e8d 100644 +--- a/grub-core/kern/coreboot/mmap.c ++++ b/grub-core/kern/coreboot/mmap.c +@@ -59,7 +59,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) + /* Multiboot mmaps match with the coreboot mmap + definition. Therefore, we can just pass type + through. */ +- mem_region->type, ++ (mem_region->type >= 13) ? 2 : mem_region->type, + ctx->hook_data)) + return 1; + if (start < 0xa0000) +@@ -81,7 +81,7 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, void *data) + /* Multiboot mmaps match with the coreboot mmap + definition. Therefore, we can just pass type + through. */ +- mem_region->type, ++ (mem_region->type >= 13) ? 2 : mem_region->type, + ctx->hook_data)) + return 1; + } +-- +2.31.1 + From 6b247c93e25f7283524edb6b6e19ca3296c78006 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 11:54:23 +0100 Subject: [PATCH 067/267] mk: Fix bad error handling for gnu_setver I mixed logical OR and AND by mistake. Oops! Signed-off-by: Leah Rowe --- mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mk b/mk index 55f67a92..dcf135a1 100755 --- a/mk +++ b/mk @@ -326,7 +326,8 @@ check_gnu_path() command -v "$1" 1>/dev/null || err "Host '$1' unavailable" eval "`setvars "" gccver gccfull gnatver gnatfull gccdir gnatdir`" - x_ gnu_setver "$1" "$1" && gnu_setver "$2" "$2" || : + x_ gnu_setver "$1" "$1" || err "Command '$1' unavailable." + gnu_setver "$2" "$2" || : eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\"" [ "$gnatfull" = "$gccfull" ] && return 0 From 62ec3dac07584d6ab8e7f86587e730b3d159e8ef Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 15:31:33 +0100 Subject: [PATCH 068/267] git.sh: move singletree() to lib.sh it's also used by mk, to determine which build function to use (build_project or build_targets). Signed-off-by: Leah Rowe --- include/git.sh | 9 --------- include/lib.sh | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/git.sh b/include/git.sh index ded12625..7995df06 100644 --- a/include/git.sh +++ b/include/git.sh @@ -66,15 +66,6 @@ git_prep() mv "$tmpgit" "$_loc" || err "git_prep: !mv $tmpgit $_loc" } -# return 0 if project is single-tree, otherwise 1 -# e.g. coreboot is multi-tree, so 1 -singletree() -{ - for targetfile in "config/${1}/"*/target.cfg; do - [ -e "$targetfile" ] && [ -f "$targetfile" ] && return 1; : - done; : -} - fetch_submodule() { mcfgdir="$mdir/${1##*/}"; eval \ diff --git a/include/lib.sh b/include/lib.sh index 43b1a318..1830356e 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -144,6 +144,15 @@ chkvars() done; : } +# return 0 if project is single-tree, otherwise 1 +# e.g. coreboot is multi-tree, so 1 +singletree() +{ + for targetfile in "config/${1}/"*/target.cfg; do + [ -e "$targetfile" ] && [ -f "$targetfile" ] && return 1; : + done; : +} + fe_() { find_ex "x_" "$@" From 437ac2454c1a6a77c40894379f5073b4412d0c8d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 15:40:08 +0100 Subject: [PATCH 069/267] lib.sh: simplify singletree() Signed-off-by: Leah Rowe --- include/lib.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 1830356e..b8f99674 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -148,9 +148,7 @@ chkvars() # e.g. coreboot is multi-tree, so 1 singletree() { - for targetfile in "config/${1}/"*/target.cfg; do - [ -e "$targetfile" ] && [ -f "$targetfile" ] && return 1; : - done; : + ( fe_ "exit 1" "config/$1/"*/ -type f -name "target.cfg" ) || return 1 } fe_() From c2182d821939a7d3c3e8ff2b6ff96e9e44ff96fa Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 15:51:04 +0100 Subject: [PATCH 070/267] mk: simplify elfcheck() fe_() called inside subshell, ftw Signed-off-by: Leah Rowe --- mk | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mk b/mk index dcf135a1..08ac22a2 100755 --- a/mk +++ b/mk @@ -370,10 +370,8 @@ check_defconfig() elfcheck() { - # TODO: very hacky check. do it properly (based on build.list) - for elftest in "$dest_dir"/*; do - [ -e "$elftest" ] && e "$elftest" f && return 1 - done; : + # TODO: *STILL* very hacky check. do it properly (based on build.list) + ( fe_ "exit 1" "$dest_dir" -type f ) || return 1; : } handle_makefile() From 89a8cd4936a7dd24eb4c2db8a484b858ed20dd88 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 17:41:10 +0100 Subject: [PATCH 071/267] rom.sh: simplify mkseagrub() Signed-off-by: Leah Rowe --- include/rom.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/include/rom.sh b/include/rom.sh index af739d92..8f605e3a 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -192,9 +192,7 @@ mkseagrub() [ "$payload_grubsea" = "y" ] && pname="grub" [ "$payload_grubsea" = "y" ] || \ cbfs "$tmprom" "$grubdata/bootorder" bootorder raw - for keymap in config/data/grub/keymap/*.gkb; do - [ -f "$keymap" ] && cprom "${keymap##*/}"; : - done; : + fe_ "cprom" "$grubdata/keymap" -type f -name "*.gkb" } add_uboot() @@ -243,16 +241,16 @@ add_uboot() cprom() { - newrom="bin/$target/${pname}_${target}_$initmode.rom" + tmpnew=""; newrom="bin/$target/${pname}_${target}_$initmode.rom" [ -n "$displaymode" ] && newrom="${newrom%.rom}_$displaymode.rom" - [ $# -gt 0 ] && [ "$1" != "seauboot" ] && \ - newrom="${newrom%.rom}_${1%.gkb}.rom" + [ $# -gt 0 ] && [ "$1" != "seauboot" ] && tmpnew="${1##*/}" && \ + newrom="${newrom%.rom}_${tmpnew%.gkb}.rom" x_ mkdir -p "bin/$target" - x_ cp "$tmprom" "$newrom" && [ $# -gt 0 ] && [ "$1" != "seauboot" ] && \ - cbfs "$newrom" "config/data/grub/keymap/$1" keymap.gkb raw + x_ cp "$tmprom" "$newrom" && [ $# -gt 0 ] && [ "$1" != "seauboot" ] \ + && cbfs "$newrom" "$grubdata/keymap/$tmpnew" keymap.gkb raw [ $# -gt 0 ] && [ "$1" = "seauboot" ] && \ - cbfs "$newrom" "config/data/grub/bootorder_uboot" bootorder raw; : + cbfs "$newrom" "$grubdata/bootorder_uboot" bootorder raw; : } cbfs() From 2be8d1c7982a37cb4e8e57b302c4039be4bc5bad Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 17:53:02 +0100 Subject: [PATCH 072/267] rom.sh: specifically check keymaps in cprom() "not seauboot" is a valid check at present, but if i start supporting other arguments in the future, this code would have to change. therefore, i change it in advance, on that theory. this new check is more technically correct. these lines are triggered when inserting grub keymaps. Signed-off-by: Leah Rowe --- include/rom.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rom.sh b/include/rom.sh index 8f605e3a..a92348bf 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -243,11 +243,11 @@ cprom() { tmpnew=""; newrom="bin/$target/${pname}_${target}_$initmode.rom" [ -n "$displaymode" ] && newrom="${newrom%.rom}_$displaymode.rom" - [ $# -gt 0 ] && [ "$1" != "seauboot" ] && tmpnew="${1##*/}" && \ + [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ] && tmpnew="${1##*/}" && \ newrom="${newrom%.rom}_${tmpnew%.gkb}.rom" x_ mkdir -p "bin/$target" - x_ cp "$tmprom" "$newrom" && [ $# -gt 0 ] && [ "$1" != "seauboot" ] \ + x_ cp "$tmprom" "$newrom" && [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ] \ && cbfs "$newrom" "$grubdata/keymap/$tmpnew" keymap.gkb raw [ $# -gt 0 ] && [ "$1" = "seauboot" ] && \ cbfs "$newrom" "$grubdata/bootorder_uboot" bootorder raw; : From dc9fe517cb04c1903ce7974267821c51640e0e60 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 18:08:55 +0100 Subject: [PATCH 073/267] rom.sh: Safer cprom() Don't insert special files like GRUB keymaps after copying to the final destination. Instead, copy the tmprom to /tmp and operate on that, in these instances. This is less efficient, depending on the user's configuration; if /tmp is on the same file system as the user's xbmkpwd, it should be fine. However, the actual performance hit isn't that bad in practise, on most setups. If the user's /tmp is a tmpfs, then that means using tmpfs, but it's one image at a time. It should be OK. Signed-off-by: Leah Rowe --- include/rom.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/rom.sh b/include/rom.sh index a92348bf..98b94926 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -241,16 +241,24 @@ add_uboot() cprom() { + cpcmd="cp" + tmpnew=""; newrom="bin/$target/${pname}_${target}_$initmode.rom" [ -n "$displaymode" ] && newrom="${newrom%.rom}_$displaymode.rom" [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ] && tmpnew="${1##*/}" && \ newrom="${newrom%.rom}_${tmpnew%.gkb}.rom" - x_ mkdir -p "bin/$target" - x_ cp "$tmprom" "$newrom" && [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ] \ - && cbfs "$newrom" "$grubdata/keymap/$tmpnew" keymap.gkb raw + irom="$tmprom" + [ $# -lt 1 ] || irom="`mktemp`" || err "!mk irom, $(echo "$@")" + [ $# -gt 0 ] && x_ cp "$tmprom" "$irom" && cpcmd="mv" + + [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ] && \ + cbfs "$irom" "$grubdata/keymap/$tmpnew" keymap.gkb raw [ $# -gt 0 ] && [ "$1" = "seauboot" ] && \ - cbfs "$newrom" "$grubdata/bootorder_uboot" bootorder raw; : + cbfs "$irom" "$grubdata/bootorder_uboot" bootorder raw; : + + x_ mkdir -p "bin/$target" + x_ $cpcmd "$irom" "$newrom" } cbfs() From 8ca06463ebc42142ca7618ee6a07950059cf4820 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 18:14:44 +0100 Subject: [PATCH 074/267] rom.sh: Print the rom image path being generated This message used to exist, and it's a nice feedback for the user, to confirm that the build went OK. Signed-off-by: Leah Rowe --- include/rom.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/include/rom.sh b/include/rom.sh index 98b94926..0eebdabb 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -257,6 +257,7 @@ cprom() [ $# -gt 0 ] && [ "$1" = "seauboot" ] && \ cbfs "$irom" "$grubdata/bootorder_uboot" bootorder raw; : + printf "Creating new %s image: '%s'\n" "$projectname" "$newrom" x_ mkdir -p "bin/$target" x_ $cpcmd "$irom" "$newrom" } From f98e34a24dd21ebafbfac2e019d3a4bc1cf500cb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 20:33:02 +0100 Subject: [PATCH 075/267] singletree/elfcheck: use fx_, not fe_ fe_ returns an error on the find command, but we rely on the only error ever being our intentional exit, upon discovering files. in singletree, the directory being checked was already checked first, so we know it's safe not to err on find; and find not reporting an error if no files are found is ok. on elfcheck, it's very much the same thing. In fact, we very much want it to return 0 if the directory doesn't exist, or if files don't exist within it. Therefore, use fx_ which is designed for this use-case. Quick re-cap: fx and fe execute a given function name with each line outputting by find as an argument, each time. It is somewhat similar in scope to find's -exec command. We use fe_ as shorthand in several places all over lbmk. Signed-off-by: Leah Rowe --- include/lib.sh | 2 +- mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index b8f99674..2c28b112 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -148,7 +148,7 @@ chkvars() # e.g. coreboot is multi-tree, so 1 singletree() { - ( fe_ "exit 1" "config/$1/"*/ -type f -name "target.cfg" ) || return 1 + ( fx_ "exit 1" "config/$1/"*/ -type f -name "target.cfg" ) || return 1 } fe_() diff --git a/mk b/mk index 08ac22a2..a438d653 100755 --- a/mk +++ b/mk @@ -371,7 +371,7 @@ check_defconfig() elfcheck() { # TODO: *STILL* very hacky check. do it properly (based on build.list) - ( fe_ "exit 1" "$dest_dir" -type f ) || return 1; : + ( fx_ "exit 1" "$dest_dir" -type f ) || return 1; : } handle_makefile() From 17d826d3a9614fea2bc87d8203b7f07fe4b7fb54 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 20:38:19 +0100 Subject: [PATCH 076/267] lbmk: Replace err with much simpler implementation The current implementation is insanely over-engineered, and completely unnecessary. Signed-off-by: Leah Rowe --- include/init.sh | 2 -- include/inject.sh | 1 - include/lib.sh | 22 ---------------------- 3 files changed, 25 deletions(-) diff --git a/include/init.sh b/include/init.sh index 8f5ab059..1be860ea 100644 --- a/include/init.sh +++ b/include/init.sh @@ -14,8 +14,6 @@ projectsite="https://libreboot.org/" export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" xbmkpath="$PATH" -xbmk_err="err_" - eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \ datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver xbmklocal \ xbmklock`" diff --git a/include/inject.sh b/include/inject.sh index 6aceb52c..6caf8500 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -270,7 +270,6 @@ fail_inject() inject() { need_files="n" - xbmk_err="fail_inject" remkdir "$tmpromdel" set +u +e diff --git a/include/lib.sh b/include/lib.sh index 2c28b112..e83170ee 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -184,28 +184,6 @@ x_() err() { set -u -e - - xbmk_err_val=0 - real_err="" && [ -n "${xbmk_err+x}" ] && real_err="$xbmk_err" - - if [ -z "$real_err" ]; then - printf "WARNING: err not set. Defaulting to 'err_'\n" 1>&2 - real_err="err_" - fi - - ( - $real_err "$@" || err_ "Error function '$real_err' *returned* 1" - err_ "Error function '$real_err' didn't exit" - exit 1 # just in case! - ) || xbmk_err_val=1 # otherwise, it wrongly did exit 0, not exit 1 - - [ $xbmk_err_val -eq 0 ] && err_ "Error function '$real_err' did exit 0" - exit 1 # just in case! -} - -err_() -{ - [ $# -lt 1 ] && printf "ERROR (but no error message provided)\n" 1>&2 [ $# -lt 1 ] || printf "ERROR %s: %s\n" "$0" "$1" 1>&2 || : exit 1 } From c275f35e7e26c878011e8033680c11b75637390a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 20:41:48 +0100 Subject: [PATCH 077/267] lib.sh x_(): Remove warning of empty args It's completely unnecessary, and I forsee this check breaking the build system at some point, since some commands rely on the output of other commands. Therefore, I've removed this check. Signed-off-by: Leah Rowe --- include/lib.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/lib.sh b/include/lib.sh index e83170ee..6de1010e 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -176,7 +176,6 @@ find_ex() x_() { - [ $# -lt 1 ] && printf "WARNING: x_ called without arguments\n" 1>&2 [ $# -lt 1 ] || [ -n "$1" ] || err "Empty first arg: x_ $(echo "$@")" [ $# -lt 1 ] || "$@" || err "Unhandled error for: $(echo "$@")"; : } From ef38333f8b0dae8f7f7b271128e2805de9669be3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 20:45:31 +0100 Subject: [PATCH 078/267] lib.sh find_ex: Write sort errors to /dev/null Signed-off-by: Leah Rowe --- include/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lib.sh b/include/lib.sh index 6de1010e..e6fa7e75 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -166,7 +166,7 @@ find_ex() xmsg="$1" && shift 1 fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" xx="$1" && shift 1 - $xmsg find "$@" 2>/dev/null | sort > "$fd" || \ + $xmsg find "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || \ err "!find $(echo "$@") > \"$fd\"" while read -r fx; do $xx "$fx" || break; : From 7585336b914d5d43ab85ba2f75fc5215be7782fb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 21:05:45 +0100 Subject: [PATCH 079/267] inject.sh: simplify kconfig scanning Use fe_ with a new function, scankconfig, to do the same thing. Not only is this simpler, it now also operates on all coreboot configs for a given target, whereas it previously only operated on the first one. This is useful for cases where one config might use a file that the other one does not; in practise, we don't do this yet, but it's a theoretical possibility Also: don't use the function check_defconfig, which is now redundant and has been removed. That function also conflicted with another function by the same name in mk, but fortunately didn't cause an issue in practise, due to how sh works; when vendor.sh was used, it was without running the tree commands, except under a separate lbmk instance. So this is a simplification, a feature enhancement and even a bug fix, all wrapped into one! Signed-off-by: Leah Rowe --- include/inject.sh | 12 +++++++++--- include/lib.sh | 8 -------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 6caf8500..fa6ac095 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -49,9 +49,8 @@ download() readkconfig() { x_ rm -f "$xbmktmp/cbcfg" - cbcfg="`check_defconfig "$boarddir"`" || for cbc in $cv; do - grep "$cbc" "$cbcfg" 1>>"$xbmktmp/cbcfg" 2>/dev/null || : - done + fe_ scankconfig "$boarddir/config" -type f + eval "`setcfg "$xbmktmp/cbcfg" 1`" for c in $cvchk; do @@ -63,6 +62,13 @@ readkconfig() return 1 } +scankconfig() +{ + for cbc in $cv; do + grep "$cbc" "$1" 1>>"$xbmktmp/cbcfg" 2>/dev/null || : + done +} + bootstrap() { x_ ./mk -f coreboot ${cbdir##*/} diff --git a/include/lib.sh b/include/lib.sh index e6fa7e75..530ea170 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -105,14 +105,6 @@ mk() done; : } -check_defconfig() -{ - [ -d "$1" ] || err "Target '$1' not defined." - for x in "$1"/config/*; do - [ -f "$x" ] && printf "%s\n" "$x" && return 1 - done; : -} - setvars() { _setvars="" From 73074dedee33bfa66edfc9a19dd9625598911518 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 21:13:28 +0100 Subject: [PATCH 080/267] inject.sh: Further simplified FSP extraction We don't need the copy command at all, since the files it copies are the only ones that the Python script does anyway, so now we just make that script output to the directory, directly, where these files must go. Signed-off-by: Leah Rowe --- include/inject.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/inject.sh b/include/inject.sh index fa6ac095..5c5e1e1c 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -260,7 +260,7 @@ copy_tbfw() extract_fsp() { x_ python "$cbdir/3rdparty/fsp/Tools/SplitFspBin.py" split -f "$1" \ - -o "$2" -n "Fsp.fd" && x_ cp "$appdir/"Fsp_*.fd "${_dest%/*}" + -o "${_dest%/*}" -n "Fsp.fd" } fail_inject() From 282b939d9dae58f2ef128b3a866ba8640f87739b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 May 2025 21:33:29 +0100 Subject: [PATCH 081/267] init.sh: New function dx_ to execute path files Generated by find, this is a wrapper in place of using for loops everywhere. This simplification temporarily increases the amount of code, because we don't do this a lot, but this will reduce the growth of the build system code size in future changes. Signed-off-by: Leah Rowe --- include/git.sh | 4 +--- include/lib.sh | 11 ++++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/git.sh b/include/git.sh index 7995df06..535c7d6e 100644 --- a/include/git.sh +++ b/include/git.sh @@ -54,9 +54,7 @@ git_prep() chkvars rev tmpclone "$1" "$2" "$tmpgit" "$rev" "$_patchdir" if singletree "$project" || [ $# -gt 4 ]; then - [ -f "$mdir/module.list" ] && while read -r msrcdir; do - fetch_submodule "$msrcdir" - done < "$mdir/module.list"; : + dx_ fetch_submodule "$mdir/module.list" fi [ "$_loc" != "$XBMK_CACHE/repo/$project" ] && \ diff --git a/include/lib.sh b/include/lib.sh index 530ea170..572fcf68 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -160,12 +160,17 @@ find_ex() xx="$1" && shift 1 $xmsg find "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || \ err "!find $(echo "$@") > \"$fd\"" - while read -r fx; do - $xx "$fx" || break; : - done < "$fd" + dx_ "$xx" "$fd" x_ rm -f "$fd" } +dx_() +{ + [ -f "$2" ] && while read -r fx; do + $1 "$fx" + done < "$2"; : +} + x_() { [ $# -lt 1 ] || [ -n "$1" ] || err "Empty first arg: x_ $(echo "$@")" From 4c1de1ad1267f74ed28cdb0a7c2cc06d52949dda Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 May 2025 04:49:56 +0100 Subject: [PATCH 082/267] inject.sh: remove unused function Signed-off-by: Leah Rowe --- include/inject.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 5c5e1e1c..3cfe891c 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -263,16 +263,6 @@ extract_fsp() -o "${_dest%/*}" -n "Fsp.fd" } -fail_inject() -{ - [ -L "$tmpromdel" ] || [ ! -d "$tmpromdel" ] || \ - rm -Rf "$tmpromdel" || : - printf "\n\n%s\n\n" "$dontflash" 1>&2 - printf "WARNING: File '%s' was NOT modified.\n\n" "$archive" 1>&2 - printf "Please MAKE SURE vendor files are inserted before flashing\n\n" - err_ "$1" -} - inject() { need_files="n" From e8be3fd1d41c3c0a81c2cfecb3fa68271ad794ca Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 May 2025 11:09:39 +0100 Subject: [PATCH 083/267] git.sh: Simplify git am handling fx_ and fe_ really are the best shell functions ever. really. they're the best. Signed-off-by: Leah Rowe --- include/git.sh | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/include/git.sh b/include/git.sh index 535c7d6e..0a05b5ab 100644 --- a/include/git.sh +++ b/include/git.sh @@ -108,23 +108,13 @@ tmpclone() ( [ $# -gt 5 ] || git clone "$repodir" "$3" || err "!clone $repodir $3" git -C "$3" reset --hard "$4" || err "!reset $1 $2 $3 $4 $5" - git_am_patches "$3" "$5" + fx_ "eval x_ git -C \"$3\" am" "$5" -type f ) || repofail="y" [ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry [ "$repofail" = "y" ] && err "!clone $1 $2 $3 $4 $5"; : } -git_am_patches() -{ - for p in "$2/"*; do - [ -L "$p" ] && continue - [ -e "$p" ] || continue - [ -d "$p" ] && git_am_patches "$1" "$p" && continue - [ ! -f "$p" ] || git -C "$1" am "$p" || err "$1 $2: !am $p" - done; : -} - nuke() { e "config/${1%/}/nuke.list" f missing || while read -r nukefile; do From 5686f35e0f1522d45361f042adc135b5782eae32 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 May 2025 18:32:28 +0100 Subject: [PATCH 084/267] inject.sh: insanely optimise the me bruteforce use fe_ fe_ ftw Signed-off-by: Leah Rowe --- include/inject.sh | 49 +++++++++++++++++------------------------------ 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 3cfe891c..f3f75bf3 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -35,7 +35,7 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ mecleaner kbc1126_ec_dump MRC_refcode_cbtree new_mac _dl SCH5545EC_DL_url \ archive EC_url boarddir rom cbdir DL_url nukemode cbfstoolref FSPFD_hash \ _7ztest ME11bootguard ME11delta ME11version ME11sku ME11pch tmpromdir \ - IFD_platform ifdprefix cdir sdir _me _metmp mfs TBFW_url_bkup TBFW_url \ + IFD_platform ifdprefix _me _metmp mfs TBFW_url_bkup TBFW_url \ TBFW_hash TBFW_size hashfile xromsize xchanged EC_url_bkup need_files \ vfile cbcfg $cv`" @@ -139,15 +139,19 @@ extract_intel_me() { e "$mecleaner" f not && err "$cbdir: me_cleaner missing. $dontflash" - cdir="$xbmkpwd/$appdir" + _7ztest="$xbmklocal/metmp/a" _me="$xbmkpwd/$_dest" _metmp="$xbmklocal/me.bin" + x_ rm -f "$_metmp" mfs="" && [ "$ME11bootguard" = "y" ] && mfs="--whitelist MFS" && \ chkvars ME11delta ME11version ME11sku ME11pch [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard - extract_intel_me_bruteforce + set +u +e + ( fe_ extract_intel_me_bruteforce "$xbmkpwd/$appdir" -type f ) || : + x_ rm -Rf "$xbmklocal/metmp" + [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 ( @@ -160,36 +164,19 @@ extract_intel_me() extract_intel_me_bruteforce() { - [ $# -gt 0 ] && cdir="$1" - e "$_metmp" f && return 0 + [ -L "$1" ] && return 0 + e "$_metmp" f && x_ && exit 1 - [ -z "$sdir" ] && sdir="$(mktemp -d)" - x_ mkdir -p "$sdir" + _r="-r" && [ -n "$mfs" ] && _r="" + + "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" && exit 1 + "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" && exit 1 + "$me7updateparser" -O "$_metmp" "$1" && exit 1 - set +u +e - ( - [ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}" - cd "$cdir" || err "extract_intel_me: !cd \"$cdir\" - $dontflash" - for i in *; do - c=0 && e "$_metmp" f && break - [ -L "$i" ] && continue - [ -e "$i" ] || continue - [ -d "$i" ] && extract_intel_me_bruteforce "$cdir/$i" && c=1 - if [ $c -eq 0 ] && [ -f "$i" ]; then - _r="-r" && [ -n "$mfs" ] && _r="" - "$mecleaner" $mfs $_r -t -O "$sdir/vendorfile" \ - -M "$_metmp" "$i" && break - "$mecleaner" $mfs $_r -t -O "$_metmp" "$i" && break - "$me7updateparser" -O "$_metmp" "$i" && break - _7ztest="${_7ztest}a" - extract_archive "$i" "$_7ztest" || continue - extract_intel_me_bruteforce "$cdir/$_7ztest" - fi - cdir="$1"; [ "${cdir#/a}" != "$cdir" ] && cdir="${cdir#/}" - cd "$cdir" || : - done - ) || : - rm -Rf "$sdir" || err "extract_intel_me: !rm -Rf $sdir - $dontflash" + _7ztest="${_7ztest}a" + extract_archive "$i" "$_7ztest" || return 0 + + ( fe_ extract_intel_me_bruteforce "$_7ztest" -type f ) || exit 1; : } extract_archive() From 5657cc1afb326b5b902dc8eb7fd584a15a38ca37 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 May 2025 19:30:55 +0100 Subject: [PATCH 085/267] inject.sh: don't use subshell for me bruteforce i needed it on the old version, which used cd this one stays in the same directory at all times Signed-off-by: Leah Rowe --- include/inject.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index f3f75bf3..0fcd6977 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -149,7 +149,7 @@ extract_intel_me() [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard set +u +e - ( fe_ extract_intel_me_bruteforce "$xbmkpwd/$appdir" -type f ) || : + fe_ extract_intel_me_bruteforce "$xbmkpwd/$appdir" -type f || : x_ rm -Rf "$xbmklocal/metmp" [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 @@ -165,18 +165,19 @@ extract_intel_me() extract_intel_me_bruteforce() { [ -L "$1" ] && return 0 - e "$_metmp" f && x_ && exit 1 + e "$_metmp" f && x_ && return 1 _r="-r" && [ -n "$mfs" ] && _r="" - "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" && exit 1 - "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" && exit 1 - "$me7updateparser" -O "$_metmp" "$1" && exit 1 + "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" && \ + return 1 + "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" && return 1 + "$me7updateparser" -O "$_metmp" "$1" && return 1 _7ztest="${_7ztest}a" extract_archive "$i" "$_7ztest" || return 0 - ( fe_ extract_intel_me_bruteforce "$_7ztest" -type f ) || exit 1; : + fe_ extract_intel_me_bruteforce "$_7ztest" -type f || return 1; : } extract_archive() From cf78583a6d8b4fe744c0872c82e7cca011899188 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 May 2025 19:32:18 +0100 Subject: [PATCH 086/267] inject.sh: remove unnecessary check the call stack already falls through with a bunch of return 1s after a successful run of me_cleaner, so it's really not necessary. Signed-off-by: Leah Rowe --- include/inject.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/inject.sh b/include/inject.sh index 0fcd6977..347d2d3b 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -165,7 +165,6 @@ extract_intel_me() extract_intel_me_bruteforce() { [ -L "$1" ] && return 0 - e "$_metmp" f && x_ && return 1 _r="-r" && [ -n "$mfs" ] && _r="" From 4781dbd2a050e7c98ae14e0eead7fb6f3ec0f92c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 May 2025 19:43:44 +0100 Subject: [PATCH 087/267] inject.sh: fix oversight in me bruteforce i used i instead of 1, in the variable when running the extract_archive function. this didn't trigger since +u was set, and +e was set. in practise, then, it seems that because of this, and because my ME extract/insert test was a success, that none of the archives we use actually have a ME inside of a file inside of a given downloaded archive. still, this is technically incorrect, so fix it! Signed-off-by: Leah Rowe --- include/inject.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/inject.sh b/include/inject.sh index 347d2d3b..b31964e6 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -174,7 +174,7 @@ extract_intel_me_bruteforce() "$me7updateparser" -O "$_metmp" "$1" && return 1 _7ztest="${_7ztest}a" - extract_archive "$i" "$_7ztest" || return 0 + extract_archive "$1" "$_7ztest" || return 0 fe_ extract_intel_me_bruteforce "$_7ztest" -type f || return 1; : } From 03300766d1418cb2670c120dab8b20acdbb63f3d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 May 2025 19:47:08 +0100 Subject: [PATCH 088/267] inject.sh: tidy up extract_intel_me_bruteforce Signed-off-by: Leah Rowe --- include/inject.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index b31964e6..845208ba 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -165,9 +165,8 @@ extract_intel_me() extract_intel_me_bruteforce() { [ -L "$1" ] && return 0 - _r="-r" && [ -n "$mfs" ] && _r="" - + "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" && \ return 1 "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" && return 1 From fac99aa2d4478268453bdbe36f9397c15328201e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 May 2025 20:24:32 +0100 Subject: [PATCH 089/267] lib.sh: re-add missing break in fe/fx_ Signed-off-by: Leah Rowe --- include/lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 572fcf68..a125181b 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -160,14 +160,14 @@ find_ex() xx="$1" && shift 1 $xmsg find "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || \ err "!find $(echo "$@") > \"$fd\"" - dx_ "$xx" "$fd" + dx_ "$xx" "$fd" || break x_ rm -f "$fd" } dx_() { [ -f "$2" ] && while read -r fx; do - $1 "$fx" + $1 "$fx" || return 1 done < "$2"; : } From 485d785d3313fb5c27b0822f8c8e25d631efb3d6 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 6 May 2025 21:16:06 +0100 Subject: [PATCH 090/267] inject.sh: clean up tmp me file before extract Signed-off-by: Leah Rowe --- include/inject.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/inject.sh b/include/inject.sh index 845208ba..a26668b5 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -142,7 +142,7 @@ extract_intel_me() _7ztest="$xbmklocal/metmp/a" _me="$xbmkpwd/$_dest" _metmp="$xbmklocal/me.bin" - x_ rm -f "$_metmp" + x_ rm -f "$_metmp" "$xbmklocal/a" mfs="" && [ "$ME11bootguard" = "y" ] && mfs="--whitelist MFS" && \ chkvars ME11delta ME11version ME11sku ME11pch From 2b7f6b7d7cedfcc7661f02b8092707fde09460a0 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 10:20:59 +0100 Subject: [PATCH 091/267] inject.sh: Simplify extract_intel_me_bruteforce() This is probably about as small as it's going to get. Signed-off-by: Leah Rowe --- include/inject.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index a26668b5..c1e8131c 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -148,14 +148,10 @@ extract_intel_me() chkvars ME11delta ME11version ME11sku ME11pch [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard - set +u +e - fe_ extract_intel_me_bruteforce "$xbmkpwd/$appdir" -type f || : - x_ rm -Rf "$xbmklocal/metmp" - + set +u +e && fe_ extract_intel_me_bruteforce "$xbmkpwd/$appdir" -type f [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 - ( - x_ cd src/deguard/ + ( x_ cd src/deguard/ x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ "$ME11version" --pch "$ME11pch" --sku "$ME11sku" \ --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_me" @@ -164,16 +160,14 @@ extract_intel_me() extract_intel_me_bruteforce() { + e "$_metmp" f && x_ rm -Rf "$xbmklocal/metmp" && return 1 [ -L "$1" ] && return 0 - _r="-r" && [ -n "$mfs" ] && _r="" - "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" && \ - return 1 - "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" && return 1 - "$me7updateparser" -O "$_metmp" "$1" && return 1 + _7ztest="${_7ztest}a" && _r="-r" && [ -n "$mfs" ] && _r="" - _7ztest="${_7ztest}a" - extract_archive "$1" "$_7ztest" || return 0 + "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" || \ + "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ + -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 fe_ extract_intel_me_bruteforce "$_7ztest" -type f || return 1; : } From 0faef899469818410e5e6d481f1e6c4fa5ad3d3d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 13:27:25 +0100 Subject: [PATCH 092/267] lib.sh: support any command on find_exec() right now, we assume "find", but it adds any number of arguments next to that. change it instead to support any command, where the assumption is that it would generate a list of files and directories. Signed-off-by: Leah Rowe --- include/git.sh | 2 +- include/inject.sh | 16 ++++++++-------- include/lib.sh | 5 +++-- include/rom.sh | 2 +- mk | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/git.sh b/include/git.sh index 0a05b5ab..81c75806 100644 --- a/include/git.sh +++ b/include/git.sh @@ -108,7 +108,7 @@ tmpclone() ( [ $# -gt 5 ] || git clone "$repodir" "$3" || err "!clone $repodir $3" git -C "$3" reset --hard "$4" || err "!reset $1 $2 $3 $4 $5" - fx_ "eval x_ git -C \"$3\" am" "$5" -type f + fx_ "eval x_ git -C \"$3\" am" find "$5" -type f ) || repofail="y" [ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry diff --git a/include/inject.sh b/include/inject.sh index c1e8131c..f1e29fd6 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -49,7 +49,7 @@ download() readkconfig() { x_ rm -f "$xbmktmp/cbcfg" - fe_ scankconfig "$boarddir/config" -type f + fe_ scankconfig find "$boarddir/config" -type f eval "`setcfg "$xbmktmp/cbcfg" 1`" @@ -148,7 +148,7 @@ extract_intel_me() chkvars ME11delta ME11version ME11sku ME11pch [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard - set +u +e && fe_ extract_intel_me_bruteforce "$xbmkpwd/$appdir" -type f + set +u +e && fe_ find_me find "$xbmkpwd/$appdir" -type f [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 ( x_ cd src/deguard/ @@ -158,7 +158,7 @@ extract_intel_me() ) || err "Error running deguard for $_me - $dontflash"; : } -extract_intel_me_bruteforce() +find_me() { e "$_metmp" f && x_ rm -Rf "$xbmklocal/metmp" && return 1 [ -L "$1" ] && return 0 @@ -169,7 +169,7 @@ extract_intel_me_bruteforce() "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 - fe_ extract_intel_me_bruteforce "$_7ztest" -type f || return 1; : + fe_ find_me find "$_7ztest" -type f || return 1; : } extract_archive() @@ -228,7 +228,7 @@ extract_sch5545ec() # https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988 extract_tbfw() { - chkvars TBFW_size && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin" + chkvars TBFW_size; fe_ copy_tbfw find "$appdir" -type f -name "TBT.bin" } copy_tbfw() @@ -344,7 +344,7 @@ patch_release_roms() done if readkconfig; then - fe_ prep_rom "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + fe_ preprom find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" [ "$nukemode" != "nuke" ] || \ printf "Make sure you inserted vendor files: %s\n" \ "$vguide" > "$tmpromdir/README.md" || : @@ -378,7 +378,7 @@ patch_release_roms() "$archive" || err "'$archive' -> Can't overwrite - $dontflash"; : } -prep_rom() +preprom() { _xrom="$1" _xromname="${1##*/}" @@ -492,7 +492,7 @@ modify_mac() [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ x_ "$nvm" "$xbmklocal/gbe" setmac "$new_mac" - fe_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + fe_ newmac find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" printf "\nGbE NVM written to '%s':\n" "$archive" x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || : diff --git a/include/lib.sh b/include/lib.sh index a125181b..f20b17e9 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -140,7 +140,8 @@ chkvars() # e.g. coreboot is multi-tree, so 1 singletree() { - ( fx_ "exit 1" "config/$1/"*/ -type f -name "target.cfg" ) || return 1 + ( fx_ "exit 1" find "config/$1/"*/ -type f -name "target.cfg" ) || \ + return 1 } fe_() @@ -158,7 +159,7 @@ find_ex() xmsg="$1" && shift 1 fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" xx="$1" && shift 1 - $xmsg find "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || \ + $xmsg "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || \ err "!find $(echo "$@") > \"$fd\"" dx_ "$xx" "$fd" || break x_ rm -f "$fd" diff --git a/include/rom.sh b/include/rom.sh index 0eebdabb..09270829 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -192,7 +192,7 @@ mkseagrub() [ "$payload_grubsea" = "y" ] && pname="grub" [ "$payload_grubsea" = "y" ] || \ cbfs "$tmprom" "$grubdata/bootorder" bootorder raw - fe_ "cprom" "$grubdata/keymap" -type f -name "*.gkb" + fe_ cprom find "$grubdata/keymap" -type f -name "*.gkb" } add_uboot() diff --git a/mk b/mk index a438d653..61d5d694 100755 --- a/mk +++ b/mk @@ -279,7 +279,7 @@ check_project_hashes() [ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \ read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree" - fx_ "x_ sha512sum" "$datadir" "$configdir/$tree" "$mdir" \ + fx_ "x_ sha512sum" find "$datadir" "$configdir/$tree" "$mdir" \ -type f -not -path "*/.git*/*" | awk '{print $1}' > \ "$xbmktmp/project.hash" || err "!h $project $tree" @@ -371,7 +371,7 @@ check_defconfig() elfcheck() { # TODO: *STILL* very hacky check. do it properly (based on build.list) - ( fx_ "exit 1" "$dest_dir" -type f ) || return 1; : + ( fx_ "exit 1" find "$dest_dir" -type f ) || return 1; : } handle_makefile() From d2e6f989d7ef1250bedac1ad5c93e8f6220a5fd0 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 13:44:05 +0100 Subject: [PATCH 093/267] rom.sh: build serprog images with fe_ Signed-off-by: Leah Rowe --- include/rom.sh | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/include/rom.sh b/include/rom.sh index 09270829..182282b1 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -9,22 +9,19 @@ grubdata="config/data/grub" mkserprog() { - [ "$_f" = "-d" ] && return 0 # dry run - basename -as .h "$serdir/"*.h > "$xbmktmp/ser" || \ - err "!mk $1 $xbmktmp" + $dry fe_ "eval buildser \"$1\"" basename -as .h "$serdir/"*.h + [ "$XBMK_RELEASE" = "y" ] && $dry mkrom_tarball "bin/serprog_$1"; : +} - while read -r sertarget; do - [ "$1" = "pico" ] && 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 < "$xbmktmp/ser" - - [ "$XBMK_RELEASE" = "y" ] && mkrom_tarball "bin/serprog_$1"; : +buildser() +{ + [ "$1" = "pico" ] && x_ cmake -DPICO_BOARD="$2" \ + -DPICO_SDK_PATH="$picosdk" -B "$sersrc/build" "$sersrc" && \ + x_ cmake --build "$sersrc/build" + [ "$1" = "stm32" ] && x_ make -C "$sersrc" libopencm3-just-make \ + BOARD=$2 && x_ make -C "$sersrc" BOARD=$2 + x_ mkdir -p "bin/serprog_$1" + x_ mv "$serx" "bin/serprog_$1/serprog_$2.${serx##*.}" } copyps1bios() From 0ef77e65832e1ebf75a4fbfde977a55b7251d5c0 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 14:01:50 +0100 Subject: [PATCH 094/267] build serprog using fe_ *defined inside mkhelper* sh macros ftw Signed-off-by: Leah Rowe --- config/data/pico-serprog/mkhelper.cfg | 2 +- config/data/stm32-vserprog/mkhelper.cfg | 2 +- include/rom.sh | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/config/data/pico-serprog/mkhelper.cfg b/config/data/pico-serprog/mkhelper.cfg index 8e902bda..de3f6aa5 100644 --- a/config/data/pico-serprog/mkhelper.cfg +++ b/config/data/pico-serprog/mkhelper.cfg @@ -4,4 +4,4 @@ sersrc="src/pico-serprog" serx="$sersrc/build/pico_serprog.uf2" picosdk="src/pico-sdk" serdir="$picosdk/src/boards/include/boards" -premake="mkserprog pico" +premake="$dry eval fe_ \"buildser pico\" basename -as .h \"\$serdir/\"*.h" diff --git a/config/data/stm32-vserprog/mkhelper.cfg b/config/data/stm32-vserprog/mkhelper.cfg index 907e890f..344dde81 100644 --- a/config/data/stm32-vserprog/mkhelper.cfg +++ b/config/data/stm32-vserprog/mkhelper.cfg @@ -3,4 +3,4 @@ sersrc="src/stm32-vserprog" serx="$sersrc/stm32-vserprog.hex" serdir="$sersrc/boards" -mkhelper="mkserprog stm32" +mkhelper="$dry eval fe_ \"buildser stm32\" basename -as .h \"\$serdir/\"*.h" diff --git a/include/rom.sh b/include/rom.sh index 182282b1..cb3c1298 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -7,12 +7,6 @@ grubdata="config/data/grub" -mkserprog() -{ - $dry fe_ "eval buildser \"$1\"" basename -as .h "$serdir/"*.h - [ "$XBMK_RELEASE" = "y" ] && $dry mkrom_tarball "bin/serprog_$1"; : -} - buildser() { [ "$1" = "pico" ] && x_ cmake -DPICO_BOARD="$2" \ From 1390f7f800767dcba394ebbc4f7996508940639e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 14:19:15 +0100 Subject: [PATCH 095/267] mk: Create serprog tarballs here instead i simplified rom.sh to use mkhelper for actual image building. Signed-off-by: Leah Rowe --- mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mk b/mk index 61d5d694..06e73ddc 100755 --- a/mk +++ b/mk @@ -87,6 +87,8 @@ build_release() cd "$srcdir" || err "$vdir: 2 !cd \"$srcdir\"" x_ ./mk -d coreboot mk -b coreboot pico-serprog stm32-vserprog pcsx-redux + + fe_ mkrom_tarball find bin -maxdepth 1 -type d -name "serprog_*" x_ mv bin ../roms ) || err "can't build rom images" From ec5c954337b2e1ea50b0ace0f1086e48f20e7774 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 15:12:10 +0100 Subject: [PATCH 096/267] lib.sh: Simplified fx_() and removed fe_() Instead of calling fe_, prefix x_ as indicated. Signed-off-by: Leah Rowe --- config/data/pico-serprog/mkhelper.cfg | 2 +- config/data/stm32-vserprog/mkhelper.cfg | 2 +- include/inject.sh | 14 ++++++++------ include/lib.sh | 14 +------------- include/rom.sh | 2 +- mk | 2 +- 6 files changed, 13 insertions(+), 23 deletions(-) diff --git a/config/data/pico-serprog/mkhelper.cfg b/config/data/pico-serprog/mkhelper.cfg index de3f6aa5..982c365b 100644 --- a/config/data/pico-serprog/mkhelper.cfg +++ b/config/data/pico-serprog/mkhelper.cfg @@ -4,4 +4,4 @@ sersrc="src/pico-serprog" serx="$sersrc/build/pico_serprog.uf2" picosdk="src/pico-sdk" serdir="$picosdk/src/boards/include/boards" -premake="$dry eval fe_ \"buildser pico\" basename -as .h \"\$serdir/\"*.h" +premake="$dry eval fx_ \"buildser pico\" x_ basename -as .h \"\$serdir/\"*.h" diff --git a/config/data/stm32-vserprog/mkhelper.cfg b/config/data/stm32-vserprog/mkhelper.cfg index 344dde81..bb2189a6 100644 --- a/config/data/stm32-vserprog/mkhelper.cfg +++ b/config/data/stm32-vserprog/mkhelper.cfg @@ -3,4 +3,4 @@ sersrc="src/stm32-vserprog" serx="$sersrc/stm32-vserprog.hex" serdir="$sersrc/boards" -mkhelper="$dry eval fe_ \"buildser stm32\" basename -as .h \"\$serdir/\"*.h" +mkhelper="$dry eval fx_ \"buildser stm32\" x_ basename -as .h \"\$serdir/\"*.h" diff --git a/include/inject.sh b/include/inject.sh index f1e29fd6..dc4868ed 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -49,7 +49,7 @@ download() readkconfig() { x_ rm -f "$xbmktmp/cbcfg" - fe_ scankconfig find "$boarddir/config" -type f + fx_ scankconfig x_ find "$boarddir/config" -type f eval "`setcfg "$xbmktmp/cbcfg" 1`" @@ -148,7 +148,7 @@ extract_intel_me() chkvars ME11delta ME11version ME11sku ME11pch [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard - set +u +e && fe_ find_me find "$xbmkpwd/$appdir" -type f + set +u +e && fx_ find_me x_ find "$xbmkpwd/$appdir" -type f [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 ( x_ cd src/deguard/ @@ -169,7 +169,7 @@ find_me() "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 - fe_ find_me find "$_7ztest" -type f || return 1; : + fx_ find_me x_ find "$_7ztest" -type f || return 1; : } extract_archive() @@ -228,7 +228,8 @@ extract_sch5545ec() # https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988 extract_tbfw() { - chkvars TBFW_size; fe_ copy_tbfw find "$appdir" -type f -name "TBT.bin" + chkvars TBFW_size + fx_ copy_tbfw x_ find "$appdir" -type f -name "TBT.bin" } copy_tbfw() @@ -344,7 +345,8 @@ patch_release_roms() done if readkconfig; then - fe_ preprom find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + fx_ preprom x_ find "$tmpromdir" -maxdepth 1 -type f \ + -name "*.rom" [ "$nukemode" != "nuke" ] || \ printf "Make sure you inserted vendor files: %s\n" \ "$vguide" > "$tmpromdir/README.md" || : @@ -492,7 +494,7 @@ modify_mac() [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ x_ "$nvm" "$xbmklocal/gbe" setmac "$new_mac" - fe_ newmac find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" printf "\nGbE NVM written to '%s':\n" "$archive" x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || : diff --git a/include/lib.sh b/include/lib.sh index f20b17e9..274daf69 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -144,23 +144,11 @@ singletree() return 1 } -fe_() -{ - find_ex "x_" "$@" -} - fx_() { - find_ex "" "$@" -} - -find_ex() -{ - xmsg="$1" && shift 1 fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" xx="$1" && shift 1 - $xmsg "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || \ - err "!find $(echo "$@") > \"$fd\"" + "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || err "FATAL: !sort fx_" dx_ "$xx" "$fd" || break x_ rm -f "$fd" } diff --git a/include/rom.sh b/include/rom.sh index cb3c1298..fdd0787f 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -183,7 +183,7 @@ mkseagrub() [ "$payload_grubsea" = "y" ] && pname="grub" [ "$payload_grubsea" = "y" ] || \ cbfs "$tmprom" "$grubdata/bootorder" bootorder raw - fe_ cprom find "$grubdata/keymap" -type f -name "*.gkb" + fx_ cprom x_ find "$grubdata/keymap" -type f -name "*.gkb" } add_uboot() diff --git a/mk b/mk index 06e73ddc..0c156523 100755 --- a/mk +++ b/mk @@ -88,7 +88,7 @@ build_release() x_ ./mk -d coreboot mk -b coreboot pico-serprog stm32-vserprog pcsx-redux - fe_ mkrom_tarball find bin -maxdepth 1 -type d -name "serprog_*" + fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*" x_ mv bin ../roms ) || err "can't build rom images" From 394b4ea7a59e4392d39c6e8154b21ae91b26492e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 15:17:45 +0100 Subject: [PATCH 097/267] inject.sh: rename copytb and preprom functions make them shorter so they go on one line again Signed-off-by: Leah Rowe --- include/inject.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index dc4868ed..fe52e986 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -228,11 +228,10 @@ extract_sch5545ec() # https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988 extract_tbfw() { - chkvars TBFW_size - fx_ copy_tbfw x_ find "$appdir" -type f -name "TBT.bin" + chkvars TBFW_size; fx_ copytb x_ find "$appdir" -type f -name "TBT.bin" } -copy_tbfw() +copytb() { [ -f "$1" ] && [ ! -L "$1" ] && x_ dd if=/dev/null of="$1" bs=1 \ seek=$TBFW_size && x_ mv "$1" "$_dest" && return 1; : @@ -345,8 +344,7 @@ patch_release_roms() done if readkconfig; then - fx_ preprom x_ find "$tmpromdir" -maxdepth 1 -type f \ - -name "*.rom" + fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" [ "$nukemode" != "nuke" ] || \ printf "Make sure you inserted vendor files: %s\n" \ "$vguide" > "$tmpromdir/README.md" || : @@ -380,7 +378,7 @@ patch_release_roms() "$archive" || err "'$archive' -> Can't overwrite - $dontflash"; : } -preprom() +prep() { _xrom="$1" _xromname="${1##*/}" From 7f71328f0e214db25f5dcccea0dab32ea834fb13 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 16:23:12 +0100 Subject: [PATCH 098/267] lib.sh: Remove useless command in err() We don't need this, since we're exiting anyway. Signed-off-by: Leah Rowe --- include/lib.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/lib.sh b/include/lib.sh index 274daf69..950a07c8 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -168,7 +168,6 @@ x_() err() { - set -u -e [ $# -lt 1 ] || printf "ERROR %s: %s\n" "$0" "$1" 1>&2 || : exit 1 } From d530e68594d39076831d7a232ea17c8b42d73b4f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 16:53:57 +0100 Subject: [PATCH 099/267] inject.sh: Simplify patch_release_roms() Signed-off-by: Leah Rowe --- include/inject.sh | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index fe52e986..7bcd5bc7 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -13,7 +13,6 @@ cbcfgsdir="config/coreboot" hashfiles="vendorhashes blobhashes" # blobhashes for backwards compatibility dontflash="!!! AN ERROR OCCURED! Please DO NOT flash if injection failed. !!!" vfix="DO_NOT_FLASH_YET._FIRST,_INJECT_FILES_VIA_INSTRUCTIONS_ON_LIBREBOOT.ORG_" -vguide="https://libreboot.org/docs/install/ivy_has_common.html" tmpromdel="$xbmklocal/DO_NOT_FLASH" nvm="util/nvmutil/nvm" ifdtool="elf/ifdtool/default/ifdtool" @@ -338,23 +337,14 @@ patch_release_roms() x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}" for _hashes in $hashfiles; do - [ "$need_files" = "y" ] || break - e "$tmpromdir/$_hashes" f && has_hashes="y" && \ - hashfile="$_hashes" && break; : + [ "$need_files" = "y" ] && e "$tmpromdir/$_hashes" f && \ + has_hashes="y" && hashfile="$_hashes" && break; : done - if readkconfig; then - fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" - [ "$nukemode" != "nuke" ] || \ - printf "Make sure you inserted vendor files: %s\n" \ - "$vguide" > "$tmpromdir/README.md" || : - else - printf "Skipping vendorfiles on '%s'\n" "$archive" 1>&2 - need_files="n" - fi + readkconfig || exit 0; [ "$need_files" = "n" ] || \ + fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" ( - [ "$need_files" = "y" ] || exit 0 cd "$tmpromdir" || err "patch '$archive': can't cd $tmpromdir" # NOTE: For compatibility with older rom releases, defer to sha1 if [ "$has_hashes" = "y" ] && [ "$nukemode" != "nuke" ]; then From e3098c61f43575650628fc4e6f7e1693c44ac337 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 17:00:41 +0100 Subject: [PATCH 100/267] inject.sh: simplified MAC address handling Signed-off-by: Leah Rowe --- include/inject.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 7bcd5bc7..e64c304e 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -354,7 +354,7 @@ patch_release_roms() fi ) || err "'$archive' -> Can't verify vendor hashes. $dontflash" - [ -z "$new_mac" ] || modify_mac || printf "\nGbE not defined\n" 1>&2 + [ -z "$new_mac" ] || [ -z "$CONFIG_GBE_BIN_PATH" ] || modify_mac [ "$xchanged" = "y" ] || rm -Rf "$tmpromdel" || : [ "$xchanged" = "y" ] || return 0 @@ -476,16 +476,11 @@ insert() modify_mac() { - [ -n "$CONFIG_GBE_BIN_PATH" ] || return 1 - x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbmklocal/gbe" [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ x_ "$nvm" "$xbmklocal/gbe" setmac "$new_mac" fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" - - printf "\nGbE NVM written to '%s':\n" "$archive" - x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || : } newmac() From a94bd3c0939fac05a902af2cce2cf862ecdf9200 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 17:08:42 +0100 Subject: [PATCH 101/267] inject.sh: simplify extract_kbc1126ec() Signed-off-by: Leah Rowe --- include/inject.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index e64c304e..c0b4409f 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -150,7 +150,8 @@ extract_intel_me() set +u +e && fx_ find_me x_ find "$xbmkpwd/$appdir" -type f [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 - ( x_ cd src/deguard/ + ( + x_ cd src/deguard/ x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ "$ME11version" --pch "$ME11pch" --sku "$ME11sku" \ --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_me" @@ -181,15 +182,11 @@ extract_archive() extract_kbc1126ec() { - x_ e "$kbc1126_ec_dump" f ( x_ cd "$appdir/" - mv Rompaq/68*.BIN ec.bin || : - if [ ! -f "ec.bin" ]; then - unar -D ROM.CAB Rom.bin || unar -D Rom.CAB Rom.bin || \ - unar -D 68*.CAB Rom.bin || err "kbc1126 unar failed" - x_ mv Rom.bin ec.bin - fi + mv Rompaq/68*.BIN ec.bin || unar -D ROM.CAB Rom.bin || unar -D \ + Rom.CAB Rom.bin || unar -D 68*.CAB Rom.bin || err "!kbc1126 unar" + [ -f "ec.bin" ] || x_ mv Rom.bin ec.bin x_ e ec.bin f && x_ "$kbc1126_ec_dump" ec.bin ) || err "$board: can't extract kbc1126 ec firmware - $dontflash" From cba04aa74b816cbd5f1266a73962f6dd48ee2892 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 19:00:13 +0100 Subject: [PATCH 102/267] init.sh: Use readlink in pybin() Use realpath only as a fallback. Signed-off-by: Leah Rowe --- include/init.sh | 3 +-- include/lib.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/init.sh b/include/init.sh index 1be860ea..5032d734 100644 --- a/include/init.sh +++ b/include/init.sh @@ -80,8 +80,7 @@ pybin() # ideally, don't rely on PATH or hardcoded paths if python venv. # use the *real*, direct executable linked to by the venv symlink if [ $venv -gt 0 ] && [ -L "`command -v "$1" 2>/dev/null`" ]; then - # realpath isn't posix, but available mostly universally - pypath="$(realpath \ + pypath="$(findpath \ "$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)" [ -e "$pypath" ] && [ ! -d "$pypath" ] && \ [ -x "$pypath" ] && printf "%s\n" "$pypath" && return 0; : diff --git a/include/lib.sh b/include/lib.sh index 950a07c8..99e59a1a 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -144,6 +144,18 @@ singletree() return 1 } +findpath() +{ + [ $# -gt 0 ] || err "findpath: No arguments provided" + while [ $# -gt 0 ]; do + found="`readlink -f "$1" 2>/dev/null`" || return 1; : + [ -n "$found" ] || found="`realpath "$1" 2>/dev/null`" || \ + return 1; : + printf "%s\n" "$found" + shift 1 + done +} + fx_() { fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd" From 40a944118f2af08ab37719c07cf7e826267a0eef Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 19:03:51 +0100 Subject: [PATCH 103/267] init.sh: run set_version before set_env Signed-off-by: Leah Rowe --- include/init.sh | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/include/init.sh b/include/init.sh index 5032d734..6ccdf13f 100644 --- a/include/init.sh +++ b/include/init.sh @@ -31,7 +31,7 @@ xbmk_init() id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || err "this command as root is not permitted" - for init_cmd in set_pyver set_env set_version git_init create_tmpdir \ + for init_cmd in set_pyver set_version set_env git_init create_tmpdir \ lock create_pathdirs child_exec; do xbmk_$init_cmd "$@" || break done @@ -97,26 +97,6 @@ pybin() command -v "$1" 2>/dev/null || return 1 } -xbmk_set_env() -{ - # XBMK_CACHE is a directory, for caching downloads and git repon - [ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache" - [ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" - [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ - err "cachedir '$xbmkpwd/cache' is a symlink" - [ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" - [ -f "$XBMK_CACHE" ] && err "cachedir '$XBMK_CACHE' is a file"; : - - # if "y": a coreboot target won't be built if target.cfg says release="n" - # (this is used to exclude certain build targets from releases) - [ -z "${XBMK_RELEASE+x}" ] && export XBMK_RELEASE="n" - [ "$XBMK_RELEASE" = "y" ] || export XBMK_RELEASE="n" - - [ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1 - expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \ - 1>/dev/null 2>/dev/null || export XBMK_THREADS=1; : -} - xbmk_set_version() { [ ! -f ".version" ] || read -r version < ".version" || :; : @@ -142,6 +122,26 @@ xbmk_set_version() export LOCALVERSION="-$projectname-${version%%-*}" } +xbmk_set_env() +{ + # XBMK_CACHE is a directory, for caching downloads and git repon + [ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache" + [ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" + [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ + err "cachedir '$xbmkpwd/cache' is a symlink" + [ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" + [ -f "$XBMK_CACHE" ] && err "cachedir '$XBMK_CACHE' is a file"; : + + # if "y": a coreboot target won't be built if target.cfg says release="n" + # (this is used to exclude certain build targets from releases) + [ -z "${XBMK_RELEASE+x}" ] && export XBMK_RELEASE="n" + [ "$XBMK_RELEASE" = "y" ] || export XBMK_RELEASE="n" + + [ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1 + expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \ + 1>/dev/null 2>/dev/null || export XBMK_THREADS=1; : +} + xbmk_git_init() { for gitarg in "--global user.name" "--global user.email"; do From e1628ad8f3e63428888b42d0c49c3fe6b3c9d006 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 19:04:52 +0100 Subject: [PATCH 104/267] init.sh: export LOCALVERSION in set_env Don't do it in set_version Signed-off-by: Leah Rowe --- include/init.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/init.sh b/include/init.sh index 6ccdf13f..1bf52eef 100644 --- a/include/init.sh +++ b/include/init.sh @@ -119,11 +119,12 @@ xbmk_set_version() printf "%s\n" "$versiondate" > ".versiondate" || err "can't save date" relname="$projectname-$version" - export LOCALVERSION="-$projectname-${version%%-*}" } xbmk_set_env() { + export LOCALVERSION="-$projectname-${version%%-*}" + # XBMK_CACHE is a directory, for caching downloads and git repon [ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache" [ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" From e1af1055ed11b25df42c8a7a32c250da346b08b7 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 19:09:29 +0100 Subject: [PATCH 105/267] init.sh: check XBMK_CACHE is a directory instead it doesn't matter if it's not a file. that's the wrong check. Signed-off-by: Leah Rowe --- include/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/init.sh b/include/init.sh index 1bf52eef..1a01de45 100644 --- a/include/init.sh +++ b/include/init.sh @@ -131,7 +131,7 @@ xbmk_set_env() [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ err "cachedir '$xbmkpwd/cache' is a symlink" [ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" - [ -f "$XBMK_CACHE" ] && err "cachedir '$XBMK_CACHE' is a file"; : + [ -d "$XBMK_CACHE" ] || err "cachedir '$XBMK_CACHE' is a file"; : # if "y": a coreboot target won't be built if target.cfg says release="n" # (this is used to exclude certain build targets from releases) From 570f1417a80224cf73a57febf126bd80e908b32e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 19:12:51 +0100 Subject: [PATCH 106/267] init.sh: Resolve XBMK_CACHE via readlink Signed-off-by: Leah Rowe --- include/init.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/init.sh b/include/init.sh index 1a01de45..a322370b 100644 --- a/include/init.sh +++ b/include/init.sh @@ -131,6 +131,9 @@ xbmk_set_env() [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ err "cachedir '$xbmkpwd/cache' is a symlink" [ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" + xbmkcache="`findpath "$XBMK_CACHE"`" || \ + err "Can't resolve cachedir: '$XBMK_CACHE'" + export XBMK_CACHE="$xbmkcache" [ -d "$XBMK_CACHE" ] || err "cachedir '$XBMK_CACHE' is a file"; : # if "y": a coreboot target won't be built if target.cfg says release="n" From 1b0afdcea226ebc4e5f46c50fc21aa835b52ada9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 19:23:32 +0100 Subject: [PATCH 107/267] init.sh: also allow XBMK_RELEASE=Y or N as opposed to =n or =y Signed-off-by: Leah Rowe --- include/init.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/init.sh b/include/init.sh index a322370b..e5e3f564 100644 --- a/include/init.sh +++ b/include/init.sh @@ -139,6 +139,8 @@ xbmk_set_env() # if "y": a coreboot target won't be built if target.cfg says release="n" # (this is used to exclude certain build targets from releases) [ -z "${XBMK_RELEASE+x}" ] && export XBMK_RELEASE="n" + [ "$XBMK_RELEASE" = "N" ] && export XBMK_RELEASE="n" + [ "$XBMK_RELEASE" = "Y" ] && export XBMK_RELEASE="y" [ "$XBMK_RELEASE" = "y" ] || export XBMK_RELEASE="n" [ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1 From 2cea8517f3b6c7f72cdecbcd3e6745db29284852 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 7 May 2025 21:16:50 +0100 Subject: [PATCH 108/267] init.sh: remove useless export we already reset to n if not y, afterward just rely on that Signed-off-by: Leah Rowe --- include/init.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/init.sh b/include/init.sh index e5e3f564..d2db0236 100644 --- a/include/init.sh +++ b/include/init.sh @@ -139,7 +139,6 @@ xbmk_set_env() # if "y": a coreboot target won't be built if target.cfg says release="n" # (this is used to exclude certain build targets from releases) [ -z "${XBMK_RELEASE+x}" ] && export XBMK_RELEASE="n" - [ "$XBMK_RELEASE" = "N" ] && export XBMK_RELEASE="n" [ "$XBMK_RELEASE" = "Y" ] && export XBMK_RELEASE="y" [ "$XBMK_RELEASE" = "y" ] || export XBMK_RELEASE="n" From e084b06dc767af37870b05139598b56a41872d1f Mon Sep 17 00:00:00 2001 From: cqst Date: Thu, 8 May 2025 02:28:14 -0700 Subject: [PATCH 109/267] fix trying to boot all logical volumes after unlocking an encrypted volume --- config/grub/default/config/payload | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/grub/default/config/payload b/config/grub/default/config/payload index 3f134f1d..3d84413e 100644 --- a/config/grub/default/config/payload +++ b/config/grub/default/config/payload @@ -184,7 +184,7 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o # using * is slow on some machines, but we use it here, # just once. in so doing, we find every lvm volume for vol in (*); do - if regexp ^lvm/ $vol; then + if regexp ^\\(lvm/ $vol; then lvmvol="${lvmvol} ${vol}" try_bootcfg "${vol}" fi From fe926052441151722886edb5693a961342b3aa9e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 11:12:34 +0100 Subject: [PATCH 110/267] also fix the other grub trees Signed-off-by: Leah Rowe --- config/grub/nvme/config/payload | 2 +- config/grub/xhci/config/payload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/grub/nvme/config/payload b/config/grub/nvme/config/payload index 22dd8fe1..4f3de36e 100644 --- a/config/grub/nvme/config/payload +++ b/config/grub/nvme/config/payload @@ -196,7 +196,7 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o # using * is slow on some machines, but we use it here, # just once. in so doing, we find every lvm volume for vol in (*); do - if regexp ^lvm/ $vol; then + if regexp ^\\(lvm/ $vol; then lvmvol="${lvmvol} ${vol}" try_bootcfg "${vol}" fi diff --git a/config/grub/xhci/config/payload b/config/grub/xhci/config/payload index d1f81fd3..9db22fe2 100644 --- a/config/grub/xhci/config/payload +++ b/config/grub/xhci/config/payload @@ -197,7 +197,7 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o # using * is slow on some machines, but we use it here, # just once. in so doing, we find every lvm volume for vol in (*); do - if regexp ^lvm/ $vol; then + if regexp ^\\(lvm/ $vol; then lvmvol="${lvmvol} ${vol}" try_bootcfg "${vol}" fi From 021e7615c84ddf91edcd13a6385fe1bd6ca51ebb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 20:27:42 +0100 Subject: [PATCH 111/267] HP 820 G2: Use fam15h cbfstool tree for refcode We used cbfstool from coreboot 4.13, because it was the last version to work with the particular format used for stage files, before the CBFS standard changed in newer releases of cbfstool. When I added this board to Libreboot, it was source-only at first so it didn't matter. I didn't want to do a standalone cbfstool binary, in case some people decided to use that one on newer boards, which would cause all sorts of issues. So I bodged it and just included an import of coreboot 4.13. Well, the cbfstool from coreboot 4.11, as used for FAM15H AMD boards, is compatible. I checked the code diff between the two, and there is no meaningful difference. I've tested this, and it works, since the last release or two now includes 820 G2 images, so I was able to use those with ./mk inject, to verify whether the refcode file is still grabbed properly. We need the refcode to handle MRC on Broadwell platform, but we extract it from an old Google Chromebook image, that uses the old CBFS stage file layout. This change solves my problem: the problem was that releases are bloated further, due to including this extra coreboot version. This should reduce the size of the next release considerably, especially after decompressing the tarball. Signed-off-by: Leah Rowe --- ...ake-use-of-spurious-null-termination.patch | 56 ------ ...-build-error-on-GCC-15-host-compiler.patch | 33 ---- config/coreboot/coreboot413/target.cfg | 4 - .../coreboot/coreboot413/module.list | 1 - .../coreboot/coreboot413/vboot/module.cfg | 5 - ...c-Fix-the-bounds-check-on-vmlinuz_he.patch | 178 ------------------ config/vendor/hp820g2/pkg.cfg | 2 +- 7 files changed, 1 insertion(+), 278 deletions(-) delete mode 100644 config/coreboot/coreboot413/patches/0001-cbfstool-Make-use-of-spurious-null-termination.patch delete mode 100644 config/coreboot/coreboot413/patches/0002-Fix-cbfstool-build-error-on-GCC-15-host-compiler.patch delete mode 100644 config/coreboot/coreboot413/target.cfg delete mode 100644 config/submodule/coreboot/coreboot413/module.list delete mode 100644 config/submodule/coreboot/coreboot413/vboot/module.cfg delete mode 100644 config/submodule/coreboot/coreboot413/vboot/patches/0001-extract_vmlinuz.c-Fix-the-bounds-check-on-vmlinuz_he.patch diff --git a/config/coreboot/coreboot413/patches/0001-cbfstool-Make-use-of-spurious-null-termination.patch b/config/coreboot/coreboot413/patches/0001-cbfstool-Make-use-of-spurious-null-termination.patch deleted file mode 100644 index dfc684e1..00000000 --- a/config/coreboot/coreboot413/patches/0001-cbfstool-Make-use-of-spurious-null-termination.patch +++ /dev/null @@ -1,56 +0,0 @@ -From f22f408956bf02609a96b7d72fb3321da159bfc6 Mon Sep 17 00:00:00 2001 -From: Nico Huber -Date: Tue, 22 Jun 2021 13:49:44 +0000 -Subject: [PATCH 1/1] cbfstool: Make use of spurious null-termination - -The null-termination of `filetypes` was added after the code was -written, obviously resulting in NULL dereferences. As some more -code has grown around the termination, it's hard to revert the -regression, so let's update the code that still used the array -length. - -This fixes commit 7f5f9331d1 (util/cbfstool: fix buffer over-read) -which actually did fix something, but only one path while it broke -two others. We should be careful with fixes, they can always break -something else. Especially when a dumb tool triggered the patching -it seems likely that fewer people looked into related code. - -Change-Id: If2ece1f5ad62952ed2e57769702e318ba5468f0c -Signed-off-by: Nico Huber -Reviewed-on: https://review.coreboot.org/c/coreboot/+/55763 -Tested-by: build bot (Jenkins) -Reviewed-by: Julius Werner ---- - util/cbfstool/common.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c -index e2ed38ffc4..539d0baccf 100644 ---- a/util/cbfstool/common.c -+++ b/util/cbfstool/common.c -@@ -168,10 +168,10 @@ void print_supported_architectures(void) - - void print_supported_filetypes(void) - { -- int i, number = ARRAY_SIZE(filetypes); -+ int i; - -- for (i=0; i -Date: Tue, 29 Apr 2025 17:31:13 +0300 -Subject: [PATCH 1/1] Fix cbfstool build error on GCC 15 host compiler - -GCC 15 now considers the unterminated-string-initialization warning as -part of -Werror by default. Coreboot compiles host utilities with the -system compiler, which results in getting this error in some files. - -Mark a hexadecimal translation table in cbfstool code as "nonstring" to -avoid the warning-turned-error. - -Signed-off-by: Alper Nebi Yasak ---- - util/cbfstool/common.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c -index 539d0baccf..f6fe647503 100644 ---- a/util/cbfstool/common.c -+++ b/util/cbfstool/common.c -@@ -188,7 +188,7 @@ uint64_t intfiletype(const char *name) - - char *bintohex(uint8_t *data, size_t len) - { -- static const char translate[16] = "0123456789abcdef"; -+ static const char translate[16] __attribute__((__nonstring__)) = "0123456789abcdef"; - - char *result = malloc(len * 2 + 1); - if (result == NULL) --- -2.39.5 - diff --git a/config/coreboot/coreboot413/target.cfg b/config/coreboot/coreboot413/target.cfg deleted file mode 100644 index a0aae341..00000000 --- a/config/coreboot/coreboot413/target.cfg +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later - -tree="coreboot413" -rev="5c186c6777c9438ff4681929c9c25c98dee28bef" diff --git a/config/submodule/coreboot/coreboot413/module.list b/config/submodule/coreboot/coreboot413/module.list deleted file mode 100644 index 08e76de0..00000000 --- a/config/submodule/coreboot/coreboot413/module.list +++ /dev/null @@ -1 +0,0 @@ -3rdparty/vboot diff --git a/config/submodule/coreboot/coreboot413/vboot/module.cfg b/config/submodule/coreboot/coreboot413/vboot/module.cfg deleted file mode 100644 index 79c98870..00000000 --- a/config/submodule/coreboot/coreboot413/vboot/module.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later - -subrepo="https://review.coreboot.org/vboot.git" -subrepo_bkup="https://github.com/coreboot/vboot" -subhash="4c523ed10f25de872ac0513ebd6ca53d3970b9de" diff --git a/config/submodule/coreboot/coreboot413/vboot/patches/0001-extract_vmlinuz.c-Fix-the-bounds-check-on-vmlinuz_he.patch b/config/submodule/coreboot/coreboot413/vboot/patches/0001-extract_vmlinuz.c-Fix-the-bounds-check-on-vmlinuz_he.patch deleted file mode 100644 index 1ac41de6..00000000 --- a/config/submodule/coreboot/coreboot413/vboot/patches/0001-extract_vmlinuz.c-Fix-the-bounds-check-on-vmlinuz_he.patch +++ /dev/null @@ -1,178 +0,0 @@ -From 195f61375aeec9eec16604ec59f6eda2e6058cc1 Mon Sep 17 00:00:00 2001 -From: "Luke T. Shumaker" -Date: Thu, 30 May 2024 14:08:33 -0600 -Subject: [PATCH 1/1] extract_vmlinuz.c: Fix the bounds check on - vmlinuz_header_{offset,size} - -The check on vmlinuz_header_offset and vmlinuz_header_size is obviously -wrong: - - if (!vmlinuz_header_size || - kpart_data + vmlinuz_header_offset + vmlinuz_header_size > - kpart_data) { - return 1; - } - -`kpart_data + some_unsigned_values` can obviously never be `> kpart_data`, -unless something has overflowed! And `vmlinuz_header_offset` hasn't even -been set yet (besides being initialized to zero)! - -GCC will deduce that if the check didn't cause the function to bail, then -vmlinuz_header_size (a uint32_t) must be "negative"; that is: in the range -[2GiB,4GiB). - -On platforms where size_t is 32-bits, this is *especially* broken. -memcpy's size argument must be in the range [0,2GiB). Because GCC has -proved that vmlinuz_header_size is higher than that, it will fail to -compile: - - host/lib/extract_vmlinuz.c:67:9: error: 'memcpy' specified bound between 2147483648 and 4294967295 exceeds maximum object size 2147483647 [-Werror=stringop-overflow=] - -So, fix the check. - -I can now say that what I suspect the original author meant to write would -be the following patch, if `vmlinuz_header_offset` were already set: - - -kpart_data + vmlinuz_header_offset + vmlinuz_header_size > kpart_data - +now + vmlinuz_header_offset + vmlinuz_header_size > kpart_size - -This hypothesis is supported by `now` not getting incremented by -`kblob_size` the way it is for the keyblock and preamble sizes. - -However, we can also see that even this "corrected" bounds check is -insufficient: it does not detect the vmlinuz_header overflowing into -kblob_data. - -OK, so let's describe the fix: - -Have a `*vmlinuz_header` pointer instead of a -`uint64_t vmlinuz_header_offset`, to be more similar to all the other -regions. With this change, the correct check becomes a simple - - vmlinuz_header + vmlinuz_header_size > kblob_data - -While we're at it, make some changes that could have helped avoid this in -the first place: - - - Add comments. - - Calculate the vmlinuz_header offset right away, instead of waiting. - - Go ahead and increment `now` by `kblob_size`, to increase regularity. - -Change-Id: I5c03e49070b6dd2e04459566ef7dd129d27736e4 ---- - host/lib/extract_vmlinuz.c | 72 +++++++++++++++++++++++++++----------- - 1 file changed, 51 insertions(+), 21 deletions(-) - -diff --git a/host/lib/extract_vmlinuz.c b/host/lib/extract_vmlinuz.c -index 4ccfcf33..d2c09443 100644 ---- a/host/lib/extract_vmlinuz.c -+++ b/host/lib/extract_vmlinuz.c -@@ -15,16 +15,44 @@ - - int ExtractVmlinuz(void *kpart_data, size_t kpart_size, - void **vmlinuz_out, size_t *vmlinuz_size) { -+ // We're going to be extracting `vmlinuz_header` and -+ // `kblob_data`, and returning the concatenation of them. -+ // -+ // kpart_data = +-[kpart_size]------------------------------------+ -+ // | | -+ // keyblock = | +-[keyblock->keyblock_size]-------------------+ | -+ // | | struct vb2_keyblock keyblock | | -+ // | | char [] ...data... | | -+ // | +---------------------------------------------+ | -+ // | | -+ // preamble = | +-[preamble->preamble_size]-------------------+ | -+ // | | struct vb2_kernel_preamble preamble | | -+ // | | char [] ...data... | | -+ // | | char [] vmlinuz_header | | -+ // | | char [] ...data... | | -+ // | +---------------------------------------------+ | -+ // | | -+ // kblob_data= | +-[preamble->body_signature.data_size]--------+ | -+ // | | char [] ...data... | | -+ // | +---------------------------------------------+ | -+ // | | -+ // +-------------------------------------------------+ -+ - size_t now = 0; -+ // The 3 sections of kpart_data. -+ struct vb2_keyblock *keyblock = NULL; - struct vb2_kernel_preamble *preamble = NULL; - uint8_t *kblob_data = NULL; - uint32_t kblob_size = 0; -+ // vmlinuz_header -+ uint8_t *vmlinuz_header = NULL; - uint32_t vmlinuz_header_size = 0; -- uint64_t vmlinuz_header_address = 0; -- uint64_t vmlinuz_header_offset = 0; -+ // The concatenated result. - void *vmlinuz = NULL; - -- struct vb2_keyblock *keyblock = (struct vb2_keyblock *)kpart_data; -+ // Isolate the 3 sections of kpart_data. -+ -+ keyblock = (struct vb2_keyblock *)kpart_data; - now += keyblock->keyblock_size; - if (now > kpart_size) - return 1; -@@ -36,37 +64,39 @@ int ExtractVmlinuz(void *kpart_data, size_t kpart_size, - - kblob_data = kpart_data + now; - kblob_size = preamble->body_signature.data_size; -- -- if (!kblob_data || (now + kblob_size) > kpart_size) -+ now += kblob_size; -+ if (now > kpart_size) - return 1; - -+ // Find `vmlinuz_header` within `preamble`. -+ - if (preamble->header_version_minor > 0) { -- vmlinuz_header_address = preamble->vmlinuz_header_address; -+ // calculate the vmlinuz_header offset from -+ // the beginning of the kpart_data. The kblob doesn't -+ // include the body_load_offset, but does include -+ // the keyblock and preamble sections. -+ size_t vmlinuz_header_offset = -+ preamble->vmlinuz_header_address - -+ preamble->body_load_address + -+ keyblock->keyblock_size + -+ preamble->preamble_size; -+ -+ vmlinuz_header = kpart_data + vmlinuz_header_offset; - vmlinuz_header_size = preamble->vmlinuz_header_size; - } - -- if (!vmlinuz_header_size || -- kpart_data + vmlinuz_header_offset + vmlinuz_header_size > -- kpart_data) { -+ if (!vmlinuz_header || -+ !vmlinuz_header_size || -+ vmlinuz_header + vmlinuz_header_size > kblob_data) { - return 1; - } - -- // calculate the vmlinuz_header offset from -- // the beginning of the kpart_data. The kblob doesn't -- // include the body_load_offset, but does include -- // the keyblock and preamble sections. -- vmlinuz_header_offset = vmlinuz_header_address - -- preamble->body_load_address + -- keyblock->keyblock_size + -- preamble->preamble_size; -+ // Concatenate and return. - - vmlinuz = malloc(vmlinuz_header_size + kblob_size); - if (vmlinuz == NULL) - return 1; -- -- memcpy(vmlinuz, kpart_data + vmlinuz_header_offset, -- vmlinuz_header_size); -- -+ memcpy(vmlinuz, vmlinuz_header, vmlinuz_header_size); - memcpy(vmlinuz + vmlinuz_header_size, kblob_data, kblob_size); - - *vmlinuz_out = vmlinuz; --- -2.45.1 - diff --git a/config/vendor/hp820g2/pkg.cfg b/config/vendor/hp820g2/pkg.cfg index 89303ad3..308148c5 100644 --- a/config/vendor/hp820g2/pkg.cfg +++ b/config/vendor/hp820g2/pkg.cfg @@ -7,5 +7,5 @@ MRC_url="https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13904.77.0_s MRC_url_bkup="https://web.archive.org/web/20220310155922/https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13904.77.0_samus_recovery_stable-channel_mp-v3.bin.zip" MRC_hash="3ff1599c52539f0707a07a8664a84ce51cd3fed1569df4bb7aa6722fc8dec0af1754250333b6ca1a9794d970a4de7b29a5cf2499f5b61e4c3eab64d1314aaea9" MRC_board="samus" -MRC_refcode_cbtree="coreboot413" +MRC_refcode_cbtree="fam15h" MRC_refcode_gbe="131253" From a3ba8acface32900a524cf0ab429cadcd99577bc Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 20:49:49 +0100 Subject: [PATCH 112/267] init.sh: Only check XBMK_CACHE if it exists Otherwise, if it doesn't exist, the current check will wrongly exit with error status, preventing you from running the build system at all! Signed-off-by: Leah Rowe --- include/init.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/init.sh b/include/init.sh index d2db0236..b9cb81b1 100644 --- a/include/init.sh +++ b/include/init.sh @@ -134,7 +134,8 @@ xbmk_set_env() xbmkcache="`findpath "$XBMK_CACHE"`" || \ err "Can't resolve cachedir: '$XBMK_CACHE'" export XBMK_CACHE="$xbmkcache" - [ -d "$XBMK_CACHE" ] || err "cachedir '$XBMK_CACHE' is a file"; : + [ ! -e "$XBMK_CACHE" ] || \ + [ -d "$XBMK_CACHE" ] || err "cachedir '$XBMK_CACHE' is a file"; : # if "y": a coreboot target won't be built if target.cfg says release="n" # (this is used to exclude certain build targets from releases) From 93d4eca04ae9b7eabb4fa72d96784b9ba714d384 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 21:33:17 +0100 Subject: [PATCH 113/267] git.sh: Hard fail if reset fails We allow a re-try when cloning fails, to account for redundancy, but resetfail currently doesn't cause any error exit at all. This patch mitigates that bug. Signed-off-by: Leah Rowe --- include/git.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/git.sh b/include/git.sh index 81c75806..3e885c1b 100644 --- a/include/git.sh +++ b/include/git.sh @@ -92,6 +92,7 @@ tmpclone() livepull="n" && [ "$repofail" = "y" ] && \ printf "Cached clone failed; trying online.\n" 1>&2 && livepull="y" + resetfail="n" repofail="n" [ $# -lt 6 ] || rm -Rf "$3" || err "git retry: !rm $3 ($1)" @@ -107,10 +108,13 @@ tmpclone() fi ( [ $# -gt 5 ] || git clone "$repodir" "$3" || err "!clone $repodir $3" - git -C "$3" reset --hard "$4" || err "!reset $1 $2 $3 $4 $5" + git -C "$3" reset --hard "$4" || resetfail="y" + [ "$resetfail" = "y" ] && err "'$3': Cannot reset to rev '$4'" fx_ "eval x_ git -C \"$3\" am" find "$5" -type f ) || repofail="y" + [ "$resetfail" = "y" ] && err "Cannot reset revisions" + [ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry [ "$repofail" = "y" ] && err "!clone $1 $2 $3 $4 $5"; : } From 6bdb15fd329e1ffb22ff37c7e9a296cca633f836 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 21:36:37 +0100 Subject: [PATCH 114/267] git.sh: hard fail if git am fails similar to the last patch, we must ensure that the inability to patch will cause a hard exit, regardless of any redundancy we have for cloning. Signed-off-by: Leah Rowe --- include/git.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/git.sh b/include/git.sh index 3e885c1b..afcfee93 100644 --- a/include/git.sh +++ b/include/git.sh @@ -94,6 +94,7 @@ tmpclone() resetfail="n" repofail="n" + amfail="n" [ $# -lt 6 ] || rm -Rf "$3" || err "git retry: !rm $3 ($1)" repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3" @@ -109,11 +110,12 @@ tmpclone() ( [ $# -gt 5 ] || git clone "$repodir" "$3" || err "!clone $repodir $3" git -C "$3" reset --hard "$4" || resetfail="y" - [ "$resetfail" = "y" ] && err "'$3': Cannot reset to rev '$4'" - fx_ "eval x_ git -C \"$3\" am" find "$5" -type f + [ "$resetfail" = "y" ] || ( fx_ "eval x_ git -C \"$3\" am" find "$5" \ + -type f ) || amfail="y" ) || repofail="y" [ "$resetfail" = "y" ] && err "Cannot reset revisions" + [ "$amfail" = "y" ] && err "Cannot apply patches" [ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry [ "$repofail" = "y" ] && err "!clone $1 $2 $3 $4 $5"; : From 454f11bdd7bf7409276b2e0fc301a061b258e8d9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 21:38:07 +0100 Subject: [PATCH 115/267] git.sh: use setvars for fail variables Signed-off-by: Leah Rowe --- include/git.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/git.sh b/include/git.sh index afcfee93..14def209 100644 --- a/include/git.sh +++ b/include/git.sh @@ -92,9 +92,7 @@ tmpclone() livepull="n" && [ "$repofail" = "y" ] && \ printf "Cached clone failed; trying online.\n" 1>&2 && livepull="y" - resetfail="n" - repofail="n" - amfail="n" + eval "`setvars "n" resetfail repofail amfail`" [ $# -lt 6 ] || rm -Rf "$3" || err "git retry: !rm $3 ($1)" repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3" From 0d876622fcb715eb8cfc03a1bf9bb138fd845731 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 22:05:28 +0100 Subject: [PATCH 116/267] git.sh: re-write tmpclone without caching remove caching for now. it's buggy as hell. will re-write the caching feature next. Signed-off-by: Leah Rowe --- include/git.sh | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/include/git.sh b/include/git.sh index 14def209..9440b1af 100644 --- a/include/git.sh +++ b/include/git.sh @@ -89,34 +89,12 @@ fetch_submodule() tmpclone() { - livepull="n" && [ "$repofail" = "y" ] && \ - printf "Cached clone failed; trying online.\n" 1>&2 && livepull="y" - - eval "`setvars "n" resetfail repofail amfail`" - - [ $# -lt 6 ] || rm -Rf "$3" || err "git retry: !rm $3 ($1)" - repodir="$XBMK_CACHE/repo/${1##*/}" && [ $# -gt 5 ] && repodir="$3" - mkdir -p "$XBMK_CACHE/repo" || err "!rmdir $XBMK_CACHE/repo" - - if [ "$livepull" = "y" ] && [ ! -d "$repodir" ]; then - git clone "$1" "$repodir" || git clone $2 "$repodir" || \ - err "!clone $1 $2 $repodir $4 $5" # - elif [ -d "$repodir" ] && [ $# -lt 6 ]; then - git -C "$repodir" pull || sleep 3 || git -C "$repodir" pull \ - || sleep 3 || git -C "$repodir" pull || : - fi - ( - [ $# -gt 5 ] || git clone "$repodir" "$3" || err "!clone $repodir $3" - git -C "$3" reset --hard "$4" || resetfail="y" - [ "$resetfail" = "y" ] || ( fx_ "eval x_ git -C \"$3\" am" find "$5" \ - -type f ) || amfail="y" - ) || repofail="y" - - [ "$resetfail" = "y" ] && err "Cannot reset revisions" - [ "$amfail" = "y" ] && err "Cannot apply patches" - - [ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry - [ "$repofail" = "y" ] && err "!clone $1 $2 $3 $4 $5"; : + [ -d "$3" ] && return 0 + printf "Creating git clone '%s' from '%s', '%s'\n" "$3" "$1" "$2" + git clone "$1" "$3" || x_ rm -Rf "$3" + [ -d "$3" ] || x_ git clone "$2" "$3" + x_ git -C "$3" reset --hard "$4" + fx_ "eval x_ git -C \"$3\" am" find "$5" -type f } nuke() From 1ce3e7a3d39cced1749b909fba9228b877c77339 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 22:17:35 +0100 Subject: [PATCH 117/267] mk: add missing error handli for mk -f on the release command, that is Signed-off-by: Leah Rowe --- mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk b/mk index 0c156523..aa89710a 100755 --- a/mk +++ b/mk @@ -67,7 +67,7 @@ build_release() ( cd "$srcdir" || err "$vdir: !cd \"$srcdir\"" - ./mk -f + x_ ./mk -f rmgit . x_ mv src/docs docs ) || err "can't create release files" From 50ce1ac9b225d717cc26727f4f2330795e84f05a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 23:28:06 +0100 Subject: [PATCH 118/267] mk: move release functions to idnclude/release.sh The idea with mk is that it's meant to basically be a stub for running everything else, while mainly having the trees logic within it (what was once script/trees). Signed-off-by: Leah Rowe --- include/release.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++ mk | 64 +-------------------------------------------- 2 files changed, 66 insertions(+), 63 deletions(-) create mode 100644 include/release.sh diff --git a/include/release.sh b/include/release.sh new file mode 100644 index 00000000..2f9f2b86 --- /dev/null +++ b/include/release.sh @@ -0,0 +1,65 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (c) 2023-2025 Leah Rowe + +eval "`setvars "" vdir src_dirname relsrcdir relmode`" + +release() +{ + export XBMK_RELEASE="y" + + vdir="release" + while getopts d:m: option; do + [ -z "$OPTARG" ] && err "empty argument not allowed" + case "$option" in + d) vdir="$OPTARG" ;; + m) relmode="$OPTARG" ;; + *) err "invalid option '-$option'" ;; + esac + done + + vdir="$vdir/$version" + src_dirname="${relname}_src" + relsrcdir="$vdir/$src_dirname" + + [ -e "$vdir" ] && err "already exists: \"$vdir\"" + mkdir -p "$vdir" || err "mkvdir: !mkdir -p \"$vdir\"" + git clone . "$relsrcdir" || err "mkdir: !gitclone \"$relsrcdir\"" + touch "$relsrcdir/lock" || err "can't make lock file in $relsrcdir/" + + build_release + + printf "\n\nDONE! Check release files under %s\n" "$vdir" +} + +build_release() +{ + ( + cd "$relsrcdir" || err "$vdir: !cd \"$relsrcdir\"" + + x_ ./mk -f + rmgit . + x_ mv src/docs docs + ) || err "can't create release files" + + git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \ + --abbrev-commit > "$relsrcdir/CHANGELOG" || err "!log $relsrcdir" + rm -f "$relsrcdir/lock" || err "can't remove lock file in $relsrcdir" + + ( + cd "${relsrcdir%/*}" || err "$vdir: mktarball \"$relsrcdir\"" + x_ mktarball "${relsrcdir##*/}" "${relsrcdir##*/}.tar.xz" + ) || err "can't create src tarball" + [ "$relmode" = "src" ] && return 0 + + touch "$relsrcdir/lock" || err "can't make lock file in $relsrcdir/" + ( + cd "$relsrcdir" || err "$vdir: 2 !cd \"$relsrcdir\"" + x_ ./mk -d coreboot + mk -b coreboot pico-serprog stm32-vserprog pcsx-redux + + fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*" + x_ mv bin ../roms + ) || err "can't build rom images" + + rm -Rf "$relsrcdir" || err "!rm -Rf $relsrcdir" +} diff --git a/mk b/mk index aa89710a..324e56cc 100755 --- a/mk +++ b/mk @@ -18,8 +18,7 @@ fi . "include/inject.sh" . "include/mrc.sh" . "include/rom.sh" - -eval "`setvars "" vdir src_dirname srcdir mode`" +. "include/release.sh" main() { @@ -34,67 +33,6 @@ main() set -u -e # some commands disable them. turn them on! } -release() -{ - export XBMK_RELEASE="y" - - vdir="release" - while getopts d:m: option; do - [ -z "$OPTARG" ] && err "empty argument not allowed" - case "$option" in - d) vdir="$OPTARG" ;; - m) mode="$OPTARG" ;; - *) err "invalid option '-$option'" ;; - esac - done - - vdir="$vdir/$version" - src_dirname="${relname}_src" - srcdir="$vdir/$src_dirname" - - [ -e "$vdir" ] && err "already exists: \"$vdir\"" - mkdir -p "$vdir" || err "mkvdir: !mkdir -p \"$vdir\"" - git clone . "$srcdir" || err "mkdir: !gitclone \"$srcdir\"" - touch "$srcdir/lock" || err "can't make lock file in $srcdir/" - - build_release - - printf "\n\nDONE! Check release files under %s\n" "$vdir" -} - -build_release() -{ - ( - cd "$srcdir" || err "$vdir: !cd \"$srcdir\"" - - x_ ./mk -f - rmgit . - x_ mv src/docs docs - ) || err "can't create release files" - - git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \ - --abbrev-commit > "$srcdir/CHANGELOG" || err "!gitlog $srcdir" - rm -f "$srcdir/lock" || err "can't remove lock file in $srcdir" - - ( - cd "${srcdir%/*}" || err "$vdir: mktarball \"$srcdir\"" - mktarball "${srcdir##*/}" "${srcdir##*/}.tar.xz" || err "$vdir: mksrc" - ) || err "can't create src tarball" - [ "$mode" = "src" ] && return 0 - - touch "$srcdir/lock" || err "can't make lock file in $srcdir/" - ( - cd "$srcdir" || err "$vdir: 2 !cd \"$srcdir\"" - x_ ./mk -d coreboot - mk -b coreboot pico-serprog stm32-vserprog pcsx-redux - - fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*" - x_ mv bin ../roms - ) || err "can't build rom images" - - rm -Rf "$srcdir" || err "!rm -Rf $srcdir" -} - main "$@" && exit 0 # what follows was formerly script/trees, whose main() is now trees() From 7012c00ed1102160dd612b79fd9c5c913119b6c4 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 23:33:49 +0100 Subject: [PATCH 119/267] mk: re-split tree logic to include/tree.sh I really think mk should just be a small stub. Better to keep everything separate. Signed-off-by: Leah Rowe --- include/tree.sh | 344 ++++++++++++++++++++++++++++++++++++++++++++++++ mk | 343 +---------------------------------------------- 2 files changed, 345 insertions(+), 342 deletions(-) create mode 100644 include/tree.sh diff --git a/include/tree.sh b/include/tree.sh new file mode 100644 index 00000000..4d0c533d --- /dev/null +++ b/include/tree.sh @@ -0,0 +1,344 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (c) 2022-2023 Alper Nebi Yasak +# Copyright (c) 2022 Ferass El Hafidi +# Copyright (c) 2023-2025 Leah Rowe + +eval "`setvars "" xarch srcdir premake gnatdir xlang mode makeargs elfdir cmd \ + project target target_dir targets xtree _f release bootstrapargs mkhelper \ + autoconfargs listfile autogenargs btype rev build_depend gccdir cmakedir \ + defconfig postmake mkhelpercfg dry dest_dir mdir cleanargs gccver gccfull \ + gnatver gnatfull do_make badhash tree`" + +trees() +{ + flags="f:b:m:u:c:x:s:l:n:d:" + + while getopts $flags option; do + [ -n "$_f" ] && err "only one flag is permitted" + _f="$1" + + case "$_f" in + -d) dry=":" ;; + -b) : ;; + -u) mode="oldconfig" ;; + -m) mode="menuconfig" ;; + -c) mode="distclean" ;; + -x) mode="crossgcc-clean" ;; + -f) + do_make="n" + dry=":" ;; + -s) mode="savedefconfig" ;; + -l) mode="olddefconfig" ;; + -n) mode="nconfig" ;; + *) err "invalid option '-$option'" ;; + esac + + if [ -z "${OPTARG+x}" ]; then + shift 1 + break + fi + + project="${OPTARG#src/}" + shift 2 + done + [ -z "$_f" ] && err "missing flag ($flags)" + if [ -z "$project" ]; then + mk $_f $(ls -1 config/git) + return 1 + fi + + [ -f "config/git/$project/pkg.cfg" ] || \ + err "config/git/$project/pkg.cfg missing" + + for d in "elf" "config/data" "config" "src"; do + eval "${d#*/}dir=\"$d/$project\"" + done + dest_dir="$elfdir" + + listfile="$datadir/build.list" + [ -f "$listfile" ] || listfile="" # optional on all projects + + mkhelpercfg="$datadir/mkhelper.cfg" + if e "$mkhelpercfg" f missing; then + mkhelpercfg="$xbmktmp/mkhelper.cfg" + x_ touch "$mkhelpercfg" + fi + + targets="$*" + cmd="build_targets $targets" + singletree "$project" && cmd="build_project" + + remkdir "${tmpgit%/*}" +} + +build_project() +{ + configure_project "$configdir" || return 0 + [ ! -f "$listfile" ] || $dry elfcheck || return 0 + + [ "$mode" = "distclean" ] && mode="clean" + run_make_command || return 0 + + [ -n "$mode" ] || $dry copy_elf; : +} + +build_targets() +{ + [ -d "$configdir" ] || err "directory, $configdir, does not exist" + [ $# -gt 0 ] || targets="$(ls -1 "$configdir")" || err "!o $configdir" + + for x in $targets; do + unset CROSS_COMPILE + export PATH="$xbmkpath" + [ "$x" = "list" ] && x_ ls -1 "config/$project" && \ + listfile="" && break + + target="$x" + printf "'make %s', '%s', '%s'\n" "$mode" "$project" "$target" + x_ handle_defconfig + + [ -n "$mode" ] || x_ $postmake + done; : +} + +handle_defconfig() +{ + target_dir="$configdir/$target" + + [ -f "CHANGELOG" ] || fetch_project "$project" + configure_project "$target_dir" || return 0 + x_ mkdir -p "$elfdir/$target" + + chkvars tree + srcdir="src/$project/$tree" + + if [ "$mode" = "distclean" ] || [ "$mode" = "crossgcc-clean" ]; then + [ -d "$srcdir" ] || return 0 + fi + [ -z "$mode" ] && for _xarch in $xarch; do + $dry check_cross_compiler "$_xarch" + done; : + + for y in "$target_dir/config"/*; do + [ "$_f" = "-d" ] || [ -f "$y" ] || continue + [ "$_f" = "-d" ] || defconfig="$y" + + [ -n "$mode" ] || check_defconfig || continue + handle_makefile + [ -n "$mode" ] || $dry copy_elf + done; : +} + +configure_project() +{ + eval "`setvars "" cleanargs build_depend autoconfargs xtree postmake \ + makeargs btype mkhelper bootstrapargs premake release xlang xarch \ + badhash`" + _tcfg="$1/target.cfg" + [ -f "$_tcfg" ] || btype="auto" + e "$datadir/mkhelper.cfg" f && eval "`setcfg "$datadir/mkhelper.cfg"`" + + while e "$_tcfg" f || [ "$cmd" != "build_project" ]; do + eval "`setvars "" rev tree`" + eval "`setcfg "$_tcfg"`" + printf "Loading %s config: %s\n" "$project" "$_tcfg" + + [ "$_f" = "-d" ] && build_depend="" # dry run + [ "$cmd" = "build_project" ] && break + [ "$do_make" != "n" ] && break + + [ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \ + && break + _tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg" + done + [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && return 1 + [ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || return 1 + [ -z "$mode" ] && $dry build_dependencies + + mdir="$xbmkpwd/config/submodule/$project" + [ -n "$tree" ] && mdir="$mdir/$tree" + [ -f "CHANGELOG" ] || check_project_hashes + + if [ "$do_make" = "n" ]; then + [ -f "CHANGELOG" ] || fetch_${cmd#build_} + return 1 + fi + x_ ./mk -f "$project" "$target" +} + +build_dependencies() +{ + for bd in $build_depend; do + bd_p="${bd%%/*}" + bd_t="${bd##*/}" + [ -z "$bd_p" ] && $dry err "$project/$tree: !bd '$bd'" + [ "${bd##*/}" = "$bd" ] && bd_t="" + [ -z "$bd_p" ] || $dry x_ ./mk -b $bd_p $bd_t; : + done; : +} + +check_project_hashes() +{ + old_pjhash="" && x_ mkdir -p "$XBMK_CACHE/hash" + [ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \ + read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree" + + fx_ "x_ sha512sum" find "$datadir" "$configdir/$tree" "$mdir" \ + -type f -not -path "*/.git*/*" | awk '{print $1}' > \ + "$xbmktmp/project.hash" || err "!h $project $tree" + + pjhash="$(sha512sum "$xbmktmp/project.hash" | awk '{print $1}')" || : + [ "$pjhash" != "$old_pjhash" ] && badhash="y" + [ -f "$XBMK_CACHE/hash/$project$tree" ] || badhash="y" + + printf "%s\n" "$pjhash" > "$XBMK_CACHE/hash/$project$tree" || \ + err "!mk $XBMK_CACHE/hash/$project$tree" + + [ "$badhash" != "y" ] || x_ rm -Rf "src/$project/$tree" \ + "elf/$project/$tree" "elf/$project/$target"; : +} + +check_cross_compiler() +{ + cbdir="src/coreboot/$tree" + [ "$project" != "coreboot" ] && cbdir="src/coreboot/default" + [ -n "$xtree" ] && cbdir="src/coreboot/$xtree" + + x_ ./mk -f coreboot "${cbdir#src/coreboot/}" + + export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH" + export CROSS_COMPILE="${xarch% *}-" + [ -n "$xlang" ] && export BUILD_LANGUAGES="$xlang" + + # match gnat-X to gcc + check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc + + xfix="${1%-*}" && [ "$xfix" = "x86_64" ] && xfix="x64" + xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" + make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs + + # we only want to mess with hostcc to build xgcc + remkdir "$XBMK_CACHE/gnupath" +} + +# fix mismatching gcc/gnat versions on debian trixie/sid. as of december 2024, +# trixie/sid had gnat-13 as gnat and gcc-14 as gcc, but has gnat-14 in apt. in +# some cases, gcc 13+14 and gnat-13 are present; or gnat-14 and gcc-14, but +# gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental" +check_gnu_path() +{ + command -v "$1" 1>/dev/null || err "Host '$1' unavailable" + + eval "`setvars "" gccver gccfull gnatver gnatfull gccdir gnatdir`" + x_ gnu_setver "$1" "$1" || err "Command '$1' unavailable." + gnu_setver "$2" "$2" || : + + eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\"" + [ "$gnatfull" = "$gccfull" ] && return 0 + + eval "$1dir=\"$(dirname "$(command -v "$1")")\"" + eval "_gnudir=\"\$$1dir\"; _gnuver=\"\$$1ver\"" + for _bin in "$_gnudir/$2-"*; do + [ "${_bin#"$_gnudir/$2-"}" = "$_gnuver" ] && [ -x "$_bin" ] \ + && _gnuver="${_bin#"$_gnudir/$2-"}" && break; : + done + gnu_setver "$2" "$_gnudir/$2-$_gnuver" || return 1 + [ "$gnatfull" = "$gccfull" ] || return 1 + + ( + remkdir "$XBMK_CACHE/gnupath" && x_ cd "$XBMK_CACHE/gnupath" + for _gnubin in "$_gnudir/$2"*"-$_gnuver"; do + _gnuutil="${_gnubin##*/}" && [ -e "$_gnubin" ] && \ + x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}" + done + ) || err "Cannot create $2-$_gnuver link in $_gnudir"; : +} + +gnu_setver() +{ + eval "$2 --version 1>/dev/null 2>/dev/null || return 1" + eval "$1ver=\"`"$2" --version 2>/dev/null | head -n1`\"" + eval "$1ver=\"\${$1ver##* }\"" + eval "$1full=\"\$$1ver\"" + eval "$1ver=\"\${$1ver%%.*}\""; : +} + +check_defconfig() +{ + [ -f "$defconfig" ] || $dry err "$project/$target: missing defconfig" + dest_dir="$elfdir/$target/${defconfig#"$target_dir/config/"}" + + $dry elfcheck || return 1 # skip build if a previous one exists + $dry x_ mkdir -p "$dest_dir" +} + +elfcheck() +{ + # TODO: *STILL* very hacky check. do it properly (based on build.list) + ( fx_ "exit 1" find "$dest_dir" -type f ) || return 1; : +} + +handle_makefile() +{ + $dry check_makefile "$srcdir" && x_ make -C "$srcdir" $cleanargs clean + + [ -f "$defconfig" ] && x_ cp "$defconfig" "$srcdir/.config" + [ -n "$mode" ] || [ -n "$btype" ] || $dry make -C \ + "$srcdir" silentoldconfig || make -C "$srcdir" oldconfig || : + + run_make_command || err "handle_makefile $srcdir: no makefile!" + + _copy=".config" && [ "$mode" = "savedefconfig" ] && _copy="defconfig" + [ "${mode%config}" = "$mode" ] || \ + $dry x_ cp "$srcdir/$_copy" "$defconfig" + + [ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \ + [ "$mode" = "distclean" ] && \ + $dry x_ git -C "$srcdir" $cleanargs clean -fdx; : +} + +run_make_command() +{ + [ -n "$mode" ] || x_ $premake + + $dry check_cmake "$srcdir" && [ -z "$mode" ] && \ + $dry check_autoconf "$srcdir" + $dry check_makefile "$srcdir" || return 1 + + $dry x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs + [ -n "$mode" ] || x_ $mkhelper + + [ "$mode" != "clean" ] || \ + $dry make -C "$srcdir" $cleanargs distclean || :; : +} + +check_cmake() +{ + [ -z "$cmakedir" ] || $dry check_makefile "$1" || cmake -B "$1" \ + "$1/$cmakedir" || $dry x_ check_makefile "$1" + [ -z "$cmakedir" ] || $dry x_ check_makefile "$1"; : +} + +check_autoconf() +{ + ( + cd "$1" || err "!cd $1" + [ -f "bootstrap" ] && x_ ./bootstrap $bootstrapargs + [ -f "autogen.sh" ] && x_ ./autogen.sh $autogenargs + [ -f "configure" ] && x_ ./configure $autoconfargs; : + ) || err "can't bootstrap project: $1"; : +} + +check_makefile() +{ + [ -f "$1/Makefile" ] || [ -f "$1/makefile" ] || \ + [ -f "$1/GNUmakefile" ] || return 1; : +} + +copy_elf() +{ + [ -f "$listfile" ] && x_ mkdir -p "$dest_dir" && while read -r f; do + [ -f "$srcdir/$f" ] && x_ cp "$srcdir/$f" "$dest_dir" + done < "$listfile" + x_ make clean -C "$srcdir" $cleanargs +} diff --git a/mk b/mk index 324e56cc..2b1191bb 100755 --- a/mk +++ b/mk @@ -2,8 +2,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Copyright (c) 2020-2025 Leah Rowe # Copyright (c) 2022 Caleb La Grange -# Copyright (c) 2022 Ferass El Hafidi -# Copyright (c) 2022-2023 Alper Nebi Yasak set -u -e @@ -38,346 +36,7 @@ main "$@" && exit 0 # what follows was formerly script/trees, whose main() is now trees() . "include/git.sh" - -eval "`setvars "" xarch srcdir premake gnatdir xlang mode makeargs elfdir cmd \ - project target target_dir targets xtree _f release bootstrapargs mkhelper \ - autoconfargs listfile autogenargs btype rev build_depend gccdir cmakedir \ - defconfig postmake mkhelpercfg dry dest_dir mdir cleanargs gccver gccfull \ - gnatver gnatfull do_make badhash tree`" - -trees() -{ - flags="f:b:m:u:c:x:s:l:n:d:" - - while getopts $flags option; do - [ -n "$_f" ] && err "only one flag is permitted" - _f="$1" - - case "$_f" in - -d) dry=":" ;; - -b) : ;; - -u) mode="oldconfig" ;; - -m) mode="menuconfig" ;; - -c) mode="distclean" ;; - -x) mode="crossgcc-clean" ;; - -f) - do_make="n" - dry=":" ;; - -s) mode="savedefconfig" ;; - -l) mode="olddefconfig" ;; - -n) mode="nconfig" ;; - *) err "invalid option '-$option'" ;; - esac - - if [ -z "${OPTARG+x}" ]; then - shift 1 - break - fi - - project="${OPTARG#src/}" - shift 2 - done - [ -z "$_f" ] && err "missing flag ($flags)" - if [ -z "$project" ]; then - mk $_f $(ls -1 config/git) - return 1 - fi - - [ -f "config/git/$project/pkg.cfg" ] || \ - err "config/git/$project/pkg.cfg missing" - - for d in "elf" "config/data" "config" "src"; do - eval "${d#*/}dir=\"$d/$project\"" - done - dest_dir="$elfdir" - - listfile="$datadir/build.list" - [ -f "$listfile" ] || listfile="" # optional on all projects - - mkhelpercfg="$datadir/mkhelper.cfg" - if e "$mkhelpercfg" f missing; then - mkhelpercfg="$xbmktmp/mkhelper.cfg" - x_ touch "$mkhelpercfg" - fi - - targets="$*" - cmd="build_targets $targets" - singletree "$project" && cmd="build_project" - - remkdir "${tmpgit%/*}" -} - -build_project() -{ - configure_project "$configdir" || return 0 - [ ! -f "$listfile" ] || $dry elfcheck || return 0 - - [ "$mode" = "distclean" ] && mode="clean" - run_make_command || return 0 - - [ -n "$mode" ] || $dry copy_elf; : -} - -build_targets() -{ - [ -d "$configdir" ] || err "directory, $configdir, does not exist" - [ $# -gt 0 ] || targets="$(ls -1 "$configdir")" || err "!o $configdir" - - for x in $targets; do - unset CROSS_COMPILE - export PATH="$xbmkpath" - [ "$x" = "list" ] && x_ ls -1 "config/$project" && \ - listfile="" && break - - target="$x" - printf "'make %s', '%s', '%s'\n" "$mode" "$project" "$target" - x_ handle_defconfig - - [ -n "$mode" ] || x_ $postmake - done; : -} - -handle_defconfig() -{ - target_dir="$configdir/$target" - - [ -f "CHANGELOG" ] || fetch_project "$project" - configure_project "$target_dir" || return 0 - x_ mkdir -p "$elfdir/$target" - - chkvars tree - srcdir="src/$project/$tree" - - if [ "$mode" = "distclean" ] || [ "$mode" = "crossgcc-clean" ]; then - [ -d "$srcdir" ] || return 0 - fi - [ -z "$mode" ] && for _xarch in $xarch; do - $dry check_cross_compiler "$_xarch" - done; : - - for y in "$target_dir/config"/*; do - [ "$_f" = "-d" ] || [ -f "$y" ] || continue - [ "$_f" = "-d" ] || defconfig="$y" - - [ -n "$mode" ] || check_defconfig || continue - handle_makefile - [ -n "$mode" ] || $dry copy_elf - done; : -} - -configure_project() -{ - eval "`setvars "" cleanargs build_depend autoconfargs xtree postmake \ - makeargs btype mkhelper bootstrapargs premake release xlang xarch \ - badhash`" - _tcfg="$1/target.cfg" - [ -f "$_tcfg" ] || btype="auto" - e "$datadir/mkhelper.cfg" f && eval "`setcfg "$datadir/mkhelper.cfg"`" - - while e "$_tcfg" f || [ "$cmd" != "build_project" ]; do - eval "`setvars "" rev tree`" - eval "`setcfg "$_tcfg"`" - printf "Loading %s config: %s\n" "$project" "$_tcfg" - - [ "$_f" = "-d" ] && build_depend="" # dry run - [ "$cmd" = "build_project" ] && break - [ "$do_make" != "n" ] && break - - [ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \ - && break - _tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg" - done - [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && return 1 - [ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || return 1 - [ -z "$mode" ] && $dry build_dependencies - - mdir="$xbmkpwd/config/submodule/$project" - [ -n "$tree" ] && mdir="$mdir/$tree" - [ -f "CHANGELOG" ] || check_project_hashes - - if [ "$do_make" = "n" ]; then - [ -f "CHANGELOG" ] || fetch_${cmd#build_} - return 1 - fi - x_ ./mk -f "$project" "$target" -} - -build_dependencies() -{ - for bd in $build_depend; do - bd_p="${bd%%/*}" - bd_t="${bd##*/}" - [ -z "$bd_p" ] && $dry err "$project/$tree: !bd '$bd'" - [ "${bd##*/}" = "$bd" ] && bd_t="" - [ -z "$bd_p" ] || $dry x_ ./mk -b $bd_p $bd_t; : - done; : -} - -check_project_hashes() -{ - old_pjhash="" && x_ mkdir -p "$XBMK_CACHE/hash" - [ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \ - read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree" - - fx_ "x_ sha512sum" find "$datadir" "$configdir/$tree" "$mdir" \ - -type f -not -path "*/.git*/*" | awk '{print $1}' > \ - "$xbmktmp/project.hash" || err "!h $project $tree" - - pjhash="$(sha512sum "$xbmktmp/project.hash" | awk '{print $1}')" || : - [ "$pjhash" != "$old_pjhash" ] && badhash="y" - [ -f "$XBMK_CACHE/hash/$project$tree" ] || badhash="y" - - printf "%s\n" "$pjhash" > "$XBMK_CACHE/hash/$project$tree" || \ - err "!mk $XBMK_CACHE/hash/$project$tree" - - [ "$badhash" != "y" ] || x_ rm -Rf "src/$project/$tree" \ - "elf/$project/$tree" "elf/$project/$target"; : -} - -check_cross_compiler() -{ - cbdir="src/coreboot/$tree" - [ "$project" != "coreboot" ] && cbdir="src/coreboot/default" - [ -n "$xtree" ] && cbdir="src/coreboot/$xtree" - - x_ ./mk -f coreboot "${cbdir#src/coreboot/}" - - export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH" - export CROSS_COMPILE="${xarch% *}-" - [ -n "$xlang" ] && export BUILD_LANGUAGES="$xlang" - - # match gnat-X to gcc - check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc - - xfix="${1%-*}" && [ "$xfix" = "x86_64" ] && xfix="x64" - xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" - make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs - - # we only want to mess with hostcc to build xgcc - remkdir "$XBMK_CACHE/gnupath" -} - -# fix mismatching gcc/gnat versions on debian trixie/sid. as of december 2024, -# trixie/sid had gnat-13 as gnat and gcc-14 as gcc, but has gnat-14 in apt. in -# some cases, gcc 13+14 and gnat-13 are present; or gnat-14 and gcc-14, but -# gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental" -check_gnu_path() -{ - command -v "$1" 1>/dev/null || err "Host '$1' unavailable" - - eval "`setvars "" gccver gccfull gnatver gnatfull gccdir gnatdir`" - x_ gnu_setver "$1" "$1" || err "Command '$1' unavailable." - gnu_setver "$2" "$2" || : - - eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\"" - [ "$gnatfull" = "$gccfull" ] && return 0 - - eval "$1dir=\"$(dirname "$(command -v "$1")")\"" - eval "_gnudir=\"\$$1dir\"; _gnuver=\"\$$1ver\"" - for _bin in "$_gnudir/$2-"*; do - [ "${_bin#"$_gnudir/$2-"}" = "$_gnuver" ] && [ -x "$_bin" ] \ - && _gnuver="${_bin#"$_gnudir/$2-"}" && break; : - done - gnu_setver "$2" "$_gnudir/$2-$_gnuver" || return 1 - [ "$gnatfull" = "$gccfull" ] || return 1 - - ( - remkdir "$XBMK_CACHE/gnupath" && x_ cd "$XBMK_CACHE/gnupath" - for _gnubin in "$_gnudir/$2"*"-$_gnuver"; do - _gnuutil="${_gnubin##*/}" && [ -e "$_gnubin" ] && \ - x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}" - done - ) || err "Cannot create $2-$_gnuver link in $_gnudir"; : -} - -gnu_setver() -{ - eval "$2 --version 1>/dev/null 2>/dev/null || return 1" - eval "$1ver=\"`"$2" --version 2>/dev/null | head -n1`\"" - eval "$1ver=\"\${$1ver##* }\"" - eval "$1full=\"\$$1ver\"" - eval "$1ver=\"\${$1ver%%.*}\""; : -} - -check_defconfig() -{ - [ -f "$defconfig" ] || $dry err "$project/$target: missing defconfig" - dest_dir="$elfdir/$target/${defconfig#"$target_dir/config/"}" - - $dry elfcheck || return 1 # skip build if a previous one exists - $dry x_ mkdir -p "$dest_dir" -} - -elfcheck() -{ - # TODO: *STILL* very hacky check. do it properly (based on build.list) - ( fx_ "exit 1" find "$dest_dir" -type f ) || return 1; : -} - -handle_makefile() -{ - $dry check_makefile "$srcdir" && x_ make -C "$srcdir" $cleanargs clean - - [ -f "$defconfig" ] && x_ cp "$defconfig" "$srcdir/.config" - [ -n "$mode" ] || [ -n "$btype" ] || $dry make -C \ - "$srcdir" silentoldconfig || make -C "$srcdir" oldconfig || : - - run_make_command || err "handle_makefile $srcdir: no makefile!" - - _copy=".config" && [ "$mode" = "savedefconfig" ] && _copy="defconfig" - [ "${mode%config}" = "$mode" ] || \ - $dry x_ cp "$srcdir/$_copy" "$defconfig" - - [ -e "$srcdir/.git" ] && [ "$project" = "u-boot" ] && \ - [ "$mode" = "distclean" ] && \ - $dry x_ git -C "$srcdir" $cleanargs clean -fdx; : -} - -run_make_command() -{ - [ -n "$mode" ] || x_ $premake - - $dry check_cmake "$srcdir" && [ -z "$mode" ] && \ - $dry check_autoconf "$srcdir" - $dry check_makefile "$srcdir" || return 1 - - $dry x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs - [ -n "$mode" ] || x_ $mkhelper - - [ "$mode" != "clean" ] || \ - $dry make -C "$srcdir" $cleanargs distclean || :; : -} - -check_cmake() -{ - [ -z "$cmakedir" ] || $dry check_makefile "$1" || cmake -B "$1" \ - "$1/$cmakedir" || $dry x_ check_makefile "$1" - [ -z "$cmakedir" ] || $dry x_ check_makefile "$1"; : -} - -check_autoconf() -{ - ( - cd "$1" || err "!cd $1" - [ -f "bootstrap" ] && x_ ./bootstrap $bootstrapargs - [ -f "autogen.sh" ] && x_ ./autogen.sh $autogenargs - [ -f "configure" ] && x_ ./configure $autoconfargs; : - ) || err "can't bootstrap project: $1"; : -} - -check_makefile() -{ - [ -f "$1/Makefile" ] || [ -f "$1/makefile" ] || \ - [ -f "$1/GNUmakefile" ] || return 1; : -} - -copy_elf() -{ - [ -f "$listfile" ] && x_ mkdir -p "$dest_dir" && while read -r f; do - [ -f "$srcdir/$f" ] && x_ cp "$srcdir/$f" "$dest_dir" - done < "$listfile" - x_ make clean -C "$srcdir" $cleanargs -} +. "include/tree.sh" trees "$@" || exit 0 . "$mkhelpercfg" From 066402b7e7a3c0a6fbe1f5f1e362c3c7bfb9d25f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 23:35:40 +0100 Subject: [PATCH 120/267] mk: remove unnecessary line break Signed-off-by: Leah Rowe --- mk | 1 - 1 file changed, 1 deletion(-) diff --git a/mk b/mk index 2b1191bb..0bd18bee 100755 --- a/mk +++ b/mk @@ -11,7 +11,6 @@ if [ "./${0##*/}" != "${0}" ] || [ ! -f "mk" ] || [ -L "mk" ]; then fi . "include/lib.sh" - . "include/init.sh" . "include/inject.sh" . "include/mrc.sh" From c2b627dc6d0e6fe10d899fdf301fee6b806ecd50 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 23:36:44 +0100 Subject: [PATCH 121/267] remove useless comment Signed-off-by: Leah Rowe --- mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/mk b/mk index 0bd18bee..1a7b896f 100755 --- a/mk +++ b/mk @@ -32,8 +32,6 @@ main() main "$@" && exit 0 -# what follows was formerly script/trees, whose main() is now trees() - . "include/git.sh" . "include/tree.sh" From ff33ec3352babab4c827121099192f014a960c43 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 May 2025 23:41:24 +0100 Subject: [PATCH 122/267] mk: use zero exit instead, to run trees that way, with set -u -e, we aren't risking some buggy sh implementations from causing an error exit where it shouldn't. Signed-off-by: Leah Rowe --- mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mk b/mk index 1a7b896f..af29f1e2 100755 --- a/mk +++ b/mk @@ -24,13 +24,14 @@ main() case "$cmd" in version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;; release|download|inject) $cmd "$@" ;; - -*) return 1 ;; + -*) return 0 ;; *) err "bad command" ;; esac set -u -e # some commands disable them. turn them on! + return 1 } -main "$@" && exit 0 +main "$@" || exit 0 . "include/git.sh" . "include/tree.sh" From 91220ce1833e4980097cff9674e2481cb2b24e07 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 9 May 2025 00:20:33 +0100 Subject: [PATCH 123/267] inject.sh: use subshell to speed up find_me() the current test allows a further extraction after running mecleaner, even if me.bin was found. further, any recursive calls that exit non-ze don't lot the loop acthually stop, unless we subshell that too, otherwise fx_ is returned to return 0 when a given command it runs returns 1, or more specifically: the for loop in x_ breaks. this is by design, and there's not much that can be done, but this patch should pseed up extraction a little bit, when dealing with intel me files. Signed-off-by: Leah Rowe --- include/inject.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index c0b4409f..135df0c2 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -147,7 +147,9 @@ extract_intel_me() chkvars ME11delta ME11version ME11sku ME11pch [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard - set +u +e && fx_ find_me x_ find "$xbmkpwd/$appdir" -type f + set +u +e + x_ rm -Rf "$xbmkpwd/metmp" + ( fx_ find_me x_ find "$xbmkpwd/$appdir" -type f ) || : [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 ( @@ -160,7 +162,7 @@ extract_intel_me() find_me() { - e "$_metmp" f && x_ rm -Rf "$xbmklocal/metmp" && return 1 + e "$_metmp" f && exit 1 [ -L "$1" ] && return 0 _7ztest="${_7ztest}a" && _r="-r" && [ -n "$mfs" ] && _r="" @@ -169,7 +171,8 @@ find_me() "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 - fx_ find_me x_ find "$_7ztest" -type f || return 1; : + e "$_metmp" f && exit 1 + ( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : } extract_archive() From 23486abef3abafbe36b34ebac880f993804356f3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 9 May 2025 00:26:33 +0100 Subject: [PATCH 124/267] inject.sh: use direct comparison for metmp use of the e function would slow down execution, and it's mostly unnecessary in this case. the e function is only needed if we want to confirm via user message that a file exists. that is not needed here. Signed-off-by: Leah Rowe --- include/inject.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 135df0c2..8485d7e8 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -162,7 +162,7 @@ extract_intel_me() find_me() { - e "$_metmp" f && exit 1 + [ -f "$_metmp" ] && exit 1 [ -L "$1" ] && return 0 _7ztest="${_7ztest}a" && _r="-r" && [ -n "$mfs" ] && _r="" @@ -171,7 +171,7 @@ find_me() "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 - e "$_metmp" f && exit 1 + [ -f "$_metmp" ] && exit 1 ( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : } From 6e521c2e1ea975133894ce7fc27702feed080547 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 9 May 2025 20:21:58 +0100 Subject: [PATCH 125/267] mrc.sh: fix outdated info in the comment Signed-off-by: Leah Rowe --- include/mrc.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mrc.sh b/include/mrc.sh index a1dcb140..00fb8626 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -23,9 +23,9 @@ extract_refcode() [ $# -lt 1 ] && extract_shellball - # cbfstool changed the attributes scheme for stage files, - # incompatible with older versions before coreboot 4.14, - # so we need coreboot 4.13 cbfstool for certain refcode files + # cbfstool after coreboot 4.13 changed the stage file attribute scheme, + # and refcode is extracted from an image using the old scheme. we use + # cbfstool from coreboot 4.11_branch, the tree used by ASUS KGPE-D16 chkvars cbfstoolref mkdir -p "${_refdest%/*}" || err "ref: !mkdir -p ${_refdest%/*}" From 14d46abceda7a7ad6081b6ab321fb0efb4bc3325 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 9 May 2025 20:31:00 +0100 Subject: [PATCH 126/267] mrc.sh: operate on refcode in tmp area first that way, the Intel GbE device can be enabled there, and only then would the refcode file be copied. otherwise, the current behaviour would leave buggy refcode in place, if the dd command failed. Signed-off-by: Leah Rowe --- include/mrc.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/mrc.sh b/include/mrc.sh index 00fb8626..edd35414 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -30,11 +30,13 @@ extract_refcode() mkdir -p "${_refdest%/*}" || err "ref: !mkdir -p ${_refdest%/*}" x_ "$cbfstoolref" "$appdir/bios.bin" extract \ - -m x86 -n fallback/refcode -f "$_refdest" -r RO_SECTION + -m x86 -n fallback/refcode -f "$appdir/ref" -r RO_SECTION # enable the Intel GbE device, if told by offset MRC_refcode_gbe [ -z "$MRC_refcode_gbe" ] || x_ dd if="config/ifd/hp820g2/1.bin" \ - of="$_refdest" bs=1 seek=$MRC_refcode_gbe count=1 conv=notrunc; : + of="$appdir/ref" bs=1 seek=$MRC_refcode_gbe count=1 conv=notrunc; : + + x_ mv "$appdir/ref" "$_refdest" } extract_shellball() From 81dbde7e09f06c7f227fd0d78498df6e1c269f84 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 9 May 2025 20:54:23 +0100 Subject: [PATCH 127/267] lbmk: use x_ instead of err, where appropriate many places in lbmk used err, because older versions of x_ did not handle globbing properly. however, use of x_ is preferable on trivial commands. the only time err() should be called is what it has to be, when x_ can't work, or when a more useful error message is needed, for context. Signed-off-by: Leah Rowe --- include/git.sh | 6 +++--- include/init.sh | 4 ++-- include/inject.sh | 27 +++++++++++++-------------- include/lib.sh | 2 +- include/mrc.sh | 10 +++++----- include/release.sh | 18 +++++++++--------- include/tree.sh | 2 +- 7 files changed, 34 insertions(+), 35 deletions(-) diff --git a/include/git.sh b/include/git.sh index 9440b1af..bbc5140e 100644 --- a/include/git.sh +++ b/include/git.sh @@ -61,7 +61,7 @@ git_prep() [ "$XBMK_RELEASE" = "y" ] && rmgit "$tmpgit" [ "$_loc" = "${_loc%/*}" ] || x_ mkdir -p "${_loc%/*}" - mv "$tmpgit" "$_loc" || err "git_prep: !mv $tmpgit $_loc" + x_ mv "$tmpgit" "$_loc" } fetch_submodule() @@ -82,7 +82,7 @@ fetch_submodule() [ "$st" = "file" ] && xbmkget "$subfile" "$subfile_bkup" \ "$tmpgit/$1" "$subhash" && return 0 - rm -Rf "$tmpgit/$1" || err "!rm '$mdir' '$1'" + x_ rm -Rf "$tmpgit/$1" tmpclone "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subhash" \ "$mdir/${1##*/}/patches" } @@ -101,6 +101,6 @@ nuke() { e "config/${1%/}/nuke.list" f missing || while read -r nukefile; do rmf="src/${2%/}/$nukefile" && [ -L "$rmf" ] && continue - e "$rmf" e missing || rm -Rf "$rmf" || err "!rm $rmf, ${2%/}" + e "$rmf" e missing || x_ rm -Rf "$rmf" done < "config/${1%/}/nuke.list"; : } diff --git a/include/init.sh b/include/init.sh index b9cb81b1..2eea04c0 100644 --- a/include/init.sh +++ b/include/init.sh @@ -45,7 +45,7 @@ xbmkpkg() eval "`setcfg "config/dependencies/$2"`" chkvars pkg_add pkglist - $pkg_add $pkglist || err "Cannot install packages" + x_ $pkg_add $pkglist [ -n "$aur_notice" ] && \ printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; : @@ -200,7 +200,7 @@ xbmk_create_pathdirs() ( # set up python v3.x in PATH, in case it's not set up correctly. # see code above that detected the correct python3 command. - cd "$XBMK_CACHE/xbmkpath" || err "can't cd $XBMK_CACHE/xbmkpath" + x_ cd "$XBMK_CACHE/xbmkpath" x_ ln -s "`pybin "$python"`" python ) || err "Can't set up python symlink in $XBMK_CACHE/xbmkpath"; : } diff --git a/include/inject.sh b/include/inject.sh index 8485d7e8..476b7eb0 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -121,7 +121,7 @@ fetch() dlop="curl" && [ $# -gt 5 ] && dlop="$6" xbmkget "$dl" "$dl_bkup" "$_dl" "$dlsum" "$dlop" - rm -Rf "${_dl}_extracted" || err "!rm ${_ul}_extracted. $dontflash" + x_ rm -Rf "${_dl}_extracted" e "$_dest" f && return 0 x_ mkdir -p "${_dest%/*}" @@ -219,7 +219,7 @@ extract_sch5545ec() _sch5545ec_fw="$_sch5545ec_fw/54 D386BEB8-4B54-4E69-94F5-06091F67E0D3" _sch5545ec_fw="$_sch5545ec_fw/0 Raw section/body.bin" # <-- this! - "$uefiextract" "$_bios" || err "sch5545 !extract - $dontflash" + x_ "$uefiextract" "$_bios" x_ cp "$_sch5545ec_fw" "$_dest" } @@ -345,7 +345,7 @@ patch_release_roms() fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" ( - cd "$tmpromdir" || err "patch '$archive': can't cd $tmpromdir" + x_ cd "$tmpromdir" # NOTE: For compatibility with older rom releases, defer to sha1 if [ "$has_hashes" = "y" ] && [ "$nukemode" != "nuke" ]; then sha512sum --status -c "$hashfile" || \ @@ -385,7 +385,7 @@ prep() [ $xromsize -lt 524288 ] && err "too small, $xromsize: $_xrom" x_ dd if="$_xrom" of="$_xromnew" bs=$xromsize count=1 - rm -f "$_xrom" || err "Can't rm $_xrom - $dontflash" + x_ rm -f "$_xrom" _xrom="$_xromnew" fi @@ -455,21 +455,20 @@ insert() [ "$nukemode" = "nuke" ] || x_ e "$_dest" f if [ "$cbfsname" = "IFD" ]; then - [ "$nukemode" = "nuke" ] || "$ifdtool" $ifdprefix -i \ - $_t:$_dest "$rom" -O "$rom" || \ - err "failed: insert '$_t' '$_dest' on '$rom'" - [ "$nukemode" != "nuke" ] || "$ifdtool" $ifdprefix --nuke $_t \ - "$rom" -O "$rom" || err "$rom: !nuke IFD/$_t" + [ "$nukemode" = "nuke" ] || x_ "$ifdtool" $ifdprefix -i \ + $_t:$_dest "$rom" -O "$rom" + [ "$nukemode" != "nuke" ] || x_ "$ifdtool" $ifdprefix --nuke \ + $_t "$rom" -O "$rom" elif [ "$nukemode" = "nuke" ]; then x_ "$cbfstool" "$rom" remove -n "$cbfsname" elif [ "$_t" = "stage" ]; then # the only stage we handle is refcode x_ rm -f "$xbmklocal/refcode" - "$rmodtool" -i "$_dest" -o "$xbmklocal/refcode" || "!reloc ref" - "$cbfstool" "$rom" add-stage -f "$xbmklocal/refcode" \ - -n "$cbfsname" -t stage || err "$rom: !add ref" + x_ "$rmodtool" -i "$_dest" -o "$xbmklocal/refcode" + x_ "$cbfstool" "$rom" add-stage -f "$xbmklocal/refcode" \ + -n "$cbfsname" -t stage else - "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \ - -t $_t $_offset || err "$rom !add $_t ($_dest)" + x_ "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \ + -t $_t $_offset fi xchanged="y"; : } diff --git a/include/lib.sh b/include/lib.sh index 99e59a1a..2f87e8b1 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -58,7 +58,7 @@ xbmkget() for url in "$1" "$2"; do [ "$dl_fail" = "n" ] && break [ -z "$url" ] && continue - rm -f "$cached" || err "!rm -f '$cached'" + x_ rm -f "$cached" if [ "$_dlop" = "curl" ]; then curl --location --retry 3 -A "$_ua" "$url" \ -o "$cached" || wget --tries 3 -U "$_ua" "$url" \ diff --git a/include/mrc.sh b/include/mrc.sh index edd35414..3b3089fc 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -10,8 +10,8 @@ extract_mrc() { extract_shellball - "$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ - -f "$_dest" -r RO_SECTION || err "extract_mrc: !$cbfstool $_dest" + x_ "$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ + -f "$_dest" -r RO_SECTION [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && extract_refcode extra; : } @@ -27,7 +27,7 @@ extract_refcode() # and refcode is extracted from an image using the old scheme. we use # cbfstool from coreboot 4.11_branch, the tree used by ASUS KGPE-D16 chkvars cbfstoolref - mkdir -p "${_refdest%/*}" || err "ref: !mkdir -p ${_refdest%/*}" + x_ mkdir -p "${_refdest%/*}" x_ "$cbfstoolref" "$appdir/bios.bin" extract \ -m x86 -n fallback/refcode -f "$appdir/ref" -r RO_SECTION @@ -60,8 +60,8 @@ extract_partition() START=$(( $( echo $ROOTP | cut -f2 -d\ | tr -d "B" ) )) SIZE=$(( $( echo $ROOTP | cut -f4 -d\ | tr -d "B" ) )) - dd if="${1%.zip}" of="root-a.ext2" bs=1024 skip=$(( $START / 1024 )) \ - count=$(( $SIZE / 1024 )) || err "ex dd ${1%.zip}, root-a.ext2" + x_ dd if="${1%.zip}" of="root-a.ext2" bs=1024 skip=$(( $START / 1024 )) \ + count=$(( $SIZE / 1024 )) printf "cd /usr/sbin\ndump chromeos-firmwareupdate %s\nquit" \ "$SHELLBALL" | debugfs "root-a.ext2" || err "!extract shellball" diff --git a/include/release.sh b/include/release.sh index 2f9f2b86..4741b44a 100644 --- a/include/release.sh +++ b/include/release.sh @@ -22,9 +22,9 @@ release() relsrcdir="$vdir/$src_dirname" [ -e "$vdir" ] && err "already exists: \"$vdir\"" - mkdir -p "$vdir" || err "mkvdir: !mkdir -p \"$vdir\"" - git clone . "$relsrcdir" || err "mkdir: !gitclone \"$relsrcdir\"" - touch "$relsrcdir/lock" || err "can't make lock file in $relsrcdir/" + x_ mkdir -p "$vdir" + x_ git clone . "$relsrcdir" + x_ touch "$relsrcdir/lock" build_release @@ -34,7 +34,7 @@ release() build_release() { ( - cd "$relsrcdir" || err "$vdir: !cd \"$relsrcdir\"" + x_ cd "$relsrcdir" x_ ./mk -f rmgit . @@ -43,17 +43,17 @@ build_release() git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \ --abbrev-commit > "$relsrcdir/CHANGELOG" || err "!log $relsrcdir" - rm -f "$relsrcdir/lock" || err "can't remove lock file in $relsrcdir" + x_ rm -f "$relsrcdir/lock" ( - cd "${relsrcdir%/*}" || err "$vdir: mktarball \"$relsrcdir\"" + x_ cd "${relsrcdir%/*}" x_ mktarball "${relsrcdir##*/}" "${relsrcdir##*/}.tar.xz" ) || err "can't create src tarball" [ "$relmode" = "src" ] && return 0 - touch "$relsrcdir/lock" || err "can't make lock file in $relsrcdir/" + x_ touch "$relsrcdir/lock" ( - cd "$relsrcdir" || err "$vdir: 2 !cd \"$relsrcdir\"" + x_ cd "$relsrcdir" x_ ./mk -d coreboot mk -b coreboot pico-serprog stm32-vserprog pcsx-redux @@ -61,5 +61,5 @@ build_release() x_ mv bin ../roms ) || err "can't build rom images" - rm -Rf "$relsrcdir" || err "!rm -Rf $relsrcdir" + x_ rm -Rf "$relsrcdir" } diff --git a/include/tree.sh b/include/tree.sh index 4d0c533d..47f65d10 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -322,7 +322,7 @@ check_cmake() check_autoconf() { ( - cd "$1" || err "!cd $1" + x_ cd "$1" [ -f "bootstrap" ] && x_ ./bootstrap $bootstrapargs [ -f "autogen.sh" ] && x_ ./autogen.sh $autogenargs [ -f "configure" ] && x_ ./configure $autoconfargs; : From 3554b5aad9c0076c3180715b9830eb6069b03b7c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 10 May 2025 10:24:16 +0100 Subject: [PATCH 128/267] inject.sh: split up the inject functions generally go for a more linear function order, and split up any functions. the objective is to have functions only suitable to libreboot be separate. more splitting will be done, and eventually the vendor-download functions will be split into a new file, as will several other functions. this is being done as part of an effort to bring the libreboot and canoeboot versions of inject.sh in sync, so that from now on, cherry picking between the two projects will produce fewer merge conflicts and require a lesser amount of post-merge maintenance. some other minor cleanup has also been done; for example, the "need_files" variable is redundant and was removed. Signed-off-by: Leah Rowe --- include/inject.sh | 159 +++++++++++++++++++++++----------------------- 1 file changed, 80 insertions(+), 79 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 476b7eb0..7ec4e42b 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -34,38 +34,14 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ mecleaner kbc1126_ec_dump MRC_refcode_cbtree new_mac _dl SCH5545EC_DL_url \ archive EC_url boarddir rom cbdir DL_url nukemode cbfstoolref FSPFD_hash \ _7ztest ME11bootguard ME11delta ME11version ME11sku ME11pch tmpromdir \ - IFD_platform ifdprefix _me _metmp mfs TBFW_url_bkup TBFW_url \ - TBFW_hash TBFW_size hashfile xromsize xchanged EC_url_bkup need_files \ - vfile cbcfg $cv`" + IFD_platform ifdprefix _me _metmp mfs TBFW_url_bkup TBFW_url TBFW_hash \ + TBFW_size hashfile xromsize xchanged EC_url_bkup vfile cbcfg $cv`" download() { [ $# -gt 0 ] || err "No argument given" export PATH="$PATH:/sbin" - board="$1" && readcfg && readkconfig && bootstrap && getfiles; : -} - -readkconfig() -{ - x_ rm -f "$xbmktmp/cbcfg" - fx_ scankconfig x_ find "$boarddir/config" -type f - - eval "`setcfg "$xbmktmp/cbcfg" 1`" - - for c in $cvchk; do - eval "[ \"\${$c}\" = \"/dev/null\" ] && continue" - eval "[ -z \"\${$c}\" ] && continue" - eval "`setcfg "$vfile"`" - return 0 - done - return 1 -} - -scankconfig() -{ - for cbc in $cv; do - grep "$cbc" "$1" 1>>"$xbmktmp/cbcfg" 2>/dev/null || : - done + board="$1" && readvcfg && readkconfig && bootstrap && getfiles; : } bootstrap() @@ -244,7 +220,6 @@ extract_fsp() inject() { - need_files="n" remkdir "$tmpromdel" set +u +e @@ -261,47 +236,46 @@ inject() setmac) [ $# -gt 2 ] && new_mac="$3" && \ [ -z "$new_mac" ] && err "Empty MAC address specified" ;; - *) err "Unrecognised inject mode: '$2'" + *) + err "Unrecognised inject mode: '$2'" esac [ "$new_mac" = "keep" ] && new_mac="" [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ x_ make -C util/nvmutil clean && x_ make -C util/nvmutil - check_release "$archive" || err "'$archive' is not a release archive" + check_release + readvcfg && patch_release - readcfg && need_files="y" - if [ "$need_files" = "y" ] || [ -n "$new_mac" ]; then - [ "$nukemode" != "nuke" ] && [ "$need_files" = "y" ] && \ - x_ ./mk download "$board" - patch_release_roms - fi + [ "$xchanged" = "y" ] && remktar - xtype="patched" && [ "$nukemode" = "nuke" ] && xtype="nuked" - [ "$xchanged" != "y" ] && printf "\n'%s' *NOT* modified.\n" "$archive" - [ "$xchanged" = "y" ] && printf "\n'%s' %s.\n" "$archive" "$xtype"; : + xnot=" NOT" && [ "$xchanged" = "y" ] && xnot="" + printf "\n'%s' was%s modified\n" "$archive" "$xnot" 1>&2 + + x_ rm -Rf "$tmpromdel" } check_release() { [ -L "$archive" ] && err "'$archive' is a symlink. $dontflash" - e "$archive" f missing && return 1 + e "$archive" f missing && err "'$archive' missing" - archivename="`basename "$archive"`" + archivename="`basename "$archive"`" || err "Can't get '$archive' name" [ -z "$archivename" ] && err "Can't determine archive name. $dontflash" case "$archivename" in *_src.tar.xz) err "'$archive' is a src archive, silly!" ;; grub_*|seagrub_*|custom_*|seauboot_*|seabios_withgrub_*) - return 1 ;; + err "'$archive' is a ROM image (it must be a tarball)" ;; *.tar.xz) _stripped_prefix="${archivename#*_}" board="${_stripped_prefix%.tar.xz}" ;; - *) err "'$archive': could not detect board type - $dontflash" + *) + err "'$archive': could not detect board type - $dontflash" esac; : } -readcfg() +readvcfg() { if [ "$board" = "serprog_rp2040" ] || [ "$board" = "serprog_stm32" ] \ || [ "$board" = "serprog_pico" ]; then @@ -328,8 +302,10 @@ readcfg() [ -n "$IFD_platform" ] && ifdprefix="-p $IFD_platform"; : } -patch_release_roms() +patch_release() { + [ "$nukemode" = "nuke" ] || x_ ./mk download "$board" + has_hashes="n" tmpromdir="$xbmklocal/DO_NOT_FLASH/bin/$board" @@ -337,35 +313,41 @@ patch_release_roms() x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}" for _hashes in $hashfiles; do - [ "$need_files" = "y" ] && e "$tmpromdir/$_hashes" f && \ + e "$tmpromdir/$_hashes" f && \ has_hashes="y" && hashfile="$_hashes" && break; : done - readkconfig || exit 0; [ "$need_files" = "n" ] || \ - fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + readkconfig || exit 0 + fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" - ( - x_ cd "$tmpromdir" - # NOTE: For compatibility with older rom releases, defer to sha1 - if [ "$has_hashes" = "y" ] && [ "$nukemode" != "nuke" ]; then - sha512sum --status -c "$hashfile" || \ - x_ sha1sum --status -c "$hashfile" - x_ rm -f "$hashfile" - fi - ) || err "'$archive' -> Can't verify vendor hashes. $dontflash" + ( check_vendor_hashes ) || err "Can't verify hashes for '$archive'"; : - [ -z "$new_mac" ] || [ -z "$CONFIG_GBE_BIN_PATH" ] || modify_mac + [ -n "$new_mac" ] && [ -n "$CONFIG_GBE_BIN_PATH" ] && modify_mac; : +} - [ "$xchanged" = "y" ] || rm -Rf "$tmpromdel" || : - [ "$xchanged" = "y" ] || return 0 +readkconfig() +{ + x_ rm -f "$xbmktmp/cbcfg" + fx_ scankconfig x_ find "$boarddir/config" -type f + eval "`setcfg "$xbmktmp/cbcfg" 1`" + setvfile_kconfig && return 1; : +} - ( - x_ cd "${tmpromdir%"/bin/$board"}" - mkrom_tarball "bin/$board" - ) || err "Cannot re-generate '$archive' - $dontflash" +setvfile_kconfig() +{ + for c in $cvchk; do + eval "[ \"\${$c}\" = \"/dev/null\" ] && continue" + eval "[ -z \"\${$c}\" ] && continue" + eval "`setcfg "$vfile"`" + return 1 + done +} - mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \ - "$archive" || err "'$archive' -> Can't overwrite - $dontflash"; : +scankconfig() +{ + for cbc in $cv; do + grep "$cbc" "$1" 1>>"$xbmktmp/cbcfg" 2>/dev/null || : + done } prep() @@ -392,7 +374,7 @@ prep() [ "$nukemode" = "nuke" ] && mksha512sum "$_xrom" "vendorhashes" - patch_rom "$_xrom" || return 1 # if break return, can still change MAC + add_vfiles "$_xrom" || return 1 # if break return, can still change MAC [ "$nukemode" != "nuke" ] && return 0 # Rename the file, prefixing a warning saying not to flash @@ -400,7 +382,7 @@ prep() x_ rm -f "$_xrom" } -patch_rom() +add_vfiles() { rom="$1" @@ -412,31 +394,31 @@ patch_rom() return 1 fi - [ -n "$CONFIG_HAVE_REFCODE_BLOB" ] && insert "fallback/refcode" \ + [ -n "$CONFIG_HAVE_REFCODE_BLOB" ] && vfile "fallback/refcode" \ "$CONFIG_REFCODE_BLOB_FILE" "stage" - [ "$CONFIG_HAVE_MRC" = "y" ] && insert "mrc.bin" "$CONFIG_MRC_FILE" \ + [ "$CONFIG_HAVE_MRC" = "y" ] && vfile "mrc.bin" "$CONFIG_MRC_FILE" \ "mrc" "0xfffa0000" - [ "$CONFIG_HAVE_ME_BIN" = "y" ] && insert IFD "$CONFIG_ME_BIN_PATH" me - [ "$CONFIG_KBC1126_FIRMWARE" = "y" ] && insert ecfw1.bin \ - "$CONFIG_KBC1126_FW1" raw "$CONFIG_KBC1126_FW1_OFFSET" && insert \ + [ "$CONFIG_HAVE_ME_BIN" = "y" ] && vfile IFD "$CONFIG_ME_BIN_PATH" me + [ "$CONFIG_KBC1126_FIRMWARE" = "y" ] && vfile ecfw1.bin \ + "$CONFIG_KBC1126_FW1" raw "$CONFIG_KBC1126_FW1_OFFSET" && vfile \ ecfw2.bin "$CONFIG_KBC1126_FW2" raw "$CONFIG_KBC1126_FW2_OFFSET" [ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ] && \ - insert "pci$CONFIG_VGA_BIOS_ID.rom" "$CONFIG_VGA_BIOS_FILE" optionrom + vfile "pci$CONFIG_VGA_BIOS_ID.rom" "$CONFIG_VGA_BIOS_FILE" optionrom [ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \ [ -n "$CONFIG_SMSC_SCH5545_EC_FW_FILE" ] && \ - insert sch5545_ecfw.bin "$CONFIG_SMSC_SCH5545_EC_FW_FILE" raw + vfile sch5545_ecfw.bin "$CONFIG_SMSC_SCH5545_EC_FW_FILE" raw [ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \ [ -n "$CONFIG_FSP_M_FILE" ] && \ - insert "$CONFIG_FSP_M_CBFS" "$CONFIG_FSP_M_FILE" fsp --xip + vfile "$CONFIG_FSP_M_CBFS" "$CONFIG_FSP_M_FILE" fsp --xip [ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \ [ -n "$CONFIG_FSP_S_FILE" ] && \ - insert "$CONFIG_FSP_S_CBFS" "$CONFIG_FSP_S_FILE" fsp + vfile "$CONFIG_FSP_S_CBFS" "$CONFIG_FSP_S_FILE" fsp printf "ROM image successfully patched: %s\n" "$rom" xchanged="y" } -insert() +vfile() { [ "$2" = "/dev/null" ] && return 0 @@ -449,7 +431,7 @@ insert() if [ "$_t" = "fsp" ] && [ $# -gt 3 ]; then _offset="$4" elif [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ]; then - err "insert $*, $rom: offset given but empty (undefined)" + err "vfile $*, $rom: offset given but empty (undefined)" fi [ "$nukemode" = "nuke" ] || x_ e "$_dest" f @@ -473,6 +455,14 @@ insert() xchanged="y"; : } +check_vendor_hashes() +{ + x_ cd "$tmpromdir" + [ "$has_hashes" = "n" ] || [ "$nukemode" = "nuke" ] || sha512sum \ + --status -c "$hashfile" || x_ sha1sum --status -c "$hashfile" + x_ rm -f "$hashfile" +} + modify_mac() { x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbmklocal/gbe" @@ -487,3 +477,14 @@ newmac() e "$1" f && xchanged="y" && x_ \ "$ifdtool" $ifdprefix -i GbE:"$xbmklocal/gbe" "$1" -O "$1"; : } + +remktar() +{ + ( + x_ cd "${tmpromdir%"/bin/$board"}" + mkrom_tarball "bin/$board" + ) || err "Cannot re-generate '$archive' - $dontflash" + + mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \ + "$archive" || err "'$archive' -> Can't overwrite"; : +} From 0f931b508a8eb34e70b2ed3628ac4fe74f22b8e8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 10 May 2025 12:32:05 +0100 Subject: [PATCH 129/267] inject.sh: split to vendor.sh the download parts to the extent feasible, keep lbmk-specific parts on inject.sh to a minimum. this will later be used to re-sync cbmk's inject.sh with lbmk's, because cbmk's one doesn't handle vendor files. the way this is designed now, with this patch, will make cherry-picking lbmk to cbmk easier in the future, when keeping this part of cbmk in sync with lbmk. Signed-off-by: Leah Rowe --- include/init.sh | 2 +- include/inject.sh | 347 ++------------------------------------------- include/vendor.sh | 354 ++++++++++++++++++++++++++++++++++++++++++++++ mk | 1 + 4 files changed, 366 insertions(+), 338 deletions(-) create mode 100644 include/vendor.sh diff --git a/include/init.sh b/include/init.sh index 2eea04c0..2dd9e88f 100644 --- a/include/init.sh +++ b/include/init.sh @@ -16,7 +16,7 @@ xbmkpath="$PATH" eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \ datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver xbmklocal \ - xbmklock`" + xbmklock cvxbmk cvchk`" xbmk_init() { diff --git a/include/inject.sh b/include/inject.sh index 7ec4e42b..ce61350a 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -3,12 +3,6 @@ # Copyright (c) 2022 Ferass El Hafidi # Copyright (c) 2023-2025 Leah Rowe -e6400_unpack="$xbmkpwd/src/bios_extract/dell_inspiron_1100_unpacker.py" -me7updateparser="$xbmkpwd/util/me7_update_parser/me7_update_parser.py" -pfs_extract="$xbmkpwd/src/biosutilities/Dell_PFS_Extract.py" -uefiextract="$xbmkpwd/elf/uefitool/uefiextract" -vendir="vendorfiles" -appdir="$vendir/app" cbcfgsdir="config/coreboot" hashfiles="vendorhashes blobhashes" # blobhashes for backwards compatibility dontflash="!!! AN ERROR OCCURED! Please DO NOT flash if injection failed. !!!" @@ -17,206 +11,12 @@ tmpromdel="$xbmklocal/DO_NOT_FLASH" nvm="util/nvmutil/nvm" ifdtool="elf/ifdtool/default/ifdtool" -cvchk="CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN CONFIG_KBC1126_FIRMWARE \ - CONFIG_VGA_BIOS_FILE CONFIG_INCLUDE_SMSC_SCH5545_EC_FW \ - CONFIG_LENOVO_TBFW_BIN CONFIG_FSP_M_FILE CONFIG_FSP_S_FILE" +cv="CONFIG_GBE_BIN_PATH" +[ -n "$cvxbmk" ] && cv="$cv $cvxbmk" +[ -n "$cvchk" ] && cv="$cv $cvchk" -cv="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE CONFIG_KBC1126_FW1 \ - CONFIG_KBC1126_FW2 CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2_OFFSET \ - CONFIG_VGA_BIOS_ID CONFIG_BOARD_DELL_E6400 CONFIG_FSP_S_CBFS \ - CONFIG_HAVE_REFCODE_BLOB CONFIG_REFCODE_BLOB_FILE CONFIG_GBE_BIN_PATH \ - CONFIG_IFD_BIN_PATH CONFIG_FSP_FD_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS \ - CONFIG_FSP_USE_REPO CONFIG_FSP_FULL_FD $cvchk" - -eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ - E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \ - E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest tree \ - mecleaner kbc1126_ec_dump MRC_refcode_cbtree new_mac _dl SCH5545EC_DL_url \ - archive EC_url boarddir rom cbdir DL_url nukemode cbfstoolref FSPFD_hash \ - _7ztest ME11bootguard ME11delta ME11version ME11sku ME11pch tmpromdir \ - IFD_platform ifdprefix _me _metmp mfs TBFW_url_bkup TBFW_url TBFW_hash \ - TBFW_size hashfile xromsize xchanged EC_url_bkup vfile cbcfg $cv`" - -download() -{ - [ $# -gt 0 ] || err "No argument given" - export PATH="$PATH:/sbin" - board="$1" && readvcfg && readkconfig && bootstrap && getfiles; : -} - -bootstrap() -{ - x_ ./mk -f coreboot ${cbdir##*/} - mk -b uefitool biosutilities bios_extract - [ -d "${kbc1126_ec_dump%/*}" ] && x_ make -C "$cbdir/util/kbc1126" - [ -n "$MRC_refcode_cbtree" ] && \ - cbfstoolref="elf/cbfstool/$MRC_refcode_cbtree/cbfstool" && \ - x_ ./mk -d coreboot "$MRC_refcode_cbtree"; : -} - -getfiles() -{ - [ -z "$CONFIG_HAVE_ME_BIN" ] || fetch intel_me "$DL_url" \ - "$DL_url_bkup" "$DL_hash" "$CONFIG_ME_BIN_PATH" - [ -z "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" ] || fetch sch5545ec \ - "$SCH5545EC_DL_url" "$SCH5545EC_DL_url_bkup" "$SCH5545EC_DL_hash" \ - "$CONFIG_SMSC_SCH5545_EC_FW_FILE" - [ -z "$CONFIG_KBC1126_FIRMWARE" ] || fetch kbc1126ec "$EC_url" \ - "$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW1" - [ -z "$CONFIG_VGA_BIOS_FILE" ] || fetch e6400vga "$E6400_VGA_DL_url" \ - "$E6400_VGA_DL_url_bkup" "$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE" - [ -z "$CONFIG_HAVE_MRC" ] || fetch "mrc" "$MRC_url" "$MRC_url_bkup" \ - "$MRC_hash" "$CONFIG_MRC_FILE" - [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && fetch "refcode" "$MRC_url" \ - "$MRC_url_bkup" "$MRC_hash" "$CONFIG_REFCODE_BLOB_FILE" - [ -z "$CONFIG_LENOVO_TBFW_BIN" ] || fetch "tbfw" "$TBFW_url" \ - "$TBFW_url_bkup" "$TBFW_hash" "$CONFIG_LENOVO_TBFW_BIN" - [ -z "$CONFIG_FSP_M_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ - "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_M_FILE" copy - [ -z "$CONFIG_FSP_S_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ - "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_S_FILE" copy; : -} - -fetch() -{ - dl_type="$1" - dl="$2" - dl_bkup="$3" - dlsum="$4" - _dest="${5##*../}" - - [ "$5" = "/dev/null" ] && return 0 - _dl="$XBMK_CACHE/file/$dlsum" - # HACK: if grabbing fsp from coreboot, fix the path for lbmk - [ "$dl_type" = "fsp" ] && for _cdl in dl dl_bkup; do - eval "$_cdl=\"\${$_cdl##*../}\"; _cdp=\"\$$_cdl\"" - [ -f "$_cdp" ] || _cdp="$cbdir/$_cdp" - [ -f "$_cdp" ] && eval "$_cdl=\"$_cdp\"" - done; : - - dlop="curl" && [ $# -gt 5 ] && dlop="$6" - xbmkget "$dl" "$dl_bkup" "$_dl" "$dlsum" "$dlop" - - x_ rm -Rf "${_dl}_extracted" - e "$_dest" f && return 0 - - x_ mkdir -p "${_dest%/*}" - remkdir "$appdir" - [ "$dl_type" = "fsp" ] || extract_archive "$_dl" "$appdir" || \ - [ "$dl_type" = "e6400vga" ] || err "$_dest $dl_type: !extract" - - x_ extract_$dl_type "$_dl" "$appdir" - set -u -e - e "$_dest" f missing && err "!extract_$dl_type. $dontflash"; : -} - -extract_intel_me() -{ - e "$mecleaner" f not && err "$cbdir: me_cleaner missing. $dontflash" - - _7ztest="$xbmklocal/metmp/a" - _me="$xbmkpwd/$_dest" - _metmp="$xbmklocal/me.bin" - x_ rm -f "$_metmp" "$xbmklocal/a" - - mfs="" && [ "$ME11bootguard" = "y" ] && mfs="--whitelist MFS" && \ - chkvars ME11delta ME11version ME11sku ME11pch - [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard - - set +u +e - x_ rm -Rf "$xbmkpwd/metmp" - ( fx_ find_me x_ find "$xbmkpwd/$appdir" -type f ) || : - [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 - - ( - x_ cd src/deguard/ - x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ - "$ME11version" --pch "$ME11pch" --sku "$ME11sku" \ - --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_me" - ) || err "Error running deguard for $_me - $dontflash"; : -} - -find_me() -{ - [ -f "$_metmp" ] && exit 1 - [ -L "$1" ] && return 0 - - _7ztest="${_7ztest}a" && _r="-r" && [ -n "$mfs" ] && _r="" - - "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" || \ - "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ - -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 - - [ -f "$_metmp" ] && exit 1 - ( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : -} - -extract_archive() -{ - innoextract "$1" -d "$2" || python "$pfs_extract" "$1" -e || 7z x \ - "$1" -o"$2" || unar "$1" -o "$2" || unzip "$1" -d "$2" || return 1 - - [ ! -d "${_dl}_extracted" ] || x_ cp -R "${_dl}_extracted" "$2"; : -} - -extract_kbc1126ec() -{ - ( - x_ cd "$appdir/" - mv Rompaq/68*.BIN ec.bin || unar -D ROM.CAB Rom.bin || unar -D \ - Rom.CAB Rom.bin || unar -D 68*.CAB Rom.bin || err "!kbc1126 unar" - [ -f "ec.bin" ] || x_ mv Rom.bin ec.bin - x_ e ec.bin f && x_ "$kbc1126_ec_dump" ec.bin - ) || err "$board: can't extract kbc1126 ec firmware - $dontflash" - - x_ e "$appdir/ec.bin.fw1" f && x_ e "$appdir/ec.bin.fw2" f - x_ cp "$appdir/"ec.bin.fw* "${_dest%/*}/" -} - -extract_e6400vga() -{ - set +u +e - chkvars E6400_VGA_offset E6400_VGA_romname - tail -c +$E6400_VGA_offset "$_dl" | gunzip > "$appdir/bios.bin" || : - ( - x_ cd "$appdir" - x_ e "bios.bin" f - "$e6400_unpack" bios.bin || printf "TODO: fix dell extract util\n" - ) || err "can't extract e6400 vga rom - $dontflosh" - x_ cp "$appdir/$E6400_VGA_romname" "$_dest" -} - -extract_sch5545ec() -{ - # full system ROM (UEFI), to extract with UEFIExtract: - _bios="${_dl}_extracted/Firmware/1 $dlsum -- 1 System BIOS vA.28.bin" - # this is the SCH5545 firmware, inside of the extracted UEFI ROM: - _sch5545ec_fw="$_bios.dump/4 7A9354D9-0468-444A-81CE-0BF617D890DF" - _sch5545ec_fw="$_sch5545ec_fw/54 D386BEB8-4B54-4E69-94F5-06091F67E0D3" - _sch5545ec_fw="$_sch5545ec_fw/0 Raw section/body.bin" # <-- this! - - x_ "$uefiextract" "$_bios" - x_ cp "$_sch5545ec_fw" "$_dest" -} - -# Lenovo ThunderBolt firmware updates: -# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988 -extract_tbfw() -{ - chkvars TBFW_size; fx_ copytb x_ find "$appdir" -type f -name "TBT.bin" -} - -copytb() -{ - [ -f "$1" ] && [ ! -L "$1" ] && x_ dd if=/dev/null of="$1" bs=1 \ - seek=$TBFW_size && x_ mv "$1" "$_dest" && return 1; : -} - -extract_fsp() -{ - x_ python "$cbdir/3rdparty/fsp/Tools/SplitFspBin.py" split -f "$1" \ - -o "${_dest%/*}" -n "Fsp.fd" -} +eval "`setvars "" archive boarddir cbdir IFD_platform ifdprefix tree new_mac \ + tmpromdir $cv`" inject() { @@ -245,7 +45,7 @@ inject() x_ make -C util/nvmutil clean && x_ make -C util/nvmutil check_release - readvcfg && patch_release + check_target && patch_release [ "$xchanged" = "y" ] && remktar @@ -275,7 +75,7 @@ check_release() esac; : } -readvcfg() +check_target() { if [ "$board" = "serprog_rp2040" ] || [ "$board" = "serprog_stm32" ] \ || [ "$board" = "serprog_pico" ]; then @@ -286,11 +86,7 @@ readvcfg() eval "`setcfg "$boarddir/target.cfg"`" chkvars tree && x_ ./mk -d coreboot "$tree" - [ -z "$vcfg" ] && return 1 - - vfile="config/vendor/$vcfg/pkg.cfg" - [ -L "$vfile" ] && err "'$archive', '$board': $vfile is a symlink" - [ -f "$vfile" ] || err "'$archive', '$board': $vfile doesn't exist" + [ -n "$vcfg" ] && check_vcfg cbdir="src/coreboot/$tree" cbfstool="elf/cbfstool/$tree/cbfstool" @@ -318,8 +114,8 @@ patch_release() done readkconfig || exit 0 - fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" ( check_vendor_hashes ) || err "Can't verify hashes for '$archive'"; : [ -n "$new_mac" ] && [ -n "$CONFIG_GBE_BIN_PATH" ] && modify_mac; : @@ -330,17 +126,7 @@ readkconfig() x_ rm -f "$xbmktmp/cbcfg" fx_ scankconfig x_ find "$boarddir/config" -type f eval "`setcfg "$xbmktmp/cbcfg" 1`" - setvfile_kconfig && return 1; : -} - -setvfile_kconfig() -{ - for c in $cvchk; do - eval "[ \"\${$c}\" = \"/dev/null\" ] && continue" - eval "[ -z \"\${$c}\" ] && continue" - eval "`setcfg "$vfile"`" - return 1 - done + setvfile && return 1; : } scankconfig() @@ -350,119 +136,6 @@ scankconfig() done } -prep() -{ - _xrom="$1" - _xromname="${1##*/}" - _xromnew="${_xrom%/*}/${_xromname#"$vfix"}" - [ "$nukemode" = "nuke" ] && _xromnew="${_xrom%/*}/$vfix${_xrom##*/}" - - e "$_xrom" f missing && return 0 - [ -z "${_xromname#"$vfix"}" ] && err "$_xromname / $vfix: name match" - - # Remove the prefix and 1-byte pad - if [ "$nukemode" != "nuke" ] && \ - [ "${_xromname#"$vfix"}" != "$_xromname" ]; then - xromsize="$(expr $(stat -c '%s' "$_xrom") - 1)" || err "!int" - [ $xromsize -lt 524288 ] && err "too small, $xromsize: $_xrom" - - x_ dd if="$_xrom" of="$_xromnew" bs=$xromsize count=1 - x_ rm -f "$_xrom" - - _xrom="$_xromnew" - fi - - [ "$nukemode" = "nuke" ] && mksha512sum "$_xrom" "vendorhashes" - - add_vfiles "$_xrom" || return 1 # if break return, can still change MAC - [ "$nukemode" != "nuke" ] && return 0 - - # Rename the file, prefixing a warning saying not to flash - cat "$_xrom" config/data/coreboot/0 > "$_xromnew" || err "!pad $_xrom" - x_ rm -f "$_xrom" -} - -add_vfiles() -{ - rom="$1" - - if [ "$has_hashes" != "y" ] && [ "$nukemode" != "nuke" ]; then - printf "'%s' has no hash file. Skipping.\n" "$archive" 1>&2 - return 1 - elif [ "$has_hashes" = "y" ] && [ "$nukemode" = "nuke" ]; then - printf "'%s' has a hash file. Skipping nuke.\n" "$archive" 1>&2 - return 1 - fi - - [ -n "$CONFIG_HAVE_REFCODE_BLOB" ] && vfile "fallback/refcode" \ - "$CONFIG_REFCODE_BLOB_FILE" "stage" - [ "$CONFIG_HAVE_MRC" = "y" ] && vfile "mrc.bin" "$CONFIG_MRC_FILE" \ - "mrc" "0xfffa0000" - [ "$CONFIG_HAVE_ME_BIN" = "y" ] && vfile IFD "$CONFIG_ME_BIN_PATH" me - [ "$CONFIG_KBC1126_FIRMWARE" = "y" ] && vfile ecfw1.bin \ - "$CONFIG_KBC1126_FW1" raw "$CONFIG_KBC1126_FW1_OFFSET" && vfile \ - ecfw2.bin "$CONFIG_KBC1126_FW2" raw "$CONFIG_KBC1126_FW2_OFFSET" - [ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ] && \ - vfile "pci$CONFIG_VGA_BIOS_ID.rom" "$CONFIG_VGA_BIOS_FILE" optionrom - [ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \ - [ -n "$CONFIG_SMSC_SCH5545_EC_FW_FILE" ] && \ - vfile sch5545_ecfw.bin "$CONFIG_SMSC_SCH5545_EC_FW_FILE" raw - [ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \ - [ -n "$CONFIG_FSP_M_FILE" ] && \ - vfile "$CONFIG_FSP_M_CBFS" "$CONFIG_FSP_M_FILE" fsp --xip - [ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \ - [ -n "$CONFIG_FSP_S_FILE" ] && \ - vfile "$CONFIG_FSP_S_CBFS" "$CONFIG_FSP_S_FILE" fsp - - printf "ROM image successfully patched: %s\n" "$rom" - xchanged="y" -} - -vfile() -{ - [ "$2" = "/dev/null" ] && return 0 - - cbfsname="$1" - _dest="${2##*../}" - _t="$3" - - _offset="" - - if [ "$_t" = "fsp" ] && [ $# -gt 3 ]; then - _offset="$4" - elif [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ]; then - err "vfile $*, $rom: offset given but empty (undefined)" - fi - - [ "$nukemode" = "nuke" ] || x_ e "$_dest" f - - if [ "$cbfsname" = "IFD" ]; then - [ "$nukemode" = "nuke" ] || x_ "$ifdtool" $ifdprefix -i \ - $_t:$_dest "$rom" -O "$rom" - [ "$nukemode" != "nuke" ] || x_ "$ifdtool" $ifdprefix --nuke \ - $_t "$rom" -O "$rom" - elif [ "$nukemode" = "nuke" ]; then - x_ "$cbfstool" "$rom" remove -n "$cbfsname" - elif [ "$_t" = "stage" ]; then # the only stage we handle is refcode - x_ rm -f "$xbmklocal/refcode" - x_ "$rmodtool" -i "$_dest" -o "$xbmklocal/refcode" - x_ "$cbfstool" "$rom" add-stage -f "$xbmklocal/refcode" \ - -n "$cbfsname" -t stage - else - x_ "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \ - -t $_t $_offset - fi - xchanged="y"; : -} - -check_vendor_hashes() -{ - x_ cd "$tmpromdir" - [ "$has_hashes" = "n" ] || [ "$nukemode" = "nuke" ] || sha512sum \ - --status -c "$hashfile" || x_ sha1sum --status -c "$hashfile" - x_ rm -f "$hashfile" -} - modify_mac() { x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbmklocal/gbe" diff --git a/include/vendor.sh b/include/vendor.sh new file mode 100644 index 00000000..bc329398 --- /dev/null +++ b/include/vendor.sh @@ -0,0 +1,354 @@ +# SPDX-License-Identifier: GPL-3.0-only +# Copyright (c) 2022 Caleb La Grange +# Copyright (c) 2022 Ferass El Hafidi +# Copyright (c) 2023-2025 Leah Rowe + +# These are variables and functions, extending the functionality of +# inject.sh, to be used with lbmk; they are kept separate here, so that +# the main inject.sh can be as similar as possible between lbmk and cbmk, +# so that cherry-picking lbmk patches into cbmk yields fewer merge conflicts. + +# When reading this file, you should imagine that it is part of inject.sh, +# with inject.sh concatenated onto vendor.sh; they are inexorably intertwined. +# The main "mk" script sources vendor.sh first, and then inject.sh, in lbmk. + +e6400_unpack="$xbmkpwd/src/bios_extract/dell_inspiron_1100_unpacker.py" +me7updateparser="$xbmkpwd/util/me7_update_parser/me7_update_parser.py" +pfs_extract="$xbmkpwd/src/biosutilities/Dell_PFS_Extract.py" +uefiextract="$xbmkpwd/elf/uefitool/uefiextract" +vendir="vendorfiles" +appdir="$vendir/app" + +# lbmk-specific extension to the "cv" variable (not suitable for cbmk) +cvchk="CONFIG_INCLUDE_SMSC_SCH5545_EC_FW CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \ + CONFIG_KBC1126_FIRMWARE CONFIG_LENOVO_TBFW_BIN CONFIG_VGA_BIOS_FILE \ + CONFIG_FSP_M_FILE CONFIG_FSP_S_FILE" + +# lbmk-specific extensions to the "cv" variable (not suitable for cbmk) +cvxbmk="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE CONFIG_KBC1126_FW1 \ + CONFIG_KBC1126_FW2 CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2_OFFSET \ + CONFIG_VGA_BIOS_ID CONFIG_BOARD_DELL_E6400 CONFIG_FSP_S_CBFS \ + CONFIG_HAVE_REFCODE_BLOB CONFIG_REFCODE_BLOB_FILE CONFIG_FSP_FD_PATH \ + CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS" + +# lbmk-specific extensions; mostly used for downloading vendor files +eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ + E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \ + E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest \ + mecleaner kbc1126_ec_dump MRC_refcode_cbtree _dl SCH5545EC_DL_url \ + EC_url rom DL_url nukemode cbfstoolref FSPFD_hash \ + _7ztest ME11bootguard ME11delta ME11version ME11sku ME11pch \ + _me _metmp mfs TBFW_url_bkup TBFW_url TBFW_hash \ + TBFW_size hashfile xromsize xchanged EC_url_bkup vfile \ + CONFIG_FSP_USE_REPO CONFIG_FSP_FULL_FD`" + +download() +{ + [ $# -gt 0 ] || err "No argument given" + export PATH="$PATH:/sbin" + board="$1" && check_target && readkconfig && bootstrap && getfiles; : +} + +bootstrap() +{ + x_ ./mk -f coreboot ${cbdir##*/} + mk -b uefitool biosutilities bios_extract + [ -d "${kbc1126_ec_dump%/*}" ] && x_ make -C "$cbdir/util/kbc1126" + [ -n "$MRC_refcode_cbtree" ] && \ + cbfstoolref="elf/cbfstool/$MRC_refcode_cbtree/cbfstool" && \ + x_ ./mk -d coreboot "$MRC_refcode_cbtree"; : +} + +getfiles() +{ + [ -z "$CONFIG_HAVE_ME_BIN" ] || fetch intel_me "$DL_url" \ + "$DL_url_bkup" "$DL_hash" "$CONFIG_ME_BIN_PATH" + [ -z "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" ] || fetch sch5545ec \ + "$SCH5545EC_DL_url" "$SCH5545EC_DL_url_bkup" "$SCH5545EC_DL_hash" \ + "$CONFIG_SMSC_SCH5545_EC_FW_FILE" + [ -z "$CONFIG_KBC1126_FIRMWARE" ] || fetch kbc1126ec "$EC_url" \ + "$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW1" + [ -z "$CONFIG_VGA_BIOS_FILE" ] || fetch e6400vga "$E6400_VGA_DL_url" \ + "$E6400_VGA_DL_url_bkup" "$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE" + [ -z "$CONFIG_HAVE_MRC" ] || fetch "mrc" "$MRC_url" "$MRC_url_bkup" \ + "$MRC_hash" "$CONFIG_MRC_FILE" + [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && fetch "refcode" "$MRC_url" \ + "$MRC_url_bkup" "$MRC_hash" "$CONFIG_REFCODE_BLOB_FILE" + [ -z "$CONFIG_LENOVO_TBFW_BIN" ] || fetch "tbfw" "$TBFW_url" \ + "$TBFW_url_bkup" "$TBFW_hash" "$CONFIG_LENOVO_TBFW_BIN" + [ -z "$CONFIG_FSP_M_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ + "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_M_FILE" copy + [ -z "$CONFIG_FSP_S_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ + "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_S_FILE" copy; : +} + +fetch() +{ + dl_type="$1" + dl="$2" + dl_bkup="$3" + dlsum="$4" + _dest="${5##*../}" + + [ "$5" = "/dev/null" ] && return 0 + _dl="$XBMK_CACHE/file/$dlsum" + # HACK: if grabbing fsp from coreboot, fix the path for lbmk + [ "$dl_type" = "fsp" ] && for _cdl in dl dl_bkup; do + eval "$_cdl=\"\${$_cdl##*../}\"; _cdp=\"\$$_cdl\"" + [ -f "$_cdp" ] || _cdp="$cbdir/$_cdp" + [ -f "$_cdp" ] && eval "$_cdl=\"$_cdp\"" + done; : + + dlop="curl" && [ $# -gt 5 ] && dlop="$6" + xbmkget "$dl" "$dl_bkup" "$_dl" "$dlsum" "$dlop" + + x_ rm -Rf "${_dl}_extracted" + e "$_dest" f && return 0 + + x_ mkdir -p "${_dest%/*}" + remkdir "$appdir" + [ "$dl_type" = "fsp" ] || extract_archive "$_dl" "$appdir" || \ + [ "$dl_type" = "e6400vga" ] || err "$_dest $dl_type: !extract" + + x_ extract_$dl_type "$_dl" "$appdir" + set -u -e + e "$_dest" f missing && err "!extract_$dl_type. $dontflash"; : +} + +extract_intel_me() +{ + e "$mecleaner" f not && err "$cbdir: me_cleaner missing. $dontflash" + + _7ztest="$xbmklocal/metmp/a" + _me="$xbmkpwd/$_dest" + _metmp="$xbmklocal/me.bin" + x_ rm -f "$_metmp" "$xbmklocal/a" + + mfs="" && [ "$ME11bootguard" = "y" ] && mfs="--whitelist MFS" && \ + chkvars ME11delta ME11version ME11sku ME11pch + [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard + + set +u +e + x_ rm -Rf "$xbmkpwd/metmp" + ( fx_ find_me x_ find "$xbmkpwd/$appdir" -type f ) || : + [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 + + ( + x_ cd src/deguard/ + x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ + "$ME11version" --pch "$ME11pch" --sku "$ME11sku" \ + --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_me" + ) || err "Error running deguard for $_me - $dontflash"; : +} + +find_me() +{ + [ -f "$_metmp" ] && exit 1 + [ -L "$1" ] && return 0 + + _7ztest="${_7ztest}a" && _r="-r" && [ -n "$mfs" ] && _r="" + + "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" || \ + "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ + -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 + + [ -f "$_metmp" ] && exit 1 + ( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : +} + +extract_archive() +{ + innoextract "$1" -d "$2" || python "$pfs_extract" "$1" -e || 7z x \ + "$1" -o"$2" || unar "$1" -o "$2" || unzip "$1" -d "$2" || return 1 + + [ ! -d "${_dl}_extracted" ] || x_ cp -R "${_dl}_extracted" "$2"; : +} + +extract_kbc1126ec() +{ + ( + x_ cd "$appdir/" + mv Rompaq/68*.BIN ec.bin || unar -D ROM.CAB Rom.bin || unar -D \ + Rom.CAB Rom.bin || unar -D 68*.CAB Rom.bin || err "!kbc1126 unar" + [ -f "ec.bin" ] || x_ mv Rom.bin ec.bin + x_ e ec.bin f && x_ "$kbc1126_ec_dump" ec.bin + ) || err "$board: can't extract kbc1126 ec firmware - $dontflash" + + x_ e "$appdir/ec.bin.fw1" f && x_ e "$appdir/ec.bin.fw2" f + x_ cp "$appdir/"ec.bin.fw* "${_dest%/*}/" +} + +extract_e6400vga() +{ + set +u +e + chkvars E6400_VGA_offset E6400_VGA_romname + tail -c +$E6400_VGA_offset "$_dl" | gunzip > "$appdir/bios.bin" || : + ( + x_ cd "$appdir" + x_ e "bios.bin" f + "$e6400_unpack" bios.bin || printf "TODO: fix dell extract util\n" + ) || err "can't extract e6400 vga rom - $dontflosh" + x_ cp "$appdir/$E6400_VGA_romname" "$_dest" +} + +extract_sch5545ec() +{ + # full system ROM (UEFI), to extract with UEFIExtract: + _bios="${_dl}_extracted/Firmware/1 $dlsum -- 1 System BIOS vA.28.bin" + # this is the SCH5545 firmware, inside of the extracted UEFI ROM: + _sch5545ec_fw="$_bios.dump/4 7A9354D9-0468-444A-81CE-0BF617D890DF" + _sch5545ec_fw="$_sch5545ec_fw/54 D386BEB8-4B54-4E69-94F5-06091F67E0D3" + _sch5545ec_fw="$_sch5545ec_fw/0 Raw section/body.bin" # <-- this! + + x_ "$uefiextract" "$_bios" + x_ cp "$_sch5545ec_fw" "$_dest" +} + +# Lenovo ThunderBolt firmware updates: +# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988 +extract_tbfw() +{ + chkvars TBFW_size; fx_ copytb x_ find "$appdir" -type f -name "TBT.bin" +} + +copytb() +{ + [ -f "$1" ] && [ ! -L "$1" ] && x_ dd if=/dev/null of="$1" bs=1 \ + seek=$TBFW_size && x_ mv "$1" "$_dest" && return 1; : +} + +extract_fsp() +{ + x_ python "$cbdir/3rdparty/fsp/Tools/SplitFspBin.py" split -f "$1" \ + -o "${_dest%/*}" -n "Fsp.fd" +} + +check_vcfg() +{ + vfile="config/vendor/$vcfg/pkg.cfg" + [ -L "$vfile" ] && err "'$archive', '$board': $vfile is a symlink"; : + [ -f "$vfile" ] || err "'$archive', '$board': $vfile missing"; : +} + +setvfile() +{ + [ -n "$vfile" ] && for c in $cvchk; do + eval "[ \"\${$c}\" = \"/dev/null\" ] && continue" + eval "[ -z \"\${$c}\" ] && continue" + eval "`setcfg "$vfile"`" + return 1 + done && return 0; return 1 +} + +prep() +{ + _xrom="$1" + _xromname="${1##*/}" + _xromnew="${_xrom%/*}/${_xromname#"$vfix"}" + [ "$nukemode" = "nuke" ] && _xromnew="${_xrom%/*}/$vfix${_xrom##*/}" + + e "$_xrom" f missing && return 0 + [ -z "${_xromname#"$vfix"}" ] && err "$_xromname / $vfix: name match" + + # Remove the prefix and 1-byte pad + if [ "$nukemode" != "nuke" ] && \ + [ "${_xromname#"$vfix"}" != "$_xromname" ]; then + xromsize="$(expr $(stat -c '%s' "$_xrom") - 1)" || err "!int" + [ $xromsize -lt 524288 ] && err "too small, $xromsize: $_xrom" + + x_ dd if="$_xrom" of="$_xromnew" bs=$xromsize count=1 + x_ rm -f "$_xrom" + + _xrom="$_xromnew" + fi + + [ "$nukemode" = "nuke" ] && mksha512sum "$_xrom" "vendorhashes" + + add_vfiles "$_xrom" || return 1 # if break return, can still change MAC + [ "$nukemode" != "nuke" ] && return 0 + + # Rename the file, prefixing a warning saying not to flash + cat "$_xrom" config/data/coreboot/0 > "$_xromnew" || err "!pad $_xrom" + x_ rm -f "$_xrom" +} + +add_vfiles() +{ + rom="$1" + + if [ "$has_hashes" != "y" ] && [ "$nukemode" != "nuke" ]; then + printf "'%s' has no hash file. Skipping.\n" "$archive" 1>&2 + return 1 + elif [ "$has_hashes" = "y" ] && [ "$nukemode" = "nuke" ]; then + printf "'%s' has a hash file. Skipping nuke.\n" "$archive" 1>&2 + return 1 + fi + + [ -n "$CONFIG_HAVE_REFCODE_BLOB" ] && vfile "fallback/refcode" \ + "$CONFIG_REFCODE_BLOB_FILE" "stage" + [ "$CONFIG_HAVE_MRC" = "y" ] && vfile "mrc.bin" "$CONFIG_MRC_FILE" \ + "mrc" "0xfffa0000" + [ "$CONFIG_HAVE_ME_BIN" = "y" ] && vfile IFD "$CONFIG_ME_BIN_PATH" me + [ "$CONFIG_KBC1126_FIRMWARE" = "y" ] && vfile ecfw1.bin \ + "$CONFIG_KBC1126_FW1" raw "$CONFIG_KBC1126_FW1_OFFSET" && vfile \ + ecfw2.bin "$CONFIG_KBC1126_FW2" raw "$CONFIG_KBC1126_FW2_OFFSET" + [ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ] && \ + vfile "pci$CONFIG_VGA_BIOS_ID.rom" "$CONFIG_VGA_BIOS_FILE" optionrom + [ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \ + [ -n "$CONFIG_SMSC_SCH5545_EC_FW_FILE" ] && \ + vfile sch5545_ecfw.bin "$CONFIG_SMSC_SCH5545_EC_FW_FILE" raw + [ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \ + [ -n "$CONFIG_FSP_M_FILE" ] && \ + vfile "$CONFIG_FSP_M_CBFS" "$CONFIG_FSP_M_FILE" fsp --xip + [ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \ + [ -n "$CONFIG_FSP_S_FILE" ] && \ + vfile "$CONFIG_FSP_S_CBFS" "$CONFIG_FSP_S_FILE" fsp + + printf "ROM image successfully patched: %s\n" "$rom" + xchanged="y" +} + +vfile() +{ + [ "$2" = "/dev/null" ] && return 0 + + cbfsname="$1" + _dest="${2##*../}" + _t="$3" + + _offset="" + + if [ "$_t" = "fsp" ] && [ $# -gt 3 ]; then + _offset="$4" + elif [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ]; then + err "vfile $*, $rom: offset given but empty (undefined)" + fi + + [ "$nukemode" = "nuke" ] || x_ e "$_dest" f + + if [ "$cbfsname" = "IFD" ]; then + [ "$nukemode" = "nuke" ] || x_ "$ifdtool" $ifdprefix -i \ + $_t:$_dest "$rom" -O "$rom" + [ "$nukemode" != "nuke" ] || x_ "$ifdtool" $ifdprefix --nuke \ + $_t "$rom" -O "$rom" + elif [ "$nukemode" = "nuke" ]; then + x_ "$cbfstool" "$rom" remove -n "$cbfsname" + elif [ "$_t" = "stage" ]; then # the only stage we handle is refcode + x_ rm -f "$xbmklocal/refcode" + x_ "$rmodtool" -i "$_dest" -o "$xbmklocal/refcode" + x_ "$cbfstool" "$rom" add-stage -f "$xbmklocal/refcode" \ + -n "$cbfsname" -t stage + else + x_ "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \ + -t $_t $_offset + fi + xchanged="y"; : +} + +check_vendor_hashes() +{ + x_ cd "$tmpromdir" + [ "$has_hashes" = "n" ] || [ "$nukemode" = "nuke" ] || sha512sum \ + --status -c "$hashfile" || x_ sha1sum --status -c "$hashfile" + x_ rm -f "$hashfile" +} diff --git a/mk b/mk index af29f1e2..b56b7444 100755 --- a/mk +++ b/mk @@ -12,6 +12,7 @@ fi . "include/lib.sh" . "include/init.sh" +. "include/vendor.sh" . "include/inject.sh" . "include/mrc.sh" . "include/rom.sh" From a8e374020c0bea6cc849ffdf424b382fe535fee9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 10 May 2025 17:19:00 +0100 Subject: [PATCH 130/267] tree.sh: simplified srcdir check on make-clean this is the check that ksips a given target if the tree directory does not exist, on the clean command. Signed-off-by: Leah Rowe --- include/tree.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/tree.sh b/include/tree.sh index 47f65d10..1d5dd071 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -112,9 +112,8 @@ handle_defconfig() chkvars tree srcdir="src/$project/$tree" - if [ "$mode" = "distclean" ] || [ "$mode" = "crossgcc-clean" ]; then - [ -d "$srcdir" ] || return 0 - fi + [ "$mode" = "${mode%clean}" ] && [ ! -d "$srcdir" ] && return 0 + [ -z "$mode" ] && for _xarch in $xarch; do $dry check_cross_compiler "$_xarch" done; : From 0aa99f4bf8b52ea6060f0cd72263b9d4b4e99699 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 10 May 2025 17:58:22 +0100 Subject: [PATCH 131/267] tree.sh: only create elfdir in copy_elf() otherwise, we create empty directories where build.list doesn't exist, like on coreboot. we already create a directory when needed, when actually copying elf files, so let's just leave it at that. Signed-off-by: Leah Rowe --- include/tree.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/tree.sh b/include/tree.sh index 1d5dd071..d4585b92 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -107,7 +107,6 @@ handle_defconfig() [ -f "CHANGELOG" ] || fetch_project "$project" configure_project "$target_dir" || return 0 - x_ mkdir -p "$elfdir/$target" chkvars tree srcdir="src/$project/$tree" @@ -267,8 +266,7 @@ check_defconfig() [ -f "$defconfig" ] || $dry err "$project/$target: missing defconfig" dest_dir="$elfdir/$target/${defconfig#"$target_dir/config/"}" - $dry elfcheck || return 1 # skip build if a previous one exists - $dry x_ mkdir -p "$dest_dir" + $dry elfcheck || return 1; : # skip build if a previous one exists } elfcheck() From e5af201060ef920b9155b4324bc4d2a832752bff Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 10 May 2025 19:03:15 +0100 Subject: [PATCH 132/267] inject.sh: further cleanup for vendor.sh i moved out more code to vendor.sh, to reduce the amount of lbmk-only code on inject.sh this should reduce the number of merge conflicts even further, when cherry picking from lbmk to cbmk. in particular, vendor file insertion is now handled entirely through the "setvfile" function, instead of from inject.sh, which seems counterintuitive, but remember that inject.sh also does MAC addresses. therefore, the inject.sh script is now primarily for inserting MAC addresses, and handles vendor downloads in a slightly more convoluted way, but still easy enough to understand if you read it a bit. Signed-off-by: Leah Rowe --- include/inject.sh | 33 +++++++----------------- include/vendor.sh | 66 ++++++++++++++++++++++++++++++----------------- 2 files changed, 52 insertions(+), 47 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index ce61350a..50ade80f 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -5,9 +5,7 @@ cbcfgsdir="config/coreboot" hashfiles="vendorhashes blobhashes" # blobhashes for backwards compatibility -dontflash="!!! AN ERROR OCCURED! Please DO NOT flash if injection failed. !!!" -vfix="DO_NOT_FLASH_YET._FIRST,_INJECT_FILES_VIA_INSTRUCTIONS_ON_LIBREBOOT.ORG_" -tmpromdel="$xbmklocal/DO_NOT_FLASH" +tmpromdel="$XBMK_CACHE/DO_NOT_FLASH" nvm="util/nvmutil/nvm" ifdtool="elf/ifdtool/default/ifdtool" @@ -15,15 +13,15 @@ cv="CONFIG_GBE_BIN_PATH" [ -n "$cvxbmk" ] && cv="$cv $cvxbmk" [ -n "$cvchk" ] && cv="$cv $cvchk" -eval "`setvars "" archive boarddir cbdir IFD_platform ifdprefix tree new_mac \ - tmpromdir $cv`" +eval "`setvars "" archive boarddir IFD_platform ifdprefix tree new_mac \ + tmpromdir board $cv`" inject() { remkdir "$tmpromdel" set +u +e - [ $# -lt 1 ] && err "No options specified. - $dontflash" + [ $# -lt 1 ] && err "No options specified" eval "`setvars "" nukemode new_mac xchanged`" archive="$1"; @@ -57,11 +55,11 @@ inject() check_release() { - [ -L "$archive" ] && err "'$archive' is a symlink. $dontflash" + [ -L "$archive" ] && err "'$archive' is a symlink" e "$archive" f missing && err "'$archive' missing" archivename="`basename "$archive"`" || err "Can't get '$archive' name" - [ -z "$archivename" ] && err "Can't determine archive name. $dontflash" + [ -z "$archivename" ] && err "Can't determine archive name" case "$archivename" in *_src.tar.xz) @@ -71,7 +69,7 @@ check_release() *.tar.xz) _stripped_prefix="${archivename#*_}" board="${_stripped_prefix%.tar.xz}" ;; *) - err "'$archive': could not detect board type - $dontflash" + err "'$archive': could not detect board type" esac; : } @@ -86,14 +84,6 @@ check_target() eval "`setcfg "$boarddir/target.cfg"`" chkvars tree && x_ ./mk -d coreboot "$tree" - [ -n "$vcfg" ] && check_vcfg - - cbdir="src/coreboot/$tree" - cbfstool="elf/cbfstool/$tree/cbfstool" - rmodtool="elf/cbfstool/$tree/rmodtool" - mecleaner="$xbmkpwd/$cbdir/util/me_cleaner/me_cleaner.py" - kbc1126_ec_dump="$xbmkpwd/$cbdir/util/kbc1126/kbc1126_ec_dump" - cbfstool="elf/cbfstool/$tree/cbfstool" ifdtool="elf/ifdtool/$tree/ifdtool" [ -n "$IFD_platform" ] && ifdprefix="-p $IFD_platform"; : } @@ -103,7 +93,7 @@ patch_release() [ "$nukemode" = "nuke" ] || x_ ./mk download "$board" has_hashes="n" - tmpromdir="$xbmklocal/DO_NOT_FLASH/bin/$board" + tmpromdir="$tmpromdel/bin/$board" remkdir "${tmpromdir%"/bin/$board"}" x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}" @@ -115,9 +105,6 @@ patch_release() readkconfig || exit 0 - fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" - ( check_vendor_hashes ) || err "Can't verify hashes for '$archive'"; : - [ -n "$new_mac" ] && [ -n "$CONFIG_GBE_BIN_PATH" ] && modify_mac; : } @@ -126,7 +113,7 @@ readkconfig() x_ rm -f "$xbmktmp/cbcfg" fx_ scankconfig x_ find "$boarddir/config" -type f eval "`setcfg "$xbmktmp/cbcfg" 1`" - setvfile && return 1; : + setvfile "$@" && return 1; : } scankconfig() @@ -156,7 +143,7 @@ remktar() ( x_ cd "${tmpromdir%"/bin/$board"}" mkrom_tarball "bin/$board" - ) || err "Cannot re-generate '$archive' - $dontflash" + ) || err "Cannot re-generate '$archive'" mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \ "$archive" || err "'$archive' -> Can't overwrite"; : diff --git a/include/vendor.sh b/include/vendor.sh index bc329398..1c553300 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -18,6 +18,7 @@ pfs_extract="$xbmkpwd/src/biosutilities/Dell_PFS_Extract.py" uefiextract="$xbmkpwd/elf/uefitool/uefiextract" vendir="vendorfiles" appdir="$vendir/app" +vfix="DO_NOT_FLASH_YET._FIRST,_INJECT_FILES_VIA_INSTRUCTIONS_ON_LIBREBOOT.ORG_" # lbmk-specific extension to the "cv" variable (not suitable for cbmk) cvchk="CONFIG_INCLUDE_SMSC_SCH5545_EC_FW CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \ @@ -40,23 +41,13 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ _7ztest ME11bootguard ME11delta ME11version ME11sku ME11pch \ _me _metmp mfs TBFW_url_bkup TBFW_url TBFW_hash \ TBFW_size hashfile xromsize xchanged EC_url_bkup vfile \ - CONFIG_FSP_USE_REPO CONFIG_FSP_FULL_FD`" + CONFIG_FSP_USE_REPO CONFIG_FSP_FULL_FD cbdir`" download() { [ $# -gt 0 ] || err "No argument given" export PATH="$PATH:/sbin" - board="$1" && check_target && readkconfig && bootstrap && getfiles; : -} - -bootstrap() -{ - x_ ./mk -f coreboot ${cbdir##*/} - mk -b uefitool biosutilities bios_extract - [ -d "${kbc1126_ec_dump%/*}" ] && x_ make -C "$cbdir/util/kbc1126" - [ -n "$MRC_refcode_cbtree" ] && \ - cbfstoolref="elf/cbfstool/$MRC_refcode_cbtree/cbfstool" && \ - x_ ./mk -d coreboot "$MRC_refcode_cbtree"; : + board="$1" && check_target && readkconfig download } getfiles() @@ -112,12 +103,12 @@ fetch() x_ extract_$dl_type "$_dl" "$appdir" set -u -e - e "$_dest" f missing && err "!extract_$dl_type. $dontflash"; : + e "$_dest" f missing && err "!extract_$dl_type"; : } extract_intel_me() { - e "$mecleaner" f not && err "$cbdir: me_cleaner missing. $dontflash" + e "$mecleaner" f not && err "$cbdir: me_cleaner missing" _7ztest="$xbmklocal/metmp/a" _me="$xbmkpwd/$_dest" @@ -138,7 +129,7 @@ extract_intel_me() x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ "$ME11version" --pch "$ME11pch" --sku "$ME11sku" \ --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_me" - ) || err "Error running deguard for $_me - $dontflash"; : + ) || err "Error running deguard for $_me"; : } find_me() @@ -172,7 +163,7 @@ extract_kbc1126ec() Rom.CAB Rom.bin || unar -D 68*.CAB Rom.bin || err "!kbc1126 unar" [ -f "ec.bin" ] || x_ mv Rom.bin ec.bin x_ e ec.bin f && x_ "$kbc1126_ec_dump" ec.bin - ) || err "$board: can't extract kbc1126 ec firmware - $dontflash" + ) || err "$board: can't extract kbc1126 ec firmware" x_ e "$appdir/ec.bin.fw1" f && x_ e "$appdir/ec.bin.fw2" f x_ cp "$appdir/"ec.bin.fw* "${_dest%/*}/" @@ -187,7 +178,7 @@ extract_e6400vga() x_ cd "$appdir" x_ e "bios.bin" f "$e6400_unpack" bios.bin || printf "TODO: fix dell extract util\n" - ) || err "can't extract e6400 vga rom - $dontflosh" + ) || err "can't extract e6400 vga rom" x_ cp "$appdir/$E6400_VGA_romname" "$_dest" } @@ -223,6 +214,27 @@ extract_fsp() -o "${_dest%/*}" -n "Fsp.fd" } +setvfile() +{ + [ -n "$vcfg" ] && check_vcfg && for c in $cvchk; do + eval "[ \"\${$c}\" = \"/dev/null\" ] && continue" + eval "[ -z \"\${$c}\" ] && continue" + + # valid vcfg. proceed to download files + eval "`setcfg "$vfile"`" + + bootstrap + + [ $# -gt 0 ] && getfiles + [ $# -gt 0 ] && return 1 # download + + fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + ( check_vendor_hashes ) || err "$archive: Can't verify hashes" + + return 1 + done && return 0; return 1 +} + check_vcfg() { vfile="config/vendor/$vcfg/pkg.cfg" @@ -230,14 +242,20 @@ check_vcfg() [ -f "$vfile" ] || err "'$archive', '$board': $vfile missing"; : } -setvfile() +bootstrap() { - [ -n "$vfile" ] && for c in $cvchk; do - eval "[ \"\${$c}\" = \"/dev/null\" ] && continue" - eval "[ -z \"\${$c}\" ] && continue" - eval "`setcfg "$vfile"`" - return 1 - done && return 0; return 1 + cbdir="src/coreboot/$tree" + mecleaner="$xbmkpwd/$cbdir/util/me_cleaner/me_cleaner.py" + kbc1126_ec_dump="$xbmkpwd/$cbdir/util/kbc1126/kbc1126_ec_dump" + cbfstool="elf/cbfstool/$tree/cbfstool" + rmodtool="elf/cbfstool/$tree/rmodtool" + + x_ ./mk -f coreboot "${cbdir##*/}" + mk -b uefitool biosutilities bios_extract + [ -d "${kbc1126_ec_dump%/*}" ] && x_ make -C "$cbdir/util/kbc1126" + [ -n "$MRC_refcode_cbtree" ] && \ + cbfstoolref="elf/cbfstool/$MRC_refcode_cbtree/cbfstool" && \ + x_ ./mk -d coreboot "$MRC_refcode_cbtree"; : } prep() From dcfd3e632e279480a2b6e0f6172c8fd595548c13 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 10 May 2025 20:23:46 +0100 Subject: [PATCH 133/267] inject.sh: re-add mac address confirmation it just makes the script more user-friendly Signed-off-by: Leah Rowe --- include/inject.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/inject.sh b/include/inject.sh index 50ade80f..6e8fa320 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -130,6 +130,9 @@ modify_mac() x_ "$nvm" "$xbmklocal/gbe" setmac "$new_mac" fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + + printf "\nGbE NVM written to '%s':\n" "$archive" + x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || : } newmac() From a0c436ad4bae62bf6d237bd093b2bd2dcfdb8efb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 10 May 2025 20:48:38 +0100 Subject: [PATCH 134/267] inject.sh: Remove confusing path on tar creation The path is wrong. The correct path is printed afterward. Signed-off-by: Leah Rowe --- include/inject.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/inject.sh b/include/inject.sh index 6e8fa320..ae6fcc58 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -145,7 +145,8 @@ remktar() { ( x_ cd "${tmpromdir%"/bin/$board"}" - mkrom_tarball "bin/$board" + printf "Re-building tar archive (please wait)\n" + mkrom_tarball "bin/$board" 1>/dev/null ) || err "Cannot re-generate '$archive'" mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \ From 7d90d43425251f94adced76512310a59f2fac4dd Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 10 May 2025 20:51:38 +0100 Subject: [PATCH 135/267] remove another confusing message the current message says the file name, and implies that the given file has already been updated. Signed-off-by: Leah Rowe --- include/inject.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/inject.sh b/include/inject.sh index ae6fcc58..6d910b7c 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -131,7 +131,7 @@ modify_mac() fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" - printf "\nGbE NVM written to '%s':\n" "$archive" + printf "\nThe following GbE NVM data will be written:\n" x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || : } From 0cc816167bb7f95c1722a640066933bfdf38dd60 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 11 May 2025 00:34:53 +0100 Subject: [PATCH 136/267] vendor.sh: split up setvfile() split the actual bootstrapping to getvfile() setvfile only sets the config, but then it will call getvfile() to act on that config. Signed-off-by: Leah Rowe --- include/inject.sh | 2 +- include/vendor.sh | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 6d910b7c..d3ea78f7 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -113,7 +113,7 @@ readkconfig() x_ rm -f "$xbmktmp/cbcfg" fx_ scankconfig x_ find "$boarddir/config" -type f eval "`setcfg "$xbmktmp/cbcfg" 1`" - setvfile "$@" && return 1; : + setvfile "$@" || return 1; : } scankconfig() diff --git a/include/vendor.sh b/include/vendor.sh index 1c553300..e914f08d 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -219,20 +219,8 @@ setvfile() [ -n "$vcfg" ] && check_vcfg && for c in $cvchk; do eval "[ \"\${$c}\" = \"/dev/null\" ] && continue" eval "[ -z \"\${$c}\" ] && continue" - - # valid vcfg. proceed to download files - eval "`setcfg "$vfile"`" - - bootstrap - - [ $# -gt 0 ] && getfiles - [ $# -gt 0 ] && return 1 # download - - fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" - ( check_vendor_hashes ) || err "$archive: Can't verify hashes" - - return 1 - done && return 0; return 1 + getvfile "$@" && return 0 + done && return 1; : } check_vcfg() @@ -242,6 +230,20 @@ check_vcfg() [ -f "$vfile" ] || err "'$archive', '$board': $vfile missing"; : } +getvfile() +{ + # valid vcfg. proceed to download files + eval "`setcfg "$vfile"`" + + bootstrap + + [ $# -gt 0 ] && getfiles + [ $# -gt 0 ] && return 0 # download + + fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" + ( check_vendor_hashes ) || err "$archive: Can't verify hashes"; : +} + bootstrap() { cbdir="src/coreboot/$tree" From 9c27b7437cf2f902389cbc5965c8dada0b867cba Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 11 May 2025 00:43:34 +0100 Subject: [PATCH 137/267] vendor.sh: tidy up variables Signed-off-by: Leah Rowe --- include/vendor.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/include/vendor.sh b/include/vendor.sh index e914f08d..89e352a7 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -30,18 +30,17 @@ cvxbmk="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE CONFIG_KBC1126_FW1 \ CONFIG_KBC1126_FW2 CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2_OFFSET \ CONFIG_VGA_BIOS_ID CONFIG_BOARD_DELL_E6400 CONFIG_FSP_S_CBFS \ CONFIG_HAVE_REFCODE_BLOB CONFIG_REFCODE_BLOB_FILE CONFIG_FSP_FD_PATH \ - CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS" + CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS \ + CONFIG_FSP_USE_REPO CONFIG_FSP_FULL_FD" # lbmk-specific extensions; mostly used for downloading vendor files eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \ - E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest \ - mecleaner kbc1126_ec_dump MRC_refcode_cbtree _dl SCH5545EC_DL_url \ - EC_url rom DL_url nukemode cbfstoolref FSPFD_hash \ - _7ztest ME11bootguard ME11delta ME11version ME11sku ME11pch \ - _me _metmp mfs TBFW_url_bkup TBFW_url TBFW_hash \ - TBFW_size hashfile xromsize xchanged EC_url_bkup vfile \ - CONFIG_FSP_USE_REPO CONFIG_FSP_FULL_FD cbdir`" + E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest mecleaner \ + kbc1126_ec_dump MRC_refcode_cbtree _dl SCH5545EC_DL_url EC_url rom DL_url \ + nukemode cbfstoolref FSPFD_hash _7ztest ME11bootguard ME11delta xromsize \ + ME11version ME11sku ME11pch _me _metmp mfs TBFW_url_bkup TBFW_url vfile \ + TBFW_hash TBFW_size hashfile xchanged EC_url_bkup cbdir`" download() { From 2bbf2ae80b79ec6c6376d4606b48b0e4100d772b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 11 May 2025 00:52:47 +0100 Subject: [PATCH 138/267] inject.sh: simplified serprog check Signed-off-by: Leah Rowe --- include/inject.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index d3ea78f7..9963150f 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -75,10 +75,7 @@ check_release() check_target() { - if [ "$board" = "serprog_rp2040" ] || [ "$board" = "serprog_stm32" ] \ - || [ "$board" = "serprog_pico" ]; then - return 1 - fi + [ "$board" = "${board#serprog_}" ] || return 1 boarddir="$cbcfgsdir/$board" eval "`setcfg "$boarddir/target.cfg"`" From a449afb287f34e23e98a74011dd655357dc4a085 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 11 May 2025 00:56:28 +0100 Subject: [PATCH 139/267] inject.sh: only compile nvmutil if needed Signed-off-by: Leah Rowe --- include/inject.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 9963150f..890ac275 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -39,9 +39,6 @@ inject() esac [ "$new_mac" = "keep" ] && new_mac="" - [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ - x_ make -C util/nvmutil clean && x_ make -C util/nvmutil - check_release check_target && patch_release @@ -124,6 +121,7 @@ modify_mac() { x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbmklocal/gbe" [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ + x_ make -C util/nvmutil clean && x_ make -C util/nvmutil && \ x_ "$nvm" "$xbmklocal/gbe" setmac "$new_mac" fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" From 0911a5a5aed9232f8f9d1685e0a12378f21e41fe Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 13:13:13 +0100 Subject: [PATCH 140/267] lib.sh: split up xbmkget() it was too complicated. most of the logic has been moved to a new function, try_file() the for loop is handled by xbmkget(), whereas each try is now handled in try_file() Signed-off-by: Leah Rowe --- include/lib.sh | 52 +++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 2f87e8b1..c69825e8 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -50,34 +50,34 @@ xbmkget() _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0" _dlop="curl" && [ $# -gt 4 ] && _dlop="$5" - cached="$XBMK_CACHE/file/$4" - dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum - bad_checksum "$4" "$cached" 2>/dev/null && dl_fail="y" - [ "$dl_fail" = "n" ] && e "$3" f && return 0 x_ mkdir -p "${3%/*}" "$XBMK_CACHE/file" for url in "$1" "$2"; do - [ "$dl_fail" = "n" ] && break - [ -z "$url" ] && continue - x_ rm -f "$cached" - if [ "$_dlop" = "curl" ]; then - curl --location --retry 3 -A "$_ua" "$url" \ - -o "$cached" || wget --tries 3 -U "$_ua" "$url" \ - -O "$cached" || continue - elif [ "$_dlop" = "copy" ]; then - [ -L "$url" ] && \ - printf "dl %s %s %s %s: '%s' is a symlink\n" \ - "$1" "$2" "$3" "$4" "$url" 1>&2 && continue - [ ! -f "$url" ] && \ - printf "dl %s %s %s %s: '%s' not a file\n" \ - "$1" "$2" "$3" "$4" "$url" 1>&2 && continue - cp "$url" "$cached" || continue - else - err "$1 $2 $3 $4: Unsupported dlop type: '$_dlop'" - fi - bad_checksum "$4" "$cached" || dl_fail="n" - done - [ "$dl_fail" = "y" ] && err "$1 $2 $3 $4: not downloaded" - [ "$cached" = "$3" ] || x_ cp "$cached" "$3"; : + [ -n "$url" ] && try_file "$url" "$_dlop" "$@" && return 0 + done && err "$1 $2 $3 $4: not downloaded"; : +} + +try_file() +{ + cached="$XBMK_CACHE/file/$6" + dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum + bad_checksum "$6" "$cached" 2>/dev/null && dl_fail="y" + [ "$dl_fail" = "n" ] && e "$5" f && return 0 + + x_ rm -f "$cached" + if [ "$2" = "curl" ]; then + curl --location --retry 3 -A "$_ua" "$1" -o "$cached" || \ + wget --tries 3 -U "$_ua" "$1" -O "$cached" || return 1 + elif [ "$2" = "copy" ]; then + [ -L "$1" ] && printf "dl %s %s %s %s: '%s' is a symlink\n" \ + "$3" "$4" "$5" "$6" "$1" 1>&2 && return 1 + [ ! -f "$1" ] && printf "dl %s %s %s %s: '%s' not a file\n" \ + "$3" "$4" "$5" "$6" "$1" 1>&2 && return 1 + cp "$1" "$cached" || return 1 + else + err "$3 $4 $5 $6: Unsupported dlop type: '$2'" + fi + bad_checksum "$6" "$cached" && return 1 + [ "$cached" = "$5" ] || x_ cp "$cached" "$5"; : } bad_checksum() From 3879f6c4d8ff89b390ff64afbcec66ea17f41123 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 13:21:59 +0100 Subject: [PATCH 141/267] lib.sh: use fx_ in rmgit() with fx_, i have more much granular control over how errors are handled. Signed-off-by: Leah Rowe --- include/lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index c69825e8..c0adc7a6 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -39,8 +39,8 @@ mksha512sum() rmgit() { - x_ find "$1" -name ".git" -exec rm -Rf {} + - x_ find "$1" -name ".gitmodules" -exec rm -Rf {} + + fx_ "x_ rm -Rf" x_ find "$1" -name ".git" + fx_ "x_ rm -Rf" x_ find "$1" -name ".gitmodules" } # can grab from the internet, or copy locally. From 57f896ac016f50db3f3af1ba4be48b4c256deacd Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 14:23:32 +0100 Subject: [PATCH 142/267] vendor.sh: simplify setvfile() Signed-off-by: Leah Rowe --- include/vendor.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/vendor.sh b/include/vendor.sh index 89e352a7..bca51496 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -216,9 +216,8 @@ extract_fsp() setvfile() { [ -n "$vcfg" ] && check_vcfg && for c in $cvchk; do - eval "[ \"\${$c}\" = \"/dev/null\" ] && continue" - eval "[ -z \"\${$c}\" ] && continue" - getvfile "$@" && return 0 + vcmd="[ \"\${$c}\" != \"/dev/null\" ] && [ -n \"\${$c}\" ]" + eval "$vcmd && getvfile \"\$@\" && return 0" done && return 1; : } From 97d4d020d97eb8f9fde598c768d1bc19a847bc34 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 14:30:27 +0100 Subject: [PATCH 143/267] vendor.sh: simplify getvfile() Signed-off-by: Leah Rowe --- include/vendor.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/vendor.sh b/include/vendor.sh index bca51496..cd3a10d5 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -230,14 +230,8 @@ check_vcfg() getvfile() { - # valid vcfg. proceed to download files eval "`setcfg "$vfile"`" - - bootstrap - - [ $# -gt 0 ] && getfiles - [ $# -gt 0 ] && return 0 # download - + bootstrap && [ $# -gt 0 ] && getfiles && return 0 # download fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" ( check_vendor_hashes ) || err "$archive: Can't verify hashes"; : } From 76f81697e6e9a6f8ec7cb121cb6bc58f41bdf443 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 14:47:43 +0100 Subject: [PATCH 144/267] vendor.sh: remove check_vcfg() We don't need it. The vfile variable is only used in one place, and only once, for use with setcfg. Signed-off-by: Leah Rowe --- include/vendor.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/include/vendor.sh b/include/vendor.sh index cd3a10d5..259a25ba 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -39,8 +39,8 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest mecleaner \ kbc1126_ec_dump MRC_refcode_cbtree _dl SCH5545EC_DL_url EC_url rom DL_url \ nukemode cbfstoolref FSPFD_hash _7ztest ME11bootguard ME11delta xromsize \ - ME11version ME11sku ME11pch _me _metmp mfs TBFW_url_bkup TBFW_url vfile \ - TBFW_hash TBFW_size hashfile xchanged EC_url_bkup cbdir`" + ME11version ME11sku ME11pch _me _metmp mfs TBFW_url_bkup TBFW_url cbdir \ + TBFW_hash TBFW_size hashfile xchanged EC_url_bkup`" download() { @@ -215,22 +215,15 @@ extract_fsp() setvfile() { - [ -n "$vcfg" ] && check_vcfg && for c in $cvchk; do + [ -n "$vcfg" ] && for c in $cvchk; do vcmd="[ \"\${$c}\" != \"/dev/null\" ] && [ -n \"\${$c}\" ]" eval "$vcmd && getvfile \"\$@\" && return 0" done && return 1; : } -check_vcfg() -{ - vfile="config/vendor/$vcfg/pkg.cfg" - [ -L "$vfile" ] && err "'$archive', '$board': $vfile is a symlink"; : - [ -f "$vfile" ] || err "'$archive', '$board': $vfile missing"; : -} - getvfile() { - eval "`setcfg "$vfile"`" + eval "`setcfg "config/vendor/$vcfg/pkg.cfg" 1`" bootstrap && [ $# -gt 0 ] && getfiles && return 0 # download fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" ( check_vendor_hashes ) || err "$archive: Can't verify hashes"; : From 311ae2f8df28e69ffbf26ff63f7bf70070c225b5 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 14:49:14 +0100 Subject: [PATCH 145/267] inject.sh: define xchanged here instead this is used here, and also needed in cbmk. Signed-off-by: Leah Rowe --- include/inject.sh | 2 +- include/vendor.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index 890ac275..a17ed19c 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -14,7 +14,7 @@ cv="CONFIG_GBE_BIN_PATH" [ -n "$cvchk" ] && cv="$cv $cvchk" eval "`setvars "" archive boarddir IFD_platform ifdprefix tree new_mac \ - tmpromdir board $cv`" + tmpromdir board xchanged $cv`" inject() { diff --git a/include/vendor.sh b/include/vendor.sh index 259a25ba..4374277a 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -40,7 +40,7 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ kbc1126_ec_dump MRC_refcode_cbtree _dl SCH5545EC_DL_url EC_url rom DL_url \ nukemode cbfstoolref FSPFD_hash _7ztest ME11bootguard ME11delta xromsize \ ME11version ME11sku ME11pch _me _metmp mfs TBFW_url_bkup TBFW_url cbdir \ - TBFW_hash TBFW_size hashfile xchanged EC_url_bkup`" + TBFW_hash TBFW_size hashfile EC_url_bkup`" download() { From ef800b652c8fe1e69e8faa338489638c08d30de5 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 14:52:27 +0100 Subject: [PATCH 146/267] inject.sh: remove the hashfiles variable we only use it once, and it's a trivial string Signed-off-by: Leah Rowe --- include/inject.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index a17ed19c..d4d20568 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -4,7 +4,6 @@ # Copyright (c) 2023-2025 Leah Rowe cbcfgsdir="config/coreboot" -hashfiles="vendorhashes blobhashes" # blobhashes for backwards compatibility tmpromdel="$XBMK_CACHE/DO_NOT_FLASH" nvm="util/nvmutil/nvm" ifdtool="elf/ifdtool/default/ifdtool" @@ -92,7 +91,7 @@ patch_release() remkdir "${tmpromdir%"/bin/$board"}" x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}" - for _hashes in $hashfiles; do + for _hashes in "vendorhashes" "blobhashes"; do e "$tmpromdir/$_hashes" f && \ has_hashes="y" && hashfile="$_hashes" && break; : done From 40163dcfa4e29d9ce15f5537d03a2ae3b657cdf8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 15:05:21 +0100 Subject: [PATCH 147/267] mrc.sh: update copyright year to include 2025 I've made several modifications to the file, this year. Signed-off-by: Leah Rowe --- include/mrc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mrc.sh b/include/mrc.sh index 3b3089fc..55cc6a76 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only # Logic based on util/chromeos/crosfirmware.sh in coreboot cfc26ce278. -# Modifications in this version are Copyright 2021, 2023 and 2024 Leah Rowe. +# Modifications in this version are Copyright 2021,2023-2025 Leah Rowe. # Original copyright detailed in repo: https://review.coreboot.org/coreboot/ eval "`setvars "" MRC_url MRC_url_bkup MRC_hash MRC_board SHELLBALL`" From 308a9ab1e17e3c3fd5acbbe95d7f2c598344870b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 15:06:25 +0100 Subject: [PATCH 148/267] mrc.sh: minor cleanup group the cbfs command to the extract command, since they are related. this makes it clearer that the following command to extract refcode is unrelated. Signed-off-by: Leah Rowe --- include/mrc.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/mrc.sh b/include/mrc.sh index 55cc6a76..70c3bd3c 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -9,7 +9,6 @@ eval "`setvars "" MRC_url MRC_url_bkup MRC_hash MRC_board SHELLBALL`" extract_mrc() { extract_shellball - x_ "$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ -f "$_dest" -r RO_SECTION From 89cd828e87c8a98e37f689adafa32d0f2d404c39 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 15:32:50 +0100 Subject: [PATCH 149/267] lib.sh: move _ua to try_file() it's only used there Signed-off-by: Leah Rowe --- include/lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index c0adc7a6..32f81cd0 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -47,8 +47,6 @@ rmgit() # if copying locally, it can only copy a file. xbmkget() { - _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0" - _dlop="curl" && [ $# -gt 4 ] && _dlop="$5" x_ mkdir -p "${3%/*}" "$XBMK_CACHE/file" for url in "$1" "$2"; do @@ -58,6 +56,8 @@ xbmkget() try_file() { + _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0" + cached="$XBMK_CACHE/file/$6" dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum bad_checksum "$6" "$cached" 2>/dev/null && dl_fail="y" From 80f0562e8d1d0de4715bdcbdab52440302fd1c44 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 15:44:31 +0100 Subject: [PATCH 150/267] lib.sh: split up try_file() Signed-off-by: Leah Rowe --- include/lib.sh | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 32f81cd0..fc26c733 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -56,30 +56,37 @@ xbmkget() try_file() { - _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0" - cached="$XBMK_CACHE/file/$6" dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum bad_checksum "$6" "$cached" 2>/dev/null && dl_fail="y" [ "$dl_fail" = "n" ] && e "$5" f && return 0 x_ rm -f "$cached" - if [ "$2" = "curl" ]; then - curl --location --retry 3 -A "$_ua" "$1" -o "$cached" || \ - wget --tries 3 -U "$_ua" "$1" -O "$cached" || return 1 - elif [ "$2" = "copy" ]; then - [ -L "$1" ] && printf "dl %s %s %s %s: '%s' is a symlink\n" \ - "$3" "$4" "$5" "$6" "$1" 1>&2 && return 1 - [ ! -f "$1" ] && printf "dl %s %s %s %s: '%s' not a file\n" \ - "$3" "$4" "$5" "$6" "$1" 1>&2 && return 1 - cp "$1" "$cached" || return 1 - else - err "$3 $4 $5 $6: Unsupported dlop type: '$2'" - fi + [ "$2" = "curl" ] || [ "$2" = "copy" ] || \ + err "$3 $4 $5 $6: Unsupported dlop type: '$2'" + + try_$2 "$cached" "$@" || return 1 + bad_checksum "$6" "$cached" && return 1 [ "$cached" = "$5" ] || x_ cp "$cached" "$5"; : } +try_curl() +{ + _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0" + curl --location --retry 3 -A "$_ua" "$2" -o "$1" || \ + wget --tries 3 -U "$_ua" "$2" -O "$1" || return 1; : +} + +try_copy() +{ + [ -L "$2" ] && printf "dl %s %s %s %s: '%s' is a symlink\n" \ + "$4" "$5" "$6" "$7" "$2" 1>&2 && return 1 + [ ! -f "$2" ] && printf "dl %s %s %s %s: '%s' not a file\n" \ + "$4" "$5" "$6" "$7" "$2" 1>&2 && return 1 + cp "$2" "$1" || return 1; : +} + bad_checksum() { [ "$(sha512sum "$2" | awk '{print $1}')" != "$1" ] || return 1 From 23913bb8d2aa80452c381086b7513587badcd1e4 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 16:20:34 +0100 Subject: [PATCH 151/267] lib.sh: move mksha512sum() to vendor.sh this is unused in cbmk. it's only used from vendor.sh. therefore, lbmk shall have it in vendor.sh. Signed-off-by: Leah Rowe --- include/lib.sh | 8 -------- include/vendor.sh | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index fc26c733..d5607c61 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -29,14 +29,6 @@ mktarball() x_ tar -c "$1" | xz -T$XBMK_THREADS -9e > "$2" || err "mktarball2, $1" } -mksha512sum() -{ - ( - [ "${1%/*}" != "$1" ] && x_ cd "${1%/*}" - sha512sum ./"${1##*/}" >> "$2" || err "!sha512sum \"$1\" > \"$2\"" - ) || err "failed to create tarball checksum" -} - rmgit() { fx_ "x_ rm -Rf" x_ find "$1" -name ".git" diff --git a/include/vendor.sh b/include/vendor.sh index 4374277a..73f2592c 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -277,6 +277,14 @@ prep() x_ rm -f "$_xrom" } +mksha512sum() +{ + ( + [ "${1%/*}" != "$1" ] && x_ cd "${1%/*}" + sha512sum ./"${1##*/}" >> "$2" || err "!sha512sum \"$1\" > \"$2\"" + ) || err "failed to create tarball checksum" +} + add_vfiles() { rom="$1" From c9696e233389f1f896dc70076cfc03f14f8a940a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 16:30:05 +0100 Subject: [PATCH 152/267] lib.sh: move xbmkget() to git.sh in cbmk, it's only used from there. in lbmk, it's also used from vendor.sh. however, i plan to further expand git.sh at some point, tidying it up so that git cloning is also done from xbmkget, with dlop=git and git.sh would then be renamed to get.sh Signed-off-by: Leah Rowe --- include/git.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/lib.sh | 50 -------------------------------------------------- mk | 2 +- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/include/git.sh b/include/git.sh index bbc5140e..b65bd196 100644 --- a/include/git.sh +++ b/include/git.sh @@ -87,6 +87,56 @@ fetch_submodule() "$mdir/${1##*/}/patches" } +# can grab from the internet, or copy locally. +# if copying locally, it can only copy a file. +xbmkget() +{ + _dlop="curl" && [ $# -gt 4 ] && _dlop="$5" + x_ mkdir -p "${3%/*}" "$XBMK_CACHE/file" + for url in "$1" "$2"; do + [ -n "$url" ] && try_file "$url" "$_dlop" "$@" && return 0 + done && err "$1 $2 $3 $4: not downloaded"; : +} + +try_file() +{ + cached="$XBMK_CACHE/file/$6" + dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum + bad_checksum "$6" "$cached" 2>/dev/null && dl_fail="y" + [ "$dl_fail" = "n" ] && e "$5" f && return 0 + + x_ rm -f "$cached" + [ "$2" = "curl" ] || [ "$2" = "copy" ] || \ + err "$3 $4 $5 $6: Unsupported dlop type: '$2'" + + try_$2 "$cached" "$@" || return 1 + + bad_checksum "$6" "$cached" && return 1 + [ "$cached" = "$5" ] || x_ cp "$cached" "$5"; : +} + +try_curl() +{ + _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0" + curl --location --retry 3 -A "$_ua" "$2" -o "$1" || \ + wget --tries 3 -U "$_ua" "$2" -O "$1" || return 1; : +} + +try_copy() +{ + [ -L "$2" ] && printf "dl %s %s %s %s: '%s' is a symlink\n" \ + "$4" "$5" "$6" "$7" "$2" 1>&2 && return 1 + [ ! -f "$2" ] && printf "dl %s %s %s %s: '%s' not a file\n" \ + "$4" "$5" "$6" "$7" "$2" 1>&2 && return 1 + cp "$2" "$1" || return 1; : +} + +bad_checksum() +{ + [ "$(sha512sum "$2" | awk '{print $1}')" != "$1" ] || return 1 + printf "Bad checksum for file: %s\n" "$2" 1>&2; rm -f "$2" || :; : +} + tmpclone() { [ -d "$3" ] && return 0 diff --git a/include/lib.sh b/include/lib.sh index d5607c61..ba7d5d8c 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -35,56 +35,6 @@ rmgit() fx_ "x_ rm -Rf" x_ find "$1" -name ".gitmodules" } -# can grab from the internet, or copy locally. -# if copying locally, it can only copy a file. -xbmkget() -{ - _dlop="curl" && [ $# -gt 4 ] && _dlop="$5" - x_ mkdir -p "${3%/*}" "$XBMK_CACHE/file" - for url in "$1" "$2"; do - [ -n "$url" ] && try_file "$url" "$_dlop" "$@" && return 0 - done && err "$1 $2 $3 $4: not downloaded"; : -} - -try_file() -{ - cached="$XBMK_CACHE/file/$6" - dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum - bad_checksum "$6" "$cached" 2>/dev/null && dl_fail="y" - [ "$dl_fail" = "n" ] && e "$5" f && return 0 - - x_ rm -f "$cached" - [ "$2" = "curl" ] || [ "$2" = "copy" ] || \ - err "$3 $4 $5 $6: Unsupported dlop type: '$2'" - - try_$2 "$cached" "$@" || return 1 - - bad_checksum "$6" "$cached" && return 1 - [ "$cached" = "$5" ] || x_ cp "$cached" "$5"; : -} - -try_curl() -{ - _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0" - curl --location --retry 3 -A "$_ua" "$2" -o "$1" || \ - wget --tries 3 -U "$_ua" "$2" -O "$1" || return 1; : -} - -try_copy() -{ - [ -L "$2" ] && printf "dl %s %s %s %s: '%s' is a symlink\n" \ - "$4" "$5" "$6" "$7" "$2" 1>&2 && return 1 - [ ! -f "$2" ] && printf "dl %s %s %s %s: '%s' not a file\n" \ - "$4" "$5" "$6" "$7" "$2" 1>&2 && return 1 - cp "$2" "$1" || return 1; : -} - -bad_checksum() -{ - [ "$(sha512sum "$2" | awk '{print $1}')" != "$1" ] || return 1 - printf "Bad checksum for file: %s\n" "$2" 1>&2; rm -f "$2" || :; : -} - e() { es_t="e" && [ $# -gt 1 ] && es_t="$2" diff --git a/mk b/mk index b56b7444..f22d3b09 100755 --- a/mk +++ b/mk @@ -17,6 +17,7 @@ fi . "include/mrc.sh" . "include/rom.sh" . "include/release.sh" +. "include/git.sh" main() { @@ -34,7 +35,6 @@ main() main "$@" || exit 0 -. "include/git.sh" . "include/tree.sh" trees "$@" || exit 0 From 05b5914b35492ddb4076873e0b6519396dfe92de Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 18:01:53 +0100 Subject: [PATCH 153/267] lib.sh: remove mk() i don't need it. i can use fx_ instead, on functions that previously called mk(). Signed-off-by: Leah Rowe --- include/lib.sh | 8 -------- include/release.sh | 3 ++- include/tree.sh | 6 ++---- include/vendor.sh | 2 +- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index ba7d5d8c..cb3ba6cc 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -46,14 +46,6 @@ e() printf "%s %s\n" "$1" "$es2" 1>&2 } -mk() -{ - mk_flag="$1" || err "No argument given" - shift 1 && for mk_arg in "$@"; do - x_ ./mk $mk_flag $mk_arg - done; : -} - setvars() { _setvars="" diff --git a/include/release.sh b/include/release.sh index 4741b44a..0afb777f 100644 --- a/include/release.sh +++ b/include/release.sh @@ -55,7 +55,8 @@ build_release() ( x_ cd "$relsrcdir" x_ ./mk -d coreboot - mk -b coreboot pico-serprog stm32-vserprog pcsx-redux + fx_ "x_ ./mk -b" printf \ + "coreboot\npico-serprog\nstm32-vserprog\npcsx-redux\n" fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*" x_ mv bin ../roms diff --git a/include/tree.sh b/include/tree.sh index d4585b92..f44b39cc 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -39,13 +39,11 @@ trees() fi project="${OPTARG#src/}" + project="${project#config/git/}" shift 2 done [ -z "$_f" ] && err "missing flag ($flags)" - if [ -z "$project" ]; then - mk $_f $(ls -1 config/git) - return 1 - fi + [ -z "$project" ] && fx_ "x_ ./mk $_f" x_ ls -1 config/git && return 1 [ -f "config/git/$project/pkg.cfg" ] || \ err "config/git/$project/pkg.cfg missing" diff --git a/include/vendor.sh b/include/vendor.sh index 73f2592c..fb49cca5 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -238,7 +238,7 @@ bootstrap() rmodtool="elf/cbfstool/$tree/rmodtool" x_ ./mk -f coreboot "${cbdir##*/}" - mk -b uefitool biosutilities bios_extract + fx_ "x_ ./mk -b" printf "uefitool\nbiosutilities\nbios_extract\n" [ -d "${kbc1126_ec_dump%/*}" ] && x_ make -C "$cbdir/util/kbc1126" [ -n "$MRC_refcode_cbtree" ] && \ cbfstoolref="elf/cbfstool/$MRC_refcode_cbtree/cbfstool" && \ From 92954eeb38f69ebc0cfef7b9629e96a1599667be Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 19:20:50 +0100 Subject: [PATCH 154/267] lib.sh: remove rmgit() We don't need to call it from git.sh, because it's only being done when building a release anyway, and we already run rmgit when doing a release. The function itself is only two simple fx_ calls, so we can just do that from build_release(). Signed-off-by: Leah Rowe --- include/git.sh | 3 --- include/lib.sh | 6 ------ include/release.sh | 3 ++- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/include/git.sh b/include/git.sh index b65bd196..0091c832 100644 --- a/include/git.sh +++ b/include/git.sh @@ -57,9 +57,6 @@ git_prep() dx_ fetch_submodule "$mdir/module.list" fi - [ "$_loc" != "$XBMK_CACHE/repo/$project" ] && \ - [ "$XBMK_RELEASE" = "y" ] && rmgit "$tmpgit" - [ "$_loc" = "${_loc%/*}" ] || x_ mkdir -p "${_loc%/*}" x_ mv "$tmpgit" "$_loc" } diff --git a/include/lib.sh b/include/lib.sh index cb3ba6cc..cf4305a1 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -29,12 +29,6 @@ mktarball() x_ tar -c "$1" | xz -T$XBMK_THREADS -9e > "$2" || err "mktarball2, $1" } -rmgit() -{ - fx_ "x_ rm -Rf" x_ find "$1" -name ".git" - fx_ "x_ rm -Rf" x_ find "$1" -name ".gitmodules" -} - e() { es_t="e" && [ $# -gt 1 ] && es_t="$2" diff --git a/include/release.sh b/include/release.sh index 0afb777f..be221d19 100644 --- a/include/release.sh +++ b/include/release.sh @@ -37,7 +37,8 @@ build_release() x_ cd "$relsrcdir" x_ ./mk -f - rmgit . + fx_ "x_ rm -Rf" x_ find . -name ".git" + fx_ "x_ rm -Rf" x_ find . -name ".gitmodules" x_ mv src/docs docs ) || err "can't create release files" From c85aff5c54e8a2b0b649882b555e704bded268a9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 19:29:58 +0100 Subject: [PATCH 155/267] release.sh: delete tmp/cache from the tarball Signed-off-by: Leah Rowe --- include/release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/include/release.sh b/include/release.sh index be221d19..ecff57b3 100644 --- a/include/release.sh +++ b/include/release.sh @@ -45,6 +45,7 @@ build_release() git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \ --abbrev-commit > "$relsrcdir/CHANGELOG" || err "!log $relsrcdir" x_ rm -f "$relsrcdir/lock" + x_ rm -Rf "$relsrcdir/cache" "$relsrcdir/tmp" ( x_ cd "${relsrcdir%/*}" From f4871da9bca612fc2bcafaedc6b023863c411829 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 19:49:50 +0100 Subject: [PATCH 156/267] release.sh: split up build_release() Signed-off-by: Leah Rowe --- include/release.sh | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/include/release.sh b/include/release.sh index ecff57b3..05e872d5 100644 --- a/include/release.sh +++ b/include/release.sh @@ -24,45 +24,50 @@ release() [ -e "$vdir" ] && err "already exists: \"$vdir\"" x_ mkdir -p "$vdir" x_ git clone . "$relsrcdir" - x_ touch "$relsrcdir/lock" - build_release + prep_release src + prep_release_tarball + [ "$relmode" = "src" ] || prep_release bin + x_ rm -Rf "$relsrcdir" printf "\n\nDONE! Check release files under %s\n" "$vdir" } -build_release() +prep_release() { + x_ touch "$relsrcdir/lock" ( x_ cd "$relsrcdir" + prep_release_$1 + ) || err "can't prep release $1" +} +prep_release_src() +{ x_ ./mk -f fx_ "x_ rm -Rf" x_ find . -name ".git" fx_ "x_ rm -Rf" x_ find . -name ".gitmodules" x_ mv src/docs docs - ) || err "can't create release files" +} +prep_release_tarball() +{ git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \ --abbrev-commit > "$relsrcdir/CHANGELOG" || err "!log $relsrcdir" x_ rm -f "$relsrcdir/lock" x_ rm -Rf "$relsrcdir/cache" "$relsrcdir/tmp" - ( x_ cd "${relsrcdir%/*}" x_ mktarball "${relsrcdir##*/}" "${relsrcdir##*/}.tar.xz" - ) || err "can't create src tarball" - [ "$relmode" = "src" ] && return 0 + ) || err "can't create src tarball"; : +} - x_ touch "$relsrcdir/lock" - ( - x_ cd "$relsrcdir" +prep_release_bin() +{ x_ ./mk -d coreboot fx_ "x_ ./mk -b" printf \ "coreboot\npico-serprog\nstm32-vserprog\npcsx-redux\n" fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*" x_ mv bin ../roms - ) || err "can't build rom images" - - x_ rm -Rf "$relsrcdir" } From a0105e1ab44f9021d8a89f9932ea3a53e4a02eeb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 20:07:50 +0100 Subject: [PATCH 157/267] release.sh: remove unnecessary mkdir command the following git clone command creates that directory Signed-off-by: Leah Rowe --- include/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/release.sh b/include/release.sh index 05e872d5..640391f8 100644 --- a/include/release.sh +++ b/include/release.sh @@ -22,7 +22,7 @@ release() relsrcdir="$vdir/$src_dirname" [ -e "$vdir" ] && err "already exists: \"$vdir\"" - x_ mkdir -p "$vdir" + x_ git clone . "$relsrcdir" prep_release src From 6d3a6347c3ee93f674f129ffe1b9120741b34b00 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 20:23:41 +0100 Subject: [PATCH 158/267] release.sh: build in tmp directory first don't move to the real directory until the work is done. that way, a re-try can be done, while analysing the old files. it is created based on the tmpdir, under XBMK_CACHE/ Signed-off-by: Leah Rowe --- include/release.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/include/release.sh b/include/release.sh index 640391f8..eb0d58d8 100644 --- a/include/release.sh +++ b/include/release.sh @@ -1,28 +1,32 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Copyright (c) 2023-2025 Leah Rowe -eval "`setvars "" vdir src_dirname relsrcdir relmode`" +eval "`setvars "" reldir reldest vdir src_dirname relsrcdir relmode`" release() { export XBMK_RELEASE="y" - vdir="release" + reldir="release" + while getopts d:m: option; do [ -z "$OPTARG" ] && err "empty argument not allowed" case "$option" in - d) vdir="$OPTARG" ;; + d) reldir="$OPTARG" ;; m) relmode="$OPTARG" ;; *) err "invalid option '-$option'" ;; esac done - vdir="$vdir/$version" + reldest="$reldir/$version" + [ -e "$reldest" ] && \ + err "already exists: \"$reldest\"" + + vdir="$XBMK_CACHE/relpwd/${xbmktmp##*/}/$version" src_dirname="${relname}_src" relsrcdir="$vdir/$src_dirname" - [ -e "$vdir" ] && err "already exists: \"$vdir\"" - + remkdir "$vdir" x_ git clone . "$relsrcdir" prep_release src @@ -30,7 +34,10 @@ release() [ "$relmode" = "src" ] || prep_release bin x_ rm -Rf "$relsrcdir" - printf "\n\nDONE! Check release files under %s\n" "$vdir" + x_ mkdir -p "$reldir" + x_ mv "$vdir" "$reldir" + + printf "\n\nDONE! Check release files under %s\n" "$reldest" } prep_release() From d4c0479093ab33a3909d4408ad17ca740e0436a5 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 20:25:03 +0100 Subject: [PATCH 159/267] release.sh: remove src_dirname variable Signed-off-by: Leah Rowe --- include/release.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/release.sh b/include/release.sh index eb0d58d8..f34eb6df 100644 --- a/include/release.sh +++ b/include/release.sh @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Copyright (c) 2023-2025 Leah Rowe -eval "`setvars "" reldir reldest vdir src_dirname relsrcdir relmode`" +eval "`setvars "" reldir reldest vdir relsrcdir relmode`" release() { @@ -23,8 +23,7 @@ release() err "already exists: \"$reldest\"" vdir="$XBMK_CACHE/relpwd/${xbmktmp##*/}/$version" - src_dirname="${relname}_src" - relsrcdir="$vdir/$src_dirname" + relsrcdir="$vdir/${relname}_src" remkdir "$vdir" x_ git clone . "$relsrcdir" From 66f7ecdb2d7ef03c56bf50171911a66c92b8238a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 21:04:48 +0100 Subject: [PATCH 160/267] release.sh: clean up the vdir after release do this after moving the version directory within it. Signed-off-by: Leah Rowe --- include/release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/include/release.sh b/include/release.sh index f34eb6df..9046acbf 100644 --- a/include/release.sh +++ b/include/release.sh @@ -35,6 +35,7 @@ release() x_ mkdir -p "$reldir" x_ mv "$vdir" "$reldir" + x_ rm -Rf "${vdir%"/$version"}" printf "\n\nDONE! Check release files under %s\n" "$reldest" } From 6bf24221e60cfcc21bef445274973570ace436c5 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 21:11:34 +0100 Subject: [PATCH 161/267] release.sh: simplify release() Signed-off-by: Leah Rowe --- include/release.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/release.sh b/include/release.sh index 9046acbf..fbcc5621 100644 --- a/include/release.sh +++ b/include/release.sh @@ -28,9 +28,7 @@ release() remkdir "$vdir" x_ git clone . "$relsrcdir" - prep_release src - prep_release_tarball - [ "$relmode" = "src" ] || prep_release bin + fx_ prep_release printf "src\ntarball\nbin\n" x_ rm -Rf "$relsrcdir" x_ mkdir -p "$reldir" @@ -44,7 +42,7 @@ prep_release() { x_ touch "$relsrcdir/lock" ( - x_ cd "$relsrcdir" + [ "$1" = "tarball" ] || x_ cd "$relsrcdir" prep_release_$1 ) || err "can't prep release $1" } @@ -71,6 +69,7 @@ prep_release_tarball() prep_release_bin() { + [ "$relmode" = "src" ] && return 0 x_ ./mk -d coreboot fx_ "x_ ./mk -b" printf \ "coreboot\npico-serprog\nstm32-vserprog\npcsx-redux\n" From e38805a9448af8445370d4f5fbdbbb185dcbe6e8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 12 May 2025 21:29:38 +0100 Subject: [PATCH 162/267] rom.sh: reduce indendation in check_coreboot_utils call it via fx_, instead of using a for loop Signed-off-by: Leah Rowe --- include/rom.sh | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/include/rom.sh b/include/rom.sh index fdd0787f..65900a01 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -44,7 +44,7 @@ mkpayload_grub() mkvendorfiles() { [ -z "$mode" ] && $dry cook_coreboot_config - check_coreboot_utils "$tree" + fx_ check_coreboot_util printf "cbfstool\nifdtool\n" printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \ err "!mk $srcdir .coreboot-version" [ -z "$mode" ] && [ "$target" != "$tree" ] && \ @@ -59,26 +59,24 @@ cook_coreboot_config() make -C "$srcdir" oldconfig || err "Could not cook $srcdir/.config"; : } -check_coreboot_utils() +check_coreboot_util() { - for util in cbfstool ifdtool; do - [ "$badhash" = "y" ] && x_ rm -f "elf/$util/$1/$util" - e "elf/$util/$1/$util" f && continue + [ "$badhash" = "y" ] && x_ rm -f "elf/$1/$tree/$1" + e "elf/$1/$tree/$1" f && return 0 - utilelfdir="elf/$util/$1" - utilsrcdir="src/coreboot/$1/util/$util" + utilelfdir="elf/$1/$tree" + utilsrcdir="src/coreboot/$tree/util/$1" - utilmode="" && [ -n "$mode" ] && utilmode="clean" - x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs - 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; : - done; : + utilmode="" && [ -n "$mode" ] && utilmode="clean" + x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs + [ -n "$mode" ] && x_ rm -Rf "$utilelfdir" && return 0 + [ -z "$mode" ] || return 0 + [ -f "$utilelfdir/$1" ] && return 0 + + x_ mkdir -p "$utilelfdir" + x_ cp "$utilsrcdir/$1" "$utilelfdir" + [ "$1" = "cbfstool" ] || return 0 + x_ cp "$utilsrcdir/rmodtool" "$utilelfdir" } mkcorebootbin() From 1ca26c5d238d2acb85e491f949ff7cc369959bd9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 13 May 2025 18:41:48 +0100 Subject: [PATCH 163/267] git.sh: Re-implement redundant git downloads And this time it works. I'm now calling xbmkget() which in turn calls tmpclone(), instead of me calling tmpclone() directly. The git-pull is done on both remotes, regardless of whether the first succeeds. This way, if I forgot to update a mirror, downloads would probably still work. This also fixes an issue people were having, for example where the gnulib repository of GRUB was always being downloaded every time. I'm using a new directory, XBMK_CACHE/clone, instead of XBMK_CACHE/repo (which I used before), in case people still have the old caches from before. Signed-off-by: Leah Rowe --- include/git.sh | 56 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/include/git.sh b/include/git.sh index 0091c832..af0e8f2a 100644 --- a/include/git.sh +++ b/include/git.sh @@ -12,7 +12,7 @@ fetch_targets() e "src/$project/$tree" d && return 0 printf "Creating %s tree %s\n" "$project" "$tree" - git_prep "$loc" "$loc" "$xbmkpwd/$configdir/$tree/patches" \ + git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \ "src/$project/$tree" with_submodules nuke "$project/$tree" "$project/$tree" } @@ -42,6 +42,7 @@ clone_project() loc="src/$project" printf "Downloading project '%s' to '%s'\n" "$project" "$loc" + singletree "$project" || x_ rm -Rf "$loc" e "$loc" d missing && remkdir "${tmpgit%/*}" && git_prep \ "$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"; : } @@ -52,7 +53,7 @@ git_prep() _loc="$4" # $1 and $2 are gitrepo and gitrepo_backup chkvars rev - tmpclone "$1" "$2" "$tmpgit" "$rev" "$_patchdir" + xbmkget "$1" "$2" "$tmpgit" "$rev" git "$_patchdir" if singletree "$project" || [ $# -gt 4 ]; then dx_ fetch_submodule "$mdir/module.list" fi @@ -80,7 +81,7 @@ fetch_submodule() [ "$st" = "file" ] && xbmkget "$subfile" "$subfile_bkup" \ "$tmpgit/$1" "$subhash" && return 0 x_ rm -Rf "$tmpgit/$1" - tmpclone "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subhash" \ + xbmkget "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subhash" git \ "$mdir/${1##*/}/patches" } @@ -89,7 +90,9 @@ fetch_submodule() xbmkget() { _dlop="curl" && [ $# -gt 4 ] && _dlop="$5" - x_ mkdir -p "${3%/*}" "$XBMK_CACHE/file" + [ "$_dlop" = "curl" ] || [ "$_dlop" = "copy" ] || \ + [ "$_dlop" = "git" ] || err "$1 $2 $3 $4: Bad dlop type: '$_dlop'" + for url in "$1" "$2"; do [ -n "$url" ] && try_file "$url" "$_dlop" "$@" && return 0 done && err "$1 $2 $3 $4: not downloaded"; : @@ -97,19 +100,25 @@ xbmkget() try_file() { - cached="$XBMK_CACHE/file/$6" - dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum - bad_checksum "$6" "$cached" 2>/dev/null && dl_fail="y" - [ "$dl_fail" = "n" ] && e "$5" f && return 0 + cached="file/$6" && [ "$2" = "git" ] && cached="clone/${3##*/}" && \ + cached="${cached%.git}" + cached="$XBMK_CACHE/$cached" + x_ mkdir -p "${5%/*}" "${cached%/*}" - x_ rm -f "$cached" - [ "$2" = "curl" ] || [ "$2" = "copy" ] || \ - err "$3 $4 $5 $6: Unsupported dlop type: '$2'" + echk="d" && dl_fail="n" && [ "$2" != "git" ] && echk="f" && \ + bad_checksum "$6" "$cached" 2>/dev/null && dl_fail="y" + [ "$dl_fail" = "n" ] && e "$5" $echk && return 0 + + [ "$2" != "git" ] && x_ rm -f "$cached" try_$2 "$cached" "$@" || return 1 - bad_checksum "$6" "$cached" && return 1 - [ "$cached" = "$5" ] || x_ cp "$cached" "$5"; : + if [ "$2" = "git" ]; then + tmpclone "$cached" "$5" "$6" "$8" || return 1 + else + bad_checksum "$6" "$cached" && return 1 + [ "$cached" != "$5" ] && x_ cp "$cached" "$5" + fi } try_curl() @@ -128,6 +137,16 @@ try_copy() cp "$2" "$1" || return 1; : } +try_git() +{ + [ -d "$1" ] || git clone "$2" "$1" || return 1 + git -C "$1" remote add main "$4" 2>/dev/null || : + git -C "$1" remote add backup "$5" 2>/dev/null || : + git -C "$1" fetch --all || : + git -C "$1" pull --all || : + git -C "$1" pull --all || : +} + bad_checksum() { [ "$(sha512sum "$2" | awk '{print $1}')" != "$1" ] || return 1 @@ -136,12 +155,11 @@ bad_checksum() tmpclone() { - [ -d "$3" ] && return 0 - printf "Creating git clone '%s' from '%s', '%s'\n" "$3" "$1" "$2" - git clone "$1" "$3" || x_ rm -Rf "$3" - [ -d "$3" ] || x_ git clone "$2" "$3" - x_ git -C "$3" reset --hard "$4" - fx_ "eval x_ git -C \"$3\" am" find "$5" -type f + [ -d "$2" ] && return 0 + printf "Creating git clone '%s' from '%s'\n" "$2" "$1" + ( x_ git clone "$1" "$2" ) || return 1 + ( x_ git -C "$2" reset --hard "$3" ) || return 1 + ( fx_ "eval x_ git -C \"$2\" am" find "$4" -type f ) || return 1; : } nuke() From ed8a33d6fb1c380e70fec881e6a0308cea99333e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 13 May 2025 20:47:41 +0100 Subject: [PATCH 164/267] git.sh: cleanup Signed-off-by: Leah Rowe --- include/git.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/git.sh b/include/git.sh index af0e8f2a..cc9c2f2a 100644 --- a/include/git.sh +++ b/include/git.sh @@ -38,11 +38,10 @@ fetch_project() clone_project() { - loc="$XBMK_CACHE/repo/$project" && singletree "$project" && \ + loc="$XBMK_CACHE/clone/$project" && singletree "$project" && \ loc="src/$project" printf "Downloading project '%s' to '%s'\n" "$project" "$loc" - singletree "$project" || x_ rm -Rf "$loc" e "$loc" d missing && remkdir "${tmpgit%/*}" && git_prep \ "$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"; : } @@ -144,7 +143,6 @@ try_git() git -C "$1" remote add backup "$5" 2>/dev/null || : git -C "$1" fetch --all || : git -C "$1" pull --all || : - git -C "$1" pull --all || : } bad_checksum() From 3c23ff4fa1873e9170326141e31eb588d71a7d3a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 13 May 2025 21:57:34 +0100 Subject: [PATCH 165/267] git.sh: Only create destination repo on success Don't leave a broken cache laying around, which would otherwise break lbmk for the user. Signed-off-by: Leah Rowe --- include/git.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/include/git.sh b/include/git.sh index cc9c2f2a..9405828e 100644 --- a/include/git.sh +++ b/include/git.sh @@ -6,6 +6,7 @@ eval "`setvars "" loc url bkup_url subfile subhash subrepo subrepo_bkup \ depend subfile_bkup repofail`" tmpgit="$xbmklocal/gitclone" +tmpgitcache="$XBMK_CACHE/tmpgit" fetch_targets() { @@ -138,11 +139,17 @@ try_copy() try_git() { - [ -d "$1" ] || git clone "$2" "$1" || return 1 - git -C "$1" remote add main "$4" 2>/dev/null || : - git -C "$1" remote add backup "$5" 2>/dev/null || : - git -C "$1" fetch --all || : - git -C "$1" pull --all || : + gitdest="`findpath "$1"`" || err "Can't get readpath for '$1'" + x_ rm -Rf "$tmpgitcache" + + [ -d "$gitdest" ] || git clone "$2" "$tmpgitcache" || return 1 + [ -d "$gitdest" ] || x_ mkdir -p "${gitdest##*/}" + [ -d "$gitdest" ] || x_ mv "$tmpgitcache" "$gitdest" + + git -C "$gitdest" remote add main "$4" 2>/dev/null || : + git -C "$gitdest" remote add backup "$5" 2>/dev/null || : + git -C "$gitdest" fetch --all || : + git -C "$gitdest" pull --all || : } bad_checksum() From b04c86e5740f92cbea708f52a444df3aa1a2061f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 13 May 2025 22:00:28 +0100 Subject: [PATCH 166/267] git.sh: rename to get.sh it now handles more than just git, and i forsee it handling even more in the future, e.g. rsync, ftp, bittorrent. Signed-off-by: Leah Rowe --- include/{git.sh => get.sh} | 0 mk | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename include/{git.sh => get.sh} (100%) diff --git a/include/git.sh b/include/get.sh similarity index 100% rename from include/git.sh rename to include/get.sh diff --git a/mk b/mk index f22d3b09..f358bc3a 100755 --- a/mk +++ b/mk @@ -17,7 +17,7 @@ fi . "include/mrc.sh" . "include/rom.sh" . "include/release.sh" -. "include/git.sh" +. "include/get.sh" main() { From 6089716f07caf6b4690df1e1c2f2089a27a0b514 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 13 May 2025 22:17:37 +0100 Subject: [PATCH 167/267] release.sh: Don't run prep_release with fx_ The result of the printf statement is sorted, making it do binaries first, which results in a lot of junk files then being present inside the source archive. Signed-off-by: Leah Rowe --- include/release.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/release.sh b/include/release.sh index fbcc5621..f0799f17 100644 --- a/include/release.sh +++ b/include/release.sh @@ -28,7 +28,9 @@ release() remkdir "$vdir" x_ git clone . "$relsrcdir" - fx_ prep_release printf "src\ntarball\nbin\n" + prep_release src + prep_release tarball + prep_release bin x_ rm -Rf "$relsrcdir" x_ mkdir -p "$reldir" From e9fe5a74a2e66906721fe2ca1beb1f14784cf675 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 14 May 2025 16:28:29 +0100 Subject: [PATCH 168/267] get.sh: fix caching of crossgcc tarballs they were always re-downloading every time. i've basically re-written most of xbmkget. there was some erroneous conditions under which it wrongly deleted the cached file, resulting in it being downloaded again. Signed-off-by: Leah Rowe --- include/get.sh | 44 +++++++++++++++++++++++--------------------- include/vendor.sh | 2 +- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/include/get.sh b/include/get.sh index 9405828e..fbb41cd3 100644 --- a/include/get.sh +++ b/include/get.sh @@ -53,7 +53,7 @@ git_prep() _loc="$4" # $1 and $2 are gitrepo and gitrepo_backup chkvars rev - xbmkget "$1" "$2" "$tmpgit" "$rev" git "$_patchdir" + xbmkget git "$1" "$2" "$tmpgit" "$rev" "$_patchdir" if singletree "$project" || [ $# -gt 4 ]; then dx_ fetch_submodule "$mdir/module.list" fi @@ -78,46 +78,46 @@ fetch_submodule() [ -z "$st" ] && return 0 # subrepo/subfile not defined chkvars "sub${st}" "sub${st}_bkup" "subhash" - [ "$st" = "file" ] && xbmkget "$subfile" "$subfile_bkup" \ + [ "$st" = "file" ] && xbmkget curl "$subfile" "$subfile_bkup" \ "$tmpgit/$1" "$subhash" && return 0 x_ rm -Rf "$tmpgit/$1" - xbmkget "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subhash" git \ + xbmkget git "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subhash" \ "$mdir/${1##*/}/patches" } -# can grab from the internet, or copy locally. -# if copying locally, it can only copy a file. xbmkget() { - _dlop="curl" && [ $# -gt 4 ] && _dlop="$5" - [ "$_dlop" = "curl" ] || [ "$_dlop" = "copy" ] || \ - [ "$_dlop" = "git" ] || err "$1 $2 $3 $4: Bad dlop type: '$_dlop'" + [ "$1" = "curl" ] || [ "$1" = "copy" ] || [ "$1" = "git" ] || \ + err "Bad dlop (arg 1): xbmkget $*" - for url in "$1" "$2"; do - [ -n "$url" ] && try_file "$url" "$_dlop" "$@" && return 0 + for url in "$2" "$3"; do + [ -n "$url" ] && try_file "$url" "$@" && return 0 done && err "$1 $2 $3 $4: not downloaded"; : } try_file() { cached="file/$6" && [ "$2" = "git" ] && cached="clone/${3##*/}" && \ - cached="${cached%.git}" + cached="${cached%.git}" # always the main repo as basis for naming, + # in case the backup has another name cached="$XBMK_CACHE/$cached" x_ mkdir -p "${5%/*}" "${cached%/*}" - echk="d" && dl_fail="n" && [ "$2" != "git" ] && echk="f" && \ - bad_checksum "$6" "$cached" 2>/dev/null && dl_fail="y" - [ "$dl_fail" = "n" ] && e "$5" $echk && return 0 + echk="d" && [ "$2" != "git" ] && echk="f" && \ + bad_checksum "$6" "$cached" 2>/dev/null && x_ rm -f "$cached" - [ "$2" != "git" ] && x_ rm -f "$cached" - - try_$2 "$cached" "$@" || return 1 + e "$cached" $echk || try_$2 "$cached" "$@" || return 1 + if e "$5" $echk && [ "$2" != "git" ]; then + bad_checksum "$6" "$5" 2>/dev/null && x_ cp "$cached" "$5" + fi + e "$cached" $echk missing && return 1 if [ "$2" = "git" ]; then - tmpclone "$cached" "$5" "$6" "$8" || return 1 + tmpclone "$cached" "$5" "$6" "$7" || return 1 else - bad_checksum "$6" "$cached" && return 1 + bad_checksum "$6" "$cached" && x_ rm -f "$cached" && return 1 [ "$cached" != "$5" ] && x_ cp "$cached" "$5" + bad_checksum "$6" "$5" && x_ rm -rf "$5" && return 1; : fi } @@ -154,8 +154,10 @@ try_git() bad_checksum() { - [ "$(sha512sum "$2" | awk '{print $1}')" != "$1" ] || return 1 - printf "Bad checksum for file: %s\n" "$2" 1>&2; rm -f "$2" || :; : + [ ! -f "$2" ] || [ "$(sha512sum "$2" | awk '{print $1}')" != "$1" ] \ + || return 1 + printf "Bad checksum for file: %s\n" "$2" 1>&2 + x_ rm -f "$2" } tmpclone() diff --git a/include/vendor.sh b/include/vendor.sh index fb49cca5..823ba74f 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -90,7 +90,7 @@ fetch() done; : dlop="curl" && [ $# -gt 5 ] && dlop="$6" - xbmkget "$dl" "$dl_bkup" "$_dl" "$dlsum" "$dlop" + xbmkget "$dlop" "$dl" "$dl_bkup" "$_dl" "$dlsum" x_ rm -Rf "${_dl}_extracted" e "$_dest" f && return 0 From 21867b7d80562ce822525fca63688908f1ca59b8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 14 May 2025 16:38:10 +0100 Subject: [PATCH 169/267] get.sh: simplify fetch_submodules() We are calling xbmkget in the same way, whether it's a subfile or subrepo. Rename these variables to subcurl and subgit, so that we can call xbmkget unconditionally. Signed-off-by: Leah Rowe --- .../acpica-unix-20241212.tar.gz/module.cfg | 4 ++-- .../default/arm-trusted-firmware/module.cfg | 4 ++-- .../default/binutils-2.43.1.tar.xz/module.cfg | 4 ++-- .../submodule/coreboot/default/fsp/module.cfg | 4 ++-- .../default/gcc-14.2.0.tar.xz/module.cfg | 4 ++-- .../default/gmp-6.3.0.tar.xz/module.cfg | 4 ++-- .../default/intel-microcode/module.cfg | 4 ++-- .../coreboot/default/libgfxinit/module.cfg | 4 ++-- .../coreboot/default/libhwbase/module.cfg | 4 ++-- .../default/mpc-1.3.1.tar.gz/module.cfg | 4 ++-- .../default/mpfr-4.2.1.tar.xz/module.cfg | 4 ++-- .../default/nasm-2.16.03.tar.bz2/module.cfg | 4 ++-- .../coreboot/default/vboot/module.cfg | 4 ++-- .../acpica-unix2-20190703.tar.gz/module.cfg | 4 ++-- .../fam15h/binutils-2.32.tar.xz/module.cfg | 4 ++-- .../coreboot/fam15h/blobs/module.cfg | 4 ++-- .../fam15h/gcc-8.3.0.tar.xz/module.cfg | 4 ++-- .../fam15h/gmp-6.1.2.tar.xz/module.cfg | 4 ++-- .../fam15h/mpc-1.1.0.tar.gz/module.cfg | 4 ++-- .../fam15h/mpfr-4.0.2.tar.xz/module.cfg | 4 ++-- .../fam15h/nasm-2.16.03.tar.bz2/module.cfg | 4 ++-- .../coreboot/fam15h/vboot/module.cfg | 4 ++-- config/submodule/docs/html/module.cfg | 4 ++-- config/submodule/docs/img/module.cfg | 4 ++-- .../submodule/grub/default/gnulib/module.cfg | 4 ++-- config/submodule/grub/nvme/gnulib/module.cfg | 4 ++-- config/submodule/grub/xhci/gnulib/module.cfg | 4 ++-- config/submodule/pcsx-redux/uC-sdk/module.cfg | 4 ++-- config/submodule/pico-sdk/tinyusb/module.cfg | 4 ++-- .../stm32-vserprog/libopencm3/module.cfg | 4 ++-- include/get.sh | 20 +++++++++---------- 31 files changed, 69 insertions(+), 71 deletions(-) diff --git a/config/submodule/coreboot/default/acpica-unix-20241212.tar.gz/module.cfg b/config/submodule/coreboot/default/acpica-unix-20241212.tar.gz/module.cfg index 30baf001..27508216 100644 --- a/config/submodule/coreboot/default/acpica-unix-20241212.tar.gz/module.cfg +++ b/config/submodule/coreboot/default/acpica-unix-20241212.tar.gz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/libreboot.org/release/misc/acpica/acpica-unix-20241212.tar.gz" -subfile_bkup="https://mirror.math.princeton.edu/pub/libreboot/misc/acpica/acpica-unix-20241212.tar.gz" +subcurl="https://www.mirrorservice.org/sites/libreboot.org/release/misc/acpica/acpica-unix-20241212.tar.gz" +subcurl_bkup="https://mirror.math.princeton.edu/pub/libreboot/misc/acpica/acpica-unix-20241212.tar.gz" subhash="daa4243f927451ac18c337cf17c27849e68329b3f7eb25b8c3379fda9c6a484201b73d4ffccab89a0ae22cc5e432f141ba149015a003834b0515bdb3d4efe0a8" diff --git a/config/submodule/coreboot/default/arm-trusted-firmware/module.cfg b/config/submodule/coreboot/default/arm-trusted-firmware/module.cfg index 911f3fa9..953997c7 100644 --- a/config/submodule/coreboot/default/arm-trusted-firmware/module.cfg +++ b/config/submodule/coreboot/default/arm-trusted-firmware/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://review.coreboot.org/arm-trusted-firmware.git" -subrepo_bkup="https://github.com/coreboot/arm-trusted-firmware" +subgit="https://review.coreboot.org/arm-trusted-firmware.git" +subgit_bkup="https://github.com/coreboot/arm-trusted-firmware" subhash="57ac3f74b34a3303f03deee264a1f2247c68008d" diff --git a/config/submodule/coreboot/default/binutils-2.43.1.tar.xz/module.cfg b/config/submodule/coreboot/default/binutils-2.43.1.tar.xz/module.cfg index 1e16b92a..de0d349c 100644 --- a/config/submodule/coreboot/default/binutils-2.43.1.tar.xz/module.cfg +++ b/config/submodule/coreboot/default/binutils-2.43.1.tar.xz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.xz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/binutils/binutils-2.43.1.tar.xz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/binutils/binutils-2.43.1.tar.xz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/binutils/binutils-2.43.1.tar.xz" subhash="20977ad17729141a2c26d358628f44a0944b84dcfefdec2ba029c2d02f40dfc41cc91c0631044560d2bd6f9a51e1f15846b4b311befbe14f1239f14ff7d57824" diff --git a/config/submodule/coreboot/default/fsp/module.cfg b/config/submodule/coreboot/default/fsp/module.cfg index 2b39812b..98e57efe 100644 --- a/config/submodule/coreboot/default/fsp/module.cfg +++ b/config/submodule/coreboot/default/fsp/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://review.coreboot.org/fsp.git" -subrepo_bkup="https://github.com/coreboot/fsp" +subgit="https://review.coreboot.org/fsp.git" +subgit_bkup="https://github.com/coreboot/fsp" subhash="86c9111639d357e0f369c14248097b119112a71c" diff --git a/config/submodule/coreboot/default/gcc-14.2.0.tar.xz/module.cfg b/config/submodule/coreboot/default/gcc-14.2.0.tar.xz/module.cfg index 4ef88d1d..e637ba03 100644 --- a/config/submodule/coreboot/default/gcc-14.2.0.tar.xz/module.cfg +++ b/config/submodule/coreboot/default/gcc-14.2.0.tar.xz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" subhash="932bdef0cda94bacedf452ab17f103c0cb511ff2cec55e9112fc0328cbf1d803b42595728ea7b200e0a057c03e85626f937012e49a7515bc5dd256b2bf4bc396" diff --git a/config/submodule/coreboot/default/gmp-6.3.0.tar.xz/module.cfg b/config/submodule/coreboot/default/gmp-6.3.0.tar.xz/module.cfg index 46b55c01..90466fed 100644 --- a/config/submodule/coreboot/default/gmp-6.3.0.tar.xz/module.cfg +++ b/config/submodule/coreboot/default/gmp-6.3.0.tar.xz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/gmp/gmp-6.3.0.tar.xz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/gmp/gmp-6.3.0.tar.xz" subhash="e85a0dab5195889948a3462189f0e0598d331d3457612e2d3350799dba2e244316d256f8161df5219538eb003e4b5343f989aaa00f96321559063ed8c8f29fd2" diff --git a/config/submodule/coreboot/default/intel-microcode/module.cfg b/config/submodule/coreboot/default/intel-microcode/module.cfg index 0ae50bd0..2af752fa 100644 --- a/config/submodule/coreboot/default/intel-microcode/module.cfg +++ b/config/submodule/coreboot/default/intel-microcode/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://review.coreboot.org/intel-microcode.git" -subrepo_bkup="https://github.com/coreboot/intel-microcode" +subgit="https://review.coreboot.org/intel-microcode.git" +subgit_bkup="https://github.com/coreboot/intel-microcode" subhash="8a62de41c011615d749f8e72bb906dddc72e56a8" diff --git a/config/submodule/coreboot/default/libgfxinit/module.cfg b/config/submodule/coreboot/default/libgfxinit/module.cfg index 93383129..87589128 100644 --- a/config/submodule/coreboot/default/libgfxinit/module.cfg +++ b/config/submodule/coreboot/default/libgfxinit/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://review.coreboot.org/libgfxinit.git" -subrepo_bkup="https://github.com/coreboot/libgfxinit" +subgit="https://review.coreboot.org/libgfxinit.git" +subgit_bkup="https://github.com/coreboot/libgfxinit" subhash="17cfc92f402493979783585b6581efbd98c0cf07" diff --git a/config/submodule/coreboot/default/libhwbase/module.cfg b/config/submodule/coreboot/default/libhwbase/module.cfg index 4995e70f..f09b123f 100644 --- a/config/submodule/coreboot/default/libhwbase/module.cfg +++ b/config/submodule/coreboot/default/libhwbase/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://review.coreboot.org/libhwbase.git" -subrepo_bkup="https://github.com/coreboot/libhwbase" +subgit="https://review.coreboot.org/libhwbase.git" +subgit_bkup="https://github.com/coreboot/libhwbase" subhash="584629b9f4771b7618951cec57df2ca3af9c6981" diff --git a/config/submodule/coreboot/default/mpc-1.3.1.tar.gz/module.cfg b/config/submodule/coreboot/default/mpc-1.3.1.tar.gz/module.cfg index 9b6cc57a..9a1ec4cb 100644 --- a/config/submodule/coreboot/default/mpc-1.3.1.tar.gz/module.cfg +++ b/config/submodule/coreboot/default/mpc-1.3.1.tar.gz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/mpc/mpc-1.3.1.tar.gz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/mpc/mpc-1.3.1.tar.gz" subhash="4bab4ef6076f8c5dfdc99d810b51108ced61ea2942ba0c1c932d624360a5473df20d32b300fc76f2ba4aa2a97e1f275c9fd494a1ba9f07c4cb2ad7ceaeb1ae97" diff --git a/config/submodule/coreboot/default/mpfr-4.2.1.tar.xz/module.cfg b/config/submodule/coreboot/default/mpfr-4.2.1.tar.xz/module.cfg index 93cc1a05..4ff30620 100644 --- a/config/submodule/coreboot/default/mpfr-4.2.1.tar.xz/module.cfg +++ b/config/submodule/coreboot/default/mpfr-4.2.1.tar.xz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/mpfr/mpfr-4.2.1.tar.xz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/mpfr/mpfr-4.2.1.tar.xz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/mpfr/mpfr-4.2.1.tar.xz" subhash="bc68c0d755d5446403644833ecbb07e37360beca45f474297b5d5c40926df1efc3e2067eecffdf253f946288bcca39ca89b0613f545d46a9e767d1d4cf358475" diff --git a/config/submodule/coreboot/default/nasm-2.16.03.tar.bz2/module.cfg b/config/submodule/coreboot/default/nasm-2.16.03.tar.bz2/module.cfg index 3895e2ef..bc486e80 100644 --- a/config/submodule/coreboot/default/nasm-2.16.03.tar.bz2/module.cfg +++ b/config/submodule/coreboot/default/nasm-2.16.03.tar.bz2/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/nasm-2.16.03.tar.bz2" -subfile_bkup="https://www.mirrorservice.org/sites/distfiles.macports.org/nasm/nasm-2.16.03.tar.bz2" +subcurl="https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/nasm-2.16.03.tar.bz2" +subcurl_bkup="https://www.mirrorservice.org/sites/distfiles.macports.org/nasm/nasm-2.16.03.tar.bz2" subhash="f28445d368debdf44219cc57df33800a8c0e49186cd60836d4adfec7700d53b801d34aa9fc9bfda74169843f33a1e8b465e11292582eb968bb9c3a26f54dd172" diff --git a/config/submodule/coreboot/default/vboot/module.cfg b/config/submodule/coreboot/default/vboot/module.cfg index d13a1b29..8b4e15de 100644 --- a/config/submodule/coreboot/default/vboot/module.cfg +++ b/config/submodule/coreboot/default/vboot/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://review.coreboot.org/vboot.git" -subrepo_bkup="https://github.com/coreboot/vboot" +subgit="https://review.coreboot.org/vboot.git" +subgit_bkup="https://github.com/coreboot/vboot" subhash="3f94e2c7ed58c4e67d6e7dc6052ec615dbbb9bb4" diff --git a/config/submodule/coreboot/fam15h/acpica-unix2-20190703.tar.gz/module.cfg b/config/submodule/coreboot/fam15h/acpica-unix2-20190703.tar.gz/module.cfg index 50e6989e..b8365f7c 100644 --- a/config/submodule/coreboot/fam15h/acpica-unix2-20190703.tar.gz/module.cfg +++ b/config/submodule/coreboot/fam15h/acpica-unix2-20190703.tar.gz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/libreboot.org/release/misc/acpica/acpica-unix2-20190703.tar.gz" -subfile_bkup="https://mirror.math.princeton.edu/pub/libreboot/misc/acpica/acpica-unix2-20190703.tar.gz" +subcurl="https://www.mirrorservice.org/sites/libreboot.org/release/misc/acpica/acpica-unix2-20190703.tar.gz" +subcurl_bkup="https://mirror.math.princeton.edu/pub/libreboot/misc/acpica/acpica-unix2-20190703.tar.gz" subhash="8445a6d354ce3bcbfb5159f4ec0312b1e910c0b1b2033a2300f892e4ac580abab4e3f5b4ded379f0036299359d307330511ab7053678cfd9031d7df4c365f555" diff --git a/config/submodule/coreboot/fam15h/binutils-2.32.tar.xz/module.cfg b/config/submodule/coreboot/fam15h/binutils-2.32.tar.xz/module.cfg index 6e86543f..3f03f64e 100644 --- a/config/submodule/coreboot/fam15h/binutils-2.32.tar.xz/module.cfg +++ b/config/submodule/coreboot/fam15h/binutils-2.32.tar.xz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/binutils/binutils-2.32.tar.xz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/binutils/binutils-2.32.tar.xz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/binutils/binutils-2.32.tar.xz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/binutils/binutils-2.32.tar.xz" subhash="d326408f12a03d9a61a9de56584c2af12f81c2e50d2d7e835d51565df8314df01575724afa1e43bd0db45cfc9916b41519b67dfce03232aa4978704492a6994a" diff --git a/config/submodule/coreboot/fam15h/blobs/module.cfg b/config/submodule/coreboot/fam15h/blobs/module.cfg index f649cab2..3c34302c 100644 --- a/config/submodule/coreboot/fam15h/blobs/module.cfg +++ b/config/submodule/coreboot/fam15h/blobs/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://review.coreboot.org/blobs.git" -subrepo_bkup="https://github.com/coreboot/blobs" +subgit="https://review.coreboot.org/blobs.git" +subgit_bkup="https://github.com/coreboot/blobs" subhash="034b27818450428f70aa9316c8bd0d65bacd8ee8" diff --git a/config/submodule/coreboot/fam15h/gcc-8.3.0.tar.xz/module.cfg b/config/submodule/coreboot/fam15h/gcc-8.3.0.tar.xz/module.cfg index 1a111581..ce21c98b 100644 --- a/config/submodule/coreboot/fam15h/gcc-8.3.0.tar.xz/module.cfg +++ b/config/submodule/coreboot/fam15h/gcc-8.3.0.tar.xz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.xz" subhash="1811337ae3add9680cec64968a2509d085b6dc5b6783fc1e8c295e3e47416196fd1a3ad8dfe7e10be2276b4f62c357659ce2902f239f60a8648548231b4b5802" diff --git a/config/submodule/coreboot/fam15h/gmp-6.1.2.tar.xz/module.cfg b/config/submodule/coreboot/fam15h/gmp-6.1.2.tar.xz/module.cfg index 08926b6a..a46b9b7c 100644 --- a/config/submodule/coreboot/fam15h/gmp-6.1.2.tar.xz/module.cfg +++ b/config/submodule/coreboot/fam15h/gmp-6.1.2.tar.xz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/gmp/gmp-6.1.2.tar.xz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/gmp/gmp-6.1.2.tar.xz" subhash="9f098281c0593b76ee174b722936952671fab1dae353ce3ed436a31fe2bc9d542eca752353f6645b7077c1f395ab4fdd355c58e08e2a801368f1375690eee2c6" diff --git a/config/submodule/coreboot/fam15h/mpc-1.1.0.tar.gz/module.cfg b/config/submodule/coreboot/fam15h/mpc-1.1.0.tar.gz/module.cfg index 89cfabc7..13a66a87 100644 --- a/config/submodule/coreboot/fam15h/mpc-1.1.0.tar.gz/module.cfg +++ b/config/submodule/coreboot/fam15h/mpc-1.1.0.tar.gz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/mpc/mpc-1.1.0.tar.gz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/mpc/mpc-1.1.0.tar.gz" subhash="72d657958b07c7812dc9c7cbae093118ce0e454c68a585bfb0e2fa559f1bf7c5f49b93906f580ab3f1073e5b595d23c6494d4d76b765d16dde857a18dd239628" diff --git a/config/submodule/coreboot/fam15h/mpfr-4.0.2.tar.xz/module.cfg b/config/submodule/coreboot/fam15h/mpfr-4.0.2.tar.xz/module.cfg index c6ebf4de..f2a4f0fe 100644 --- a/config/submodule/coreboot/fam15h/mpfr-4.0.2.tar.xz/module.cfg +++ b/config/submodule/coreboot/fam15h/mpfr-4.0.2.tar.xz/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.xz" -subfile_bkup="https://ftp.nluug.nl/pub/gnu/mpfr/mpfr-4.0.2.tar.xz" +subcurl="https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.xz" +subcurl_bkup="https://ftp.nluug.nl/pub/gnu/mpfr/mpfr-4.0.2.tar.xz" subhash="d583555d08863bf36c89b289ae26bae353d9a31f08ee3894520992d2c26e5683c4c9c193d7ad139632f71c0a476d85ea76182702a98bf08dde7b6f65a54f8b88" diff --git a/config/submodule/coreboot/fam15h/nasm-2.16.03.tar.bz2/module.cfg b/config/submodule/coreboot/fam15h/nasm-2.16.03.tar.bz2/module.cfg index 3895e2ef..bc486e80 100644 --- a/config/submodule/coreboot/fam15h/nasm-2.16.03.tar.bz2/module.cfg +++ b/config/submodule/coreboot/fam15h/nasm-2.16.03.tar.bz2/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subfile="https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/nasm-2.16.03.tar.bz2" -subfile_bkup="https://www.mirrorservice.org/sites/distfiles.macports.org/nasm/nasm-2.16.03.tar.bz2" +subcurl="https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/nasm-2.16.03.tar.bz2" +subcurl_bkup="https://www.mirrorservice.org/sites/distfiles.macports.org/nasm/nasm-2.16.03.tar.bz2" subhash="f28445d368debdf44219cc57df33800a8c0e49186cd60836d4adfec7700d53b801d34aa9fc9bfda74169843f33a1e8b465e11292582eb968bb9c3a26f54dd172" diff --git a/config/submodule/coreboot/fam15h/vboot/module.cfg b/config/submodule/coreboot/fam15h/vboot/module.cfg index b0897e4f..a3a8f21b 100644 --- a/config/submodule/coreboot/fam15h/vboot/module.cfg +++ b/config/submodule/coreboot/fam15h/vboot/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://review.coreboot.org/vboot.git" -subrepo_bkup="https://github.com/coreboot/vboot" +subgit="https://review.coreboot.org/vboot.git" +subgit_bkup="https://github.com/coreboot/vboot" subhash="ecdca931ae0637d1a9498f64862939bd5bb99e0b" diff --git a/config/submodule/docs/html/module.cfg b/config/submodule/docs/html/module.cfg index 6c6dab9a..58bec732 100644 --- a/config/submodule/docs/html/module.cfg +++ b/config/submodule/docs/html/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later subhash="47c993cba483ff23a4c7b866c6cedcc905e9a2bd" -subrepo="https://codeberg.org/libreboot/lbwww" -subrepo_bkup="https://git.disroot.org/libreboot/lbwww" +subgit="https://codeberg.org/libreboot/lbwww" +subgit_bkup="https://git.disroot.org/libreboot/lbwww" diff --git a/config/submodule/docs/img/module.cfg b/config/submodule/docs/img/module.cfg index 32317ff9..8a176668 100644 --- a/config/submodule/docs/img/module.cfg +++ b/config/submodule/docs/img/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later subhash="68863fd7491f1358fb920d8ad558de35fcfec769" -subrepo="https://codeberg.org/libreboot/lbwww-img" -subrepo_bkup="https://git.disroot.org/libreboot/lbwww-img" +subgit="https://codeberg.org/libreboot/lbwww-img" +subgit_bkup="https://git.disroot.org/libreboot/lbwww-img" diff --git a/config/submodule/grub/default/gnulib/module.cfg b/config/submodule/grub/default/gnulib/module.cfg index eaf40b24..eb5aa2b6 100644 --- a/config/submodule/grub/default/gnulib/module.cfg +++ b/config/submodule/grub/default/gnulib/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://codeberg.org/libreboot/gnulib" -subrepo_bkup="git://git.sv.gnu.org/gnulib" # ALWAYS slow. only use as backup! +subgit="https://codeberg.org/libreboot/gnulib" +subgit_bkup="git://git.sv.gnu.org/gnulib" # ALWAYS slow. only use as backup! subhash="9f48fb992a3d7e96610c4ce8be969cff2d61a01b" diff --git a/config/submodule/grub/nvme/gnulib/module.cfg b/config/submodule/grub/nvme/gnulib/module.cfg index eaf40b24..eb5aa2b6 100644 --- a/config/submodule/grub/nvme/gnulib/module.cfg +++ b/config/submodule/grub/nvme/gnulib/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://codeberg.org/libreboot/gnulib" -subrepo_bkup="git://git.sv.gnu.org/gnulib" # ALWAYS slow. only use as backup! +subgit="https://codeberg.org/libreboot/gnulib" +subgit_bkup="git://git.sv.gnu.org/gnulib" # ALWAYS slow. only use as backup! subhash="9f48fb992a3d7e96610c4ce8be969cff2d61a01b" diff --git a/config/submodule/grub/xhci/gnulib/module.cfg b/config/submodule/grub/xhci/gnulib/module.cfg index eaf40b24..eb5aa2b6 100644 --- a/config/submodule/grub/xhci/gnulib/module.cfg +++ b/config/submodule/grub/xhci/gnulib/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subrepo="https://codeberg.org/libreboot/gnulib" -subrepo_bkup="git://git.sv.gnu.org/gnulib" # ALWAYS slow. only use as backup! +subgit="https://codeberg.org/libreboot/gnulib" +subgit_bkup="git://git.sv.gnu.org/gnulib" # ALWAYS slow. only use as backup! subhash="9f48fb992a3d7e96610c4ce8be969cff2d61a01b" diff --git a/config/submodule/pcsx-redux/uC-sdk/module.cfg b/config/submodule/pcsx-redux/uC-sdk/module.cfg index f8f44850..75f68204 100644 --- a/config/submodule/pcsx-redux/uC-sdk/module.cfg +++ b/config/submodule/pcsx-redux/uC-sdk/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later subhash="7c6f1973a16893cf1f0868af6f8e60a028b933ad" -subrepo="https://github.com/grumpycoders/uC-sdk.git" -subrepo_bkup="https://codeberg.org/vimuser/uC-sdk" +subgit="https://github.com/grumpycoders/uC-sdk.git" +subgit_bkup="https://codeberg.org/vimuser/uC-sdk" diff --git a/config/submodule/pico-sdk/tinyusb/module.cfg b/config/submodule/pico-sdk/tinyusb/module.cfg index 988d68ba..981e5305 100644 --- a/config/submodule/pico-sdk/tinyusb/module.cfg +++ b/config/submodule/pico-sdk/tinyusb/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later subhash="86c416d4c0fb38432460b3e11b08b9de76941bf5" -subrepo="https://codeberg.org/libreboot/tinyusb" -subrepo_bkup="https://github.com/hathach/tinyusb.git" +subgit="https://codeberg.org/libreboot/tinyusb" +subgit_bkup="https://github.com/hathach/tinyusb.git" diff --git a/config/submodule/stm32-vserprog/libopencm3/module.cfg b/config/submodule/stm32-vserprog/libopencm3/module.cfg index 069020cc..3ac90162 100644 --- a/config/submodule/stm32-vserprog/libopencm3/module.cfg +++ b/config/submodule/stm32-vserprog/libopencm3/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later subhash="458250dc6147dc807eec9e4d5a6caf38a699ecb1" -subrepo="https://codeberg.org/libreboot/libopencm3" -subrepo_bkup="https://github.com/libopencm3/libopencm3" +subgit="https://codeberg.org/libreboot/libopencm3" +subgit_bkup="https://github.com/libopencm3/libopencm3" diff --git a/include/get.sh b/include/get.sh index fbb41cd3..e582fdd8 100644 --- a/include/get.sh +++ b/include/get.sh @@ -2,8 +2,8 @@ # Copyright (c) 2020-2021,2023-2025 Leah Rowe # Copyright (c) 2022 Caleb La Grange -eval "`setvars "" loc url bkup_url subfile subhash subrepo subrepo_bkup \ - depend subfile_bkup repofail`" +eval "`setvars "" loc url bkup_url subcurl subhash subgit subgit_bkup \ + depend subcurl_bkup repofail`" tmpgit="$xbmklocal/gitclone" tmpgitcache="$XBMK_CACHE/tmpgit" @@ -65,24 +65,22 @@ git_prep() fetch_submodule() { mcfgdir="$mdir/${1##*/}"; eval \ - "`setvars "" subhash subrepo subrepo_bkup subfile subfile_bkup st`" + "`setvars "" subhash subgit subgit_bkup subcurl subcurl_bkup st`" [ ! -f "$mcfgdir/module.cfg" ] || . "$mcfgdir/module.cfg" || \ err "! . $mcfgdir/module.cfg" - for xt in repo file; do + for xt in git curl; do _seval="if [ -n \"\$sub$xt\" ] || [ -n \"\$sub${xt}_bkup\" ]" eval "$_seval; then st=\"\$st \$xt\"; fi" done - st="${st# }" && [ "$st" = "repo file" ] && err "$mdir: repo+file" - [ -z "$st" ] && return 0 # subrepo/subfile not defined + st="${st# }" && [ "$st" = "git curl" ] && err "$mdir: git+curl defined" + [ -z "$st" ] && return 0 # subgit/subcurl not defined chkvars "sub${st}" "sub${st}_bkup" "subhash" - [ "$st" = "file" ] && xbmkget curl "$subfile" "$subfile_bkup" \ - "$tmpgit/$1" "$subhash" && return 0 - x_ rm -Rf "$tmpgit/$1" - xbmkget git "$subrepo" "$subrepo_bkup" "$tmpgit/$1" "$subhash" \ - "$mdir/${1##*/}/patches" + [ "$st" = "git" ] && x_ rm -Rf "$tmpgit/$1" + eval xbmkget "$st" "\$sub$st" "\$sub${st}_bkup" "$tmpgit/$1" \ + "$subhash" "$mdir/${1##*/}/patches" } xbmkget() From 8d5475ed5b55b01290d09ff06a29ae3c6da119fa Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 14 May 2025 16:48:25 +0100 Subject: [PATCH 170/267] get.sh: simplify fetch_submodules() config check We already do what the old code does in setcfg, by virtue of the fact that the st variable is later checked, after loading this config conditionally, where the st variable is otherwise blank. We can avoid the unnecessary work after loading the config, by returning if the config is absent. Signed-off-by: Leah Rowe --- include/get.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/get.sh b/include/get.sh index e582fdd8..120d4264 100644 --- a/include/get.sh +++ b/include/get.sh @@ -66,8 +66,7 @@ fetch_submodule() { mcfgdir="$mdir/${1##*/}"; eval \ "`setvars "" subhash subgit subgit_bkup subcurl subcurl_bkup st`" - [ ! -f "$mcfgdir/module.cfg" ] || . "$mcfgdir/module.cfg" || \ - err "! . $mcfgdir/module.cfg" + eval "`setcfg "$mcfgdir/module.cfg" 0`" for xt in git curl; do _seval="if [ -n \"\$sub$xt\" ] || [ -n \"\$sub${xt}_bkup\" ]" From d9ed03f9ea595f8e376021f5560625908b4069d9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 14 May 2025 16:52:33 +0100 Subject: [PATCH 171/267] get.sh submodules: Don't delete files recursively I overlooked this in a previous patch. It doesn't really matter, since we're operating on a file anyway, but it's not correct. Files should have rm -f on them, not rm -Rf, for deletion. Signed-off-by: Leah Rowe --- include/get.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 120d4264..b3d17d7e 100644 --- a/include/get.sh +++ b/include/get.sh @@ -114,7 +114,7 @@ try_file() else bad_checksum "$6" "$cached" && x_ rm -f "$cached" && return 1 [ "$cached" != "$5" ] && x_ cp "$cached" "$5" - bad_checksum "$6" "$5" && x_ rm -rf "$5" && return 1; : + bad_checksum "$6" "$5" && x_ rm -f "$5" && return 1; : fi } From e62886dedae26f49822350daeb7cfe83bb9a3931 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 14 May 2025 16:59:59 +0100 Subject: [PATCH 172/267] get.sh: simplify try_copy() Signed-off-by: Leah Rowe --- include/get.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/get.sh b/include/get.sh index b3d17d7e..69cc1a4a 100644 --- a/include/get.sh +++ b/include/get.sh @@ -127,10 +127,8 @@ try_curl() try_copy() { - [ -L "$2" ] && printf "dl %s %s %s %s: '%s' is a symlink\n" \ - "$4" "$5" "$6" "$7" "$2" 1>&2 && return 1 - [ ! -f "$2" ] && printf "dl %s %s %s %s: '%s' not a file\n" \ - "$4" "$5" "$6" "$7" "$2" 1>&2 && return 1 + [ -L "$2" ] && printf "symlink %s (try_cp %s)\n" "$2" "$*" && return 1 + [ ! -f "$2" ] && "no such file %s (try_cp %s)\n" "$2" "$*" && return 1 cp "$2" "$1" || return 1; : } From f29aa9c8d5983f39166d00997364a47f126ae401 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 14 May 2025 17:03:32 +0100 Subject: [PATCH 173/267] get.sh: use subshells on try_ functions This way, we can use x_ which will then print the command that failed, if we need to debug future errors. Signed-off-by: Leah Rowe --- include/get.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/get.sh b/include/get.sh index 69cc1a4a..e2aaf70b 100644 --- a/include/get.sh +++ b/include/get.sh @@ -121,15 +121,15 @@ try_file() try_curl() { _ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0" - curl --location --retry 3 -A "$_ua" "$2" -o "$1" || \ - wget --tries 3 -U "$_ua" "$2" -O "$1" || return 1; : + ( x_ curl --location --retry 3 -A "$_ua" "$2" -o "$1" ) || \ + ( x_ wget --tries 3 -U "$_ua" "$2" -O "$1" ) || return 1; : } try_copy() { [ -L "$2" ] && printf "symlink %s (try_cp %s)\n" "$2" "$*" && return 1 [ ! -f "$2" ] && "no such file %s (try_cp %s)\n" "$2" "$*" && return 1 - cp "$2" "$1" || return 1; : + ( x_ cp "$2" "$1" ) || return 1; : } try_git() @@ -137,14 +137,14 @@ try_git() gitdest="`findpath "$1"`" || err "Can't get readpath for '$1'" x_ rm -Rf "$tmpgitcache" - [ -d "$gitdest" ] || git clone "$2" "$tmpgitcache" || return 1 + [ -d "$gitdest" ] || ( x_ git clone "$2" "$tmpgitcache" ) || return 1 [ -d "$gitdest" ] || x_ mkdir -p "${gitdest##*/}" [ -d "$gitdest" ] || x_ mv "$tmpgitcache" "$gitdest" - git -C "$gitdest" remote add main "$4" 2>/dev/null || : - git -C "$gitdest" remote add backup "$5" 2>/dev/null || : - git -C "$gitdest" fetch --all || : - git -C "$gitdest" pull --all || : + ( x_ git -C "$gitdest" remote add main "$4" 2>/dev/null ) || : + ( x_ git -C "$gitdest" remote add backup "$5" 2>/dev/null ) || : + ( x_ git -C "$gitdest" fetch --all ) || : + ( x_ git -C "$gitdest" pull --all ) || :; : } bad_checksum() From 46f42291d3c1e9a3e5b34b6bd727f94cd512bc64 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 14 May 2025 18:06:29 +0100 Subject: [PATCH 174/267] get.sh: fix broken printf statement Signed-off-by: Leah Rowe --- include/get.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/get.sh b/include/get.sh index e2aaf70b..7d728796 100644 --- a/include/get.sh +++ b/include/get.sh @@ -127,8 +127,8 @@ try_curl() try_copy() { - [ -L "$2" ] && printf "symlink %s (try_cp %s)\n" "$2" "$*" && return 1 - [ ! -f "$2" ] && "no such file %s (try_cp %s)\n" "$2" "$*" && return 1 + [ -L "$2" ] && printf "symlink %s (trycp %s)\n" "$2" "$*" && return 1 + [ ! -f "$2" ] && printf "%s missing (trycp %s)\n" "$2" "$*" && return 1 ( x_ cp "$2" "$1" ) || return 1; : } From 208dfc89bd583f4d8b757ca34e6f6a85538d5e48 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 15 May 2025 01:03:14 +0100 Subject: [PATCH 175/267] get.sh: simplify nuke() more specifically, re-write it so that it can be called with fx_ this means that the single-tree check for nuke.list can be made much simpler Signed-off-by: Leah Rowe --- include/get.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/include/get.sh b/include/get.sh index 7d728796..156d2b87 100644 --- a/include/get.sh +++ b/include/get.sh @@ -15,7 +15,7 @@ fetch_targets() printf "Creating %s tree %s\n" "$project" "$tree" git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \ "src/$project/$tree" with_submodules - nuke "$project/$tree" "$project/$tree" + ( fx_ nuke find "$xbmkpwd/config" -type f -name "nuke.list" ) || exit 1 } fetch_project() @@ -31,10 +31,7 @@ fetch_project() x_ ./mk -f $d done clone_project - - for x in config/git/*; do - [ -d "$x" ] && nuke "${x##*/}" "src/${x##*/}" 2>/dev/null; : - done; : + ( fx_ nuke find "$xbmkpwd/config" -type f -name "nuke.list" ) || exit 1 } clone_project() @@ -166,8 +163,7 @@ tmpclone() nuke() { - e "config/${1%/}/nuke.list" f missing || while read -r nukefile; do - rmf="src/${2%/}/$nukefile" && [ -L "$rmf" ] && continue - e "$rmf" e missing || x_ rm -Rf "$rmf" - done < "config/${1%/}/nuke.list"; : + rdir="${1#"$xbmkpwd/config/"}" && [ -d "$xbmkpwd/src/${rdir%/*}" ] && \ + x_ cd "$xbmkpwd/src/${rdir%/*}" && \ + dx_ "[ -L \"\$fx\" ] || x_ rm -Rf" "$1"; : } From c8813c9a144b14a78f7328ce7b886270e1b676f3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 15 May 2025 02:20:55 +0100 Subject: [PATCH 176/267] properly exit 1 when calling fx_ in a few places, we use the presence of a file found by fx_ to cause an exit, but the command that runs looks something like: exit 1 "string" this yields an error, and a non-zero exit, because of too many arguments to "exit", but we wanted a non-zero exit anyway. nevertheless, this is incorrect. to fix it, eval is used instead. if the never-going-to-exist condition one day exists where exit 1 actually returns, not, you know, exits, we will use err instead, with the string as argument. this should be fine. it's a bit hacky, but so is fx_, and it works. fx_ is used in several places to keep the sloccount down, providing a common way to perform while loops on the output of a command; that is its only purpose.. Signed-off-by: Leah Rowe --- include/lib.sh | 4 ++-- include/tree.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index cf4305a1..75de7512 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -75,8 +75,8 @@ chkvars() # e.g. coreboot is multi-tree, so 1 singletree() { - ( fx_ "exit 1" find "config/$1/"*/ -type f -name "target.cfg" ) || \ - return 1 + ( fx_ "eval exit 1 && err" find "config/$1/"*/ -type f \ + -name "target.cfg" ) || return 1; : } findpath() diff --git a/include/tree.sh b/include/tree.sh index f44b39cc..25d4732c 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -270,7 +270,7 @@ check_defconfig() elfcheck() { # TODO: *STILL* very hacky check. do it properly (based on build.list) - ( fx_ "exit 1" find "$dest_dir" -type f ) || return 1; : + ( fx_ "eval exit 1 && err" find "$dest_dir" -type f ) || return 1; : } handle_makefile() From a191d22bd6dad8b5d9cb37e952904ff1a0030259 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 15 May 2025 02:38:54 +0100 Subject: [PATCH 177/267] get.sh: add missing eval to dx_ in nuke() Signed-off-by: Leah Rowe --- include/get.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 156d2b87..74adb6be 100644 --- a/include/get.sh +++ b/include/get.sh @@ -165,5 +165,5 @@ nuke() { rdir="${1#"$xbmkpwd/config/"}" && [ -d "$xbmkpwd/src/${rdir%/*}" ] && \ x_ cd "$xbmkpwd/src/${rdir%/*}" && \ - dx_ "[ -L \"\$fx\" ] || x_ rm -Rf" "$1"; : + dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$1"; : } From d668f3a35296f0bc7884b18d49f523d7bb331c30 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 15 May 2025 21:51:36 +0100 Subject: [PATCH 178/267] vendor.sh: Properly verify SHA512SUM on extraction I currently check the downloaded files e.g. .exe file, but then I don't check - or even define - sha512sums for the files extracted from them e.g. me.bin This patch fixes that. It also caches the hashed files, so that extraction is faster on a re-run - this makes release builds go faster, when running ./mk release If a checksum is not defined, i.e. blank, then a warning is given, telling you to check a specific directory. This way, when adding new vendor files, you can add it first without specifying the checksum, e.g. me.bin checksum. Then you can manually inspect the files that were extracted, and define it, then test again. In a given pkg.cfg for config/vendor, the following variables are now available for use: FSPM_bin_hash for fsp m module FSPS_bin_hash for fsp s module EC_FW1_hash for KBC1126 EC firmware (1st file) EC_FW2_hash for KBC1126 EC firmware (2nd file) ME_bin_hash for me.bin MRC_bin_hash for mrc.bin (broadwell boards) REF_bin_hash for refcode (broadwell boards) SCH5545EC_bin_hash for sch5545 firmware (Dell Precision T1650) TBFW_bin_hash for Lenovo ThunderBolt firmware (e.g. T480/T480s) E6400_VGA_bin_hash for Dell E6400 Nvidia VGA ROM In practise, most people use release archives, and the inject script, so I knew those were reliable, because the ROM images were hashed prior to removing files. This patch benefits people using lbmk.git directly, without using release files, because now they know they have a valid file e.g. me.bin Previously, only the download was checked, not the extracted files, which meant that the only thing preventing a brick was the code not being buggy. Any number of bugs could pop up in the future, so this new level of integrity will protect against such a scenario, and provide early warning prompting bug fixes. Signed-off-by: Leah Rowe --- config/vendor/3050micro/pkg.cfg | 3 + config/vendor/e6400/pkg.cfg | 1 + config/vendor/haswell/pkg.cfg | 1 + config/vendor/hp2170p/pkg.cfg | 3 + config/vendor/hp2560p/pkg.cfg | 3 + config/vendor/hp2570p/pkg.cfg | 3 + config/vendor/hp8200sff/pkg.cfg | 1 + config/vendor/hp820g2/pkg.cfg | 3 + config/vendor/hp8460pintel/pkg.cfg | 3 + config/vendor/hp8470pintel/pkg.cfg | 3 + config/vendor/hp8560w/pkg.cfg | 3 + config/vendor/hp9470m/pkg.cfg | 3 + config/vendor/ivybridge/pkg.cfg | 1 + config/vendor/sandybridge/pkg.cfg | 1 + config/vendor/t1650/pkg.cfg | 2 + config/vendor/t1700/pkg.cfg | 2 + config/vendor/t480/pkg.cfg | 4 ++ config/vendor/t480s/pkg.cfg | 5 ++ include/get.sh | 26 ++++--- include/mrc.sh | 13 ++-- include/vendor.sh | 108 ++++++++++++++++++++--------- 21 files changed, 142 insertions(+), 50 deletions(-) diff --git a/config/vendor/3050micro/pkg.cfg b/config/vendor/3050micro/pkg.cfg index 497a27a6..45ba55d1 100644 --- a/config/vendor/3050micro/pkg.cfg +++ b/config/vendor/3050micro/pkg.cfg @@ -3,6 +3,7 @@ DL_hash="976bbb1e625f64df276d8343757d910c88b8a781f953bc2c41a7dd15184ec70d55f8081de2a0aaa83cddb8e73bdc2df6288fde6e0897e4928c48ca4bb30bea2d" DL_url="https://download.asrock.com/BIOS/1151/H110M-DGS(7.30)ROM.zip" DL_url_bkup="https://web.archive.org/web/20230822134231/https://download.asrock.com/BIOS/1151/H110M-DGS(7.30)ROM.zip" +ME_bin_hash="3231ddb79be81f0a631926fc0e533ee7bce2d10032d7d45e56ae8a9894bcf9b4ca0b4f6fd3bc4daa185a464e771e0bf3d1b771a3180739b6896cec911758145b" # for Fsp.fd, we don't rely on a download. Instead, # we copy from coreboot.git. The file is defined @@ -10,6 +11,8 @@ DL_url_bkup="https://web.archive.org/web/20230822134231/https://download.asrock. # and inserted to CBFS with names CONFIG_FSP_S_CBFS and CONFIG_FSP_M_CBFS # FSPFD_hash="c500166a8553a80ba8db8b8185a896e0ae1562ea3c139e07acd9e7937baf8110ba743cc79b69db09a5f39c076d1d22bc45045223975f46aea2034ba82a6b0360" +FSPM_bin_hash="b15712a53f4d16f36b384beb6dbb716c0b0924751d6ca1e229cd4b8c03aef9eda025c235af247e53dac94d94b79559623974d0d21c7f97e125d8ecc2c86bf03f" +FSPS_bin_hash="64ac9f93e43efddc35931e168d6594c2b39fb5a0da863d22f2d000d7eacc0692b07ce89389cbb1c5b95ff9b2bba508c538e37d0e644fcab7b2cada773da65ce6" # We will use deguard to disable the Intel Boot Guard: ME11bootguard="y" diff --git a/config/vendor/e6400/pkg.cfg b/config/vendor/e6400/pkg.cfg index c5962480..21d1e69d 100644 --- a/config/vendor/e6400/pkg.cfg +++ b/config/vendor/e6400/pkg.cfg @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later E6400_VGA_DL_hash="6217d5fce2291d15bb0649fd2faaeb78e4c48962b07a2bea6af60466bfdc5f233af0d077c2c6e71dd96047bdbb1f612324cef0a5e728ba9a9ec5c69a4022cd8d" +E6400_VGA_bin_hash="24fb3d934afca13bd2b43ec958aa2f69654e0f8ee2dd6ca910350a738dea22cfd7f69626093e047566b27c0dd9f3595beeacaad7812fc7f6a13970e49e7b60f3" E6400_VGA_DL_url="https://dl.dell.com/FOLDER01530530M/1/E6400A34.exe" E6400_VGA_DL_url_bkup="https://web.archive.org/web/20230506014903/https://dl.dell.com/FOLDER01530530M/1/E6400A34.exe" E6400_VGA_offset="274451" diff --git a/config/vendor/haswell/pkg.cfg b/config/vendor/haswell/pkg.cfg index e9722a11..401736b5 100644 --- a/config/vendor/haswell/pkg.cfg +++ b/config/vendor/haswell/pkg.cfg @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="f3d79aec805c8b0094a4081be76b3a22d329c479ad18210449b7acc3236ccfc4a2103eaa7c5b79a4872bfd699eede047efd46dfb06dc8f47e3216fc254612998" +ME_bin_hash="8629caded7efd2aa234cc378b7118f0d300402537b8aff6aa3d9b895c6b14590a79cb02d1db7a91de36d36f5612386fc99ddcb57c9d78b1e75b5864e68763de1" DL_url="https://download.lenovo.com/pccbbs/mobiles/glrg22ww.exe" DL_url_bkup="https://web.archive.org/web/20211120031520/https://download.lenovo.com/pccbbs/mobiles/glrg22ww.exe" diff --git a/config/vendor/hp2170p/pkg.cfg b/config/vendor/hp2170p/pkg.cfg index 77cbd08b..192bcf41 100644 --- a/config/vendor/hp2170p/pkg.cfg +++ b/config/vendor/hp2170p/pkg.cfg @@ -1,8 +1,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="4dc908050c91c1227645c900ddee88652937540af4ba222b0239b7f459f260cdf6e5e8113ac14e5543d00cf53abdd6c7bd23e61f690de1ce45a3709a30cbb91c" +ME_bin_hash="672240d231a723ea7fac112262fdc28884c43a5be9b231dfae838c7a1edc86140da38983079d23ab5ac8e6c74611b65da4872ecbab3ec979c680d3f526eb91ed" DL_url="https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" DL_url_bkup="https://web.archive.org/web/20210706183911/https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" EC_hash="940e533b6a276c13a6e46a93795ca84b19877b05e82c0c1795b7fea9cbea63c28e606ef994352fc77c4fdfb2e0c31c5edeefa98b989e1990364dfc6417b25460" EC_url="https://ftp.hp.com/pub/softpaq/sp96001-96500/sp96088.exe" EC_url_bkup="https://web.archive.org/web/20230909164345/https://ftp.hp.com/pub/softpaq/sp96001-96500/sp96088.exe" +EC_FW1_hash="44a27359e8e2ecfae910a754617d5ee947d6bba976f2eb53114a97c71b64813da7ab4223749706c9bbcaf1e752c190834ee3b41c297c191b3cac200814e02938" +EC_FW2_hash="09c5b8bab6f258a0303ac502b4900cd4277bd6c43bfd2ef0030df6e918ef3300d04d2979373f8b05f77d1eae1c27ebd01856426b8eed6f215e1fcaed68e0977e" diff --git a/config/vendor/hp2560p/pkg.cfg b/config/vendor/hp2560p/pkg.cfg index f7c7cd14..52b9394d 100644 --- a/config/vendor/hp2560p/pkg.cfg +++ b/config/vendor/hp2560p/pkg.cfg @@ -1,8 +1,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="81c9917938c4a2a4f128c976250451931efd0f25b51ff34f058ddacb8eec27272691371864a683ec7abcb924fea32592d061584c7b2571a5d3e84eb870281cc3" +ME_bin_hash="6a7eb169a01581682a2ecf4b284c1689eb7746cc80aa16ea1ce35d1a1c47a92664b5240defd62535e9707c3f3d42abfb62da3254b97e569de178099f7683c858" DL_url="https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/83rf46ww.exe" DL_url_bkup="https://web.archive.org/web/20220202201637/https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/83rf46ww.exe" EC_hash="a602cc7627c569bc423a5857cf506fbc3bcd68cb6b43a7c1b99d12a569b4107c412748cf49605ef4d5b930eb14b6815c4d1b1dc20145fe9d707e445fc201cea2" EC_url="https://ftp.hp.com/pub/softpaq/sp85501-86000/sp85526.exe" EC_url_bkup="https://web.archive.org/web/20230416125725/https://ftp.hp.com/pub/softpaq/sp85501-86000/sp85526.exe" +EC_FW1_hash="44a27359e8e2ecfae910a754617d5ee947d6bba976f2eb53114a97c71b64813da7ab4223749706c9bbcaf1e752c190834ee3b41c297c191b3cac200814e02938" +EC_FW2_hash="a05c1eb5433f43e035327d0ae74e9dbd09ecb45f00be656e477ebd5b505ca21bae820e90c29483c4c641591fdd2aebb6b6ea0ecfb879b506bc1a657c01a21bd2" diff --git a/config/vendor/hp2570p/pkg.cfg b/config/vendor/hp2570p/pkg.cfg index 9f1a85aa..1df49d73 100644 --- a/config/vendor/hp2570p/pkg.cfg +++ b/config/vendor/hp2570p/pkg.cfg @@ -1,8 +1,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="4dc908050c91c1227645c900ddee88652937540af4ba222b0239b7f459f260cdf6e5e8113ac14e5543d00cf53abdd6c7bd23e61f690de1ce45a3709a30cbb91c" +ME_bin_hash="672240d231a723ea7fac112262fdc28884c43a5be9b231dfae838c7a1edc86140da38983079d23ab5ac8e6c74611b65da4872ecbab3ec979c680d3f526eb91ed" DL_url="https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" DL_url_bkup="https://web.archive.org/web/20210706183911/https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" EC_hash="61ed284bdf938c5f36ad3267263fb3963a6608339425bc41aaef3ab0cd98f07c998d816b0233735ca35dc6cb771257da3f09a40d5cfc96bb6388b4366348275e" EC_url="https://ftp.hp.com/pub/softpaq/sp96001-96500/sp96085.exe" EC_url_bkup="https://web.archive.org/web/20230610174558/https://ftp.hp.com/pub/softpaq/sp96001-96500/sp96085.exe" +EC_FW1_hash="44a27359e8e2ecfae910a754617d5ee947d6bba976f2eb53114a97c71b64813da7ab4223749706c9bbcaf1e752c190834ee3b41c297c191b3cac200814e02938" +EC_FW2_hash="d4afcad4960253af674f1dcd3a5a044444b7fcfbaa2a993f976997966b579a80d8a1c58b0ed0a47d862312ad81e433834bb1992c79f69d858d8c00e8cd62e1fb" diff --git a/config/vendor/hp8200sff/pkg.cfg b/config/vendor/hp8200sff/pkg.cfg index 9d0a34de..dba0b354 100644 --- a/config/vendor/hp8200sff/pkg.cfg +++ b/config/vendor/hp8200sff/pkg.cfg @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="8fcb691bf84dc1feefc3c84f7cc59eadaabb200477bb3ecba1b050f23f133b0a8c2539015a523f676544c2dff64599bcba7e844e8c31757b90d70bb4485b5664" +ME_bin_hash="732954bd288a7d7de3b779032476e2bd5a6f64b6971ff3053434d49ab55fd514db9f224e83883215646e50eecf4ecbdb69a65d5957d241e1146424053dd3ba91" DL_url="https://ftp.ext.hp.com/pub/softpaq/sp96001-96500/sp96026.exe" DL_url_bkup="https://web.archive.org/web/20220708171920/https://ftp.ext.hp.com/pub/softpaq/sp96001-96500/sp96026.exe" diff --git a/config/vendor/hp820g2/pkg.cfg b/config/vendor/hp820g2/pkg.cfg index 308148c5..4a2fdbb3 100644 --- a/config/vendor/hp820g2/pkg.cfg +++ b/config/vendor/hp820g2/pkg.cfg @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="1ac05a3e4f46426eeb77f89c4aca25ed1ad64479d8fcba6a3ab63a944512bacbc5d148cc7b9c4ff4b8c90a1fb1de4776e46f14aca8021900e0df37246aa0b717" +ME_bin_hash="ca754e2fd09eb48bc14b2d1b19d3fa3ed1df2297cff2b7d9b68e9002812e745a59a8ca921f26834ae84c0076c64d8dfab75ce113b50e4badafbfb8ab6c14ad2b" DL_url="https://download.lenovo.com/pccbbs/mobiles/n10rg50w.exe" DL_url_bkup="https://download.lenovo.com/pccbbs/mobiles/n10rg50w.exe" MRC_url="https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13904.77.0_samus_recovery_stable-channel_mp-v3.bin.zip" @@ -9,3 +10,5 @@ MRC_hash="3ff1599c52539f0707a07a8664a84ce51cd3fed1569df4bb7aa6722fc8dec0af175425 MRC_board="samus" MRC_refcode_cbtree="fam15h" MRC_refcode_gbe="131253" +MRC_bin_hash="cade33e8664fb92ebb6ce0c92b572f587f047b2832babb6bd30eb221dba76b08d578e189ba1f89cdb4c956aecd092ebd7443adbc30cf3800452b906967cedc11" +REF_bin_hash="7efa3bdc48d548924b4c57bbadc99a7add91ac8c5eb7f8f98874c2f8583ca0e71e99997186aaf2714c8ca56593e12c80c1aa9e727a462ef9d2c36963042e7d56" diff --git a/config/vendor/hp8460pintel/pkg.cfg b/config/vendor/hp8460pintel/pkg.cfg index 1e1da34e..1140e5c9 100644 --- a/config/vendor/hp8460pintel/pkg.cfg +++ b/config/vendor/hp8460pintel/pkg.cfg @@ -1,8 +1,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="81c9917938c4a2a4f128c976250451931efd0f25b51ff34f058ddacb8eec27272691371864a683ec7abcb924fea32592d061584c7b2571a5d3e84eb870281cc3" +ME_bin_hash="6a7eb169a01581682a2ecf4b284c1689eb7746cc80aa16ea1ce35d1a1c47a92664b5240defd62535e9707c3f3d42abfb62da3254b97e569de178099f7683c858" DL_url="https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/83rf46ww.exe" DL_url_bkup="https://web.archive.org/web/20220202201637/https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/83rf46ww.exe" EC_hash="9be5511d7ba07a376583cbd0b7fa4d7dff87ebc94b78d489fd62a14cb7f61eac99670e6a10ce374fe8e3c4bdafabbd1edce7774c3a482c15c2d4207b74ea49ed" EC_url="https://ftp.hp.com/pub/softpaq/sp85501-86000/sp85528.exe" EC_url_bkup="https://web.archive.org/web/20211231004901/https://ftp.ext.hp.com/pub/softpaq/sp85501-86000/sp85528.exe" +EC_FW1_hash="44a27359e8e2ecfae910a754617d5ee947d6bba976f2eb53114a97c71b64813da7ab4223749706c9bbcaf1e752c190834ee3b41c297c191b3cac200814e02938" +EC_FW2_hash="8eba6e0087e42a2f552de3367639b376501d31e8ae1629846496c3eb46ed7d2f9b46531dc245cc2ce5f4a91047fe84a37b350864cdc37530148f456818c0133e" diff --git a/config/vendor/hp8470pintel/pkg.cfg b/config/vendor/hp8470pintel/pkg.cfg index 1170f56b..db0b6e69 100644 --- a/config/vendor/hp8470pintel/pkg.cfg +++ b/config/vendor/hp8470pintel/pkg.cfg @@ -1,8 +1,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="4dc908050c91c1227645c900ddee88652937540af4ba222b0239b7f459f260cdf6e5e8113ac14e5543d00cf53abdd6c7bd23e61f690de1ce45a3709a30cbb91c" +ME_bin_hash="672240d231a723ea7fac112262fdc28884c43a5be9b231dfae838c7a1edc86140da38983079d23ab5ac8e6c74611b65da4872ecbab3ec979c680d3f526eb91ed" DL_url="https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" DL_url_bkup="https://web.archive.org/web/20210706183911/https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" EC_hash="b95c9cf909ed537fb448e2be69eddcb57459efbaf0a979a73cd2bce90a7014b110f4dbbeecfd596c072636396b8f20c229c59ffe34e45500ce9edb000c6ccaf9" EC_url="https://ftp.hp.com/pub/softpaq/sp77501-78000/sp77818.exe" EC_url_bkup="https://web.archive.org/web/20230909173821/https://ftp.hp.com/pub/softpaq/sp77501-78000/sp77818.exe" +EC_FW1_hash="44a27359e8e2ecfae910a754617d5ee947d6bba976f2eb53114a97c71b64813da7ab4223749706c9bbcaf1e752c190834ee3b41c297c191b3cac200814e02938" +EC_FW2_hash="d7a44b682b1dae7f3cbcc34646b3dd80895a7e2132ab0292b3d42ccf54a9fa447773f7e8e914b0c427adaaad8aa54224e7e146dc72280cf04093956727f41a03" diff --git a/config/vendor/hp8560w/pkg.cfg b/config/vendor/hp8560w/pkg.cfg index 629d96d1..224b448c 100644 --- a/config/vendor/hp8560w/pkg.cfg +++ b/config/vendor/hp8560w/pkg.cfg @@ -1,8 +1,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="81c9917938c4a2a4f128c976250451931efd0f25b51ff34f058ddacb8eec27272691371864a683ec7abcb924fea32592d061584c7b2571a5d3e84eb870281cc3" +ME_bin_hash="6a7eb169a01581682a2ecf4b284c1689eb7746cc80aa16ea1ce35d1a1c47a92664b5240defd62535e9707c3f3d42abfb62da3254b97e569de178099f7683c858" DL_url="https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/83rf46ww.exe" DL_url_bkup="https://web.archive.org/web/20220202201637/https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/83rf46ww.exe" EC_hash="8e2bc5dca1a1cf0cfc1ac9df74eb6fda333f8ae560019f8182a49d3a716d72938f6cde4aa5ee56942def08207d3ef95706653bd238768fd029da43e9a4fbcc67" EC_url="https://ftp.hp.com/pub/softpaq/sp78001-78500/sp78085.exe" EC_url_bkup="https://web.archive.org/web/20230402085323/https://ftp.hp.com/pub/softpaq/sp78001-78500/sp78085.exe" +EC_FW1_hash="44a27359e8e2ecfae910a754617d5ee947d6bba976f2eb53114a97c71b64813da7ab4223749706c9bbcaf1e752c190834ee3b41c297c191b3cac200814e02938" +EC_FW2_hash="82882406167e7df8ff90d2ea8d93adee59c3e8eb034b6dfcd0ff70cadf8ab3e5acee7262dd344560e118d00b010ed13c18539b042dae0b4b4e6a2c09402aadc4" diff --git a/config/vendor/hp9470m/pkg.cfg b/config/vendor/hp9470m/pkg.cfg index 9cdb8143..46f1349b 100644 --- a/config/vendor/hp9470m/pkg.cfg +++ b/config/vendor/hp9470m/pkg.cfg @@ -1,8 +1,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="4dc908050c91c1227645c900ddee88652937540af4ba222b0239b7f459f260cdf6e5e8113ac14e5543d00cf53abdd6c7bd23e61f690de1ce45a3709a30cbb91c" +ME_bin_hash="672240d231a723ea7fac112262fdc28884c43a5be9b231dfae838c7a1edc86140da38983079d23ab5ac8e6c74611b65da4872ecbab3ec979c680d3f526eb91ed" DL_url="https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" DL_url_bkup="https://web.archive.org/web/20210706183911/https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" EC_hash="563422bf5420da18b89439f28a38ea28a175f0ad3588f0f5ea39b08dfdd14c8d513cbf11c2125ec3869fc3b7222c7dc3d111415185ea9b73f41410b1b57f13bd" EC_url="https://ftp.hp.com/pub/softpaq/sp96001-96500/sp96090.exe" EC_url_bkup="http://web.archive.org/web/20220504072602/https://ftp.ext.hp.com/pub/softpaq/sp96001-96500/sp96090.exe" +EC_FW1_hash="44a27359e8e2ecfae910a754617d5ee947d6bba976f2eb53114a97c71b64813da7ab4223749706c9bbcaf1e752c190834ee3b41c297c191b3cac200814e02938" +EC_FW2_hash="0d7b446fda5e5cde9570b6df15e4c0ad6b9fad6b425f498669d91bccb4a4bb9a8d22d20f4adb9f116e38df6db3519aae14a6d8fd8cb3075c93ce7c5ae0d8eacb" diff --git a/config/vendor/ivybridge/pkg.cfg b/config/vendor/ivybridge/pkg.cfg index d9b2200b..3b3d1091 100644 --- a/config/vendor/ivybridge/pkg.cfg +++ b/config/vendor/ivybridge/pkg.cfg @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="4dc908050c91c1227645c900ddee88652937540af4ba222b0239b7f459f260cdf6e5e8113ac14e5543d00cf53abdd6c7bd23e61f690de1ce45a3709a30cbb91c" +ME_bin_hash="672240d231a723ea7fac112262fdc28884c43a5be9b231dfae838c7a1edc86140da38983079d23ab5ac8e6c74611b65da4872ecbab3ec979c680d3f526eb91ed" DL_url="https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" DL_url_bkup="https://web.archive.org/web/20210706183911/https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" diff --git a/config/vendor/sandybridge/pkg.cfg b/config/vendor/sandybridge/pkg.cfg index bb022043..c243413f 100644 --- a/config/vendor/sandybridge/pkg.cfg +++ b/config/vendor/sandybridge/pkg.cfg @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="81c9917938c4a2a4f128c976250451931efd0f25b51ff34f058ddacb8eec27272691371864a683ec7abcb924fea32592d061584c7b2571a5d3e84eb870281cc3" +ME_bin_hash="6a7eb169a01581682a2ecf4b284c1689eb7746cc80aa16ea1ce35d1a1c47a92664b5240defd62535e9707c3f3d42abfb62da3254b97e569de178099f7683c858" DL_url="https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/83rf46ww.exe" DL_url_bkup="https://web.archive.org/web/20220202201637/https://download.lenovo.com/ibmdl/pub/pc/pccbbs/mobiles/83rf46ww.exe" diff --git a/config/vendor/t1650/pkg.cfg b/config/vendor/t1650/pkg.cfg index f994b942..47303884 100644 --- a/config/vendor/t1650/pkg.cfg +++ b/config/vendor/t1650/pkg.cfg @@ -1,8 +1,10 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="4dc908050c91c1227645c900ddee88652937540af4ba222b0239b7f459f260cdf6e5e8113ac14e5543d00cf53abdd6c7bd23e61f690de1ce45a3709a30cbb91c" +ME_bin_hash="672240d231a723ea7fac112262fdc28884c43a5be9b231dfae838c7a1edc86140da38983079d23ab5ac8e6c74611b65da4872ecbab3ec979c680d3f526eb91ed" DL_url="https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" DL_url_bkup="https://web.archive.org/web/20210706183911/https://download.lenovo.com/pccbbs/mobiles/g1rg24ww.exe" SCH5545EC_DL_url="https://dl.dell.com/FOLDER05065992M/1/T1650A28.exe" SCH5545EC_DL_url_bkup="https://web.archive.org/web/20230811151654/https://dl.dell.com/FOLDER05065992M/1/T1650A28.exe" SCH5545EC_DL_hash="18261d0f7f27e9de3b0b5a25019b9a934ef1a61cd3f0140e34f38553695e91e671e227a8fa962774edceab5c7804d13ed9fe1c518c5643c7c8f15632f903a6c4" +SCH5545EC_bin_hash="51d9540f73c60ba5e245a8a98c2215d477d3bad9759f1dae94a4fe63652421d8552406817c2482dd6ee3bb55d942bbc0315eab54095544d7956e73112e2d8483" diff --git a/config/vendor/t1700/pkg.cfg b/config/vendor/t1700/pkg.cfg index cc100683..979dd7bf 100644 --- a/config/vendor/t1700/pkg.cfg +++ b/config/vendor/t1700/pkg.cfg @@ -1,9 +1,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later DL_hash="f3d79aec805c8b0094a4081be76b3a22d329c479ad18210449b7acc3236ccfc4a2103eaa7c5b79a4872bfd699eede047efd46dfb06dc8f47e3216fc254612998" +ME_bin_hash="8629caded7efd2aa234cc378b7118f0d300402537b8aff6aa3d9b895c6b14590a79cb02d1db7a91de36d36f5612386fc99ddcb57c9d78b1e75b5864e68763de1" DL_url="https://download.lenovo.com/pccbbs/mobiles/glrg22ww.exe" DL_url_bkup="https://web.archive.org/web/20211120031520/https://download.lenovo.com/pccbbs/mobiles/glrg22ww.exe" MRC_url="https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13904.77.0_samus_recovery_stable-channel_mp-v3.bin.zip" MRC_url_bkup="https://web.archive.org/web/20220310155922/https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_13904.77.0_samus_recovery_stable-channel_mp-v3.bin.zip" MRC_hash="3ff1599c52539f0707a07a8664a84ce51cd3fed1569df4bb7aa6722fc8dec0af1754250333b6ca1a9794d970a4de7b29a5cf2499f5b61e4c3eab64d1314aaea9" +MRC_bin_hash="cade33e8664fb92ebb6ce0c92b572f587f047b2832babb6bd30eb221dba76b08d578e189ba1f89cdb4c956aecd092ebd7443adbc30cf3800452b906967cedc11" MRC_board="samus" diff --git a/config/vendor/t480/pkg.cfg b/config/vendor/t480/pkg.cfg index 3071f83d..90c31b75 100644 --- a/config/vendor/t480/pkg.cfg +++ b/config/vendor/t480/pkg.cfg @@ -2,6 +2,7 @@ # ME firmware (deguard will be used) DL_hash="df735a24242792bf4150f30bf0bd4fdbdc0fb6bf0f897ea533df32567be8e084006d692fb6351677f8cc976878c5018667901dbd407b0a77805754f7c101497c" +ME_bin_hash="fad8bcd2ea2ae9d1a2a1e223f499f15ada0787feb600eab3201669f82b7ade0741194fa86448eff57d7f68c8ebbfc1bf266b4d68aca509ee48db258902a805e7" DL_url="https://dl.dell.com/FOLDER04573471M/1/Inspiron_5468_1.3.0.exe" DL_url_bkup="https://web.archive.org/web/20241110222323/https://dl.dell.com/FOLDER04573471M/1/Inspiron_5468_1.3.0.exe" @@ -11,6 +12,8 @@ DL_url_bkup="https://web.archive.org/web/20241110222323/https://dl.dell.com/FOLD # and inserted to CBFS with names CONFIG_FSP_S_CBFS and CONFIG_FSP_M_CBFS # FSPFD_hash="c500166a8553a80ba8db8b8185a896e0ae1562ea3c139e07acd9e7937baf8110ba743cc79b69db09a5f39c076d1d22bc45045223975f46aea2034ba82a6b0360" +FSPM_bin_hash="b15712a53f4d16f36b384beb6dbb716c0b0924751d6ca1e229cd4b8c03aef9eda025c235af247e53dac94d94b79559623974d0d21c7f97e125d8ecc2c86bf03f" +FSPS_bin_hash="64ac9f93e43efddc35931e168d6594c2b39fb5a0da863d22f2d000d7eacc0692b07ce89389cbb1c5b95ff9b2bba508c538e37d0e644fcab7b2cada773da65ce6" # We will use deguard to disable the Intel Boot Guard: ME11bootguard="y" @@ -27,3 +30,4 @@ TBFW_url="https://download.lenovo.com/pccbbs/mobiles/n24th13w.exe" TBFW_url_bkup="https://web.archive.org/web/20241004165955/https://download.lenovo.com/pccbbs/mobiles/n24th13w.exe" TBFW_hash="906d916e8ae77e6d146c67c3113cd904e735a7f28cb2fc37e2284758ead5cda8dd4025c1c741fac9162b1eb01cff08fc39a0d4e79c5cec0515f1d3e6447d1323" TBFW_size=1048576 # size in bytes, when padding, matching TBFW's flash IC +TBFW_bin_hash="15aea269e79d92fe651fe613e30febee5459786169f647e5f321b7382892cf2b8fc61aa1afb8a04d0369b71579de54763272ba144673fbfadfefeb384d45c293" diff --git a/config/vendor/t480s/pkg.cfg b/config/vendor/t480s/pkg.cfg index a9e3e48b..4c1eeaf1 100644 --- a/config/vendor/t480s/pkg.cfg +++ b/config/vendor/t480s/pkg.cfg @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-3.0-or-later +# ME firmware (deguard will be used) DL_hash="df735a24242792bf4150f30bf0bd4fdbdc0fb6bf0f897ea533df32567be8e084006d692fb6351677f8cc976878c5018667901dbd407b0a77805754f7c101497c" +ME_bin_hash="1c77371187ef64e719debc75f606c78fc063b8a84f2704f3fa45e9e4d8a9bccec50420d262bbfbc0dd1695e038698b10113a1bc532a33b943321cd0811e40786" DL_url="https://dl.dell.com/FOLDER04573471M/1/Inspiron_5468_1.3.0.exe" DL_url_bkup="https://web.archive.org/web/20241110222323/https://dl.dell.com/FOLDER04573471M/1/Inspiron_5468_1.3.0.exe" @@ -10,6 +12,8 @@ DL_url_bkup="https://web.archive.org/web/20241110222323/https://dl.dell.com/FOLD # and inserted to CBFS with names CONFIG_FSP_S_CBFS and CONFIG_FSP_M_CBFS # FSPFD_hash="c500166a8553a80ba8db8b8185a896e0ae1562ea3c139e07acd9e7937baf8110ba743cc79b69db09a5f39c076d1d22bc45045223975f46aea2034ba82a6b0360" +FSPM_bin_hash="b15712a53f4d16f36b384beb6dbb716c0b0924751d6ca1e229cd4b8c03aef9eda025c235af247e53dac94d94b79559623974d0d21c7f97e125d8ecc2c86bf03f" +FSPS_bin_hash="64ac9f93e43efddc35931e168d6594c2b39fb5a0da863d22f2d000d7eacc0692b07ce89389cbb1c5b95ff9b2bba508c538e37d0e644fcab7b2cada773da65ce6" # We will use deguard to disable the Intel Boot Guard: ME11bootguard="y" @@ -26,3 +30,4 @@ TBFW_url="https://download.lenovo.com/pccbbs/mobiles/n22th11w.exe" TBFW_url_bkup="https://web.archive.org/web/20230319003752/https://download.lenovo.com/pccbbs/mobiles/n22th11w.exe" TBFW_hash="ef8ec0a41d7faaa0ce514cfb6f8e7e10669c878eff69fbe1b821443b6218f5b31e1b910c8abceecf38d4b11a6e552d90f277c96c7a9c512d605c8b8aea9c1c0c" TBFW_size=1048576 # size in bytes, when padding, matching TBFW's flash IC +TBFW_bin_hash="41672f3ccdbf7a39ffd7d94c5cfb16efd2911be7b980feaa88b0f33777bd679eafdb97019a9c7b1d32cf76297ba0cb81d5b36072f6be96cec2834011249984db" diff --git a/include/get.sh b/include/get.sh index 74adb6be..4bcccceb 100644 --- a/include/get.sh +++ b/include/get.sh @@ -84,8 +84,11 @@ xbmkget() [ "$1" = "curl" ] || [ "$1" = "copy" ] || [ "$1" = "git" ] || \ err "Bad dlop (arg 1): xbmkget $*" + echk="f" && [ "$1" = "git" ] && echk="d" + for url in "$2" "$3"; do - [ -n "$url" ] && try_file "$url" "$@" && return 0 + [ -n "$url" ] && try_file "$url" "$@" && \ + eval "[ -$echk \"$4\" ] && return 0" done && err "$1 $2 $3 $4: not downloaded"; : } @@ -100,11 +103,10 @@ try_file() echk="d" && [ "$2" != "git" ] && echk="f" && \ bad_checksum "$6" "$cached" 2>/dev/null && x_ rm -f "$cached" - e "$cached" $echk || try_$2 "$cached" "$@" || return 1 - if e "$5" $echk && [ "$2" != "git" ]; then - bad_checksum "$6" "$5" 2>/dev/null && x_ cp "$cached" "$5" - fi - e "$cached" $echk missing && return 1 + eval "[ -$echk \"$cached\" ] || try_$2 \"\$cached\" \"\$@\" || return 1" + [ "$2" != "git" ] && [ -f "$5" ] && \ + bad_checksum "$6" "$5" 2>/dev/null && x_ cp "$cached" "$5" + eval "[ -$echk \"$cached\" ] || return 1" if [ "$2" = "git" ]; then tmpclone "$cached" "$5" "$6" "$7" || return 1 @@ -113,6 +115,8 @@ try_file() [ "$cached" != "$5" ] && x_ cp "$cached" "$5" bad_checksum "$6" "$5" && x_ rm -f "$5" && return 1; : fi + + eval "[ -$echk \"$5\" ] || return 1" } try_curl() @@ -146,9 +150,13 @@ try_git() bad_checksum() { - [ ! -f "$2" ] || [ "$(sha512sum "$2" | awk '{print $1}')" != "$1" ] \ - || return 1 - printf "Bad checksum for file: %s\n" "$2" 1>&2 + [ ! -f "$2" ] && printf "File '%s' missing (sha512sum '%s')\n" \ + "$2" "$1" 1>&2 && return 0 + fchksum="$(x_ sha512sum "$2" | awk '{print $1}')" || \ + err "Can't get sha512sum on '$2' (checking for sha512sum '$1')" + [ "$fchksum" != "$1" ] || return 1 + printf "WARNING: BAD checksum for '%s' - expected '%s', got '%s'\n" \ + "$2" "$1" "$fchksum" 1>&2 x_ rm -f "$2" } diff --git a/include/mrc.sh b/include/mrc.sh index 70c3bd3c..a132f574 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -10,23 +10,18 @@ extract_mrc() { extract_shellball x_ "$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ - -f "$_dest" -r RO_SECTION - - [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && extract_refcode extra; : + -f "$_pre_dest" -r RO_SECTION } extract_refcode() { - _refdest="${CONFIG_REFCODE_BLOB_FILE##*../}" - e "$_refdest" f && return 0 - - [ $# -lt 1 ] && extract_shellball + extract_shellball # cbfstool after coreboot 4.13 changed the stage file attribute scheme, # and refcode is extracted from an image using the old scheme. we use # cbfstool from coreboot 4.11_branch, the tree used by ASUS KGPE-D16 chkvars cbfstoolref - x_ mkdir -p "${_refdest%/*}" + x_ mkdir -p "${_pre_dest%/*}" x_ "$cbfstoolref" "$appdir/bios.bin" extract \ -m x86 -n fallback/refcode -f "$appdir/ref" -r RO_SECTION @@ -35,7 +30,7 @@ extract_refcode() [ -z "$MRC_refcode_gbe" ] || x_ dd if="config/ifd/hp820g2/1.bin" \ of="$appdir/ref" bs=1 seek=$MRC_refcode_gbe count=1 conv=notrunc; : - x_ mv "$appdir/ref" "$_refdest" + x_ mv "$appdir/ref" "$_pre_dest" } extract_shellball() diff --git a/include/vendor.sh b/include/vendor.sh index 823ba74f..8a71ad5b 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -22,12 +22,12 @@ vfix="DO_NOT_FLASH_YET._FIRST,_INJECT_FILES_VIA_INSTRUCTIONS_ON_LIBREBOOT.ORG_" # lbmk-specific extension to the "cv" variable (not suitable for cbmk) cvchk="CONFIG_INCLUDE_SMSC_SCH5545_EC_FW CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \ - CONFIG_KBC1126_FIRMWARE CONFIG_LENOVO_TBFW_BIN CONFIG_VGA_BIOS_FILE \ - CONFIG_FSP_M_FILE CONFIG_FSP_S_FILE" + CONFIG_LENOVO_TBFW_BIN CONFIG_VGA_BIOS_FILE CONFIG_FSP_M_FILE \ + CONFIG_FSP_S_FILE CONFIG_KBC1126_FW1 CONFIG_KBC1126_FW2" # lbmk-specific extensions to the "cv" variable (not suitable for cbmk) -cvxbmk="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE CONFIG_KBC1126_FW1 \ - CONFIG_KBC1126_FW2 CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2_OFFSET \ +cvxbmk="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE \ + CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2_OFFSET \ CONFIG_VGA_BIOS_ID CONFIG_BOARD_DELL_E6400 CONFIG_FSP_S_CBFS \ CONFIG_HAVE_REFCODE_BLOB CONFIG_REFCODE_BLOB_FILE CONFIG_FSP_FD_PATH \ CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS \ @@ -40,7 +40,9 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ kbc1126_ec_dump MRC_refcode_cbtree _dl SCH5545EC_DL_url EC_url rom DL_url \ nukemode cbfstoolref FSPFD_hash _7ztest ME11bootguard ME11delta xromsize \ ME11version ME11sku ME11pch _me _metmp mfs TBFW_url_bkup TBFW_url cbdir \ - TBFW_hash TBFW_size hashfile EC_url_bkup`" + TBFW_hash TBFW_size hashfile EC_url_bkup FSPM_bin_hash FSPS_bin_hash \ + EC_FW1_hash EC_FW2_hash ME_bin_hash MRC_bin_hash REF_bin_hash _dl_bin \ + SCH5545EC_bin_hash TBFW_bin_hash E6400_VGA_bin_hash _pre_dest`" download() { @@ -52,24 +54,34 @@ download() getfiles() { [ -z "$CONFIG_HAVE_ME_BIN" ] || fetch intel_me "$DL_url" \ - "$DL_url_bkup" "$DL_hash" "$CONFIG_ME_BIN_PATH" + "$DL_url_bkup" "$DL_hash" "$CONFIG_ME_BIN_PATH" "curl" \ + "$ME_bin_hash" [ -z "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" ] || fetch sch5545ec \ "$SCH5545EC_DL_url" "$SCH5545EC_DL_url_bkup" "$SCH5545EC_DL_hash" \ - "$CONFIG_SMSC_SCH5545_EC_FW_FILE" - [ -z "$CONFIG_KBC1126_FIRMWARE" ] || fetch kbc1126ec "$EC_url" \ - "$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW1" + "$CONFIG_SMSC_SCH5545_EC_FW_FILE" "curl" "$SCH5545EC_bin_hash" + [ -z "$CONFIG_KBC1126_FW1" ] || fetch kbc1126ec "$EC_url" \ + "$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW1" "curl" \ + "$EC_FW1_hash" + [ -z "$CONFIG_KBC1126_FW2" ] || fetch kbc1126ec "$EC_url" \ + "$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW2" "curl" \ + "$EC_FW2_hash" [ -z "$CONFIG_VGA_BIOS_FILE" ] || fetch e6400vga "$E6400_VGA_DL_url" \ - "$E6400_VGA_DL_url_bkup" "$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE" + "$E6400_VGA_DL_url_bkup" "$E6400_VGA_DL_hash" \ + "$CONFIG_VGA_BIOS_FILE" "curl" "$E6400_VGA_bin_hash" [ -z "$CONFIG_HAVE_MRC" ] || fetch "mrc" "$MRC_url" "$MRC_url_bkup" \ - "$MRC_hash" "$CONFIG_MRC_FILE" - [ -n "$CONFIG_REFCODE_BLOB_FILE" ] && fetch "refcode" "$MRC_url" \ - "$MRC_url_bkup" "$MRC_hash" "$CONFIG_REFCODE_BLOB_FILE" + "$MRC_hash" "$CONFIG_MRC_FILE" "curl" "$MRC_bin_hash" + [ -z "$CONFIG_REFCODE_BLOB_FILE" ] || fetch "refcode" "$MRC_url" \ + "$MRC_url_bkup" "$MRC_hash" "$CONFIG_REFCODE_BLOB_FILE" "curl" \ + "$REF_bin_hash" [ -z "$CONFIG_LENOVO_TBFW_BIN" ] || fetch "tbfw" "$TBFW_url" \ - "$TBFW_url_bkup" "$TBFW_hash" "$CONFIG_LENOVO_TBFW_BIN" + "$TBFW_url_bkup" "$TBFW_hash" "$CONFIG_LENOVO_TBFW_BIN" "curl" \ + "$TBFW_bin_hash" [ -z "$CONFIG_FSP_M_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ - "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_M_FILE" copy + "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_M_FILE" "copy" \ + "$FSPM_bin_hash" [ -z "$CONFIG_FSP_S_FILE" ] || fetch "fsp" "$CONFIG_FSP_FD_PATH" \ - "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_S_FILE" copy; : + "$CONFIG_FSP_FD_PATH" "$FSPFD_hash" "$CONFIG_FSP_S_FILE" "copy" \ + "$FSPS_bin_hash"; : } fetch() @@ -79,9 +91,18 @@ fetch() dl_bkup="$3" dlsum="$4" _dest="${5##*../}" + _pre_dest="$XBMK_CACHE/tmpdl/check" || err "!fetch, mktemp, $*" + dlop="$6" + binsum="$7" [ "$5" = "/dev/null" ] && return 0 - _dl="$XBMK_CACHE/file/$dlsum" + _dl="$XBMK_CACHE/file/$dlsum" # internet file to extract from e.g. .exe + _dl_bin="$XBMK_CACHE/file/$binsum" # extracted file e.g. me.bin + + # an extracted vendor file will be placed in pre_dest first, for + # verifying its checksum. if it matches, it is later moved to _dest + remkdir "${_pre_dest%/*}" "$appdir" + # HACK: if grabbing fsp from coreboot, fix the path for lbmk [ "$dl_type" = "fsp" ] && for _cdl in dl dl_bkup; do eval "$_cdl=\"\${$_cdl##*../}\"; _cdp=\"\$$_cdl\"" @@ -89,20 +110,43 @@ fetch() [ -f "$_cdp" ] && eval "$_cdl=\"$_cdp\"" done; : - dlop="curl" && [ $# -gt 5 ] && dlop="$6" + # download the file (from the internet) to extract from xbmkget "$dlop" "$dl" "$dl_bkup" "$_dl" "$dlsum" - x_ rm -Rf "${_dl}_extracted" - e "$_dest" f && return 0 + + # skip extraction if a cached extracted file exists + ( xbmkget copy "$_dl_bin" "$_dl_bin" "$_dest" "$binsum" 2>/dev/null ) \ + || : + [ -f "$_dest" ] && return 0 x_ mkdir -p "${_dest%/*}" - remkdir "$appdir" [ "$dl_type" = "fsp" ] || extract_archive "$_dl" "$appdir" || \ [ "$dl_type" = "e6400vga" ] || err "$_dest $dl_type: !extract" x_ extract_$dl_type "$_dl" "$appdir" set -u -e - e "$_dest" f missing && err "!extract_$dl_type"; : + + # some functions don't output directly to the given file, _pre_dest. + # instead, they put multiple files there, but we need the one matching + # the given hashsum. So, search for a matching file via bruteforce: + ( fx_ "eval mkdst \"$binsum\"" x_ find "${_pre_dest%/*}" -type f ) || : + + [ -f "$_dest" ] && return 0 + [ -z "$binsum" ] && \ + printf "'%s', '%s': checksum undefined. Check files in '%s'\n" \ + "$board" "$_dest" "${_pre_dest%/*}" 1>&2 + e "$_dest" f not && err "missing file '$_dest', !extract_$dl_type"; : + e "$_dest" f && printf "WARNING: '%s' exists but has bad checksum" \ + "$_dest" + err "Could not safely extract '$_dest', for board '$board'" +} + +mkdst() +{ + bad_checksum "$1" "$2" && x_ rm -f "$2" && return 0 + x_ mv "$2" "$_dl_bin" + x_ cp "$_dl_bin" "$_dest" + exit 1 } extract_intel_me() @@ -110,7 +154,6 @@ extract_intel_me() e "$mecleaner" f not && err "$cbdir: me_cleaner missing" _7ztest="$xbmklocal/metmp/a" - _me="$xbmkpwd/$_dest" _metmp="$xbmklocal/me.bin" x_ rm -f "$_metmp" "$xbmklocal/a" @@ -121,14 +164,14 @@ extract_intel_me() set +u +e x_ rm -Rf "$xbmkpwd/metmp" ( fx_ find_me x_ find "$xbmkpwd/$appdir" -type f ) || : - [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0 + [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_pre_dest" && return 0 ( x_ cd src/deguard/ x_ ./finalimage.py --delta "data/delta/$ME11delta" --version \ "$ME11version" --pch "$ME11pch" --sku "$ME11sku" \ - --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_me" - ) || err "Error running deguard for $_me"; : + --fake-fpfs data/fpfs/zero --input "$_metmp" --output "$_pre_dest" + ) || err "Error running deguard for $_dest"; : } find_me() @@ -165,7 +208,7 @@ extract_kbc1126ec() ) || err "$board: can't extract kbc1126 ec firmware" x_ e "$appdir/ec.bin.fw1" f && x_ e "$appdir/ec.bin.fw2" f - x_ cp "$appdir/"ec.bin.fw* "${_dest%/*}/" + x_ cp "$appdir/"ec.bin.fw* "${_pre_dest%/*}/" } extract_e6400vga() @@ -178,7 +221,7 @@ extract_e6400vga() x_ e "bios.bin" f "$e6400_unpack" bios.bin || printf "TODO: fix dell extract util\n" ) || err "can't extract e6400 vga rom" - x_ cp "$appdir/$E6400_VGA_romname" "$_dest" + x_ cp "$appdir/$E6400_VGA_romname" "$_pre_dest" } extract_sch5545ec() @@ -191,26 +234,27 @@ extract_sch5545ec() _sch5545ec_fw="$_sch5545ec_fw/0 Raw section/body.bin" # <-- this! x_ "$uefiextract" "$_bios" - x_ cp "$_sch5545ec_fw" "$_dest" + x_ cp "$_sch5545ec_fw" "$_pre_dest" } # Lenovo ThunderBolt firmware updates: # https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988 extract_tbfw() { - chkvars TBFW_size; fx_ copytb x_ find "$appdir" -type f -name "TBT.bin" + chkvars TBFW_size + fx_ copytb x_ find "$appdir" -type f -name "TBT.bin" } copytb() { [ -f "$1" ] && [ ! -L "$1" ] && x_ dd if=/dev/null of="$1" bs=1 \ - seek=$TBFW_size && x_ mv "$1" "$_dest" && return 1; : + seek=$TBFW_size && x_ mv "$1" "$_pre_dest" && return 1; : } extract_fsp() { x_ python "$cbdir/3rdparty/fsp/Tools/SplitFspBin.py" split -f "$1" \ - -o "${_dest%/*}" -n "Fsp.fd" + -o "${_pre_dest%/*}" -n "Fsp.fd" } setvfile() From 4313b474a593c5b2e57278c590b7cfb56dec5114 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 16 May 2025 07:03:08 +0100 Subject: [PATCH 179/267] vendor.sh: additional safety check the exit from mkdst can also be non-zero if mv or cp failed, but there's no way to handle that reliably. therefore, the checksum verification should be done one final time, to compensate. Signed-off-by: Leah Rowe --- include/vendor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vendor.sh b/include/vendor.sh index 8a71ad5b..7dcf9757 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -131,7 +131,7 @@ fetch() # the given hashsum. So, search for a matching file via bruteforce: ( fx_ "eval mkdst \"$binsum\"" x_ find "${_pre_dest%/*}" -type f ) || : - [ -f "$_dest" ] && return 0 + bad_checksum "$binsum" "$_dest" || [ ! -f "$_dest" ] || return 0 [ -z "$binsum" ] && \ printf "'%s', '%s': checksum undefined. Check files in '%s'\n" \ "$board" "$_dest" "${_pre_dest%/*}" 1>&2 From 6a2ed9428b7528da5c3953a89797d9bfb6d8f7f3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 16 May 2025 08:20:17 +0100 Subject: [PATCH 180/267] vendor.sh: Fix broken KBC1126 insertion On release archives, I overlooked the previous change to downloads, during the recent implementation of extra safety checks. I previously checked there whether the variable named CONFIG_KBC1126_FIRMWARE was defined, and grabbed both; now I check CONFIG_KBC1126_FW1 and CONFIG_KBC1126_FW2 separately, grabbing each file separately. This patch replicates that change for insertions. Otherwise, hash verification on ROM images will fail, when running the inject script on release images. Downloading was being done, reliably, and the extracted files were correct, so there was no danger if the user was building from source and flashing that way. However, checksum verification on full images failed when inserting into archives. This is not because the files were wrong; they were *correct*. However, the EC firmware was not being inserted *at all* on HP EliteBooks, because of this oversight. The check is now based on whether the paths to the files themselves are defined, not whether EC firmware is enabled in the coreboot config; the latter is implied. With this patch, vendor file insertion once again works perfectly, without error, on every board. There was no real danger for users, just a minor inconvenience. Sorry! Signed-off-by: Leah Rowe --- include/vendor.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/vendor.sh b/include/vendor.sh index 7dcf9757..5d7ea82b 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -346,9 +346,10 @@ add_vfiles() [ "$CONFIG_HAVE_MRC" = "y" ] && vfile "mrc.bin" "$CONFIG_MRC_FILE" \ "mrc" "0xfffa0000" [ "$CONFIG_HAVE_ME_BIN" = "y" ] && vfile IFD "$CONFIG_ME_BIN_PATH" me - [ "$CONFIG_KBC1126_FIRMWARE" = "y" ] && vfile ecfw1.bin \ - "$CONFIG_KBC1126_FW1" raw "$CONFIG_KBC1126_FW1_OFFSET" && vfile \ - ecfw2.bin "$CONFIG_KBC1126_FW2" raw "$CONFIG_KBC1126_FW2_OFFSET" + [ -n "$CONFIG_KBC1126_FW1" ] && vfile ecfw1.bin \ + "$CONFIG_KBC1126_FW1" raw "$CONFIG_KBC1126_FW1_OFFSET" + [ -n "$CONFIG_KBC1126_FW2" ] && vfile ecfw2.bin \ + "$CONFIG_KBC1126_FW2" raw "$CONFIG_KBC1126_FW2_OFFSET" [ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ] && \ vfile "pci$CONFIG_VGA_BIOS_ID.rom" "$CONFIG_VGA_BIOS_FILE" optionrom [ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \ From 6dea381614d01abb58a3534cc62c2346ba654beb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 09:46:54 +0100 Subject: [PATCH 181/267] get.sh: fix bad mkdir command this is the mkdir call that createsn the directory where a cached git repository is moved to, during creation. Signed-off-by: Leah Rowe --- include/get.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 4bcccceb..c9bf840d 100644 --- a/include/get.sh +++ b/include/get.sh @@ -139,7 +139,7 @@ try_git() x_ rm -Rf "$tmpgitcache" [ -d "$gitdest" ] || ( x_ git clone "$2" "$tmpgitcache" ) || return 1 - [ -d "$gitdest" ] || x_ mkdir -p "${gitdest##*/}" + [ -d "$gitdest" ] || x_ mkdir -p "${gitdest%/*}" [ -d "$gitdest" ] || x_ mv "$tmpgitcache" "$gitdest" ( x_ git -C "$gitdest" remote add main "$4" 2>/dev/null ) || : From d2564fd9457c1fd7533c02341769483e81e9667f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 11:08:06 +0100 Subject: [PATCH 182/267] get.sh: simplify tmpclone() Signed-off-by: Leah Rowe --- include/get.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/get.sh b/include/get.sh index c9bf840d..c6c6b75b 100644 --- a/include/get.sh +++ b/include/get.sh @@ -109,7 +109,7 @@ try_file() eval "[ -$echk \"$cached\" ] || return 1" if [ "$2" = "git" ]; then - tmpclone "$cached" "$5" "$6" "$7" || return 1 + [ -d "$5" ] || tmpclone "$cached" "$5" "$6" "$7" || return 1 else bad_checksum "$6" "$cached" && x_ rm -f "$cached" && return 1 [ "$cached" != "$5" ] && x_ cp "$cached" "$5" @@ -162,7 +162,6 @@ bad_checksum() tmpclone() { - [ -d "$2" ] && return 0 printf "Creating git clone '%s' from '%s'\n" "$2" "$1" ( x_ git clone "$1" "$2" ) || return 1 ( x_ git -C "$2" reset --hard "$3" ) || return 1 From 840d6a1d2770e765db63c4e1114f2b8adaa2029e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 11:54:14 +0100 Subject: [PATCH 183/267] get.sh: FURTHER simplify nuke() this is getting almost comical now Signed-off-by: Leah Rowe --- include/get.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/get.sh b/include/get.sh index c6c6b75b..3448a668 100644 --- a/include/get.sh +++ b/include/get.sh @@ -15,7 +15,7 @@ fetch_targets() printf "Creating %s tree %s\n" "$project" "$tree" git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \ "src/$project/$tree" with_submodules - ( fx_ nuke find "$xbmkpwd/config" -type f -name "nuke.list" ) || exit 1 + ( fx_ nuke find config -type f -name "nuke.list" ) || err; : } fetch_project() @@ -31,7 +31,7 @@ fetch_project() x_ ./mk -f $d done clone_project - ( fx_ nuke find "$xbmkpwd/config" -type f -name "nuke.list" ) || exit 1 + ( fx_ nuke find config -type f -name "nuke.list" ) || err; : } clone_project() @@ -170,7 +170,6 @@ tmpclone() nuke() { - rdir="${1#"$xbmkpwd/config/"}" && [ -d "$xbmkpwd/src/${rdir%/*}" ] && \ - x_ cd "$xbmkpwd/src/${rdir%/*}" && \ - dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$1"; : + r="${1#config/}" && r="$xbmkpwd/src/${r%/*}" && [ -d "$r" ] && x_ cd \ + "$r" && dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$xbmkpwd/$1"; : } From dbe109d7b541af4c218620dee7c3523bad6ed1fc Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 12:43:25 +0100 Subject: [PATCH 184/267] release.sh: don't move src/docs/ otherwise, ./mk -b (without argument) will fail, on release archives. also, perhaps i should add an mkhelper to build it? Signed-off-by: Leah Rowe --- include/release.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/release.sh b/include/release.sh index f0799f17..7a7b96fd 100644 --- a/include/release.sh +++ b/include/release.sh @@ -54,7 +54,6 @@ prep_release_src() x_ ./mk -f fx_ "x_ rm -Rf" x_ find . -name ".git" fx_ "x_ rm -Rf" x_ find . -name ".gitmodules" - x_ mv src/docs docs } prep_release_tarball() From 136bd66c2809dcdb1b9475687101332f2d91d4cb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 13:00:17 +0100 Subject: [PATCH 185/267] mrc.sh: merge extract_mrc with extract_shellball Signed-off-by: Leah Rowe --- include/mrc.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/include/mrc.sh b/include/mrc.sh index a132f574..775831f8 100644 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -6,16 +6,9 @@ eval "`setvars "" MRC_url MRC_url_bkup MRC_hash MRC_board SHELLBALL`" -extract_mrc() -{ - extract_shellball - x_ "$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ - -f "$_pre_dest" -r RO_SECTION -} - extract_refcode() { - extract_shellball + extract_mrc # cbfstool after coreboot 4.13 changed the stage file attribute scheme, # and refcode is extracted from an image using the old scheme. we use @@ -33,7 +26,7 @@ extract_refcode() x_ mv "$appdir/ref" "$_pre_dest" } -extract_shellball() +extract_mrc() { chkvars "MRC_board" "CONFIG_MRC_FILE" SHELLBALL="chromeos-firmwareupdate-$MRC_board" @@ -42,7 +35,10 @@ extract_shellball() x_ cd "$appdir" extract_partition "${MRC_url##*/}" extract_archive "$SHELLBALL" . - ) || err "mrc download/extract failure"; : + ) || err "mrc download/extract failure" + + x_ "$cbfstool" "$appdir/"bios.bin extract -n mrc.bin \ + -f "${_pre_dest%/*}/mrc.bin" -r RO_SECTION } extract_partition() From 587d245cafa630ff252a45297760371ef07a7f15 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 13:17:09 +0100 Subject: [PATCH 186/267] release.sh: simplify prep_release_bin() Signed-off-by: Leah Rowe --- include/release.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/release.sh b/include/release.sh index 7a7b96fd..618ad633 100644 --- a/include/release.sh +++ b/include/release.sh @@ -30,7 +30,7 @@ release() prep_release src prep_release tarball - prep_release bin + [ "$relmode" = "src" ] || prep_release bin x_ rm -Rf "$relsrcdir" x_ mkdir -p "$reldir" @@ -70,7 +70,6 @@ prep_release_tarball() prep_release_bin() { - [ "$relmode" = "src" ] && return 0 x_ ./mk -d coreboot fx_ "x_ ./mk -b" printf \ "coreboot\npico-serprog\nstm32-vserprog\npcsx-redux\n" From 05c07f7401bf79e6eeb34e12a19ce6d2cabab2ab Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 15:20:02 +0100 Subject: [PATCH 187/267] get.sh: move nuke() to release.sh we really only need it there, because the context is for release archives. normal use of the git repository doesn't matter in the context of deletions, because that will not be distributed. only the result of ./mk release will be distributed. the builds produced will not change as a result of this, for people using the normal git repository, because the files in question are never used anyway, in our configs. this is being done to make working on local repos easier. Signed-off-by: Leah Rowe --- include/get.sh | 8 -------- include/release.sh | 29 ++++++++++++++++++----------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/include/get.sh b/include/get.sh index 3448a668..244eb1bb 100644 --- a/include/get.sh +++ b/include/get.sh @@ -15,7 +15,6 @@ fetch_targets() printf "Creating %s tree %s\n" "$project" "$tree" git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \ "src/$project/$tree" with_submodules - ( fx_ nuke find config -type f -name "nuke.list" ) || err; : } fetch_project() @@ -31,7 +30,6 @@ fetch_project() x_ ./mk -f $d done clone_project - ( fx_ nuke find config -type f -name "nuke.list" ) || err; : } clone_project() @@ -167,9 +165,3 @@ tmpclone() ( x_ git -C "$2" reset --hard "$3" ) || return 1 ( fx_ "eval x_ git -C \"$2\" am" find "$4" -type f ) || return 1; : } - -nuke() -{ - r="${1#config/}" && r="$xbmkpwd/src/${r%/*}" && [ -d "$r" ] && x_ cd \ - "$r" && dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$xbmkpwd/$1"; : -} diff --git a/include/release.sh b/include/release.sh index 618ad633..1eec8fa9 100644 --- a/include/release.sh +++ b/include/release.sh @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Copyright (c) 2023-2025 Leah Rowe -eval "`setvars "" reldir reldest vdir relsrcdir relmode`" +eval "`setvars "" reldir reldest vdir relsrc relmode`" release() { @@ -23,15 +23,15 @@ release() err "already exists: \"$reldest\"" vdir="$XBMK_CACHE/relpwd/${xbmktmp##*/}/$version" - relsrcdir="$vdir/${relname}_src" + relsrc="$vdir/${relname}_src" remkdir "$vdir" - x_ git clone . "$relsrcdir" + x_ git clone . "$relsrc" prep_release src prep_release tarball [ "$relmode" = "src" ] || prep_release bin - x_ rm -Rf "$relsrcdir" + x_ rm -Rf "$relsrc" x_ mkdir -p "$reldir" x_ mv "$vdir" "$reldir" @@ -42,9 +42,9 @@ release() prep_release() { - x_ touch "$relsrcdir/lock" + x_ touch "$relsrc/lock" ( - [ "$1" = "tarball" ] || x_ cd "$relsrcdir" + [ "$1" = "tarball" ] || x_ cd "$relsrc" prep_release_$1 ) || err "can't prep release $1" } @@ -54,17 +54,24 @@ prep_release_src() x_ ./mk -f fx_ "x_ rm -Rf" x_ find . -name ".git" fx_ "x_ rm -Rf" x_ find . -name ".gitmodules" + ( fx_ nuke find config -type f -name "nuke.list" ) || err; : +} + +nuke() +{ + r="${1#config/}" && r="$relsrc/src/${r%/*}" && [ -d "$r" ] && x_ cd \ + "$r" && dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$relsrc/$1"; : } prep_release_tarball() { git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \ - --abbrev-commit > "$relsrcdir/CHANGELOG" || err "!log $relsrcdir" - x_ rm -f "$relsrcdir/lock" - x_ rm -Rf "$relsrcdir/cache" "$relsrcdir/tmp" + --abbrev-commit > "$relsrc/CHANGELOG" || err "!log $relsrc" + x_ rm -f "$relsrc/lock" + x_ rm -Rf "$relsrc/cache" "$relsrc/tmp" ( - x_ cd "${relsrcdir%/*}" - x_ mktarball "${relsrcdir##*/}" "${relsrcdir##*/}.tar.xz" + x_ cd "${relsrc%/*}" + x_ mktarball "${relsrc##*/}" "${relsrc##*/}.tar.xz" ) || err "can't create src tarball"; : } From 6dc71cc02468a0fce6d5edbc9c9077c09808acf0 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 15:38:20 +0100 Subject: [PATCH 188/267] release.sh: simplify nuke() EVEN MORE Signed-off-by: Leah Rowe --- include/release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/release.sh b/include/release.sh index 1eec8fa9..729ae4e6 100644 --- a/include/release.sh +++ b/include/release.sh @@ -59,8 +59,8 @@ prep_release_src() nuke() { - r="${1#config/}" && r="$relsrc/src/${r%/*}" && [ -d "$r" ] && x_ cd \ - "$r" && dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$relsrc/$1"; : + r="${1#config/}"; r="$relsrc/src/${r%/*}"; [ -d "$r" ] && x_ cd "$r" \ + && dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$relsrc/$1"; : } prep_release_tarball() From 47a3982bbeabd46623e7874ab9e139eb59474388 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 15:49:24 +0100 Subject: [PATCH 189/267] release.sh: use x_ on find command for nuke() Signed-off-by: Leah Rowe --- include/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/release.sh b/include/release.sh index 729ae4e6..528156b7 100644 --- a/include/release.sh +++ b/include/release.sh @@ -54,7 +54,7 @@ prep_release_src() x_ ./mk -f fx_ "x_ rm -Rf" x_ find . -name ".git" fx_ "x_ rm -Rf" x_ find . -name ".gitmodules" - ( fx_ nuke find config -type f -name "nuke.list" ) || err; : + ( fx_ nuke x_ find config -type f -name "nuke.list" ) || err; : } nuke() From 4ca57943d7031c4a38d9dbd565fd58adf2a7c2c2 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 16:03:08 +0100 Subject: [PATCH 190/267] release.sh: simplify nuke() EVEN MORE, yet again Signed-off-by: Leah Rowe --- include/release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/release.sh b/include/release.sh index 528156b7..de8551d6 100644 --- a/include/release.sh +++ b/include/release.sh @@ -59,8 +59,8 @@ prep_release_src() nuke() { - r="${1#config/}"; r="$relsrc/src/${r%/*}"; [ -d "$r" ] && x_ cd "$r" \ - && dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$relsrc/$1"; : + r="$relsrc/src/${1#config/}"; [ -d "${r%/*}" ] && x_ cd "${r%/*}" && \ + dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$relsrc/$1"; : } prep_release_tarball() From 01a0217c1e39ef8f665b5499e210fac7d0221416 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 16:51:12 +0100 Subject: [PATCH 191/267] get.sh: simplify bad_checksum() Signed-off-by: Leah Rowe --- include/get.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/get.sh b/include/get.sh index 244eb1bb..b83449b7 100644 --- a/include/get.sh +++ b/include/get.sh @@ -148,14 +148,10 @@ try_git() bad_checksum() { - [ ! -f "$2" ] && printf "File '%s' missing (sha512sum '%s')\n" \ - "$2" "$1" 1>&2 && return 0 - fchksum="$(x_ sha512sum "$2" | awk '{print $1}')" || \ - err "Can't get sha512sum on '$2' (checking for sha512sum '$1')" - [ "$fchksum" != "$1" ] || return 1 - printf "WARNING: BAD checksum for '%s' - expected '%s', got '%s'\n" \ - "$2" "$1" "$fchksum" 1>&2 - x_ rm -f "$2" + [ ! -f "$2" ] && printf "'%s' missing, %s\n" "$2" "$1" 1>&2 && return 0 + csum="$(x_ sha512sum "$2" | awk '{print $1}')" || err "!sha512 '$2' $1" + [ "$csum" != "$1" ] && printf "BAD SHA512, '%s'; need '%s', got %s\n" \ + "$2" "$1" "$csum" 1>&2 && x_ rm -f "$2" && return 0; return 1 } tmpclone() From 3c58181f69ee28c954a8844613dee9d4d576ea2c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 17 May 2025 16:52:32 +0100 Subject: [PATCH 192/267] get.sh: remove useless message the user doesn't care where the temporary git repo is git shows that information anyway, in the git clone command Signed-off-by: Leah Rowe --- include/get.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index b83449b7..667ab398 100644 --- a/include/get.sh +++ b/include/get.sh @@ -156,7 +156,6 @@ bad_checksum() tmpclone() { - printf "Creating git clone '%s' from '%s'\n" "$2" "$1" ( x_ git clone "$1" "$2" ) || return 1 ( x_ git -C "$2" reset --hard "$3" ) || return 1 ( fx_ "eval x_ git -C \"$2\" am" find "$4" -type f ) || return 1; : From 44df3b2bff864e7eb42e370d7ac9182799a59fdf Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 10:33:23 +0100 Subject: [PATCH 193/267] release.sh: tidy up nuke() i wasn't ok having that variable initialisation and then the commands on the same line. it looks messy. having the commands on a separate line makes the code nice to read, so let's separate them. Signed-off-by: Leah Rowe --- include/release.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/release.sh b/include/release.sh index de8551d6..77281009 100644 --- a/include/release.sh +++ b/include/release.sh @@ -59,8 +59,9 @@ prep_release_src() nuke() { - r="$relsrc/src/${1#config/}"; [ -d "${r%/*}" ] && x_ cd "${r%/*}" && \ - dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$relsrc/$1"; : + r="$relsrc/src/${1#config/}" + [ -d "${r%/*}" ] && x_ cd "${r%/*}" && \ + dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$relsrc/$1" } prep_release_tarball() From a3e1ed9823d4750d8e7c5610eecc811e841a35d4 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 10:51:03 +0100 Subject: [PATCH 194/267] release.sh: rename relsrc to rsrc Signed-off-by: Leah Rowe --- include/release.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/include/release.sh b/include/release.sh index 77281009..5d6da466 100644 --- a/include/release.sh +++ b/include/release.sh @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Copyright (c) 2023-2025 Leah Rowe -eval "`setvars "" reldir reldest vdir relsrc relmode`" +eval "`setvars "" reldir reldest vdir rsrc relmode`" release() { @@ -23,15 +23,15 @@ release() err "already exists: \"$reldest\"" vdir="$XBMK_CACHE/relpwd/${xbmktmp##*/}/$version" - relsrc="$vdir/${relname}_src" + rsrc="$vdir/${relname}_src" remkdir "$vdir" - x_ git clone . "$relsrc" + x_ git clone . "$rsrc" prep_release src prep_release tarball [ "$relmode" = "src" ] || prep_release bin - x_ rm -Rf "$relsrc" + x_ rm -Rf "$rsrc" x_ mkdir -p "$reldir" x_ mv "$vdir" "$reldir" @@ -42,9 +42,9 @@ release() prep_release() { - x_ touch "$relsrc/lock" + x_ touch "$rsrc/lock" ( - [ "$1" = "tarball" ] || x_ cd "$relsrc" + [ "$1" = "tarball" ] || x_ cd "$rsrc" prep_release_$1 ) || err "can't prep release $1" } @@ -59,20 +59,20 @@ prep_release_src() nuke() { - r="$relsrc/src/${1#config/}" + r="$rsrc/src/${1#config/}" [ -d "${r%/*}" ] && x_ cd "${r%/*}" && \ - dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$relsrc/$1" + dx_ "eval [ -L \"\$fx\" ] || x_ rm -Rf" "$rsrc/$1"; : } prep_release_tarball() { git log --graph --pretty=format:'%Cred%h%Creset %s %Creset' \ - --abbrev-commit > "$relsrc/CHANGELOG" || err "!log $relsrc" - x_ rm -f "$relsrc/lock" - x_ rm -Rf "$relsrc/cache" "$relsrc/tmp" + --abbrev-commit > "$rsrc/CHANGELOG" || err "!log $rsrc" + x_ rm -f "$rsrc/lock" + x_ rm -Rf "$rsrc/cache" "$rsrc/tmp" ( - x_ cd "${relsrc%/*}" - x_ mktarball "${relsrc##*/}" "${relsrc##*/}.tar.xz" + x_ cd "${rsrc%/*}" + x_ mktarball "${rsrc##*/}" "${rsrc##*/}.tar.xz" ) || err "can't create src tarball"; : } From ac609d5aae4907f15dcfe21a2d49d9fefe73946f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 10:59:16 +0100 Subject: [PATCH 195/267] vendor.sh: Remove _dest if it's bad Also, provide more ample warning to the user Signed-off-by: Leah Rowe --- include/vendor.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/vendor.sh b/include/vendor.sh index 5d7ea82b..add5b052 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -136,8 +136,11 @@ fetch() printf "'%s', '%s': checksum undefined. Check files in '%s'\n" \ "$board" "$_dest" "${_pre_dest%/*}" 1>&2 e "$_dest" f not && err "missing file '$_dest', !extract_$dl_type"; : - e "$_dest" f && printf "WARNING: '%s' exists but has bad checksum" \ - "$_dest" + e "$_dest" f && printf "WARNING: '%s' made with bad hash (will rm)\n" \ + "$_dest" 1>&2 + [ -L "$_dest" ] && printf "WARNING: '%s' is a link. Please delete!\n" \ + "$_dest" 1>&2 + [ -L "$_dest" ] || x_ rm -f "$_dest" err "Could not safely extract '$_dest', for board '$board'" } From b48eb161e49d0e40c50c9885072fdb00204230c3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:10:57 +0100 Subject: [PATCH 196/267] vendor.sh: simplify mksha512sum() Signed-off-by: Leah Rowe --- include/vendor.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/vendor.sh b/include/vendor.sh index add5b052..12ae68c0 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -314,7 +314,7 @@ prep() _xrom="$_xromnew" fi - [ "$nukemode" = "nuke" ] && mksha512sum "$_xrom" "vendorhashes" + [ "$nukemode" != "nuke" ] || ( mksha512 "$_xrom" "vendorhashes" ) || err add_vfiles "$_xrom" || return 1 # if break return, can still change MAC [ "$nukemode" != "nuke" ] && return 0 @@ -324,12 +324,10 @@ prep() x_ rm -f "$_xrom" } -mksha512sum() +mksha512() { - ( [ "${1%/*}" != "$1" ] && x_ cd "${1%/*}" sha512sum ./"${1##*/}" >> "$2" || err "!sha512sum \"$1\" > \"$2\"" - ) || err "failed to create tarball checksum" } add_vfiles() From 7ec9ee42283f3722a5c3bfd0050dd32b00a32973 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:12:20 +0100 Subject: [PATCH 197/267] inject.sh: shorten the nukemode variable name just call it "nuke". this is what tells whether to remove vendor files from an archive. Signed-off-by: Leah Rowe --- include/inject.sh | 6 +++--- include/vendor.sh | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index d4d20568..74f688a1 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -21,7 +21,7 @@ inject() set +u +e [ $# -lt 1 ] && err "No options specified" - eval "`setvars "" nukemode new_mac xchanged`" + eval "`setvars "" nuke new_mac xchanged`" archive="$1"; new_mac="xx:xx:xx:xx:xx:xx" @@ -29,7 +29,7 @@ inject() [ $# -gt 1 ] && case "$2" in nuke) new_mac="" - nukemode="nuke" ;; + nuke="nuke" ;; setmac) [ $# -gt 2 ] && new_mac="$3" && \ [ -z "$new_mac" ] && err "Empty MAC address specified" ;; @@ -83,7 +83,7 @@ check_target() patch_release() { - [ "$nukemode" = "nuke" ] || x_ ./mk download "$board" + [ "$nuke" = "nuke" ] || x_ ./mk download "$board" has_hashes="n" tmpromdir="$tmpromdel/bin/$board" diff --git a/include/vendor.sh b/include/vendor.sh index 12ae68c0..2732eade 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -38,7 +38,7 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \ E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest mecleaner \ kbc1126_ec_dump MRC_refcode_cbtree _dl SCH5545EC_DL_url EC_url rom DL_url \ - nukemode cbfstoolref FSPFD_hash _7ztest ME11bootguard ME11delta xromsize \ + nuke cbfstoolref FSPFD_hash _7ztest ME11bootguard ME11delta xromsize \ ME11version ME11sku ME11pch _me _metmp mfs TBFW_url_bkup TBFW_url cbdir \ TBFW_hash TBFW_size hashfile EC_url_bkup FSPM_bin_hash FSPS_bin_hash \ EC_FW1_hash EC_FW2_hash ME_bin_hash MRC_bin_hash REF_bin_hash _dl_bin \ @@ -297,13 +297,13 @@ prep() _xrom="$1" _xromname="${1##*/}" _xromnew="${_xrom%/*}/${_xromname#"$vfix"}" - [ "$nukemode" = "nuke" ] && _xromnew="${_xrom%/*}/$vfix${_xrom##*/}" + [ "$nuke" = "nuke" ] && _xromnew="${_xrom%/*}/$vfix${_xrom##*/}" e "$_xrom" f missing && return 0 [ -z "${_xromname#"$vfix"}" ] && err "$_xromname / $vfix: name match" # Remove the prefix and 1-byte pad - if [ "$nukemode" != "nuke" ] && \ + if [ "$nuke" != "nuke" ] && \ [ "${_xromname#"$vfix"}" != "$_xromname" ]; then xromsize="$(expr $(stat -c '%s' "$_xrom") - 1)" || err "!int" [ $xromsize -lt 524288 ] && err "too small, $xromsize: $_xrom" @@ -314,10 +314,10 @@ prep() _xrom="$_xromnew" fi - [ "$nukemode" != "nuke" ] || ( mksha512 "$_xrom" "vendorhashes" ) || err + [ "$nuke" != "nuke" ] || ( mksha512 "$_xrom" "vendorhashes" ) || err add_vfiles "$_xrom" || return 1 # if break return, can still change MAC - [ "$nukemode" != "nuke" ] && return 0 + [ "$nuke" != "nuke" ] && return 0 # Rename the file, prefixing a warning saying not to flash cat "$_xrom" config/data/coreboot/0 > "$_xromnew" || err "!pad $_xrom" @@ -334,10 +334,10 @@ add_vfiles() { rom="$1" - if [ "$has_hashes" != "y" ] && [ "$nukemode" != "nuke" ]; then + if [ "$has_hashes" != "y" ] && [ "$nuke" != "nuke" ]; then printf "'%s' has no hash file. Skipping.\n" "$archive" 1>&2 return 1 - elif [ "$has_hashes" = "y" ] && [ "$nukemode" = "nuke" ]; then + elif [ "$has_hashes" = "y" ] && [ "$nuke" = "nuke" ]; then printf "'%s' has a hash file. Skipping nuke.\n" "$archive" 1>&2 return 1 fi @@ -383,14 +383,14 @@ vfile() err "vfile $*, $rom: offset given but empty (undefined)" fi - [ "$nukemode" = "nuke" ] || x_ e "$_dest" f + [ "$nuke" = "nuke" ] || x_ e "$_dest" f if [ "$cbfsname" = "IFD" ]; then - [ "$nukemode" = "nuke" ] || x_ "$ifdtool" $ifdprefix -i \ + [ "$nuke" = "nuke" ] || x_ "$ifdtool" $ifdprefix -i \ $_t:$_dest "$rom" -O "$rom" - [ "$nukemode" != "nuke" ] || x_ "$ifdtool" $ifdprefix --nuke \ + [ "$nuke" != "nuke" ] || x_ "$ifdtool" $ifdprefix --nuke \ $_t "$rom" -O "$rom" - elif [ "$nukemode" = "nuke" ]; then + elif [ "$nuke" = "nuke" ]; then x_ "$cbfstool" "$rom" remove -n "$cbfsname" elif [ "$_t" = "stage" ]; then # the only stage we handle is refcode x_ rm -f "$xbmklocal/refcode" @@ -407,7 +407,7 @@ vfile() check_vendor_hashes() { x_ cd "$tmpromdir" - [ "$has_hashes" = "n" ] || [ "$nukemode" = "nuke" ] || sha512sum \ + [ "$has_hashes" = "n" ] || [ "$nuke" = "nuke" ] || sha512sum \ --status -c "$hashfile" || x_ sha1sum --status -c "$hashfile" x_ rm -f "$hashfile" } From cde3b7051e4c9276a35f608e7709e3a7e480b01e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:18:45 +0100 Subject: [PATCH 198/267] init.sh: return from child in set_env instead This is earlier than the current check, thus preventing the initialisation of a git repository and/or the recreation of xbmktmp and xbmklocal by erroneous parent executions of lbmk while another parent is running - the latter of which could have caused a massively unpredictable build failure, so this is also a pre-emptive bug fix, fixing all kinds of weird bugs. Signed-off-by: Leah Rowe --- include/init.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/init.sh b/include/init.sh index 2dd9e88f..60dd3dd9 100644 --- a/include/init.sh +++ b/include/init.sh @@ -146,6 +146,17 @@ xbmk_set_env() [ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1 expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \ 1>/dev/null 2>/dev/null || export XBMK_THREADS=1; : + + # unify all temporary files/directories in a single TMPDIR + [ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || \ + unset TMPDIR + [ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR" && xbmktmp="$TMPDIR" + [ -z "${TMPDIR+x}" ] || return 1 # child instance, so return + + # parent instance of xbmk, so don't return. set up TMPDIR + export TMPDIR="/tmp" + export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" + xbmktmp="$TMPDIR" } xbmk_git_init() @@ -171,17 +182,6 @@ xbmk_create_tmpdir() { x_ mkdir -p "$xbmklocal" - # unify all temporary files/directories in a single TMPDIR - [ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || \ - unset TMPDIR - [ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR" && xbmktmp="$TMPDIR" - [ -z "${TMPDIR+x}" ] || return 1 # child instance, so return - - # parent instance of xbmk, so don't return. set up TMPDIR - export TMPDIR="/tmp" - export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" - xbmktmp="$TMPDIR" - # /tmp might be a tmpfs, so for large files we use ./tmp, # not to be confused with xbmktmp (xbmktmp points to /tmp) remkdir "$xbmktmp" "$xbmklocal" From e05a18d35131acd2007afc56aa07a321f6f2dfdb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:21:30 +0100 Subject: [PATCH 199/267] init.sh: check the lock file BEFORE git init this way, initialisation will not be performed erroneously while another parent instance of lbmk is running. Signed-off-by: Leah Rowe --- include/init.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/init.sh b/include/init.sh index 60dd3dd9..807174a8 100644 --- a/include/init.sh +++ b/include/init.sh @@ -31,8 +31,8 @@ xbmk_init() id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || err "this command as root is not permitted" - for init_cmd in set_pyver set_version set_env git_init create_tmpdir \ - lock create_pathdirs child_exec; do + for init_cmd in set_pyver set_version set_env lock git_init \ + create_tmpdir create_pathdirs child_exec; do xbmk_$init_cmd "$@" || break done } @@ -159,6 +159,12 @@ xbmk_set_env() xbmktmp="$TMPDIR" } +xbmk_lock() +{ + [ -f "$xbmklock" ] && err "'$xbmklock' exists. Is a build running?" + touch "$xbmklock" || err "cannot create '$xbmklock'"; : +} + xbmk_git_init() { for gitarg in "--global user.name" "--global user.email"; do @@ -187,12 +193,6 @@ xbmk_create_tmpdir() remkdir "$xbmktmp" "$xbmklocal" } -xbmk_lock() -{ - [ -f "$xbmklock" ] && err "'$xbmklock' exists. Is a build running?" - touch "$xbmklock" || err "cannot create '$xbmklock'"; : -} - xbmk_create_pathdirs() { remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" From 253aa81a3f991b8951c964e62859573b7a971440 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:25:35 +0100 Subject: [PATCH 200/267] init.sh: move PATH init to set_env we must only set this in the parent instance, not child instances. this prevents the variable from being over-populated with repeated entries. Signed-off-by: Leah Rowe --- include/init.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/init.sh b/include/init.sh index 807174a8..2c65d0b6 100644 --- a/include/init.sh +++ b/include/init.sh @@ -12,11 +12,10 @@ projectsite="https://libreboot.org/" [ -z "${PATH+x}" ] && \ export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" -xbmkpath="$PATH" eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \ datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver xbmklocal \ - xbmklock cvxbmk cvchk`" + xbmklock cvxbmk cvchk xbmkpath`" xbmk_init() { @@ -123,6 +122,7 @@ xbmk_set_version() xbmk_set_env() { + xbmkpath="$PATH" export LOCALVERSION="-$projectname-${version%%-*}" # XBMK_CACHE is a directory, for caching downloads and git repon @@ -157,6 +157,9 @@ xbmk_set_env() export TMPDIR="/tmp" export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" xbmktmp="$TMPDIR" + + export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH" + xbmkpath="$PATH" } xbmk_lock() @@ -196,7 +199,6 @@ xbmk_create_tmpdir() xbmk_create_pathdirs() { remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" - export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH" ( # set up python v3.x in PATH, in case it's not set up correctly. # see code above that detected the correct python3 command. From c75bc0449d01a3a1495e75998b27fbc2a624a2ce Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:28:15 +0100 Subject: [PATCH 201/267] init.sh: move gnupath creation to create_tmpdir Signed-off-by: Leah Rowe --- include/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/init.sh b/include/init.sh index 2c65d0b6..ed11dfd3 100644 --- a/include/init.sh +++ b/include/init.sh @@ -194,11 +194,11 @@ xbmk_create_tmpdir() # /tmp might be a tmpfs, so for large files we use ./tmp, # not to be confused with xbmktmp (xbmktmp points to /tmp) remkdir "$xbmktmp" "$xbmklocal" + remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" } xbmk_create_pathdirs() { - remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" ( # set up python v3.x in PATH, in case it's not set up correctly. # see code above that detected the correct python3 command. From 0343081d9050ca62d188face7d6fb401f43ac883 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:28:57 +0100 Subject: [PATCH 202/267] init.sh: xbmk_create_tmpdir to xbmk_mkdirs this function now simply creates directories that lbmk will use, rather than creating specific directories. Signed-off-by: Leah Rowe --- include/init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/init.sh b/include/init.sh index ed11dfd3..a49879d9 100644 --- a/include/init.sh +++ b/include/init.sh @@ -31,7 +31,7 @@ xbmk_init() [ "$(id -u)" != "0" ] || err "this command as root is not permitted" for init_cmd in set_pyver set_version set_env lock git_init \ - create_tmpdir create_pathdirs child_exec; do + mkdirs create_pathdirs child_exec; do xbmk_$init_cmd "$@" || break done } @@ -187,7 +187,7 @@ xbmk_git_init() 2>/dev/null; : } -xbmk_create_tmpdir() +xbmk_mkdirs() { x_ mkdir -p "$xbmklocal" From 36ffe6ef501e170d52a54f70713dba8bf88ba5d2 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:29:54 +0100 Subject: [PATCH 203/267] init.sh: remove useless comment Signed-off-by: Leah Rowe --- include/init.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/init.sh b/include/init.sh index a49879d9..b41ca872 100644 --- a/include/init.sh +++ b/include/init.sh @@ -191,8 +191,6 @@ xbmk_mkdirs() { x_ mkdir -p "$xbmklocal" - # /tmp might be a tmpfs, so for large files we use ./tmp, - # not to be confused with xbmktmp (xbmktmp points to /tmp) remkdir "$xbmktmp" "$xbmklocal" remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" } From 4aa69a7d1f02733d3776e7c18ec081ff8182a75e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:30:11 +0100 Subject: [PATCH 204/267] init.sh: remove useless command we mkdir -p xbmklocal, only to remkdir it immediately afterward, which is the intended behaviour; on parent instances, xbmklocal is to be re-created fresh. Signed-off-by: Leah Rowe --- include/init.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/init.sh b/include/init.sh index b41ca872..ccbad2b5 100644 --- a/include/init.sh +++ b/include/init.sh @@ -189,8 +189,6 @@ xbmk_git_init() xbmk_mkdirs() { - x_ mkdir -p "$xbmklocal" - remkdir "$xbmktmp" "$xbmklocal" remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" } From d0bee6b4ebba914b0ac2f16689bc23c5f6cbf866 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:38:11 +0100 Subject: [PATCH 205/267] init.sh: Set python version only on parent Do it after the creation of xbmkpath. This avoids performing an unnecessary check, since PATH will have already been corrected for child instances; Python will already be correct there. Signed-off-by: Leah Rowe --- include/init.sh | 96 ++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/include/init.sh b/include/init.sh index ccbad2b5..6c45b44d 100644 --- a/include/init.sh +++ b/include/init.sh @@ -30,8 +30,8 @@ xbmk_init() id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || err "this command as root is not permitted" - for init_cmd in set_pyver set_version set_env lock git_init \ - mkdirs create_pathdirs child_exec; do + for init_cmd in set_version set_env lock git_init \ + mkdirs set_pyver create_pathdirs child_exec; do xbmk_$init_cmd "$@" || break done } @@ -50,52 +50,6 @@ xbmkpkg() printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; : } -xbmk_set_pyver() -{ - pyv="import sys; print(sys.version_info[:])" - python="python3" - pybin python3 1>/dev/null || python="python" - pyver="2" && [ "$python" = "python3" ] && pyver="3" - pybin "$python" 1>/dev/null || pyver="" - [ -z "$pyver" ] || "`pybin "$python"`" -c "$pyv" 1>/dev/null \ - 2>/dev/null || err "Cannot detect host Python version." - [ -n "$pyver" ] && \ - pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')" && \ - pyver="${pyver#(}" && pyver="${pyver%,}" - [ "${pyver%%.*}" = "3" ] || err "Bad python version (must by 3.x)"; : -} - -# Use direct path, to prevent a hang if Python is using a virtual environment, -# not command -v, to prevent a hang when checking python's version -# See: https://docs.python.org/3/library/venv.html#how-venvs-work -pybin() -{ - py="import sys; quit(1) if sys.prefix == sys.base_prefix else quit(0)" - - venv=1 - command -v "$1" 1>/dev/null 2>/dev/null || venv=0 - [ $venv -lt 1 ] || "$1" -c "$py" 1>/dev/null 2>/dev/null || venv=0 - - # ideally, don't rely on PATH or hardcoded paths if python venv. - # use the *real*, direct executable linked to by the venv symlink - if [ $venv -gt 0 ] && [ -L "`command -v "$1" 2>/dev/null`" ]; then - pypath="$(findpath \ - "$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)" - [ -e "$pypath" ] && [ ! -d "$pypath" ] && \ - [ -x "$pypath" ] && printf "%s\n" "$pypath" && return 0; : - fi - - # if python venv: fall back to common PATH directories for checking - [ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do - [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \ - [ -x "$pypath/$1" ] && printf "%s/%s\n" "$pypath" "$1" && \ - return 0 - done && return 1 - - # Defer to normal command -v if not a venv - command -v "$1" 2>/dev/null || return 1 -} - xbmk_set_version() { [ ! -f ".version" ] || read -r version < ".version" || :; : @@ -193,6 +147,52 @@ xbmk_mkdirs() remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" } +xbmk_set_pyver() +{ + pyv="import sys; print(sys.version_info[:])" + python="python3" + pybin python3 1>/dev/null || python="python" + pyver="2" && [ "$python" = "python3" ] && pyver="3" + pybin "$python" 1>/dev/null || pyver="" + [ -z "$pyver" ] || "`pybin "$python"`" -c "$pyv" 1>/dev/null \ + 2>/dev/null || err "Cannot detect host Python version." + [ -n "$pyver" ] && \ + pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')" && \ + pyver="${pyver#(}" && pyver="${pyver%,}" + [ "${pyver%%.*}" = "3" ] || err "Bad python version (must by 3.x)"; : +} + +# Use direct path, to prevent a hang if Python is using a virtual environment, +# not command -v, to prevent a hang when checking python's version +# See: https://docs.python.org/3/library/venv.html#how-venvs-work +pybin() +{ + py="import sys; quit(1) if sys.prefix == sys.base_prefix else quit(0)" + + venv=1 + command -v "$1" 1>/dev/null 2>/dev/null || venv=0 + [ $venv -lt 1 ] || "$1" -c "$py" 1>/dev/null 2>/dev/null || venv=0 + + # ideally, don't rely on PATH or hardcoded paths if python venv. + # use the *real*, direct executable linked to by the venv symlink + if [ $venv -gt 0 ] && [ -L "`command -v "$1" 2>/dev/null`" ]; then + pypath="$(findpath \ + "$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)" + [ -e "$pypath" ] && [ ! -d "$pypath" ] && \ + [ -x "$pypath" ] && printf "%s\n" "$pypath" && return 0; : + fi + + # if python venv: fall back to common PATH directories for checking + [ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do + [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \ + [ -x "$pypath/$1" ] && printf "%s/%s\n" "$pypath" "$1" && \ + return 0 + done && return 1 + + # Defer to normal command -v if not a venv + command -v "$1" 2>/dev/null || return 1 +} + xbmk_create_pathdirs() { ( From 484afcb91969b9325c448a6a77ad97a4813f7bfb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:40:28 +0100 Subject: [PATCH 206/267] init.sh: merge create_pathdirs with set_pyver all this function does now is create the python symlink, based on work that was already performed in set_pyver Signed-off-by: Leah Rowe --- include/init.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/include/init.sh b/include/init.sh index 6c45b44d..13592d83 100644 --- a/include/init.sh +++ b/include/init.sh @@ -31,7 +31,7 @@ xbmk_init() [ "$(id -u)" != "0" ] || err "this command as root is not permitted" for init_cmd in set_version set_env lock git_init \ - mkdirs set_pyver create_pathdirs child_exec; do + mkdirs set_pyver child_exec; do xbmk_$init_cmd "$@" || break done } @@ -159,7 +159,14 @@ xbmk_set_pyver() [ -n "$pyver" ] && \ pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')" && \ pyver="${pyver#(}" && pyver="${pyver%,}" - [ "${pyver%%.*}" = "3" ] || err "Bad python version (must by 3.x)"; : + [ "${pyver%%.*}" = "3" ] || err "Bad python version (must by 3.x)" + + ( + # set up python v3.x in PATH, in case it's not set up correctly. + # see code above that detected the correct python3 command. + x_ cd "$XBMK_CACHE/xbmkpath" + x_ ln -s "`pybin "$python"`" python + ) || err "Can't set up python symlink in $XBMK_CACHE/xbmkpath"; : } # Use direct path, to prevent a hang if Python is using a virtual environment, @@ -193,16 +200,6 @@ pybin() command -v "$1" 2>/dev/null || return 1 } -xbmk_create_pathdirs() -{ - ( - # set up python v3.x in PATH, in case it's not set up correctly. - # see code above that detected the correct python3 command. - x_ cd "$XBMK_CACHE/xbmkpath" - x_ ln -s "`pybin "$python"`" python - ) || err "Can't set up python symlink in $XBMK_CACHE/xbmkpath"; : -} - xbmk_child_exec() { xbmk_rval=0 From ac36ea7f950a88e56be82e046004c9780c9e0803 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 11:54:51 +0100 Subject: [PATCH 207/267] init.sh: initialise variables AFTER path That way, unnecessary work is avoided on child instances. Of course, the current check assumes that TMPDIR wasn't already set by a wily user before running lbmk, but then those sorts of users probably know what they're doing. If they don't know, they will soon find out. Therefore, I have added additional checks on child instances, preventing the build system from running if XBMK_CACHE is not set; if it isn't, then that could very easy lead to certain system files being overwritten. The user must never know what happens if XBMK_CACHE is unset. We simply will not allow it. Signed-off-by: Leah Rowe --- include/init.sh | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/include/init.sh b/include/init.sh index 13592d83..363f0b18 100644 --- a/include/init.sh +++ b/include/init.sh @@ -76,9 +76,29 @@ xbmk_set_version() xbmk_set_env() { + is_child="n" + xbmkpath="$PATH" export LOCALVERSION="-$projectname-${version%%-*}" + # unify all temporary files/directories in a single TMPDIR + [ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || \ + unset TMPDIR + [ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR" && xbmktmp="$TMPDIR" + [ -z "${TMPDIR+x}" ] || is_child="y" # child instance, so return + + if [ "$is_child" = "y" ]; then + [ -z "${XBMK_CACHE+x}" ] && err "XBMK_CACHE unset on child" + [ -z "${XBMK_THREADS+x}" ] && err "XBMK_THREADS unset on child" + e "lock" f missing && err "lock file absent on child" + return 1 + fi + + # parent instance of xbmk, so don't return. set up TMPDIR + export TMPDIR="/tmp" + export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" + xbmktmp="$TMPDIR" + # XBMK_CACHE is a directory, for caching downloads and git repon [ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache" [ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" @@ -91,6 +111,9 @@ xbmk_set_env() [ ! -e "$XBMK_CACHE" ] || \ [ -d "$XBMK_CACHE" ] || err "cachedir '$XBMK_CACHE' is a file"; : + export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH" + xbmkpath="$PATH" + # if "y": a coreboot target won't be built if target.cfg says release="n" # (this is used to exclude certain build targets from releases) [ -z "${XBMK_RELEASE+x}" ] && export XBMK_RELEASE="n" @@ -100,20 +123,6 @@ xbmk_set_env() [ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1 expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \ 1>/dev/null 2>/dev/null || export XBMK_THREADS=1; : - - # unify all temporary files/directories in a single TMPDIR - [ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || \ - unset TMPDIR - [ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR" && xbmktmp="$TMPDIR" - [ -z "${TMPDIR+x}" ] || return 1 # child instance, so return - - # parent instance of xbmk, so don't return. set up TMPDIR - export TMPDIR="/tmp" - export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" - xbmktmp="$TMPDIR" - - export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH" - xbmkpath="$PATH" } xbmk_lock() From 6b603b9fbf45f6f391f84ecc8ced7896722f6b02 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 12:07:10 +0100 Subject: [PATCH 208/267] init.sh: only set xbmk version on parent instance On child instances, we need only read. Apply the principle of least privilege. Signed-off-by: Leah Rowe --- include/init.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/init.sh b/include/init.sh index 363f0b18..e94157f0 100644 --- a/include/init.sh +++ b/include/init.sh @@ -30,7 +30,7 @@ xbmk_init() id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || err "this command as root is not permitted" - for init_cmd in set_version set_env lock git_init \ + for init_cmd in get_version set_env lock set_version git_init \ mkdirs set_pyver child_exec; do xbmk_$init_cmd "$@" || break done @@ -50,7 +50,7 @@ xbmkpkg() printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; : } -xbmk_set_version() +xbmk_get_version() { [ ! -f ".version" ] || read -r version < ".version" || :; : [ ! -f ".versiondate" ] || read -r versiondate < ".versiondate" || :; : @@ -68,9 +68,6 @@ xbmk_set_version() --pretty='%ct' HEAD)" || versiondate="$versiondate_" chkvars version versiondate - printf "%s\n" "$version" > ".version" || err "can't save version" - printf "%s\n" "$versiondate" > ".versiondate" || err "can't save date" - relname="$projectname-$version" } @@ -131,6 +128,12 @@ xbmk_lock() touch "$xbmklock" || err "cannot create '$xbmklock'"; : } +xbmk_set_version() +{ + printf "%s\n" "$version" > ".version" || err "can't save version" + printf "%s\n" "$versiondate" > ".versiondate" || err "can't save date" +} + xbmk_git_init() { for gitarg in "--global user.name" "--global user.email"; do From 94437278dc7c3635e760f8781e9e151575845cad Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 12:51:56 +0100 Subject: [PATCH 209/267] init.sh: simplify unknown version creation we don't need to read or write a file at all, in that case. we only then need to generate one if running ./mk release. the scenario in which no .git and no version files exist is when someone grabs the build system from a snapshot generated by e.g. forgejo instances. it's ill advised, so we advise against it, but it is mitigated in code. Signed-off-by: Leah Rowe --- include/init.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/init.sh b/include/init.sh index e94157f0..20d63068 100644 --- a/include/init.sh +++ b/include/init.sh @@ -55,10 +55,8 @@ xbmk_get_version() [ ! -f ".version" ] || read -r version < ".version" || :; : [ ! -f ".versiondate" ] || read -r versiondate < ".versiondate" || :; : - [ -e ".git" ] || [ -f ".version" ] || printf "unknown\n" > ".version" \ - || err "Cannot generate unknown .version file" - [ -e ".git" ] || [ -f ".versiondate" ] || printf "1716415872\n" > \ - ".versiondate" || err "Can't generate unknown versiondate file"; : + [ ! -e ".git" ] && [ ! -f ".version" ] && version="unknown" + [ ! -e ".git" ] && [ ! -f ".versiondate" ] && versiondate="1716415872" version_="$version" [ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \ From 99f09f25ef34c6836f0d13cae2ad071504715ddf Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 12:58:42 +0100 Subject: [PATCH 210/267] init.sh: only update version files on parent don't update them on child instances, since it's a waste of time; the lock file prevents further execution, so we are just wasting time writing to disk. Signed-off-by: Leah Rowe --- include/init.sh | 31 +++++++++++++++++-------------- include/lib.sh | 10 +++++++--- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/include/init.sh b/include/init.sh index 20d63068..cd290ebe 100644 --- a/include/init.sh +++ b/include/init.sh @@ -30,7 +30,7 @@ xbmk_init() id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || err "this command as root is not permitted" - for init_cmd in get_version set_env lock set_version git_init \ + for init_cmd in get_version set_env lock git_init \ mkdirs set_pyver child_exec; do xbmk_$init_cmd "$@" || break done @@ -58,15 +58,7 @@ xbmk_get_version() [ ! -e ".git" ] && [ ! -f ".version" ] && version="unknown" [ ! -e ".git" ] && [ ! -f ".versiondate" ] && versiondate="1716415872" - version_="$version" - [ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \ - version="git-$(git rev-parse HEAD 2>&1)" || version="$version_" - versiondate_="$versiondate" - [ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \ - --pretty='%ct' HEAD)" || versiondate="$versiondate_" - - chkvars version versiondate - relname="$projectname-$version" + [ -n "$version" ] && relname="$projectname-$version"; : } xbmk_set_env() @@ -74,7 +66,6 @@ xbmk_set_env() is_child="n" xbmkpath="$PATH" - export LOCALVERSION="-$projectname-${version%%-*}" # unify all temporary files/directories in a single TMPDIR [ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || \ @@ -117,7 +108,10 @@ xbmk_set_env() [ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1 expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \ - 1>/dev/null 2>/dev/null || export XBMK_THREADS=1; : + 1>/dev/null 2>/dev/null || export XBMK_THREADS=1 + + xbmk_set_version + export LOCALVERSION="-$projectname-${version%%-*}" } xbmk_lock() @@ -128,8 +122,17 @@ xbmk_lock() xbmk_set_version() { - printf "%s\n" "$version" > ".version" || err "can't save version" - printf "%s\n" "$versiondate" > ".versiondate" || err "can't save date" + version_="$version" + [ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \ + version="git-$(git rev-parse HEAD 2>&1)" || version="$version_" + versiondate_="$versiondate" + [ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \ + --pretty='%ct' HEAD)" || versiondate="$versiondate_" + + chkvars version versiondate + update_xbmkver "." + + relname="$projectname-$version" } xbmk_git_init() diff --git a/include/lib.sh b/include/lib.sh index 75de7512..6c831795 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -15,13 +15,17 @@ remkdir() mkrom_tarball() { - printf "%s\n" "$version" > "$1/.version" || err "$1 !version" - printf "%s\n" "$versiondate" > "$1/.versiondate" || err "$1 !vdate" - + update_xbmkver "$1" mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz" x_ rm -Rf "$1" } +update_xbmkver() +{ + printf "%s\n" "$version" > "$1/.version" || err "$1 !version"; : + printf "%s\n" "$versiondate" > "$1/.versiondate" || err "$1 !vdate"; : +} + mktarball() { printf "Creating tar archive '%s' from directory '%s'\n" "$2" "$1" From 485a60e2f6ab0c4eb7b08fd07a2e7be5d0c40402 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 13:08:49 +0100 Subject: [PATCH 211/267] init.sh: error if version not read we no longer rely on the .git version being read by child instances, so we MUST ensure that it is being read. Signed-off-by: Leah Rowe --- include/init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/init.sh b/include/init.sh index cd290ebe..117a1818 100644 --- a/include/init.sh +++ b/include/init.sh @@ -52,8 +52,8 @@ xbmkpkg() xbmk_get_version() { - [ ! -f ".version" ] || read -r version < ".version" || :; : - [ ! -f ".versiondate" ] || read -r versiondate < ".versiondate" || :; : + [ ! -f ".version" ] || read -r version < ".version" || err + [ ! -f ".versiondate" ] || read -r versiondate < ".versiondate" || err [ ! -e ".git" ] && [ ! -f ".version" ] && version="unknown" [ ! -e ".git" ] && [ ! -f ".versiondate" ] && versiondate="1716415872" From 5f022acbf47724adead781136d866e8220a83e6d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 13:10:22 +0100 Subject: [PATCH 212/267] init.sh: check version/versiondate once read once again, we are being stricter in child instances. we must ensure that these variables are set by xbmk. Signed-off-by: Leah Rowe --- include/init.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/init.sh b/include/init.sh index 117a1818..ac145f56 100644 --- a/include/init.sh +++ b/include/init.sh @@ -54,6 +54,8 @@ xbmk_get_version() { [ ! -f ".version" ] || read -r version < ".version" || err [ ! -f ".versiondate" ] || read -r versiondate < ".versiondate" || err + [ ! -f ".version" ] || chkvars version + [ ! -f ".versiondate" ] || chkvars versiondate [ ! -e ".git" ] && [ ! -f ".version" ] && version="unknown" [ ! -e ".git" ] && [ ! -f ".versiondate" ] && versiondate="1716415872" From 158c56072c075231eec3422b653f01ddaa451ab6 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 13:25:37 +0100 Subject: [PATCH 213/267] init.sh: merge xbmk_mkdirs with set_env it's just two lines, and they relate. Signed-off-by: Leah Rowe --- include/init.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/include/init.sh b/include/init.sh index ac145f56..1791ef78 100644 --- a/include/init.sh +++ b/include/init.sh @@ -30,8 +30,8 @@ xbmk_init() id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || err "this command as root is not permitted" - for init_cmd in get_version set_env lock git_init \ - mkdirs set_pyver child_exec; do + for init_cmd in get_version set_env lock git_init set_pyver child_exec + do xbmk_$init_cmd "$@" || break done } @@ -114,6 +114,9 @@ xbmk_set_env() xbmk_set_version export LOCALVERSION="-$projectname-${version%%-*}" + + remkdir "$xbmktmp" "$xbmklocal" + remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" } xbmk_lock() @@ -156,12 +159,6 @@ xbmk_git_init() 2>/dev/null; : } -xbmk_mkdirs() -{ - remkdir "$xbmktmp" "$xbmklocal" - remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" -} - xbmk_set_pyver() { pyv="import sys; print(sys.version_info[:])" From 962902a1c4a0b3b9ce942980f42311528d4a4398 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 13:28:31 +0100 Subject: [PATCH 214/267] init.sh: set pyver from set_env it's related to this function, no point calling from main Signed-off-by: Leah Rowe --- include/init.sh | 82 +++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/include/init.sh b/include/init.sh index 1791ef78..49193f0f 100644 --- a/include/init.sh +++ b/include/init.sh @@ -30,7 +30,7 @@ xbmk_init() id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || err "this command as root is not permitted" - for init_cmd in get_version set_env lock git_init set_pyver child_exec + for init_cmd in get_version set_env lock git_init child_exec do xbmk_$init_cmd "$@" || break done @@ -117,46 +117,8 @@ xbmk_set_env() remkdir "$xbmktmp" "$xbmklocal" remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" -} -xbmk_lock() -{ - [ -f "$xbmklock" ] && err "'$xbmklock' exists. Is a build running?" - touch "$xbmklock" || err "cannot create '$xbmklock'"; : -} - -xbmk_set_version() -{ - version_="$version" - [ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \ - version="git-$(git rev-parse HEAD 2>&1)" || version="$version_" - versiondate_="$versiondate" - [ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \ - --pretty='%ct' HEAD)" || versiondate="$versiondate_" - - chkvars version versiondate - update_xbmkver "." - - relname="$projectname-$version" -} - -xbmk_git_init() -{ - for gitarg in "--global user.name" "--global user.email"; do - gitcmd="git config $gitarg"; $gitcmd 1>/dev/null 2>/dev/null \ - || err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" - done - - [ -L ".git" ] && return 1 - [ -e ".git" ] && return 0 - eval "`setvars "$(date -Rud @$versiondate)" cdate _nogit`" - - x_ git init 1>/dev/null 2>/dev/null - x_ git add -A . 1>/dev/null 2>/dev/null - x_ git commit -m "$projectname $version" --date "$cdate" \ - --author="xbmk " 1>/dev/null 2>/dev/null - x_ git tag -a "$version" -m "$projectname $version" 1>/dev/null \ - 2>/dev/null; : + xbmk_set_pyver } xbmk_set_pyver() @@ -212,6 +174,46 @@ pybin() command -v "$1" 2>/dev/null || return 1 } +xbmk_lock() +{ + [ -f "$xbmklock" ] && err "'$xbmklock' exists. Is a build running?" + touch "$xbmklock" || err "cannot create '$xbmklock'"; : +} + +xbmk_set_version() +{ + version_="$version" + [ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \ + version="git-$(git rev-parse HEAD 2>&1)" || version="$version_" + versiondate_="$versiondate" + [ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \ + --pretty='%ct' HEAD)" || versiondate="$versiondate_" + + chkvars version versiondate + update_xbmkver "." + + relname="$projectname-$version" +} + +xbmk_git_init() +{ + for gitarg in "--global user.name" "--global user.email"; do + gitcmd="git config $gitarg"; $gitcmd 1>/dev/null 2>/dev/null \ + || err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" + done + + [ -L ".git" ] && return 1 + [ -e ".git" ] && return 0 + eval "`setvars "$(date -Rud @$versiondate)" cdate _nogit`" + + x_ git init 1>/dev/null 2>/dev/null + x_ git add -A . 1>/dev/null 2>/dev/null + x_ git commit -m "$projectname $version" --date "$cdate" \ + --author="xbmk " 1>/dev/null 2>/dev/null + x_ git tag -a "$version" -m "$projectname $version" 1>/dev/null \ + 2>/dev/null; : +} + xbmk_child_exec() { xbmk_rval=0 From fc4006ce877231f63a941eca903c0af9416e8ab8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 13:29:51 +0100 Subject: [PATCH 215/267] init.sh: move xbmk_set_version it's called before set_pyver, so move it above that Signed-off-by: Leah Rowe --- include/init.sh | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/include/init.sh b/include/init.sh index 49193f0f..35512469 100644 --- a/include/init.sh +++ b/include/init.sh @@ -121,6 +121,21 @@ xbmk_set_env() xbmk_set_pyver } +xbmk_set_version() +{ + version_="$version" + [ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \ + version="git-$(git rev-parse HEAD 2>&1)" || version="$version_" + versiondate_="$versiondate" + [ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \ + --pretty='%ct' HEAD)" || versiondate="$versiondate_" + + chkvars version versiondate + update_xbmkver "." + + relname="$projectname-$version" +} + xbmk_set_pyver() { pyv="import sys; print(sys.version_info[:])" @@ -180,21 +195,6 @@ xbmk_lock() touch "$xbmklock" || err "cannot create '$xbmklock'"; : } -xbmk_set_version() -{ - version_="$version" - [ ! -e ".git" ] || version="$(git describe --tags HEAD 2>&1)" || \ - version="git-$(git rev-parse HEAD 2>&1)" || version="$version_" - versiondate_="$versiondate" - [ ! -e ".git" ] || versiondate="$(git show --no-patch --no-notes \ - --pretty='%ct' HEAD)" || versiondate="$versiondate_" - - chkvars version versiondate - update_xbmkver "." - - relname="$projectname-$version" -} - xbmk_git_init() { for gitarg in "--global user.name" "--global user.email"; do From 2702a43a86d51aba2123d620ce2f383d8fc41311 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 18 May 2025 13:32:24 +0100 Subject: [PATCH 216/267] init.sh: merge xbmk_lock() with xbmk_set_env() it's just two lines, and we want much more granular control of where the lock is enforced. it should be JUST after confirming that the instance is a parent. it is at this moment that we should bail if a lock file exists, because this signals that another instance of xbmk is running. Signed-off-by: Leah Rowe --- include/init.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/init.sh b/include/init.sh index 35512469..ee19c398 100644 --- a/include/init.sh +++ b/include/init.sh @@ -30,8 +30,7 @@ xbmk_init() id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || err "this command as root is not permitted" - for init_cmd in get_version set_env lock git_init child_exec - do + for init_cmd in get_version set_env git_init child_exec; do xbmk_$init_cmd "$@" || break done } @@ -82,6 +81,9 @@ xbmk_set_env() return 1 fi + [ -f "$xbmklock" ] && err "'$xbmklock' exists. Is a build running?" + touch "$xbmklock" || err "cannot create '$xbmklock'"; : + # parent instance of xbmk, so don't return. set up TMPDIR export TMPDIR="/tmp" export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" @@ -189,12 +191,6 @@ pybin() command -v "$1" 2>/dev/null || return 1 } -xbmk_lock() -{ - [ -f "$xbmklock" ] && err "'$xbmklock' exists. Is a build running?" - touch "$xbmklock" || err "cannot create '$xbmklock'"; : -} - xbmk_git_init() { for gitarg in "--global user.name" "--global user.email"; do From 265ec0b7673d3df608dfb9e1cbec39b3bb68cdd6 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 17:40:44 +0100 Subject: [PATCH 217/267] dependencies/debian: add libx86 already present on a few other config files, e.g. arch i noticed on debian-experimental that i needed to explicitly install it, whereas it was implicitly installed on debian 12 Signed-off-by: Leah Rowe --- config/dependencies/debian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/dependencies/debian b/config/dependencies/debian index 992fb690..d4c26ee0 100755 --- a/config/dependencies/debian +++ b/config/dependencies/debian @@ -14,5 +14,5 @@ libusb-dev lz4 lzma lzma-alone m4 nasm openssl p7zip p7zip-full parted pciutils perl pkg-config python3 python3-distutils-extra python3-pkg-resources python3-pycryptodome \ python3-pyelftools python3-setuptools python-is-python3 sharutils swig unar \ unifont unifont-bin unzip uuid-dev wget xfonts-unifont zlib1g-dev ccache \ -g++-mipsel-linux-gnu make genisoimage mtools \ +g++-mipsel-linux-gnu make genisoimage mtools libx86-1 libx86-dev \ " From 769a97aed5a712c80141fee8da60868c437fbf36 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 18:50:06 +0100 Subject: [PATCH 218/267] init.sh: Hardcode XBMK_CACHE for integrity I never really intended for this to be configurable, but the cache directory is also used during release builds. There's too much that can go wrong, letting the user decide where their cache is. Simplify it by hardcoding. Signed-off-by: Leah Rowe --- include/init.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/init.sh b/include/init.sh index ee19c398..cd4acf43 100644 --- a/include/init.sh +++ b/include/init.sh @@ -89,15 +89,9 @@ xbmk_set_env() export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" xbmktmp="$TMPDIR" - # XBMK_CACHE is a directory, for caching downloads and git repon - [ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$xbmkpwd/cache" - [ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" + export XBMK_CACHE="$xbmkpwd/cache" [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ err "cachedir '$xbmkpwd/cache' is a symlink" - [ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$xbmkpwd/cache" - xbmkcache="`findpath "$XBMK_CACHE"`" || \ - err "Can't resolve cachedir: '$XBMK_CACHE'" - export XBMK_CACHE="$xbmkcache" [ ! -e "$XBMK_CACHE" ] || \ [ -d "$XBMK_CACHE" ] || err "cachedir '$XBMK_CACHE' is a file"; : From b25a4876434d371dc4278d71365574158c77d47d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 18:53:22 +0100 Subject: [PATCH 219/267] init.sh: looser XBMK_THREADS validation on child processes, we can simply correct it. we currently provide an error message, but this is silly. Signed-off-by: Leah Rowe --- include/init.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/init.sh b/include/init.sh index cd4acf43..38eb1c81 100644 --- a/include/init.sh +++ b/include/init.sh @@ -30,7 +30,7 @@ xbmk_init() id -u 1>/dev/null 2>/dev/null || err "suid check failed (id -u)" [ "$(id -u)" != "0" ] || err "this command as root is not permitted" - for init_cmd in get_version set_env git_init child_exec; do + for init_cmd in get_version set_env set_threads git_init child_exec; do xbmk_$init_cmd "$@" || break done } @@ -76,7 +76,7 @@ xbmk_set_env() if [ "$is_child" = "y" ]; then [ -z "${XBMK_CACHE+x}" ] && err "XBMK_CACHE unset on child" - [ -z "${XBMK_THREADS+x}" ] && err "XBMK_THREADS unset on child" + [ -z "${XBMK_THREADS+x}" ] && xbmk_set_threads e "lock" f missing && err "lock file absent on child" return 1 fi @@ -104,10 +104,6 @@ xbmk_set_env() [ "$XBMK_RELEASE" = "Y" ] && export XBMK_RELEASE="y" [ "$XBMK_RELEASE" = "y" ] || export XBMK_RELEASE="n" - [ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1 - expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \ - 1>/dev/null 2>/dev/null || export XBMK_THREADS=1 - xbmk_set_version export LOCALVERSION="-$projectname-${version%%-*}" @@ -117,6 +113,13 @@ xbmk_set_env() xbmk_set_pyver } +xbmk_set_threads() +{ + [ -z "${XBMK_THREADS+x}" ] && export XBMK_THREADS=1 + expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \ + 1>/dev/null 2>/dev/null || export XBMK_THREADS=1 +} + xbmk_set_version() { version_="$version" From d9c64b267540a7c0a62f219c1c27c790234fd11c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 19:24:43 +0100 Subject: [PATCH 220/267] xbmk: stricter handling of files on while loops i overlooked these! Signed-off-by: Leah Rowe --- include/lib.sh | 4 ++-- include/tree.sh | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 6c831795..025db88a 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -106,9 +106,9 @@ fx_() dx_() { - [ -f "$2" ] && while read -r fx; do + [ ! -f "$2" ] || while read -r fx; do $1 "$fx" || return 1 - done < "$2"; : + done < "$2" || err "dx_ $*: cannot read '$2'"; : } x_() diff --git a/include/tree.sh b/include/tree.sh index 25d4732c..9dccf857 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -332,8 +332,9 @@ check_makefile() copy_elf() { - [ -f "$listfile" ] && x_ mkdir -p "$dest_dir" && while read -r f; do + [ -f "$listfile" ] && x_ mkdir -p "$dest_dir" + [ ! -f "$listfile" ] || while read -r f; do [ -f "$srcdir/$f" ] && x_ cp "$srcdir/$f" "$dest_dir" - done < "$listfile" + done < "$listfile" || err "copy_elf $*: cannot read '$listfile'" x_ make clean -C "$srcdir" $cleanargs } From 8aaf404ddea8a8d6c21f0a1f83f1675a8b0895aa Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 19:29:59 +0100 Subject: [PATCH 221/267] lib.sh: Use while, not for, to process arguments This is more reliable against globbing, in context of for. Signed-off-by: Leah Rowe --- include/lib.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 025db88a..184d0491 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -53,8 +53,10 @@ setvars() fi val="$1" shift 1 - for var in "$@"; do - _setvars="$var=\"$val\"; $_setvars" + while true; do + [ $# -lt 1 ] && break + _setvars="$1=\"$val\"; $_setvars" + shift 1 done printf "%s\n" "${_setvars% }" } @@ -69,9 +71,11 @@ setcfg() chkvars() { - for var in "$@"; do - eval "[ -n \"\${$var+x}\" ] || err \"$var unset\"" - eval "[ -n \"\$$var\" ] || err \"$var unset\"" + while true; do + [ $# -lt 1 ] && break + eval "[ -n \"\${$1+x}\" ] || err \"$1 unset\"" + eval "[ -n \"\$$1\" ] || err \"$1 unset\"" + shift 1 done; : } From 900da04efa929a9373d5a6f3f56f8b8ac8f193df Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 19:57:06 +0100 Subject: [PATCH 222/267] tree.sh: fix up copy_elf(), bad for loop Because of how sh works, having just the [] line causes sh to exit, annoyingly without an error message, but it does cause a non-zero exit. This bug will have already been triggering, before I added the recent error handling on files for this for loop. also do it to the other loop in lib.sh Signed-off-by: Leah Rowe --- include/lib.sh | 2 +- include/tree.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 184d0491..7c4d71ea 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -111,7 +111,7 @@ fx_() dx_() { [ ! -f "$2" ] || while read -r fx; do - $1 "$fx" || return 1 + $1 "$fx" || return 1; : done < "$2" || err "dx_ $*: cannot read '$2'"; : } diff --git a/include/tree.sh b/include/tree.sh index 9dccf857..8d787d4c 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -334,7 +334,7 @@ copy_elf() { [ -f "$listfile" ] && x_ mkdir -p "$dest_dir" [ ! -f "$listfile" ] || while read -r f; do - [ -f "$srcdir/$f" ] && x_ cp "$srcdir/$f" "$dest_dir" - done < "$listfile" || err "copy_elf $*: cannot read '$listfile'" + [ -f "$srcdir/$f" ] && x_ cp "$srcdir/$f" "$dest_dir"; : + done < "$listfile" || err "copy_elf $*: cannot read '$listfile'"; : x_ make clean -C "$srcdir" $cleanargs } From 620c1dd6fae0f0f83212e9f6b6fb27c1faf67b83 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 22:59:20 +0100 Subject: [PATCH 223/267] get.sh: Make xbmkget err on exiting the loop check The idea in this function is that if a file or repo is successfully handled, a return will be performed from the loop. If the loop exits for any reason, an error is thrown. The current code is probably fine, but I can forsee future modifications possibly causing bugs here. Make it unambiguous, by always throwing an error if execution reaches the end of the function. Signed-off-by: Leah Rowe --- include/get.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 667ab398..ab6ff401 100644 --- a/include/get.sh +++ b/include/get.sh @@ -87,7 +87,8 @@ xbmkget() for url in "$2" "$3"; do [ -n "$url" ] && try_file "$url" "$@" && \ eval "[ -$echk \"$4\" ] && return 0" - done && err "$1 $2 $3 $4: not downloaded"; : + done + err "$1 $2 $3 $4: not downloaded"; : } try_file() From cdc0fb49e1c47a013ea99117acbf62e96ec5c652 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 23:07:01 +0100 Subject: [PATCH 224/267] get.sh: make xbmkget() easier to understand the intent once again is that this for loop shall return, with zero status, if success is observed. otherwise, the loop breaks and an error is thrown. Signed-off-by: Leah Rowe --- include/get.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/get.sh b/include/get.sh index ab6ff401..89859454 100644 --- a/include/get.sh +++ b/include/get.sh @@ -85,8 +85,10 @@ xbmkget() echk="f" && [ "$1" = "git" ] && echk="d" for url in "$2" "$3"; do - [ -n "$url" ] && try_file "$url" "$@" && \ - eval "[ -$echk \"$4\" ] && return 0" + [ -n "$url" ] || continue + try_file "$url" "$@" || continue + eval "[ -$echk \"$4\" ] || continue" + return 0 # successful download/copy done err "$1 $2 $3 $4: not downloaded"; : } From f15bb8153a3f2fce6e0aea28ce029c889a2e7c76 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 23:09:37 +0100 Subject: [PATCH 225/267] get.sh: stricter URL check in xbmkget() don't skip if the URL is empty. throw an error instead. i decree that all links must be properly initialised, because that is the design of lbmk. where only one link is provided, such as in a local copy operation, the second would succeed no better than the first so two identical paths are given. Signed-off-by: Leah Rowe --- include/get.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 89859454..8280d96b 100644 --- a/include/get.sh +++ b/include/get.sh @@ -85,7 +85,7 @@ xbmkget() echk="f" && [ "$1" = "git" ] && echk="d" for url in "$2" "$3"; do - [ -n "$url" ] || continue + [ -n "$url" ] || err "empty URL given in: xbmkget $*" try_file "$url" "$@" || continue eval "[ -$echk \"$4\" ] || continue" return 0 # successful download/copy From 903f78bf080ee8ad9176022005b81a3d3ac530b3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 19 May 2025 23:13:29 +0100 Subject: [PATCH 226/267] get.sh: add missing check in fetch_project() we check the main url, but not backup urls. this patch fixes that oversight. Signed-off-by: Leah Rowe --- include/get.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 8280d96b..ae2c5a35 100644 --- a/include/get.sh +++ b/include/get.sh @@ -22,7 +22,7 @@ fetch_project() eval "`setvars "" xtree`" eval "`setcfg "config/git/$project/pkg.cfg"`" - chkvars url + chkvars url bkup_url [ -n "$xtree" ] && x_ ./mk -f coreboot "$xtree" [ -z "$depend" ] || for d in $depend ; do From fb7aaa78bb080a473bdf0edf449bf08045e8366c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 20 May 2025 02:58:33 +0100 Subject: [PATCH 227/267] vendor.sh: optimise find_me() i'm adding characters to 7ztest, which isn't being passed on through because everything runs in subshells; the next pass would default back to the original string, so a given file may be checked multiple times. fix this by mitigation; use the random string from mktemp as a suffix instead. in practice, this has not affected performance much, but it will nevertheless avoid unnecessary work by xbmk. Signed-off-by: Leah Rowe --- include/init.sh | 2 +- include/vendor.sh | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/init.sh b/include/init.sh index 38eb1c81..39d48948 100644 --- a/include/init.sh +++ b/include/init.sh @@ -181,7 +181,7 @@ pybin() [ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \ [ -x "$pypath/$1" ] && printf "%s/%s\n" "$pypath" "$1" && \ - return 0 + return 0; : done && return 1 # Defer to normal command -v if not a venv diff --git a/include/vendor.sh b/include/vendor.sh index 2732eade..88c3fa04 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -38,7 +38,7 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \ E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest mecleaner \ kbc1126_ec_dump MRC_refcode_cbtree _dl SCH5545EC_DL_url EC_url rom DL_url \ - nuke cbfstoolref FSPFD_hash _7ztest ME11bootguard ME11delta xromsize \ + nuke cbfstoolref FSPFD_hash ME11bootguard ME11delta xromsize \ ME11version ME11sku ME11pch _me _metmp mfs TBFW_url_bkup TBFW_url cbdir \ TBFW_hash TBFW_size hashfile EC_url_bkup FSPM_bin_hash FSPS_bin_hash \ EC_FW1_hash EC_FW2_hash ME_bin_hash MRC_bin_hash REF_bin_hash _dl_bin \ @@ -156,7 +156,6 @@ extract_intel_me() { e "$mecleaner" f not && err "$cbdir: me_cleaner missing" - _7ztest="$xbmklocal/metmp/a" _metmp="$xbmklocal/me.bin" x_ rm -f "$_metmp" "$xbmklocal/a" @@ -165,7 +164,7 @@ extract_intel_me() [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard set +u +e - x_ rm -Rf "$xbmkpwd/metmp" + x_ rm -Rf "$xbmklocal/metmp" ( fx_ find_me x_ find "$xbmkpwd/$appdir" -type f ) || : [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_pre_dest" && return 0 @@ -182,14 +181,19 @@ find_me() [ -f "$_metmp" ] && exit 1 [ -L "$1" ] && return 0 - _7ztest="${_7ztest}a" && _r="-r" && [ -n "$mfs" ] && _r="" + _7x="`mktemp`" || err "find_me: can't make tmp file" + x_ rm -f "$_7x" + _7x="$xbmklocal/metmp/${_7x##*/}" + + _r="-r" + [ -n "$mfs" ] && _r="" "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" || \ "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ - -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 + -O "$_metmp" "$1" || extract_archive "$1" "$_7x" || return 0 [ -f "$_metmp" ] && exit 1 - ( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : + ( fx_ find_me x_ find "$_7x" -type f ) || exit 1; : } extract_archive() From f6b77822835fcd775a845c825a4e6a78abaa742a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 20 May 2025 20:14:09 +0100 Subject: [PATCH 228/267] Revert "vendor.sh: optimise find_me()" This reverts commit fb7aaa78bb080a473bdf0edf449bf08045e8366c. it caused a few issues. will re-do later the old code isn't really broken, just inefficient, because several files are scanned twice, but in practise the overhead isn't that great The error occurs sometimes, when bruteforcing me.bin: ERROR ./mk: Unhandled error for: mv /home/user/lbmk/tmp/me.bin /home/user/lbmk/cache/tmpdl/check This revert should fix the issue, for now. --- include/init.sh | 2 +- include/vendor.sh | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/init.sh b/include/init.sh index 39d48948..38eb1c81 100644 --- a/include/init.sh +++ b/include/init.sh @@ -181,7 +181,7 @@ pybin() [ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \ [ -x "$pypath/$1" ] && printf "%s/%s\n" "$pypath" "$1" && \ - return 0; : + return 0 done && return 1 # Defer to normal command -v if not a venv diff --git a/include/vendor.sh b/include/vendor.sh index 88c3fa04..2732eade 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -38,7 +38,7 @@ eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ E6400_VGA_DL_hash E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset \ E6400_VGA_romname SCH5545EC_DL_url_bkup SCH5545EC_DL_hash _dest mecleaner \ kbc1126_ec_dump MRC_refcode_cbtree _dl SCH5545EC_DL_url EC_url rom DL_url \ - nuke cbfstoolref FSPFD_hash ME11bootguard ME11delta xromsize \ + nuke cbfstoolref FSPFD_hash _7ztest ME11bootguard ME11delta xromsize \ ME11version ME11sku ME11pch _me _metmp mfs TBFW_url_bkup TBFW_url cbdir \ TBFW_hash TBFW_size hashfile EC_url_bkup FSPM_bin_hash FSPS_bin_hash \ EC_FW1_hash EC_FW2_hash ME_bin_hash MRC_bin_hash REF_bin_hash _dl_bin \ @@ -156,6 +156,7 @@ extract_intel_me() { e "$mecleaner" f not && err "$cbdir: me_cleaner missing" + _7ztest="$xbmklocal/metmp/a" _metmp="$xbmklocal/me.bin" x_ rm -f "$_metmp" "$xbmklocal/a" @@ -164,7 +165,7 @@ extract_intel_me() [ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard set +u +e - x_ rm -Rf "$xbmklocal/metmp" + x_ rm -Rf "$xbmkpwd/metmp" ( fx_ find_me x_ find "$xbmkpwd/$appdir" -type f ) || : [ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_pre_dest" && return 0 @@ -181,19 +182,14 @@ find_me() [ -f "$_metmp" ] && exit 1 [ -L "$1" ] && return 0 - _7x="`mktemp`" || err "find_me: can't make tmp file" - x_ rm -f "$_7x" - _7x="$xbmklocal/metmp/${_7x##*/}" - - _r="-r" - [ -n "$mfs" ] && _r="" + _7ztest="${_7ztest}a" && _r="-r" && [ -n "$mfs" ] && _r="" "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" || \ "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ - -O "$_metmp" "$1" || extract_archive "$1" "$_7x" || return 0 + -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 [ -f "$_metmp" ] && exit 1 - ( fx_ find_me x_ find "$_7x" -type f ) || exit 1; : + ( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : } extract_archive() From 24b8e633e0348d60dc7d64a919605e69f6ef0379 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 21 May 2025 13:34:18 +0100 Subject: [PATCH 229/267] GRUB: Update to revision 73d1c959e (14 March 2025) This brings in several changes from upstream: * 73d1c959e cryptocheck: Add --quiet option * dbc0eb5bd disk/cryptodisk: Wipe the passphrase from memory * 301b4ef25 disk/cryptodisk: Add the "erase secrets" function * 23ec4535f docs: Document available crypto disks checks * 10d778c4b commands/search: Add the diskfilter support * 7a584fbde disk/diskfilter: Introduce the "cryptocheck" command * ed691c0e0 commands/search: Introduce the --cryptodisk-only argument * c448f511e kern/rescue_reader: Block the rescue mode until the CLI authentication * 4abac0ad5 fs/xfs: Fix large extent counters incompat feature support This commit is of particular interest: * dbc0eb5bd disk/cryptodisk: Wipe the passphrase from memory Signed-off-by: Leah Rowe --- config/grub/default/target.cfg | 2 +- config/grub/nvme/target.cfg | 2 +- config/grub/xhci/target.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/grub/default/target.cfg b/config/grub/default/target.cfg index a9dab736..f5cc85f1 100644 --- a/config/grub/default/target.cfg +++ b/config/grub/default/target.cfg @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later tree="default" -rev="a4da71dafeea519b034beb159dfe80c486c2107c" +rev="73d1c959ea3417e9309ba8c6102d7d6dc7c94259" diff --git a/config/grub/nvme/target.cfg b/config/grub/nvme/target.cfg index aa86509f..7e473f19 100644 --- a/config/grub/nvme/target.cfg +++ b/config/grub/nvme/target.cfg @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later tree="nvme" -rev="a4da71dafeea519b034beb159dfe80c486c2107c" +rev="73d1c959ea3417e9309ba8c6102d7d6dc7c94259" diff --git a/config/grub/xhci/target.cfg b/config/grub/xhci/target.cfg index 5727e70b..0b90065b 100644 --- a/config/grub/xhci/target.cfg +++ b/config/grub/xhci/target.cfg @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-3.0-or-later tree="xhci" -rev="a4da71dafeea519b034beb159dfe80c486c2107c" +rev="73d1c959ea3417e9309ba8c6102d7d6dc7c94259" From a3250d144744e77b6a0d0f7cf011ecc6800edaaf Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 22 May 2025 01:17:27 +0100 Subject: [PATCH 230/267] tree.sh: Don't run make-clean on dry runs Otherwise, ./mk -d (without arguments) fails for GRUB, which first requires running autoconf to get a Makefile. Signed-off-by: Leah Rowe --- include/tree.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/tree.sh b/include/tree.sh index 8d787d4c..83887864 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -275,7 +275,8 @@ elfcheck() handle_makefile() { - $dry check_makefile "$srcdir" && x_ make -C "$srcdir" $cleanargs clean + $dry check_makefile "$srcdir" && \ + $dry x_ make -C "$srcdir" $cleanargs clean [ -f "$defconfig" ] && x_ cp "$defconfig" "$srcdir/.config" [ -n "$mode" ] || [ -n "$btype" ] || $dry make -C \ From 8e0c6059d155052c30a2b765b91c580e93ebdb7f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 22 May 2025 01:47:02 +0100 Subject: [PATCH 231/267] rom.sh: skip copyps1bios on dry builds otherwise, ./mk -d (without arguments) will fail. Signed-off-by: Leah Rowe --- include/rom.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/rom.sh b/include/rom.sh index 65900a01..1c39979d 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -20,6 +20,8 @@ buildser() copyps1bios() { + [ "$dry" = ":" ] && return 0; : + remkdir "bin/playstation" x_ cp src/pcsx-redux/src/mips/openbios/openbios.bin bin/playstation From f9266601b8c73daf36518c71db5e5c36080f3ddf Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 22 May 2025 11:27:22 +0100 Subject: [PATCH 232/267] vendor.sh: add colon at the end of a for loop Signed-off-by: Leah Rowe --- include/vendor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vendor.sh b/include/vendor.sh index 2732eade..99fc7467 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -107,7 +107,7 @@ fetch() [ "$dl_type" = "fsp" ] && for _cdl in dl dl_bkup; do eval "$_cdl=\"\${$_cdl##*../}\"; _cdp=\"\$$_cdl\"" [ -f "$_cdp" ] || _cdp="$cbdir/$_cdp" - [ -f "$_cdp" ] && eval "$_cdl=\"$_cdp\"" + [ -f "$_cdp" ] && eval "$_cdl=\"$_cdp\""; : done; : # download the file (from the internet) to extract from From fc0720184d954690071dcbf1c9322a2006701a94 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 22 May 2025 11:34:28 +0100 Subject: [PATCH 233/267] xbmk: add fake config makefile args to flashprog also pcsx-redux this way, commands like "./mk -u" without argument will not fail. these fake makefile commands do nothing. otherwise, an error errors because their makefiles do not define these options. Signed-off-by: Leah Rowe --- ...bmk-hack-add-config-Makefile-options.patch | 48 +++++++++++++++++++ ...-hack-add-no-ops-for-config-commands.patch | 43 +++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 config/flashprog/patches/0002-lbmk-hack-add-config-Makefile-options.patch create mode 100644 config/pcsx-redux/patches/0002-lbmk-hack-add-no-ops-for-config-commands.patch diff --git a/config/flashprog/patches/0002-lbmk-hack-add-config-Makefile-options.patch b/config/flashprog/patches/0002-lbmk-hack-add-config-Makefile-options.patch new file mode 100644 index 00000000..d2702d23 --- /dev/null +++ b/config/flashprog/patches/0002-lbmk-hack-add-config-Makefile-options.patch @@ -0,0 +1,48 @@ +From b7a4d2907d3358173510aa6e31af08afe4969b38 Mon Sep 17 00:00:00 2001 +From: Leah Rowe +Date: Thu, 22 May 2025 11:25:42 +0100 +Subject: [PATCH 1/1] lbmk hack: add config Makefile options + +this prevents a build error when running the +-u, -m, -s, -l and -n options in lbmk without +argument. + +this makes no functional changes to flashprog. + +Signed-off-by: Leah Rowe +--- + Makefile | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 12adf61..701f842 100644 +--- a/Makefile ++++ b/Makefile +@@ -1113,7 +1113,23 @@ libpayload: clean + gitconfig: + ./util/getrevision.sh -c 2>/dev/null && ./util/git-hooks/install.sh + +-.PHONY: all install clean distclean config branch tag versioninfo _export export tarball libpayload gitconfig ++oldconfig: ++ : ++ ++menuconfig: ++ : ++ ++savedefconfig: ++ : ++ ++olddefconfig: ++ : ++ ++nconfig: ++ : ++ ++ ++.PHONY: all install clean distclean config branch tag versioninfo _export export tarball libpayload gitconfig oldconfig menuconfig savedefconfig olddefconfig nconfig + + # Disable implicit suffixes and built-in rules (for performance and profit) + .SUFFIXES: +-- +2.39.5 + diff --git a/config/pcsx-redux/patches/0002-lbmk-hack-add-no-ops-for-config-commands.patch b/config/pcsx-redux/patches/0002-lbmk-hack-add-no-ops-for-config-commands.patch new file mode 100644 index 00000000..1a495d60 --- /dev/null +++ b/config/pcsx-redux/patches/0002-lbmk-hack-add-no-ops-for-config-commands.patch @@ -0,0 +1,43 @@ +From e4cd98fb5e3baf8260a3692cab745dea925b0764 Mon Sep 17 00:00:00 2001 +From: Leah Rowe +Date: Thu, 22 May 2025 11:29:37 +0100 +Subject: [PATCH 1/1] lbmk hack: add no-ops for config commands + +./mk -u, -m, -s, -l and -n cause errors without +arguments, because pcsx-redux's makefile doesn't +have them. additionally, i use my own makefile here, +so that only the openbios is compiled. + +add these so that lbmk doesn't crash during tests. + +Signed-off-by: Leah Rowe +--- + lbmkbofhmakefile | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/lbmkbofhmakefile b/lbmkbofhmakefile +index fe2e36d2..e0e2a11e 100644 +--- a/lbmkbofhmakefile ++++ b/lbmkbofhmakefile +@@ -14,3 +14,18 @@ clean: + + distclean: + make -C src/mips/openbios clean ++ ++oldconfig: ++ : ++ ++menuconfig: ++ : ++ ++savedefconfig: ++ : ++ ++olddefconfig: ++ : ++ ++nconfig: ++ : +-- +2.39.5 + From 231b320e63bb452208b3d01e5df6844ead4b76db Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 22 May 2025 11:51:31 +0100 Subject: [PATCH 234/267] release.sh: copy version files to rsrc Otherwise, an "unknown" version number is created. This regression was caused by the recent optimisation that reduces the amount of extra work done by init.sh on child instances of xbmk. As a result of those changes, now release.sh has to do some minor initialisation of its own, such as this. Signed-off-by: Leah Rowe --- include/release.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/release.sh b/include/release.sh index 5d6da466..f23ed541 100644 --- a/include/release.sh +++ b/include/release.sh @@ -27,6 +27,8 @@ release() remkdir "$vdir" x_ git clone . "$rsrc" + x_ cp ".version" "$rsrc/.version" + x_ cp ".versiondate" "$rsrc/.versiondate" prep_release src prep_release tarball From 419733d3073cbfc9f8f67e835b385b2b41e6f045 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 22 May 2025 12:22:07 +0100 Subject: [PATCH 235/267] get.sh: re-generate remotes every time that way, when a remote changes in config/, it will be updated automatically, without user intervention. Signed-off-by: Leah Rowe --- include/get.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/get.sh b/include/get.sh index ae2c5a35..08a561d9 100644 --- a/include/get.sh +++ b/include/get.sh @@ -143,8 +143,10 @@ try_git() [ -d "$gitdest" ] || x_ mkdir -p "${gitdest%/*}" [ -d "$gitdest" ] || x_ mv "$tmpgitcache" "$gitdest" - ( x_ git -C "$gitdest" remote add main "$4" 2>/dev/null ) || : - ( x_ git -C "$gitdest" remote add backup "$5" 2>/dev/null ) || : + ( x_ git -C "$gitdest" remote remove main ) || : + ( x_ git -C "$gitdest" remote remove backup ) || : + x_ git -C "$gitdest" remote add main "$4" + x_ git -C "$gitdest" remote add backup "$5" ( x_ git -C "$gitdest" fetch --all ) || : ( x_ git -C "$gitdest" pull --all ) || :; : } From 0216a3104a50ebf01405f6e04e44d0349567b85e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 22 May 2025 12:43:34 +0100 Subject: [PATCH 236/267] get.sh: Always update git remotes Right now, if cache/clone/PROJECT/ already exists, the logic for pulling new changes doesn't execute, and neither does the logic for updating remotes. This is bad when updating revisions, because then manual updating is required, defeating the purpose of xbmk's own automation in this regard. Fix it by only checking the cached download on files, not Git repositories; the try_git function itself will already perform this check, before updating remotes and pulling in new commits from upstream. The updating only happens when a given target directory doesn't exist, e.g. src/flashprog/ or src/grub/default/, so this won't slow down release builds for example. Signed-off-by: Leah Rowe --- include/get.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 08a561d9..6f1b5f1d 100644 --- a/include/get.sh +++ b/include/get.sh @@ -104,7 +104,8 @@ try_file() echk="d" && [ "$2" != "git" ] && echk="f" && \ bad_checksum "$6" "$cached" 2>/dev/null && x_ rm -f "$cached" - eval "[ -$echk \"$cached\" ] || try_$2 \"\$cached\" \"\$@\" || return 1" + evalchk="[ -$echk \"$cached\" ] || " && [ "$2" = "git" ] && evalchk="" + eval "${evalchk}try_$2 \"\$cached\" \"\$@\" || return 1" [ "$2" != "git" ] && [ -f "$5" ] && \ bad_checksum "$6" "$5" 2>/dev/null && x_ cp "$cached" "$5" eval "[ -$echk \"$cached\" ] || return 1" From 64cc91bca33d3a5356a805155d229b574e954f1c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 22 May 2025 13:48:20 +0100 Subject: [PATCH 237/267] coreboot/default: Remove unneeded FSP modules We only need the Kabylake version. We can safely remove the other ones, thereby significantly reducing the size of the lbmk release archive. Signed-off-by: Leah Rowe --- config/coreboot/default/nuke.list | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 config/coreboot/default/nuke.list diff --git a/config/coreboot/default/nuke.list b/config/coreboot/default/nuke.list new file mode 100644 index 00000000..c811f95d --- /dev/null +++ b/config/coreboot/default/nuke.list @@ -0,0 +1,18 @@ +3rdparty/fsp/EagleStreamFspBinPkg +3rdparty/fsp/AlderLakeFspBinPkg +3rdparty/fsp/MeteorLakeFspBinPkg +3rdparty/fsp/IceLakeFspBinPkg +3rdparty/fsp/AmberLakeFspBinPkg +3rdparty/fsp/DenvertonNSFspBinPkg +3rdparty/fsp/TigerLakeFspBinPkg +3rdparty/fsp/CedarIslandFspBinPkg +3rdparty/fsp/ElkhartLakeFspBinPkg +3rdparty/fsp/CometLakeFspBinPkg +3rdparty/fsp/WhitleyFspBinPkg +3rdparty/fsp/ArrowLakeFspBinPkg +3rdparty/fsp/IdavilleFspBinPkg +3rdparty/fsp/BraswellFspBinPkg +3rdparty/fsp/CoffeeLakeFspBinPkg +3rdparty/fsp/RaptorLakeFspBinPkg +3rdparty/fsp/ApolloLakeFspBinPkg +3rdparty/fsp/SkylakeFspBinPkg From 452aeb6001a5fc2b08da72536e6ed0d6fe2b6a9d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 22 May 2025 14:13:11 +0100 Subject: [PATCH 238/267] coreboot: Remove unused vboot tests Futility tests enlarge the src tarballs, without much utility. Uttterly futile. Signed-off-by: Leah Rowe --- config/coreboot/default/nuke.list | 1 + config/coreboot/fam15h/nuke.list | 1 + 2 files changed, 2 insertions(+) create mode 100644 config/coreboot/fam15h/nuke.list diff --git a/config/coreboot/default/nuke.list b/config/coreboot/default/nuke.list index c811f95d..7e5ba3b5 100644 --- a/config/coreboot/default/nuke.list +++ b/config/coreboot/default/nuke.list @@ -16,3 +16,4 @@ 3rdparty/fsp/RaptorLakeFspBinPkg 3rdparty/fsp/ApolloLakeFspBinPkg 3rdparty/fsp/SkylakeFspBinPkg +3rdparty/vboot/tests diff --git a/config/coreboot/fam15h/nuke.list b/config/coreboot/fam15h/nuke.list new file mode 100644 index 00000000..8ca7a4cf --- /dev/null +++ b/config/coreboot/fam15h/nuke.list @@ -0,0 +1 @@ +3rdparty/vboot/tests From 3e28873532b13a750df04d8dad8ffacb159cc7da Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 23 May 2025 04:52:36 +0100 Subject: [PATCH 239/267] ifd/hp8300usdt: set the HAP bit by default In practise, coreboot can set this bit at build time. We also use ME Soft Temporary Disable by default, on this platform. We also use me_cleaner by default, so the me.bin file added to flash only contains the code that would run with HAP set anyway. Therefore, this change is of little practical consequence, but as a friend put it to me, this change is most technically correct. And I'm all about technical correctness. Signed-off-by: Leah Rowe --- config/ifd/hp8300usdt/ifd | Bin 4096 -> 4096 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/config/ifd/hp8300usdt/ifd b/config/ifd/hp8300usdt/ifd index 3b81b7046a120162504ae6bd4a93ed9be0459cd0..282a8abba2b7e208b51c691aa6f972a1509739f2 100644 GIT binary patch delta 14 VcmZorXi(Uo!N}OKS(EWP9{?do1YH0C delta 14 VcmZorXi(Uo!N|z4S(EWP9{?Ul1Kj`s From 8c3f10ba402e7535529decf008cfd3dbd39d9d7e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 25 May 2025 03:09:29 +0100 Subject: [PATCH 240/267] rom.sh: simplify u-boot payload handling define it with a single variable, rather than several. this allows several checks to be greatly simplified. Signed-off-by: Leah Rowe --- .../dell3050micro_vfsp_16mb/target.cfg | 2 +- config/coreboot/dell7010sff_12mb/target.cfg | 2 +- config/coreboot/dell780mt_8mb/target.cfg | 2 +- .../dell780mt_truncate_8mb/target.cfg | 2 +- config/coreboot/dell780usff_8mb/target.cfg | 2 +- .../dell780usff_truncate_8mb/target.cfg | 2 +- .../coreboot/dell9020mt_nri_12mb/target.cfg | 2 +- .../coreboot/dell9020sff_nri_12mb/target.cfg | 2 +- config/coreboot/e4300_4mb/target.cfg | 2 +- config/coreboot/e5420_6mb/target.cfg | 2 +- config/coreboot/e5520_6mb/target.cfg | 2 +- config/coreboot/e5530_12mb/target.cfg | 2 +- config/coreboot/e6220_10mb/target.cfg | 2 +- config/coreboot/e6230_12mb/target.cfg | 4 +- config/coreboot/e6320_10mb/target.cfg | 2 +- config/coreboot/e6330_12mb/target.cfg | 2 +- config/coreboot/e6400_4mb/target.cfg | 2 +- config/coreboot/e6420_10mb/target.cfg | 2 +- config/coreboot/e6430_12mb/target.cfg | 2 +- config/coreboot/e6520_10mb/target.cfg | 2 +- config/coreboot/e6530_12mb/target.cfg | 2 +- config/coreboot/g43t_am3/target.cfg | 2 +- config/coreboot/g43t_am3_16mb/target.cfg | 2 +- config/coreboot/gru_bob/target.cfg | 2 +- config/coreboot/gru_kevin/target.cfg | 2 +- config/coreboot/hp2170p_16mb/target.cfg | 2 +- config/coreboot/hp2560p_8mb/target.cfg | 2 +- config/coreboot/hp2570p_16mb/target.cfg | 2 +- config/coreboot/hp8200sff_4mb/target.cfg | 2 +- config/coreboot/hp8200sff_8mb/target.cfg | 2 +- config/coreboot/hp820g2_12mb/target.cfg | 2 +- config/coreboot/hp8300cmt_16mb/target.cfg | 2 +- config/coreboot/hp8300usdt_16mb/target.cfg | 2 +- config/coreboot/hp8460pintel_8mb/target.cfg | 2 +- config/coreboot/hp8470pintel_16mb/target.cfg | 2 +- config/coreboot/hp9470m_16mb/target.cfg | 2 +- config/coreboot/kcma_d8_16mb/target.cfg | 2 +- config/coreboot/kcma_d8_2mb/target.cfg | 2 +- config/coreboot/kfsn4_dre_1mb/target.cfg | 2 +- config/coreboot/kfsn4_dre_2mb/target.cfg | 2 +- config/coreboot/kgpe_d16_16mb/target.cfg | 2 +- config/coreboot/kgpe_d16_2mb/target.cfg | 2 +- config/coreboot/macbook11/target.cfg | 2 +- config/coreboot/macbook11_16mb/target.cfg | 2 +- config/coreboot/macbook21/target.cfg | 2 +- config/coreboot/macbook21_16mb/target.cfg | 2 +- config/coreboot/q45t_am/target.cfg | 2 +- config/coreboot/qemu_arm64_12mb/target.cfg | 2 +- config/coreboot/qemu_x86_12mb/target.cfg | 2 +- config/coreboot/qemu_x86_64_12mb/target.cfg | 2 +- config/coreboot/r400_16mb/target.cfg | 2 +- config/coreboot/r400_4mb/target.cfg | 2 +- config/coreboot/r400_8mb/target.cfg | 2 +- config/coreboot/r500_4mb/target.cfg | 2 +- config/coreboot/t1650_12mb/target.cfg | 2 +- config/coreboot/t1700mt_bmrc_12mb/target.cfg | 2 +- config/coreboot/t1700sff_bmrc_12mb/target.cfg | 2 +- config/coreboot/t400_16mb/target.cfg | 2 +- config/coreboot/t400_4mb/target.cfg | 2 +- config/coreboot/t400_8mb/target.cfg | 2 +- config/coreboot/t420_8mb/target.cfg | 2 +- config/coreboot/t420s_8mb/target.cfg | 2 +- config/coreboot/t430_12mb/target.cfg | 2 +- config/coreboot/t440plibremrc_12mb/target.cfg | 2 +- config/coreboot/t500_16mb/target.cfg | 2 +- config/coreboot/t500_4mb/target.cfg | 2 +- config/coreboot/t500_8mb/target.cfg | 2 +- config/coreboot/t520_8mb/target.cfg | 2 +- config/coreboot/t530_12mb/target.cfg | 2 +- config/coreboot/t60_16mb_intelgpu/target.cfg | 2 +- config/coreboot/t60_intelgpu/target.cfg | 2 +- config/coreboot/w500_16mb/target.cfg | 2 +- config/coreboot/w500_4mb/target.cfg | 2 +- config/coreboot/w500_8mb/target.cfg | 2 +- config/coreboot/w530_12mb/target.cfg | 2 +- config/coreboot/w541_12mb/target.cfg | 2 +- config/coreboot/x200_16mb/target.cfg | 2 +- config/coreboot/x200_4mb/target.cfg | 2 +- config/coreboot/x200_8mb/target.cfg | 2 +- config/coreboot/x220_8mb/target.cfg | 2 +- config/coreboot/x230_12mb/target.cfg | 2 +- config/coreboot/x230_16mb/target.cfg | 2 +- config/coreboot/x230t_12mb/target.cfg | 2 +- config/coreboot/x230t_16mb/target.cfg | 2 +- config/coreboot/x301_16mb/target.cfg | 2 +- config/coreboot/x301_4mb/target.cfg | 2 +- config/coreboot/x301_8mb/target.cfg | 2 +- config/coreboot/x60/target.cfg | 2 +- config/coreboot/x60_16mb/target.cfg | 2 +- config/data/coreboot/mkhelper.cfg | 5 +-- include/rom.sh | 37 ++++++++----------- 91 files changed, 107 insertions(+), 115 deletions(-) diff --git a/config/coreboot/dell3050micro_vfsp_16mb/target.cfg b/config/coreboot/dell3050micro_vfsp_16mb/target.cfg index f86065a1..e100fbed 100644 --- a/config/coreboot/dell3050micro_vfsp_16mb/target.cfg +++ b/config/coreboot/dell3050micro_vfsp_16mb/target.cfg @@ -10,4 +10,4 @@ grubtree="xhci" vcfg="3050micro" build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" IFD_platform="sklkbl" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/dell7010sff_12mb/target.cfg b/config/coreboot/dell7010sff_12mb/target.cfg index de6a8af8..34865f86 100644 --- a/config/coreboot/dell7010sff_12mb/target.cfg +++ b/config/coreboot/dell7010sff_12mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="nvme" vcfg="t1650" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/dell780mt_8mb/target.cfg b/config/coreboot/dell780mt_8mb/target.cfg index 45b8ea0b..a58de7bd 100644 --- a/config/coreboot/dell780mt_8mb/target.cfg +++ b/config/coreboot/dell780mt_8mb/target.cfg @@ -8,4 +8,4 @@ payload_memtest="y" grub_scan_disk="nvme ahci ata" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/dell780mt_truncate_8mb/target.cfg b/config/coreboot/dell780mt_truncate_8mb/target.cfg index 45b8ea0b..a58de7bd 100644 --- a/config/coreboot/dell780mt_truncate_8mb/target.cfg +++ b/config/coreboot/dell780mt_truncate_8mb/target.cfg @@ -8,4 +8,4 @@ payload_memtest="y" grub_scan_disk="nvme ahci ata" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/dell780usff_8mb/target.cfg b/config/coreboot/dell780usff_8mb/target.cfg index 45b8ea0b..a58de7bd 100644 --- a/config/coreboot/dell780usff_8mb/target.cfg +++ b/config/coreboot/dell780usff_8mb/target.cfg @@ -8,4 +8,4 @@ payload_memtest="y" grub_scan_disk="nvme ahci ata" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/dell780usff_truncate_8mb/target.cfg b/config/coreboot/dell780usff_truncate_8mb/target.cfg index 45b8ea0b..a58de7bd 100644 --- a/config/coreboot/dell780usff_truncate_8mb/target.cfg +++ b/config/coreboot/dell780usff_truncate_8mb/target.cfg @@ -8,4 +8,4 @@ payload_memtest="y" grub_scan_disk="nvme ahci ata" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/dell9020mt_nri_12mb/target.cfg b/config/coreboot/dell9020mt_nri_12mb/target.cfg index 96fbb9e3..7c26ae5e 100644 --- a/config/coreboot/dell9020mt_nri_12mb/target.cfg +++ b/config/coreboot/dell9020mt_nri_12mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="xhci" vcfg="haswell" build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/dell9020sff_nri_12mb/target.cfg b/config/coreboot/dell9020sff_nri_12mb/target.cfg index 96fbb9e3..7c26ae5e 100644 --- a/config/coreboot/dell9020sff_nri_12mb/target.cfg +++ b/config/coreboot/dell9020sff_nri_12mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="xhci" vcfg="haswell" build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e4300_4mb/target.cfg b/config/coreboot/e4300_4mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/e4300_4mb/target.cfg +++ b/config/coreboot/e4300_4mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e5420_6mb/target.cfg b/config/coreboot/e5420_6mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/e5420_6mb/target.cfg +++ b/config/coreboot/e5420_6mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e5520_6mb/target.cfg b/config/coreboot/e5520_6mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/e5520_6mb/target.cfg +++ b/config/coreboot/e5520_6mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e5530_12mb/target.cfg b/config/coreboot/e5530_12mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/e5530_12mb/target.cfg +++ b/config/coreboot/e5530_12mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e6220_10mb/target.cfg b/config/coreboot/e6220_10mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/e6220_10mb/target.cfg +++ b/config/coreboot/e6220_10mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e6230_12mb/target.cfg b/config/coreboot/e6230_12mb/target.cfg index b491fdc8..42eca05e 100644 --- a/config/coreboot/e6230_12mb/target.cfg +++ b/config/coreboot/e6230_12mb/target.cfg @@ -7,5 +7,5 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" -payload_uboot_amd64="y" +payload_uboot="amd64" +payload_uboot="amd64" diff --git a/config/coreboot/e6320_10mb/target.cfg b/config/coreboot/e6320_10mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/e6320_10mb/target.cfg +++ b/config/coreboot/e6320_10mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e6330_12mb/target.cfg b/config/coreboot/e6330_12mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/e6330_12mb/target.cfg +++ b/config/coreboot/e6330_12mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e6400_4mb/target.cfg b/config/coreboot/e6400_4mb/target.cfg index b999b10c..f7500e97 100644 --- a/config/coreboot/e6400_4mb/target.cfg +++ b/config/coreboot/e6400_4mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="e6400" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e6420_10mb/target.cfg b/config/coreboot/e6420_10mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/e6420_10mb/target.cfg +++ b/config/coreboot/e6420_10mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e6430_12mb/target.cfg b/config/coreboot/e6430_12mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/e6430_12mb/target.cfg +++ b/config/coreboot/e6430_12mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e6520_10mb/target.cfg b/config/coreboot/e6520_10mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/e6520_10mb/target.cfg +++ b/config/coreboot/e6520_10mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/e6530_12mb/target.cfg b/config/coreboot/e6530_12mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/e6530_12mb/target.cfg +++ b/config/coreboot/e6530_12mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/g43t_am3/target.cfg b/config/coreboot/g43t_am3/target.cfg index 3379b716..357eee9a 100644 --- a/config/coreboot/g43t_am3/target.cfg +++ b/config/coreboot/g43t_am3/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_memtest="y" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/g43t_am3_16mb/target.cfg b/config/coreboot/g43t_am3_16mb/target.cfg index f2f0a52d..a097a3e8 100644 --- a/config/coreboot/g43t_am3_16mb/target.cfg +++ b/config/coreboot/g43t_am3_16mb/target.cfg @@ -7,4 +7,4 @@ payload_memtest="y" release="n" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/gru_bob/target.cfg b/config/coreboot/gru_bob/target.cfg index e5866cb7..dda11b5f 100644 --- a/config/coreboot/gru_bob/target.cfg +++ b/config/coreboot/gru_bob/target.cfg @@ -2,5 +2,5 @@ tree="default" xarch="aarch64-elf arm-eabi" -payload_uboot="y" +payload_uboot="arm64" build_depend="u-boot/gru_bob" diff --git a/config/coreboot/gru_kevin/target.cfg b/config/coreboot/gru_kevin/target.cfg index 81a93f27..26fd442b 100644 --- a/config/coreboot/gru_kevin/target.cfg +++ b/config/coreboot/gru_kevin/target.cfg @@ -2,5 +2,5 @@ tree="default" xarch="aarch64-elf arm-eabi" -payload_uboot="y" +payload_uboot="arm64" build_depend="u-boot/gru_kevin" diff --git a/config/coreboot/hp2170p_16mb/target.cfg b/config/coreboot/hp2170p_16mb/target.cfg index e1cffa41..d6868831 100644 --- a/config/coreboot/hp2170p_16mb/target.cfg +++ b/config/coreboot/hp2170p_16mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="hp2170p" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp2560p_8mb/target.cfg b/config/coreboot/hp2560p_8mb/target.cfg index 5715390e..fce385d9 100644 --- a/config/coreboot/hp2560p_8mb/target.cfg +++ b/config/coreboot/hp2560p_8mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="hp2560p" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp2570p_16mb/target.cfg b/config/coreboot/hp2570p_16mb/target.cfg index fb5d41e1..26c80f5f 100644 --- a/config/coreboot/hp2570p_16mb/target.cfg +++ b/config/coreboot/hp2570p_16mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="hp2570p" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp8200sff_4mb/target.cfg b/config/coreboot/hp8200sff_4mb/target.cfg index 521ba0ec..76effd9f 100644 --- a/config/coreboot/hp8200sff_4mb/target.cfg +++ b/config/coreboot/hp8200sff_4mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="nvme" vcfg="hp8200sff" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp8200sff_8mb/target.cfg b/config/coreboot/hp8200sff_8mb/target.cfg index 521ba0ec..76effd9f 100644 --- a/config/coreboot/hp8200sff_8mb/target.cfg +++ b/config/coreboot/hp8200sff_8mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="nvme" vcfg="hp8200sff" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp820g2_12mb/target.cfg b/config/coreboot/hp820g2_12mb/target.cfg index 7fe45119..66d0433e 100644 --- a/config/coreboot/hp820g2_12mb/target.cfg +++ b/config/coreboot/hp820g2_12mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="xhci" vcfg="hp820g2" build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp8300cmt_16mb/target.cfg b/config/coreboot/hp8300cmt_16mb/target.cfg index 5bd323c9..f3fb43a7 100644 --- a/config/coreboot/hp8300cmt_16mb/target.cfg +++ b/config/coreboot/hp8300cmt_16mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="nvme" vcfg="ivybridge" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp8300usdt_16mb/target.cfg b/config/coreboot/hp8300usdt_16mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/hp8300usdt_16mb/target.cfg +++ b/config/coreboot/hp8300usdt_16mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp8460pintel_8mb/target.cfg b/config/coreboot/hp8460pintel_8mb/target.cfg index d6179420..255bfac7 100644 --- a/config/coreboot/hp8460pintel_8mb/target.cfg +++ b/config/coreboot/hp8460pintel_8mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="hp8460pintel" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp8470pintel_16mb/target.cfg b/config/coreboot/hp8470pintel_16mb/target.cfg index 65828b25..01b2ed5b 100644 --- a/config/coreboot/hp8470pintel_16mb/target.cfg +++ b/config/coreboot/hp8470pintel_16mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="hp8470pintel" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/hp9470m_16mb/target.cfg b/config/coreboot/hp9470m_16mb/target.cfg index e4dbdc93..6ebd81c5 100644 --- a/config/coreboot/hp9470m_16mb/target.cfg +++ b/config/coreboot/hp9470m_16mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="hp9470m" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/kcma_d8_16mb/target.cfg b/config/coreboot/kcma_d8_16mb/target.cfg index 112c101f..75955f7e 100644 --- a/config/coreboot/kcma_d8_16mb/target.cfg +++ b/config/coreboot/kcma_d8_16mb/target.cfg @@ -9,4 +9,4 @@ xlang="c" grub_scan_disk="nvme ahci" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/kcma_d8_2mb/target.cfg b/config/coreboot/kcma_d8_2mb/target.cfg index 112c101f..75955f7e 100644 --- a/config/coreboot/kcma_d8_2mb/target.cfg +++ b/config/coreboot/kcma_d8_2mb/target.cfg @@ -9,4 +9,4 @@ xlang="c" grub_scan_disk="nvme ahci" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/kfsn4_dre_1mb/target.cfg b/config/coreboot/kfsn4_dre_1mb/target.cfg index a87ac1ad..c4536856 100644 --- a/config/coreboot/kfsn4_dre_1mb/target.cfg +++ b/config/coreboot/kfsn4_dre_1mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_memtest="y" xlang="c" build_depend="seabios/default memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/kfsn4_dre_2mb/target.cfg b/config/coreboot/kfsn4_dre_2mb/target.cfg index 17021b47..f942604b 100644 --- a/config/coreboot/kfsn4_dre_2mb/target.cfg +++ b/config/coreboot/kfsn4_dre_2mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" xlang="c" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/kgpe_d16_16mb/target.cfg b/config/coreboot/kgpe_d16_16mb/target.cfg index 112c101f..75955f7e 100644 --- a/config/coreboot/kgpe_d16_16mb/target.cfg +++ b/config/coreboot/kgpe_d16_16mb/target.cfg @@ -9,4 +9,4 @@ xlang="c" grub_scan_disk="nvme ahci" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/kgpe_d16_2mb/target.cfg b/config/coreboot/kgpe_d16_2mb/target.cfg index 112c101f..75955f7e 100644 --- a/config/coreboot/kgpe_d16_2mb/target.cfg +++ b/config/coreboot/kgpe_d16_2mb/target.cfg @@ -9,4 +9,4 @@ xlang="c" grub_scan_disk="nvme ahci" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/macbook11/target.cfg b/config/coreboot/macbook11/target.cfg index c1e3a3c6..f41e3fe9 100644 --- a/config/coreboot/macbook11/target.cfg +++ b/config/coreboot/macbook11/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" grub_scan_disk="ahci" build_depend="seabios/default grub/default u-boot/i386coreboot" -payload_uboot_i386="y" +payload_uboot="i386" diff --git a/config/coreboot/macbook11_16mb/target.cfg b/config/coreboot/macbook11_16mb/target.cfg index e0d1afbf..ff2498eb 100644 --- a/config/coreboot/macbook11_16mb/target.cfg +++ b/config/coreboot/macbook11_16mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" scan_scan_disk="ahci" build_depend="seabios/default grub/default u-boot/i386coreboot" -payload_uboot_i386="y" +payload_uboot="i386" diff --git a/config/coreboot/macbook21/target.cfg b/config/coreboot/macbook21/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/macbook21/target.cfg +++ b/config/coreboot/macbook21/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/macbook21_16mb/target.cfg b/config/coreboot/macbook21_16mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/macbook21_16mb/target.cfg +++ b/config/coreboot/macbook21_16mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/q45t_am/target.cfg b/config/coreboot/q45t_am/target.cfg index 3379b716..357eee9a 100644 --- a/config/coreboot/q45t_am/target.cfg +++ b/config/coreboot/q45t_am/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_memtest="y" grubtree="nvme" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/qemu_arm64_12mb/target.cfg b/config/coreboot/qemu_arm64_12mb/target.cfg index 5d8f0db2..2ea9482f 100644 --- a/config/coreboot/qemu_arm64_12mb/target.cfg +++ b/config/coreboot/qemu_arm64_12mb/target.cfg @@ -2,5 +2,5 @@ tree="default" xarch="aarch64-elf arm-eabi" -payload_uboot="y" +payload_uboot="arm64" build_depend="u-boot/qemu_arm64_12mb" diff --git a/config/coreboot/qemu_x86_12mb/target.cfg b/config/coreboot/qemu_x86_12mb/target.cfg index 2074beca..476a98cb 100644 --- a/config/coreboot/qemu_x86_12mb/target.cfg +++ b/config/coreboot/qemu_x86_12mb/target.cfg @@ -6,4 +6,4 @@ payload_grub="y" payload_seabios="y" payload_memtest="y" build_depend="seabios/default grub/default memtest86plus u-boot/i386coreboot" -payload_uboot_i386="y" +payload_uboot="i386" diff --git a/config/coreboot/qemu_x86_64_12mb/target.cfg b/config/coreboot/qemu_x86_64_12mb/target.cfg index 7855bd6f..61ae6299 100644 --- a/config/coreboot/qemu_x86_64_12mb/target.cfg +++ b/config/coreboot/qemu_x86_64_12mb/target.cfg @@ -5,4 +5,4 @@ xarch="i386-elf" payload_grub="y" payload_seabios="y" payload_memtest="y" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/r400_16mb/target.cfg b/config/coreboot/r400_16mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/r400_16mb/target.cfg +++ b/config/coreboot/r400_16mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/r400_4mb/target.cfg b/config/coreboot/r400_4mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/r400_4mb/target.cfg +++ b/config/coreboot/r400_4mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/r400_8mb/target.cfg b/config/coreboot/r400_8mb/target.cfg index ef878ea1..23bfb335 100644 --- a/config/coreboot/r400_8mb/target.cfg +++ b/config/coreboot/r400_8mb/target.cfg @@ -5,4 +5,4 @@ xarch="i386-elf" payload_seabios="y" payload_grub="y" payload_memtest="y" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/r500_4mb/target.cfg b/config/coreboot/r500_4mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/r500_4mb/target.cfg +++ b/config/coreboot/r500_4mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t1650_12mb/target.cfg b/config/coreboot/t1650_12mb/target.cfg index de6a8af8..34865f86 100644 --- a/config/coreboot/t1650_12mb/target.cfg +++ b/config/coreboot/t1650_12mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="nvme" vcfg="t1650" build_depend="seabios/default grub/nvme memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t1700mt_bmrc_12mb/target.cfg b/config/coreboot/t1700mt_bmrc_12mb/target.cfg index 06de408c..5fd0d500 100644 --- a/config/coreboot/t1700mt_bmrc_12mb/target.cfg +++ b/config/coreboot/t1700mt_bmrc_12mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="xhci" vcfg="t1700" build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t1700sff_bmrc_12mb/target.cfg b/config/coreboot/t1700sff_bmrc_12mb/target.cfg index 06de408c..5fd0d500 100644 --- a/config/coreboot/t1700sff_bmrc_12mb/target.cfg +++ b/config/coreboot/t1700sff_bmrc_12mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="xhci" vcfg="t1700" build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t400_16mb/target.cfg b/config/coreboot/t400_16mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/t400_16mb/target.cfg +++ b/config/coreboot/t400_16mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t400_4mb/target.cfg b/config/coreboot/t400_4mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/t400_4mb/target.cfg +++ b/config/coreboot/t400_4mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t400_8mb/target.cfg b/config/coreboot/t400_8mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/t400_8mb/target.cfg +++ b/config/coreboot/t400_8mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t420_8mb/target.cfg b/config/coreboot/t420_8mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/t420_8mb/target.cfg +++ b/config/coreboot/t420_8mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t420s_8mb/target.cfg b/config/coreboot/t420s_8mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/t420s_8mb/target.cfg +++ b/config/coreboot/t420s_8mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t430_12mb/target.cfg b/config/coreboot/t430_12mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/t430_12mb/target.cfg +++ b/config/coreboot/t430_12mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t440plibremrc_12mb/target.cfg b/config/coreboot/t440plibremrc_12mb/target.cfg index 96fbb9e3..7c26ae5e 100644 --- a/config/coreboot/t440plibremrc_12mb/target.cfg +++ b/config/coreboot/t440plibremrc_12mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="xhci" vcfg="haswell" build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t500_16mb/target.cfg b/config/coreboot/t500_16mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/t500_16mb/target.cfg +++ b/config/coreboot/t500_16mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t500_4mb/target.cfg b/config/coreboot/t500_4mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/t500_4mb/target.cfg +++ b/config/coreboot/t500_4mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t500_8mb/target.cfg b/config/coreboot/t500_8mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/t500_8mb/target.cfg +++ b/config/coreboot/t500_8mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t520_8mb/target.cfg b/config/coreboot/t520_8mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/t520_8mb/target.cfg +++ b/config/coreboot/t520_8mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t530_12mb/target.cfg b/config/coreboot/t530_12mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/t530_12mb/target.cfg +++ b/config/coreboot/t530_12mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/t60_16mb_intelgpu/target.cfg b/config/coreboot/t60_16mb_intelgpu/target.cfg index c1e3a3c6..f41e3fe9 100644 --- a/config/coreboot/t60_16mb_intelgpu/target.cfg +++ b/config/coreboot/t60_16mb_intelgpu/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" grub_scan_disk="ahci" build_depend="seabios/default grub/default u-boot/i386coreboot" -payload_uboot_i386="y" +payload_uboot="i386" diff --git a/config/coreboot/t60_intelgpu/target.cfg b/config/coreboot/t60_intelgpu/target.cfg index c1e3a3c6..f41e3fe9 100644 --- a/config/coreboot/t60_intelgpu/target.cfg +++ b/config/coreboot/t60_intelgpu/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" grub_scan_disk="ahci" build_depend="seabios/default grub/default u-boot/i386coreboot" -payload_uboot_i386="y" +payload_uboot="i386" diff --git a/config/coreboot/w500_16mb/target.cfg b/config/coreboot/w500_16mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/w500_16mb/target.cfg +++ b/config/coreboot/w500_16mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/w500_4mb/target.cfg b/config/coreboot/w500_4mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/w500_4mb/target.cfg +++ b/config/coreboot/w500_4mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/w500_8mb/target.cfg b/config/coreboot/w500_8mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/w500_8mb/target.cfg +++ b/config/coreboot/w500_8mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/w530_12mb/target.cfg b/config/coreboot/w530_12mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/w530_12mb/target.cfg +++ b/config/coreboot/w530_12mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/w541_12mb/target.cfg b/config/coreboot/w541_12mb/target.cfg index 96fbb9e3..7c26ae5e 100644 --- a/config/coreboot/w541_12mb/target.cfg +++ b/config/coreboot/w541_12mb/target.cfg @@ -9,4 +9,4 @@ grub_scan_disk="nvme ahci" grubtree="xhci" vcfg="haswell" build_depend="seabios/default grub/xhci memtest86plus u-boot/amd64coreboot" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x200_16mb/target.cfg b/config/coreboot/x200_16mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/x200_16mb/target.cfg +++ b/config/coreboot/x200_16mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x200_4mb/target.cfg b/config/coreboot/x200_4mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/x200_4mb/target.cfg +++ b/config/coreboot/x200_4mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x200_8mb/target.cfg b/config/coreboot/x200_8mb/target.cfg index 53a597b6..f4d81d19 100644 --- a/config/coreboot/x200_8mb/target.cfg +++ b/config/coreboot/x200_8mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x220_8mb/target.cfg b/config/coreboot/x220_8mb/target.cfg index 333030ce..d7510b96 100644 --- a/config/coreboot/x220_8mb/target.cfg +++ b/config/coreboot/x220_8mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="sandybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x230_12mb/target.cfg b/config/coreboot/x230_12mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/x230_12mb/target.cfg +++ b/config/coreboot/x230_12mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x230_16mb/target.cfg b/config/coreboot/x230_16mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/x230_16mb/target.cfg +++ b/config/coreboot/x230_16mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x230t_12mb/target.cfg b/config/coreboot/x230t_12mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/x230t_12mb/target.cfg +++ b/config/coreboot/x230t_12mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x230t_16mb/target.cfg b/config/coreboot/x230t_16mb/target.cfg index 6cbab731..595ad782 100644 --- a/config/coreboot/x230t_16mb/target.cfg +++ b/config/coreboot/x230t_16mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" grub_scan_disk="ahci" vcfg="ivybridge" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x301_16mb/target.cfg b/config/coreboot/x301_16mb/target.cfg index 4d4a4c25..31e9f759 100644 --- a/config/coreboot/x301_16mb/target.cfg +++ b/config/coreboot/x301_16mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" release="n" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x301_4mb/target.cfg b/config/coreboot/x301_4mb/target.cfg index 4d4a4c25..31e9f759 100644 --- a/config/coreboot/x301_4mb/target.cfg +++ b/config/coreboot/x301_4mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" release="n" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x301_8mb/target.cfg b/config/coreboot/x301_8mb/target.cfg index 4d4a4c25..31e9f759 100644 --- a/config/coreboot/x301_8mb/target.cfg +++ b/config/coreboot/x301_8mb/target.cfg @@ -7,4 +7,4 @@ payload_grub="y" payload_memtest="y" release="n" grub_scan_disk="ahci" -payload_uboot_amd64="y" +payload_uboot="amd64" diff --git a/config/coreboot/x60/target.cfg b/config/coreboot/x60/target.cfg index c1e3a3c6..f41e3fe9 100644 --- a/config/coreboot/x60/target.cfg +++ b/config/coreboot/x60/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" grub_scan_disk="ahci" build_depend="seabios/default grub/default u-boot/i386coreboot" -payload_uboot_i386="y" +payload_uboot="i386" diff --git a/config/coreboot/x60_16mb/target.cfg b/config/coreboot/x60_16mb/target.cfg index c1e3a3c6..f41e3fe9 100644 --- a/config/coreboot/x60_16mb/target.cfg +++ b/config/coreboot/x60_16mb/target.cfg @@ -6,4 +6,4 @@ payload_seabios="y" payload_grub="y" grub_scan_disk="ahci" build_depend="seabios/default grub/default u-boot/i386coreboot" -payload_uboot_i386="y" +payload_uboot="i386" diff --git a/config/data/coreboot/mkhelper.cfg b/config/data/coreboot/mkhelper.cfg index c993fbd4..630654a0 100644 --- a/config/data/coreboot/mkhelper.cfg +++ b/config/data/coreboot/mkhelper.cfg @@ -5,10 +5,9 @@ build_depend="seabios/default grub/default memtest86plus u-boot/amd64coreboot" seavgabiosrom="elf/seabios/default/libgfxinit/vgabios.bin" -pv="payload_uboot payload_seabios payload_memtest payload_grub" -pv="$pv payload_uboot_i386 payload_uboot_amd64 payload_grubsea" +pv="payload_seabios payload_memtest payload_grub payload_grubsea" v="initmode ubootelf grub_scan_disk uboot_config grubtree grubelf pname" -v="$v displaymode tmprom newrom" +v="$v displaymode tmprom newrom payload_uboot" eval `setvars "n" $pv` eval `setvars "" $v` diff --git a/include/rom.sh b/include/rom.sh index 1c39979d..eedd05d3 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -94,21 +94,16 @@ mkcorebootbin() initmode="${initmode%%_*}" cbfstool="elf/cbfstool/$tree/cbfstool" - [ "$payload_uboot_i386" = "y" ] && \ - [ "$payload_uboot_amd64" = "y" ] && \ - err "'$target' enables 32- and 64-bit x86 U-Boot" + [ -z "$payload_uboot" ] || [ "$payload_uboot" = "amd64" ] || \ + [ "$payload_uboot" = "i386" ] || [ "$payload_uboot" = "arm64" ] \ + || err "'$target' defines bad u-boot type '$payload_uboot'" - if [ "$payload_uboot_i386" = "y" ] || \ - [ "$payload_uboot_amd64" = "y" ]; then - printf "'%s' has x86 U-Boot; assuming SeaBIOS=y\n" \ - "$target" 1>&2 + [ -z "$payload_uboot" ] || [ "$payload_uboot" = "arm64" ] || \ 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" ] && \ + [ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "arm64" ] && \ $dry err "$target: U-Boot(arm64) and SeaBIOS/GRUB both enabled." [ -z "$grub_scan_disk" ] && grub_scan_disk="nvme ahci ata" @@ -126,7 +121,8 @@ mkcorebootbin() if $dry grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then [ "$payload_seabios" = "y" ] && pname="seabios" && \ $dry add_seabios - [ "$payload_uboot" = "y" ] && pname="uboot" && $dry add_uboot + [ "$payload_uboot" = "arm64" ] && pname="uboot" && \ + $dry add_uboot; : else pname="custom" $dry cprom @@ -135,10 +131,8 @@ mkcorebootbin() add_seabios() { - if [ "$payload_uboot_i386" = "y" ] || \ - [ "$payload_uboot_amd64" = "y" ]; then - $dry add_uboot - fi + [ -z "$payload_uboot" ] || [ "$payload_uboot" = "arm64" ] || \ + $dry add_uboot _seabioself="elf/seabios/default/$initmode/bios.bin.elf" _seaname="fallback/payload" && [ "$payload_grubsea" = "y" ] && \ @@ -159,7 +153,7 @@ add_seabios() [ "$payload_grub" = "y" ] && add_grub [ "$payload_grubsea" != "y" ] && cprom - [ "$payload_uboot_amd64" = "y" ] && [ "$displaymode" != "txtmode" ] && \ + [ "$payload_uboot" = "amd64" ] && [ "$displaymode" != "txtmode" ] && \ [ "$initmode" != "normal" ] && [ "$payload_grubsea" != "y" ] && \ pname="seauboot" && cprom "seauboot" [ "$payload_grub" = "y" ] && pname="seagrub" && mkseagrub; : @@ -206,14 +200,13 @@ add_uboot() ubpath="fallback/payload" ubtarget="$target" # override for x86/x86_64 targets: - if [ "$payload_uboot_i386" = "y" ] || \ - [ "$payload_uboot_amd64" = "y" ]; then + if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; 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" # 64-bit ubtarget="amd64coreboot" - [ "$payload_uboot_i386" = "y" ] && ubpath="u-boot" # 32-bit - [ "$payload_uboot_i386" = "y" ] && ubtarget="i386coreboot"; : + [ "$payload_uboot" = "i386" ] && ubpath="u-boot" # 32-bit + [ "$payload_uboot" = "i386" ] && ubtarget="i386coreboot"; : fi ubdir="elf/u-boot/$ubtarget/$uboot_config" @@ -222,8 +215,8 @@ add_uboot() 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" ] && \ + [ "$payload_uboot" = "i386" ] && ubootelf="$ubdir/u-boot-dtb.bin" + [ "$payload_uboot" = "amd64" ] && \ ubootelf="$ubdir/u-boot-x86-with-spl.bin" # EFI-compatible cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs From d2e148fdd9d3f341940c22c241d219a0372f8f57 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 25 May 2025 04:40:30 +0100 Subject: [PATCH 241/267] rom.sh: simplify ccache handling for coreboot we simply do not need to run the make-oldconfig command at all, and after removing it, the "cook" function seemed quite redundant so i merged it with mkvendorfiles() Signed-off-by: Leah Rowe --- include/rom.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/include/rom.sh b/include/rom.sh index eedd05d3..4a3503f4 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -45,7 +45,8 @@ mkpayload_grub() mkvendorfiles() { - [ -z "$mode" ] && $dry cook_coreboot_config + [ -n "$mode" ] || [ ! -f "$srcdir/.config" ] || $dry printf \ + "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || err "$srcdir: !cook"; : fx_ check_coreboot_util printf "cbfstool\nifdtool\n" printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \ err "!mk $srcdir .coreboot-version" @@ -53,14 +54,6 @@ mkvendorfiles() x_ ./mk download "$target"; : } -cook_coreboot_config() -{ - [ -f "$srcdir/.config" ] || return 0 - printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \ - err "$srcdir/.config: Could not enable ccache" - make -C "$srcdir" oldconfig || err "Could not cook $srcdir/.config"; : -} - check_coreboot_util() { [ "$badhash" = "y" ] && x_ rm -f "elf/$1/$tree/$1" From a47e98117235682e9d1744ddbf1d16523532d96a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 25 May 2025 04:45:23 +0100 Subject: [PATCH 242/267] rom.sh: rename mkvendorfiles it mainly does general tasks, like handling utils and enabling ccache. the vfiles are a small part. rename the function accordingly. it is called by premake, so let's call it corebootpremake. this change will also make sense when cherry-picked into cbmk, which does not handle vfiles at all. Signed-off-by: Leah Rowe --- config/data/coreboot/mkhelper.cfg | 2 +- include/rom.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/data/coreboot/mkhelper.cfg b/config/data/coreboot/mkhelper.cfg index 630654a0..da9015f1 100644 --- a/config/data/coreboot/mkhelper.cfg +++ b/config/data/coreboot/mkhelper.cfg @@ -11,6 +11,6 @@ v="$v displaymode tmprom newrom payload_uboot" eval `setvars "n" $pv` eval `setvars "" $v` -premake="mkvendorfiles" +premake="corebootpremake" mkhelper="mkcorebootbin" postmake="mkcoreboottar" diff --git a/include/rom.sh b/include/rom.sh index 4a3503f4..632ecca3 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -43,7 +43,7 @@ mkpayload_grub() "/boot/grub/grub.cfg=$grubdata/memdisk.cfg"; : } -mkvendorfiles() +corebootpremake() { [ -n "$mode" ] || [ ! -f "$srcdir/.config" ] || $dry printf \ "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || err "$srcdir: !cook"; : From 97ce531c341f36b1496729e4a0f882b4ad9621b7 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 25 May 2025 05:03:03 +0100 Subject: [PATCH 243/267] rom.sh: simplify mkcoreboottar() Signed-off-by: Leah Rowe --- include/rom.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/rom.sh b/include/rom.sh index 632ecca3..4ac4c5de 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -253,10 +253,7 @@ cbfs() mkcoreboottar() { - [ "$target" = "$tree" ] && return 0 - [ "$XBMK_RELEASE" = "y" ] || return 0 - [ "$release" != "n" ] || return 0 - - $dry mkrom_tarball "bin/$target" - $dry x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke; : + [ "$target" != "$tree" ] && [ "$XBMK_RELEASE" = "y" ] && \ + [ "$release" != "n" ] && $dry mkrom_tarball "bin/$target" && \ + $dry x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke; : } From ad333ae24810dcb762d5561d0b7d7dabec7c0eac Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 25 May 2025 14:35:02 +0100 Subject: [PATCH 244/267] tree.sh: Don't auto-run make-oldconfig This code was introduced to provide fault tolerance, so that if I forgot to manually update the configs myself, builds would still succeed, e.g. coreboot builds. However, there have been cases in the past where this introduces settings we don't want, and in general we do want to know when there is an error in the configs. The policy should always be: fail early, fail hard. This also mitigates bugs in U-Boot's build system; for example, when I last attempted to update the U-Boot tree for x86, make-oldconfig introduced a lot of junk settings unrelated, which then introduced code that would brick the board if you tried it on one, e.g. it broke booting most Linux kernels via bootflow. With this change, U-Boot will be easier to handle, which normally requires manual configuration; the automated make-oldconfig reconfiguration feature breaks U-Boot. This will no longer occur, since we no longer run it manually. On the other hand, this feature has also prevented other disastrous bugs in the past, such as when I forgot to properly set the SPD size on T480; it was set to 256 bytes, not 512 as is correct. Therefore, this new design change means I must also be more vigilant about config changes in project trees. Signed-off-by: Leah Rowe --- include/tree.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/tree.sh b/include/tree.sh index 83887864..8aaadd57 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -279,8 +279,6 @@ handle_makefile() $dry x_ make -C "$srcdir" $cleanargs clean [ -f "$defconfig" ] && x_ cp "$defconfig" "$srcdir/.config" - [ -n "$mode" ] || [ -n "$btype" ] || $dry make -C \ - "$srcdir" silentoldconfig || make -C "$srcdir" oldconfig || : run_make_command || err "handle_makefile $srcdir: no makefile!" From 2493203ee53befbf46de0ff7908214b5e64033a8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 25 May 2025 14:46:33 +0100 Subject: [PATCH 245/267] get.sh: Properly error out if tmpclone fails We rely on a non-zero exit on other try_ commands, which works fine there because we then check the file afterward and error out accordingly. For git repositories, we assume that both mirrors are identical and therefore once we get to the first clone attempt, we assume that it must succeed. Therefore, if it does not succeed, we must fail. This fixes a regression I found in testing, where sometimes a failed patching attempt would not result in an error exit, and would therefore result in broken sources being present. In practise, I always very closely watch the terminal when testing xbmk, especially when updating project patches, so we probably didn't introduce any broken sources in practice. Signed-off-by: Leah Rowe --- include/get.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 6f1b5f1d..3d06eb4a 100644 --- a/include/get.sh +++ b/include/get.sh @@ -111,7 +111,8 @@ try_file() eval "[ -$echk \"$cached\" ] || return 1" if [ "$2" = "git" ]; then - [ -d "$5" ] || tmpclone "$cached" "$5" "$6" "$7" || return 1 + [ -d "$5" ] || tmpclone "$cached" "$5" "$6" "$7" || \ + err "Can't clone final repo in command: try_file $*"; : else bad_checksum "$6" "$cached" && x_ rm -f "$cached" && return 1 [ "$cached" != "$5" ] && x_ cp "$cached" "$5" From 30bc3732c39cbb14faa8f7caf0c9206f6a401008 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 25 May 2025 17:01:10 +0100 Subject: [PATCH 246/267] init.sh: error out if .git/ is a symlink the current behaviour is a relic from the older lbmk design, before recent auditing. the current logic would cause xbmk to continue execution, going into a child process with .git/ being a symlink. The .git/ directory should never be a symlink, because it is extremely error-prone. Signed-off-by: Leah Rowe --- include/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/init.sh b/include/init.sh index 38eb1c81..9265bf45 100644 --- a/include/init.sh +++ b/include/init.sh @@ -195,7 +195,7 @@ xbmk_git_init() || err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" done - [ -L ".git" ] && return 1 + [ -L ".git" ] && err "'$xbmkpwd/.git' is a symlink" [ -e ".git" ] && return 0 eval "`setvars "$(date -Rud @$versiondate)" cdate _nogit`" From ba7c49c090b7b41564ec5e9c69e60a022c2ace6e Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 00:33:36 +0100 Subject: [PATCH 247/267] vendor.sh: simplify fetch() the checks at the end of the function are mostly superfluous, because bad_checksum() is immediately called just beforehand, and performs the same checks. Signed-off-by: Leah Rowe --- include/vendor.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/include/vendor.sh b/include/vendor.sh index 99fc7467..0111f90f 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -132,14 +132,8 @@ fetch() ( fx_ "eval mkdst \"$binsum\"" x_ find "${_pre_dest%/*}" -type f ) || : bad_checksum "$binsum" "$_dest" || [ ! -f "$_dest" ] || return 0 - [ -z "$binsum" ] && \ - printf "'%s', '%s': checksum undefined. Check files in '%s'\n" \ - "$board" "$_dest" "${_pre_dest%/*}" 1>&2 - e "$_dest" f not && err "missing file '$_dest', !extract_$dl_type"; : - e "$_dest" f && printf "WARNING: '%s' made with bad hash (will rm)\n" \ - "$_dest" 1>&2 - [ -L "$_dest" ] && printf "WARNING: '%s' is a link. Please delete!\n" \ - "$_dest" 1>&2 + [ -z "$binsum" ] && printf "'%s': checksum undefined\n" "$_dest" 1>&2 + [ -L "$_dest" ] && printf "WARNING: '%s' is a link!\n" "$_dest" 1>&2 [ -L "$_dest" ] || x_ rm -f "$_dest" err "Could not safely extract '$_dest', for board '$board'" } From ffe387ac6b98d99f82660410f23bb931e04beed8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 00:35:38 +0100 Subject: [PATCH 248/267] get.sh: remove superfluous command in try_git() A git-pull is performed immediately after git-fetch. Git-pull already performs git-fetch as a prerequisite. Signed-off-by: Leah Rowe --- include/get.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 3d06eb4a..4105b93f 100644 --- a/include/get.sh +++ b/include/get.sh @@ -149,7 +149,6 @@ try_git() ( x_ git -C "$gitdest" remote remove backup ) || : x_ git -C "$gitdest" remote add main "$4" x_ git -C "$gitdest" remote add backup "$5" - ( x_ git -C "$gitdest" fetch --all ) || : ( x_ git -C "$gitdest" pull --all ) || :; : } From afc36754b13de41bfbea5ebf5202bdb01cb4aeeb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 00:44:57 +0100 Subject: [PATCH 249/267] get.sh: remove redundant printf in fetch_project The following execution will result in another printf that says exactly what is being downloaded. There is no need to inform the user twice about what is being downloaded. Signed-off-by: Leah Rowe --- include/get.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/include/get.sh b/include/get.sh index 4105b93f..639d101d 100644 --- a/include/get.sh +++ b/include/get.sh @@ -26,7 +26,6 @@ fetch_project() [ -n "$xtree" ] && x_ ./mk -f coreboot "$xtree" [ -z "$depend" ] || for d in $depend ; do - printf "'%s' needs '%s'; grabbing '%s'\n" "$project" "$d" "$d" x_ ./mk -f $d done clone_project From e981132c829dea9dd958ea174e35e15e122451d7 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 00:50:06 +0100 Subject: [PATCH 250/267] get.sh: consolidate printf statements stick it in git_prep, which both single- and multi-tree projects will use, when downloading git repositories. Signed-off-by: Leah Rowe --- include/get.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/get.sh b/include/get.sh index 639d101d..a60e8c36 100644 --- a/include/get.sh +++ b/include/get.sh @@ -11,8 +11,6 @@ tmpgitcache="$XBMK_CACHE/tmpgit" fetch_targets() { e "src/$project/$tree" d && return 0 - - printf "Creating %s tree %s\n" "$project" "$tree" git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \ "src/$project/$tree" with_submodules } @@ -35,7 +33,6 @@ clone_project() { loc="$XBMK_CACHE/clone/$project" && singletree "$project" && \ loc="src/$project" - printf "Downloading project '%s' to '%s'\n" "$project" "$loc" e "$loc" d missing && remkdir "${tmpgit%/*}" && git_prep \ "$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"; : @@ -43,6 +40,8 @@ clone_project() git_prep() { + printf "Creating code directory, src/%s/%s\n" "$project" "$tree" + _patchdir="$3" _loc="$4" # $1 and $2 are gitrepo and gitrepo_backup From 18dacd4c22b1dfe6ab985d76712dd8261f173ce4 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 00:57:50 +0100 Subject: [PATCH 251/267] xbmk: rename xbmklocal/xbmktmp variables shorten them Signed-off-by: Leah Rowe --- include/get.sh | 2 +- include/init.sh | 13 ++++++------- include/inject.sh | 14 +++++++------- include/release.sh | 2 +- include/rom.sh | 6 +++--- include/tree.sh | 6 +++--- include/vendor.sh | 14 +++++++------- 7 files changed, 28 insertions(+), 29 deletions(-) diff --git a/include/get.sh b/include/get.sh index a60e8c36..ebaaaff1 100644 --- a/include/get.sh +++ b/include/get.sh @@ -5,7 +5,7 @@ eval "`setvars "" loc url bkup_url subcurl subhash subgit subgit_bkup \ depend subcurl_bkup repofail`" -tmpgit="$xbmklocal/gitclone" +tmpgit="$xbloc/gitclone" tmpgitcache="$XBMK_CACHE/tmpgit" fetch_targets() diff --git a/include/init.sh b/include/init.sh index 9265bf45..bc5a62b6 100644 --- a/include/init.sh +++ b/include/init.sh @@ -14,13 +14,13 @@ projectsite="https://libreboot.org/" export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \ - datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver xbmklocal \ + datadir version xbmkpwd relname xbmkpwd xbtmp python pyver xbloc \ xbmklock cvxbmk cvchk xbmkpath`" xbmk_init() { xbmkpwd="`pwd`" || err "Cannot generate PWD" - xbmklocal="$xbmkpwd/tmp" + xbloc="$xbmkpwd/tmp" xbmklock="$xbmkpwd/lock" export PWD="$xbmkpwd" @@ -71,7 +71,7 @@ xbmk_set_env() # unify all temporary files/directories in a single TMPDIR [ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || \ unset TMPDIR - [ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR" && xbmktmp="$TMPDIR" + [ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR" && xbtmp="$TMPDIR" [ -z "${TMPDIR+x}" ] || is_child="y" # child instance, so return if [ "$is_child" = "y" ]; then @@ -87,7 +87,7 @@ xbmk_set_env() # parent instance of xbmk, so don't return. set up TMPDIR export TMPDIR="/tmp" export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)" - xbmktmp="$TMPDIR" + xbtmp="$TMPDIR" export XBMK_CACHE="$xbmkpwd/cache" [ -L "$XBMK_CACHE" ] && [ "$XBMK_CACHE" = "$xbmkpwd/cache" ] && \ @@ -107,8 +107,7 @@ xbmk_set_env() xbmk_set_version export LOCALVERSION="-$projectname-${version%%-*}" - remkdir "$xbmktmp" "$xbmklocal" - remkdir "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" + remkdir "$xbtmp" "$xbloc" "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" xbmk_set_pyver } @@ -211,7 +210,7 @@ xbmk_child_exec() { xbmk_rval=0 ( x_ ./mk "$@" ) || xbmk_rval=1 - ( x_ rm -Rf "$xbmklocal" "$xbmktmp" ) || xbmk_rval=1 + ( x_ rm -Rf "$xbloc" "$xbtmp" ) || xbmk_rval=1 ( x_ rm -f "$xbmklock" ) || xbmk_rval=1 exit $xbmk_rval } diff --git a/include/inject.sh b/include/inject.sh index 74f688a1..d2808301 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -103,36 +103,36 @@ patch_release() readkconfig() { - x_ rm -f "$xbmktmp/cbcfg" + x_ rm -f "$xbtmp/cbcfg" fx_ scankconfig x_ find "$boarddir/config" -type f - eval "`setcfg "$xbmktmp/cbcfg" 1`" + eval "`setcfg "$xbtmp/cbcfg" 1`" setvfile "$@" || return 1; : } scankconfig() { for cbc in $cv; do - grep "$cbc" "$1" 1>>"$xbmktmp/cbcfg" 2>/dev/null || : + grep "$cbc" "$1" 1>>"$xbtmp/cbcfg" 2>/dev/null || : done } modify_mac() { - x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbmklocal/gbe" + x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbloc/gbe" [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \ x_ make -C util/nvmutil clean && x_ make -C util/nvmutil && \ - x_ "$nvm" "$xbmklocal/gbe" setmac "$new_mac" + x_ "$nvm" "$xbloc/gbe" setmac "$new_mac" fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom" printf "\nThe following GbE NVM data will be written:\n" - x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || : + x_ "$nvm" "$xbloc/gbe" dump | grep -v "bytes read from file" || : } newmac() { e "$1" f && xchanged="y" && x_ \ - "$ifdtool" $ifdprefix -i GbE:"$xbmklocal/gbe" "$1" -O "$1"; : + "$ifdtool" $ifdprefix -i GbE:"$xbloc/gbe" "$1" -O "$1"; : } remktar() diff --git a/include/release.sh b/include/release.sh index f23ed541..5b822c7b 100644 --- a/include/release.sh +++ b/include/release.sh @@ -22,7 +22,7 @@ release() [ -e "$reldest" ] && \ err "already exists: \"$reldest\"" - vdir="$XBMK_CACHE/relpwd/${xbmktmp##*/}/$version" + vdir="$XBMK_CACHE/relpwd/${xbtmp##*/}/$version" rsrc="$vdir/${relname}_src" remkdir "$vdir" diff --git a/include/rom.sh b/include/rom.sh index 4ac4c5de..e8caf024 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -78,7 +78,7 @@ mkcorebootbin() { [ "$target" = "$tree" ] && return 0 - tmprom="$xbmktmp/coreboot.rom" + tmprom="$xbtmp/coreboot.rom" $dry x_ cp "$srcdir/build/coreboot.rom" "$tmprom" initmode="${defconfig##*/}" @@ -158,8 +158,8 @@ add_grub() _grubname="fallback/payload" cbfs "$tmprom" "$grubelf" "$_grubname" printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" \ - > "$xbmktmp/tmpcfg" || err "$target: !insert scandisk" - cbfs "$tmprom" "$xbmktmp/tmpcfg" scan.cfg raw + > "$xbtmp/tmpcfg" || err "$target: !insert scandisk" + cbfs "$tmprom" "$xbtmp/tmpcfg" scan.cfg raw [ "$initmode" != "normal" ] && [ "$displaymode" != "txtmode" ] && \ cbfs "$tmprom" "$grubdata/background/background1280x800.png" \ "background.png" raw; : diff --git a/include/tree.sh b/include/tree.sh index 8aaadd57..11607eed 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -58,7 +58,7 @@ trees() mkhelpercfg="$datadir/mkhelper.cfg" if e "$mkhelpercfg" f missing; then - mkhelpercfg="$xbmktmp/mkhelper.cfg" + mkhelpercfg="$xbtmp/mkhelper.cfg" x_ touch "$mkhelpercfg" fi @@ -181,9 +181,9 @@ check_project_hashes() fx_ "x_ sha512sum" find "$datadir" "$configdir/$tree" "$mdir" \ -type f -not -path "*/.git*/*" | awk '{print $1}' > \ - "$xbmktmp/project.hash" || err "!h $project $tree" + "$xbtmp/project.hash" || err "!h $project $tree" - pjhash="$(sha512sum "$xbmktmp/project.hash" | awk '{print $1}')" || : + pjhash="$(sha512sum "$xbtmp/project.hash" | awk '{print $1}')" || : [ "$pjhash" != "$old_pjhash" ] && badhash="y" [ -f "$XBMK_CACHE/hash/$project$tree" ] || badhash="y" diff --git a/include/vendor.sh b/include/vendor.sh index 0111f90f..6702f5fd 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -150,9 +150,9 @@ extract_intel_me() { e "$mecleaner" f not && err "$cbdir: me_cleaner missing" - _7ztest="$xbmklocal/metmp/a" - _metmp="$xbmklocal/me.bin" - x_ rm -f "$_metmp" "$xbmklocal/a" + _7ztest="$xbloc/metmp/a" + _metmp="$xbloc/me.bin" + x_ rm -f "$_metmp" "$xbloc/a" mfs="" && [ "$ME11bootguard" = "y" ] && mfs="--whitelist MFS" && \ chkvars ME11delta ME11version ME11sku ME11pch @@ -178,7 +178,7 @@ find_me() _7ztest="${_7ztest}a" && _r="-r" && [ -n "$mfs" ] && _r="" - "$mecleaner" $mfs $_r -t -O "$xbmklocal/a" -M "$_metmp" "$1" || \ + "$mecleaner" $mfs $_r -t -O "$xbloc/a" -M "$_metmp" "$1" || \ "$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \ -O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0 @@ -387,9 +387,9 @@ vfile() elif [ "$nuke" = "nuke" ]; then x_ "$cbfstool" "$rom" remove -n "$cbfsname" elif [ "$_t" = "stage" ]; then # the only stage we handle is refcode - x_ rm -f "$xbmklocal/refcode" - x_ "$rmodtool" -i "$_dest" -o "$xbmklocal/refcode" - x_ "$cbfstool" "$rom" add-stage -f "$xbmklocal/refcode" \ + x_ rm -f "$xbloc/refcode" + x_ "$rmodtool" -i "$_dest" -o "$xbloc/refcode" + x_ "$cbfstool" "$rom" add-stage -f "$xbloc/refcode" \ -n "$cbfsname" -t stage else x_ "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \ From 09b6e91803d4112ae22d31313a5fdbe8afe79707 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 01:30:33 +0100 Subject: [PATCH 252/267] general cleanup in get.sh and vendor.sh Signed-off-by: Leah Rowe --- include/get.sh | 10 +++++----- include/vendor.sh | 21 ++++++++------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/include/get.sh b/include/get.sh index ebaaaff1..00768f0b 100644 --- a/include/get.sh +++ b/include/get.sh @@ -46,7 +46,7 @@ git_prep() _loc="$4" # $1 and $2 are gitrepo and gitrepo_backup chkvars rev - xbmkget git "$1" "$2" "$tmpgit" "$rev" "$_patchdir" + xbget git "$1" "$2" "$tmpgit" "$rev" "$_patchdir" if singletree "$project" || [ $# -gt 4 ]; then dx_ fetch_submodule "$mdir/module.list" fi @@ -71,19 +71,19 @@ fetch_submodule() chkvars "sub${st}" "sub${st}_bkup" "subhash" [ "$st" = "git" ] && x_ rm -Rf "$tmpgit/$1" - eval xbmkget "$st" "\$sub$st" "\$sub${st}_bkup" "$tmpgit/$1" \ + eval xbget "$st" "\$sub$st" "\$sub${st}_bkup" "$tmpgit/$1" \ "$subhash" "$mdir/${1##*/}/patches" } -xbmkget() +xbget() { [ "$1" = "curl" ] || [ "$1" = "copy" ] || [ "$1" = "git" ] || \ - err "Bad dlop (arg 1): xbmkget $*" + err "Bad dlop (arg 1): xbget $*" echk="f" && [ "$1" = "git" ] && echk="d" for url in "$2" "$3"; do - [ -n "$url" ] || err "empty URL given in: xbmkget $*" + [ -n "$url" ] || err "empty URL given in: xbget $*" try_file "$url" "$@" || continue eval "[ -$echk \"$4\" ] || continue" return 0 # successful download/copy diff --git a/include/vendor.sh b/include/vendor.sh index 6702f5fd..4d8d1184 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -26,12 +26,11 @@ cvchk="CONFIG_INCLUDE_SMSC_SCH5545_EC_FW CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \ CONFIG_FSP_S_FILE CONFIG_KBC1126_FW1 CONFIG_KBC1126_FW2" # lbmk-specific extensions to the "cv" variable (not suitable for cbmk) -cvxbmk="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE \ - CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2_OFFSET \ +cvxbmk="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE CONFIG_FSP_FULL_FD \ + CONFIG_KBC1126_FW1_OFFSET CONFIG_KBC1126_FW2_OFFSET CONFIG_FSP_USE_REPO \ CONFIG_VGA_BIOS_ID CONFIG_BOARD_DELL_E6400 CONFIG_FSP_S_CBFS \ CONFIG_HAVE_REFCODE_BLOB CONFIG_REFCODE_BLOB_FILE CONFIG_FSP_FD_PATH \ - CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS \ - CONFIG_FSP_USE_REPO CONFIG_FSP_FULL_FD" + CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS" # lbmk-specific extensions; mostly used for downloading vendor files eval "`setvars "" has_hashes EC_hash DL_hash DL_url_bkup MRC_refcode_gbe vcfg \ @@ -54,17 +53,14 @@ download() getfiles() { [ -z "$CONFIG_HAVE_ME_BIN" ] || fetch intel_me "$DL_url" \ - "$DL_url_bkup" "$DL_hash" "$CONFIG_ME_BIN_PATH" "curl" \ - "$ME_bin_hash" + "$DL_url_bkup" "$DL_hash" "$CONFIG_ME_BIN_PATH" curl "$ME_bin_hash" [ -z "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" ] || fetch sch5545ec \ "$SCH5545EC_DL_url" "$SCH5545EC_DL_url_bkup" "$SCH5545EC_DL_hash" \ "$CONFIG_SMSC_SCH5545_EC_FW_FILE" "curl" "$SCH5545EC_bin_hash" [ -z "$CONFIG_KBC1126_FW1" ] || fetch kbc1126ec "$EC_url" \ - "$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW1" "curl" \ - "$EC_FW1_hash" + "$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW1" curl "$EC_FW1_hash" [ -z "$CONFIG_KBC1126_FW2" ] || fetch kbc1126ec "$EC_url" \ - "$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW2" "curl" \ - "$EC_FW2_hash" + "$EC_url_bkup" "$EC_hash" "$CONFIG_KBC1126_FW2" curl "$EC_FW2_hash" [ -z "$CONFIG_VGA_BIOS_FILE" ] || fetch e6400vga "$E6400_VGA_DL_url" \ "$E6400_VGA_DL_url_bkup" "$E6400_VGA_DL_hash" \ "$CONFIG_VGA_BIOS_FILE" "curl" "$E6400_VGA_bin_hash" @@ -111,12 +107,11 @@ fetch() done; : # download the file (from the internet) to extract from - xbmkget "$dlop" "$dl" "$dl_bkup" "$_dl" "$dlsum" + xbget "$dlop" "$dl" "$dl_bkup" "$_dl" "$dlsum" x_ rm -Rf "${_dl}_extracted" # skip extraction if a cached extracted file exists - ( xbmkget copy "$_dl_bin" "$_dl_bin" "$_dest" "$binsum" 2>/dev/null ) \ - || : + ( xbget copy "$_dl_bin" "$_dl_bin" "$_dest" "$binsum" 2>/dev/null ) || : [ -f "$_dest" ] && return 0 x_ mkdir -p "${_dest%/*}" From 671e3aa27b402f04543cf016565421021d97c27d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 13:11:20 +0100 Subject: [PATCH 253/267] get.sh: simplify fetch_targets() Signed-off-by: Leah Rowe --- include/get.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/get.sh b/include/get.sh index 00768f0b..d32452ff 100644 --- a/include/get.sh +++ b/include/get.sh @@ -10,9 +10,8 @@ tmpgitcache="$XBMK_CACHE/tmpgit" fetch_targets() { - e "src/$project/$tree" d && return 0 - git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \ - "src/$project/$tree" with_submodules + [ -d "src/$project/$tree" ] || git_prep "$url" "$bkup_url" \ + "$xbmkpwd/$configdir/$tree/patches" "src/$project/$tree" submod; : } fetch_project() From 495098d6a71bc3a67a80d39a5d4fdf2d2207c782 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 13:19:06 +0100 Subject: [PATCH 254/267] get.sh: tidy up bad_checksum() Signed-off-by: Leah Rowe --- include/get.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/get.sh b/include/get.sh index d32452ff..6aed0a8d 100644 --- a/include/get.sh +++ b/include/get.sh @@ -151,10 +151,10 @@ try_git() bad_checksum() { - [ ! -f "$2" ] && printf "'%s' missing, %s\n" "$2" "$1" 1>&2 && return 0 + e "$2" f missing && return 0 csum="$(x_ sha512sum "$2" | awk '{print $1}')" || err "!sha512 '$2' $1" - [ "$csum" != "$1" ] && printf "BAD SHA512, '%s'; need '%s', got %s\n" \ - "$2" "$1" "$csum" 1>&2 && x_ rm -f "$2" && return 0; return 1 + [ "$csum" = "$1" ] && return 1; x_ rm -f "$2" + printf "BAD SHA512 %s, '%s'; need '%s'\n" "$csum" "$2" "$1" 1>&2 } tmpclone() From b5867be214d3f899ae1777bfe1d0b2c1d69ba6cd Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 13:23:06 +0100 Subject: [PATCH 255/267] get.sh: simplify try_copy() Signed-off-by: Leah Rowe --- include/get.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/get.sh b/include/get.sh index 6aed0a8d..b842d768 100644 --- a/include/get.sh +++ b/include/get.sh @@ -128,8 +128,7 @@ try_curl() try_copy() { - [ -L "$2" ] && printf "symlink %s (trycp %s)\n" "$2" "$*" && return 1 - [ ! -f "$2" ] && printf "%s missing (trycp %s)\n" "$2" "$*" && return 1 + e "$2" f missing && return 1; : ( x_ cp "$2" "$1" ) || return 1; : } From 41308ee924445cad61e599aebf15557a0351522b Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 13:26:34 +0100 Subject: [PATCH 256/267] get.sh: simplify fetch_project() Signed-off-by: Leah Rowe --- include/get.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/get.sh b/include/get.sh index b842d768..a3328454 100644 --- a/include/get.sh +++ b/include/get.sh @@ -19,9 +19,7 @@ fetch_project() eval "`setvars "" xtree`" eval "`setcfg "config/git/$project/pkg.cfg"`" - chkvars url bkup_url - - [ -n "$xtree" ] && x_ ./mk -f coreboot "$xtree" + chkvars url bkup_url && [ -n "$xtree" ] && x_ ./mk -f coreboot "$xtree" [ -z "$depend" ] || for d in $depend ; do x_ ./mk -f $d done From 5036a0bc501b5b26d429701a8e9dd71339ec18a0 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 13:33:56 +0100 Subject: [PATCH 257/267] mk: simplify main() Signed-off-by: Leah Rowe --- mk | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mk b/mk index f358bc3a..8da15f5b 100755 --- a/mk +++ b/mk @@ -26,14 +26,13 @@ main() case "$cmd" in version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;; release|download|inject) $cmd "$@" ;; - -*) return 0 ;; + -*) return 1 ;; *) err "bad command" ;; esac set -u -e # some commands disable them. turn them on! - return 1 } -main "$@" || exit 0 +main "$@" && exit 0 . "include/tree.sh" From 79ded40f3d0f123ce2dbddba524aaae76764c699 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 13:45:12 +0100 Subject: [PATCH 258/267] lib.sh: simplify chkvars() Signed-off-by: Leah Rowe --- include/lib.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 7c4d71ea..822f1abc 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -71,11 +71,9 @@ setcfg() chkvars() { - while true; do - [ $# -lt 1 ] && break + while [ $# -gt 0 ]; do eval "[ -n \"\${$1+x}\" ] || err \"$1 unset\"" - eval "[ -n \"\$$1\" ] || err \"$1 unset\"" - shift 1 + eval "[ -n \"\$$1\" ] || err \"$1 unset\"; shift 1; :" done; : } From dee6997d0cc13e95b9a911efef0687b0ac582edd Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 13:49:55 +0100 Subject: [PATCH 259/267] lib.sh: simplify setvars() Signed-off-by: Leah Rowe --- include/lib.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/lib.sh b/include/lib.sh index 822f1abc..86c0df26 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -53,12 +53,10 @@ setvars() fi val="$1" shift 1 - while true; do - [ $# -lt 1 ] && break - _setvars="$1=\"$val\"; $_setvars" + while [ $# -gt 0 ]; do + printf "%s=\"%s\"\n" "$1" "$val" shift 1 done - printf "%s\n" "${_setvars% }" } setcfg() From b77154640de6442b4180cb65e3851d1ae9f78918 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 26 May 2025 18:46:58 +0100 Subject: [PATCH 260/267] release.sh: use printf to create version files Don't copy the files directly, because we might be doing this from a work directory that has no files; in this case, generic "unknown" variables are used, without generating any files, so the current logic would produce an error. However, we do need to create those dot files, because we then rely on them for building release binaries. The new logic maintains current behaviour, while fixing this technical edge-case scenario via mitigation. Signed-off-by: Leah Rowe --- include/release.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/release.sh b/include/release.sh index 5b822c7b..912687dc 100644 --- a/include/release.sh +++ b/include/release.sh @@ -27,8 +27,7 @@ release() remkdir "$vdir" x_ git clone . "$rsrc" - x_ cp ".version" "$rsrc/.version" - x_ cp ".versiondate" "$rsrc/.versiondate" + update_xbmkver "$rsrc" prep_release src prep_release tarball From dc6996252a0f516add85e0cbcf1693bfa80f8c99 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 10:11:42 +0100 Subject: [PATCH 261/267] put coreboot utils in elf/coreboot/TREE not elf/UTIL/TREE This way, they are automatically deleted when a tree has to be re-built. Signed-off-by: Leah Rowe --- include/inject.sh | 4 ++-- include/lib.sh | 4 ++-- include/rom.sh | 8 ++++---- include/vendor.sh | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/inject.sh b/include/inject.sh index d2808301..a58acc81 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -6,7 +6,7 @@ cbcfgsdir="config/coreboot" tmpromdel="$XBMK_CACHE/DO_NOT_FLASH" nvm="util/nvmutil/nvm" -ifdtool="elf/ifdtool/default/ifdtool" +ifdtool="elf/coreboot/default/ifdtool" cv="CONFIG_GBE_BIN_PATH" [ -n "$cvxbmk" ] && cv="$cv $cvxbmk" @@ -77,7 +77,7 @@ check_target() eval "`setcfg "$boarddir/target.cfg"`" chkvars tree && x_ ./mk -d coreboot "$tree" - ifdtool="elf/ifdtool/$tree/ifdtool" + ifdtool="elf/coreboot/$tree/ifdtool" [ -n "$IFD_platform" ] && ifdprefix="-p $IFD_platform"; : } diff --git a/include/lib.sh b/include/lib.sh index 86c0df26..b40772fa 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -4,8 +4,8 @@ # Copyright (c) 2020-2025 Leah Rowe # Copyright (c) 2025 Alper Nebi Yasak -cbfstool="elf/cbfstool/default/cbfstool" -rmodtool="elf/cbfstool/default/rmodtool" +cbfstool="elf/coreboot/default/cbfstool" +rmodtool="elf/coreboot/default/rmodtool" remkdir() { diff --git a/include/rom.sh b/include/rom.sh index e8caf024..c1b78c75 100644 --- a/include/rom.sh +++ b/include/rom.sh @@ -56,10 +56,10 @@ corebootpremake() check_coreboot_util() { - [ "$badhash" = "y" ] && x_ rm -f "elf/$1/$tree/$1" - e "elf/$1/$tree/$1" f && return 0 + [ "$badhash" = "y" ] && x_ rm -f "elf/coreboot/$tree/$1" + e "elf/coreboot/$tree/$1" f && return 0 - utilelfdir="elf/$1/$tree" + utilelfdir="elf/coreboot/$tree" utilsrcdir="src/coreboot/$tree/util/$1" utilmode="" && [ -n "$mode" ] && utilmode="clean" @@ -85,7 +85,7 @@ mkcorebootbin() displaymode="${initmode##*_}" [ "$displaymode" = "$initmode" ] && displaymode="" # "normal" config initmode="${initmode%%_*}" - cbfstool="elf/cbfstool/$tree/cbfstool" + cbfstool="elf/coreboot/$tree/cbfstool" [ -z "$payload_uboot" ] || [ "$payload_uboot" = "amd64" ] || \ [ "$payload_uboot" = "i386" ] || [ "$payload_uboot" = "arm64" ] \ diff --git a/include/vendor.sh b/include/vendor.sh index 4d8d1184..3f287899 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -270,8 +270,8 @@ bootstrap() cbdir="src/coreboot/$tree" mecleaner="$xbmkpwd/$cbdir/util/me_cleaner/me_cleaner.py" kbc1126_ec_dump="$xbmkpwd/$cbdir/util/kbc1126/kbc1126_ec_dump" - cbfstool="elf/cbfstool/$tree/cbfstool" - rmodtool="elf/cbfstool/$tree/rmodtool" + cbfstool="elf/coreboot/$tree/cbfstool" + rmodtool="elf/coreboot/$tree/rmodtool" x_ ./mk -f coreboot "${cbdir##*/}" fx_ "x_ ./mk -b" printf "uefitool\nbiosutilities\nbios_extract\n" From 974bdbb38159d90b90eeff68220c7464b418866d Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 11:18:18 +0100 Subject: [PATCH 262/267] vendor.sh: fix bad cbfstool path i overlooked this one in the previous commit there is always one. Signed-off-by: Leah Rowe --- include/vendor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vendor.sh b/include/vendor.sh index 3f287899..55373913 100644 --- a/include/vendor.sh +++ b/include/vendor.sh @@ -277,7 +277,7 @@ bootstrap() fx_ "x_ ./mk -b" printf "uefitool\nbiosutilities\nbios_extract\n" [ -d "${kbc1126_ec_dump%/*}" ] && x_ make -C "$cbdir/util/kbc1126" [ -n "$MRC_refcode_cbtree" ] && \ - cbfstoolref="elf/cbfstool/$MRC_refcode_cbtree/cbfstool" && \ + cbfstoolref="elf/coreboot/$MRC_refcode_cbtree/cbfstool" && \ x_ ./mk -d coreboot "$MRC_refcode_cbtree"; : } From 267d4c903413c4eccc4271b00f872a7dd3d1a165 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 11:29:04 +0100 Subject: [PATCH 263/267] inject.sh: add missing semicolons Signed-off-by: Leah Rowe --- include/inject.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/inject.sh b/include/inject.sh index a58acc81..795b2c70 100644 --- a/include/inject.sh +++ b/include/inject.sh @@ -65,7 +65,7 @@ check_release() *.tar.xz) _stripped_prefix="${archivename#*_}" board="${_stripped_prefix%.tar.xz}" ;; *) - err "'$archive': could not detect board type" + err "'$archive': could not detect board type" ;; esac; : } From 677dfc4d103f01b2d6c3b9d9b92011523e248308 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 27 May 2025 12:59:42 +0100 Subject: [PATCH 264/267] tree.sh: more reliable clean in run_make_command Don't do no-op if it fails; fall back to "clean" instead, and fail if that fails. The no-op was there was not all projects have distclean, but we do intend for them all to be cleaned. We mitigate further error by only running make-clean if a makefile exists. Signed-off-by: Leah Rowe --- include/tree.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/tree.sh b/include/tree.sh index 11607eed..df03333f 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -302,8 +302,10 @@ run_make_command() $dry x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs [ -n "$mode" ] || x_ $mkhelper + check_makefile "$srcdir" || return 0 [ "$mode" != "clean" ] || \ - $dry make -C "$srcdir" $cleanargs distclean || :; : + $dry make -C "$srcdir" $cleanargs distclean || \ + $dry x_ make -C "$srcdir" $cleanargs clean; : } check_cmake() From 04bee3834d031b1b9209f53112367a46d0c7606f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 28 May 2025 18:38:23 +0100 Subject: [PATCH 265/267] tree.sh: add error check in check_project_hashes() when reading old_pjhash, we need to error out where a read error occurs. such an error is unlikely, but could occur under certain edge cases. Signed-off-by: Leah Rowe --- include/tree.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/tree.sh b/include/tree.sh index df03333f..6afba6f4 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -177,7 +177,8 @@ check_project_hashes() { old_pjhash="" && x_ mkdir -p "$XBMK_CACHE/hash" [ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \ - read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree" + read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree" || \ + err "old_pjhash: Can't read '$XBMK_CACHE/hash/$project$tree'" fx_ "x_ sha512sum" find "$datadir" "$configdir/$tree" "$mdir" \ -type f -not -path "*/.git*/*" | awk '{print $1}' > \ From b1ef562b7677f7238636dcbc76fa53999efdcfbb Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 28 May 2025 18:43:44 +0100 Subject: [PATCH 266/267] tree.sh: add sha512 error for check_project_hashes handle errors on sha512sum - also handle awk errors inside the mini subshell, and provide overall error handling. we know that the project.hash file should always exist, and always be read no matter what; technically, the find command that proceeds it might not yield any results, but an empty file would then be produced. the edge case of an empty file would have lead to an error beforehand, when configuring the project in function, configure_project(), so we've already got that covered. Signed-off-by: Leah Rowe --- include/tree.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/tree.sh b/include/tree.sh index 6afba6f4..85f97101 100644 --- a/include/tree.sh +++ b/include/tree.sh @@ -184,7 +184,8 @@ check_project_hashes() -type f -not -path "*/.git*/*" | awk '{print $1}' > \ "$xbtmp/project.hash" || err "!h $project $tree" - pjhash="$(sha512sum "$xbtmp/project.hash" | awk '{print $1}')" || : + pjhash="$(x_ sha512sum "$xbtmp/project.hash" | awk '{print $1}' || \ + err)" || err "pjhash: Can't read sha512 of '$xbtmp/project.hash'" [ "$pjhash" != "$old_pjhash" ] && badhash="y" [ -f "$XBMK_CACHE/hash/$project$tree" ] || badhash="y" From c46a71138c77556b103a4a5c85917d5bb5cc915a Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 30 Jun 2025 14:08:48 +0100 Subject: [PATCH 267/267] Libreboot 25.06 release Signed-off-by: Leah Rowe --- .../patches/0002-say-the-name-libreboot-in-the-grub-menu.patch | 2 +- .../patches/0002-say-the-name-libreboot-in-the-grub-menu.patch | 2 +- .../patches/0002-say-the-name-libreboot-in-the-grub-menu.patch | 2 +- .../0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch | 2 +- config/submodule/docs/html/module.cfg | 2 +- .../0007-Libreboot-branding-version-on-the-bootflow-menu.patch | 2 +- .../0005-Libreboot-branding-version-on-the-bootflow-menu.patch | 2 +- .../0005-Libreboot-branding-version-on-the-bootflow-menu.patch | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/grub/default/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch b/config/grub/default/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch index e32ba2ce..2e7e3fa1 100644 --- a/config/grub/default/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch +++ b/config/grub/default/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch @@ -16,7 +16,7 @@ index 04d058f55..b1cc8f236 100644 grub_term_cls (term); - msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); -+ msg_formatted = grub_xasprintf (_("Libreboot 25.04 Corny Calamity (GRUB menu): https://libreboot.org/")); ++ msg_formatted = grub_xasprintf (_("Libreboot 25.06 Luminous Lemon (GRUB menu): https://libreboot.org/")); if (!msg_formatted) return; diff --git a/config/grub/nvme/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch b/config/grub/nvme/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch index f49c8340..6afb2002 100644 --- a/config/grub/nvme/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch +++ b/config/grub/nvme/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch @@ -16,7 +16,7 @@ index 04d058f55..b1cc8f236 100644 grub_term_cls (term); - msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); -+ msg_formatted = grub_xasprintf (_("Libreboot 25.04 Corny Calamity (GRUB menu): https://libreboot.org/")); ++ msg_formatted = grub_xasprintf (_("Libreboot 25.06 Luminous Lemon (GRUB menu): https://libreboot.org/")); if (!msg_formatted) return; diff --git a/config/grub/xhci/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch b/config/grub/xhci/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch index 5818c2ed..608eef01 100644 --- a/config/grub/xhci/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch +++ b/config/grub/xhci/patches/0002-say-the-name-libreboot-in-the-grub-menu.patch @@ -16,7 +16,7 @@ index 04d058f55..b1cc8f236 100644 grub_term_cls (term); - msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION); -+ msg_formatted = grub_xasprintf (_("Libreboot 25.04 Corny Calamity (GRUB menu): https://libreboot.org/")); ++ msg_formatted = grub_xasprintf (_("Libreboot 25.06 Luminous Lemon (GRUB menu): https://libreboot.org/")); if (!msg_formatted) return; diff --git a/config/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch b/config/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch index acde7f20..c78d6660 100644 --- a/config/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch +++ b/config/seabios/default/patches/0003-Print-the-Libreboot-version-in-the-SeaBIOS-menu.patch @@ -17,7 +17,7 @@ index 538b316d..9eed0b12 100644 // Write to screen. - printf("SeaBIOS (version %s)\n", VERSION); -+ printf("Libreboot 25.04 Corny Calamity (SeaBIOS menu): https://libreboot.org/\n"); ++ printf("Libreboot 25.06 Luminous Lemon (SeaBIOS menu): https://libreboot.org/\n"); display_uuid(); } diff --git a/config/submodule/docs/html/module.cfg b/config/submodule/docs/html/module.cfg index 58bec732..e18b2fe4 100644 --- a/config/submodule/docs/html/module.cfg +++ b/config/submodule/docs/html/module.cfg @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -subhash="47c993cba483ff23a4c7b866c6cedcc905e9a2bd" +subhash="2fc8efd375aef58d6c5d6b8e4ffe87b3bd2ff3d4" subgit="https://codeberg.org/libreboot/lbwww" subgit_bkup="https://git.disroot.org/libreboot/lbwww" diff --git a/config/u-boot/default/patches/0007-Libreboot-branding-version-on-the-bootflow-menu.patch b/config/u-boot/default/patches/0007-Libreboot-branding-version-on-the-bootflow-menu.patch index 754e2162..8a09fa7d 100644 --- a/config/u-boot/default/patches/0007-Libreboot-branding-version-on-the-bootflow-menu.patch +++ b/config/u-boot/default/patches/0007-Libreboot-branding-version-on-the-bootflow-menu.patch @@ -18,7 +18,7 @@ index 84831915a2..8e26ec2aef 100644 ret |= scene_obj_set_pos(scn, OBJ_MENU, MARGIN_LEFT, 100); ret |= scene_txt_str(scn, "title", OBJ_MENU_TITLE, STR_MENU_TITLE, - "U-Boot - Boot Menu", NULL); -+ "Libreboot 25.04 Corny Calamity (U-Boot menu): https://libreboot.org/", NULL); ++ "Libreboot 25.06 Luminous Lemon (U-Boot menu): https://libreboot.org/", NULL); ret |= scene_menu_set_title(scn, OBJ_MENU, OBJ_PROMPT); logo = video_get_u_boot_logo(); diff --git a/config/u-boot/x86/patches/0005-Libreboot-branding-version-on-the-bootflow-menu.patch b/config/u-boot/x86/patches/0005-Libreboot-branding-version-on-the-bootflow-menu.patch index 754e2162..8a09fa7d 100644 --- a/config/u-boot/x86/patches/0005-Libreboot-branding-version-on-the-bootflow-menu.patch +++ b/config/u-boot/x86/patches/0005-Libreboot-branding-version-on-the-bootflow-menu.patch @@ -18,7 +18,7 @@ index 84831915a2..8e26ec2aef 100644 ret |= scene_obj_set_pos(scn, OBJ_MENU, MARGIN_LEFT, 100); ret |= scene_txt_str(scn, "title", OBJ_MENU_TITLE, STR_MENU_TITLE, - "U-Boot - Boot Menu", NULL); -+ "Libreboot 25.04 Corny Calamity (U-Boot menu): https://libreboot.org/", NULL); ++ "Libreboot 25.06 Luminous Lemon (U-Boot menu): https://libreboot.org/", NULL); ret |= scene_menu_set_title(scn, OBJ_MENU, OBJ_PROMPT); logo = video_get_u_boot_logo(); diff --git a/config/u-boot/x86_64/patches/0005-Libreboot-branding-version-on-the-bootflow-menu.patch b/config/u-boot/x86_64/patches/0005-Libreboot-branding-version-on-the-bootflow-menu.patch index 754e2162..8a09fa7d 100644 --- a/config/u-boot/x86_64/patches/0005-Libreboot-branding-version-on-the-bootflow-menu.patch +++ b/config/u-boot/x86_64/patches/0005-Libreboot-branding-version-on-the-bootflow-menu.patch @@ -18,7 +18,7 @@ index 84831915a2..8e26ec2aef 100644 ret |= scene_obj_set_pos(scn, OBJ_MENU, MARGIN_LEFT, 100); ret |= scene_txt_str(scn, "title", OBJ_MENU_TITLE, STR_MENU_TITLE, - "U-Boot - Boot Menu", NULL); -+ "Libreboot 25.04 Corny Calamity (U-Boot menu): https://libreboot.org/", NULL); ++ "Libreboot 25.06 Luminous Lemon (U-Boot menu): https://libreboot.org/", NULL); ret |= scene_menu_set_title(scn, OBJ_MENU, OBJ_PROMPT); logo = video_get_u_boot_logo();