Make defconfig translates diffconfig's "=n" into commented out param "is not set" - is that OK (22.03.5)?

Hey) I'm trying to build custom minimal OpenWRT 22.03.5 image for ath79 with two extras - Mosquitto and Zerotier, by following relevant guides.

So far I have got 4.1MB openwrt-ath79-mikrotik-mikrotik_routerboard-mapl-2nd-initramfs-kernel.bin (and 4.4MB for openwrt-ath79-mikrotik-mikrotik_routerboard-mapl-2nd-squashfs-sysupgrade.bin), but I thought it may/should be even smaller as I'm trying to strip out kinda a lot. I acknowledge I have not found what's the real minimum for modern versions like 22.03.5, so if it's 4MB for "bare nothing", then I'm already achieved it.

However, while reviewing some artifacts, I've found that though I have set a number of options to =n (as seen in diffconfig), resulring .config (after "make defconfig"), converts it into "is not set".

Is that the expected behavior?
How can I ensure that those "=n"s are actually not included into the resulting .bin, as I've chosen to have packages built-in.
I've checked Issues on OpenWRT github and couldn't spot anything related, so my chances that "is not set" results into actual "wrong" inclusion into bin are kinda slim... But still, would like to re-verify

Among others with "=n" are:
CONFIG_KERNEL_PRINTK=n
CONFIG_PACKAGE_dropbear=n
and many-many others

How I have verified it (pls ignore root, actual build setup and complilation was performed under non-root user ):

kubu@ubuntu:/home/kubu/openwrt# more diffconfig | grep regdb
CONFIG_PACKAGE_wireless-regdb=n
kubu@ubuntu:/home/kubu/openwrt# cp diffconfig .config
kubu@ubuntu:/home/kubu/openwrt# make defconfig
#
# configuration written to .config
#
kubu@ubuntu:/home/kubu/openwrt# more .config | grep regdb
# CONFIG_PACKAGE_wireless-regdb is not set
kubu@ubuntu:/home/kubu/openwrt# more version
r20134-5f15225c1e
kubu@ubuntu:/home/kubu/openwrt/bin/targets/ath79/mikrotik# more profiles.json 
{"arch_packages":"mips_24kc","default_packages":["base-files","busybox","ca-bundle","dnsmasq","dropbear","firewall4","fstools","kmod-ath9k","kmod-gpio-button-hotplug","kmod-nft-offload","li
bc","libgcc","libustream-wolfssl","logd","mtd","netifd","nftables","odhcp6c","odhcpd-ipv6only","opkg","ppp","ppp-mod-pppoe","procd","procd-seccomp","procd-ujail","swconfig","uboot-envtools"
,"uci","uclient-fetch","urandom-seed","urngd","wpad-basic-wolfssl"],"metadata_version":1,"profiles":{"mikrotik_routerboard-mapl-2nd":{"device_packages":[],"image_prefix":"openwrt-ath79-mikr
otik-mikrotik_routerboard-mapl-2nd","images":[{"filesystem":"initramfs","name":"openwrt-ath79-mikrotik-mikrotik_routerboard-mapl-2nd-initramfs-kernel.bin","sha256":"...","sha256_unsigned":"...","type":"kernel"},{"filesystem":"squashfs","name":"openwrt-ath7
9-mikrotik-mikrotik_routerboard-mapl-2nd-squashfs-sysupgrade.bin","sha256":"...","sha256_unsigned":"...","type":"sysupgrade"}],"supported_devices":["mikrotik,routerboard-mapl-2nd"],"titles":[{"model":"RouterBOARD mAPL-2nD (mAP lite)","vendor":"MikroTik"}]}
},"source_date_epoch":1682627295,"target":"ath79/mikrotik","version_code":"r20134-5f15225c1e","version_number":"22.03.5"}

My diffconfig is similar to this one:

CONFIG_TARGET_ath79=y
CONFIG_TARGET_ath79_mikrotik=y
CONFIG_TARGET_ath79_mikrotik_DEVICE_mikrotik_routerboard-mapl-2nd=y
CONFIG_DEFAULT_TARGET_OPTIMIZATION="-Os -pipe -mno-branch-likely -march=24kc"
CONFIG_TARGET_OPTIMIZATION="-Os -pipe -mno-branch-likely -march=24kc"
CONFIG_BUSYBOX_DEFAULT_FEATURE_IPV6=n
CONFIG_CLEAN_IPKG=y
CONFIG_DOWNLOAD_CHECK_CERTIFICATE=n
CONFIG_SIGNATURE_CHECK=n
CONFIG_SIGNED_PACKAGES=n
CONFIG_STRIP_KERNEL_EXPORTS=y
CONFIG_USE_MKLIBS=y
CONFIG_uhttpd_ucode=n
CONFIG_DEFAULT_firewall4=n
CONFIG_DRIVER_11N_SUPPORT=n
CONFIG_FEED_luci=n
CONFIG_FEED_packages=n
CONFIG_FEED_routing=n
CONFIG_FEED_telephony=n
CONFIG_IPV6=n
CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE=n
CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_KERNEL_DEBUG_FS=n
CONFIG_KERNEL_DEBUG_INFO=n
CONFIG_KERNEL_DEBUG_KERNEL=n
CONFIG_KERNEL_ELF_CORE=n
CONFIG_KERNEL_IPV6=n
CONFIG_KERNEL_KALLSYMS=n
CONFIG_KERNEL_MAGIC_SYSRQ=n
CONFIG_KERNEL_MEMCG_KMEM=n
CONFIG_KERNEL_PRINTK=n
CONFIG_KERNEL_PRINTK_TIME=n
CONFIG_KERNEL_PROC_STRIPPED=y
CONFIG_KERNEL_SWAP=n
CONFIG_MOSQUITTO_CTRL=y
CONFIG_MOSQUITTO_DYNAMIC_SECURITY=y
CONFIG_MOSQUITTO_LWS=yfirewalls, 
CONFIG_MOSQUITTO_PASSWD=y
CONFIG_OPENSSL_ENGINE=y
CONFIG_OPENSSL_PREFER_CHACHA_OVER_GCM=y
CONFIG_OPENSSL_WITH_ASM=y
CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y
CONFIG_OPENSSL_WITH_CMS=y
CONFIG_OPENSSL_WITH_DEPRECATED=y
CONFIG_OPENSSL_WITH_ERROR_MESSAGES=y
CONFIG_OPENSSL_WITH_PSK=y
CONFIG_OPENSSL_WITH_SRP=y
CONFIG_OPENSSL_WITH_TLS13=y
CONFIG_PACKAGE_cJSON=y
CONFIG_PACKAGE_dnsmasq=n
CONFIG_PACKAGE_dropbear=n
CONFIG_PACKAGE_ip-tiny=y
CONFIG_PACKAGE_iw=n
CONFIG_PACKAGE_iwinfo=n
CONFIG_PACKAGE_jansson=n
CONFIG_PACKAGE_kmod-ath=n
CONFIG_PACKAGE_kmod-ath9k=n
CONFIG_PACKAGE_kmod-cfg80211=n
CONFIG_PACKAGE_kmod-crypto-aead=n
CONFIG_PACKAGE_kmod-crypto-ccm=n
CONFIG_PACKAGE_kmod-crypto-cmac=n
CONFIG_PACKAGE_kmod-crypto-crc32c=n
CONFIG_PACKAGE_kmod-crypto-ctr=n
CONFIG_PACKAGE_kmod-crypto-gcm=n
CONFIG_PACKAGE_kmod-crypto-gf128=n
CONFIG_PACKAGE_kmod-crypto-ghash=n
CONFIG_PACKAGE_kmod-crypto-hash=n
CONFIG_PACKAGE_kmod-crypto-hmac=n
CONFIG_PACKAGE_kmod-crypto-manager=n
CONFIG_PACKAGE_kmod-crypto-null=n
CONFIG_PACKAGE_kmod-crypto-rng=n
CONFIG_PACKAGE_kmod-crypto-seqiv=n
CONFIG_PACKAGE_kmod-crypto-sha256=n
CONFIG_PACKAGE_kmod-lib-crc-ccitt=n
CONFIG_PACKAGE_kmod-lib-crc32c=n
CONFIG_PACKAGE_kmod-mac80211=n
CONFIG_PACKAGE_kmod-nf-conntrack=n
CONFIG_PACKAGE_kmod-nf-flow=n
CONFIG_PACKAGE_kmod-nf-log=n
CONFIG_PACKAGE_kmod-nf-nat=n
CONFIG_PACKAGE_kmod-nf-reject=n
CONFIG_PACKAGE_kmod-nfnetlink=n
CONFIG_PACKAGE_kmod-nft-core=n
CONFIG_PACKAGE_kmod-nft-fib=n
CONFIG_PACKAGE_kmod-nft-nat=n
CONFIG_PACKAGE_kmod-ppp=n
CONFIG_PACKAGE_kmod-tun=y
CONFIG_PACKAGE_libcap=y
CONFIG_PACKAGE_libiwinfo=n
CONFIG_PACKAGE_libminiupnpc=y
CONFIG_PACKAGE_libmnl=n
CONFIG_PACKAGE_libnatpmp=y
CONFIG_PACKAGE_libnftnl=n
CONFIG_PACKAGE_libopenssl=y
CONFIG_PACKAGE_liboping=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_libstdcpp=y
CONFIG_PACKAGE_libwebsockets-openssl=y
CONFIG_PACKAGE_mosquitto-ssl=y
CONFIG_PACKAGE_nftables-json=n
CONFIG_PACKAGE_openwrt-keyring=n
CONFIG_PACKAGE_oping=y
CONFIG_PACKAGE_opkg=n
CONFIG_PACKAGE_ppp=n
CONFIG_PACKAGE_ucode=n
CONFIG_PACKAGE_uhttpd=y
CONFIG_PACKAGE_uhttpd-mod-ubus=y
CONFIG_PACKAGE_uhttpd-mod-ucode=n
CONFIG_PACKAGE_usign=n
CONFIG_PACKAGE_wireless-regdb=n
CONFIG_PACKAGE_zerotier=y
CONFIG_PACKAGE_zlib=y

Please advise.

yes.

1 Like

is there any way how one can verify that any of those is indeed not included into resulting bin?

It's interesting that two seemingly different notations (=n and "is not set") are used for the same state "don't include"...

“Don’t include” is pretty much your idea of some kind of “super n”.
If something is default set to include and you manually set it to ‘n’, well then it is “not set”. ‘Not’ begin with ‘n’.

You can write “not set” in your file also, it is only simpler to write ‘y’ and ‘n’.

But let’s say you put a ‘n’ on a package that is a dependable to another package that is included, then it will be forced included anyway, regardless of your ‘n’.

You can look in the build manifest what packages are build in the image, but not all dependables included are listed there.

It's not not about chosing particular notation or constant to express y/n/"not set" - the whole parameter string was commented out (#) in resulting .config (after "make defconfig" expanded diffconfig to .config) thought as I recall it, while in menuconfig, I have changed selection from it's default "include" to needed "not include".
So for me as a newbie it looks like - hey, you have set non-default value in menuconfig (changed to "do not include"), you do see it reflected as "=n" in your diffconfig, but when you expand it to a full .config, your choise may be lost (as corresponding param is commented out) and manifest may not show you if it's in fact included or not in resulting BIN.

As of dependencies - if I have excluded (at least attempted to do so) the whole wireless package, what may depend on CONFIG_PACKAGE_wireless-regdb so it makde defconfig to bring it back?

The default in binary code is 0. Unless set to 1, that’s it.

The whole list is set to zero at the beginning. After that, more and more packages are included from different parts of the code. And the very last build modification from the pilot, that is you.

Commented out is the same as not set, the compiler simply ignores all the lines that doesn’t exist which commented lines are.

1 Like

Thanks! It explains.
Was confused that "default" setting "Included" that I saw i menuconfig for a number of params that I later "excluded" then ended up "commented out" in resulting .config.

Still is there any trusted way to verify what's the actual set of features included into resulting BIN?
I will be then able to check if my 4.1MB is indeed bare minimum for 22.03.5 (+ZT, +MQTT) , or some unwanted "dependencies" were included by feature that I can also exclude.

There is a reason 4mb devices are not supported anymore, there are simply not any meaningful way to get a working system with the kernel size.

1 Like

That is the kernel config style for disabled items.

# and "is not set"

Unintuitive, but so it looks like.

See e.g. https://stackoverflow.com/questions/41946817/which-approach-to-use-for-kernel-config

1 Like

Agree. At the same time, I have not found what's the bare minimum possible for "empty" openwrt. Assuming that other "4MB" devises needed somewhat "full" version of owrt and I don't need it (no wifi, no nat, no fw, no webui, kinda nothing), I've decided to try and check, what's that "empty's" size.
If there is no mistake in my diffconfig re "minimal" (+ZT+MQTT), then it's 4MB for "nothing"

Well, the absolute bare minimum is the actual Linux kernel, driver configured to the specific device.

It will run and do absolutely nothing other then the idle loop, but to what purpose?

It will probably not even lit up a LED since you haven’t installed the io package and you can’t connect to it to verify it runs. But it will heat up so you know it is alive.

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