Add support for hardware profiles with different module sets

This commit is contained in:
Matthias Schiffer 2013-02-12 07:14:18 +01:00
parent 9e41e26943
commit 9af13d634b
4 changed files with 43 additions and 25 deletions

View File

@ -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

View File

@ -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

View File

@ -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

12
profiles.mk Normal file
View File

@ -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)))