Message ID | 20250104190859.1879934-1-cedric.hombourger@siemens.com |
---|---|
State | Accepted, archived |
Headers | show |
Series | [v2] linux-custom: generate linux-libc-dev for "all" vs "any" like trixie | expand |
On Sat, 2025-01-04 at 20:08 +0100, 'Cedric Hombourger' via isar-users wrote: > 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 <arulpandiyan.vadivel@siemens.com> > Signed-off-by: Cedric Hombourger <cedric.hombourger@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 > Applied to next, thanks.
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() {
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 <arulpandiyan.vadivel@siemens.com> Signed-off-by: Cedric Hombourger <cedric.hombourger@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(-)