The build system automagically enables packages that are disabled on purpose?

Hi there,

I'm trying to build OpenWrt 23.05.2 with modifications, saved the .config file in a stripped way by running sed '/^[[:space:]]*#.*/ d; /^[[:space:]]*$/ d' .config > <my saved config file>. If I want to reuse that file the build system automagically enables packages even if I want to replace that package, in my case enables automagically and silently dnsmasq although I selected dnsmasq-full and logd although I selected syslog-ng. It's not amusing to get after 7 hours of build time data_file_clashes from bundling the binary 'cause I have to run the build on only one core and start with an as clean as possible environment, on multi-core build it throws a *** [tools/Makefile:222: /home/devuan/openwrt-kirkwood/staging_dir/host/stamp/.tools_compile_yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy] Error 2 after installing cmake-3.26.4 due to modified options, I haven't found out which one is responsible yet, without -j "$(("$(nproc)"+1))" it's building fine.

Although I think it doesn't matter here is my whole build process:

git clone https://git.openwrt.org/openwrt/openwrt.git "$OpenWrtRoot"/OpenWrt-Master
# git pull # if needed
git checkout v23.05.2
./scripts/feeds update -a
./scripts/feeds install -a

Now I got out of that directory and left it alone, and did as the same average user in my home directory:

OpenWrtRoot=/home/devuan/OpenWrt
Arch='-kirkwood'
BuildDate="$(date +%d.%m.%y-%H:%M)"
export WhichOpenWrt="openwrt$Arch"
export OpenWrtBuildLogDir="$PWD/${WhichOpenWrt}_build-log_$BuildDate"
mkdir -p "$PWD/$WhichOpenWrt/readwrite" "$PWD/$WhichOpenWrt/work" "$OpenWrtBuildLogDir"
sudo mount -t overlay overlay -o lowerdir="$OpenWrtRoot/OpenWrt-Master",upperdir="$PWD/$WhichOpenWrt/readwrite",workdir="$PWD/$WhichOpenWrt/work" "$PWD/$WhichOpenWrt"
cd "$WhichOpenWrt"
if [ ! -h dl -o ! -d dl ]; then ln -s "$OpenWrtRoot/Sources" dl; fi
cp "$OpenWrtRoot/config$Arch"-<my saved one> .config
make menuconfig
script -a "$OpenWrtBuildLogDir/buildscreen-output.log" -c 'make -j"$(("$(nproc)"+1))" V=s defconfig download clean world 2>&1 | tee -a "$OpenWrtBuildLogDir/build.log"

'Cause I wanna save some disk space the overlay mount, just copy or better tar / untar works the same, and 'cause I had trouble in the past with some build due to a not perfectly clean environment just redoing the mount gives me an as definite as possible build environment without having to redownload anything, that's why I'm doing it that way.

'Cause I have already configured that build properly and know ('cause I ran into that trap yesterday) that the config was in the above mentioned particular point correct I just copied it at the second build and just altered that step I wanna test out if it also builds (Yesterday without SE-Linux worked after I disabled dnsmasq and logd, today just enabled SE-Linux in that particular working prooved .config file and they both were automagically enabled again - which I noticed after building by running into that clashes...)

Is the .config file parsed partial in reverse so that some lines # <xxx> is not set are crucial? If so which one?

Hope you get puzzled out my stammering...

Best regards
Peter

PS: I can't copy the mentioned .config file here to a text box due to character limits, how to attach it directly as a file if you wanna have it?

Cut with the grain

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

you're getting bit by dependencies unaccounted for my your methodology.

You can post a link from

cat .config | nc termbin.com 9999

... and read the documentation prior to getting frustrated...

Thank you for the hint. But I noticed something else yesterday while trying to direct logging to my favourite directory: make clean removes the log dir, a quick look into the Makefile revealed that the undocumented make _clean is the right choice if I want to keep the logs, opposed to what's written in the docs. I had put the build dir into a subdir of the directory where I put the logs in...

Best regards
Peter

The # CONFIG_PACKAGE_xxx is not set lines are significant, they’re not simple placeholder comments which you can delete but explicit deselect choices.

Various package choices (such as dnsmasq) default to enabled unless explicitly disabled by a # CONFIG_PACKAGE_dnsmasq is not set statement.

If your aim is to produce a minimal .config containing only deviations from the default (explicitly added and disabled packages), then consider storing the output of executing the ./scripts/diffconfig.sh script within the buildroot.