public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Cedric Hombourger <Cedric_Hombourger@mentor.com>
To: <isar-users@googlegroups.com>
Cc: Cedric Hombourger <Cedric_Hombourger@mentor.com>
Subject: [PATCH] linux-custom: repack linux-libc-dev
Date: Wed, 12 Jun 2019 22:10:02 +0200	[thread overview]
Message-ID: <1560370202-632-1-git-send-email-Cedric_Hombourger@mentor.com> (raw)

Debian's linux-libc-dev package has "asm" headers in the following
directory: /usr/include/<libc-arch>/asm while the builddeb script
from the Linux kernel places them in: /usr/include/asm. Repack the
linux-libc-dev package (fixing a build error for packages built
against Isar-created distributions shipping a custom kernel in
lieu of Debian's).

Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
---
 meta/recipes-kernel/linux/files/build-kernel.sh | 38 +++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh b/meta/recipes-kernel/linux/files/build-kernel.sh
index 8b7b23b..2c97932 100644
--- a/meta/recipes-kernel/linux/files/build-kernel.sh
+++ b/meta/recipes-kernel/linux/files/build-kernel.sh
@@ -9,8 +9,20 @@
 
 source /isar/common.sh
 
-host_arch=$(dpkg --print-architecture)
+unsupported_arch() {
+    echo "error: unsupported architecture ($1)" >&2
+    exit 1
+}
+
+case $target_arch in
+     amd64) LIBC_HEADERS_DIR="x86_64-linux-gnu"    ;;
+     armhf) LIBC_HEADERS_DIR="arm-linux-gnueabihf" ;;
+     arm64) LIBC_HEADERS_DIR="aarch64-linux-gnu"   ;;
+    mipsel) LIBC_HEADERS_DIR="mipsel-linux-gnu"    ;;
+         *) unsupported_arch "$target_arch"        ;;
+esac
 
+host_arch=$(dpkg --print-architecture)
 if [ "$host_arch" != "$target_arch" ]; then
     case $target_arch in
     armhf)
@@ -26,8 +38,7 @@ if [ "$host_arch" != "$target_arch" ]; then
         export CROSS_COMPILE="mipsel-linux-gnu-"
         ;;
     *)
-        echo "error: unsupported architecture ($target_arch)"
-        exit 1
+        unsupported_arch "$target_arch"
         ;;
     esac
 fi
@@ -35,6 +46,7 @@ fi
 REPACK_DIR="$1/../repack"
 REPACK_LINUX_IMAGE_DIR="${REPACK_DIR}/linux-image"
 REPACK_LINUX_HEADERS_DIR="${REPACK_DIR}/linux-headers"
+REPACK_LIBC_HEADERS_DIR="${REPACK_DIR}/libc-headers"
 
 if [ -e .config ]; then
 	make olddefconfig
@@ -56,6 +68,7 @@ rm -rf "${REPACK_DIR}"
 mkdir -p "${REPACK_DIR}"
 mkdir -p "${REPACK_LINUX_IMAGE_DIR}"
 mkdir -p "${REPACK_LINUX_HEADERS_DIR}"
+mkdir -p "${REPACK_LIBC_HEADERS_DIR}"
 
 cp -a debian "${REPACK_DIR}"
 
@@ -67,6 +80,7 @@ cd ..
 
 dpkg-deb -R linux-image-${PV}_${PV}-1_*.deb "${REPACK_LINUX_IMAGE_DIR}"
 dpkg-deb -R linux-headers-${PV}_${PV}-1_*.deb "${REPACK_LINUX_HEADERS_DIR}"
+dpkg-deb -R linux-libc-dev_${PV}-1_*.deb "${REPACK_LIBC_HEADERS_DIR}"
 
 dpkg-gencontrol -crepack/debian/control \
 	-lrepack/debian/changelog \
@@ -110,6 +124,10 @@ if [ "$target_arch" = "arm64" ]; then
 	gunzip "$vmlinuz.gz"
 fi
 
+# Move libc's asm headers where they are expected
+mkdir ${REPACK_LIBC_HEADERS_DIR}/usr/include/${LIBC_HEADERS_DIR}
+mv ${REPACK_LIBC_HEADERS_DIR}/usr/include/asm ${REPACK_LIBC_HEADERS_DIR}/usr/include/${LIBC_HEADERS_DIR}
+
 dpkg-gencontrol -crepack/debian/control \
 	-lrepack/debian/changelog \
 	-frepack/debian/files \
@@ -121,12 +139,26 @@ dpkg-gencontrol -crepack/debian/control \
 	-DDepends="${KERNEL_HEADERS_DEBIAN_DEPENDS}" \
 	-DArchitecture=$target_arch
 
+dpkg-gencontrol -crepack/debian/control \
+	-lrepack/debian/changelog \
+	-frepack/debian/files \
+	-plinux-libc-dev \
+	-P"${REPACK_LIBC_HEADERS_DIR}" \
+	-Vkernel:debarch="${KERNEL_NAME}" \
+	-DPackage="linux-libc-dev" \
+	-DSection=kernel \
+	-DDepends="${LIBC_HEADERS_DEBIAN_DEPENDS}" \
+	-DArchitecture=$target_arch
+
 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
 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
+rm -f linux-libc-dev_${PV}-1_*.deb
+fakeroot dpkg-deb -b "${REPACK_LIBC_HEADERS_DIR}" \
+	linux-libc-dev_${PV}-1_${KERNEL_NAME}.deb
 
 # linux-libc-dev causes dependency problems if we downgrade
 # remove it after the build so the downgraded version does not get deployed
-- 
2.11.0


             reply	other threads:[~2019-06-12 20:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12 20:10 Cedric Hombourger [this message]
2019-06-13  8:10 ` Henning Schild
2019-06-13  8:32   ` Hombourger, Cedric
2019-06-13 15:37     ` Henning Schild
2019-06-13 16:09       ` Henning Schild
2019-06-13 16:05   ` Baurzhan Ismagulov

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=1560370202-632-1-git-send-email-Cedric_Hombourger@mentor.com \
    --to=cedric_hombourger@mentor.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