This adds a default image recipe for building a RAUC update Bundle out of the
systems rootfs.

In order to sign your update (mandatory) you need to place a valid certificate
and key file in your BSP. Their location is
default they are currently expected to be located at:

  $(PTXDIST_PLATFORMCONFIGDIR)/config/rauc/rauc.key.pem (key)
  $(PTXDIST_PLATFORMCONFIGDIR)/config/rauc/rauc.cert.pem (cert)

PTXdist will then create the bundle during a run of `ptxdist images`.

Signed-off-by: Enrico Jorns <e...@pengutronix.de>
---
 config/images/rauc.config | 17 ++++++++++++
 platforms/image-rauc.in   | 28 +++++++++++++++++++
 rules/image-rauc.make     | 69 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 114 insertions(+)
 create mode 100644 config/images/rauc.config
 create mode 100644 platforms/image-rauc.in
 create mode 100644 rules/image-rauc.make

diff --git a/config/images/rauc.config b/config/images/rauc.config
new file mode 100644
index 000000000..fb43c7efb
--- /dev/null
+++ b/config/images/rauc.config
@@ -0,0 +1,17 @@
+image update.raucb {
+       rauc {
+               file root.tar.gz { image = "root.tgz" }
+               manifest = "
+                       [update]
+                       compatible=@RAUC_BUNDLE_COMPATIBLE@
+                       version=@RAUC_BUNDLE_VERSION@
+                       build=@RAUC_BUNDLE_BUILD@
+                       description=@RAUC_BUNDLE_DESCRIPTION@
+
+                       [image.rootfs]
+                       filename=root.tar.gz
+                       "
+               cert = "@RAUC_CERT@"
+               key = "@RAUC_KEY@"
+       }
+}
diff --git a/platforms/image-rauc.in b/platforms/image-rauc.in
new file mode 100644
index 000000000..71c6898ba
--- /dev/null
+++ b/platforms/image-rauc.in
@@ -0,0 +1,28 @@
+## SECTION=image2
+
+menuconfig IMAGE_RAUC
+       tristate
+       prompt "Generate RAUC Update Bundle"
+       select HOST_GENIMAGE
+       select HOST_RAUC
+       select IMAGE_ROOT_TGZ
+       help
+         This generates a RAUC update Bundle for the selected platform using
+         genimage.
+
+         By default, this will create a simple Bundle for updating a 'rootfs'
+         slot with the content from PTXdist's root file system .tgz image.
+
+         To customize the bundle, copy and adapt the genimage configuration
+         file rauc.config.
+
+if IMAGE_RAUC
+
+config IMAGE_RAUC_DESCRIPTION
+       prompt "RAUC Bundle Description"
+       string
+       default ""
+       help
+         Optional description that will be placed in the Bundles metadata.
+
+endif
diff --git a/rules/image-rauc.make b/rules/image-rauc.make
new file mode 100644
index 000000000..5f34909de
--- /dev/null
+++ b/rules/image-rauc.make
@@ -0,0 +1,69 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2017 by Enrico Joerns <e.joe...@pengutronix.de>
+# Copyright (C) 2016 by Michael Olbrich <m.olbr...@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+IMAGE_PACKAGES-$(PTXCONF_IMAGE_RAUC) += image-rauc
+
+#
+# Paths and names
+#
+IMAGE_RAUC             := image-rauc
+IMAGE_RAUC_DIR         := $(BUILDDIR)/$(IMAGE_RAUC)
+IMAGE_RAUC_IMAGE       := $(IMAGEDIR)/update.raucb
+IMAGE_RAUC_CONFIG      := rauc.config
+
+# ----------------------------------------------------------------------------
+# Image
+# ----------------------------------------------------------------------------
+
+IMAGE_RAUC_KEY = $(PTXDIST_PLATFORMCONFIGDIR)/config/rauc/rauc.key.pem
+IMAGE_RAUC_CERT = $(PTXDIST_PLATFORMCONFIGDIR)/config/rauc/rauc.cert.pem
+
+IMAGE_RAUC_ENV := \
+       RAUC_BUNDLE_COMPATIBLE=$(PTXCONF_RAUC_COMPATIBLE) \
+       RAUC_BUNDLE_VERSION=$(PTXDIST_BSP_AUTOVERSION) \
+       RAUC_BUNDLE_BUILD=$(shell date +%FT%T%z) \
+       RAUC_BUNDLE_DESCRIPTION=$(PTXCONF_IMAGE_RAUC_DESCRIPTION) \
+       RAUC_KEY=$(IMAGE_RAUC_KEY) \
+       RAUC_CERT=$(IMAGE_RAUC_CERT)
+
+$(IMAGE_RAUC_IMAGE): $(IMAGE_RAUC_KEY) $(IMAGE_RAUC_CERT)
+       @$(call targetinfo)
+       @$(call image/genimage, IMAGE_RAUC)
+       @$(call finish)
+
+$(IMAGE_RAUC_KEY):
+       @echo
+       @echo 
"****************************************************************************"
+       @echo "******** Please place your signing key in 
config/rauc/rauc.key.pem. ********"
+       @echo "*                                                                
          *"
+       @echo "* Note: For test-purpose you can create one by running 
rauc-gen-certs.sh   *"
+       @echo "*       from the scripts/ folder of your PTXdist installation    
          *"
+       @echo 
"****************************************************************************"
+       @echo
+       @echo
+       @exit 1
+
+$(IMAGE_RAUC_CERT):
+       @echo
+       @echo 
"****************************************************************************"
+       @echo "**** Please place your signing certificate in 
config/rauc/rauc.cert.pem. ***"
+       @echo "*                                                                
          *"
+       @echo "* Note: For test-purpose you can create one by running 
rauc-gen-certs.sh   *"
+       @echo "*       from the scripts/ folder of your PTXdist installation    
          *"
+       @echo 
"****************************************************************************"
+       @echo
+       @echo
+       @exit 1
+
+# vim: syntax=make
-- 
2.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to