From: claudius.heine.ext@siemens.com
To: isar-users@googlegroups.com
Cc: Claudius Heine <ch@denx.de>
Subject: [PATCH v5 3/5] meta/buildchroot: switch to using isar-bootstrap
Date: Tue, 3 Apr 2018 12:08:00 +0200 [thread overview]
Message-ID: <20180403100802.30710-4-claudius.heine.ext@siemens.com> (raw)
In-Reply-To: <20180403100802.30710-1-claudius.heine.ext@siemens.com>
From: Claudius Heine <ch@denx.de>
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 <ch@denx.de>
---
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 ----------------------
5 files changed, 18 insertions(+), 172 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-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 <<END
locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8
locales locales/default_environment_locale select en_US.UTF-8
END
-
-#set up non-interactive configuration
-export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
-export LC_ALL=C LANGUAGE=C LANG=C
-
-#run pre installation script
-/var/lib/dpkg/info/dash.preinst install
-
-#configuring packages
-dpkg --configure -a
diff --git a/meta/recipes-devtools/buildchroot/files/multistrap.conf.in b/meta/recipes-devtools/buildchroot/files/multistrap.conf.in
deleted file mode 100644
index 480a4b8..0000000
--- a/meta/recipes-devtools/buildchroot/files/multistrap.conf.in
+++ /dev/null
@@ -1,37 +0,0 @@
-# This software is a part of ISAR.
-# Copyright (C) 2015-2017 ilbers GmbH
-
-[General]
-noauth=true
-unpack=true
-ignorenativearch=true
-bootstrap=##DISTRO_MULTICONF_BOOTSTRAP##
-aptsources=isar-apt ##DISTRO_MULTICONF_APTSOURCES##
-configscript=##CONFIG_SCRIPT##
-setupscript=##SETUP_SCRIPT##
-hookdir=##DIR_HOOKS##
-
-[base]
-source=##DISTRO_APT_SOURCE##
-suite=##DISTRO_SUITE##
-components=##DISTRO_COMPONENTS##
-packages=##BUILDCHROOT_PREINSTALL##
-omitdebsrc=true
-
-[updates]
-source=##DISTRO_APT_SOURCE##
-suite=##DISTRO_SUITE##-updates
-components=##DISTRO_COMPONENTS##
-omitdebsrc=true
-
-[security]
-source=##DISTRO_APT_SOURCE_SEC##
-suite=##DISTRO_SUITE##/updates
-components=##DISTRO_COMPONENTS##
-omitdebsrc=true
-
-[isar-apt]
-source=file:///isar-apt
-suite=isar
-components=main
-omitdebsrc=true
diff --git a/meta/recipes-devtools/buildchroot/files/setup.sh b/meta/recipes-devtools/buildchroot/files/setup.sh
deleted file mode 100755
index 1257739..0000000
--- a/meta/recipes-devtools/buildchroot/files/setup.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/sh
-#
-# This software is a part of ISAR.
-# Copyright (C) 2015-2016 ilbers GmbH
-#
-# Based on multistrap/examples/chroot.sh
-
-set -e
-
-# The script is called with the following arguments:
-# $1 = $DIR - the top directory of the bootstrapped system
-# $2 = $ARCH - the specified architecture, already checked with
-# dpkg-architecture.
-# setup.sh needs to be executable.
-
-TARGET=$1
-ARCH=$2
-
-# Prevent daemons from starting in buildchroot
-if [ -x "$TARGET/sbin/start-stop-daemon" ]; then
- echo "initctl: Trying to prevent daemons from starting in $TARGET"
-
- # Disable start-stop-daemon
- mv $TARGET/sbin/start-stop-daemon $TARGET/sbin/start-stop-daemon.REAL
- cat > $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.3
next prev parent reply other threads:[~2018-04-03 10:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-03 10:07 [PATCH v5 0/5] Debootstrap integration claudius.heine.ext
2018-04-03 10:07 ` [PATCH v5 1/5] implement isar-bootstrap using debootstrap claudius.heine.ext
2018-04-03 10:07 ` [PATCH v5 2/5] meta/isar-bootstrap-helper.bbclass: handle rfs customization centrally claudius.heine.ext
2018-04-03 10:08 ` claudius.heine.ext [this message]
2018-04-03 10:08 ` [PATCH v5 4/5] meta-isar/isar-image-base: switch to using isar-bootstrap claudius.heine.ext
2018-04-03 10:08 ` [PATCH v5 5/5] meta-isar/multiconfig: remove multistrap references claudius.heine.ext
2018-04-04 20:34 ` [PATCH v5 0/5] Debootstrap integration Baurzhan Ismagulov
2018-04-05 8:03 ` Claudius Heine
2018-04-05 9:16 ` Jan Kiszka
2018-04-11 6:28 ` Baurzhan Ismagulov
2018-04-11 6:58 ` Jan Kiszka
2018-04-11 7:04 ` Claudius Heine
2018-04-09 10:50 ` Jan Kiszka
2018-04-09 12:48 ` Baurzhan Ismagulov
2018-04-09 14:47 ` Jan Kiszka
2018-04-10 11:38 ` Claudius Heine
2018-04-10 20:49 ` Baurzhan Ismagulov
2018-04-11 5:59 ` Baurzhan Ismagulov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180403100802.30710-4-claudius.heine.ext@siemens.com \
--to=claudius.heine.ext@siemens.com \
--cc=ch@denx.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox