From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6652197203295076352 X-Received: by 2002:a2e:9b99:: with SMTP id z25-v6mr6180lji.7.1549296268678; Mon, 04 Feb 2019 08:04:28 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a19:d9db:: with SMTP id s88ls1695058lfi.14.gmail; Mon, 04 Feb 2019 08:04:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IbR0WvypcZOac+vJg9HjIEvUdh2Ejqv57ftu8+jeZ7honhE27ukW41CY0eP6Krankxg/0oN X-Received: by 2002:ac2:50d1:: with SMTP id h17mr4347lfm.15.1549296268118; Mon, 04 Feb 2019 08:04:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549296268; cv=none; d=google.com; s=arc-20160816; b=QfACGjCSucqWsUwAR6cPS2+yKjvRyrCeDrt5Puz18LGNOvmCIUvT1yNiqONKIlbJp/ +MuJ0aGW2cJAoT2KV3vHB59+NOzUxnG06ojvfJipRdOBs2YkblaifgrnlwI7rBagPBse i4Cr/koteFbOeYOYsWrnkXyXJMt541I31X7RHtw/s1Yp8oqyRvJbcGmcYz3wEVcDEoaS WVs+lxL6bUJIHm8sjLIbh9QgjS/A6DGVqwAQHfCOndO5KCB57+a0DLMoBXrVajBoQ33M JSl8gTGEzXBgrsXi849KHFHPRuEUkbXfeeqLUWSIhI8IIA775+bsspspqTlXoef6FGLk Y+iw== 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:references:cc:to:from:subject; bh=xIr9xqmvVpGG5mhS8Wc1YbQTuxPSp/cWjEGiCO+lC3U=; b=CNKrO5slAPb4Q4eI4bCnV4LQDkQFPrvmHdqahr82VLz6d0ZIXCj4Mbnu6bE0hdEyAb DvtcmfFkqSNtKaaub1e6FLCI7x5esuslonldANn1DQJ5jiRdEHOnQH/3V978hqyWYoLh fZMcj5gmyiw+9DKkeWaYup4OF8o8ets7CV5X+/6lCEpewRvpluSP+EwL/aCibnWYbUBk ILLbgSLG83+yGIZKkCD2LX022yx4+3vX3SdSir/Ba2pf1O2JF6PKtPakPy8ZfvzT6r4R LgRgN3GLd8kr/i+x5oa+2m9V+lk3n7lpfOAoE/lY8CPpHIbbplRZ/CYuo2WN8ZWpxEJy WckQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id h17-v6si852718ljj.0.2019.02.04.08.04.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Feb 2019 08:04:28 -0800 (PST) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id x14G4QpM003920 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 4 Feb 2019 17:04:26 +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 x14G4Q9p022235; Mon, 4 Feb 2019 17:04:26 +0100 Subject: Re: [PATCH v3 3/5] meta/classes: added ubi-img class From: Claudius Heine To: isar-users@googlegroups.com Cc: Claudius Heine References: <20190204155454.27465-1-claudius.heine.ext@siemens.com> <20190204155454.27465-4-claudius.heine.ext@siemens.com> Message-ID: <3ee29562-c39f-6ce4-f55d-6309a4d48196@siemens.com> Date: Mon, 4 Feb 2019 17:04:26 +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: <20190204155454.27465-4-claudius.heine.ext@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: eraD+S7751CD On 04/02/2019 16.54, [ext] claudius.heine.ext@siemens.com wrote: > From: Claudius Heine > > 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. Ups, forgot to change the description here. Will do that on v4 > > Signed-off-by: Claudius Heine > --- > 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 > -- 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