From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6566568349648551936 X-Received: by 2002:a2e:95cf:: with SMTP id y15-v6mr285757ljh.20.1528898335930; Wed, 13 Jun 2018 06:58:55 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a19:4312:: with SMTP id q18-v6ls458257lfa.5.gmail; Wed, 13 Jun 2018 06:58:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIkmAQ2HKs8TBmDQ99Xa5h+dsSBjDVsGOrN53q1VcKPBt9Zs/2BcgWJtTZcHxdWjTlW0Gxf X-Received: by 2002:a19:c909:: with SMTP id z9-v6mr263830lff.42.1528898335445; Wed, 13 Jun 2018 06:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528898335; cv=none; d=google.com; s=arc-20160816; b=faJajXOUl3e1umvDlUJaL3A4oc0xjiE9G5JmITQbrnIJxxv31FsBDbFdjnbpyeiqOZ 4RLv4ZhJ4+rXZaG7Jg4vyTNoHRcDP9Qzt8qwsRAMdsZ4oBK3EggDhac1Y3ytr9zdqZRF zt+tr0YELiWea90AXsQVyx3/E0UIK3rYhpbEFwUFR9GdfCUZbAvmTv0QurYktRwmijOT Hc+esY2PmmAKddYJZfpS/alDWomb3H2zpjC8Yn7ZlrjlXa52IonB1hkmYMtP/2jiD6/c qGqp8n+BArYitDbKzrAW8kmQPgqDPIhY8pUP7dSyT2/PPe7OjDlC79ApjEmXFmVneMqF T/CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :arc-authentication-results; bh=T3uCbRMugYYHi2W40MUIOylzXLbrJmPqYqoI/hiyK5M=; b=PX6RPgN8GAnOegLJQn3Be7kaFCvqUbPzz//XlsrU3L7wEQjfRQQUuDupXben0ms4oZ z7424rgHz1FGvhIbjv4OM87O8FoZeQVE3s2DWATNJ6T589MSMCKXI7SQBSdC1rLpPmGv iImu9emY7p/7KGkCquLAOWaAEjRuMAMH/tRz1Hwd9DOfM3aRc3E2iJDRb2+CMSArt6IC AhhgLHNazYHz31MI8/wea5QUMPFfcDFldr3nkseJaHdgsfzxfCxTTq6mv705sc8QcVzU 4K06aCIgRpH7aVM3KPy92Kdct5w1WurBHR8G7Xm1GkIndsBNlT/FHlKifXo0pm2bnS5L rZEw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id u23-v6si71591lji.3.2018.06.13.06.58.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 06:58:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Received: from azat.i.ilbers.de (host-80-81-17-52.static.customer.m-online.net [80.81.17.52]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id w5DDwUeT030155 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NOT) for ; Wed, 13 Jun 2018 15:58:54 +0200 From: "Maxim Yu. Osipov" To: isar-users@googlegroups.com Subject: [RFC PATCH 2/6] isar-debootstrap: split into host and target recipes Date: Wed, 13 Jun 2018 15:58:25 +0200 Message-Id: <20180613135829.3151-3-mosipov@ilbers.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180613135829.3151-1-mosipov@ilbers.de> References: <20180613135829.3151-1-mosipov@ilbers.de> X-TUID: R8+Wtf45qeAH From: Alexander Smirnov This is required for ISAR SDK root filesystem development to split isar-bootstrap for target platform and host (SDK). Signed-off-by: Alexander Smirnov Signed-off-by: Maxim Yu. Osipov isar-bootstrap.inc} | 24 ---------------- meta/recipes-devtools/buildchroot/buildchroot.bb | 4 +-- 7 files changed, 83 insertions(+), 32 deletions(-) create mode 100644 meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb create mode 100644 meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb rename meta/recipes-core/isar-bootstrap/{isar-bootstrap.bb => isar-bootstrap.inc} (89%) diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb index 6cdc6b2..947f4fc 100644 --- a/meta-isar/recipes-core/images/isar-image-base.bb +++ b/meta-isar/recipes-core/images/isar-image-base.bb @@ -40,7 +40,7 @@ devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 # End /etc/fstab EOF - setup_root_file_system --clean --fstab "${WORKDIR}/fstab" \ + setup_target_root_file_system --clean --fstab "${WORKDIR}/fstab" \ "${IMAGE_ROOTFS}" ${IMAGE_PREINSTALL} ${IMAGE_INSTALL} # Configure root filesystem diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 3bdcb2f..4738cb8 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -47,7 +47,7 @@ INITRD_IMAGE ?= "${@get_image_name(d, 'initrd.img')[1]}" inherit ${IMAGE_TYPE} do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}" -do_rootfs[depends] = "isar-apt:do_cache_config isar-bootstrap:do_deploy" +do_rootfs[depends] = "isar-apt:do_cache_config isar-bootstrap-target:do_deploy" do_rootfs() { die "No root filesystem function defined, please implement in your recipe" diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass index 7a63914..51b7901 100644 --- a/meta/classes/isar-bootstrap-helper.bbclass +++ b/meta/classes/isar-bootstrap-helper.bbclass @@ -1,4 +1,4 @@ -# Helper functions for using isar-bootstrap +# Helper functions for using isar-bootstrap-* # # This software is a part of ISAR. # Copyright (c) Siemens AG, 2018 @@ -15,6 +15,10 @@ def reverse_bb_array(d, varname): return " ".join(i for i in array) setup_root_file_system() { + DIST="$1" + shift + ISAR_BOOTSTRAP_DIR="$1" + shift CLEAN="" COPYREPO="" FSTAB="" @@ -35,7 +39,7 @@ setup_root_file_system() { CLEAN_FILES="${ROOTFSDIR}/etc/hostname ${ROOTFSDIR}/etc/resolv.conf" sudo cp -Trpfx \ - "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}/" \ + "${DEPLOY_DIR_IMAGE}/$ISAR_BOOTSTRAP_DIR/" \ "$ROOTFSDIR" [ -n "${FSTAB}" ] && cat ${FSTAB} | sudo tee "$ROOTFSDIR/etc/fstab" @@ -46,9 +50,9 @@ setup_root_file_system() { sudo tee "$ROOTFSDIR/etc/apt/preferences.d/isar" >/dev/null if [ ${COPYREPO} ]; then - sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DISTRO} $ROOTFSDIR/isar-apt + sudo cp -Trpfx ${DEPLOY_DIR_APT}/${DIST} $ROOTFSDIR/isar-apt else - sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} $ROOTFSDIR/isar-apt + sudo mount --bind ${DEPLOY_DIR_APT}/${DIST} $ROOTFSDIR/isar-apt fi sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs $ROOTFSDIR/dev sudo mount -t proc none $ROOTFSDIR/proc @@ -87,3 +91,11 @@ setup_root_file_system() { sudo rm -f "$ROOTFSDIR/chroot-setup.sh" fi } + +setup_host_root_file_system() { + setup_root_file_system ${DISTRO_HOST} isar-bootstrap-host-${DISTRO}-${DISTRO_ARCH} "$@" +} + +setup_target_root_file_system() { + setup_root_file_system ${DISTRO} isar-bootstrap-target-${DISTRO}-${DISTRO_ARCH} "$@" +} diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb new file mode 100644 index 0000000..6f7480d --- /dev/null +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb @@ -0,0 +1,31 @@ +# Minimal debian root file system +# +# This software is a part of ISAR. +# Copyright (c) Siemens AG, 2018 +# +# SPDX-License-Identifier: MIT + +Description = "Minimal native Debian root file system" + +include isar-bootstrap.inc + +do_bootstrap[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" +do_bootstrap[vardeps] += "DISTRO_APT_SOURCES" +do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS" +do_bootstrap() { + if [ -e "${ROOTFSDIR}" ]; then + sudo umount -l "${ROOTFSDIR}/dev" || true + sudo umount -l "${ROOTFSDIR}/proc" || true + sudo rm -rf "${ROOTFSDIR}" + fi + E="${@bb.utils.export_proxies(d)}" + sudo -E "${DEBOOTSTRAP}" --verbose \ + --variant=minbase \ + --include=locales \ + ${@get_distro_components_argument(d)} \ + ${DEBOOTSTRAP_KEYRING} \ + "${@get_distro_suite(d)}" \ + "${ROOTFSDIR}" \ + "${@get_distro_source(d)}" +} +addtask bootstrap before do_build after do_generate_keyring diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb new file mode 100644 index 0000000..f65f1dd --- /dev/null +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb @@ -0,0 +1,32 @@ +# Minimal debian root file system +# +# This software is a part of ISAR. +# Copyright (c) Siemens AG, 2018 +# +# SPDX-License-Identifier: MIT + +Description = "Minimal native Debian root file system" + +include isar-bootstrap.inc + +do_bootstrap[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" +do_bootstrap[vardeps] += "DISTRO_APT_SOURCES" +do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS" +do_bootstrap() { + if [ -e "${ROOTFSDIR}" ]; then + sudo umount -l "${ROOTFSDIR}/dev" || true + sudo umount -l "${ROOTFSDIR}/proc" || true + sudo rm -rf "${ROOTFSDIR}" + fi + E="${@bb.utils.export_proxies(d)}" + sudo -E "${DEBOOTSTRAP}" --verbose \ + --variant=minbase \ + --arch="${DISTRO_ARCH}" \ + --include=locales \ + ${@get_distro_components_argument(d)} \ + ${DEBOOTSTRAP_KEYRING} \ + "${@get_distro_suite(d)}" \ + "${ROOTFSDIR}" \ + "${@get_distro_source(d)}" +} +addtask bootstrap before do_build after do_generate_keyring diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc similarity index 89% rename from meta/recipes-core/isar-bootstrap/isar-bootstrap.bb rename to meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index 497a4f4..c473ad6 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -5,8 +5,6 @@ # # SPDX-License-Identifier: MIT -Description = "Minimal debian root file system" - LICENSE = "gpl-2.0" LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe" FILESPATH_prepend := "${THISDIR}/files:" @@ -172,28 +170,6 @@ python do_apt_config_prepare() { } addtask apt_config_prepare before do_build after do_unpack -do_bootstrap[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" -do_bootstrap[vardeps] += "DISTRO_APT_SOURCES" -do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS" -do_bootstrap() { - if [ -e "${ROOTFSDIR}" ]; then - sudo umount -l "${ROOTFSDIR}/dev" || true - sudo umount -l "${ROOTFSDIR}/proc" || true - sudo rm -rf "${ROOTFSDIR}" - fi - E="${@bb.utils.export_proxies(d)}" - sudo -E "${DEBOOTSTRAP}" --verbose \ - --variant=minbase \ - --arch="${DISTRO_ARCH}" \ - --include=locales \ - ${@get_distro_components_argument(d)} \ - ${DEBOOTSTRAP_KEYRING} \ - "${@get_distro_suite(d)}" \ - "${ROOTFSDIR}" \ - "${@get_distro_source(d)}" -} -addtask bootstrap before do_build after do_generate_keyring - do_set_locale() { sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale" diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb index 538c577..5fa8691 100644 --- a/meta/recipes-devtools/buildchroot/buildchroot.bb +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -66,10 +66,10 @@ do_build[root_cleandirs] = "${BUILDCHROOT_DIR} \ ${BUILDCHROOT_DIR}/isar-apt \ ${BUILDCHROOT_DIR}/downloads \ ${BUILDCHROOT_DIR}/home/builder" -do_build[depends] = "isar-apt:do_cache_config isar-bootstrap:do_deploy" +do_build[depends] = "isar-apt:do_cache_config isar-bootstrap-target:do_deploy" do_build() { - setup_root_file_system "${BUILDCHROOT_DIR}" ${BUILDCHROOT_PREINSTALL} + setup_target_root_file_system "${BUILDCHROOT_DIR}" ${BUILDCHROOT_PREINSTALL} # Install package builder script sudo chmod -R a+rw "${BUILDCHROOT_DIR}/home/builder" -- 2.11.0