Build environment - kernel override

I have question regarding the general workflow of the build environment...

I recently underwent testing of ipq806x on syno rt2600...

I needed this to run from USB so I could leave the OEM stuff alone ( except for a little uboot env in-situ variable modding )

The think that kept me stuck for over a week, was following every extroot guide known to man.... you name it i tried it:

-editing procd sources
-editing preinit - everythong
-fstab everything
-and much much more!!!

I am happy to have ventured on those journeys because I understand /learnt heaps now....

Anyways, at the end of the day, the KEY issue was even though I changed ext4 / usb-storage etc. etc. in both kernel_menuconfig and menuconfig.....

The CHANGES NEVER PROPOGATED to the final configuration...... I stumbled upon the .config.override and it seemed that this might be the gremlin.

What I ended up doing..... and this is probably a "no-no"..... is modifying kernel-defaults.mk as such;


#########################################
$(SCRIPT_DIR)/package-metadata.pl kconfig 
$(TMP_DIR)/.packageinfo $(TOPDIR)/.config $(KERNEL_PATCHVER) > $(LINUX_DIR)/.config.override
#########################################
cp $(TOPDIR)/custom/conf.over $(LINUX_DIR)/.config.override


Which as above, inserts my hardcoded .override after the automagically one had been worked on.

Can someone please tell me what file / option is asserting the settings that go into that file and where would be the optimal place to rectumfy that?

Usually, solely using make kernel_menuconfig to mark things as builtin (<*>) is the way to go. TBH I am not quite sure why it didn't work in your case.

There is a bit of overlap between the OpenWrt build system configuration and the Kernel configuration. The OpenWrt build system manages the kernel config symbols related to packaged kmods (e.g. kmod-usb-storage => CONFIG_USB_STORAGE) but it should take care of never downgrading symbols. Means if CONFIG_USB_STORAGE is unset in the kernel config but kmod-usb-storage is enabled in menuconfig, the kconfig symbol is set to m; but if the symbol already is set to y (<*>) in the kernel config, it should remain so and not be downgraded to m.

1 Like

Thankyou very much for your help.

Might permafix this one soon.... but in the meantime, someone may find the following script useful in the odd instance they are troubleshooting a similar issue.... it ain't perfect :wink:

Rather than statically clobber the whole file it's a bit more friendly.

#!/bin/bash
# 
# BODGY BASH SCRIPT TO DYNAMICALLY CLOBBER 
#AUTOMAGICALLY MODULARISED USB STORAGE STUFF 
# SIGNALLED TO BE BUILTIN
# PLACE BELOW LINE  OR SIMILAR IN ./include/kernel-defaults.mk 
# after final > .config.override call
# i.e. 
# EXISTSING LINE:  $(SCRIPT_DIR)/package-metadata................ [snip]  > $(LINUX_DIR)/.config.override
# PUTCALL TO LOCATION HERE .... i.e: $(TOPDIR)/koverclobber.sh



#FOVER="/xsrc/wrt/_x-ipq/_2019/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/linux-4.14.90/.config.override"
FOVER=`find ./ | grep "g\.override"` # NASTY
KOPTMP="/tmp/kopt"

#CONFIG_USB
#CONFIG_USB_DWC3
#CONFIG_USB_STORAGE


cat <<EOF >$KOPTMP
CONFIG_MMC
CONFIG_MMC_BLOCK
CONFIG_USB_STORAGE
CONFIG_BLK_DEV_SD
CONFIG_SCSI
EOF


while read p; do

echo -n ">$p: "
CUROPT=""
CUROPT=`cat $FOVER | grep "^$p="`

	case "$CUROPT" in 
	   *"=y"* ) echo "Builtin"
		   cat $FOVER | grep "^$p="
		   ;;
	   *"=m"* ) echo "Module"
		   sed -i "s/^${p}=.*/${p}=y/;" $FOVER
		   cat $FOVER | grep "^$p="
	   ;;
	   *"#"* ) echo "Is not enabled"
		   sed -i "s/^# ${p} is not set/${p}=y/;" $FOVER
		   cat $FOVER | grep "^$p="
	   ;;
	   * ) echo -n "Not found";
		   echo -n "Adding: $p=y"
		   #echo -n "$p=y" >> $FOVER
		   echo "$p=y" >> $FOVER
		   cat $FOVER | grep "^$p="
	   ;;
	esac

echo " "; sleep 1
done <$KOPTMP

echo "### kernel .config.override modules still"
cat $FOVER | grep "=m"; sleep 1
echo "#######   END FINISHED OVER  #############"