* [PATCH v2 1/4] doc/user: added targz-img to image type list
2019-01-30 8:02 [PATCH v2 0/4] UBI support claudius.heine.ext
@ 2019-01-30 8:02 ` claudius.heine.ext
2019-01-30 16:19 ` Henning Schild
2019-01-30 8:02 ` [PATCH v2 2/4] meta/classes: added ubifs-img class claudius.heine.ext
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: claudius.heine.ext @ 2019-01-30 8:02 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] 9+ messages in thread
* Re: [PATCH v2 1/4] doc/user: added targz-img to image type list
2019-01-30 8:02 ` [PATCH v2 1/4] doc/user: added targz-img to image type list claudius.heine.ext
@ 2019-01-30 16:19 ` Henning Schild
0 siblings, 0 replies; 9+ messages in thread
From: Henning Schild @ 2019-01-30 16:19 UTC (permalink / raw)
To: [ext] claudius.heine.ext@siemens.com; +Cc: isar-users, Claudius Heine
If there will be more iterations, i guess this simple one should go
stand-alone.
Henning
On Wed, 30 Jan 2019 09:02:26 +0100
"[ext] claudius.heine.ext@siemens.com" <claudius.heine.ext@siemens.com>
wrote:
> 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`
>
> ---
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/4] meta/classes: added ubifs-img class
2019-01-30 8:02 [PATCH v2 0/4] UBI support claudius.heine.ext
2019-01-30 8:02 ` [PATCH v2 1/4] doc/user: added targz-img to image type list claudius.heine.ext
@ 2019-01-30 8:02 ` claudius.heine.ext
2019-01-30 8:02 ` [PATCH v2 3/4] meta/classes: added ubi-img class claudius.heine.ext
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: claudius.heine.ext @ 2019-01-30 8:02 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] 9+ messages in thread
* [PATCH v2 3/4] meta/classes: added ubi-img class
2019-01-30 8:02 [PATCH v2 0/4] UBI support claudius.heine.ext
2019-01-30 8:02 ` [PATCH v2 1/4] doc/user: added targz-img to image type list claudius.heine.ext
2019-01-30 8:02 ` [PATCH v2 2/4] meta/classes: added ubifs-img class claudius.heine.ext
@ 2019-01-30 8:02 ` claudius.heine.ext
2019-01-30 8:02 ` [PATCH v2 4/4] meta-isar: added nand-ubi-demo example to demonstrate UBI use claudius.heine.ext
2019-01-30 12:57 ` [PATCH v2 0/4] UBI support Claudius Heine
4 siblings, 0 replies; 9+ messages in thread
From: claudius.heine.ext @ 2019-01-30 8:02 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.
It allows custom ubinize configuration file templates to be placed into
the SRC_URI of the image recipe and has mechanims to replace variables
within those. It does this by using `envsubst` from the gettext project.
The interface for custom template variables is implemented via the
`UBINIZE_CFG_TMPL_VARS` bitbake variable. The value of this variable is
an array of template variable names. Each template variable name
corresponds to a flag of the `UBINIZE_CFG_TMPL_VARS` variable, with
which the value can be set.
Signed-off-by: Claudius Heine <ch@denx.de>
---
doc/user_manual.md | 2 +
meta/classes/ubi-img.bbclass | 73 ++++++++++++++++++++++++++++++++++++
2 files changed, 75 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..078293e
--- /dev/null
+++ b/meta/classes/ubi-img.bbclass
@@ -0,0 +1,73 @@
+# 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_TMPL ??= "ubinize.cfg.tmpl"
+UBINIZE_CFG_TMPL_VARS ??= ""
+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}"
+
+def get_ubi_exports(d):
+ template_vars = (d.getVar("UBINIZE_CFG_TMPL_VARS", True) or "").split()
+ template_vars_flags = (d.getVarFlags("UBINIZE_CFG_TMPL_VARS") or {})
+ return " ".join("{}=\"{}\"".format(name, template_vars_flags[name])
+ for name in template_vars)
+
+def get_envsubst_args(d):
+ template_vars = (d.getVar("UBINIZE_CFG_TMPL_VARS", True) or "").split()
+ return " ".join("\\${{{}}}".format(name)
+ for name in template_vars)
+
+# Generate ubi filesystem image
+do_ubi_image() {
+ if [ ! -e "${WORKDIR}/${UBINIZE_CFG_TMPL}" -a \
+ ! -e "${WORKDIR}/${UBINIZE_CFG}" ]; then
+ die "Neigher UBINIZE_CFG_TMPL nor UBINIZE_CFG contain existing" \
+ "ubinize configuration 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}
+ '
+
+ if [ -e "${WORKDIR}/${UBINIZE_CFG_TMPL}" ]; then
+ export ${@get_ubi_exports(d)}
+ envsubst "${@get_envsubst_args(d)}" \
+ < ${WORKDIR}/${UBINIZE_CFG_TMPL} > ${WORKDIR}/${UBINIZE_CFG}
+ fi
+
+ # 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
--
2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 4/4] meta-isar: added nand-ubi-demo example to demonstrate UBI use
2019-01-30 8:02 [PATCH v2 0/4] UBI support claudius.heine.ext
` (2 preceding siblings ...)
2019-01-30 8:02 ` [PATCH v2 3/4] meta/classes: added ubi-img class claudius.heine.ext
@ 2019-01-30 8:02 ` claudius.heine.ext
2019-01-30 16:32 ` Henning Schild
2019-01-30 12:57 ` [PATCH v2 0/4] UBI support Claudius Heine
4 siblings, 1 reply; 9+ messages in thread
From: claudius.heine.ext @ 2019-01-30 8:02 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 | 11 ++++
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/ubinize.cfg.tmpl | 35 +++++++++++++
.../recipes-core/images/isar-image-ubi.bb | 51 +++++++++++++++++++
scripts/ci_build.sh | 1 +
7 files changed, 125 insertions(+)
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/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..c02c98f
--- /dev/null
+++ b/meta-isar/classes/ubi-ubifs-img.bbclass
@@ -0,0 +1,11 @@
+# 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
+addtask do_ubi_image after do_ubifs_image
+
+UBINIZE_CFG_TMPL_VARS[UBIFS_IMG] = "${PP_DEPLOY}/${UBIFS_IMAGE_FILE}"
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/ubinize.cfg.tmpl b/meta-isar/recipes-core/images/files/ubinize.cfg.tmpl
new file mode 100644
index 0000000..f386915
--- /dev/null
+++ b/meta-isar/recipes-core/images/files/ubinize.cfg.tmpl
@@ -0,0 +1,35 @@
+[kernel]
+mode=ubi
+image=${KERNEL_IMG}
+vol_id=1
+vol_type=static
+vol_name=kernel
+vol_size=16MiB
+vol_alignment=1
+
+[initrd]
+mode=ubi
+image=${INITRD_IMG}
+vol_id=2
+vol_type=static
+vol_name=initrd
+vol_size=32MiB
+vol_alignment=1
+
+[dtb]
+mode=ubi
+image=${DTB_IMG}
+vol_id=3
+vol_type=static
+vol_name=dtb
+vol_size=2MiB
+vol_alignment=1
+
+[rootfs]
+mode=ubi
+image=${UBIFS_IMG}
+vol_id=4
+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..fbf0903
--- /dev/null
+++ b/meta-isar/recipes-core/images/isar-image-ubi.bb
@@ -0,0 +1,51 @@
+# 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"
+
+PV = "1.0"
+
+inherit isar-image
+
+SRC_URI += "file://ubinize.cfg.tmpl"
+
+def find_linux_image(d, root_var):
+ """
+ Find path to the linux-image directory
+
+ Takes the first it can find -> could lead to problems if more than one
+ linux-image package is installed.
+
+ root_var: Name of variable that contains the path to the rootfs
+ returns: found path without leading path to the rootfs or ""
+ """
+ import glob
+
+ root = d.getVar(root_var, True)
+ if not root:
+ bb.fatal("Variable \"{}\" does not exist or is empty!".format(root_var))
+
+ found = glob.glob(os.path.join(root, 'usr/lib/linux-image-*'))
+ if not found:
+ return ""
+
+ return found[0][len(root):]
+
+UBINIZE_CFG_TMPL_VARS ??= "KERNEL_IMG INITRD_IMG DTB_IMG UBIFS_IMG"
+UBINIZE_CFG_TMPL_VARS[KERNEL_IMG] = "${PP_DEPLOY}/${KERNEL_IMAGE}"
+UBINIZE_CFG_TMPL_VARS[INITRD_IMG] = "${PP_DEPLOY}/${INITRD_IMAGE}"
+UBINIZE_CFG_TMPL_VARS[DTB_IMG] = "${PP_ROOTFS}/${@find_linux_image(d, 'IMAGE_ROOTFS')}/${DTB_FILE}"
+
+do_copy_boot_files_append() {
+ DTB="${@find_linux_image(d, 'IMAGE_ROOTFS')}/${DTB_FILE}"
+ if [ -n "${DTB}" ]; then
+ cp -f ${IMAGE_ROOTFS}/${DTB} ${DEPLOY_DIR_IMAGE}/${DTB_FILE}
+ fi
+}
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] 9+ messages in thread
* Re: [PATCH v2 4/4] meta-isar: added nand-ubi-demo example to demonstrate UBI use
2019-01-30 8:02 ` [PATCH v2 4/4] meta-isar: added nand-ubi-demo example to demonstrate UBI use claudius.heine.ext
@ 2019-01-30 16:32 ` Henning Schild
2019-01-31 10:11 ` Claudius Heine
0 siblings, 1 reply; 9+ messages in thread
From: Henning Schild @ 2019-01-30 16:32 UTC (permalink / raw)
To: [ext] claudius.heine.ext@siemens.com; +Cc: isar-users, Claudius Heine
On Wed, 30 Jan 2019 09:02:29 +0100
"[ext] claudius.heine.ext@siemens.com" <claudius.heine.ext@siemens.com>
wrote:
> From: Claudius Heine <ch@denx.de>
>
> Signed-off-by: Claudius Heine <ch@denx.de>
> ---
> meta-isar/classes/ubi-ubifs-img.bbclass | 11 ++++
> 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/ubinize.cfg.tmpl | 35 +++++++++++++
> .../recipes-core/images/isar-image-ubi.bb | 51
> +++++++++++++++++++ scripts/ci_build.sh |
> 1 + 7 files changed, 125 insertions(+)
> 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/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..c02c98f
> --- /dev/null
> +++ b/meta-isar/classes/ubi-ubifs-img.bbclass
> @@ -0,0 +1,11 @@
> +# 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
> +addtask do_ubi_image after do_ubifs_image
> +
> +UBINIZE_CFG_TMPL_VARS[UBIFS_IMG] = "${PP_DEPLOY}/${UBIFS_IMAGE_FILE}"
> 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/ubinize.cfg.tmpl
> b/meta-isar/recipes-core/images/files/ubinize.cfg.tmpl new file mode
> 100644 index 0000000..f386915
> --- /dev/null
> +++ b/meta-isar/recipes-core/images/files/ubinize.cfg.tmpl
> @@ -0,0 +1,35 @@
> +[kernel]
> +mode=ubi
> +image=${KERNEL_IMG}
> +vol_id=1
> +vol_type=static
> +vol_name=kernel
> +vol_size=16MiB
> +vol_alignment=1
> +
> +[initrd]
> +mode=ubi
> +image=${INITRD_IMG}
> +vol_id=2
> +vol_type=static
> +vol_name=initrd
> +vol_size=32MiB
> +vol_alignment=1
> +
> +[dtb]
> +mode=ubi
> +image=${DTB_IMG}
> +vol_id=3
> +vol_type=static
> +vol_name=dtb
> +vol_size=2MiB
> +vol_alignment=1
> +
> +[rootfs]
> +mode=ubi
> +image=${UBIFS_IMG}
> +vol_id=4
> +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..fbf0903
> --- /dev/null
> +++ b/meta-isar/recipes-core/images/isar-image-ubi.bb
> @@ -0,0 +1,51 @@
> +# 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"
> + +PV = "1.0"
> +
> +inherit isar-image
> +
> +SRC_URI += "file://ubinize.cfg.tmpl"
> +
> +def find_linux_image(d, root_var):
> + """
> + Find path to the linux-image directory
> +
> + Takes the first it can find -> could lead to problems if
> more than one
> + linux-image package is installed.
> +
> + root_var: Name of variable that contains the path to the
> rootfs
> + returns: found path without leading path to the rootfs or ""
> + """
> + import glob
> +
> + root = d.getVar(root_var, True)
> + if not root:
> + bb.fatal("Variable \"{}\" does not exist or is
> empty!".format(root_var)) +
> + found = glob.glob(os.path.join(root, 'usr/lib/linux-image-*'))
> + if not found:
> + return ""
> +
> + return found[0][len(root):]
> +
> +UBINIZE_CFG_TMPL_VARS ??= "KERNEL_IMG INITRD_IMG DTB_IMG UBIFS_IMG"
> +UBINIZE_CFG_TMPL_VARS[KERNEL_IMG] = "${PP_DEPLOY}/${KERNEL_IMAGE}"
> +UBINIZE_CFG_TMPL_VARS[INITRD_IMG] = "${PP_DEPLOY}/${INITRD_IMAGE}"
Interesting. But maybe even as a more general templating feature. To be
honest i would skip that and use a few "sed"s like we do at other
places. I think the templating is orthogonal to the ubi/ubifs support.
> +UBINIZE_CFG_TMPL_VARS[DTB_IMG] =
> "${PP_ROOTFS}/${@find_linux_image(d, 'IMAGE_ROOTFS')}/${DTB_FILE}" +
> +do_copy_boot_files_append() {
> + DTB="${@find_linux_image(d, 'IMAGE_ROOTFS')}/${DTB_FILE}"
> + if [ -n "${DTB}" ]; then
> + cp -f ${IMAGE_ROOTFS}/${DTB} ${DEPLOY_DIR_IMAGE}/${DTB_FILE}
> + fi
> +}
I do not like that and the find_linux_image it needs. The way to find
the file should be the same used for kernel and initrd. So i guess
extend this with DTB support or replace KERNEL and INITRD finding with
your function.
Henning
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 4/4] meta-isar: added nand-ubi-demo example to demonstrate UBI use
2019-01-30 16:32 ` Henning Schild
@ 2019-01-31 10:11 ` Claudius Heine
0 siblings, 0 replies; 9+ messages in thread
From: Claudius Heine @ 2019-01-31 10:11 UTC (permalink / raw)
To: Henning Schild; +Cc: isar-users, Claudius Heine
Hi Henning,
On 30/01/2019 17.32, Henning Schild wrote:
> On Wed, 30 Jan 2019 09:02:29 +0100
> "[ext] claudius.heine.ext@siemens.com" <claudius.heine.ext@siemens.com>
> wrote:
>
>> From: Claudius Heine <ch@denx.de>
>>
>> Signed-off-by: Claudius Heine <ch@denx.de>
>> ---
>> meta-isar/classes/ubi-ubifs-img.bbclass | 11 ++++
>> 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/ubinize.cfg.tmpl | 35 +++++++++++++
>> .../recipes-core/images/isar-image-ubi.bb | 51
>> +++++++++++++++++++ scripts/ci_build.sh |
>> 1 + 7 files changed, 125 insertions(+)
>> 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/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..c02c98f
>> --- /dev/null
>> +++ b/meta-isar/classes/ubi-ubifs-img.bbclass
>> @@ -0,0 +1,11 @@
>> +# 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
>> +addtask do_ubi_image after do_ubifs_image
>> +
>> +UBINIZE_CFG_TMPL_VARS[UBIFS_IMG] = "${PP_DEPLOY}/${UBIFS_IMAGE_FILE}"
>> 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/ubinize.cfg.tmpl
>> b/meta-isar/recipes-core/images/files/ubinize.cfg.tmpl new file mode
>> 100644 index 0000000..f386915
>> --- /dev/null
>> +++ b/meta-isar/recipes-core/images/files/ubinize.cfg.tmpl
>> @@ -0,0 +1,35 @@
>> +[kernel]
>> +mode=ubi
>> +image=${KERNEL_IMG}
>> +vol_id=1
>> +vol_type=static
>> +vol_name=kernel
>> +vol_size=16MiB
>> +vol_alignment=1
>> +
>> +[initrd]
>> +mode=ubi
>> +image=${INITRD_IMG}
>> +vol_id=2
>> +vol_type=static
>> +vol_name=initrd
>> +vol_size=32MiB
>> +vol_alignment=1
>> +
>> +[dtb]
>> +mode=ubi
>> +image=${DTB_IMG}
>> +vol_id=3
>> +vol_type=static
>> +vol_name=dtb
>> +vol_size=2MiB
>> +vol_alignment=1
>> +
>> +[rootfs]
>> +mode=ubi
>> +image=${UBIFS_IMG}
>> +vol_id=4
>> +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..fbf0903
>> --- /dev/null
>> +++ b/meta-isar/recipes-core/images/isar-image-ubi.bb
>> @@ -0,0 +1,51 @@
>> +# 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"
>> + +PV = "1.0"
>> +
>> +inherit isar-image
>> +
>> +SRC_URI += "file://ubinize.cfg.tmpl"
>> +
>> +def find_linux_image(d, root_var):
>> + """
>> + Find path to the linux-image directory
>> +
>> + Takes the first it can find -> could lead to problems if
>> more than one
>> + linux-image package is installed.
>> +
>> + root_var: Name of variable that contains the path to the
>> rootfs
>> + returns: found path without leading path to the rootfs or ""
>> + """
>> + import glob
>> +
>> + root = d.getVar(root_var, True)
>> + if not root:
>> + bb.fatal("Variable \"{}\" does not exist or is
>> empty!".format(root_var)) +
>> + found = glob.glob(os.path.join(root, 'usr/lib/linux-image-*'))
>> + if not found:
>> + return ""
>> +
>> + return found[0][len(root):]
>> +
>> +UBINIZE_CFG_TMPL_VARS ??= "KERNEL_IMG INITRD_IMG DTB_IMG UBIFS_IMG"
>> +UBINIZE_CFG_TMPL_VARS[KERNEL_IMG] = "${PP_DEPLOY}/${KERNEL_IMAGE}"
>> +UBINIZE_CFG_TMPL_VARS[INITRD_IMG] = "${PP_DEPLOY}/${INITRD_IMAGE}"
>
> Interesting. But maybe even as a more general templating feature. To be
> honest i would skip that and use a few "sed"s like we do at other
> places. I think the templating is orthogonal to the ubi/ubifs support.
Yes, see my other patchset, that should simplify and generalize the
templating mechanism.
>
>> +UBINIZE_CFG_TMPL_VARS[DTB_IMG] =
>> "${PP_ROOTFS}/${@find_linux_image(d, 'IMAGE_ROOTFS')}/${DTB_FILE}" +
>> +do_copy_boot_files_append() {
>> + DTB="${@find_linux_image(d, 'IMAGE_ROOTFS')}/${DTB_FILE}"
>> + if [ -n "${DTB}" ]; then
>> + cp -f ${IMAGE_ROOTFS}/${DTB} ${DEPLOY_DIR_IMAGE}/${DTB_FILE}
>> + fi
>> +}
>
> I do not like that and the find_linux_image it needs. The way to find
> the file should be the same used for kernel and initrd. So i guess
> extend this with DTB support or replace KERNEL and INITRD finding with
> your function.
You are right, that could be done a bit simpler. I will try.
Claudius
>
> Henning
>
>> 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
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/4] UBI support
2019-01-30 8:02 [PATCH v2 0/4] UBI support claudius.heine.ext
` (3 preceding siblings ...)
2019-01-30 8:02 ` [PATCH v2 4/4] meta-isar: added nand-ubi-demo example to demonstrate UBI use claudius.heine.ext
@ 2019-01-30 12:57 ` Claudius Heine
4 siblings, 0 replies; 9+ messages in thread
From: Claudius Heine @ 2019-01-30 12:57 UTC (permalink / raw)
To: isar-users; +Cc: Claudius Heine
On 30/01/2019 09.02, [ext] claudius.heine.ext@siemens.com wrote:
> From: Claudius Heine <ch@denx.de>
>
> Hi,
>
> here is version two of the ubifs and ubi patchset.
After some offline discussion with Jan, I will rework the template
mechanism to improve the UX and try to implement it for debian control
file replacing.
This patchset therefor on hold for now.
Thx,
Claudius
>
> Claudius
>
> 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 (4):
> doc/user: added targz-img to image type list
> meta/classes: added ubifs-img class
> meta/classes: added ubi-img class
> meta-isar: added nand-ubi-demo example to demonstrate UBI use
>
> doc/user_manual.md | 6 +-
> meta-isar/classes/ubi-ubifs-img.bbclass | 11 +++
> 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/ubinize.cfg.tmpl | 35 +++++++++
> .../recipes-core/images/isar-image-ubi.bb | 51 +++++++++++++
> meta/classes/ubi-img.bbclass | 73 +++++++++++++++++++
> meta/classes/ubifs-img.bbclass | 44 +++++++++++
> scripts/ci_build.sh | 1 +
> 10 files changed, 247 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/ubinize.cfg.tmpl
> create mode 100644 meta-isar/recipes-core/images/isar-image-ubi.bb
> create mode 100644 meta/classes/ubi-img.bbclass
> create mode 100644 meta/classes/ubifs-img.bbclass
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de
^ permalink raw reply [flat|nested] 9+ messages in thread