From cbe66e9388de22d21d3ab3ea8461f69b817d4ec6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 13 Oct 2015 21:36:19 +0200 Subject: [PATCH] build: add `make modules` make target `make modules` will generate a opkg repository containing kernel modules matching the kernel of the Gluon images. --- Makefile | 31 +++++++++++++++++-------------- docs/user/getting_started.rst | 3 +++ include/Makefile.target | 19 ------------------- include/config | 2 +- include/gluon.mk | 3 ++- 5 files changed, 23 insertions(+), 35 deletions(-) delete mode 100644 include/Makefile.target diff --git a/Makefile b/Makefile index d3e36862..f548dd1d 100644 --- a/Makefile +++ b/Makefile @@ -68,11 +68,12 @@ prepare-target: FORCE all: prepare-target +@$(GLUONMAKE) prepare +@$(GLUONMAKE) images + +@$(GLUONMAKE) modules prepare: prepare-target +@$(GLUONMAKE) $@ -clean download images: FORCE +clean download images modules: FORCE @$(CheckExternal) @$(CheckTarget) +@$(GLUONMAKE_EARLY) maybe-prepare-target @@ -178,6 +179,10 @@ override SUBTARGET := $(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET) target_prepared_stamp := $(BOARD_BUILDDIR)/target-prepared gluon_prepared_stamp := $(BOARD_BUILDDIR)/prepared +PREPARED_RELEASE = $$(cat $(gluon_prepared_stamp)) +IMAGE_PREFIX = gluon-$(GLUON_SITE_CODE)-$(PREPARED_RELEASE) +MODULE_PREFIX = gluon-$(GLUON_SITE_CODE)-$(PREPARED_RELEASE) + include $(INCLUDE_DIR)/target.mk @@ -228,13 +233,6 @@ config: FORCE | sed -e 's/ /\n/g'; \ ) > $(BOARD_BUILDDIR)/config.tmp scripts/config/conf --defconfig=$(BOARD_BUILDDIR)/config.tmp Config.in - mv .config $(BOARD_BUILDDIR)/config - - echo 'CONFIG_ALL_KMODS=y' >> $(BOARD_BUILDDIR)/config.tmp - scripts/config/conf --defconfig=$(BOARD_BUILDDIR)/config.tmp Config.in - mv .config $(BOARD_BUILDDIR)/config-allmods - - cp $(BOARD_BUILDDIR)/config .config prepare-target: FORCE rm $(GLUON_OPENWRTDIR)/tmp || true @@ -284,8 +282,8 @@ toolchain: $(toolchain/stamp-install) $(tools/stamp-install) include $(INCLUDE_DIR)/kernel.mk kernel: FORCE - +$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUONDIR)/include/Makefile.target $(LINUX_DIR)/.image TARGET_BUILD=1 - +$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) -f $(GLUONDIR)/include/Makefile.target $(LINUX_DIR)/.modules TARGET_BUILD=1 + +$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) $(LINUX_DIR)/.image TARGET_BUILD=1 + +$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD) $(LINUX_DIR)/.modules TARGET_BUILD=1 packages: $(package/stamp-compile) $(_SINGLE)$(SUBMAKE) -r package/index @@ -313,6 +311,14 @@ prepare: FORCE $(gluon_prepared_stamp): +$(GLUONMAKE) prepare +modules: FORCE $(gluon_prepared_stamp) + -rm -f $(GLUON_MODULEDIR)/*/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic)/* + -rmdir -p $(GLUON_MODULEDIR)/*/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic) + mkdir -p $(GLUON_MODULEDIR)/$(MODULE_PREFIX)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic) + cp $(PACKAGE_DIR)/kmod-*.ipk $(GLUON_MODULEDIR)/$(MODULE_PREFIX)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic) + + $(_SINGLE)$(SUBMAKE) -r package/index PACKAGE_DIR=$(GLUON_MODULEDIR)/$(MODULE_PREFIX)/$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic) + include $(INCLUDE_DIR)/package-ipkg.mk @@ -325,9 +331,6 @@ BIN_DIR = $(PROFILE_BUILDDIR)/images TARGET_DIR = $(PROFILE_BUILDDIR)/root -PREPARED_RELEASE = $$(cat $(gluon_prepared_stamp)) -IMAGE_PREFIX = gluon-$(GLUON_SITE_CODE)-$(PREPARED_RELEASE) - OPKG:= \ IPKG_TMP="$(TMP_DIR)/ipkgtmp" \ IPKG_INSTROOT="$(TARGET_DIR)" \ @@ -440,6 +443,6 @@ manifest: FORCE ) : \ ) >> $(GLUON_BUILDDIR)/$(GLUON_BRANCH).manifest.tmp -.PHONY: all images prepare clean gluon-tools manifest +.PHONY: all images prepare modules clean gluon-tools manifest endif diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst index 658d98c5..db038bd5 100644 --- a/docs/user/getting_started.rst +++ b/docs/user/getting_started.rst @@ -126,6 +126,9 @@ GLUON_OUTPUTDIR GLUON_IMAGEDIR Path where images will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/images/``. +GLUON_MODULEDIR + Path where the kernel module opkg repository will be stored. Defaults to ``$(GLUON_OUTPUTDIR)/modules``. + So all in all, to update and rebuild a Gluon build tree, the following commands should be used (repeat the ``make clean`` and ``make`` for all targets you want to build): diff --git a/include/Makefile.target b/include/Makefile.target deleted file mode 100644 index 9a913f0c..00000000 --- a/include/Makefile.target +++ /dev/null @@ -1,19 +0,0 @@ -# code adjusted from openwrt/include/kernel-defaults.mk - -override define Kernel/Configure - $(LINUX_CONF_CMD) > $(LINUX_DIR)/.config.target -# copy CONFIG_KERNEL_* settings over to .config.target - awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' $(BOARD_BUILDDIR)/config-allmods >> $(LINUX_DIR)/.config.target - echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $(LINUX_DIR)/.config.target - echo "# CONFIG_KALLSYMS_ALL is not set" >> $(LINUX_DIR)/.config.target - echo "# CONFIG_KALLSYMS_UNCOMPRESSED is not set" >> $(LINUX_DIR)/.config.target - $(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(BOARD_BUILDDIR)/config-allmods $(KERNEL_PATCHVER) > $(LINUX_DIR)/.config.override - $(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config - $(call Kernel/SetNoInitramfs) - rm -rf $(KERNEL_BUILD_DIR)/modules - $(_SINGLE) [ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install - $(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic -endef - -# The Makefile included here is $(TOPDIR)/target/linux/$(BOARD)/Makefile -include Makefile diff --git a/include/config b/include/config index ac1a4f8d..8476ec64 100644 --- a/include/config +++ b/include/config @@ -1,7 +1,7 @@ CONFIG_IMAGEOPT=y # CONFIG_PER_FEED_REPO is not set - CONFIG_DEVEL=y +CONFIG_ALL_KMODS=y CONFIG_BUSYBOX_CUSTOM=y CONFIG_BUSYBOX_CONFIG_SHA512SUM=y diff --git a/include/gluon.mk b/include/gluon.mk index ceaa2850..3534ae22 100644 --- a/include/gluon.mk +++ b/include/gluon.mk @@ -9,8 +9,9 @@ GLUON_SITE_CONFIG := $(GLUON_SITEDIR)/site.conf GLUON_OUTPUTDIR ?= $(GLUONDIR)/output GLUON_IMAGEDIR ?= $(GLUON_OUTPUTDIR)/images +GLUON_MODULEDIR ?= $(GLUON_OUTPUTDIR)/modules -export GLUONDIR GLUON_SITEDIR GLUON_BUILDDIR GLUON_SITE_CONFIG GLUON_OUTPUTDIR GLUON_IMAGEDIR +export GLUONDIR GLUON_SITEDIR GLUON_BUILDDIR GLUON_SITE_CONFIG GLUON_OUTPUTDIR GLUON_IMAGEDIR GLUON_MODULEDIR BOARD_BUILDDIR = $(GLUON_BUILDDIR)/$(GLUON_TARGET)