From: "Maxim Yu. Osipov" <mosipov@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH v2 1/7] isar-bootstrap: Move common part to include.
Date: Fri, 22 Jun 2018 14:40:16 +0200 [thread overview]
Message-ID: <20180622124022.30192-2-mosipov@ilbers.de> (raw)
In-Reply-To: <20180622124022.30192-1-mosipov@ilbers.de>
From: Alexander Smirnov <asmirnov@ilbers.de>
Eventually there should be two bootstraps: host and target. This
patch derives the acrchitecture independent part of original isar-bootstrap
recipe and puts it in header file, the rest is moved to the target part.
Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de>
---
meta/classes/image.bbclass | 2 +-
.../isar-bootstrap/isar-bootstrap-target.bb | 74 +++++++++++++++++++
.../{isar-bootstrap.bb => isar-bootstrap.inc} | 83 ++++------------------
meta/recipes-devtools/buildchroot/buildchroot.bb | 2 +-
4 files changed, 88 insertions(+), 73 deletions(-)
create mode 100644 meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
rename meta/recipes-core/isar-bootstrap/{isar-bootstrap.bb => isar-bootstrap.inc} (68%)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 3bdcb2f..4738cb8 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -47,7 +47,7 @@ INITRD_IMAGE ?= "${@get_image_name(d, 'initrd.img')[1]}"
inherit ${IMAGE_TYPE}
do_rootfs[stamp-extra-info] = "${MACHINE}-${DISTRO}"
-do_rootfs[depends] = "isar-apt:do_cache_config isar-bootstrap:do_deploy"
+do_rootfs[depends] = "isar-apt:do_cache_config isar-bootstrap-target:do_deploy"
do_rootfs() {
die "No root filesystem function defined, please implement in your recipe"
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
new file mode 100644
index 0000000..77b5d8d
--- /dev/null
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb
@@ -0,0 +1,74 @@
+# Minimal target Debian root file system
+#
+# This software is a part of ISAR.
+# Copyright (c) Siemens AG, 2018
+#
+# SPDX-License-Identifier: MIT
+
+Description = "Minimal target Debian root file system"
+
+WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
+
+include isar-bootstrap.inc
+
+do_generate_keyring[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+
+do_apt_config_prepare[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_apt_config_prepare[dirs] = "${WORKDIR}"
+do_apt_config_prepare[vardeps] += "\
+ APTPREFS \
+ DISTRO_APT_PREFERENCES \
+ DEBDISTRONAME \
+ APTSRCS \
+ DISTRO_APT_SOURCES \
+ "
+python do_apt_config_prepare() {
+ apt_preferences_out = d.getVar("APTPREFS", True)
+ apt_preferences_list = (d.getVar("DISTRO_APT_PREFERENCES", True) or ""
+ ).split()
+ aggregate_files(d, apt_preferences_list, apt_preferences_out)
+
+ apt_sources_out = d.getVar("APTSRCS", True)
+ apt_sources_list = (d.getVar("DISTRO_APT_SOURCES", True) or "").split()
+
+ aggregate_aptsources_list(d, apt_sources_list, apt_sources_out)
+}
+addtask apt_config_prepare before do_build after do_unpack
+
+do_apt_config_install[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+
+do_bootstrap[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_bootstrap[vardeps] += "DISTRO_APT_SOURCES"
+do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS"
+do_bootstrap() {
+ if [ -e "${ROOTFSDIR}" ]; then
+ sudo umount -l "${ROOTFSDIR}/dev" || true
+ sudo umount -l "${ROOTFSDIR}/proc" || true
+ sudo rm -rf "${ROOTFSDIR}"
+ fi
+ E="${@bb.utils.export_proxies(d)}"
+ sudo -E "${DEBOOTSTRAP}" --verbose \
+ --variant=minbase \
+ --arch="${DISTRO_ARCH}" \
+ --include=locales \
+ ${@get_distro_components_argument(d, False)} \
+ ${DEBOOTSTRAP_KEYRING} \
+ "${@get_distro_suite(d, False)}" \
+ "${ROOTFSDIR}" \
+ "${@get_distro_source(d, False)}"
+}
+addtask bootstrap before do_build after do_generate_keyring
+
+do_deploy[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
+do_deploy() {
+ ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_DIR_IMAGE}/isar-bootstrap-${DISTRO}-${DISTRO_ARCH}"
+}
+addtask deploy before do_build after do_apt_update
+
+do_apt_update[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
+
+CLEANFUNCS = "clean_deploy"
+clean_deploy() {
+ rm -f "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${DISTRO_ARCH}"
+}
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
similarity index 68%
rename from meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
rename to meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 497a4f4..18ec72f 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.bb
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -5,8 +5,6 @@
#
# SPDX-License-Identifier: MIT
-Description = "Minimal debian root file system"
-
LICENSE = "gpl-2.0"
LIC_FILES_CHKSUM = "file://${LAYERDIR_isar}/licenses/COPYING.GPLv2;md5=751419260aa954499f7abaabaa882bbe"
FILESPATH_prepend := "${THISDIR}/files:"
@@ -17,7 +15,6 @@ SRC_URI = " \
file://chroot-setup.sh"
PV = "1.0"
-WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}"
DEBOOTSTRAP ?= "qemu-debootstrap"
ROOTFSDIR = "${WORKDIR}/rootfs"
APTPREFS = "${WORKDIR}/apt-preferences"
@@ -111,8 +108,11 @@ def aggregate_aptsources_list(d, file_list, file_out):
out_fd.write("\n".encode())
out_fd.write("\n".encode())
-def get_distro_primary_source_entry(d):
- apt_sources_list = (d.getVar("DISTRO_APT_SOURCES", True) or "").split()
+def get_distro_primary_source_entry(d, is_host=False):
+ if is_host:
+ apt_sources_list = (d.getVar("HOST_DISTRO_APT_SOURCES", True) or "").split()
+ else:
+ apt_sources_list = (d.getVar("DISTRO_APT_SOURCES", True) or "").split()
for entry in apt_sources_list:
entry_real = bb.parse.resolve_file(entry, d)
with open(entry_real, "r") as in_fd:
@@ -124,20 +124,19 @@ def get_distro_primary_source_entry(d):
return parsed[2:]
return ["", "", ""]
-def get_distro_source(d):
- return get_distro_primary_source_entry(d)[0]
+def get_distro_source(d, is_host):
+ return get_distro_primary_source_entry(d, is_host)[0]
-def get_distro_suite(d):
- return get_distro_primary_source_entry(d)[1]
+def get_distro_suite(d, is_host):
+ return get_distro_primary_source_entry(d, is_host)[1]
-def get_distro_components_argument(d):
- components = get_distro_primary_source_entry(d)[2]
+def get_distro_components_argument(d, is_host):
+ components = get_distro_primary_source_entry(d, is_host)[2]
if components and components.strip():
return "--components=%s" % ",".join(components.split())
else:
return ""
-do_generate_keyring[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
do_generate_keyring[dirs] = "${WORKDIR}"
do_generate_keyring[vardeps] += "DISTRO_APT_KEYS"
do_generate_keyring() {
@@ -150,50 +149,6 @@ do_generate_keyring() {
}
addtask generate_keyring before do_build after do_unpack
-do_apt_config_prepare[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
-do_apt_config_prepare[dirs] = "${WORKDIR}"
-do_apt_config_prepare[vardeps] += "\
- APTPREFS \
- DISTRO_APT_PREFERENCES \
- DEBDISTRONAME \
- APTSRCS \
- DISTRO_APT_SOURCES \
- "
-python do_apt_config_prepare() {
- apt_preferences_out = d.getVar("APTPREFS", True)
- apt_preferences_list = (d.getVar("DISTRO_APT_PREFERENCES", True) or ""
- ).split()
- aggregate_files(d, apt_preferences_list, apt_preferences_out)
-
- apt_sources_out = d.getVar("APTSRCS", True)
- apt_sources_list = (d.getVar("DISTRO_APT_SOURCES", True) or "").split()
-
- aggregate_aptsources_list(d, apt_sources_list, apt_sources_out)
-}
-addtask apt_config_prepare before do_build after do_unpack
-
-do_bootstrap[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
-do_bootstrap[vardeps] += "DISTRO_APT_SOURCES"
-do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS"
-do_bootstrap() {
- if [ -e "${ROOTFSDIR}" ]; then
- sudo umount -l "${ROOTFSDIR}/dev" || true
- sudo umount -l "${ROOTFSDIR}/proc" || true
- sudo rm -rf "${ROOTFSDIR}"
- fi
- E="${@bb.utils.export_proxies(d)}"
- sudo -E "${DEBOOTSTRAP}" --verbose \
- --variant=minbase \
- --arch="${DISTRO_ARCH}" \
- --include=locales \
- ${@get_distro_components_argument(d)} \
- ${DEBOOTSTRAP_KEYRING} \
- "${@get_distro_suite(d)}" \
- "${ROOTFSDIR}" \
- "${@get_distro_source(d)}"
-}
-addtask bootstrap before do_build after do_generate_keyring
-
do_set_locale() {
sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale"
@@ -213,7 +168,6 @@ def get_host_release():
rel = platform.release()
return rel
-do_apt_config_install[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
do_apt_config_install() {
sudo mkdir -p "${ROOTFSDIR}/etc/apt/preferences.d"
sudo install -v -m644 "${APTPREFS}" \
@@ -226,14 +180,13 @@ do_apt_config_install() {
sudo install -v -m644 "${WORKDIR}/isar-apt.conf" \
"${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf"
- if [ "${@get_distro_suite(d)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then
+ if [ "${@get_distro_suite(d, True)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then
sudo install -v -m644 "${WORKDIR}/isar-apt-fallback.conf" \
"${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf"
fi
}
addtask apt_config_install before do_build after do_bootstrap do_apt_config_prepare
-do_apt_update[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
do_apt_update() {
sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev
sudo mount -t proc none ${ROOTFSDIR}/proc
@@ -245,15 +198,3 @@ do_apt_update() {
-o Debug::pkgProblemResolver=yes
}
addtask apt_update before do_build after do_apt_config_install do_set_locale do_setup_chroot
-
-do_deploy[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
-do_deploy[dirs] = "${DEPLOY_DIR_IMAGE}"
-do_deploy() {
- ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${DISTRO_ARCH}"
-}
-addtask deploy before do_build after do_apt_update
-
-CLEANFUNCS = "clean_deploy"
-clean_deploy() {
- rm -f "${DEPLOY_DIR_IMAGE}/${PN}-${DISTRO}-${DISTRO_ARCH}"
-}
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index 2ed5cf2..e0d2302 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -66,7 +66,7 @@ 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[depends] = "isar-apt:do_cache_config isar-bootstrap-target:do_deploy"
do_build() {
setup_root_file_system "${BUILDCHROOT_DIR}" ${BUILDCHROOT_PREINSTALL}
--
2.11.0
next prev parent reply other threads:[~2018-06-22 12:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-22 12:40 [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
2018-06-22 12:40 ` Maxim Yu. Osipov [this message]
2018-06-22 12:40 ` [PATCH v2 2/7] isar-bootstrap: Add host architecture support Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 3/7] isar-bootstrap-helper: Add option --copyisarapt to setup_root_file_system() Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 4/7] sdkchroot: Added recipe-devel to create SDK root filesystem Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 5/7] meta/class/image: Add populate_sdk task to trigger SDK rootfs creation Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 6/7] scripts: Add helper scripts to mount/umount chroot directory Maxim Yu. Osipov
2018-06-22 12:40 ` [PATCH v2 7/7] doc: Add description of ISAR SDK root filesystem creation Maxim Yu. Osipov
2018-06-29 12:57 ` [PATCH v2 0/7] Add ISAR SDK support Maxim Yu. Osipov
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=20180622124022.30192-2-mosipov@ilbers.de \
--to=mosipov@ilbers.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