Kaynağa Gözat

build: don't enable all kernel modules in the general OpenWrt .config

With this change, there are two OpenWrt config files: one for the packages
actually used by Gluon, and one with all kernel modules enabled (like it was
since we removed the static kernel configs). The config with all kernel modules
is only used to generate the kernel configuration (so it is compatible with the
upstream kernel).

This should bring the build times back to what they were before the static
configs were removed.
Matthias Schiffer 9 yıl önce
ebeveyn
işleme
c676934e88
4 değiştirilmiş dosya ile 31 ekleme ve 7 silme
  1. 15 4
      Makefile
  2. 14 1
      include/Makefile.target
  3. 0 2
      include/config
  4. 2 0
      include/gluon.mk

+ 15 - 4
Makefile

@@ -183,6 +183,9 @@ gluon-tools: FORCE
 	+$(GLUONMAKE_EARLY) tools/sed/install
 	+$(GLUONMAKE_EARLY) package/lua/host/install
 
+scripts/config/conf:
+	@$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf CC="$(HOSTCC_WRAPPER)"
+
 prepare-tmpinfo: FORCE
 	mkdir -p tmp/info
 	$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk $(TOPDIR)/overlay/*/*.mk" SCAN_EXTRA=""
@@ -191,7 +194,9 @@ prepare-tmpinfo: FORCE
 		f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
 		[ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
 	done
+	[ tmp/.config-feeds.in -nt tmp/.packagefeeds ] || ./scripts/feeds feed_config > tmp/.config-feeds.in
 	./scripts/metadata.pl package_mk tmp/.packageinfo > tmp/.packagedeps || { rm -f tmp/.packagedeps; false; }
+	./scripts/metadata.pl package_feeds tmp/.packageinfo > tmp/.packagefeeds || { rm -f tmp/.packagefeeds; false; }
 	touch $(TOPDIR)/tmp/.build
 
 feeds: FORCE
@@ -201,7 +206,7 @@ feeds: FORCE
 	. $(GLUONDIR)/modules && for feed in $$GLUON_FEEDS; do ln -s ../../../packages/$$feed $(TOPDIR)/package/feeds/$$feed; done
 	+$(GLUONMAKE_EARLY) prepare-tmpinfo
 
-config: FORCE
+config: scripts/config/conf FORCE
 	+$(GLUONMAKE) prepare-tmpinfo
 	( \
 		cat $(GLUONDIR)/include/config $(GLUONDIR)/targets/$(GLUON_TARGET)/config; \
@@ -209,8 +214,15 @@ config: FORCE
 			| sed -e 's/ /\n/g'; \
 		echo '$(patsubst %,CONFIG_GLUON_LANG_%=y,$(GLUON_LANGS))' \
 			| sed -e 's/ /\n/g'; \
-	) > .config
-	+$(NO_TRACE_MAKE) defconfig OPENWRT_BUILD=0
+	) > $(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
@@ -299,7 +311,6 @@ PROFILE_BUILDDIR = $(BOARD_BUILDDIR)/$(PROFILE)
 PROFILE_KDIR = $(PROFILE_BUILDDIR)/kernel
 BIN_DIR = $(PROFILE_BUILDDIR)/images
 
-TMP_DIR = $(PROFILE_BUILDDIR)/tmp
 TARGET_DIR = $(PROFILE_BUILDDIR)/root
 
 PREPARED_RELEASE = $$(cat $(gluon_prepared_stamp))

+ 14 - 1
include/Makefile.target

@@ -1,5 +1,18 @@
+# code adjusted from openwrt/include/kernel-defaults.mk
+
 override define Kernel/Configure
-	$(call Kernel/Configure/Default)
+	$(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
+	echo "# CONFIG_KPROBES is not set" >> $(LINUX_DIR)/.config.target
+	$(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(BOARD_BUILDDIR)/config-allmods > $(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
 	cp $(GLUONDIR)/targets/$(GLUON_TARGET)/vermagic $(LINUX_DIR)/.vermagic
 endef
 

+ 0 - 2
include/config

@@ -1,5 +1,3 @@
-CONFIG_ALL_KMODS=y
-
 CONFIG_IMAGEOPT=y
 # CONFIG_PER_FEED_REPO is not set
 

+ 2 - 0
include/gluon.mk

@@ -14,6 +14,8 @@ export GLUONDIR GLUON_SITEDIR GLUON_SITE_CONFIG GLUON_IMAGEDIR GLUON_BUILDDIR
 BOARD_BUILDDIR = $(GLUON_BUILDDIR)/$(GLUON_TARGET)
 BOARD_KDIR = $(BOARD_BUILDDIR)/kernel
 
+export BOARD_BUILDDIR
+
 GLUON_OPENWRTDIR = $(BOARD_BUILDDIR)/openwrt