From: "Koch, Stefan" <stefan-koch@siemens.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>
Cc: "Kiszka, Jan" <jan.kiszka@siemens.com>,
"ubely@ilbers.de" <ubely@ilbers.de>,
"Storm, Christian" <christian.storm@siemens.com>,
"Adler, Michael" <michael.adler@siemens.com>,
"Sudler, Simon" <simon.sudler@siemens.com>,
"Koch, Stefan" <stefan-koch@siemens.com>
Subject: [PATCH v2 3/5] dpkg: Add support for additional target and host builds
Date: Tue, 20 Dec 2022 17:09:28 +0000 [thread overview]
Message-ID: <20221220170921.1718503-4-stefan-koch@siemens.com> (raw)
In-Reply-To: <20221220170921.1718503-1-stefan-koch@siemens.com>
By appending ISAR_BUILDS with "target" or "host" it's possible
to run additional target or host builds.
There are no "target" and "host" builds enabled by default.
When both build modes are enabled then for a cross build a kbuild package
for the target and a kbuild package for the host will be created.
When "host" build is not enabled instead of the kbuild
a kbuild-cross package for the host is generated.
Supported modes for ISAR_BUILDS:
default: default build (e.g. generic ISAR non-cross or cross build)
target: run target architecture build (non-cross, using QEMU)
host: run host architecture build
Signed-off-by: Stefan Koch <stefan-koch@siemens.com>
---
meta/classes/dpkg-base.bbclass | 51 ++++++++++++++++++++++++++++++----
meta/classes/dpkg.bbclass | 2 +-
2 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 260aa73..3108fee 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -228,7 +228,7 @@ dpkg_runbuild() {
def isar_deb_build_profiles(d):
deb_build_profiles = d.getVar('DEB_BUILD_PROFILES', True)
- if d.getVar('ISAR_CROSS_COMPILE', True) == "1":
+ if d.getVar('ISAR_CROSS_COMPILE', True) == "1" and not "targetbuild" in d.getVar('DEB_BUILD_PROFILES', True):
deb_build_profiles += ' cross'
return deb_build_profiles.strip()
@@ -242,12 +242,51 @@ def isar_export_build_settings(d):
os.environ['DEB_BUILD_OPTIONS'] = isar_deb_build_options(d)
os.environ['DEB_BUILD_PROFILES'] = isar_deb_build_profiles(d)
+# By default only one dpkg build is executed
+# With enabled ISAR_CROSS_COMPILE and different HOST_ARCH from DISTRO_ARCH
+# it's possible to run additional target or host builds.
+# These can requested by appending the following strings (seperated by space):
+# target: run target architecture build (non-cross, using QEMU)
+# host: run host architecture build
+# Supported build modes for ISAR_BUILDS: default target host
+ISAR_BUILDS ?= "default"
+
python do_dpkg_build() {
- bb.build.exec_func('schroot_create_configs', d)
- try:
- bb.build.exec_func("dpkg_runbuild", d)
- finally:
- bb.build.exec_func('schroot_delete_configs', d)
+ # store default build values for restoring
+ deb_profiles = d.getVar('DEB_BUILD_PROFILES', True)
+ schroot_dir = d.getVar('SCHROOT_DIR', True)
+
+ for build in d.getVar('ISAR_BUILDS', True).split(" "):
+ runbuild = False
+
+ # set default build values
+ d.setVar('DEB_BUILD_PROFILES', deb_profiles)
+ d.setVar('SCHROOT_DIR', schroot_dir)
+ d.setVar('SBUILD_BUILD', d.getVar('SBUILD_HOST_ARCH', True))
+ d.setVar('SBUILD_HOST', d.getVar('PACKAGE_ARCH', True))
+
+ if build == "default":
+ runbuild = True
+ elif d.getVar('ISAR_CROSS_COMPILE', True) == "1" and d.getVar('HOST_ARCH', True) != d.getVar('DISTRO_ARCH', True):
+ if build == "target":
+ d.appendVar('DEB_BUILD_PROFILES', ' targetbuild')
+ d.setVar('SCHROOT_DIR', d.getVar('SCHROOT_TARGET_DIR', True))
+ d.setVar('SBUILD_BUILD', d.getVar('PACKAGE_ARCH', True))
+ runbuild = True
+ elif build == "host":
+ d.appendVar('DEB_BUILD_PROFILES', ' hostbuild')
+ d.setVar('SCHROOT_DIR', d.getVar('SCHROOT_HOST_DIR', True))
+ d.setVar('SBUILD_BUILD', d.getVar('HOST_ARCH', True))
+ d.setVar('SBUILD_HOST', d.getVar('HOST_ARCH', True))
+ runbuild = True
+
+ # execute build
+ if runbuild:
+ bb.build.exec_func('schroot_create_configs', d)
+ try:
+ bb.build.exec_func("dpkg_runbuild", d)
+ finally:
+ bb.build.exec_func('schroot_delete_configs', d)
}
addtask dpkg_build
diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 7822b14..70a1c6a 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -102,7 +102,7 @@ dpkg_runbuild() {
DSC_FILE=$(find ${WORKDIR} -name "${DEB_SOURCE_NAME}*.dsc" -print)
sbuild -A -n -c ${SBUILD_CHROOT} --extra-repository="${ISAR_APT_REPO}" \
- --host=${PACKAGE_ARCH} --build=${SBUILD_HOST_ARCH} ${profiles} \
+ --host=${SBUILD_HOST} --build=${SBUILD_BUILD} ${profiles} \
--no-run-lintian --no-run-piuparts --no-run-autopkgtest --resolve-alternatives \
--no-apt-update \
--chroot-setup-commands="echo \"Package: *\nPin: release n=${DEBDISTRONAME}\nPin-Priority: 1000\" > /etc/apt/preferences.d/isar-apt" \
--
2.30.2
next prev parent reply other threads:[~2022-12-20 17:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 17:09 [PATCH v2 0/5] linux-custom: Split up binaries from kernel headers to kbuild packages Koch, Stefan
2022-12-20 17:09 ` [PATCH v2 2/5] sbuild: Support overwriting configured schroot dir Koch, Stefan
2022-12-20 17:09 ` Koch, Stefan [this message]
2022-12-20 17:09 ` [PATCH v2 1/5] linux-custom: Split up binaries from kernel headers to kbuild package Koch, Stefan
2023-03-17 8:18 ` Jan Kiszka
2023-03-17 8:32 ` cedric.hombourger
2023-03-17 9:20 ` Koch, Stefan
2023-03-17 9:38 ` Jan Kiszka
2022-12-20 17:09 ` [PATCH v2 5/5] docs: Update custom_kernel docs for split up of kernel scripts and tools Koch, Stefan
2022-12-20 17:09 ` [PATCH v2 4/5] linux-custom: Provide host and target specific kernel kbuild packages Koch, Stefan
2023-03-17 7:41 ` [PATCH v2 0/5] linux-custom: Split up binaries from kernel headers to " Uladzimir Bely
2023-03-17 8:06 ` Jan Kiszka
2023-08-16 11:29 ` Koch, Stefan
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=20221220170921.1718503-4-stefan-koch@siemens.com \
--to=stefan-koch@siemens.com \
--cc=christian.storm@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=michael.adler@siemens.com \
--cc=simon.sudler@siemens.com \
--cc=ubely@ilbers.de \
/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