public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: claudius.heine.ext@siemens.com
To: isar-users@googlegroups.com
Cc: Claudius Heine <ch@denx.de>
Subject: [RFC PATCH 2/2] meta-isar: added qemusabrelite example to demonstrate UBI use
Date: Tue, 29 Jan 2019 13:10:20 +0100	[thread overview]
Message-ID: <20190129121020.30845-3-claudius.heine.ext@siemens.com> (raw)
In-Reply-To: <20190129121020.30845-1-claudius.heine.ext@siemens.com>

From: Claudius Heine <ch@denx.de>

Signed-off-by: Claudius Heine <ch@denx.de>
---
 meta-isar/classes/ubi-ubifs-img.bbclass       |  9 ++++
 meta-isar/conf/machine/qemusabrelite.conf     | 11 +++++
 .../multiconfig/qemusabrelite-buster.conf     | 13 +++++
 .../images/files/ubinize.cfg.tmpl             | 35 +++++++++++++
 .../recipes-core/images/isar-image-ubi.bb     | 49 +++++++++++++++++++
 5 files changed, 117 insertions(+)
 create mode 100644 meta-isar/classes/ubi-ubifs-img.bbclass
 create mode 100644 meta-isar/conf/machine/qemusabrelite.conf
 create mode 100644 meta-isar/conf/multiconfig/qemusabrelite-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..711492e
--- /dev/null
+++ b/meta-isar/classes/ubi-ubifs-img.bbclass
@@ -0,0 +1,9 @@
+# UBI with UBIFS image recipe
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2018 ilbers GmbH
+
+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/machine/qemusabrelite.conf b/meta-isar/conf/machine/qemusabrelite.conf
new file mode 100644
index 0000000..1f886be
--- /dev/null
+++ b/meta-isar/conf/machine/qemusabrelite.conf
@@ -0,0 +1,11 @@
+# This software is a part of ISAR.
+# Copyright (C) 2015-2017 ilbers GmbH
+
+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/qemusabrelite-buster.conf b/meta-isar/conf/multiconfig/qemusabrelite-buster.conf
new file mode 100644
index 0000000..aa29abb
--- /dev/null
+++ b/meta-isar/conf/multiconfig/qemusabrelite-buster.conf
@@ -0,0 +1,13 @@
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+MACHINE ?= "qemusabrelite"
+
+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..c5a94d0
--- /dev/null
+++ b/meta-isar/recipes-core/images/isar-image-ubi.bb
@@ -0,0 +1,49 @@
+# UBI image recipe
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2018 ilbers GmbH
+
+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
+}
-- 
2.20.1


      parent reply	other threads:[~2019-01-29 12:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 12:10 [RFC PATCH 0/2] Implementation of UBI claudius.heine.ext
2019-01-29 12:10 ` [RFC PATCH 1/2] meta/classes: added ubi-img class claudius.heine.ext
2019-01-29 12:10 ` claudius.heine.ext [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190129121020.30845-3-claudius.heine.ext@siemens.com \
    --to=claudius.heine.ext@siemens.com \
    --cc=ch@denx.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox