* [ptxdist] [PATCH v3 1/3] kernel: add make target for the installed device trees
@ 2023-09-12 16:57 Roland Hieber
2023-09-12 16:57 ` [ptxdist] [PATCH v3 2/3] templates: add template for custom FIT images Roland Hieber
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Roland Hieber @ 2023-09-12 16:57 UTC (permalink / raw)
To: ptxdist; +Cc: Roland Hieber
This makes it easy to depend on the kernel.targetinstall stage by
depending on one of the .dtb's that it installs into the image dir, e.g.
when building a custom recipe for a FIT image. As a nice side-effect,
you can simply call "ptxdist image <board.dtb>" to build the device
tree.
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
PATCH v3:
* do the same for the kernel template
PATCH v2: https://lore.ptxdist.org/ptxdist/20230831104425.2874985-1-rhi@pengutronix.de
* change ifneq syntax
PATCH v1: https://lore.ptxdist.org/ptxdist/20230822121234.2040303-1-rhi@pengutronix.de
---
rules/kernel.make | 4 ++++
rules/templates/template-kernel-make | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/rules/kernel.make b/rules/kernel.make
index 59ecdf19973f..7b1c663ffb7d 100644
--- a/rules/kernel.make
+++ b/rules/kernel.make
@@ -283,6 +283,10 @@ endif
# Target-Install
# ----------------------------------------------------------------------------
+ifneq ($(KERNEL_DTB_FILES),)
+$(addprefix $(IMAGEDIR)/,$(KERNEL_DTB_FILES)): $(STATEDIR)/kernel.targetinstall
+endif
+
$(STATEDIR)/kernel.targetinstall:
@$(call targetinfo)
diff --git a/rules/templates/template-kernel-make b/rules/templates/template-kernel-make
index c5f0c9303b51..cd1b717c51ba 100644
--- a/rules/templates/template-kernel-make
+++ b/rules/templates/template-kernel-make
@@ -106,6 +106,10 @@ $(STATEDIR)/kernel-@package@.install:
# Target-Install
# ----------------------------------------------------------------------------
+ifneq ($(KERNEL_@PACKAGE@_DTB_FILES),)
+$(addprefix $(IMAGEDIR)/,$(KERNEL_@PACKAGE@_DTB_FILES)): $(STATEDIR)/kernel-@package@.targetinstall
+endif
+
$(STATEDIR)/kernel-@package@.targetinstall:
@$(call targetinfo)
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ptxdist] [PATCH v3 2/3] templates: add template for custom FIT images
2023-09-12 16:57 [ptxdist] [PATCH v3 1/3] kernel: add make target for the installed device trees Roland Hieber
@ 2023-09-12 16:57 ` Roland Hieber
2023-09-24 5:44 ` [ptxdist] [APPLIED] " Michael Olbrich
2023-09-12 16:57 ` [ptxdist] [PATCH v3 3/3] doc: ref_make_macros: document world/image-fit macro Roland Hieber
2023-09-24 5:44 ` [ptxdist] [APPLIED] kernel: add make target for the installed device trees Michael Olbrich
2 siblings, 1 reply; 6+ messages in thread
From: Roland Hieber @ 2023-09-12 16:57 UTC (permalink / raw)
To: ptxdist; +Cc: Roland Hieber
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
PATCH v3:
* select kernel and initrd image by default instead of TODO comments
* select HOST_U_BOOT_TOOLS for mkimage (previously a fixup patch)
PATCH v2: https://lore.ptxdist.org/ptxdist/20230831104425.2874985-2-rhi@pengutronix.de
* no change
PATCH v1: https://lore.ptxdist.org/ptxdist/20230822121234.2040303-2-rhi@pengutronix.de
---
rules/templates/template-image-fit-in | 10 ++++++++
rules/templates/template-image-fit-make | 34 +++++++++++++++++++++++++
scripts/lib/ptxd_lib_template.sh | 25 ++++++++++++++++++
3 files changed, 69 insertions(+)
create mode 100644 rules/templates/template-image-fit-in
create mode 100644 rules/templates/template-image-fit-make
diff --git a/rules/templates/template-image-fit-in b/rules/templates/template-image-fit-in
new file mode 100644
index 000000000000..1a89153fc185
--- /dev/null
+++ b/rules/templates/template-image-fit-in
@@ -0,0 +1,10 @@
+## SECTION=image
+
+config IMAGE_@PACKAGE@
+ tristate
+ select HOST_U_BOOT_TOOLS
+ @select_CODE_SIGNING@select IMAGE_KERNEL
+ select IMAGE_ROOT_CPIO
+ prompt "Generate images/@package@.fit"
+ help
+ FIXME
diff --git a/rules/templates/template-image-fit-make b/rules/templates/template-image-fit-make
new file mode 100644
index 000000000000..cd57d24df76c
--- /dev/null
+++ b/rules/templates/template-image-fit-make
@@ -0,0 +1,34 @@
+# -*-makefile-*-
+#
+# Copyright (C) @YEAR@ by @AUTHOR@
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+IMAGE_PACKAGES-$(PTXCONF_IMAGE_@PACKAGE@) += image-@package@
+
+#
+# Paths and names
+#
+IMAGE_@PACKAGE@ := image-@package@
+IMAGE_@PACKAGE@_DIR := $(BUILDDIR)/$(IMAGE_@PACKAGE@)
+IMAGE_@PACKAGE@_IMAGE := $(IMAGEDIR)/@package@.fit
+IMAGE_@PACKAGE@_VERSION := ${PTXCONF_PROJECT_VERSION}
+IMAGE_@PACKAGE@_KERNEL = $(IMAGE_KERNEL_IMAGE)
+IMAGE_@PACKAGE@_DTB = # TODO: $(IMAGEDIR)/your-board.dtb
+IMAGE_@PACKAGE@_INITRAMFS = $(IMAGE_ROOT_CPIO_IMAGE)
+@CODE_SIGNING_VARS@
+# ----------------------------------------------------------------------------
+# Image
+# ----------------------------------------------------------------------------
+
+$(IMAGE_@PACKAGE@_IMAGE): $(IMAGE_@PACKAGE@_KERNEL) $(IMAGE_@PACKAGE@_INITRAMFS) $(IMAGE_@PACKAGE@_DTB)
+ @$(call targetinfo)
+ @$(call world/image-fit, IMAGE_@PACKAGE@)
+ @$(call finish)
+
+# vim: syntax=make
diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh
index 30cc48d6c9b0..f8f188e148ac 100644
--- a/scripts/lib/ptxd_lib_template.sh
+++ b/scripts/lib/ptxd_lib_template.sh
@@ -598,6 +598,31 @@ export -f ptxd_template_new_image_tgz
ptxd_template_help_list[${#ptxd_template_help_list[@]}]="image-tgz"
ptxd_template_help_list[${#ptxd_template_help_list[@]}]="create package for a tgz image"
+ptxd_template_new_image_fit() {
+ export class="image-"
+ ptxd_template_read_name &&
+ ptxd_template_read_author &&
+ ptxd_template_read "sign FIT image? (y/N)" SIGN
+ case "$SIGN" in
+ y*|Y*)
+ export select_CODE_SIGNING="select CODE_SIGNING
+ "
+ export CODE_SIGNING_VARS="
+IMAGE_@PACKAGE@_SIGN_ROLE := # TODO: role name of the code signing provider, passed to cs_get_uri
+IMAGE_@PACKAGE@_KEY_NAME_HINT := # TODO: key-name-hint property in the signature node of the FIT image
+"
+ ;;
+ *)
+ export select_CODE_SIGNING=""
+ export CODE_SIGNING_VARS=""
+ ;;
+ esac
+ ptxd_template_write_platform_rules
+}
+export -f ptxd_template_new_image_fit
+ptxd_template_help_list[${#ptxd_template_help_list[@]}]="image-fit"
+ptxd_template_help_list[${#ptxd_template_help_list[@]}]="create package for a FIT image"
+
ptxd_template_new_image_genimage() {
export class="image-"
ptxd_template_read_name &&
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [APPLIED] templates: add template for custom FIT images
2023-09-12 16:57 ` [ptxdist] [PATCH v3 2/3] templates: add template for custom FIT images Roland Hieber
@ 2023-09-24 5:44 ` Michael Olbrich
0 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2023-09-24 5:44 UTC (permalink / raw)
To: ptxdist; +Cc: Roland Hieber
Thanks, applied as c9659e6c318f1291186316c98bfcf1bcd047cdca.
Michael
[sent from post-receive hook]
On Sun, 24 Sep 2023 07:44:07 +0200, Roland Hieber <rhi@pengutronix.de> wrote:
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> Message-Id: <20230912165759.3492269-2-rhi@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> diff --git a/rules/templates/template-image-fit-in b/rules/templates/template-image-fit-in
> new file mode 100644
> index 000000000000..1a89153fc185
> --- /dev/null
> +++ b/rules/templates/template-image-fit-in
> @@ -0,0 +1,10 @@
> +## SECTION=image
> +
> +config IMAGE_@PACKAGE@
> + tristate
> + select HOST_U_BOOT_TOOLS
> + @select_CODE_SIGNING@select IMAGE_KERNEL
> + select IMAGE_ROOT_CPIO
> + prompt "Generate images/@package@.fit"
> + help
> + FIXME
> diff --git a/rules/templates/template-image-fit-make b/rules/templates/template-image-fit-make
> new file mode 100644
> index 000000000000..cd57d24df76c
> --- /dev/null
> +++ b/rules/templates/template-image-fit-make
> @@ -0,0 +1,34 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) @YEAR@ by @AUTHOR@
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +IMAGE_PACKAGES-$(PTXCONF_IMAGE_@PACKAGE@) += image-@package@
> +
> +#
> +# Paths and names
> +#
> +IMAGE_@PACKAGE@ := image-@package@
> +IMAGE_@PACKAGE@_DIR := $(BUILDDIR)/$(IMAGE_@PACKAGE@)
> +IMAGE_@PACKAGE@_IMAGE := $(IMAGEDIR)/@package@.fit
> +IMAGE_@PACKAGE@_VERSION := ${PTXCONF_PROJECT_VERSION}
> +IMAGE_@PACKAGE@_KERNEL = $(IMAGE_KERNEL_IMAGE)
> +IMAGE_@PACKAGE@_DTB = # TODO: $(IMAGEDIR)/your-board.dtb
> +IMAGE_@PACKAGE@_INITRAMFS = $(IMAGE_ROOT_CPIO_IMAGE)
> +@CODE_SIGNING_VARS@
> +# ----------------------------------------------------------------------------
> +# Image
> +# ----------------------------------------------------------------------------
> +
> +$(IMAGE_@PACKAGE@_IMAGE): $(IMAGE_@PACKAGE@_KERNEL) $(IMAGE_@PACKAGE@_INITRAMFS) $(IMAGE_@PACKAGE@_DTB)
> + @$(call targetinfo)
> + @$(call world/image-fit, IMAGE_@PACKAGE@)
> + @$(call finish)
> +
> +# vim: syntax=make
> diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh
> index 30cc48d6c9b0..f8f188e148ac 100644
> --- a/scripts/lib/ptxd_lib_template.sh
> +++ b/scripts/lib/ptxd_lib_template.sh
> @@ -598,6 +598,31 @@ export -f ptxd_template_new_image_tgz
> ptxd_template_help_list[${#ptxd_template_help_list[@]}]="image-tgz"
> ptxd_template_help_list[${#ptxd_template_help_list[@]}]="create package for a tgz image"
>
> +ptxd_template_new_image_fit() {
> + export class="image-"
> + ptxd_template_read_name &&
> + ptxd_template_read_author &&
> + ptxd_template_read "sign FIT image? (y/N)" SIGN
> + case "$SIGN" in
> + y*|Y*)
> + export select_CODE_SIGNING="select CODE_SIGNING
> + "
> + export CODE_SIGNING_VARS="
> +IMAGE_@PACKAGE@_SIGN_ROLE := # TODO: role name of the code signing provider, passed to cs_get_uri
> +IMAGE_@PACKAGE@_KEY_NAME_HINT := # TODO: key-name-hint property in the signature node of the FIT image
> +"
> + ;;
> + *)
> + export select_CODE_SIGNING=""
> + export CODE_SIGNING_VARS=""
> + ;;
> + esac
> + ptxd_template_write_platform_rules
> +}
> +export -f ptxd_template_new_image_fit
> +ptxd_template_help_list[${#ptxd_template_help_list[@]}]="image-fit"
> +ptxd_template_help_list[${#ptxd_template_help_list[@]}]="create package for a FIT image"
> +
> ptxd_template_new_image_genimage() {
> export class="image-"
> ptxd_template_read_name &&
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ptxdist] [PATCH v3 3/3] doc: ref_make_macros: document world/image-fit macro
2023-09-12 16:57 [ptxdist] [PATCH v3 1/3] kernel: add make target for the installed device trees Roland Hieber
2023-09-12 16:57 ` [ptxdist] [PATCH v3 2/3] templates: add template for custom FIT images Roland Hieber
@ 2023-09-12 16:57 ` Roland Hieber
2023-09-24 5:44 ` [ptxdist] [APPLIED] " Michael Olbrich
2023-09-24 5:44 ` [ptxdist] [APPLIED] kernel: add make target for the installed device trees Michael Olbrich
2 siblings, 1 reply; 6+ messages in thread
From: Roland Hieber @ 2023-09-12 16:57 UTC (permalink / raw)
To: ptxdist; +Cc: Roland Hieber
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
PATCH v3: no change
PATCH v2: no change
PATCH v1: https://lore.ptxdist.org/ptxdist/20230822121234.2040303-3-rhi@pengutronix.de
---
doc/ref_make_macros.rst | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/doc/ref_make_macros.rst b/doc/ref_make_macros.rst
index b8cfe9eff644..fe300c45757a 100644
--- a/doc/ref_make_macros.rst
+++ b/doc/ref_make_macros.rst
@@ -175,6 +175,44 @@ omitted.
``ptx/image-install-link`` creates a symlink in the image directory.
+.. _world_image_fit:
+
+world/image-fit
+~~~~~~~~~~~~~~~
+
+.. code-block:: none
+
+ @$(call world/image-fit, <PKG>)
+
+Build a FIT image containing a kernel, optionally an initial ramdisk, and one or
+multiple device trees. For each device tree, a configuration node is generated.
+
+.. note:: You can generate a template for a new FIT image recipe by
+ calling ``ptxdist newpackage image-fit``.
+
+The following variables are respected:
+
+``<PKG>_IMAGE``
+ The output file, usually something like ``$(IMAGEDIR)/pkg.fit``.
+
+``<PKG>_KERNEL``
+ The kernel image to package into the FIT image.
+
+``<PKG>_DTB``
+ One or more device trees that should be included in the FIT image.
+
+``<PKG>_INITRAMFS``
+ If the FIT image should contain an initial ramdisk, this variable determines
+ the initrd file name that is included. Otherwise it can be left empty.
+
+``<PKG>_SIGN_ROLE``
+ If the FIT image should be signed, this variable determines the role name
+ used for the signature. It is passed to :ref:`cs_get_uri`.
+
+``<PKG>_KEY_NAME_HINT``
+ If the FIT image should be signed, this variable determines the
+ *key-name-hint* property of the signature node.
+
.. _install_copy:
install_copy
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [APPLIED] doc: ref_make_macros: document world/image-fit macro
2023-09-12 16:57 ` [ptxdist] [PATCH v3 3/3] doc: ref_make_macros: document world/image-fit macro Roland Hieber
@ 2023-09-24 5:44 ` Michael Olbrich
0 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2023-09-24 5:44 UTC (permalink / raw)
To: ptxdist; +Cc: Roland Hieber
Thanks, applied as bf4292a7b34731ab8fb45a316c6a2215ddef26aa.
Michael
[sent from post-receive hook]
On Sun, 24 Sep 2023 07:44:08 +0200, Roland Hieber <rhi@pengutronix.de> wrote:
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> Message-Id: <20230912165759.3492269-3-rhi@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> diff --git a/doc/ref_make_macros.rst b/doc/ref_make_macros.rst
> index b8cfe9eff644..fe300c45757a 100644
> --- a/doc/ref_make_macros.rst
> +++ b/doc/ref_make_macros.rst
> @@ -175,6 +175,44 @@ omitted.
>
> ``ptx/image-install-link`` creates a symlink in the image directory.
>
> +.. _world_image_fit:
> +
> +world/image-fit
> +~~~~~~~~~~~~~~~
> +
> +.. code-block:: none
> +
> + @$(call world/image-fit, <PKG>)
> +
> +Build a FIT image containing a kernel, optionally an initial ramdisk, and one or
> +multiple device trees. For each device tree, a configuration node is generated.
> +
> +.. note:: You can generate a template for a new FIT image recipe by
> + calling ``ptxdist newpackage image-fit``.
> +
> +The following variables are respected:
> +
> +``<PKG>_IMAGE``
> + The output file, usually something like ``$(IMAGEDIR)/pkg.fit``.
> +
> +``<PKG>_KERNEL``
> + The kernel image to package into the FIT image.
> +
> +``<PKG>_DTB``
> + One or more device trees that should be included in the FIT image.
> +
> +``<PKG>_INITRAMFS``
> + If the FIT image should contain an initial ramdisk, this variable determines
> + the initrd file name that is included. Otherwise it can be left empty.
> +
> +``<PKG>_SIGN_ROLE``
> + If the FIT image should be signed, this variable determines the role name
> + used for the signature. It is passed to :ref:`cs_get_uri`.
> +
> +``<PKG>_KEY_NAME_HINT``
> + If the FIT image should be signed, this variable determines the
> + *key-name-hint* property of the signature node.
> +
> .. _install_copy:
>
> install_copy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [APPLIED] kernel: add make target for the installed device trees
2023-09-12 16:57 [ptxdist] [PATCH v3 1/3] kernel: add make target for the installed device trees Roland Hieber
2023-09-12 16:57 ` [ptxdist] [PATCH v3 2/3] templates: add template for custom FIT images Roland Hieber
2023-09-12 16:57 ` [ptxdist] [PATCH v3 3/3] doc: ref_make_macros: document world/image-fit macro Roland Hieber
@ 2023-09-24 5:44 ` Michael Olbrich
2 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2023-09-24 5:44 UTC (permalink / raw)
To: ptxdist; +Cc: Roland Hieber
Thanks, applied as 7205e52a301ce552aa5a5c1a5e257b1609822b80.
Michael
[sent from post-receive hook]
On Sun, 24 Sep 2023 07:44:05 +0200, Roland Hieber <rhi@pengutronix.de> wrote:
> This makes it easy to depend on the kernel.targetinstall stage by
> depending on one of the .dtb's that it installs into the image dir, e.g.
> when building a custom recipe for a FIT image. As a nice side-effect,
> you can simply call "ptxdist image <board.dtb>" to build the device
> tree.
>
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> Message-Id: <20230912165759.3492269-1-rhi@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> diff --git a/rules/kernel.make b/rules/kernel.make
> index 3d200eaecfee..d82aa27fb78e 100644
> --- a/rules/kernel.make
> +++ b/rules/kernel.make
> @@ -283,6 +283,10 @@ endif
> # Target-Install
> # ----------------------------------------------------------------------------
>
> +ifneq ($(KERNEL_DTB_FILES),)
> +$(addprefix $(IMAGEDIR)/,$(KERNEL_DTB_FILES)): $(STATEDIR)/kernel.targetinstall
> +endif
> +
> $(STATEDIR)/kernel.targetinstall:
> @$(call targetinfo)
>
> diff --git a/rules/templates/template-kernel-make b/rules/templates/template-kernel-make
> index c5f0c9303b51..cd1b717c51ba 100644
> --- a/rules/templates/template-kernel-make
> +++ b/rules/templates/template-kernel-make
> @@ -106,6 +106,10 @@ $(STATEDIR)/kernel-@package@.install:
> # Target-Install
> # ----------------------------------------------------------------------------
>
> +ifneq ($(KERNEL_@PACKAGE@_DTB_FILES),)
> +$(addprefix $(IMAGEDIR)/,$(KERNEL_@PACKAGE@_DTB_FILES)): $(STATEDIR)/kernel-@package@.targetinstall
> +endif
> +
> $(STATEDIR)/kernel-@package@.targetinstall:
> @$(call targetinfo)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-24 5:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12 16:57 [ptxdist] [PATCH v3 1/3] kernel: add make target for the installed device trees Roland Hieber
2023-09-12 16:57 ` [ptxdist] [PATCH v3 2/3] templates: add template for custom FIT images Roland Hieber
2023-09-24 5:44 ` [ptxdist] [APPLIED] " Michael Olbrich
2023-09-12 16:57 ` [ptxdist] [PATCH v3 3/3] doc: ref_make_macros: document world/image-fit macro Roland Hieber
2023-09-24 5:44 ` [ptxdist] [APPLIED] " Michael Olbrich
2023-09-24 5:44 ` [ptxdist] [APPLIED] kernel: add make target for the installed device trees Michael Olbrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox