public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "[ext] claudius.heine.ext@siemens.com"
	<claudius.heine.ext@siemens.com>,
	isar-users@googlegroups.com
Cc: Claudius Heine <ch@denx.de>
Subject: Re: [PATCH v2 4/5] meta-isar/isar-image-base: switch to using isar-bootstrap
Date: Fri, 23 Feb 2018 21:45:26 +0100	[thread overview]
Message-ID: <df50b25a-f507-cadc-f7bb-58b3734540be@siemens.com> (raw)
In-Reply-To: <20180222131901.20915-5-claudius.heine.ext@siemens.com>

On 2018-02-22 14:19, [ext] claudius.heine.ext@siemens.com wrote:
> From: Claudius Heine <ch@denx.de>
> 
> This patch removes the multistrap dependency of the isar-image-base
> recipe and changes it to use the 'isar-bootstrap' and
> 'isar-bootstrap-helper' instead.
> 
> Signed-off-by: Claudius Heine <ch@denx.de>
> ---
>  .../recipes-core/images/files/download_dev-random  | 24 -------
>  .../recipes-core/images/files/multistrap.conf.in   | 38 -----------
>  meta-isar/recipes-core/images/files/setup.sh       | 77 ----------------------
>  meta-isar/recipes-core/images/isar-image-base.bb   | 61 +++++------------
>  meta/classes/image.bbclass                         |  2 +-
>  5 files changed, 17 insertions(+), 185 deletions(-)
>  delete mode 100644 meta-isar/recipes-core/images/files/download_dev-random
>  delete mode 100644 meta-isar/recipes-core/images/files/multistrap.conf.in
>  delete mode 100755 meta-isar/recipes-core/images/files/setup.sh
> 
> diff --git a/meta-isar/recipes-core/images/files/download_dev-random b/meta-isar/recipes-core/images/files/download_dev-random
> deleted file mode 100644
> index f7f5fe5..0000000
> --- a/meta-isar/recipes-core/images/files/download_dev-random
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -#!/bin/sh
> -#
> -# This software is a part of ISAR.
> -# Copyright (C) 2017 ilbers GmbH
> -
> -set -e
> -
> -readonly ROOTFS="$1"
> -
> -if [ ! -c ${ROOTFS}/dev/random ]; then
> -    rm -f ${ROOTFS}/dev/random
> -    mknod "${ROOTFS}/dev/random" c 1 8
> -    chmod 666 "${ROOTFS}/dev/random"
> -    chown 0:0 "${ROOTFS}/dev/random"
> -fi
> -
> -if [ ! -c ${ROOTFS}/dev/urandom ]; then
> -    rm -f ${ROOTFS}/dev/urandom
> -    mknod "${ROOTFS}/dev/urandom" c 1 9
> -    chmod 666 "${ROOTFS}/dev/urandom"
> -    chown 0:0 "${ROOTFS}/dev/urandom"
> -fi
> -
> -exit 0
> diff --git a/meta-isar/recipes-core/images/files/multistrap.conf.in b/meta-isar/recipes-core/images/files/multistrap.conf.in
> deleted file mode 100644
> index 432b6af..0000000
> --- a/meta-isar/recipes-core/images/files/multistrap.conf.in
> +++ /dev/null
> @@ -1,38 +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## Isar
> -aptsources=##DISTRO_MULTICONF_APTSOURCES##
> -configscript=##CONFIG_SCRIPT##
> -setupscript=##SETUP_SCRIPT##
> -hookdir=##DIR_HOOKS##
> -
> -[base]
> -source=##DISTRO_APT_SOURCE##
> -suite=##DISTRO_SUITE##
> -components=##DISTRO_COMPONENTS##
> -packages=##IMAGE_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]
> -packages=##IMAGE_INSTALL##
> -source=##DEPLOY_DIR_APT##
> -suite=##ISAR_DISTRO_SUITE##
> -components=main
> -omitdebsrc=true
> diff --git a/meta-isar/recipes-core/images/files/setup.sh b/meta-isar/recipes-core/images/files/setup.sh
> deleted file mode 100755
> index 86c065c..0000000
> --- a/meta-isar/recipes-core/images/files/setup.sh
> +++ /dev/null
> @@ -1,77 +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 postinstall during the initial "dpkg
> -# --configure -a" under QEMU on the build host
> -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 postinstall
> -# during the initial "dpkg --configure -a" under QEMU on the build host
> -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
> diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
> index b444258..6047dd0 100644
> --- a/meta-isar/recipes-core/images/isar-image-base.bb
> +++ b/meta-isar/recipes-core/images/isar-image-base.bb
> @@ -9,14 +9,12 @@ LICENSE = "gpl-2.0"
>  LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
>  
>  FILESPATH =. "${LAYERDIR_isar}/recipes-core/images/files:"
> -SRC_URI = "file://multistrap.conf.in \
> -	   file://${DISTRO_CONFIG_SCRIPT} \
> -	   file://setup.sh \
> -	   file://download_dev-random"
> +SRC_URI = "file://${DISTRO_CONFIG_SCRIPT}"
>  
>  PV = "1.0"
>  
>  inherit image
> +inherit isar-bootstrap-helper
>  
>  IMAGE_INSTALL += "linux-image-${KERNEL_NAME}"
>  
> @@ -28,50 +26,23 @@ IMAGE_PREINSTALL += "apt \
>  
>  WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
>  
> -do_rootfs[dirs] = "${WORKDIR}/hooks_multistrap"
> +do_rootfs[cleandirs] = "${IMAGE_ROOTFS} \
> +                        ${IMAGE_ROOTFS}/isar-apt"

Same issue as with the buildchroot: cleaning does not work.

Jan

>  
>  do_rootfs() {
> -    E="${@ bb.utils.export_proxies(d)}"
> -
> -    sudo rm -rf ${IMAGE_ROOTFS}
> -
> -    chmod +x "${WORKDIR}/${DISTRO_CONFIG_SCRIPT}"
> -    chmod +x "${WORKDIR}/setup.sh"
> -    install -m 755 "${WORKDIR}/download_dev-random" "${WORKDIR}/hooks_multistrap/"
> -
> -    # 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|##IMAGE_PREINSTALL##|${IMAGE_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"'/${DISTRO_CONFIG_SCRIPT}|g' \
> -        -e 's|##SETUP_SCRIPT##|./'"$WORKDIR_REL"'/setup.sh|g' \
> -        -e 's|##DIR_HOOKS##|./'"$WORKDIR_REL"'/hooks_multistrap|g' \
> -        -e 's|##IMAGE_INSTALL##|${IMAGE_INSTALL}|g' \
> -        -e 's|##DEPLOY_DIR_APT##|copy:///${DEPLOY_DIR_APT}/${DISTRO}|g' \
> -        -e 's|##ISAR_DISTRO_SUITE##|${DEBDISTRONAME}|g' \
> -           "${WORKDIR}/multistrap.conf.in" > "${WORKDIR}/multistrap.conf"
> -
> -    # Do not use bitbake flag [dirs] here because this folder should have
> -    # specific ownership.
> -    [ ! -d ${IMAGE_ROOTFS}/proc ] && sudo install -d -o 0 -g 0 -m 555 ${IMAGE_ROOTFS}/proc
> -    sudo mount -t proc none ${IMAGE_ROOTFS}/proc
> -
> -    # Create root filesystem. We must use sudo -E here to preserve the environment
> -    # because of proxy settings
> -    sudo -E multistrap -a ${DISTRO_ARCH} -d "${IMAGE_ROOTFS}" -f "${WORKDIR}/multistrap.conf"
> +    setup_root_file_system "${IMAGE_ROOTFS}" ${IMAGE_PREINSTALL} ${IMAGE_INSTALL}
>  
>      # Configure root filesystem
> -    sudo chroot ${IMAGE_ROOTFS} /${DISTRO_CONFIG_SCRIPT} ${MACHINE_SERIAL} ${BAUDRATE_TTY} \
> -        ${ROOTFS_DEV}
> -    sudo rm "${IMAGE_ROOTFS}/${DISTRO_CONFIG_SCRIPT}"
> +    sudo install -m 755 "${WORKDIR}/${DISTRO_CONFIG_SCRIPT}" "${IMAGE_ROOTFS}"
> +    sudo chroot ${IMAGE_ROOTFS} /${DISTRO_CONFIG_SCRIPT} ${MACHINE_SERIAL} \
> +                                                         ${BAUDRATE_TTY} \
> +                                                         ${ROOTFS_DEV}
>  
> -    sudo umount ${IMAGE_ROOTFS}/proc 2>/dev/null || true
> +    # Cleanup
> +    sudo rm "${IMAGE_ROOTFS}/${DISTRO_CONFIG_SCRIPT}"
> +    sudo rm "${IMAGE_ROOTFS}/etc/apt/sources.list.d/isar-apt.list"
> +    sudo umount -l ${IMAGE_ROOTFS}/isar-apt
> +    sudo rmdir ${IMAGE_ROOTFS}/isar-apt
> +    sudo umount -l ${IMAGE_ROOTFS}/dev
> +    sudo umount -l ${IMAGE_ROOTFS}/proc
>  }
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 2c255f4..56038b3 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -19,7 +19,7 @@ INITRD_IMAGE ?= "${@get_image_name(d, 'initrd.img')}"
>  inherit ${IMAGE_TYPE}
>  
>  do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
> -do_rootfs[depends] = "isar-apt:do_cache_config"
> +do_rootfs[depends] = "isar-apt:do_cache_config isar-bootstrap:do_deploy"
>  
>  do_rootfs() {
>      die "No root filesystem function defined, please implement in your recipe"
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2018-02-23 20:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22 13:18 [PATCH v2 0/5] Debootstrap integration claudius.heine.ext
2018-02-22 13:18 ` [PATCH v2 1/5] implement isar-bootstrap using debootstrap claudius.heine.ext
2018-02-23 20:39   ` Jan Kiszka
2018-02-22 13:18 ` [PATCH v2 2/5] meta/isar-bootstrap-helper.bbclass: handle rfs customization centrally claudius.heine.ext
2018-02-22 13:18 ` [PATCH v2 3/5] meta/buildchroot: switch to using isar-bootstrap claudius.heine.ext
2018-02-23 20:44   ` Jan Kiszka
2018-02-22 13:19 ` [PATCH v2 4/5] meta-isar/isar-image-base: " claudius.heine.ext
2018-02-23 20:45   ` Jan Kiszka [this message]
2018-02-22 13:19 ` [PATCH v2 5/5] meta-isar/multiconfig: remove multistrap references claudius.heine.ext
2018-02-23 20:46   ` Jan Kiszka
2018-02-22 14:21 ` [PATCH v2 0/5] Debootstrap integration Alexander Smirnov
2018-02-22 18:09   ` Jan Kiszka
2018-02-23  7:40   ` Claudius Heine
2018-02-23 20:35     ` Jan Kiszka
2018-02-26  6:43       ` Jan Kiszka

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=df50b25a-f507-cadc-f7bb-58b3734540be@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=ch@denx.de \
    --cc=claudius.heine.ext@siemens.com \
    --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