Hi, I have been working to get the menuconfig for the kernel-tree easily accessible from the FreeWRT make files. Please see the attached file for the result.
The idea is as follows: * Getting all Configuration Options into the FreeWRT menu is quite difficult. * It is required to get an initial configuration into the kernel so packages from FreeWRT which require special kernel features are able to select those kernel features. The result is as this: * The user does as usual 'make menuconfig' in the FreeWRT directory and selects the packages as he/she whishes. Enabling the 'Custom Kernel Configuration' option in the 'Target' menu is required for the following steps. * The user does 'make def_kconfig' in the FreeWRT directory. This will generate the 'default' configuration for the kernel, based on the package selection in the FreeWRT menu. There would be no difference in the generated kernel - until now. * The user does 'make kconfig' in the FreeWRT directory. This will start up the menuconfig from the kernel source tree, using the default configuration from FreeWRT as in the previous step generated as defaults. The user can now add additional modules or functionality. Removing modules at this point is quite bad since it would crash the build process (modules are required for the .ipkg files to succeed). * The user would finally do 'make' in the FreeWRT directory to build the target system. Possible improvements: * Modify the simple copy operation from the custom configuration to the linux build directory in a way that enables anything required to build the *.ipkg files for the modules to succeed (i.e. select required modules as 'm', no matter what the user selected in custom configuration). * Alternativley modify the packaging algorithm for the module *.ipkgs in a way that allows for missing modules and maybe warns the user in case it the module is required by a user-mode-package but is neither selected as 'm' or 'y' in the kernel configuration. Please test the patch, if you think it is an improvement. bye, Clemens
Index: target/linux/Makefile
===================================================================
--- target/linux/Makefile (revision 3842)
+++ target/linux/Makefile (working copy)
@@ -10,10 +10,11 @@
include $(TOPDIR)/mk/targets.mk
-.PHONY: clean prepare compile install noinstall
+.PHONY: clean prepare compile install noinstall kconfig
clean:
prepare:
compile:
install:
noinstall:
+kconfig:
Index: target/Config.in.kernel
===================================================================
--- target/Config.in.kernel (revision 3842)
+++ target/Config.in.kernel (working copy)
@@ -1,3 +1,13 @@
+config FWRT_TARGET_KCONFIG
+ bool "Custom Kernel Configuration via 'make kconfig'"
+ default n
+ help
+ Activate this option if you would like to configure your kernel
+ by hand with menuconfig from the kernel sources.
+ Say No when you don't know what that is.
+ If Yes is selected, you can do "make kconfig" in freewrt directory
+ and modify the kernel parameters.
+
config FWRT_TARGET_NOKERNEL
bool
default n
Index: target/Makefile
===================================================================
--- target/Makefile (revision 3842)
+++ target/Makefile (working copy)
@@ -62,6 +62,19 @@
-rm -f ${BUILD_DIR}/.fwrtkernelconfig.tmp
prepare: linux-prepare
+def_kconfig: config-prepare
+ cp ${BUILD_DIR}/.fwrtkernelconfig ${TOPDIR}/.config.kernel
+ifeq (${FWRT_TARGET_KCONFIG},y)
+kconfig: linux-kconfig
+else
+kconfig:
+ @echo "You did not choose to create a custom kernel in 'make menuconfig'."
+ @echo "The configuration can be done, but it will not be used, until said"
+ @echo "option is enabled!"
+ @echo
+ @read -p "Please press [Enter] to proceed."
+ $(MAKE) linux-kconfig
+endif
compile: linux-compile
ifneq ($(strip ${FWRT_TARGET_NOKERNEL})$(strip ${FWRT_TARGET_ROOTFS_INITRAMFS}),)
install: image_clean linux-noinstall image_install
@@ -87,6 +100,9 @@
%-prepare:
$(TRACE) target/$(patsubst %-prepare,%,$@)-prepare
$(MAKE) -C $(patsubst %-prepare,%,$@) prepare
+%-kconfig:
+ $(TRACE) target/$(patsubst %-kconfig,%,$@)-kconfig
+ $(MAKE) -C $(patsubst %-kconfig,%,$@) kconfig
%-compile: %-prepare
$(TRACE) target/$(patsubst %-compile,%,$@)-compile
$(MAKE) -C $(patsubst %-compile,%,$@) compile
Index: mk/targets.mk
===================================================================
--- mk/targets.mk (revision 3842)
+++ mk/targets.mk (working copy)
@@ -20,6 +20,10 @@
@$(TRACE) target/linux/$(2)-$(1)-prepare
$(MAKE) -C $(2)-$(1) BOARD="$(2)" DEVICE="$(3)" prepare
+$(1)/$(2)/$(3)-kconfig:
+ @$(TRACE) target/linux/$(2)-$(1)-kconfig
+ $(MAKE) -C $(2)-$(1) BOARD="$(2)" DEVICE="$(3)" kconfig
+
$(1)/$(2)/$(3)-compile:
@$(TRACE) target/linux/$(2)-$(1)-compile
$(MAKE) -C $(2)-$(1) BOARD="$(2)" DEVICE="$(3)" compile
@@ -35,6 +39,7 @@
ifeq ($(FWRT_LINUX_$(4)),y)
clean: $(1)/$(2)/$(3)-clean
prepare: $(1)/$(2)/$(3)-prepare
+kconfig: $(1)/$(2)/$(3)-kconfig
compile: $(1)/$(2)/$(3)-compile
install: $(1)/$(2)/$(3)-install
noinstall: $(1)/$(2)/$(3)-noinstall
Index: mk/kernel-build.mk
===================================================================
--- mk/kernel-build.mk (revision 3842)
+++ mk/kernel-build.mk (working copy)
@@ -45,9 +45,15 @@
MAKEJOBS:= -j${FWRT_MAKE_JOBS}
endif
+ifeq (${FWRT_TARGET_KCONFIG},y)
+$(LINUX_DIR)/.config: $(LINUX_BUILD_DIR)/.extract $(TOPDIR)/.config.kernel
+ $(TRACE) target/linux/$(BOARD)-$(KERNEL)-kernel-configure-custom
+ $(CP) $(TOPDIR)/.config.kernel $(LINUX_DIR)/.config
+else
$(LINUX_DIR)/.config: $(LINUX_BUILD_DIR)/.extract $(BUILD_DIR)/.fwrtkernelconfig
$(TRACE) target/linux/$(BOARD)-$(KERNEL)-kernel-configure
$(CP) $(BUILD_DIR)/.fwrtkernelconfig $(LINUX_DIR)/.config
+endif
ifneq ($(strip ${FWRT_INITRAMFS_SOURCE}),)
cd ${TOPDIR} && zcat -f $(strip ${FWRT_INITRAMFS_SOURCE}) \
>${LINUX_DIR}/fwrt-initramfs.cpio
@@ -62,6 +68,7 @@
env GCC_HONOUR_COPTS=s $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) CC="$(TARGET_CC)" oldconfig include/linux/compile.h include/linux/version.h $(MAKE_TRACE)
env GCC_HONOUR_COPTS=s $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) CC="$(TARGET_CC)" dep $(MAKE_TRACE)
else
+ read
echo N | env GCC_HONOUR_COPTS=s $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) CC="$(TARGET_CC)" oldconfig $(MAKE_TRACE)
env GCC_HONOUR_COPTS=s $(MAKE) -C $(LINUX_DIR) V=1 CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) CC="$(TARGET_CC)" prepare scripts $(MAKE_TRACE) HOSTCFLAGS='-O2 -idirafter ${TOPDIR}/scripts'
endif
@@ -115,6 +122,9 @@
prepare:
compile: $(LINUX_KERNEL)
+kconfig: $(LINUX_DIR)/.config
+ env GCC_HONOUR_COPTS=s $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) CC="$(TARGET_CC)" menuconfig $(MAKE_TRACE)
+
install: compile
env GCC_HONOUR_COPTS=s $(MAKE) $(KPKG_MAKEOPTS) $(LINUX_KERNEL) $(MAKE_TRACE)
$(TRACE) target/linux/$(BOARD)-$(KERNEL)-modules-install
Index: Makefile
===================================================================
--- Makefile (revision 3842)
+++ Makefile (working copy)
@@ -43,6 +43,7 @@
@echo ' help - Print this help text'
@echo ' pkg-help - Print help about selectively compiling single packages'
@echo ' dev-help - Print help for developers / package maintainers'
+ @echo ' kernel-help - Print help about kernel options'
@echo ''
@echo 'Other generic targets:'
@echo ' all - Build everything as specified in .config'
@@ -78,6 +79,25 @@
@echo 'All changed patches will be opened with your $$EDITOR,'
@echo 'so you can add a description and verify the modifications.'
+kernel-help:
+ @echo 'The kernel can be customized. You sould start from a FreeWRT generated'
+ @echo 'configuration and modify that one. Removing modules is not a good idea'
+ @echo 'since it will break the build process. Added modules have to be manually'
+ @echo 'copied to target.'
+ @echo ''
+ @echo 'There are two configurations for the target kernel: FreeWRT configuration'
+ @echo 'and Custom configuration. You can only modify the Custom configuration'
+ @echo 'Selecting "Custom Kernel Configuration" from "Target" menu of FreeWRTs'
+ @echo 'menuconfig will switch to that Custom kernel configuration. It not selected'
+ @echo 'the normal FreeWRT configuration (which you can only modify by using FreeWRTs'
+ @echo 'menuconfig) will be used.'
+ @echo ''
+ @echo 'Kernel related build options:'
+ @echo ' def_kconfig - Overwrite the Custom configuration with FreeWRTs kernel'
+ @echo ' kernel configuration. It is recommended to do this whenever'
+ @echo ' kernel related options in FreeWRTs menuconfig change.'
+ @echo ' kconfig - Start the "menuconfig" target for the selected kernel'
+
clean: .prereq_done
-rm -f nohup.out
@${GMAKE_INV} clean
@@ -91,6 +111,12 @@
wconfig: .prereq_done
@${GMAKE_INV} _config W=-A
+def_kconfig: .prereq_done
+ @${GMAKE_INV} target/def_kconfig
+
+kconfig: .prereq_done
+ @${GMAKE_INV} target/kconfig
+
snapshotupdate: .prereq_done
@${GMAKE_INV} _config W=-a
pgpQWPVbuuuyi.pgp
Description: PGP signature
_______________________________________________ freewrt-developers mailing list [email protected] https://www.freewrt.org/lists/listinfo/freewrt-developers
