From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6652197203295076352 X-Received: by 2002:a1c:147:: with SMTP id 68mr297067wmb.21.1549367948779; Tue, 05 Feb 2019 03:59:08 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:dc04:: with SMTP id t4ls2274135wmg.12.gmail; Tue, 05 Feb 2019 03:59:08 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia1jhjuuB628obiRlb9P65gs2qHWNHJ66yrpG+H68TYvZrWnrOZF4FhcXWGnAcoBpegdEDM X-Received: by 2002:a7b:ce08:: with SMTP id m8mr339171wmc.22.1549367948381; Tue, 05 Feb 2019 03:59:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549367948; cv=none; d=google.com; s=arc-20160816; b=T3oRX59EUwyiPDnB/KsxDXKAb2tQ/FHWb+bvAVV6zynlFQOLcvCOG5ZrEAJyXCfEOR FIXjs2EO7IRZcQL/MJb4KA6qL7GtlYxyE8Vt2+7liYx6Ao4bR+faaMAhTfQWaK/0iwhE 5xUlRxY/EzWMI/eyoiksSFVLQzwzNNQSqlMyre2j0h3lEQxNbTnyQGDgs9BCWJa7/FJv m1Y0UH7joHWWXjA4OWZFlRvFUC8szjPjClij9Tx+AuwxgI84wBjMBN9VOvAg+79Ljrbi qFkeFYrkLVnWkqKC/UKW8bRP3R5qsSgRRasamBTg61F4rj0zT9zL9F8Pl5TL/PuWREmu 8Slw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=SIc+PZJ2HO+wKXe8YJfNEw/IxI1g5FF5x1d7U9HepAU=; b=XKL5wquHKTSmE/6H4UfgLyBVM1CPCY2z4xmrspRScqKXFL5BAHigGhTfyj7P/C8NJQ R1FP+iTTG+SSYGda1Znsv/Sw9ogUFeiE60AOa9VopXNeOqW6AZbSv3PDAf3E00s/fpz0 +R1IgmP6EmCb4aMen5vJcqPO0ZfwEuRvapXCduqAY9dLJxhcMhx/Nwn70+a6EkAOQhVE adlVoa4elgeSBoPW7Qt5IB2uw20k7jqO9+1Z8NeBP2C/yHQc3fQOYyVcDGHzFRuljvNp Z0OvaOrE7qUTH9/mPpfpoQb0x815bS7Hzw5VLK3d3rikQMPywVACBshrgO7t3kP7eHUy zZLg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Return-Path: Received: from lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id r6si7048wrv.2.2019.02.05.03.59.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 03:59:08 -0800 (PST) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id x15Bx7Hh019208 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Feb 2019 12:59:07 +0100 Received: from ring.ppmd.siemens.net (linux-ses-ext02.ppmd.siemens.net [139.25.69.181]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x15Bx7bH015872; Tue, 5 Feb 2019 12:59:07 +0100 From: claudius.heine.ext@siemens.com To: isar-users@googlegroups.com Cc: Claudius Heine Subject: [PATCH v4 3/5] meta/classes: added ubi-img class Date: Tue, 5 Feb 2019 12:59:04 +0100 Message-Id: <20190205115906.15204-4-claudius.heine.ext@siemens.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190205115906.15204-1-claudius.heine.ext@siemens.com> References: <20190205115906.15204-1-claudius.heine.ext@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: DRDY3+pDMs// From: Claudius Heine This class implements a new image type for UBI formatted nand flashes. 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 -- 2.20.1