public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v4 0/5] UBI support
@ 2019-02-05 11:59 claudius.heine.ext
  2019-02-05 11:59 ` [PATCH v4 1/5] doc/user: added targz-img to image type list claudius.heine.ext
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: claudius.heine.ext @ 2019-02-05 11:59 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

Hi,

forth version of the UBI support for isar.

Claudius

Changes from v3:

 - Moved dtb copy function into main `do_copy_boot_files` (feedback from
   Henning)
 - some minor fixes

Changes from v2:

 - added fit image support patch
 - moved to new templating system
 - refactored `copy_boot_files` of isar-image-ubi

Changes from v1:
 
 - fixed license header
 - removed ubifs test since it is included in the ubi test
 - merged ubifs and ubi patchset
 - renamed qemusabrelite to nand-ubi-demo
 - added nand-ubi-demo to ci build
 - added some entries for ubi/ubifs support in manual

Claudius Heine (5):
  doc/user: added targz-img to image type list
  meta/classes: added ubifs-img class
  meta/classes: added ubi-img class
  meta/classes: added fit-img class for creation of fit images
  meta-isar: added nand-ubi-demo example to demonstrate UBI use

 doc/user_manual.md                            |  6 +-
 meta-isar/classes/ubi-ubifs-img.bbclass       | 10 ++++
 meta-isar/conf/local.conf.sample              |  1 +
 meta-isar/conf/machine/nand-ubi-demo.conf     | 13 +++++
 .../multiconfig/nand-ubi-demo-buster.conf     | 13 +++++
 .../images/files/fitimage.its.tmpl            | 58 +++++++++++++++++++
 .../images/files/ubinize.cfg.tmpl             | 17 ++++++
 .../recipes-core/images/isar-image-ubi.bb     | 26 +++++++++
 meta/classes/fit-img.bbclass                  | 49 ++++++++++++++++
 meta/classes/image.bbclass                    | 14 ++++-
 meta/classes/ubi-img.bbclass                  | 52 +++++++++++++++++
 meta/classes/ubifs-img.bbclass                | 44 ++++++++++++++
 scripts/ci_build.sh                           |  1 +
 13 files changed, 302 insertions(+), 2 deletions(-)
 create mode 100644 meta-isar/classes/ubi-ubifs-img.bbclass
 create mode 100644 meta-isar/conf/machine/nand-ubi-demo.conf
 create mode 100644 meta-isar/conf/multiconfig/nand-ubi-demo-buster.conf
 create mode 100644 meta-isar/recipes-core/images/files/fitimage.its.tmpl
 create mode 100644 meta-isar/recipes-core/images/files/ubinize.cfg.tmpl
 create mode 100644 meta-isar/recipes-core/images/isar-image-ubi.bb
 create mode 100644 meta/classes/fit-img.bbclass
 create mode 100644 meta/classes/ubi-img.bbclass
 create mode 100644 meta/classes/ubifs-img.bbclass

-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 1/5] doc/user: added targz-img to image type list
  2019-02-05 11:59 [PATCH v4 0/5] UBI support claudius.heine.ext
@ 2019-02-05 11:59 ` claudius.heine.ext
  2019-02-05 11:59 ` [PATCH v4 2/5] meta/classes: added ubifs-img class claudius.heine.ext
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: claudius.heine.ext @ 2019-02-05 11:59 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

Signed-off-by: Claudius Heine <ch@denx.de>
---
 doc/user_manual.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/user_manual.md b/doc/user_manual.md
index eebcaa9..c4fe42a 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -471,10 +471,11 @@ IMAGE_TYPE = "my-image"
 
 ### Reference Classes
 
-Isar contains three image type classes that can be used as reference:
+Isar contains additional image type classes that can be used as reference:
 
  - `ext4-img`
  - `rpi-sdimg`
+ - `targz-img`
  - `wic-img`
 
 ---
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 2/5] meta/classes: added ubifs-img class
  2019-02-05 11:59 [PATCH v4 0/5] UBI support claudius.heine.ext
  2019-02-05 11:59 ` [PATCH v4 1/5] doc/user: added targz-img to image type list claudius.heine.ext
@ 2019-02-05 11:59 ` claudius.heine.ext
  2019-02-05 11:59 ` [PATCH v4 3/5] meta/classes: added ubi-img class claudius.heine.ext
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: claudius.heine.ext @ 2019-02-05 11:59 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

This class adds support for UBIFS file system images.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 doc/user_manual.md             |  1 +
 meta/classes/ubifs-img.bbclass | 44 ++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 meta/classes/ubifs-img.bbclass

diff --git a/doc/user_manual.md b/doc/user_manual.md
index c4fe42a..c9924ad 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -476,6 +476,7 @@ Isar contains additional image type classes that can be used as reference:
  - `ext4-img`
  - `rpi-sdimg`
  - `targz-img`
+ - `ubifs-img`
  - `wic-img`
 
 ---
diff --git a/meta/classes/ubifs-img.bbclass b/meta/classes/ubifs-img.bbclass
new file mode 100644
index 0000000..79cb19d
--- /dev/null
+++ b/meta/classes/ubifs-img.bbclass
@@ -0,0 +1,44 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+python() {
+    if not d.getVar("MKUBIFS_ARGS"):
+        bb.fatal("MKUBIFS_ARGS must be set")
+}
+
+inherit image
+
+UBIFS_IMAGE_FILE ?= "${IMAGE_FULLNAME}.ubifs.img"
+
+IMAGER_INSTALL += "mtd-utils"
+
+PP = "/home/builder/${PN}"
+PP_DEPLOY = "${PP}/deploy"
+PP_ROOTFS = "${PP}/rootfs"
+
+BUILDROOT = "${BUILDCHROOT_DIR}${PP}"
+BUILDROOT_DEPLOY = "${BUILDCHROOT_DIR}${PP_DEPLOY}"
+BUILDROOT_ROOTFS = "${BUILDCHROOT_DIR}${PP_ROOTFS}"
+
+do_ubifs_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
+
+# Generate ubifs filesystem image
+do_ubifs_image() {
+    rm -f ${DEPLOY_DIR_IMAGE}/${UBIFS_IMAGE_FILE}
+
+    buildchroot_do_mounts
+
+    sudo flock ${MOUNT_LOCKFILE} -c ' \
+        mkdir -p ${BUILDROOT_DEPLOY} ${BUILDROOT_ROOTFS}
+        mount --bind ${DEPLOY_DIR_IMAGE} ${BUILDROOT_DEPLOY}
+        mount --bind ${IMAGE_ROOTFS} ${BUILDROOT_ROOTFS}
+    '
+
+    # Create ubifs image using buildchroot tools
+    sudo chroot ${BUILDCHROOT_DIR} /usr/sbin/mkfs.ubifs ${MKUBIFS_ARGS} \
+                -r "${PP_ROOTFS}" "${PP_DEPLOY}/${UBIFS_IMAGE_FILE}"
+}
+
+addtask ubifs_image before do_build after do_copy_boot_files do_install_imager_deps
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 3/5] meta/classes: added ubi-img class
  2019-02-05 11:59 [PATCH v4 0/5] UBI support claudius.heine.ext
  2019-02-05 11:59 ` [PATCH v4 1/5] doc/user: added targz-img to image type list claudius.heine.ext
  2019-02-05 11:59 ` [PATCH v4 2/5] meta/classes: added ubifs-img class claudius.heine.ext
@ 2019-02-05 11:59 ` claudius.heine.ext
  2019-02-05 11:59 ` [PATCH v4 4/5] meta/classes: added fit-img class for creation of fit images claudius.heine.ext
  2019-02-05 11:59 ` [PATCH v4 5/5] meta-isar: added nand-ubi-demo example to demonstrate UBI use claudius.heine.ext
  4 siblings, 0 replies; 6+ messages in thread
From: claudius.heine.ext @ 2019-02-05 11:59 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

This class implements a new image type for UBI formatted nand flashes.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 doc/user_manual.md           |  2 ++
 meta/classes/ubi-img.bbclass | 52 ++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 meta/classes/ubi-img.bbclass

diff --git a/doc/user_manual.md b/doc/user_manual.md
index c9924ad..c9e18e0 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -350,6 +350,7 @@ Isar can generate various images types for specific machine. The type of the ima
  - `ext4` - Raw ext4 filesystem image (default option for `qemuarm` machine).
  - `rpi-sdimg` - A complete, partitioned Raspberry Pi SD card image (default option for the `rpi` machine).
  - `wic-img` - A full disk image with user-specified partitions created and populated using the wic tool.
+ - `ubi-img` - A image for use on mtd nand partitions employing UBI
 
 ---
 
@@ -477,6 +478,7 @@ Isar contains additional image type classes that can be used as reference:
  - `rpi-sdimg`
  - `targz-img`
  - `ubifs-img`
+ - `ubi-img`
  - `wic-img`
 
 ---
diff --git a/meta/classes/ubi-img.bbclass b/meta/classes/ubi-img.bbclass
new file mode 100644
index 0000000..367c48a
--- /dev/null
+++ b/meta/classes/ubi-img.bbclass
@@ -0,0 +1,52 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+python() {
+    if not d.getVar("UBINIZE_ARGS"):
+        bb.fatal("UBINIZE_ARGS must be set")
+}
+
+UBINIZE_CFG ??= "ubinize.cfg"
+
+inherit image
+
+UBI_IMAGE_FILE ?= "${IMAGE_FULLNAME}.ubi.img"
+
+IMAGER_INSTALL += "mtd-utils"
+
+PP = "/home/builder/${PN}"
+PP_DEPLOY = "${PP}/deploy"
+PP_ROOTFS = "${PP}/rootfs"
+PP_WORK = "${PP}/work"
+
+BUILDROOT = "${BUILDCHROOT_DIR}${PP}"
+BUILDROOT_DEPLOY = "${BUILDCHROOT_DIR}${PP_DEPLOY}"
+BUILDROOT_ROOTFS = "${BUILDCHROOT_DIR}${PP_ROOTFS}"
+BUILDROOT_WORK = "${BUILDCHROOT_DIR}${PP_WORK}"
+
+do_ubi_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
+
+# Generate ubi filesystem image
+do_ubi_image() {
+    if [ ! -e "${WORKDIR}/${UBINIZE_CFG}" ]; then
+        die "UBINIZE_CFG does not contain ubinize config file."
+    fi
+
+    rm -f ${DEPLOY_DIR_IMAGE}/${UBI_IMAGE_FILE}
+
+    buildchroot_do_mounts
+
+    sudo flock ${MOUNT_LOCKFILE} -c ' \
+        mkdir -p ${BUILDROOT_DEPLOY} ${BUILDROOT_ROOTFS} ${BUILDROOT_WORK}
+        mount --bind ${DEPLOY_DIR_IMAGE} ${BUILDROOT_DEPLOY}
+        mount --bind ${IMAGE_ROOTFS} ${BUILDROOT_ROOTFS}
+        mount --bind ${WORKDIR} ${BUILDROOT_WORK}
+    '
+
+    # Create ubi image using buildchroot tools
+    sudo chroot ${BUILDCHROOT_DIR} /usr/sbin/ubinize ${UBINIZE_ARGS} \
+                -o "${PP_DEPLOY}/${UBI_IMAGE_FILE}" "${PP_WORK}/${UBINIZE_CFG}"
+}
+addtask ubi_image before do_build after do_copy_boot_files do_install_imager_deps do_unpack do_transform_template
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 4/5] meta/classes: added fit-img class for creation of fit images
  2019-02-05 11:59 [PATCH v4 0/5] UBI support claudius.heine.ext
                   ` (2 preceding siblings ...)
  2019-02-05 11:59 ` [PATCH v4 3/5] meta/classes: added ubi-img class claudius.heine.ext
@ 2019-02-05 11:59 ` claudius.heine.ext
  2019-02-05 11:59 ` [PATCH v4 5/5] meta-isar: added nand-ubi-demo example to demonstrate UBI use claudius.heine.ext
  4 siblings, 0 replies; 6+ messages in thread
From: claudius.heine.ext @ 2019-02-05 11:59 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

This class implements a new image type for FIT image creation.

Signed-off-by: Claudius Heine <ch@denx.de>
---
 meta/classes/fit-img.bbclass | 49 ++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 meta/classes/fit-img.bbclass

diff --git a/meta/classes/fit-img.bbclass b/meta/classes/fit-img.bbclass
new file mode 100644
index 0000000..013b553
--- /dev/null
+++ b/meta/classes/fit-img.bbclass
@@ -0,0 +1,49 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+MKIMAGE_ARGS ??= ""
+
+FIT_IMAGE_SOURCE ??= "fitimage.its"
+
+inherit image
+
+FIT_IMAGE_FILE ?= "${IMAGE_FULLNAME}.fit.img"
+
+IMAGER_INSTALL += "u-boot-tools device-tree-compiler"
+
+PP = "/home/builder/${PN}"
+PP_DEPLOY = "${PP}/deploy"
+PP_ROOTFS = "${PP}/rootfs"
+PP_WORK = "${PP}/work"
+
+BUILDROOT = "${BUILDCHROOT_DIR}${PP}"
+BUILDROOT_DEPLOY = "${BUILDCHROOT_DIR}${PP_DEPLOY}"
+BUILDROOT_ROOTFS = "${BUILDCHROOT_DIR}${PP_ROOTFS}"
+BUILDROOT_WORK = "${BUILDCHROOT_DIR}${PP_WORK}"
+
+do_fit_image[stamp-extra-info] = "${DISTRO}-${MACHINE}"
+
+# Generate fit image
+do_fit_image() {
+    if [ ! -e "${WORKDIR}/${FIT_IMAGE_SOURCE}" ]; then
+        die "FIT_IMAGE_SOURCE does not contain fitimage source file"
+    fi
+
+    rm -f ${DEPLOY_DIR_IMAGE}/${FIT_IMAGE_FILE}
+
+    buildchroot_do_mounts
+
+    sudo flock ${MOUNT_LOCKFILE} -c ' \
+        mkdir -p ${BUILDROOT_DEPLOY} ${BUILDROOT_ROOTFS} ${BUILDROOT_WORK}
+        mount --bind ${DEPLOY_DIR_IMAGE} ${BUILDROOT_DEPLOY}
+        mount --bind ${IMAGE_ROOTFS} ${BUILDROOT_ROOTFS}
+        mount --bind ${WORKDIR} ${BUILDROOT_WORK}
+    '
+
+    # Create fit image using buildchroot tools
+    sudo chroot ${BUILDCHROOT_DIR} /usr/bin/mkimage ${MKIMAGE_ARGS} \
+                -f "${PP_WORK}/${FIT_IMAGE_SOURCE}" "${PP_DEPLOY}/${FIT_IMAGE_FILE}"
+}
+addtask fit_image before do_build after do_copy_boot_files do_install_imager_deps do_unpack do_transform_template
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 5/5] meta-isar: added nand-ubi-demo example to demonstrate UBI use
  2019-02-05 11:59 [PATCH v4 0/5] UBI support claudius.heine.ext
                   ` (3 preceding siblings ...)
  2019-02-05 11:59 ` [PATCH v4 4/5] meta/classes: added fit-img class for creation of fit images claudius.heine.ext
@ 2019-02-05 11:59 ` claudius.heine.ext
  4 siblings, 0 replies; 6+ messages in thread
From: claudius.heine.ext @ 2019-02-05 11:59 UTC (permalink / raw)
  To: isar-users; +Cc: Claudius Heine

From: Claudius Heine <ch@denx.de>

Signed-off-by: Claudius Heine <ch@denx.de>
---
 meta-isar/classes/ubi-ubifs-img.bbclass       | 10 ++++
 meta-isar/conf/local.conf.sample              |  1 +
 meta-isar/conf/machine/nand-ubi-demo.conf     | 13 +++++
 .../multiconfig/nand-ubi-demo-buster.conf     | 13 +++++
 .../images/files/fitimage.its.tmpl            | 58 +++++++++++++++++++
 .../images/files/ubinize.cfg.tmpl             | 17 ++++++
 .../recipes-core/images/isar-image-ubi.bb     | 26 +++++++++
 meta/classes/image.bbclass                    | 14 ++++-
 scripts/ci_build.sh                           |  1 +
 9 files changed, 152 insertions(+), 1 deletion(-)
 create mode 100644 meta-isar/classes/ubi-ubifs-img.bbclass
 create mode 100644 meta-isar/conf/machine/nand-ubi-demo.conf
 create mode 100644 meta-isar/conf/multiconfig/nand-ubi-demo-buster.conf
 create mode 100644 meta-isar/recipes-core/images/files/fitimage.its.tmpl
 create mode 100644 meta-isar/recipes-core/images/files/ubinize.cfg.tmpl
 create mode 100644 meta-isar/recipes-core/images/isar-image-ubi.bb

diff --git a/meta-isar/classes/ubi-ubifs-img.bbclass b/meta-isar/classes/ubi-ubifs-img.bbclass
new file mode 100644
index 0000000..095719a
--- /dev/null
+++ b/meta-isar/classes/ubi-ubifs-img.bbclass
@@ -0,0 +1,10 @@
+# UBI with UBIFS image recipe
+#
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+inherit ubi-img ubifs-img fit-img
+addtask do_ubi_image after do_ubifs_image
+addtask do_ubi_image after do_fit_image
diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample
index a671b20..519a15d 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -53,6 +53,7 @@ BBMULTICONFIG = " \
     hikey-stretch \
     qemuamd64-buster \
     qemuamd64-buster-tgz \
+    nand-ubi-demo-buster \
     rpi-jessie \
 "
 
diff --git a/meta-isar/conf/machine/nand-ubi-demo.conf b/meta-isar/conf/machine/nand-ubi-demo.conf
new file mode 100644
index 0000000..e207d40
--- /dev/null
+++ b/meta-isar/conf/machine/nand-ubi-demo.conf
@@ -0,0 +1,13 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+MACHINE_SERIAL ?= "ttymxc0"
+BAUDRATE_TTY ?= "115200"
+
+MKUBIFS_ARGS := "-m 0x1000 -e 0x3e000 -c 1500"
+UBINIZE_ARGS = "-vv -m 0x1000 -p 0x40000"
+IMAGE_TYPE ?= "ubi-ubifs-img"
+
+DTB_FILE = "imx6q-sabrelite.dtb"
diff --git a/meta-isar/conf/multiconfig/nand-ubi-demo-buster.conf b/meta-isar/conf/multiconfig/nand-ubi-demo-buster.conf
new file mode 100644
index 0000000..1c88f00
--- /dev/null
+++ b/meta-isar/conf/multiconfig/nand-ubi-demo-buster.conf
@@ -0,0 +1,13 @@
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+MACHINE ?= "nand-ubi-demo"
+
+DISTRO ?= "debian-buster"
+DISTRO_ARCH ?= "armhf"
+
+KERNEL_NAME ?= "armmp"
+
+IMAGE_INSTALL += "sshd-regen-keys"
diff --git a/meta-isar/recipes-core/images/files/fitimage.its.tmpl b/meta-isar/recipes-core/images/files/fitimage.its.tmpl
new file mode 100644
index 0000000..ca50f8f
--- /dev/null
+++ b/meta-isar/recipes-core/images/files/fitimage.its.tmpl
@@ -0,0 +1,58 @@
+/dts-v1/;
+
+/ {
+	description = "Configuration to of a fitimage";
+
+	images {
+		kernel {
+			description = "Linux kernel";
+			data = /incbin/("${KERNEL_IMG}");
+			type = "kernel";
+			arch = "arm";
+			os = "linux";
+			compression = "none";
+			load =  <0x8000>;
+                        entry = <0x8000>;
+			hash-1 {
+				algo = "sha256";
+			};
+		};
+
+		fdt {
+			description = "Device Tree";
+			data = /incbin/("${DTB_IMG}");
+			type = "flat_dt";
+			arch = "arm";
+			compression = "none";
+			hash-1 {
+				algo = "sha256";
+			};
+		};
+
+		initrd {
+			description = "Initial ram disk";
+			data = /incbin/("${INITRD_IMG}");
+			type = "ramdisk";
+			arch = "arm";
+			os = "linux";
+			compression = "none";
+			hash-1 {
+				algo = "sha256";
+			};
+		};
+	};
+
+	configurations {
+		default = "config-1";
+
+		config-1 {
+			description = "System boot configuration";
+			fdt = "fdt";
+                        kernel = "kernel";
+                        ramdisk = "initrd";
+			hash {
+				algo = "sha256";
+			};
+		};
+	};
+};
diff --git a/meta-isar/recipes-core/images/files/ubinize.cfg.tmpl b/meta-isar/recipes-core/images/files/ubinize.cfg.tmpl
new file mode 100644
index 0000000..005c1ae
--- /dev/null
+++ b/meta-isar/recipes-core/images/files/ubinize.cfg.tmpl
@@ -0,0 +1,17 @@
+[fitimage]
+mode=ubi
+image=${FIT_IMG}
+vol_id=1
+vol_type=static
+vol_name=fitimage
+vol_size=64MiB
+vol_alignment=1
+
+[rootfs]
+mode=ubi
+image=${UBIFS_IMG}
+vol_id=2
+vol_type=dynamic
+vol_name=rootfs
+vol_size=300MiB
+vol_alignment=1
diff --git a/meta-isar/recipes-core/images/isar-image-ubi.bb b/meta-isar/recipes-core/images/isar-image-ubi.bb
new file mode 100644
index 0000000..4b7e109
--- /dev/null
+++ b/meta-isar/recipes-core/images/isar-image-ubi.bb
@@ -0,0 +1,26 @@
+# UBI image recipe
+#
+# This software is a part of ISAR.
+# Copyright (C) Siemens AG, 2019
+#
+# SPDX-License-Identifier: MIT
+
+DESCRIPTION = "UBI Isar image"
+
+LICENSE = "gpl-2.0"
+LIC_FILES_CHKSUM = "file://${LAYERDIR_core}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
+
+inherit isar-image
+
+SRC_URI += "file://ubinize.cfg.tmpl \
+            file://fitimage.its.tmpl"
+
+TEMPLATE_VARS = "KERNEL_IMG INITRD_IMG DTB_IMG UBIFS_IMG FIT_IMG"
+TEMPLATE_FILES = "ubinize.cfg.tmpl fitimage.its.tmpl"
+
+KERNEL_IMG = "${PP_DEPLOY}/${KERNEL_IMAGE}"
+INITRD_IMG = "${PP_DEPLOY}/${INITRD_IMAGE}"
+DTB_IMG = "${PP_DEPLOY}/${DTB_FILE}"
+
+UBIFS_IMG = "${PP_DEPLOY}/${UBIFS_IMAGE_FILE}"
+FIT_IMG = "${PP_DEPLOY}/${FIT_IMAGE_FILE}"
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index d8fbfd5..3eafc0c 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -81,7 +81,7 @@ do_mark_rootfs() {
         "${IMAGE_ROOTFS}"
 }
 
-addtask mark_rootfs before do_copy_boot_files after do_rootfs
+addtask mark_rootfs before do_copy_boot_files do_transform_template after do_rootfs
 
 do_copy_boot_files() {
     KERNEL_IMAGE=${@get_image_name(d, 'vmlinuz')[1]}
@@ -93,6 +93,18 @@ do_copy_boot_files() {
     if [ -n "${INITRD_IMAGE}" ]; then
         sudo cp -f ${IMAGE_ROOTFS}/boot/${@get_image_name(d, 'initrd.img')[0]} ${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}
     fi
+
+    # Check DTB_FILE via inline python to handle unset case:
+    if [ -n "${@d.getVar('DTB_FILE', True) or ""}" ]; then
+        dtb="$(find '${IMAGE_ROOTFS}/usr/lib' -type f \
+                    -iwholename '*linux-image-*/${DTB_FILE}' | head -1)"
+
+        if [ -z "$dtb" -o ! -e "$dtb" ]; then
+            die "${DTB_FILE} not found"
+        fi
+
+        cp -f "$dtb" "${DEPLOY_DIR_IMAGE}/${DTB_FILE}"
+    fi
 }
 
 addtask copy_boot_files before do_build after do_rootfs
diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
index f3523e8..abb638e 100755
--- a/scripts/ci_build.sh
+++ b/scripts/ci_build.sh
@@ -115,6 +115,7 @@ else
         multiconfig:qemuamd64-stretch:isar-image-base \
         multiconfig:qemuamd64-buster:isar-image-base \
         multiconfig:qemuamd64-buster-tgz:isar-image-base \
+        multiconfig:nand-ubi-demo-buster:isar-image-ubi \
         multiconfig:rpi-jessie:isar-image-base
     # qemu-user-static of <= buster too old to build that
     #multiconfig:qemuarm64-buster:isar-image-base
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-05 11:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-05 11:59 [PATCH v4 0/5] UBI support claudius.heine.ext
2019-02-05 11:59 ` [PATCH v4 1/5] doc/user: added targz-img to image type list claudius.heine.ext
2019-02-05 11:59 ` [PATCH v4 2/5] meta/classes: added ubifs-img class claudius.heine.ext
2019-02-05 11:59 ` [PATCH v4 3/5] meta/classes: added ubi-img class claudius.heine.ext
2019-02-05 11:59 ` [PATCH v4 4/5] meta/classes: added fit-img class for creation of fit images claudius.heine.ext
2019-02-05 11:59 ` [PATCH v4 5/5] meta-isar: added nand-ubi-demo example to demonstrate UBI use claudius.heine.ext

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox