diff mbox series

build: artifacts add dependency for builded images

Message ID 20210321085810.991690-1-oskari@lemmela.net
State Accepted
Delegated to: Daniel Golle
Headers show
Series build: artifacts add dependency for builded images | expand

Commit Message

Oskari Lemmelä March 21, 2021, 8:58 a.m. UTC
Add possibility to use images and initramfs in artifacts.

Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
---
 include/image.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Paul Spooren March 21, 2021, 9:55 a.m. UTC | #1
On Sat Mar 20, 2021 at 10:58 PM HST, Oskari Lemmela wrote:
> Add possibility to use images and initramfs in artifacts.
>
> Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
> ---

Hi, could you please elaborate on your use-case?

> include/image.mk | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/image.mk b/include/image.mk
> index 29df0938bc..8b7b2b9740 100644
> --- a/include/image.mk
> +++ b/include/image.mk
> @@ -478,6 +478,7 @@ define Device/Build/initramfs
> $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO),
> $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,))
>  
> $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
> + $(1)-images: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
> $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE):
> $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
> cp $$^ $$@
>  
> @@ -570,6 +571,7 @@ define Device/Build/image
> $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
> $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
> $(eval $(call Device/Export,$(KDIR)/tmp/$(call
> DEVICE_IMG_NAME,$(1),$(2)),$(1)))
> + $(3)-images: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)
>  
> ROOTFS/$(1)/$(3) := \
> $(KDIR)/root.$(1)$$(strip \
> @@ -628,7 +630,7 @@ endef
> define Device/Build/artifact
> $$(_TARGET): $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)
> $(eval $(call Device/Export,$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1)))
> - $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE)
> + $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE)
> $(2)-images
> @rm -f $$@
> $$(call concat_cmd,$(ARTIFACT/$(1)))
>  
> @@ -651,7 +653,7 @@ define Device/Build
> $$(call Device/Build/image,$$(fs),$$(image),$(1)))))
>  
> $$(eval $$(foreach artifact,$$(ARTIFACTS), \
> - $$(call Device/Build/artifact,$$(artifact))))
> + $$(call Device/Build/artifact,$$(artifact),$(1))))
>  
> endef
>  
> --
> 2.25.1
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Oskari Lemmelä March 22, 2021, 2:44 p.m. UTC | #2
Hi,

On 21.3.2021 11.55, Paul Spooren wrote:
> On Sat Mar 20, 2021 at 10:58 PM HST, Oskari Lemmela wrote:
>> Add possibility to use images and initramfs in artifacts.
>>
>> Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
>> ---
> Hi, could you please elaborate on your use-case?

One use case is build full sdcard image for Bananapi R64.

Currently fit and initramfs images need to be copied over
tftp/serial after booting from sdcard.

Oskari

>
>> include/image.mk | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/image.mk b/include/image.mk
>> index 29df0938bc..8b7b2b9740 100644
>> --- a/include/image.mk
>> +++ b/include/image.mk
>> @@ -478,6 +478,7 @@ define Device/Build/initramfs
>> $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO),
>> $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,))
>>   
>> $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
>> + $(1)-images: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
>> $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE):
>> $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
>> cp $$^ $$@
>>   
>> @@ -570,6 +571,7 @@ define Device/Build/image
>> $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
>> $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
>> $(eval $(call Device/Export,$(KDIR)/tmp/$(call
>> DEVICE_IMG_NAME,$(1),$(2)),$(1)))
>> + $(3)-images: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)
>>   
>> ROOTFS/$(1)/$(3) := \
>> $(KDIR)/root.$(1)$$(strip \
>> @@ -628,7 +630,7 @@ endef
>> define Device/Build/artifact
>> $$(_TARGET): $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)
>> $(eval $(call Device/Export,$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1)))
>> - $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE)
>> + $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE)
>> $(2)-images
>> @rm -f $$@
>> $$(call concat_cmd,$(ARTIFACT/$(1)))
>>   
>> @@ -651,7 +653,7 @@ define Device/Build
>> $$(call Device/Build/image,$$(fs),$$(image),$(1)))))
>>   
>> $$(eval $$(foreach artifact,$$(ARTIFACTS), \
>> - $$(call Device/Build/artifact,$$(artifact))))
>> + $$(call Device/Build/artifact,$$(artifact),$(1))))
>>   
>> endef
>>   
>> --
>> 2.25.1
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Daniel Golle March 22, 2021, 3:06 p.m. UTC | #3
On Mon, Mar 22, 2021 at 04:44:47PM +0200, Oskari Lemmelä wrote:
> Hi,
> 
> On 21.3.2021 11.55, Paul Spooren wrote:
> > On Sat Mar 20, 2021 at 10:58 PM HST, Oskari Lemmela wrote:
> > > Add possibility to use images and initramfs in artifacts.
> > > 
> > > Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
> > > ---
> > Hi, could you please elaborate on your use-case?
> 
> One use case is build full sdcard image for Bananapi R64.
> 
> Currently fit and initramfs images need to be copied over
> tftp/serial after booting from sdcard.

You can also just append the initramfs to the sdcard image, btw.
With these changes things will become easier and more accessible
to users who don't know how to use 'dd'.

Are you planning to also post a patch to make use of this change
to generate a full SD card image (ie. incl. initramfs as well as
sysupgrade image)?


Cheers


Daniel


> 
> Oskari
> 
> > 
> > > include/image.mk | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/include/image.mk b/include/image.mk
> > > index 29df0938bc..8b7b2b9740 100644
> > > --- a/include/image.mk
> > > +++ b/include/image.mk
> > > @@ -478,6 +478,7 @@ define Device/Build/initramfs
> > > $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO),
> > > $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,))
> > > $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
> > > + $(1)-images: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
> > > $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE):
> > > $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
> > > cp $$^ $$@
> > > @@ -570,6 +571,7 @@ define Device/Build/image
> > > $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
> > > $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
> > > $(eval $(call Device/Export,$(KDIR)/tmp/$(call
> > > DEVICE_IMG_NAME,$(1),$(2)),$(1)))
> > > + $(3)-images: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)
> > > ROOTFS/$(1)/$(3) := \
> > > $(KDIR)/root.$(1)$$(strip \
> > > @@ -628,7 +630,7 @@ endef
> > > define Device/Build/artifact
> > > $$(_TARGET): $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)
> > > $(eval $(call Device/Export,$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1)))
> > > - $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE)
> > > + $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE)
> > > $(2)-images
> > > @rm -f $$@
> > > $$(call concat_cmd,$(ARTIFACT/$(1)))
> > > @@ -651,7 +653,7 @@ define Device/Build
> > > $$(call Device/Build/image,$$(fs),$$(image),$(1)))))
> > > $$(eval $$(foreach artifact,$$(ARTIFACTS), \
> > > - $$(call Device/Build/artifact,$$(artifact))))
> > > + $$(call Device/Build/artifact,$$(artifact),$(1))))
> > > endef
> > > --
> > > 2.25.1
> > > 
> > > 
> > > _______________________________________________
> > > 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 29df0938bc..8b7b2b9740 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -478,6 +478,7 @@  define Device/Build/initramfs
 	  $$(if $$(CONFIG_JSON_OVERVIEW_IMAGE_INFO), $(BUILD_DIR)/json_info_files/$$(KERNEL_INITRAMFS_IMAGE).json,))
 
   $(KDIR)/$$(KERNEL_INITRAMFS_NAME):: image_prepare
+  $(1)-images: $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE)
   $(BIN_DIR)/$$(KERNEL_INITRAMFS_IMAGE): $(KDIR)/tmp/$$(KERNEL_INITRAMFS_IMAGE)
 	cp $$^ $$@
 
@@ -570,6 +571,7 @@  define Device/Build/image
 	  $(BUILD_DIR)/json_info_files/$(call DEVICE_IMG_NAME,$(1),$(2)).json, \
 	  $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX))
   $(eval $(call Device/Export,$(KDIR)/tmp/$(call DEVICE_IMG_NAME,$(1),$(2)),$(1)))
+  $(3)-images: $(BIN_DIR)/$(call DEVICE_IMG_NAME,$(1),$(2))$$(GZ_SUFFIX)
 
   ROOTFS/$(1)/$(3) := \
 	$(KDIR)/root.$(1)$$(strip \
@@ -628,7 +630,7 @@  endef
 define Device/Build/artifact
   $$(_TARGET): $(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(1)
   $(eval $(call Device/Export,$(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1)))
-  $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE)
+  $(KDIR)/tmp/$(DEVICE_IMG_PREFIX)-$(1): $$(KDIR_KERNEL_IMAGE) $(2)-images
 	@rm -f $$@
 	$$(call concat_cmd,$(ARTIFACT/$(1)))
 
@@ -651,7 +653,7 @@  define Device/Build
       $$(call Device/Build/image,$$(fs),$$(image),$(1)))))
 
   $$(eval $$(foreach artifact,$$(ARTIFACTS), \
-    $$(call Device/Build/artifact,$$(artifact))))
+    $$(call Device/Build/artifact,$$(artifact),$(1))))
 
 endef