From 4f562fd273e9039d5f8d6f00ade829d47fe809f8 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sun, 20 Sep 2026 22:35:20 +0100 Subject: mk: skip *coreboot* same target/tree builds this implements the previous reverted fix, but only for coreboot. it's done tree-wide, but individual projects must handle it in their mkhelpers, via if_not_skip_build if_not_skip_build *does* universally control whether make is executed, but not make-clean. now we can do: ./mk -b coreboot default this will effectively do the same thing as -d, because no config is available there. otherwise, we try to do -b with a config, where none exists. if noconfig is set, then we ignore this, because no config will ever be used. when noconfig isn't set, it is assumed that we must always have a config for building. Signed-off-by: Leah Rowe --- include/fw/rom.sh | 20 ++++++++++---------- mk | 16 ++++++++++++---- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/include/fw/rom.sh b/include/fw/rom.sh index dc7ccd6f..cfd332a0 100644 --- a/include/fw/rom.sh +++ b/include/fw/rom.sh @@ -102,7 +102,7 @@ coreboot_pad_one_byte() [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \ return 0 - pad_one_byte "$srcdir/build/coreboot.rom" + $if_not_skip_build pad_one_byte "$srcdir/build/coreboot.rom" } mkcorebootbin() @@ -112,10 +112,10 @@ mkcorebootbin() for y in "$defscan"/*; do buildcfg="$y" - mkcorebootbin_real + $if_not_skip_build mkcorebootbin_real done - mkcoreboottar + $if_not_skip_build mkcoreboottar } mkcorebootbin_real() @@ -142,8 +142,8 @@ mkcorebootbin_real() elfrom="${elfrom}_$displaymode" elfrom="$elfrom/coreboot.rom" - x_ cp "$elfrom" "$tmprom" - unpad_one_byte "$tmprom" + $if_not_skip_build x_ cp "$elfrom" "$tmprom" + $if_not_skip_build unpad_one_byte "$tmprom" [ -n "$payload_uboot" ] && [ "$payload_uboot" != "amd64" ] && \ [ "$payload_uboot" != "i386" ] && [ "$payload_uboot" != "arm64" ] \ @@ -178,21 +178,21 @@ mkcorebootbin_real() payload_grubsea="n" [ -f "$cbfscfg" ] && \ - dx_ add_cbfs_option "$cbfscfg" + $if_not_skip_build dx_ add_cbfs_option "$cbfscfg" if grep "CONFIG_PAYLOAD_NONE=y" "$buildcfg"; then if [ "$payload_seabios" = "y" ]; then pname="seabios" - add_seabios + $if_not_skip_build add_seabios fi if [ "$payload_uboot" = "arm64" ]; then pname="uboot" - add_uboot "" fallback/payload default \ - "$target" u-boot.elf + $if_not_skip_build add_uboot "" fallback/payload \ + default "$target" u-boot.elf fi else pname="custom" - cprom + $if_not_skip_build cprom fi; : } diff --git a/mk b/mk index ba07398c..80f48c2a 100755 --- a/mk +++ b/mk @@ -88,7 +88,8 @@ eval "`newvar if_not_make_config if_not_build if_not_dry_build if_not_fetch`" # these variables will also be initialised in configure_target cfgvars="autogenargs cmakedir configureargs badhash badtghash bootstrapargs \ build_depend cleanargs fetch_depend makeargs mkhelper noconfig postmake \ - premake release rev tree xarch xgcctree xlang cfgname defscan" + premake release rev tree xarch xgcctree xlang cfgname defscan \ + if_not_skip_build" eval "`newvar buildcfg dest_dir elfdir flag forcepull listfile mdir \ mkhelpercfg mode project srcdir target target_dir _tcfg \ @@ -234,6 +235,13 @@ configure_target() # filename in srcdir when copying e.g. coreboot defconfig -> .config [ -z "$cfgname" ] && cfgname="$cfgname_default" # e.g. $srcdir/.config + # if noconfig isn't set, there needs to be a config dir in xbmk. + # coreboot needs a .config or it will behave unpredictably. we will + # use the do_build macro to disable builds in this situation. this + # does not disable mkhelpers or dry builds. + [ ! -d "$target_dir/config" ] && [ "$noconfig" != "y" ] && \ + if_not_skip_build=":" # skip make on e.g. ./mk -b coreboot default + [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \ return 1 @@ -300,7 +308,7 @@ handle_buildcfg() handle_makefile # also supports non-build operations - $if_build $if_not_dry_build \ + $if_build $if_not_dry_build $if_not_skip_build \ copy_elf; : done; : } @@ -359,7 +367,7 @@ handle_makefile() $if_build \ x_ $premake - $if_not_dry_build \ + $if_not_skip_build $if_not_dry_build \ run_make_command $if_build \ x_ $mkhelper; : @@ -368,7 +376,7 @@ handle_makefile() [ "$mode" = "savedefconfig" ] && \ _copy="defconfig" - $if_make_config \ + $if_make_config $if_not_skip_build \ x_ cp "$srcdir/$_copy" "$buildcfg"; : } -- cgit v1.2.1