Re: [PATCH] linux-custom: generate linux-libc-dev package for all arch

44 views
Skip to first unread message

cedric.h...@siemens.com

unread,
Jan 3, 2025, 3:23:24 AM1/3/25
to isar-...@googlegroups.com, Vadivel, Arulpandiyan, srikanth....@siemens.com
On Fri, 2025-01-03 at 12:59 +0530, Arulpandiyan Vadivel wrote:
> Generate linux-libc-dev package for all architecture instead of

for the "all" architecture

> desired machine architecture.
>
> With this patch, when upstream Kernels is build above 6.11, It helps

Avoid "This patch", "This commit" in commit logs

Where are you checking for kernel version >= 6.11, this appears to be
missing in your patch and will likely break builds with kernels < 6.11

Make sure no arch-dependent headers are included in our linux-libc-dev
package. In linux-libc-dev packages built in my trees, I see header
files in e.g. usr/include/x86_64-linux-gnu

We may need to make more changes for our packages to match those now
generated by Debian

> to align with bookworm-backports, trixie versions of linux-libc-dev.
>
> This change also fixes to build failures with libc6-dev dependencies
> as below
> for upstream stable kernel 6.12.
> > Broken libc6-dev:arm64 Depends on linux-libc-dev:arm64 < none @un
> > pH >
> >   Considering linux-libc-dev:arm64 1 as a solution to libc6-
> > dev:arm64 10001
> >   Considering linux-libc-dev:arm64 1 as a solution to libc6-
> > dev:arm64 10001
> > Done

did you run the Isar test suite to validate your changes prior to
submitting?

>
> Signed-off-by: Arulpandiyan Vadivel
> <arulpandiy...@siemens.com>
> ---
>  meta/recipes-kernel/linux/files/debian/control.tmpl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl
> b/meta/recipes-kernel/linux/files/debian/control.tmpl
> index 04ad0f4f..cc9cbd44 100644
> --- a/meta/recipes-kernel/linux/files/debian/control.tmpl
> +++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
> @@ -26,7 +26,7 @@ Package: linux-libc-dev
>  Build-Profiles: <!nolibcdev kernel>
>  Section: devel
>  Provides: linux-kernel-headers
> -Architecture: any
> +Architecture: all
>  Description: Linux support headers for userspace development
>   This package provides userspaces headers from the Linux kernel.
> These headers
>   are used by the installed headers for GNU glibc and other system
> libraries.


Arulpandiyan Vadivel

unread,
Jan 3, 2025, 3:32:04 AM1/3/25
to isar-...@googlegroups.com, cedric.h...@siemens.com, srikanth....@siemens.com, Arulpandiyan Vadivel
Generate linux-libc-dev package for all architecture instead of
desired machine architecture.

With this patch, when upstream Kernels is build above 6.11, It helps
to align with bookworm-backports, trixie versions of linux-libc-dev.

This change also fixes to build failures with libc6-dev dependencies as below
for upstream stable kernel 6.12.
| Broken libc6-dev:arm64 Depends on linux-libc-dev:arm64 < none @un pH >
| Considering linux-libc-dev:arm64 1 as a solution to libc6-dev:arm64 10001
| Considering linux-libc-dev:arm64 1 as a solution to libc6-dev:arm64 10001
| Done

Signed-off-by: Arulpandiyan Vadivel <arulpandiy...@siemens.com>
---
meta/recipes-kernel/linux/files/debian/control.tmpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
index 04ad0f4f..cc9cbd44 100644
--- a/meta/recipes-kernel/linux/files/debian/control.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
@@ -26,7 +26,7 @@ Package: linux-libc-dev
Build-Profiles: <!nolibcdev kernel>
Section: devel
Provides: linux-kernel-headers
-Architecture: any
+Architecture: all
Description: Linux support headers for userspace development
This package provides userspaces headers from the Linux kernel. These headers
are used by the installed headers for GNU glibc and other system libraries.
--
2.39.5

Cedric Hombourger

unread,
Jan 4, 2025, 2:10:11 PM1/4/25
to isar-...@googlegroups.com, Cedric Hombourger, Arulpandiyan Vadivel
The linux-libc-dev package that comes with Debian trixie includes
arch-dependent headers for all supported architectures and has its
Architecture set to "all" rather than "any". Match this behavior
when both KERNEL_LIBC_DEV_DEPLOY and KERNEL_LIBC_DEV_ARCH_ALL are
in effect (the latter defaults to "1" for "trixie", while the former
still defaults to "0")

Reported-by: Arulpandiyan Vadivel <arulpandiy...@siemens.com>
Signed-off-by: Cedric Hombourger <cedric.h...@siemens.com>
---
.../linux/files/debian/control.tmpl | 2 +-
.../linux/files/debian/isar/install.tmpl | 37 +++++++++++++++----
meta/recipes-kernel/linux/linux-custom.inc | 6 +++
3 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-kernel/linux/files/debian/control.tmpl b/meta/recipes-kernel/linux/files/debian/control.tmpl
index f4273ea9..ec0da1ab 100644
--- a/meta/recipes-kernel/linux/files/debian/control.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/control.tmpl
@@ -26,7 +26,7 @@ Package: linux-libc-dev
Build-Profiles: <!nolibcdev kernel>
Section: devel
Provides: linux-kernel-headers
-Architecture: any
+Architecture: ${KERNEL_LIBC_DEV_ARCH}
Description: Linux support headers for userspace development
This package provides userspaces headers from the Linux kernel. These headers
are used by the installed headers for GNU glibc and other system libraries.
diff --git a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
index 0a7bdd66..6d742f02 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/install.tmpl
@@ -5,6 +5,16 @@
# Load common stuff
. ${S}/debian/isar/common

+get_kernel_arch() {
+ case "${1}" in
+ amd64|i386) echo "x86";;
+ arm64) echo "arm64";;
+ armhf) echo "arm";;
+ mipsel) echo "mips";;
+ riscv64) echo "riscv";;
+ esac
+}
+
do_install() {

# check if our kernel was configured
@@ -165,13 +175,26 @@ headers_check() {

libc_headers() {
mkdir -p ${deb_libc_hdr_dir}
- ${MAKE} O=${O} headers_install INSTALL_HDR_PATH=${deb_libc_hdr_dir}/usr
- host_arch=$(dpkg-architecture -a${DISTRO_ARCH} -qDEB_HOST_MULTIARCH)
- mkdir ${deb_libc_hdr_dir}/usr/include/${host_arch}
- mv ${deb_libc_hdr_dir}/usr/include/asm ${deb_libc_hdr_dir}/usr/include/${host_arch}/
-
- mkdir -p ${deb_libc_hdr_cross_dir}
- ${MAKE} O=${O} headers_install INSTALL_HDR_PATH=${deb_libc_hdr_cross_dir}/usr/${host_arch}
+ arches="${DISTRO_ARCH}"
+ if echo "${DEB_BUILD_PROFILES}" | grep -q "libcdev-arch-all"; then
+ arches="amd64 armhf arm64 i386 mipsel riscv64"
+ fi
+ for distro_arch in ${arches}; do
+ target_arch=$(dpkg-architecture --force -A${distro_arch} -qDEB_TARGET_MULTIARCH)
+ kernel_arch=$(get_kernel_arch ${distro_arch})
+ [ -n "${kernel_arch}" ] || {
+ echo "fatal: don't know the kernel arch for '${distro_arch}'!" >&2
+ return 1
+ }
+ ${MAKE} O=${O} headers_install ARCH=${kernel_arch} INSTALL_HDR_PATH=${deb_libc_hdr_dir}/usr
+ mkdir ${deb_libc_hdr_dir}/usr/include/${target_arch}
+ mv ${deb_libc_hdr_dir}/usr/include/asm ${deb_libc_hdr_dir}/usr/include/${target_arch}/
+
+ if [ "${distro_arch}" = "${DISTRO_ARCH}" ]; then
+ mkdir -p ${deb_libc_hdr_cross_dir}
+ ${MAKE} O=${O} headers_install INSTALL_HDR_PATH=${deb_libc_hdr_cross_dir}/usr/${target_arch}
+ fi
+ done
}

kernel_tools() {
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index e825d29b..77700a5d 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -39,6 +39,8 @@ LIBSSL_DEP:bullseye = "libssl1.1"
KERNEL_HEADERS_DEBIAN_DEPENDS ?= "libc6, \
${LIBSSL_DEP},"

+KERNEL_LIBC_DEV_ARCH_ALL = "0"
+KERNEL_LIBC_DEV_ARCH_ALL:trixie = "1"
KERNEL_LIBC_DEV_DEPLOY ?= "0"

# Settings that may be changed on a per distro, machine or layer basis
@@ -79,6 +81,7 @@ TEMPLATE_VARS += " \
KERNEL_BUILD_DIR \
KERNEL_FILE \
KERNEL_HEADERS_DEBIAN_DEPENDS \
+ KERNEL_LIBC_DEV_ARCH \
LINUX_VERSION_EXTENSION \
KERNEL_NAME_PROVIDED \
KERNEL_CONFIG_FRAGMENTS \
@@ -214,8 +217,11 @@ def get_additional_build_profiles(d):
profiles = d.getVar('BASE_DISTRO')
if not bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_DEPLOY')):
profiles += ' nolibcdev'
+ elif bb.utils.to_boolean(d.getVar('KERNEL_LIBC_DEV_ARCH_ALL')):
+ profiles += ' libcdev-arch-all'
return profiles

+KERNEL_LIBC_DEV_ARCH = "${@ bb.utils.contains('DEB_BUILD_PROFILES', 'libcdev-arch-all', 'all', 'any', d) }"
DEB_BUILD_PROFILES += "${@get_additional_build_profiles(d)}"

do_prepare_build:prepend() {
--
2.34.1

Uladzimir Bely

unread,
Jan 16, 2025, 2:01:22 AM1/16/25
to Cedric Hombourger, isar-...@googlegroups.com, Arulpandiyan Vadivel
On Sat, 2025-01-04 at 20:08 +0100, 'Cedric Hombourger' via isar-users
wrote:
Applied to next, thanks.

--
Best regards,
Uladzimir.
Reply all
Reply to author
Forward
0 new messages