@@ -90,7 +90,7 @@ define add_jffs2_mark
echo -ne '\xde\xad\xc0\xde' >> $(1)
endef
-PROFILE_SANITIZED := $(call sanitize,$(PROFILE))
+PROFILE_SANITIZED := $(if $(filter $(PROFILE),$(PROFILES_BUILD)),multi-profile,$(call sanitize,$(PROFILE)))
define split_args
$(foreach data, \
@@ -274,6 +274,9 @@ define Image/mkfs/prepare/default
- $(FIND) $(TARGET_DIR) -type d -print0 | $(XARGS) -0 chmod u+rwx,g+rx,o+rx
$(INSTALL_DIR) $(TARGET_DIR)/tmp $(TARGET_DIR)/overlay
chmod 1777 $(TARGET_DIR)/tmp
+ mkdir -p $(TARGET_DIR)/lib/preinit
+ $(if $(PASSWORDLESS_CONSOLE),touch $(TARGET_DIR)/lib/preinit/zz_passwordless_console)
+ $(if $(NOFAILSAFE),echo 'pi_preinit_no_failsafe=y' >>$(TARGET_DIR)/lib/preinit/00_preinit.conf)
endef
define Image/mkfs/prepare
@@ -465,8 +468,8 @@ define Device/Export
endef
define Device/Check
- _TARGET = $$(if $$(filter $(PROFILE),$$(PROFILES)),install,install-disabled)
- _COMPILE_TARGET = $$(if $(if $(IB),,$(CONFIG_IB)$$(filter $(PROFILE),$$(PROFILES))),compile,compile-disabled)
+ _TARGET = $$(if $$(filter $$(DEVICE_PROFILE),$$(PROFILES_BUILD)),install,install-disabled)
+ _COMPILE_TARGET = $$(if $(if $(IB),,$(CONFIG_IB)$$(filter $$(DEVICE_PROFILE),$$(PROFILES_BUILD))),compile,compile-disabled)
endef
ifndef IB
@@ -63,13 +63,19 @@ endef
ifndef Profile
define Profile
- $(eval $(call Profile/Default))
+ PROFILE_TYPE:=
+ PROFILE_IMAGES_TYPE:=
+ PROFILE_DEFAULT:=
+ $(eval $(call Profiles/Defaults))
$(eval $(call Profile/$(1)))
dumpinfo : $(call shexport,Profile/$(1)/Config)
dumpinfo : $(call shexport,Profile/$(1)/Description)
DUMPINFO += \
echo "Target-Profile: $(1)"; \
echo "Target-Profile-Name: $(NAME)"; \
+ echo "Target-Profile-Type: $(if $(PROFILE_TYPE),$(PROFILE_TYPE),normal)"; \
+ echo "Target-Profile-Images-Type: $(if $(PROFILE_IMAGES_TYPE),$(PROFILE_IMAGES_TYPE),single)"; \
+ echo "Target-Profile-Default: $(if $(PROFILE_DEFAULT),1,0)"; \
echo "Target-Profile-Packages: $(PACKAGES) $(call extra_packages,$(DEFAULT_PACKAGES) $(PACKAGES))"; \
if [ -f ./config/profile-$(1) ]; then \
echo "Target-Profile-Kconfig: yes"; \
@@ -82,7 +88,9 @@ define Profile
echo "@@"; \
echo;
ifeq ($(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(if $(SUBTARGET),$(SUBTARGET)_))$(1)),y)
- PROFILE=$(1)
+ PROFILES_BUILD += $(1)
+ # For non multi-select targets
+ PROFILE = $(1)
endif
endef
endif
@@ -282,6 +290,7 @@ define BuildTargets/DumpCurrent
echo 'Target-Features: $(FEATURES)'; \
echo 'Target-Depends: $(DEPENDS)'; \
echo 'Target-Optimization: $(if $(CFLAGS),$(CFLAGS),$(DEFAULT_CFLAGS))'; \
+ echo 'Target-Multi-Select: $(if $(TARGET_MULTI_SELECT),$(TARGET_MULTI_SELECT),0)'; \
echo 'CPU-Type: $(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))'; \
echo 'Linux-Version: $(LINUX_VERSION)'; \
echo 'Linux-Release: $(LINUX_RELEASE)'; \
@@ -272,24 +272,126 @@ EOF
print_target($target);
}
-print <<EOF;
+ print <<EOF;
endchoice
+EOF
+
+ my %profile_unified;
+ my %profile_minimal;
+
+ foreach my $target (@target) {
+ next if scalar @{$target->{subtargets}};
+ my $tname = target_name($target);
+
+ if ($target->{multi_select}) {
+ print <<EOF;
+if TARGET_$target->{conf}
+menu "Target Profile"
+
+EOF
+
+ print <<EOF;
+config PROFILE_SINGLE_TARGET_$target->{conf}
+ bool
+ prompt "Select single profile" if TARGET_$target->{conf}
+
+ choice
+ prompt "Single Target Profile" if PROFILE_SINGLE_TARGET_$target->{conf}
+
+EOF
+
+ my $profiles = $target->{profiles};
+
+ foreach my $profile (@$profiles) {
+ next if ($profile->{type} eq 'unified');
+ print <<EOF;
+ config PROFILE_SINGLE_TARGET_$target->{conf}_$profile->{id}
+ bool "$profile->{name}"
+ depends on TARGET_$target->{conf}
+ select TARGET_$target->{conf}_$profile->{id}
+$profile->{config}
+EOF
+
+ my $help = $profile->{desc};
+ if ($help =~ /\w+/) {
+ $help =~ s/^\s*/\t\t /mg;
+ $help = "\t\thelp\n$help";
+ } else {
+ undef $help;
+ }
+ print "$help\n";
+ }
+
+ my $profiles = $target->{profiles};
+
+ foreach my $profile (@$profiles) {
+ if ($profile->{type} eq 'unified') {
+ $profile_unified{$target->{conf}} = "TARGET_$target->{conf}_$profile->{id}";
+ } elsif ($profile->{type} eq 'minimal') {
+ $profile_minimal{$target->{conf}} = "TARGET_$target->{conf}_$profile->{id}";
+ }
+ }
+ print <<EOF;
+ endchoice
+EOF
+
+ } else {
+ print <<EOF;
choice
- prompt "Target Profile"
+ prompt "Target Profile" if TARGET_$target->{conf}
EOF
+ }
- foreach my $target (@target) {
my $profiles = $target->{profiles};
foreach my $profile (@$profiles) {
- print <<EOF;
+ if ($target->{multi_select}) {
+ print <<EOF;
config TARGET_$target->{conf}_$profile->{id}
bool "$profile->{name}"
depends on TARGET_$target->{conf}
+ depends on ( !PROFILE_SINGLE_TARGET_$target->{conf} || PROFILE_SINGLE_TARGET_$target->{conf}_$profile->{id} )
+EOF
+ if ((not ($profile->{type} eq 'minimal')) and ($profile_minimal{$target->{conf}})) {
+ print <<EOF;
+ depends on !$profile_minimal{$target->{conf}}
+EOF
+ }
+
+ if ($profile->{type} eq 'normal') {
+ if ($profile_unified{$target->{conf}}) {
+ print <<EOF;
+ default y if $profile_unified{$target->{conf}}
+EOF
+
+ }
+ }
+
+ if ($profile->{default}) {
+ print <<EOF;
+ default y
+EOF
+ }
+
+ print <<EOF;
+ default n
+EOF
+
+ } else {
+ print <<EOF;
+config TARGET_$target->{conf}_$profile->{id}
+ bool "$profile->{name}"
+ depends on TARGET_$target->{conf}
+EOF
+
+ }
+
+ print <<EOF;
$profile->{config}
EOF
+
$profile->{kconfig} and print "\tselect PROFILE_KCONFIG\n";
my @pkglist = merge_package_lists($target->{packages}, $profile->{packages});
foreach my $pkg (@pkglist) {
@@ -305,11 +407,21 @@ EOF
}
print "$help\n";
}
- }
- print <<EOF;
+ if ($target->{multi_select}) {
+ print <<EOF;
+endmenu
+endif
+EOF
+ } else {
+ print <<EOF;
endchoice
+EOF
+ }
+
+ }
+ print <<EOF;
config HAS_SUBTARGETS
bool
@@ -75,6 +75,7 @@ sub parse_target_metadata($) {
/^Target-Depends:\s*(.+)\s*$/ and $target->{depends} = [ split(/\s+/, $1) ];
/^Target-Description:/ and $target->{desc} = get_multiline(*FILE);
/^Target-Optimization:\s*(.+)\s*$/ and $target->{cflags} = $1;
+ /^Target-Multi-Select:\s*(.+)\s*$/ and $target->{multi_select} = $1;
/^CPU-Type:\s*(.+)\s*$/ and $target->{cputype} = $1;
/^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1;
/^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1;
@@ -94,6 +95,9 @@ sub parse_target_metadata($) {
/^Target-Profile-Description:\s*(.*)\s*/ and $profile->{desc} = get_multiline(*FILE);
/^Target-Profile-Config:/ and $profile->{config} = get_multiline(*FILE, "\t");
/^Target-Profile-Kconfig:/ and $profile->{kconfig} = 1;
+ /^Target-Profile-Type:\s*(.+)\s*$/ and $profile->{type} = $1;
+ /^Target-Profile-Images-Type:\s*(.+)\s*$/ and $profile->{images_type} = $1;
+ /^Target-Profile-Default:\s*(.+)\s*$/ and $profile->{default} = $1;
}
close FILE;
foreach my $target (@target) {
@@ -39,7 +39,8 @@ Building images:
target profile and package set. You can use the following parameters
to change that:
- make image PROFILE="<profilename>" # override the default target profile
+ make image PROFILE="<profilename>" # override the default targets to specified single profile
+ make image PROFILES_BUILD="<profilename>[ <profilename> ... ]" # override list of profiles to build
make image PACKAGES="<pkg1> [<pkg2> [<pkg3> ...]]" # include extra packages
make image FILES="<path>" # include extra files from <path>
make image BIN_DIR="<path>" # alternative output directory for the images
@@ -72,21 +73,33 @@ OPKG:= \
--add-arch all:100 \
--add-arch $(ARCH_PACKAGES):200
+PROFILES_BUILD:=$(if $(PROFILE),$(PROFILE))
+USER_PROFILE:=$(if $(PROFILE),$(PROFILE),$(if $(PROFILES_BUILD),"Unified"))
+
define Profile
- $(eval $(call Profile/Default))
+ PROFILE_TYPE:=
+ PROFILE_IMAGES_TYPE:=
+ PROFILE_DEFAULT:=
+ $(eval $(call Profiles/Defaults))
$(eval $(call Profile/$(1)))
ifeq ($(USER_PROFILE),)
- USER_PROFILE:=$(1)
+ ifeq ($(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(if $(SUBTARGET),$(SUBTARGET)_))$(1)),y)
+ PROFILES_BUILD += $(1)
+ # For non multi-select targets
+ PROFILE = $(1)
+ endif
endif
$(1)_NAME:=$(NAME)
$(1)_PACKAGES:=$(PACKAGES)
PROFILE_NAMES += $(1)
PROFILE_LIST += \
- echo '$(1):'; [ -z '$(NAME)' ] || echo ' $(NAME)'; echo ' Packages: $(PACKAGES)';
+ echo '$(1):'; [ -z '$(NAME)' ] || echo ' $(NAME)'; echo ' Packages: $(PACKAGES)';
endef
include $(INCLUDE_DIR)/target.mk
+USER_PROFILE:=$(if $(filter-out $(PROFILE),$(PROFILES_BUILD)),Unified,$(PROFILE))
+
staging_dir/host/.prereq-build: include/prereq-build.mk
mkdir -p tmp
rm -f tmp/.host.mk
@@ -108,7 +121,7 @@ _call_info: FORCE
echo 'Available Profiles:'
echo; $(PROFILE_LIST)
-BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(USER_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel)
+BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(USER_PACKAGES) $(foreach profile,$(PROFILES_BUILD),$($(profile)_PACKAGES)) kernel)
# "-pkgname" in the package list means remove "pkgname" from the package list
BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES))
PACKAGES:=
@@ -175,7 +188,8 @@ build_image: FORCE
@echo
@echo Building images...
$(NO_TRACE_MAKE) -C target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 EXTRA_IMAGE_NAME="$(EXTRA_IMAGE_NAME)" \
- $(if $(USER_PROFILE),PROFILE="$(USER_PROFILE)")
+ $(if $(PROFILES_BUILD),PROFILES_BUILD="$(PROFILES_BUILD)",PROFILES_BUILD="$(USER_PROFILE)") \
+ $(if $(USER_PROFILE),USER_PROFILE="$(USER_PROFILE)",$(if $(PROFILES_BUILD),USER_PROFILE="Unified"))
clean:
rm -rf $(TMP_DIR) $(DL_DIR) $(TARGET_DIR) $(BIN_DIR)
@@ -192,12 +206,14 @@ ifneq ($(PROFILE),)
@exit 1
endif
endif
- (unset PROFILE FILES PACKAGES MAKEFLAGS; \
+ (unset PROFILE PROFILES_BUILD USER_PROFILE FILES PACKAGES MAKEFLAGS; \
$(MAKE) _call_image \
- $(if $(PROFILE),USER_PROFILE="$(PROFILE)") \
+ USER_PROFILE="$(USER_PROFILE)" \
+ PROFILES_BUILD="$(PROFILES_BUILD)" \
$(if $(FILES),USER_FILES="$(FILES)") \
$(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") \
- $(if $(BIN_DIR),BIN_DIR="$(BIN_DIR)"))
+ $(if $(BIN_DIR),BIN_DIR="$(BIN_DIR)") \
+ )
.SILENT: help info image
@@ -7,8 +7,6 @@
define Profile/Default
NAME:=Default Profile (all drivers)
- PACKAGES:= \
- kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,11 @@
+#
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:= \
+ kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
+endef
@@ -7,7 +7,6 @@
define Profile/Default
NAME:=Default Profile (all drivers)
- PACKAGES:= kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-mmc kmod-sdhci
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,11 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:= kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-mmc kmod-sdhci
+endef
+
@@ -7,7 +7,6 @@
define Profile/Default
NAME:=Default Profile
- PACKAGES:=kmod-b43 wpad-mini
endef
define Profile/Default/description
Package set compatible with most boards.
new file mode 100644
@@ -0,0 +1,10 @@
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=kmod-b43 wpad-mini
+endef
new file mode 100644
@@ -0,0 +1,14 @@
+#
+# Copyright (c) 2014 The Linux Foundation. All rights reserved.
+# Copyright (C) 2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:= \
+ kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev \
+ kmod-usb3 kmod-usb-dwc3-qcom kmod-usb-phy-qcom-dwc3
+endef
+
@@ -8,9 +8,6 @@
define Profile/Default
NAME:=Default Profile (minimum package set)
- PACKAGES:= \
- kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev \
- kmod-usb3 kmod-usb-dwc3-qcom kmod-usb-phy-qcom-dwc3
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,11 @@
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=kmod-ath5k
+endef
+
@@ -7,7 +7,6 @@
define Profile/Default
NAME:=Default Profile
- PACKAGES:=kmod-ath5k
endef
define Profile/Default/Description
@@ -7,7 +7,6 @@
define Profile/Default
NAME:=Default Profile (all drivers)
- PACKAGES:=kmod-usb-core kmod-usb2 kmod-usb2-fsl
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,11 @@
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=kmod-usb-core kmod-usb2 kmod-usb2-fsl
+endef
+
@@ -7,16 +7,6 @@
define Profile/Default
NAME:=Default Profile (all drivers)
- PACKAGES:= \
- kmod-mmc kmod-mvsdio swconfig \
- kmod-usb2 kmod-usb3 kmod-usb-storage \
- kmod-i2c-core kmod-i2c-mv64xxx \
- kmod-ata-core kmod-ata-marvell-sata \
- kmod-rtc-marvell kmod-thermal-armada \
- kmod-gpio-button-hotplug kmod-hwmon-tmp421 \
- kmod-hwmon-pwmfan kmod-leds-tlc59116 \
- kmod-ledtrig-usbdev kmod-mwlwifi wpad-mini \
- kmod-ata-mvebu-ahci
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:= \
+ kmod-mmc kmod-mvsdio swconfig \
+ kmod-usb2 kmod-usb3 kmod-usb-storage \
+ kmod-i2c-core kmod-i2c-mv64xxx \
+ kmod-ata-core kmod-ata-marvell-sata \
+ kmod-rtc-marvell kmod-thermal-armada \
+ kmod-gpio-button-hotplug kmod-hwmon-tmp421 \
+ kmod-hwmon-pwmfan kmod-leds-tlc59116 \
+ kmod-ledtrig-usbdev kmod-mwlwifi wpad-mini \
+ kmod-ata-mvebu-ahci
+endef
+
@@ -7,9 +7,6 @@
define Profile/Default
NAME:=Default Profile
- PACKAGES:=\
- kmod-usb-core kmod-usb2 kmod-usb-ohci \
- kmod-ledtrig-usbdev
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=\
+ kmod-usb-core kmod-usb2 kmod-usb-ohci \
+ kmod-ledtrig-usbdev
+endef
+
@@ -7,9 +7,6 @@
define Profile/Default
NAME:=Default Profile
- PACKAGES:=\
- kmod-usb-core kmod-usb3 \
- kmod-ledtrig-usbdev
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=\
+ kmod-usb-core kmod-usb3 \
+ kmod-ledtrig-usbdev
+endef
+
@@ -7,9 +7,6 @@
define Profile/Default
NAME:=Default Profile
- PACKAGES:=\
- kmod-usb-core kmod-usb2 kmod-usb-ohci \
- kmod-ledtrig-usbdev
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=\
+ kmod-usb-core kmod-usb2 kmod-usb-ohci \
+ kmod-ledtrig-usbdev
+endef
+
@@ -7,9 +7,6 @@
define Profile/Default
NAME:=Default Profile
- PACKAGES:=\
- kmod-usb-core kmod-usb2 kmod-usb-ohci \
- kmod-ledtrig-usbdev
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=\
+ kmod-usb-core kmod-usb2 kmod-usb-ohci \
+ kmod-ledtrig-usbdev
+endef
+
@@ -7,7 +7,6 @@
define Profile/Default
NAME:=Default Profile
- PACKAGES:=kmod-switch-rtl8366s kmod-swconfig swconfig
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,11 @@
+#
+# Copyright (C) 2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=kmod-switch-rtl8366s kmod-swconfig swconfig
+endef
+
@@ -7,9 +7,6 @@
define Profile/Default
NAME:=Default Profile
- PACKAGES:=\
- kmod-usb-core kmod-usb-dwc2 \
- kmod-ledtrig-usbdev
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,12 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=\
+ kmod-usb-core kmod-usb-dwc2 \
+ kmod-ledtrig-usbdev
+endef
@@ -7,7 +7,6 @@
define Profile/Default
NAME:=Default Profile
- PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig
endef
define Profile/Default/Description
new file mode 100644
@@ -0,0 +1,11 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profiles/Defaults
+ PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 swconfig
+endef
+