Why does running some "make" commands end up calling menuconfig interactively?

I regularly rebuild openwrt from master, and i have a (podman) container-based script that are based on the regular openwrt-build-system procedure. And before doing any of the feed related stuff, i run a 'make clean'...

The issue is that each time 'make clean' runs, it seems to always hop into the "OpenWrt Configuration" interactive (menuconfig-like) system, and i have to exit and confirm i want to save .confg.

I've tried to pre-stage a .config file before running make clean, but doesn't seem to keep it from becoming interactive?

Is there a way or am i missing some way to make this part of the build entirely non-interactive so i can avoid having to remember to exit the configurator menu and save .config ??

I can't reproduce this, I only get this output:

~/openwrt$ make clean
 make[1] clean
~/openwrt$

I would double-check these scripts, they may be based on the regular buildroot procedure but they're not the ones OpenWrt uses.

2 Likes

but is that perhaps an already clean buildroot (freshly git-cloned openwrt repo) you're using there? Or did you have an existing build you had already done (as in my case)?

Here's what i see:

INFO: cleaning up existing git repo..
Collecting target info: done
make[1]: Entering directory '/home/user/workdir/openwrt'
make[2]: Entering directory '/home/user/workdir/openwrt/scripts/config'
set -e; mkdir -p ./; trap "rm -f ./.mconf-cfg.tmp" EXIT; { /bin/sh mconf-cfg.sh; } > ./.mconf-cfg.tmp; if [ ! -r mconf-cfg ] || ! cmp -s mconf-cfg ./.mconf-cfg.tmp; then true '  UPD     mconf-cfg'; mv -f ./.mconf-cfg.tmp mconf-cfg; fi
make[2]: Leaving directory '/home/user/workdir/openwrt/scripts/config'

 .config - OpenWrt Configuration                                                                                                                                                                                    
 ā”€                                                                                                                                                                                                                  
   
[... here i have to interact and exit/save...]
                                                                                                                                                                                                                    
                    ā”Œā”€ā”                                                                                                                                     
                    ā”‚  Do you wish to save your new configuration?             ā”‚                                                                            
                    ā”‚  (Press <ESC><ESC> to continue kernel configuration.)    ā”‚                                                                            
                    ā”œā”€ā”¤                                                                                                                                     
                    ā”‚ d  --->           < Yes >      <  No  >                  ā”‚                                                                            
                    ā””ā”€ā”˜                                                                                                                                     
                                                                                                                                                                                                                    
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

make[1]: Leaving directory '/home/user/workdir/openwrt'
 make[1] clean
 make[1] clean               

the first line is just the script echoing what step we're up to, and then only running make clean

my entrypoint script is mainly just loading patches and calling the different make commands based on what is in the online procedures..


tl;dr - there's gotta be some step or pre-condition i'm missing/not meeting here, when i am starting over to rebuild, meaning an already build a fw-image from master is present, that would prevent this from having to be interactive..

No, I've done this multiple times on existing builds while adding support to UniFi U6+. This is the first time I've heard make clean producing an interactive prompt.

This might mean your .config file is being deleted here. I haven't looked at your scripts yet, but I would check what's going on at and before this step.

That output can be examine in the script as it's available on github here (now i can't expect you to help me troubleshoot my script, but posting more in case you wanted to have a look for yourself)

As far as i can tell, what i've attempted (to prevent this menuconfig-like interactivity) is pre-stage the .config file before running make clean (thinking maybe the lack of the .config file is what caused it to go into interactive mode - but that didn't help.. i even verified a .config file exists before make clean is ran with a (non-committed test) execution of the ls -l .config command right before make clean is ran)..

So i enabled bash debugging so you can see exactly which commands are run, in what order..

Here's what it looks like:

$ ./build.sh
Building image for release: 20230925-00
+ cd /home/user/workdir
+ [[ -n start ]]
+ [[ start != \s\t\a\r\t ]]
+ [[ -d openwrt ]]
+ cd /home/user/workdir/openwrt
+ echo 'INFO: rewinding openwrt git repo and updating master branch..'
INFO: rewinding openwrt git repo and updating master branch..
+ git am --abort
+ git reset --hard origin/master
HEAD is now at 86dadeba48 generic: add patch for GPON-ONU-34-20BI quirk
+ git pull
Already up to date.
+ echo

+ [[ -n 20230925-00 ]]
+ echo 'INFO: will build the following release: 20230925-00'
INFO: will build the following release: 20230925-00
++ awk -F- '{print $NF}' ../../upstream/20230925-00/version.buildinfo
+ VERSION_COMMIT=74e7f8ebbd
+ echo

+ echo 'INFO: rewinding git repo to release'\''s commit: 74e7f8ebbd'
INFO: rewinding git repo to release's commit: 74e7f8ebbd
+ git reset --hard 74e7f8ebbd
HEAD is now at 74e7f8ebbd ipq40xx: add support for Extreme Networks WS-AP391x series APs
+ echo

+ touch .config
+ git add -f .config
+ git commit -mfoo
[master 95b2988924] foo
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 .config
+ echo 'INFO: cleaning up existing git repo..'
INFO: cleaning up existing git repo..
+ make clean
Collecting package info: done
Collecting target info: done
make[1]: Entering directory '/home/user/workdir/openwrt'
make[2]: Entering directory '/home/user/workdir/openwrt/scripts/config'
set -e; mkdir -p ./; trap "rm -f ./.mconf-cfg.tmp" EXIT; { /bin/sh mconf-cfg.sh; } > ./.mconf-cfg.tmp; if [ ! -r mconf-cfg ] || ! cmp -s mconf-cfg ./.mconf-cfg.tmp; then true '  UPD     mconf-cfg'; mv -f ./.mconf-cfg.tmp mconf-cfg; fi
make[2]: Leaving directory '/home/user/workdir/openwrt/scripts/config'

 .config - OpenWrt Configuration                                                                                                                                                                                                                                                   
 ā”€                                                    

[... INTERACTIVE MENUCONFIG CONFIGURATOR RUNNING HERE... ARG HAVE TO MANUALLY EXIT/SAVE!... ]

                    ā”Œā”€ā”                                                                              
                    ā”‚  Do you wish to save your new configuration?             ā”‚                     
                    ā”‚  (Press <ESC><ESC> to continue kernel configuration.)    ā”‚                     
                    ā”œā”€ā”¤                                                                              
                    ā”‚ -->               < Yes >      <  No  >                  ā”‚                     
                    ā””ā”€ā”˜                                                                              
                                                                                                     
                                                                                                     
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

make[1]: Leaving directory '/home/user/workdir/openwrt'
 make[1] clean
 make[1] clean
+ echo

+ echo 'INFO: loading feeds commits configuration'
INFO: loading feeds commits configuration
+ cp ../../upstream/20230925-00/feeds.buildinfo feeds.conf
+ echo

+ echo 'INFO: updating feeds..'
INFO: updating feeds..
+ ./scripts/feeds update -a -f
Updating feed 'packages' from 'https://git.openwrt.org/feed/packages.git^b738e42c4' ...
Updating feed 'luci' from 'https://git.openwrt.org/project/luci.git^2a09ea0003' ...
Updating feed 'routing' from 'https://git.openwrt.org/feed/routing.git^88c98c9' ...
Updating feed 'telephony' from 'https://git.openwrt.org/feed/telephony.git^4ccdae6' ...
Create index file './feeds/packages.index' 
[...]

can't believe i'm the only one experiencing this?

As stated above, appears the .config is not in existence

2 Likes

Tried again, this time with an explicit touch .config and even a git commit right before make clean:

Building image for release: 20230925-00
+ cd /home/user/workdir
+ [[ -n start ]]
+ [[ start != \s\t\a\r\t ]]
+ [[ -d openwrt ]]
+ cd /home/user/workdir/openwrt
+ echo 'INFO: rewinding openwrt git repo and updating master branch..'
INFO: rewinding openwrt git repo and updating master branch..
+ git am --abort
+ git reset --hard origin/master
HEAD is now at 86dadeba48 generic: add patch for GPON-ONU-34-20BI quirk
+ git pull
Already up to date.
+ echo

+ [[ -n 20230925-00 ]]
+ echo 'INFO: will build the following release: 20230925-00'
INFO: will build the following release: 20230925-00
++ awk -F- '{print $NF}' ../../upstream/20230925-00/version.buildinfo
+ VERSION_COMMIT=74e7f8ebbd
+ echo

+ echo 'INFO: rewinding git repo to release'\''s commit: 74e7f8ebbd'
INFO: rewinding git repo to release's commit: 74e7f8ebbd
+ git reset --hard 74e7f8ebbd
HEAD is now at 74e7f8ebbd ipq40xx: add support for Extreme Networks WS-AP391x series APs
+ echo

+ touch .config
+ git add -f .config
+ git commit -mfoo
[master 95b2988924] foo
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 .config
+ echo 'INFO: cleaning up existing git repo..'
INFO: cleaning up existing git repo..
+ make clean
Collecting package info: done
Collecting target info: done
make[1]: Entering directory '/home/user/workdir/openwrt'
make[2]: Entering directory '/home/user/workdir/openwrt/scripts/config'
set -e; mkdir -p ./; trap "rm -f ./.mconf-cfg.tmp" EXIT; { /bin/sh mconf-cfg.sh; } > ./.mconf-cfg.tmp; if [ ! -r mconf-cfg ] || ! cmp -s mconf-cfg ./.mconf-cfg.tmp; then true '  UPD     mconf-cfg'; mv -f ./.mconf-cfg.tmp mconf-cfg; fi
make[2]: Leaving directory '/home/user/workdir/openwrt/scripts/config'

 .config - OpenWrt Configuration                                                                                                                                                                                    
      ā”Œā”€ā”                                                                              
                    ā”‚  Do you wish to save your new configuration?             ā”‚                     
                    ā”‚  (Press <ESC><ESC> to continue kernel configuration.)    ā”‚                     
                    ā”œā”€ā”¤                                                                              
                    ā”‚ -->               < Yes >      <  No  >                  ā”‚                     
                    ā””ā”€ā”˜                                                                              
                                                                                                     
                                                                                                     
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

make[1]: Leaving directory '/home/user/workdir/openwrt'
 make[1] clean
 make[1] clean
+ echo

+ echo 'INFO: loading feeds commits configuration'
INFO: loading feeds commits configuration
+ cp ../../upstream/20230925-00/feeds.buildinfo feeds.conf
+ echo

+ echo 'INFO: updating feeds..'
INFO: updating feeds..
+ ./scripts/feeds update -a -f
Updating feed 'packages' from 'https://git.openwrt.org/feed/packages.git^b738e42c4' ...
Updating feed 'luci' from 'https://git.openwrt.org/project/luci.git^2a09ea0003' ...
Updating feed 'routing' from 'https://git.openwrt.org/feed/routing.git^88c98c9' ...
Updating feed 'telephony' from 'https://git.openwrt.org/feed/telephony.git^4ccdae6' ...
Create index file './feeds/packages.index'
[...]

Interestingly, i've gotten this same menuconfig to pop up a 2nd time now, when later in the process i re-patch the .config right before doing the make download

+ echo 'INFO: loading release base config..'
INFO: loading release base config..
+ cp ../../upstream/20230925-00/config.buildinfo .config
+ echo

+ echo 'INFO: patching base config..'
INFO: patching base config..
+ git add -f .config
+ git commit '-mstage config file'
[master 7963f5b793] stage config file
 1 file changed, 485 insertions(+)
 create mode 100644 .config
+ git am --whitespace=nowarn ../../custom/0001-trimmed-down-DivestedWRT-config.buildinfo.patch
Applying: trimmed down DivestedWRT config.buildinfo
+ [[ 0 -ne 0 ]]
+ echo

+ echo 'INFO: downloading necessary files..'
INFO: downloading necessary files..
+ make download -j4
Collecting package info: done
Collecting target info: done
make[1]: Entering directory '/home/user/workdir/openwrt'
make[2]: Entering directory '/home/user/workdir/openwrt/scripts/config'
set -e; mkdir -p ./; trap "rm -f ./.mconf-cfg.tmp" EXIT; { /bin/sh mconf-cfg.sh; } > ./.mconf-cfg.tmp; if [ ! -r mconf-cfg ] || ! cmp -s mconf-cfg ./.mconf-cfg.tmp; then true '  UPD     mconf-cfg'; mv -f ./.mconf-cfg.tmp mconf-cfg; fi
make[2]: Leaving directory '/home/user/workdir/openwrt/scripts/config'


 .config - OpenWrt Configuration                                                                                                                                                                                    
                                                                            ā”‚  Do you wish to save your new configuration?             ā”‚                                                                            
                                                                            ā”‚  (Press <ESC><ESC> to continue kernel configuration.)    ā”‚                                                                            
                                                                            ā”œā”€ā”¤                                                                                                                                     
                                                                            ā”‚ d  --->           < Yes >      <  No  >                  ā”‚                                                                            
                                                                            ā””ā”€ā”˜                                                                                                                                     
                                                                                                                                                                                                                    
configuration written to .config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

make[1]: Leaving directory '/home/user/workdir/openwrt'
 make[1] tools/download
 make[1] tools/download
 make[2] -C tools/autoconf download
...

So it seems it's not something exclusive to make clean afterall.. my Makefile-foo is not strong so i'm hoping some one more familiar could explain the log when it decides to go into the make menuconfig..

So what is it about the .config file exactly?? It isn't only its mere existence, because i have explictly tried to create it right before the menuconfig pops up anyway, with simple touch or cp commands..

Are you saving a configdiff and restoring:

./scripts/diffconfig.sh > configdiffx
...
cp configdiffx .config
make defconfig && make oldconfig

wise to set diffs aside as you work through additions / changes...

see the wiki

No, i'm not touching any of those tools, i'm only creating/modifying/patching the .confg file directly and the only config-ish utility i'm using is make defconfig near the very end..

i track changes to the changes in git-am compatible patches rather than make explicit config-diffs.. i don't quite understand how would these commands (scritps/diffconfig.sh or make oldconfig) would help me make a step non-interactive (not cause menuconfig to pop up)?

I have an existing .config file (really a config.buildinfo file that has the same stuff.. i copy it to the build-root, commit it, then use a git-am patch on it provided by the maintainer of a specific openwrt build flavor, then use another git-am patch on that which has my customizations of their build.. before i started doing make clean, this worked fine and was never interactive, so i originally suspected something about make clean "acting up" (and by acting up, i mean my understanding of the internals of the build workflow is obviously incomplete).

i only end up calling make defconfig right before the final make step. Do i need to use things like defconfig (or the other commands) earlier?

It just seems that whatever you have as a .config file ain't right, so I would check that outside of running it in your build script. At least that is how at appears from an outside POV. But I would suggest it is self inflicted, or to point, make clean is not the culprit, make dirclean does not even remove a .config, not sure about make distclean.

Not a bash user, but I noticed your script has made two calls to make clean when you escape out of your script anomaly. The script is linear. It runs top to bottom based on conditionals.

Only two make calls in the script use the $* variable which I am not at all familiar with. All the other calls to make define the specific call to make.

that part i had already suspected :slight_smile: it was more about the WHY isn't it right? What does the make system check with the .config exactly, which condition isn't being met, which causes it to defer to going into menuconfig?

i only see one, on line 64... where's the other one you're seeing?

This is a shell variable which globs all the params passed to the shell script.. so rather than type $1 $2 $3, i can use $* to include all of them. The script here in this case, is the entrypoint script to the containerized build environment.. When called from a container starting, normally is passed with a start parameter in $1, but you can pass it an explicit set of params, so i set it up if you have a compilation failure, you'd just want to skip to the final make and then you can specify V=sc -j1 or whatever, there $* will expand to those params in one go.

Ok i figured out what "right" actually looks like then.. or rather, how to make it right:

make defconfig needs to be run before any make command if i have a trimmed (incomplete) .config file, then that step (or others) no longer throw me into the interactive menuconfig..

1 Like

stdout

make[1] clean
make[1] clean 

I know what it does, Iā€™m not familiar with its usage. I only use posix shells.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.