From 9af13d634b148b3fe070045fb443db97087cfd9f Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 12 Feb 2013 07:14:18 +0100 Subject: [PATCH] Add support for hardware profiles with different module sets --- Makefile | 31 ++++++++++++++++++++----------- builder/Makefile | 6 ++---- builder/gluon.mk | 19 +++++++++---------- profiles.mk | 12 ++++++++++++ 4 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 profiles.mk diff --git a/Makefile b/Makefile index 22b0fe98..5545f51f 100644 --- a/Makefile +++ b/Makefile @@ -6,14 +6,28 @@ all: images include $(GLUONDIR)/builder/gluon.mk -BOARD:=ar71xx -PROFILES:=TLWR741 +BOARD := ar71xx +PROFILES := +PROFILE_PACKAGES := null := space := ${null} ${null} ${space} := ${space} -prepared_stamp:=$(GLUON_BUILDDIR)/prepared +prepared_stamp := $(GLUON_BUILDDIR)/prepared + +define GluonProfile +image/$(1): $(prepared_stamp) + $(MAKE) -C $(GLUON_BUILDERDIR) image \ + PROFILE="$(1)" \ + PACKAGE_DIR="$(GLUON_OPENWRTDIR)/bin/$(BOARD)/packages" \ + $(if $(2),PACKAGES="$(2)") + +PROFILES += $(1) +PROFILE_PACKAGES += $(filter-out -%,$(2)) +endef + +include profiles.mk prepare: mkdir -p $(GLUON_IMAGEDIR) $(GLUON_BUILDDIR) @@ -24,7 +38,7 @@ prepare: $(GLUON_OPENWRTDIR)/scripts/feeds update -a $(GLUON_OPENWRTDIR)/scripts/feeds install -a - echo -e "CONFIG_TARGET_$(BOARD)=y\nCONFIG_TARGET_ROOTFS_JFFS2=n\n$(subst ${ },\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(GLUON_PACKAGES)))" > $(GLUON_OPENWRTDIR)/.config + echo -e "CONFIG_TARGET_$(BOARD)=y\nCONFIG_TARGET_ROOTFS_JFFS2=n\n$(subst ${ },\n,$(patsubst %,CONFIG_PACKAGE_%=m,$(GLUON_PACKAGES) $(PROFILE_PACKAGES)))" > $(GLUON_OPENWRTDIR)/.config $(MAKE) -C $(GLUON_OPENWRTDIR) defconfig prepare $(MAKE) -C $(GLUON_BUILDERDIR) kernel $(MAKE) -C $(GLUON_OPENWRTDIR) package/compile @@ -34,15 +48,10 @@ prepare: $(prepared_stamp): $(MAKE) prepare -image-%: $(prepared_stamp) - $(MAKE) -C $(GLUON_BUILDERDIR) image \ - PACKAGE_DIR=$(GLUON_OPENWRTDIR)/bin/$(BOARD)/packages \ - PROFILE=$(subst image-,,$@) - -images: $(patsubst %,image-%,$(PROFILES)) +images: $(patsubst %,image/%,$(PROFILES)) clean: - rm -rf $(GLUON_BUILDDIR) $(prepared_stamp) + rm -rf $(GLUON_BUILDDIR) cleanall: clean $(MAKE) -C $(GLUON_OPENWRTDIR) clean diff --git a/builder/Makefile b/builder/Makefile index a6cd3bd2..6074ba05 100644 --- a/builder/Makefile +++ b/builder/Makefile @@ -60,8 +60,6 @@ define Profile endif $(1)_NAME:=$(NAME) $(1)_PACKAGES:=$(PACKAGES) - PROFILE_LIST += \ - echo '$(1):'; [ -z '$(NAME)' ] || echo ' $(NAME)'; echo ' Packages: $(PACKAGES)'; endef include $(INCLUDE_DIR)/target.mk @@ -144,7 +142,7 @@ package_postinst: FORCE build_image: FORCE @echo @echo Building images... - $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 \ + $(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IMG_PREFIX="gluon-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))" \ $(if $(USER_PROFILE),PROFILE="$(USER_PROFILE)") image: @@ -156,5 +154,5 @@ image: BIN_DIR="$(GLUON_IMAGEDIR)" \ $(if $(PACKAGE_DIR),PACKAGE_DIR="$(PACKAGE_DIR)")) -.SILENT: image +.SILENT: kernel image diff --git a/builder/gluon.mk b/builder/gluon.mk index 10ccb401..003b547e 100644 --- a/builder/gluon.mk +++ b/builder/gluon.mk @@ -1,22 +1,21 @@ ifneq ($(__gluon_inc),1) __gluon_inc=1 -GLUON_SITEDIR:=$(GLUONDIR)/site -GLUON_IMAGEDIR:=$(GLUONDIR)/images -GLUON_OPENWRTDIR:=$(GLUONDIR)/openwrt -GLUON_BUILDERDIR:=$(GLUONDIR)/builder -GLUON_BUILDDIR:=$(GLUONDIR)/build +GLUON_SITEDIR := $(GLUONDIR)/site +GLUON_IMAGEDIR := $(GLUONDIR)/images +GLUON_OPENWRTDIR := $(GLUONDIR)/openwrt +GLUON_BUILDERDIR := $(GLUONDIR)/builder +GLUON_BUILDDIR := $(GLUONDIR)/build $(GLUON_SITEDIR)/site.mk: $(error There was no site configuration found. Please check out a site configuration to $(GLUON_SITEDIR)) -include $(GLUON_SITEDIR)/site.mk -GLUON_DEFAULT_PACKAGES:=gluon-core +GLUON_DEFAULT_PACKAGES := gluon-core - -GLUON_PACKAGES:=$(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) -DEFAULT_PACKAGES.gluon:=$(GLUON_PACKAGES) -DEVICE_TYPE:=gluon +GLUON_PACKAGES := $(GLUON_DEFAULT_PACKAGES) $(GLUON_SITE_PACKAGES) +DEFAULT_PACKAGES.gluon := $(GLUON_PACKAGES) +DEVICE_TYPE := gluon endif #__gluon_inc diff --git a/profiles.mk b/profiles.mk new file mode 100644 index 00000000..b4af4c1e --- /dev/null +++ b/profiles.mk @@ -0,0 +1,12 @@ +# List of hardware profiles + +USB_PACKAGES := block-mount kmod-fs-ext4 kmod-fs-vfat kmod-usb-storage kmod-usb-storage-extras blkid swap-utils \ + kmod-nls-cp1250 kmod-nls-cp1251 kmod-nls-cp437 kmod-nls-cp775 kmod-nls-cp850 kmod-nls-cp852 kmod-nls-cp866 \ + kmod-nls-iso8859-1 kmod-nls-iso8859-13 kmod-nls-iso8859-15 kmod-nls-iso8859-2 kmod-nls-koi8r kmod-nls-utf8 + + +$(eval $(call GluonProfile,TLWR741)) +$(eval $(call GluonProfile,TLWR841)) +$(eval $(call GluonProfile,TLWR842,$(USB_PACKAGES))) +$(eval $(call GluonProfile,TLWR1043,$(USB_PACKAGES))) +$(eval $(call GluonProfile,TLWDR4300,$(USB_PACKAGES)))