From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6626719792838475776 X-Received: by 2002:a1c:55c8:: with SMTP id j191mr161748wmb.13.1542976521608; Fri, 23 Nov 2018 04:35:21 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:5444:: with SMTP id p4ls2683645wmi.1.gmail; Fri, 23 Nov 2018 04:35:21 -0800 (PST) X-Google-Smtp-Source: AJdET5cjMLixVNSnlANb7uNws/lAh+THcs9GpIyFvB4DZDAFX/RcLJJRh3u9j5GmF/0NSWXIylts X-Received: by 2002:a7b:cd90:: with SMTP id y16mr2052154wmj.19.1542976521114; Fri, 23 Nov 2018 04:35:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542976521; cv=none; d=google.com; s=arc-20160816; b=Z/p5UvpaNGUimQtC94aTA9GV+Bk83XiqPq1UoJGtGmw+NoOWW4ZyY9fJ2guwFg6uih YpmV6unPdjSPCzpKcjvXZ1PnRYKrG86s5A3FnQNByGV8tBUXEYGWWLTUr92l6ZqbeqNR Ln8NWaNAAZ2sKbNHbuBEuIpE65QVBTfH4k1KL+chmx8dMLNhmpW8dlMc70lgySqFLUx/ hNdL34BmrqkiESsXr/UyKR4s/+/uTgAxt/JZZpLeQwtQLUT/Luj18T/xZzxLlsvqJBpb j5UtIkQuvaonzp+g9rkiaMYbx13vdDOVsmnVqYB2ylvMKIxZ7Rzs28IC4GwHxIJRujm8 k1Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:references:to:subject; bh=5BB050jcaVpmkxRa94oRNhEW/XNI+A05M9ux/lsaBvc=; b=Bm/YSsUwfxkb/vh7Rkwo2sFjDR7BZPdrR5xNjAz9eRSyfEgVN1iyK5jqEiy1rf8CyH hTLBcwGoLK8t2Ww2Vl4SInC/Y5Jh8eyUA/wYBeEpN9M7ZmLqmi1xSU9Y8aNzmF3Mj99o SMkYxolKfzLX9kr9JYyKwFeQZgjKFdfeQK4pVyjE3djI+bNrxmxGuK7e2fa2RPHH0gxs C4RnQMghKxS5VUqfRCjJjDEmsPpYYw7v9A3639PxE3+lVoxLr6BoxGEey5c53lVz/HES jBR4fLELw6cxDImJFdimYkZeapTJNKW7pr7VsGtMEiJ3CSM+pkDoDJQY52RAkmWksVzt GwXg== 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 k140si254551wmd.2.2018.11.23.04.35.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Nov 2018 04:35:21 -0800 (PST) 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 [192.168.50.180] (nat-ppp-217.71.235.199-satnet-spb.ru [217.71.235.199] (may be forged)) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id wANCZIVB025433 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Fri, 23 Nov 2018 13:35:19 +0100 Subject: Re: [PATCH] linux-custom: Build as "builder:builder" and not as root To: Henning Schild , isar-users References: <20181122161701.2565-1-henning.schild@siemens.com> From: "Maxim Yu. Osipov" Organization: ilbers GmbH Message-ID: <2030cfc8-cf8b-64d0-739c-74db0d01acd1@ilbers.de> Date: Fri, 23 Nov 2018 15:35:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20181122161701.2565-1-henning.schild@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: KQH1/a2ESzJ4 On 11/22/18 7:17 PM, Henning Schild wrote: > In line with previous patches, avoid "root" in buildchroot to avoid > permission problems between the host and the chroot. Applied to the 'next', Thanks, Maxim. > Signed-off-by: Henning Schild > --- > meta/recipes-kernel/linux/files/build-kernel.sh | 10 ++++------ > meta/recipes-kernel/linux/linux-custom.inc | 8 +++----- > 2 files changed, 7 insertions(+), 11 deletions(-) > > diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh b/meta/recipes-kernel/linux/files/build-kernel.sh > index 32d62bf..dbd6162 100644 > --- a/meta/recipes-kernel/linux/files/build-kernel.sh > +++ b/meta/recipes-kernel/linux/files/build-kernel.sh > @@ -1,4 +1,4 @@ > -#!/bin/sh > +#!/bin/bash > # > # Custom kernel build > # > @@ -7,10 +7,9 @@ > # > # SPDX-License-Identifier: MIT > > -set -e > +source /isar/common.sh > > host_arch=$(dpkg --print-architecture) > -target_arch=$2 > > if [ "$host_arch" != "$target_arch" ]; then > case $target_arch in > @@ -33,7 +32,6 @@ REPACK_DIR="$1/../repack" > REPACK_LINUX_IMAGE_DIR="${REPACK_DIR}/linux-image" > REPACK_LINUX_HEADERS_DIR="${REPACK_DIR}/linux-headers" > > -cd $1 > if [ -e .config ]; then > make olddefconfig > else > @@ -118,9 +116,9 @@ dpkg-gencontrol -crepack/debian/control \ > -DDepends="${KERNEL_HEADERS_DEBIAN_DEPENDS}" \ > -DArchitecture=$target_arch > > -dpkg-deb -b ${REPACK_LINUX_IMAGE_DIR} \ > +fakeroot dpkg-deb -b ${REPACK_LINUX_IMAGE_DIR} \ > linux-image-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb > rm -f linux-image-${PV}_${PV}-1_*.deb > -dpkg-deb -b ${REPACK_LINUX_HEADERS_DIR} \ > +fakeroot dpkg-deb -b ${REPACK_LINUX_HEADERS_DIR} \ > linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb > rm -f linux-headers-${PV}_${PV}-1_*.deb > diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc > index d9b2935..f33bb9d 100644 > --- a/meta/recipes-kernel/linux/linux-custom.inc > +++ b/meta/recipes-kernel/linux/linux-custom.inc > @@ -47,11 +47,9 @@ do_install_builddeps[lockfiles] += "${REPO_ISAR_DIR}/isar.lock" > do_install_builddeps[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}" > > dpkg_runbuild() { > - # Install package builder script > - sudo install -m 755 ${WORKDIR}/build-kernel.sh ${BUILDCHROOT_DIR} > - > + chmod +x ${WORKDIR}/build-kernel.sh > if [ -n "${KERNEL_DEFCONFIG}" ]; then > - sudo cp ${WORKDIR}/${KERNEL_DEFCONFIG} ${S}/.config > + cp ${WORKDIR}/${KERNEL_DEFCONFIG} ${S}/.config > fi > > E="${@ bb.utils.export_proxies(d)}" > @@ -63,5 +61,5 @@ dpkg_runbuild() { > export KERNEL_DEBIAN_DEPENDS="${KERNEL_DEBIAN_DEPENDS}" > export KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}" > > - sudo -E chroot ${BUILDCHROOT_DIR} /build-kernel.sh ${PP}/${PPS} ${DISTRO_ARCH} > + sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} ${PP}/build-kernel.sh ${PP}/${PPS} ${DISTRO_ARCH} > } > -- Maxim Osipov ilbers GmbH Maria-Merian-Str. 8 85521 Ottobrunn Germany +49 (151) 6517 6917 mosipov@ilbers.de http://ilbers.de/ Commercial register Munich, HRB 214197 General Manager: Baurzhan Ismagulov