From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7291218501940805632 X-Received: by 2002:a05:6512:3189:b0:507:b836:f836 with SMTP id i9-20020a056512318900b00507b836f836mr9688680lfe.0.1698128650200; Mon, 23 Oct 2023 23:24:10 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6512:b8f:b0:503:a8b:c1b with SMTP id b15-20020a0565120b8f00b005030a8b0c1bls350156lfv.2.-pod-prod-02-eu; Mon, 23 Oct 2023 23:24:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9gx6jHJmh82vZ6+0je+KlSuaxi0T7NHD1vcScCx4ijQIr5eprS+xCxLOb+Yn2v8/jdndk X-Received: by 2002:ac2:44ac:0:b0:507:9d36:31fc with SMTP id c12-20020ac244ac000000b005079d3631fcmr7014588lfm.21.1698128648286; Mon, 23 Oct 2023 23:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698128648; cv=none; d=google.com; s=arc-20160816; b=ylfhCdMFlma/013J4pNu2JMwrzxINOmC+ixx3LwTw3SJt9f9Y8i/CUX3Yh0LWRiJiW NTr1AzyFsjea2uxzjzF2WbbjXF9plbLJy2CFupjwDX9Sy6wr1ZdaHZ/8ZGLzftDR0KH+ nYgwwc1cCj3P5vC/Zg1p69ReBi0WO1DRvusL+tsIO9KUMv09e3xbp0/FyRgPPfTs9/gg rqSomaFqrXiwbz1B10YNPc372TTAM810FmcfyjKqlq/4Kq2tkJU5ujCtl2VrRMpzT96r tQhfUsDzzZ5IhS6QMuTjrq19SO/IUKr0DHuIHCW5796PGn8HS6eNBgpZc5poWpDyntFR 40MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=s6JQfpJATffd5AKngZ2eAEkbNd0nwv6+n2l3pzTJimU=; fh=403AV4hwEHWB4lTYzGdOyLsp6fLjI4P6I+0rnADDAes=; b=wiDcbPxUlJsQ4JJ6yDUFkJMf4Uhf2114AFaQt1SE2kVkSVRptR0QT4zL1rj45MiW5N y4khPBFylGLaFmzMh0cCgVCP4lU8+t8U1sQnPoAwI7RQ5MDeQ8juM9+OIyKB2ElIbYZt sCDoEIH3/f5PhC1zpRxxdrKva7auaNytIvTfI5+axMGUbJVgvi1mrTfYTv0zmsejAONu Lm0aMR49Ichpw761e7xg94uOuQBsX19xqr/fidL3hhRBcfVC7chHlEE1AkOhXSazyPEy q7b55dYWjwvnwhO0w7k+fssHxdHjwSw55gZdknD+r6j0az0xPqMNbrJiVBvRwQTEsV4r uC0w== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id br26-20020a056512401a00b005032919f892si353706lfb.6.2023.10.23.23.24.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2023 23:24:08 -0700 (PDT) Received-SPF: pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of amikan@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=amikan@ilbers.de Received: from localhost.localdomain (r154-240-38-77-broadband.btv.lv [77.38.240.154] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 39O6O5W8024986 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Oct 2023 08:24:07 +0200 From: Anton Mikanovich To: isar-users@googlegroups.com Cc: Uladzimir Bely , Anton Mikanovich Subject: [PATCH v6 1/8] meta: Switch to mmdebstrap Date: Tue, 24 Oct 2023 09:23:51 +0300 Message-Id: <20231024062358.252053-2-amikan@ilbers.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231024062358.252053-1-amikan@ilbers.de> References: <20231024062358.252053-1-amikan@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: CjItFW5vL4JV From: Uladzimir Bely Instead of debootstrap, use mmdebstrap alternative. Internally, it uses apt and allows to debootstrap the distro from multiple repositories. Signed-off-by: Uladzimir Bely Signed-off-by: Anton Mikanovich --- meta-isar/conf/distro/ubuntu-common.inc | 4 -- .../isar-bootstrap/isar-bootstrap.inc | 64 ++++++++++--------- 2 files changed, 33 insertions(+), 35 deletions(-) diff --git a/meta-isar/conf/distro/ubuntu-common.inc b/meta-isar/conf/distro/ubuntu-common.inc index 6a990a89..afe96b73 100644 --- a/meta-isar/conf/distro/ubuntu-common.inc +++ b/meta-isar/conf/distro/ubuntu-common.inc @@ -18,10 +18,6 @@ HOST_DISTRO_BOOTSTRAP_KEYS += "${BOOTSTRAP_KEY}" # kernel package name is linux-image-generic in Ubuntu KERNEL_NAME = "generic" - -# that is what debootstrap_1.0.118ubuntu1 does anyways -DISTRO_DEBOOTSTRAP_SCRIPT = "/usr/share/debootstrap/scripts/gutsy" - DISTRO_CONFIG_SCRIPT ?= "debian-configscript.sh" DISTRO_KERNELS ?= " \ diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index 3477c2fb..9f1142ba 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -15,7 +15,6 @@ PV = "1.0" BOOTSTRAP_FOR_HOST ?= "0" -DEBOOTSTRAP ?= "qemu-debootstrap" ROOTFSDIR = "${WORKDIR}/rootfs" APTPREFS = "${WORKDIR}/apt-preferences" APTSRCS = "${WORKDIR}/apt-sources" @@ -23,12 +22,14 @@ APTSRCS_INIT = "${WORKDIR}/apt-sources-init" DISTRO_BOOTSTRAP_KEYFILES = "" THIRD_PARTY_APT_KEYFILES = "" DEPLOY_ISAR_BOOTSTRAP ?= "" -DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales" +DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales,usrmerge" DISTRO_BOOTSTRAP_BASE_PACKAGES:append:gnupg = ",gnupg" DISTRO_BOOTSTRAP_BASE_PACKAGES:append:https-support = ",ca-certificates" DISTRO_VARS_PREFIX ?= "${@'HOST_' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else ''}" BOOTSTRAP_DISTRO = "${@d.getVar('HOST_DISTRO' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else 'DISTRO')}" BOOTSTRAP_BASE_DISTRO = "${@d.getVar('HOST_BASE_DISTRO' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else 'BASE_DISTRO')}" +BOOTSTRAP_DISTRO_ARCH = "${@d.getVar('HOST_ARCH' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else 'DISTRO_ARCH')}" +BOOTSTRAP_TMPDIR = "${WORKDIR}/tempdir" FILESEXTRAPATHS:append = ":${BBPATH}" inherit deb-dl-dir @@ -39,7 +40,7 @@ python () { topdir = d.getVar("TOPDIR") # The cached repo key can be both for bootstrapping and apt package - # installation afterwards. However, debootstrap will include the key into + # installation afterwards. However, bootstrap will include the key into # the rootfs automatically thus the right place is distro_bootstrap_keys. if bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')): @@ -267,7 +268,7 @@ do_bootstrap[vardeps] += " \ ISAR_ENABLE_COMPAT_ARCH \ ${DISTRO_VARS_PREFIX}DISTRO_APT_SOURCES \ " -do_bootstrap[dirs] = "${DEPLOY_DIR_BOOTSTRAP}" +do_bootstrap[dirs] = "${DEPLOY_DIR_BOOTSTRAP} ${BOOTSTRAP_TMPDIR}" do_bootstrap[depends] = "base-apt:do_cache isar-apt:do_cache_config" do_bootstrap[network] = "${TASK_USE_NETWORK_AND_SUDO}" @@ -279,31 +280,35 @@ do_bootstrap() { bbfatal "${DISTRO_ARCH} does not have a compat arch" fi fi - debootstrap_args="--verbose --variant=minbase --include=${DISTRO_BOOTSTRAP_BASE_PACKAGES}" + bootstrap_args="--verbose --variant=minbase --include=${DISTRO_BOOTSTRAP_BASE_PACKAGES}" if [ -f "${DISTRO_BOOTSTRAP_KEYRING}" ]; then - debootstrap_args="$debootstrap_args --keyring=${DISTRO_BOOTSTRAP_KEYRING}" - fi - if [ "${ISAR_USE_CACHED_BASE_REPO}" = "1" -a -z "${BASE_REPO_KEY}" ]; then - debootstrap_args="$debootstrap_args --no-check-gpg" + bootstrap_args="$bootstrap_args --keyring=${DISTRO_BOOTSTRAP_KEYRING}" fi E="${@ isar_export_proxies(d)}" - export BOOTSTRAP_FOR_HOST debootstrap_args E + export BOOTSTRAP_FOR_HOST - sudo rm -rf --one-file-system "${ROOTFSDIR}" deb_dl_dir_import "${ROOTFSDIR}" "${BOOTSTRAP_BASE_DISTRO}-${BASE_DISTRO_CODENAME}" + sudo rm -rf --one-file-system "${ROOTFSDIR}" + mkdir -p "${ROOTFSDIR}" + + if [ ! -z "${SOURCE_DATE_EPOCH}" ]; then + export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}" + fi + + arch_param="--arch=${BOOTSTRAP_DISTRO_ARCH},${DISTRO_ARCH}" + + sudo TMPDIR="${BOOTSTRAP_TMPDIR}" mmdebstrap $bootstrap_args \ + $arch_param \ + --mode=unshare \ + ${@get_distro_components_argument(d)} \ + "${@get_distro_suite(d)}" \ + "${WORKDIR}/rootfs.tar.zst" \ + "${@get_distro_source(d)}" sudo -E -s <<'EOSUDO' set -e - if [ "${BOOTSTRAP_FOR_HOST}" = "0" ]; then - arch_param="--arch=${DISTRO_ARCH}" - fi - ${DEBOOTSTRAP} $debootstrap_args \ - $arch_param \ - ${@get_distro_components_argument(d)} \ - "${@get_distro_suite(d)}" \ - "${ROOTFSDIR}" \ - "${@get_distro_source(d)}" \ - ${DISTRO_DEBOOTSTRAP_SCRIPT} + + tar -xf "${WORKDIR}/rootfs.tar.zst" -C "${ROOTFSDIR}" --exclude="./dev/console" # Install apt config mkdir -p "${ROOTFSDIR}/etc/apt/preferences.d" @@ -389,7 +394,7 @@ do_bootstrap() { umount -l "${ROOTFSDIR}/sys" umount -l "${ROOTFSDIR}/base-apt" || true - # Finalize debootstrap by setting the link in deploy + # Finalize bootstrap by setting the link in deploy ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}" EOSUDO deb_dl_dir_export "${ROOTFSDIR}" "${BOOTSTRAP_BASE_DISTRO}-${BASE_DISTRO_CODENAME}" @@ -406,19 +411,16 @@ SSTATEPOSTINSTFUNCS += "bootstrap_sstate_finalize" bootstrap_sstate_prepare() { # this runs in SSTATE_BUILDDIR, which will be deleted automatically - lopts="--one-file-system --exclude=var/cache/apt/archives" - sudo tar -C $(dirname "${ROOTFSDIR}") -cpSf bootstrap.tar $lopts $(basename "${ROOTFSDIR}") - sudo chown $(id -u):$(id -g) bootstrap.tar + sudo cp -a "$(dirname "${ROOTFSDIR}")/rootfs.tar.zst" ./bootstrap.tar.zst + sudo chown $(id -u):$(id -g) bootstrap.tar.zst } bootstrap_sstate_finalize() { # this runs in SSTATE_INSTDIR - # - after building the bootstrap, the tar won't be there, but we also don't need to unpack - # - after restoring from cache, there will be a tar which we unpack and then delete - if [ -f bootstrap.tar ]; then - sudo tar -C $(dirname "${ROOTFSDIR}") -xpf bootstrap.tar - sudo ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}" - rm bootstrap.tar + if [ -f bootstrap.tar.zst ]; then + mv bootstrap.tar.zst "$(dirname "${ROOTFSDIR}")/rootfs.tar.zst" + sudo ln -Tfsr "$(dirname "${ROOTFSDIR}")/rootfs.tar.zst" \ + "${DEPLOY_ISAR_BOOTSTRAP}.tar.zst" fi } -- 2.34.1