summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-12-02 20:37:26 +0000
committerLeah Rowe <leah@libreboot.org>2024-12-02 20:41:05 +0000
commit5b4c9158e5a79f8d7e776c8c4ece69dda5aa8690 (patch)
tree76906ab132b97d962177c479e4994b0fe8b92bfd
parentb95a411a3645b72036101aaa8f8ad28758eefd15 (diff)
trees: Allow using a custom clean command
On coreboot for example, as Mate has told me, if you're making Kconfig changes and re-compiling, sometimes the actual image that you build might still have the old one in it, due to how coreboot's build system works. To mitigate this, you can just always run distclean before doing the build, but lbmk was doing just clean. In practise, we did not find any issues, but this change should be harmless, and might prevent such issues in the future. It's even possible that we might have already encountered this before and not realised, and we were just lucky that no noticeable issues were caused. It's *also* possible that the reverse is true: an issue that was previously covered up, then that issue will now be exposed. However, if that turns out to be true, then that is good because we are exposing said bugs and then we will know to fix them! Anyway, the variable in target.cfg is: cleancmd="whatever_you_want" e.g. cleancmd="distclean" You may also specify this in global mkhelper.cfg files, per project; I've already done this for SeaBIOS, coreboot and U-Boot, since all of these use Kconfig files. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--config/data/coreboot/mkhelper.cfg1
-rw-r--r--config/data/seabios/mkhelper.cfg1
-rw-r--r--config/data/u-boot/mkhelper.cfg1
-rwxr-xr-xscript/trees10
4 files changed, 10 insertions, 3 deletions
diff --git a/config/data/coreboot/mkhelper.cfg b/config/data/coreboot/mkhelper.cfg
index a218e0e7..8d892fc4 100644
--- a/config/data/coreboot/mkhelper.cfg
+++ b/config/data/coreboot/mkhelper.cfg
@@ -2,6 +2,7 @@
makeargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
build_depend="seabios/default grub/default memtest86plus u-boot/amd64coreboot"
+cleancmd="distclean"
seavgabiosrom="elf/seabios/default/libgfxinit/vgabios.bin"
diff --git a/config/data/seabios/mkhelper.cfg b/config/data/seabios/mkhelper.cfg
index e69de29b..86c74456 100644
--- a/config/data/seabios/mkhelper.cfg
+++ b/config/data/seabios/mkhelper.cfg
@@ -0,0 +1 @@
+cleancmd="distclean"
diff --git a/config/data/u-boot/mkhelper.cfg b/config/data/u-boot/mkhelper.cfg
new file mode 100644
index 00000000..86c74456
--- /dev/null
+++ b/config/data/u-boot/mkhelper.cfg
@@ -0,0 +1 @@
+cleancmd="distclean"
diff --git a/script/trees b/script/trees
index 698d2b34..b40c00db 100755
--- a/script/trees
+++ b/script/trees
@@ -14,7 +14,8 @@ XBMKPATH="$PATH"
eval `setvars "" xarch srcdir premake cmakedir xlang mode makeargs elfdir cmd \
project target target_dir targets xtree _f release bootstrapargs mkhelper \
autoconfargs listfile autogenargs btype tree rev tree_depend build_depend \
- defconfig postmake mkhelpercfg dry dest_dir mdir cleanargs`; badhash="n"
+ defconfig postmake mkhelpercfg dry dest_dir mdir cleanargs cleancmd`
+badhash="n"
main()
{
@@ -116,7 +117,7 @@ configure_project()
{
eval `setvars "" xarch xlang build_depend autoconfargs xtree postmake \
tree_depend makeargs btype mkhelper bootstrapargs premake release \
- cleanargs`
+ cleanargs cleancmd`
_tcfg="$1/target.cfg"; badhash="n"; [ -f "$_tcfg" ] || btype="auto"
[ -f "$datadir/mkhelper.cfg" ] && eval `setcfg "$datadir/mkhelper.cfg"`
@@ -231,7 +232,10 @@ elfcheck()
handle_makefile()
{
- $dry check_makefile "$srcdir" && x_ make -C "$srcdir" $cleanargs clean
+ _cleancmd="clean"
+ [ -n "$cleancmd" ] && _cleancmd="$cleancmd"
+ $dry check_makefile "$srcdir" && \
+ x_ make -C "$srcdir" $cleanargs $_cleancmd
[ -f "$defconfig" ] && x_ cp "$defconfig" "$srcdir/.config"
[ -n "$mode" ] || [ -n "$btype" ] || $dry make -C \
"$srcdir" silentoldconfig || make -C "$srcdir" oldconfig || :