[OpenWrt-Devel] [PATCH 1/2] build: allow selective per device building of initramfs
Petr Štetiar
ynezz at true.cz
Sun May 5 16:14:19 EDT 2019
Currently it's not possible to enable building of initramfs images for
the devices which need them, leading to production of initramfs images
for every device under target which has FEATURES += ramdisk.
So this patch adds a possibility to enable FEATURES += selective-ramdisk
and then the device which needs ramdisk can just define
NEEDS_INITRAMFS=1.
Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
config/Config-images.in | 2 +-
include/image.mk | 11 ++++++++++-
scripts/target-metadata.pl | 1 +
target/Config.in | 3 +++
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/config/Config-images.in b/config/Config-images.in
index 8548c7c..befed24 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -8,7 +8,7 @@ menu "Target Images"
menuconfig TARGET_ROOTFS_INITRAMFS
bool "ramdisk"
- default y if USES_INITRAMFS
+ default y if (USES_INITRAMFS || USES_SELECTIVE_INITRAMFS)
help
Embed the root filesystem into the kernel (initramfs).
diff --git a/include/image.mk b/include/image.mk
index 5b02219..4f29002 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -382,6 +382,7 @@ define Device/Init
SUPPORTED_DEVICES :=
IMAGE_METADATA :=
+ NEEDS_INITRAMFS :=
FILESYSTEMS := $(TARGET_FILESYSTEMS)
endef
@@ -538,7 +539,15 @@ define Device/Build/artifact
endef
define Device/Build
- $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),$(call Device/Build/initramfs,$(1)))
+ifdef CONFIG_TARGET_ROOTFS_INITRAMFS
+ifneq ($(CONFIG_USES_SELECTIVE_INITRAMFS),y)
+ $(call Device/Build/initramfs,$(1))
+else
+ ifdef NEEDS_INITRAMFS
+ $(call Device/Build/initramfs,$(1))
+ endif
+endif
+endif
$(call Device/Build/kernel,$(1))
$$(eval $$(foreach compile,$$(COMPILE), \
diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl
index 1239587..d6f2dd4 100755
--- a/scripts/target-metadata.pl
+++ b/scripts/target-metadata.pl
@@ -32,6 +32,7 @@ sub target_config_features(@) {
/^fpu$/ and $ret .= "\tselect HAS_FPU\n";
/^spe_fpu$/ and $ret .= "\tselect HAS_SPE_FPU\n";
/^ramdisk$/ and $ret .= "\tselect USES_INITRAMFS\n";
+ /^selective-ramdisk$/ and $ret .= "\tselect USES_SELECTIVE_INITRAMFS\n";
/^powerpc64$/ and $ret .= "\tselect powerpc64\n";
/^nommu$/ and $ret .= "\tselect NOMMU\n";
/^mips16$/ and $ret .= "\tselect HAS_MIPS16\n";
diff --git a/target/Config.in b/target/Config.in
index 3cf4231..3533cf9 100644
--- a/target/Config.in
+++ b/target/Config.in
@@ -46,6 +46,9 @@ config USES_DEVICETREE
config USES_INITRAMFS
bool
+config USES_SELECTIVE_INITRAMFS
+ bool
+
config USES_SQUASHFS
bool
--
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list