diff mbox series

[1/3] build/json: generate json file for initramfs images

Message ID 20210108235106.29999-1-moritzwarning@web.de
State Superseded
Headers show
Series [1/3] build/json: generate json file for initramfs images | expand

Commit Message

Moritz Warning Jan. 8, 2021, 11:51 p.m. UTC
The initramfs images are missing from the profiles.json files.

Signed-off-by: Moritz Warning <moritzwarning@web.de>
---
 include/image.mk | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

--
2.30.0

Comments

Paul Spooren Jan. 10, 2021, 7:42 p.m. UTC | #1
On Sa, Jan 9, 2021 at 00:51, Moritz Warning <moritzwarning@web.de> 
wrote:
> The initramfs images are missing from the profiles.json files.
> 
> Signed-off-by: Moritz Warning <moritzwarning@web.de>
> ---

Superseded by GitHub patch[1].

Overall I'm not happy with this approach as it complicates multiple 
ends, instead I suggested a simpler implementation in the GitHub 
comments.

[1]: https://github.com/openwrt/openwrt/pull/3772

>  include/image.mk | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/include/image.mk b/include/image.mk
> index 8f46c75ffe..fc73658a9a 100644
> --- a/include/image.mk
> +++ b/include/image.mk
> @@ -475,7 +475,8 @@ endef
>  ifndef IB
>  define Device/Build/initramfs
>    $(call Device/Export,$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE),$(1))
> -  $$(_TARGET): $$(if 
> $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE))
> +  $$(_TARGET): $$(if 
> $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)) \
> +	  $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO), 
> $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,)
> 
>    $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
>    $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): 
> $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
> @@ -484,6 +485,20 @@ define Device/Build/initramfs
>    $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): 
> $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile 
> $$(KERNEL_DEPENDS) image_prepare
>  	@rm -f $$@
>  	$$(call concat_cmd,$$(KERNEL_INITRAMFS))
> +
> +  $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json: 
> $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
> +	@mkdir -p $$(shell dirname $$@)
> +	DEVICE_ID="$(1)" \
> +	BIN_DIR="$(BIN_DIR)" \
> +	SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
> +	IMAGE_NAME="$$(notdir $$^)" \
> +	IMAGE_TYPE="kernel" \
> +	IMAGE_FILESYSTEM="initramfs" \
> +	TARGET="$(BOARD)" \
> +	SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
> +	VERSION_NUMBER="$(VERSION_NUMBER)" \
> +	VERSION_CODE="$(VERSION_CODE)" \
> +	$(TOPDIR)/scripts/json_add_image_info.py $$@
>  endef
>  endif
> 
> --
> 2.30.0
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/include/image.mk b/include/image.mk
index 8f46c75ffe..fc73658a9a 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -475,7 +475,8 @@  endef
 ifndef IB
 define Device/Build/initramfs
   $(call Device/Export,$(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE),$(1))
-  $$(_TARGET): $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE))
+  $$(_TARGET): $$(if $$(KERNEL_INITRAMFS),$(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)) \
+	  $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO), $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,)

   $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
   $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
@@ -484,6 +485,20 @@  define Device/Build/initramfs
   $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/$$(KERNEL_INITRAMFS_NAME) $(CURDIR)/Makefile $$(KERNEL_DEPENDS) image_prepare
 	@rm -f $$@
 	$$(call concat_cmd,$$(KERNEL_INITRAMFS))
+
+  $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
+	@mkdir -p $$(shell dirname $$@)
+	DEVICE_ID="$(1)" \
+	BIN_DIR="$(BIN_DIR)" \
+	SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
+	IMAGE_NAME="$$(notdir $$^)" \
+	IMAGE_TYPE="kernel" \
+	IMAGE_FILESYSTEM="initramfs" \
+	TARGET="$(BOARD)" \
+	SUBTARGET="$(if $(SUBTARGET),$(SUBTARGET),generic)" \
+	VERSION_NUMBER="$(VERSION_NUMBER)" \
+	VERSION_CODE="$(VERSION_CODE)" \
+	$(TOPDIR)/scripts/json_add_image_info.py $$@
 endef
 endif