Message ID | 4d6023634c5d97694e75b460b39c25e44642c4d3.1689759351.git.falcon@tinylab.org |
---|---|
State | New |
Headers | show |
Series | selftests/nolibc: add minimal kernel config support - part1 | expand |
On Wed, Jul 19, 2023 at 09:26:01PM +0800, Zhangjin Wu wrote: > To avoid run targets one by one manually and boringly, let's string them > with IMAGE and .config, the MAKE command will trigger the dependencies > for us. > > Note, to allow do menuconfig before extconfig manually, only trigger > defconfig while the .config is not there, it means only trigger > defconfig for the first run or after a mrproper. > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > --- > tools/testing/selftests/nolibc/Makefile | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > index 83cb4b017bef..541f3565e584 100644 > --- a/tools/testing/selftests/nolibc/Makefile > +++ b/tools/testing/selftests/nolibc/Makefile (...) > -extconfig: > +extconfig: $(KERNEL_CONFIG) > $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(objtree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) > $(Q)$(MAKE_KERNEL) KCONFIG_ALLCONFIG="$(KERNEL_CONFIG)" allnoconfig > > -kernel: initramfs > +kernel: extconfig > + $(Q)$(MAKE) --no-print-directory initramfs There seems to be something wrong here. From what I'm seeing, now if I run "make kernel" it will run extconfig and possibly change the config I just edited. Or am I missing something ? I must confess all of this is becoming more and more obscure :-( Willy
> On Wed, Jul 19, 2023 at 09:26:01PM +0800, Zhangjin Wu wrote: > > To avoid run targets one by one manually and boringly, let's string them > > with IMAGE and .config, the MAKE command will trigger the dependencies > > for us. > > > > Note, to allow do menuconfig before extconfig manually, only trigger > > defconfig while the .config is not there, it means only trigger > > defconfig for the first run or after a mrproper. > > > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > > --- > > tools/testing/selftests/nolibc/Makefile | 18 +++++++++++++----- > > 1 file changed, 13 insertions(+), 5 deletions(-) > > > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > > index 83cb4b017bef..541f3565e584 100644 > > --- a/tools/testing/selftests/nolibc/Makefile > > +++ b/tools/testing/selftests/nolibc/Makefile > (...) > > -extconfig: > > +extconfig: $(KERNEL_CONFIG) > > $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(objtree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) > > $(Q)$(MAKE_KERNEL) KCONFIG_ALLCONFIG="$(KERNEL_CONFIG)" allnoconfig > > > > -kernel: initramfs > > +kernel: extconfig > > + $(Q)$(MAKE) --no-print-directory initramfs > > There seems to be something wrong here. From what I'm seeing, now if I > run "make kernel" it will run extconfig and possibly change the config > I just edited. > Yeah, extconfig will run for every 'make kernel', it is ok for us to let kernel depends on $(KERNEL_CONFIG), but this requires users to run extconfig explictly, the solution may be: - move extconfig operations to defconfig target and future tinyconfig target (it looks cleaner ...) - but it is not convenient to trigger additional changes introduced by extconfig, not necessary, but really helpful, something like 'menuconfig' - let users run extconfig manually after a defconfig or tinyconfig (it is a little complex) - this make users hard to learn what to do, should give up this method - run extconfig for every 'make kernel' as it currently do - this may change something after a menuconfig, but it only trigger minimal required options, the 'hurt' should be minimal, but of course, it may confuse sometimes ;-( As a summary, let's remove 'extconfig' and move its operations to the defconfig and the future tinyconfig targets? 'extconfig' should be a 'default' config action, let users apply additional ones manually from the top-level 'make menuconfig', what's your idea? > Or am I missing something ? I must confess all of this is becoming more > and more obscure :-( Yeah ... let's find a better solution ;-) Best regards, Zhangjin > > Willy
diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 83cb4b017bef..541f3565e584 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -150,6 +150,7 @@ all: run sysroot: sysroot/$(ARCH)/include +PHONY = sysroot/$(ARCH)/include sysroot/$(ARCH)/include: $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot $(QUIET_MKDIR)mkdir -p sysroot @@ -205,21 +206,28 @@ mrproper: defconfig: $(Q)$(MAKE_KERNEL) $(DEFCONFIG) prepare -menuconfig: +PHONY += $(KERNEL_CONFIG) +$(KERNEL_CONFIG): + $(Q)if [ ! -f "$(KERNEL_CONFIG)" ]; then $(MAKE) --no-print-directory defconfig; fi + +menuconfig: $(KERNEL_CONFIG) $(Q)$(MAKE_KERNEL) menuconfig -extconfig: +extconfig: $(KERNEL_CONFIG) $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(objtree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) $(Q)$(MAKE_KERNEL) KCONFIG_ALLCONFIG="$(KERNEL_CONFIG)" allnoconfig -kernel: initramfs +kernel: extconfig + $(Q)$(MAKE) --no-print-directory initramfs $(Q)$(MAKE_KERNEL) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs # common macros for qemu run/rerun targets QEMU_SYSTEM_RUN = qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(KERNEL_IMAGE)" -serial stdio $(QEMU_ARGS) # run the tests after building the kernel -run: kernel +PHONY += $(KERNEL_IMAGE) +$(KERNEL_IMAGE): kernel +run: $(KERNEL_IMAGE) $(Q)$(QEMU_SYSTEM_RUN) $(LOG_OUT) $(Q)$(REPORT_RUN_OUT) @@ -244,4 +252,4 @@ clean: $(call QUIET_CLEAN, run.out) $(Q)rm -rf run.out -.PHONY: sysroot/$(ARCH)/include +.PHONY: $(PHONY)
To avoid run targets one by one manually and boringly, let's string them with IMAGE and .config, the MAKE command will trigger the dependencies for us. Note, to allow do menuconfig before extconfig manually, only trigger defconfig while the .config is not there, it means only trigger defconfig for the first run or after a mrproper. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> --- tools/testing/selftests/nolibc/Makefile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)