From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6652197203295076352 X-Received: by 2002:a2e:90c8:: with SMTP id o8-v6mr1044744ljg.24.1548929467592; Thu, 31 Jan 2019 02:11:07 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:81d8:: with SMTP id s24-v6ls707369ljg.9.gmail; Thu, 31 Jan 2019 02:11:06 -0800 (PST) X-Google-Smtp-Source: AHgI3IYx3fTsL9yuIj+a2x73D4HGobfwirnVdjB5w2EKWbKF7Nw4dxVOjJOtPh5llJlO+aAuKzJQ X-Received: by 2002:a2e:9b99:: with SMTP id z25-v6mr526851lji.7.1548929466038; Thu, 31 Jan 2019 02:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548929466; cv=none; d=google.com; s=arc-20160816; b=UhxJ5Z0hSBUDdW4X201DC75MgvS9vxPwt7ExKWhEo95q7KSVpLHyos3V6RlD+P/aQa qsMn0tpwzsb7mb7oC/QnaEw/4w+EY7uEArn4xhE3tq44T/NO2mWse2mKaq/jNO6/3eqC 0CtGfIE0Op6Jilpk1+N+9EaoZ8/Ut89w8sYUEuSrCXvOwwxc8SbII/Wkn4ZkBxlD1gbk NPzv8AGOs/OjwjASd+MU/IfNRSMln3JjGFjKk2/8jE63uoh/iim1UeIrLSFQjJM52g7q HZL2WCedvzknHEv5ITHtkPXPW5G+TNVhNB/czRjBlWnIIiwDCTvJ/O3u2ixxbhcGYe2z qgBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject; bh=kgR+WTR0ElA4/0brPafwCDFwasi9SAoggKmI0fcQCQA=; b=c7AIS12ewDKLIPN7pr0ZkpaBfzXkSMpRadPH5hGX8z3wG00CW3YVcJvKBmuztpvnN5 2pMEZR3ZMFxfEuCpodGWIZ3Lv+N+6jPNt4nbx8hGVt3a7fv39cFCW4ZsU85Hj/EepKfY 3QUSy1DuB/NHVa8s1SfbdrHmRxrDlfbfXzQDhq9WSA6PYqXbxNYommykWqYB3zHp9bh6 wHs3/Opj5Ka/hw9Xnsgpn2kMvz07htQNKN1jV1Vz3nhDTFuW4eMldGmvoqF/K86b8vrH YHmbPbQmjXzrRYfbrbzt4tRO6gyWQfgDcC9ZhhwG/X8MOIcg4ZS/QaB9lPOY7TKUNLTB WwVg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id n189si157507lfa.4.2019.01.31.02.11.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 02:11:06 -0800 (PST) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.14 as permitted sender) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id x0VAB4B7016388 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 Jan 2019 11:11:04 +0100 Received: from [139.25.69.181] (linux-ses-ext02.ppmd.siemens.net [139.25.69.181]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x0VAB3DG027169; Thu, 31 Jan 2019 11:11:04 +0100 Subject: Re: [PATCH v2 4/4] meta-isar: added nand-ubi-demo example to demonstrate UBI use To: Henning Schild Cc: isar-users@googlegroups.com, Claudius Heine References: <20190130080229.604-1-claudius.heine.ext@siemens.com> <20190130080229.604-5-claudius.heine.ext@siemens.com> <20190130173228.73488cec@md1za8fc.ad001.siemens.net> From: Claudius Heine Message-ID: Date: Thu, 31 Jan 2019 11:11:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190130173228.73488cec@md1za8fc.ad001.siemens.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: 5i+yT0DeQZGs 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" > wrote: > >> From: Claudius Heine >> >> Signed-off-by: Claudius Heine >> --- >> 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