Browse Source

build: implicitly configure board and subtarget options

The file targets/$GLUON_TARGET/config becomes optional, as many targets
only used it to set the board and subtarget.

Also fix targets without subtarget.
Matthias Schiffer 8 years ago
parent
commit
8434686085

+ 7 - 2
Makefile

@@ -52,7 +52,7 @@ include $(GLUONDIR)/include/toplevel.mk
 include $(GLUONDIR)/targets/targets.mk
 
 
-CheckTarget := [ -n '$(GLUON_TARGET)' -a -n '$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)' -a -n '$(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET)' ] \
+CheckTarget := [ -n '$(GLUON_TARGET)' -a -n '$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)' ] \
 	|| (echo -e 'Please set GLUON_TARGET to a valid target. Gluon supports the following targets:$(subst $(space),\n * ,$(GLUON_TARGETS))'; false)
 
 
@@ -209,7 +209,12 @@ config: FORCE
 	+$(NO_TRACE_MAKE) scripts/config/conf OPENWRT_BUILD= QUIET=0
 	+$(GLUONMAKE) prepare-tmpinfo
 	( \
-		cat $(GLUONDIR)/include/config $(GLUONDIR)/targets/$(GLUON_TARGET)/config; \
+		cat $(GLUONDIR)/include/config; \
+		echo 'CONFIG_TARGET_$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)=y'; \
+		$(if $(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET), \
+			echo 'CONFIG_TARGET_$(GLUON_TARGET_$(GLUON_TARGET)_BOARD)_$(GLUON_TARGET_$(GLUON_TARGET)_SUBTARGET)=y'; \
+		) \
+		cat $(GLUONDIR)/targets/$(GLUON_TARGET)/config 2>/dev/null; \
 		echo 'CONFIG_BUILD_SUFFIX="gluon-$(GLUON_TARGET)"'; \
 		echo '$(patsubst %,CONFIG_PACKAGE_%=m,$(sort $(filter-out -%,$(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) $(PROFILE_PACKAGES))))' \
 			| sed -e 's/ /\n/g'; \

+ 5 - 5
docs/dev/hardware.rst

@@ -73,14 +73,14 @@ won't run correctly without some adjustments, so better double check that everyt
 Add support to the build system
 '''''''''''''''''''''''''''''''
 A directory for the new target must be created under ``targets``, and it must be added
-to ``targets/targets.mk``. In the new target directory, three files must be created:
+to ``targets/targets.mk``. In the new target directory, the following files must be created:
 
-* config
 * profiles.mk
 * vermagic
+* config (optional)
 
-The file ``config`` can be used to add additional, target-specific options to the OpenWrt config. It
-must at least select the correct target and subtarget. For ``profiles.mk``, see :ref:`hardware-adding-profiles`.
+For ``profiles.mk``, see :ref:`hardware-adding-profiles`.
+The file ``config`` can be used to add additional, target-specific options to the OpenWrt config.
 
 The files ``vermagic`` must have the correct content so kernel modules from the upstream repositories
 can be installed without dependency issues. The OpenWrt version a Gluon release is based on is defined by the upstream package repo URL in ``include/gluon.mk``
@@ -92,4 +92,4 @@ The content is a hash which is part of the version number of the kernel package.
 As the kernel package is called ``kernel_3.10.49-1-0114c71ed85677c9c1e4911437af4743_ar71xx.ipk``, the correct ``vermagic`` string
 is ``0114c71ed85677c9c1e4911437af4743``.
 
-After this, is should be sufficient to call ``make GLUON_TARGET=<target>-<subtarget>`` to build the images for the new target.
+After this, is should be sufficient to call ``make GLUON_TARGET=<target>`` to build the images for the new target.

+ 0 - 1
targets/ar71xx-generic/config

@@ -1,2 +1 @@
-CONFIG_TARGET_ar71xx=y
 # CONFIG_PACKAGE_uboot-ar71xx-nbg460n_550n_550nh is not set

+ 0 - 2
targets/ar71xx-nand/config

@@ -1,2 +0,0 @@
-CONFIG_TARGET_ar71xx=y
-CONFIG_TARGET_ar71xx_nand=y

+ 0 - 2
targets/brcm2708-bcm2708/config

@@ -1,2 +0,0 @@
-CONFIG_TARGET_brcm2708=y
-CONFIG_TARGET_brcm2708_bcm2708=y

+ 0 - 2
targets/brcm2708-bcm2709/config

@@ -1,2 +0,0 @@
-CONFIG_TARGET_brcm2708=y
-CONFIG_TARGET_brcm2708_bcm2709=y

+ 0 - 1
targets/mpc85xx-generic/config

@@ -1 +0,0 @@
-CONFIG_TARGET_mpc85xx=y

+ 0 - 2
targets/ramips-rt305x/config

@@ -1,2 +0,0 @@
-CONFIG_TARGET_ramips=y
-CONFIG_TARGET_ramips_rt305x=y

+ 0 - 2
targets/x86-64/config

@@ -1,4 +1,2 @@
-CONFIG_TARGET_x86=y
-CONFIG_TARGET_x86_64=y
 CONFIG_VDI_IMAGES=y
 CONFIG_VMDK_IMAGES=y

+ 0 - 1
targets/x86-generic/config

@@ -1,3 +1,2 @@
-CONFIG_TARGET_x86=y
 CONFIG_VDI_IMAGES=y
 CONFIG_VMDK_IMAGES=y

+ 0 - 2
targets/x86-kvm_guest/config

@@ -1,2 +0,0 @@
-CONFIG_TARGET_x86=y
-CONFIG_TARGET_x86_kvm_guest=y