From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6524973730788016128 X-Received: by 10.223.155.145 with SMTP id d17mr2200541wrc.30.1520439402720; Wed, 07 Mar 2018 08:16:42 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 10.223.201.145 with SMTP id f17ls634205wrh.5.gmail; Wed, 07 Mar 2018 08:16:42 -0800 (PST) X-Google-Smtp-Source: AG47ELsMxvely5ytHvbD5byWrT9TUibzte0QT+UFyJYmUDdbIpREfCW/IfoFEDfTVC/zMhYh7o5Y X-Received: by 10.223.169.234 with SMTP id b97mr2048824wrd.8.1520439402252; Wed, 07 Mar 2018 08:16:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520439402; cv=none; d=google.com; s=arc-20160816; b=Ad0AJ1LMWeDyLIvdr1QPsmJrlWlIrqLW3tyMb7kgCN8Jl+e1N4AfTe8VJ64qzrMTFL 6fNLfKrIw/BHEVBbZbQuj71fT80lqVjHEb1w3LvoimpJPVqdVcTwa+YlpPWmpq/Wieng nf9icczx2bjaqof6mxZGrQIRw49obUNEO/WGiNyWVqUJ0XAhNnQG/f7Iuw2y6no4PxBB lWEBcIJnIMXfGhak/a87qGLKCHIjIyZabplE7XBn7/jVd7itHTTquuU7InVhI5xwnnxZ BNpjUutMCPSLIejR0ge4VpFZ++iaauge6VJCW8V57Lfdv/LBLjuj1PIfoMu9R9aaokja e6MQ== 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:cc:to:from :arc-authentication-results; bh=5txGdeB0/DDmC1So14OKy155XB63KT6IydEGyjrbyzU=; b=kjLeOs8+nUjVU/uuyOgzJLC3rq5mVLJhPbLzG5mtOkWC6gD8+LPB/NcDUf/WkmwwVG btsnumN5g33NlhacBIPqylM9DkvO5DjG+RrzESup/1+bVp/jV9HtJM8Uv+k76QZKYkOo k6tkF0BgMDHl2q7IXolIXlI+ITdXlChb52Vw1Tmk3dSpu6+utqomGtAYh1HxKsZqlFDn uFIkEOo6ZbRFAOsv4mvCjq+MlsDPN2EblFjdAnMXnzcj4oFTPrjVeFWiS7u7OMzDHH2o NUmskUceN4QD+7JiQWQjRsvYifg88RBp4lkIcqMZDqUaJW8/Q8j5no9MsO+8fVLB7Gjl jFgg== 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 d4si105784wmh.2.2018.03.07.08.16.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Mar 2018 08:16:42 -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 mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id w27GGfA0025865 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 7 Mar 2018 17:16:41 +0100 Received: from ring.ppmd.siemens.net (linux-ses-ext02.ppmd.siemens.net [139.25.68.223]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id w27GGfLU003137; Wed, 7 Mar 2018 17:16:41 +0100 From: claudius.heine.ext@siemens.com To: isar-users@googlegroups.com Cc: Claudius Heine Subject: [PATCH v3 3/5] meta/buildchroot: switch to using isar-bootstrap Date: Wed, 7 Mar 2018 17:16:33 +0100 Message-Id: <20180307161635.30952-4-claudius.heine.ext@siemens.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180307161635.30952-1-claudius.heine.ext@siemens.com> References: <20180307161635.30952-1-claudius.heine.ext@siemens.com> X-TUID: A/Cd38hxsMdf From: Claudius Heine This patch removes the multistrap dependency of the buildchroot recipe and changes it to use the 'isar-bootstrap' and 'isar-bootstrap-helper' instead. Signed-off-by: Claudius Heine --- meta/recipes-core/isar-bootstrap/isar-bootstrap.bb | 2 +- meta/recipes-devtools/buildchroot/buildchroot.bb | 59 +++++----------- meta/recipes-devtools/buildchroot/files/build.sh | 2 +- .../buildchroot/files/configscript.sh | 10 --- .../buildchroot/files/multistrap.conf.in | 37 ---------- meta/recipes-devtools/buildchroot/files/setup.sh | 82 ---------------------- 6 files changed, 19 insertions(+), 173 deletions(-) delete mode 100644 meta/recipes-devtools/buildchroot/files/multistrap.conf.in delete mode 100755 meta/recipes-devtools/buildchroot/files/setup.sh diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb index 462edc5..2ddefa4 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb @@ -116,7 +116,7 @@ do_generate_keyring[dirs] = "${WORKDIR}" do_generate_keyring[vardeps] += "DISTRO_APT_KEYS" do_generate_keyring() { if [ -n "${@d.getVar("APTKEYFILES", True) or ""}" ]; then - for keyfile in ${@d.getVar("APTKEYFILES", True); do + for keyfile in ${@d.getVar("APTKEYFILES", True)}; do gpg --no-default-keyring --keyring "${APTKEYRING}" --import "$keyfile" done fi diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb index 2fc5297..b16e63a 100644 --- a/meta/recipes-devtools/buildchroot/buildchroot.bb +++ b/meta/recipes-devtools/buildchroot/buildchroot.bb @@ -8,13 +8,13 @@ DESCRIPTION = "Multistrap development filesystem" LICENSE = "gpl-2.0" LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe" -FILESPATH =. "${LAYERDIR_core}/recipes-devtools/buildchroot/files:" -SRC_URI = "file://multistrap.conf.in \ - file://configscript.sh \ - file://setup.sh \ +FILESPATH_prepend := "${THISDIR}/files:" +SRC_URI = "file://configscript.sh \ file://build.sh" PV = "1.0" +inherit isar-bootstrap-helper + BUILDCHROOT_PREINSTALL ?= "gcc \ make \ build-essential \ @@ -31,51 +31,26 @@ BUILDCHROOT_PREINSTALL ?= "gcc \ WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}" do_build[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" -do_build[depends] = "isar-apt:do_cache_config" +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() { - E="${@ bb.utils.export_proxies(d)}" - - # If buildchroot re-build is triggered, this ensure that we are always - # re-building a clean image: - sudo rm -rf ${BUILDCHROOT_DIR} - mkdir -p ${BUILDCHROOT_DIR}/isar-apt - mkdir -p ${BUILDCHROOT_DIR}/downloads - mkdir -p ${BUILDCHROOT_DIR}/dev - mkdir -p ${BUILDCHROOT_DIR}/proc - mkdir -p ${BUILDCHROOT_DIR}/sys - - chmod +x "${WORKDIR}/setup.sh" - chmod +x "${WORKDIR}/configscript.sh" - - # Multistrap accepts only relative path in configuration files, so get it: - cd ${TOPDIR} - WORKDIR_REL=${@ os.path.relpath(d.getVar("WORKDIR", True))} - - # Adjust multistrap config - sed -e 's|##BUILDCHROOT_PREINSTALL##|${BUILDCHROOT_PREINSTALL}|g' \ - -e 's|##DISTRO_MULTICONF_BOOTSTRAP##|${DISTRO_MULTICONF_BOOTSTRAP}|g' \ - -e 's|##DISTRO_MULTICONF_APTSOURCES##|${DISTRO_MULTICONF_APTSOURCES}|g' \ - -e 's|##DISTRO_APT_SOURCE##|${DISTRO_APT_SOURCE}|g' \ - -e 's|##DISTRO_APT_SOURCE_SEC##|${DISTRO_APT_SOURCE_SEC}|g' \ - -e 's|##DISTRO_SUITE##|${DISTRO_SUITE}|g' \ - -e 's|##DISTRO_COMPONENTS##|${DISTRO_COMPONENTS}|g' \ - -e 's|##CONFIG_SCRIPT##|./'"$WORKDIR_REL"'/configscript.sh|g' \ - -e 's|##SETUP_SCRIPT##|./'"$WORKDIR_REL"'/setup.sh|g' \ - -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \ - "${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf" - - sudo mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt - sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev - sudo mount -t proc none ${BUILDCHROOT_DIR}/proc - sudo mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads + CDIRS="${@d.expand(d.getVarFlags("do_build").get("root_cleandirs", ""))}" + if [ -n "$CDIRS" ]; then + sudo rm -rf $CDIRS + mkdir -p $CDIRS + fi - # Create root filesystem - sudo -E multistrap -a ${DISTRO_ARCH} -d "${BUILDCHROOT_DIR}" -f "${WORKDIR}/multistrap.conf" + setup_root_file_system "${BUILDCHROOT_DIR}" ${BUILDCHROOT_PREINSTALL} # Install package builder script + sudo chmod -R a+rw "${BUILDCHROOT_DIR}/home/builder" sudo install -m 755 ${WORKDIR}/build.sh ${BUILDCHROOT_DIR} # Configure root filesystem + sudo install -m 755 ${WORKDIR}/configscript.sh ${BUILDCHROOT_DIR} sudo chroot ${BUILDCHROOT_DIR} /configscript.sh } diff --git a/meta/recipes-devtools/buildchroot/files/build.sh b/meta/recipes-devtools/buildchroot/files/build.sh index 048f76f..06172f7 100644 --- a/meta/recipes-devtools/buildchroot/files/build.sh +++ b/meta/recipes-devtools/buildchroot/files/build.sh @@ -29,7 +29,7 @@ install_cmd="${install_cmd} --allow-unauthenticated" # APT::Get::List-Cleanup - do not erase obsolete packages list for # upstream in '/var/lib/apt/lists' apt-get update \ - -o Dir::Etc::sourcelist="sources.list.d/multistrap-isar-apt.list" \ + -o Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \ -o Dir::Etc::sourceparts="-" \ -o APT::Get::List-Cleanup="0" diff --git a/meta/recipes-devtools/buildchroot/files/configscript.sh b/meta/recipes-devtools/buildchroot/files/configscript.sh index a5942b5..c2a599a 100644 --- a/meta/recipes-devtools/buildchroot/files/configscript.sh +++ b/meta/recipes-devtools/buildchroot/files/configscript.sh @@ -31,13 +31,3 @@ debconf-set-selections < $TARGET/sbin/start-stop-daemon << EOF -#!/bin/sh -echo -echo Warning: Fake start-stop-daemon called, doing nothing -EOF - chmod 755 $TARGET/sbin/start-stop-daemon -fi - -if [ -x "$TARGET/sbin/initctl" ]; then - echo "start-stop-daemon: Trying to prevent daemons from starting in $TARGET" - - # Disable initctl - mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL" - cat > $TARGET/sbin/initctl << EOF -#!/bin/sh -echo -echo "Warning: Fake initctl called, doing nothing" -EOF - chmod 755 $TARGET/sbin/initctl -fi - -# Define sysvinit policy 101 to prevent daemons from starting in buildchroot -if [ -x "$TARGET/sbin/init" -a ! -f "$TARGET/usr/sbin/policy-rc.d" ]; then - echo "sysvinit: Using policy-rc.d to prevent daemons from starting in $TARGET" - - cat > $TARGET/usr/sbin/policy-rc.d << EOF -#!/bin/sh -echo "sysvinit: All runlevel operations denied by policy" >&2 -exit 101 -EOF - chmod a+x $TARGET/usr/sbin/policy-rc.d -fi - -case $ARCH in - armel|armhf) - qemu_arch=arm - ;; - arm64) - qemu_arch=aarch64 - ;; -esac - -# Install QEMU emulator to execute foreign binaries -if [ ! -x /usr/bin/qemu-${qemu_arch}-static ]; then - echo "qemu-${qemu_arch}-static binary not present, unable to execute target binaries" -else - sudo cp /usr/bin/qemu-${qemu_arch}-static ${TARGET}/usr/bin -fi - -# Set hostname -echo "isar" > $TARGET/etc/hostname - -# Create packages build folder -sudo install -d $TARGET/home/builder -sudo chmod -R a+rw $TARGET/home/builder - -# Install host networking settings -sudo cp /etc/resolv.conf $TARGET/etc -- 2.16.1