From: Henning Schild <henning.schild@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH 2/2] build-kernel: fix the cross compile arch naming
Date: Tue, 11 Sep 2018 12:16:05 +0200 [thread overview]
Message-ID: <20180911101605.21977-3-henning.schild@siemens.com> (raw)
In-Reply-To: <20180911101605.21977-1-henning.schild@siemens.com>
In debian cross building scenarios we have three machines.
"build" is where we work on, "host" is what we produce binaries for, and
"target" would be a third arch if we build a cross compiler to run on
"host". ("target" is not yet relevant on Isar)
We used to call "build" "host" and "host" "target", this patch changes
the kernel building to the debian/GNU naming.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/recipes-kernel/linux/files/build-kernel.sh | 18 +++++++++---------
meta/recipes-kernel/linux/linux-custom.inc | 4 ++--
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh b/meta/recipes-kernel/linux/files/build-kernel.sh
index 2cee28f..d1824db 100644
--- a/meta/recipes-kernel/linux/files/build-kernel.sh
+++ b/meta/recipes-kernel/linux/files/build-kernel.sh
@@ -9,11 +9,11 @@
set -e
-host_arch=$(dpkg --print-architecture)
-target_arch=$2
+build_arch=$(dpkg-architecture -qDEB_BUILD_ARCH)
+host_arch=$(dpkg-architecture -qDEB_HOST_ARCH)
-if [ "$host_arch" != "$target_arch" ]; then
- case $target_arch in
+if [ "$build_arch" != "$host_arch" ]; then
+ case $host_arch in
armhf)
export ARCH=arm
export CROSS_COMPILE="arm-linux-gnueabihf-"
@@ -23,7 +23,7 @@ if [ "$host_arch" != "$target_arch" ]; then
export CROSS_COMPILE="aarch64-linux-gnu-"
;;
*)
- echo "error: unsupported architecture ($target_arch)"
+ echo "error: unsupported architecture ($host_arch)"
exit 1
;;
esac
@@ -44,7 +44,7 @@ if [ "${KV}" != "${PV}" ]; then
fi
rm -f .version
-KBUILD_DEBARCH=$target_arch make -j $(($(nproc) * 2)) deb-pkg
+KBUILD_DEBARCH=$host_arch make -j $(($(nproc) * 2)) deb-pkg
rm -rf ${REPACK_DIR}
mkdir -p ${REPACK_DIR}
@@ -65,7 +65,7 @@ dpkg-gencontrol -crepack/debian/control \
-DSection=kernel \
-DPriority=required \
-DDepends="${KERNEL_DEBIAN_DEPENDS}" \
- -DArchitecture=$target_arch
+ -DArchitecture=$host_arch
# Add Debian-like link installation to postinst
touch ${REPACK_LINUX_IMAGE_DIR}/lib/modules/${PV}/.fresh-install
@@ -91,7 +91,7 @@ if [ \"\$1\" != upgrade ] && command -v linux-update-symlinks >/dev/null; then\\
fi"
# Make sure arm64 kernels are decompressed
-if [ "$target_arch" = "arm64" ]; then
+if [ "$host_arch" = "arm64" ]; then
vmlinuz=${REPACK_LINUX_IMAGE_DIR}/boot/vmlinuz-${PV}
mv $vmlinuz $vmlinuz.gz
gunzip $vmlinuz.gz
@@ -106,7 +106,7 @@ dpkg-gencontrol -crepack/debian/control \
-DPackage="linux-headers-${KERNEL_NAME}" \
-DSection=kernel \
-DDepends="${KERNEL_HEADERS_DEBIAN_DEPENDS}" \
- -DArchitecture=$target_arch
+ -DArchitecture=$host_arch
dpkg-deb -b ${REPACK_LINUX_IMAGE_DIR} \
linux-image-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index d75346e..7ee2a86 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -52,6 +52,6 @@ dpkg_runbuild() {
export KBUILD_DEPENDS="${KBUILD_DEPENDS}"
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}
+ export DEB_HOST_ARCH="${DISTRO_ARCH}"
+ sudo -E chroot ${BUILDCHROOT_DIR} /build-kernel.sh ${PP}/${PPS}
}
--
2.16.4
next prev parent reply other threads:[~2018-09-11 10:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-11 10:16 [PATCH 0/2] Straighten cross names Henning Schild
2018-09-11 10:16 ` [PATCH 1/2] cross: use env variables instead of switches Henning Schild
2018-09-21 12:55 ` [PATCHv2 " Henning Schild
2018-09-21 13:08 ` Henning Schild
2018-09-27 7:12 ` Maxim Yu. Osipov
2018-09-27 7:15 ` Jan Kiszka
2018-09-28 10:47 ` Henning Schild
2018-09-11 10:16 ` Henning Schild [this message]
2018-09-11 12:10 ` [PATCH 2/2] build-kernel: fix the cross compile arch naming Jan Kiszka
2018-09-11 12:20 ` Henning Schild
2018-09-21 10:00 ` [PATCH 0/2] Straighten cross names 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=20180911101605.21977-3-henning.schild@siemens.com \
--to=henning.schild@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