diff mbox series

[meta-swupdate-boards,v2,3/3] core-image: add example for .swu image generation

Message ID 20210216095258.514-4-agust@denx.de
State Changes Requested
Headers show
Series Extend swupdate class to support swu image fstype | expand

Commit Message

Anatolij Gustschin Feb. 16, 2021, 9:52 a.m. UTC
Extend core-image-full-cmdline with options for building
.swu images.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 .../images/core-image-full-cmdline.bbappend   | 28 ++++++++
 .../wandboard/emmcsetup.lua                   | 12 ++++
 .../wandboard/sw-description                  | 71 +++++++++++++++++++
 3 files changed, 111 insertions(+)
 create mode 100644 recipes-extended/images/core-image-full-cmdline.bbappend
 create mode 100644 recipes-extended/images/core-image-full-cmdline/wandboard/emmcsetup.lua
 create mode 100644 recipes-extended/images/core-image-full-cmdline/wandboard/sw-description
diff mbox series

Patch

diff --git a/recipes-extended/images/core-image-full-cmdline.bbappend b/recipes-extended/images/core-image-full-cmdline.bbappend
new file mode 100644
index 0000000..dcca4ef
--- /dev/null
+++ b/recipes-extended/images/core-image-full-cmdline.bbappend
@@ -0,0 +1,28 @@ 
+# Extensions for core-image-full-cmdline image recipe
+# to generate .swu image using swupdate class
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+inherit image_types_swu
+
+SRC_URI_wandboard = " \
+	file://emmcsetup.lua \
+	file://sw-description \
+"
+
+# Uncomment below line to enable .swu image generation
+#IMAGE_FSTYPES_wandboard += "ext4.gz swu"
+
+# remove comment when configuring to generate ext4.gz.enc or
+# ext4.gz.enc.swu images and add a key to the build directory
+# as "conf/enc.key"
+#SWUPDATE_AES_FILE = "${TOPDIR}/conf/enc.key"
+
+#SWUPDATE_IMAGES_FSTYPES[core-image-full-cmdline] = ".ext4.gz.enc"
+SWUPDATE_IMAGES_FSTYPES[core-image-full-cmdline] = ".ext4.gz"
+
+# images to build before building swupdate image
+IMAGE_DEPENDS = "core-image-full-cmdline"
+
+# images and files that will be included in the .swu image
+SWUPDATE_IMAGES = "core-image-full-cmdline"
diff --git a/recipes-extended/images/core-image-full-cmdline/wandboard/emmcsetup.lua b/recipes-extended/images/core-image-full-cmdline/wandboard/emmcsetup.lua
new file mode 100644
index 0000000..58a7832
--- /dev/null
+++ b/recipes-extended/images/core-image-full-cmdline/wandboard/emmcsetup.lua
@@ -0,0 +1,12 @@ 
+function preinst()
+	local out = "Post installed script called"
+
+	return true, out
+
+end
+
+function postinst()
+	local out = "Post installed script called"
+
+	return true, out
+end
diff --git a/recipes-extended/images/core-image-full-cmdline/wandboard/sw-description b/recipes-extended/images/core-image-full-cmdline/wandboard/sw-description
new file mode 100644
index 0000000..b3598fc
--- /dev/null
+++ b/recipes-extended/images/core-image-full-cmdline/wandboard/sw-description
@@ -0,0 +1,71 @@ 
+software =
+{
+	version = "@@DISTRO_VERSION@@";
+
+	@@MACHINE@@ = {
+		hardware-compatibility: [ "revB", "revC", "revD"];
+		stable : {
+			copy1 : {
+				images: (
+					{
+						filename = "@@IMAGE_LINK_NAME@@.ext4.gz";
+						type = "raw";
+						compressed = true;
+						device = "/dev/mmcblk2p1";
+					}
+				);
+				scripts: (
+					{
+						filename = "emmcsetup.lua";
+						type = "lua";
+					}
+				);
+                                uboot: (
+					{
+						name = "rootpart";
+						value = "1";
+					},
+					{
+						name = "finduuid";
+						value = "part uuid mmc 0:${rootpart} uuid";
+					},
+					{
+						name = "scan_dev_for_boot_part";
+						value = "setenv devplist ${rootpart};for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done";
+					}
+				);
+
+			};
+			copy2 : {
+				images: (
+					{
+						filename = "@@IMAGE_LINK_NAME@@.ext4.gz";
+						type = "raw";
+						compressed = true;
+						device = "/dev/mmcblk2p2";
+					}
+				);
+				scripts: (
+					{
+						filename = "emmcsetup.lua";
+						type = "lua";
+					}
+				);
+				uboot: (
+					{
+						name = "rootpart";
+						value = "2";
+					},
+					{
+						name = "finduuid";
+						value = "part uuid mmc 0:${rootpart} uuid";
+					},
+					{
+						name = "scan_dev_for_boot_part";
+						value = "setenv devplist ${rootpart};for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done";
+					}
+				);
+			};
+		};
+	}
+}