From 44da77ef41d37b5570edf5016e34bcbd69cc947f Mon Sep 17 00:00:00 2001 From: vali-um <47387140+vali-um@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:56:38 +0000 Subject: [PATCH 1/2] Re-add functionality to create linux-libc-dev when building kernel packages. --- lib/functions/artifacts/artifact-kernel.sh | 2 ++ lib/functions/compilation/kernel-debs.sh | 30 ++++++++++++++++++++++ lib/functions/compilation/kernel.sh | 5 ++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/lib/functions/artifacts/artifact-kernel.sh b/lib/functions/artifacts/artifact-kernel.sh index 606ac75d9f38..892f1049049a 100644 --- a/lib/functions/artifacts/artifact-kernel.sh +++ b/lib/functions/artifacts/artifact-kernel.sh @@ -197,6 +197,8 @@ function artifact_kernel_prepare_version() { artifact_map_packages+=(["linux-dtb"]="linux-dtb-${BRANCH}-${LINUXFAMILY}") fi + artifact_map_packages+=(["linux-libc-dev"]="linux-libc-dev") + artifact_name="kernel-${LINUXFAMILY}-${BRANCH}" # default name of regular artifact # Separate artifact name if we're in DTB-only mode, so stuff doesn't get mixed up later diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh index 70f5c01d4bc7..f6247a5935d9 100644 --- a/lib/functions/compilation/kernel-debs.sh +++ b/lib/functions/compilation/kernel-debs.sh @@ -86,6 +86,9 @@ function prepare_kernel_packaging_debs() { display_alert "Skipping linux-headers package" "for ${KERNEL_MAJOR_MINOR} kernel version" "info" fi fi + + display_alert "Packaging linux-libc-dev" "${LINUXFAMILY} ${LINUXCONFIG}" "info" + create_kernel_deb "linux-libc-dev" "${debs_target_dir}" kernel_package_callback_linux_libc_dev "linux-libc-dev" } function create_kernel_deb() { @@ -531,3 +534,30 @@ function kernel_package_callback_linux_headers() { EOT_POSTINST_FINISH ) } + + +function kernel_package_callback_linux_libc_dev() { + display_alert "linux-libc-dev packaging" "${package_directory}" "debug" + + mkdir -p "${package_directory}/usr" + run_host_command_logged cp -rp "${tmp_kernel_install_dirs[INSTALL_HDR_PATH]}/include" "${package_directory}/usr" + HOST_ARCH=$(dpkg-architecture -a${ARCH} -q"DEB_HOST_MULTIARCH") + run_host_command_logged mkdir "${package_directory}/usr/include/${HOST_ARCH}" + run_host_command_logged mv "${package_directory}/usr/include/asm" "${package_directory}/usr/include/${HOST_ARCH}" + + # Generate a control file + cat <<- CONTROL_FILE > "${package_DEBIAN_dir}/control" + Version: ${artifact_version} + Maintainer: ${MAINTAINER} <${MAINTAINERMAIL}> + Package: ${package_name} + Section: devel + Provides: linux-kernel-headers + Conflicts: linux-kernel-headers + Replaces: linux-kernel-headers + Architecture: ${ARCH} + Description: Armbian 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. + Multi-Arch: same + CONTROL_FILE +} diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh index e9b54aefdc03..0542462ea4f1 100644 --- a/lib/functions/compilation/kernel.sh +++ b/lib/functions/compilation/kernel.sh @@ -122,7 +122,7 @@ function kernel_prepare_build_and_package() { declare -A kernel_install_dirs=( ["INSTALL_PATH"]="${kernel_dest_install_dir}/image/boot" # Used by `make install` ["INSTALL_MOD_PATH"]="${kernel_dest_install_dir}/modules" # Used by `make modules_install` - #["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/libc_headers" # Used by `make headers_install` - disabled, only used for libc headers + ["INSTALL_HDR_PATH"]="${kernel_dest_install_dir}/libc_headers" # Used by `make headers_install` for libc headers ) [ -z "${SRC_LOADADDR}" ] || install_make_params_quoted+=("${SRC_LOADADDR}") # For uImage @@ -133,7 +133,8 @@ function kernel_prepare_build_and_package() { install_make_params_quoted+=("INSTALL_MOD_STRIP=1") # strip modules during install - build_targets+=("modules_install") # headers_install disabled, only used for libc headers + build_targets+=("modules_install") + build_targets+=("headers_install") # headers_install for libc headers if [[ "${KERNEL_BUILD_DTBS:-yes}" == "yes" ]]; then display_alert "Kernel build will produce DTBs!" "DTBs YES" "debug" build_targets+=("dtbs_install") From 11787566e5c213eef7764fabf9ed541ef4dc7fab Mon Sep 17 00:00:00 2001 From: vali-um <47387140+vali-um@users.noreply.github.com> Date: Wed, 20 Mar 2024 13:00:29 +0000 Subject: [PATCH 2/2] linux-libc-dev: append -${BRANCH}-${LINUXFAMILY} to package name and update control file --- lib/functions/artifacts/artifact-kernel.sh | 2 +- lib/functions/compilation/kernel-debs.sh | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/functions/artifacts/artifact-kernel.sh b/lib/functions/artifacts/artifact-kernel.sh index 892f1049049a..232f3d7b3002 100644 --- a/lib/functions/artifacts/artifact-kernel.sh +++ b/lib/functions/artifacts/artifact-kernel.sh @@ -197,7 +197,7 @@ function artifact_kernel_prepare_version() { artifact_map_packages+=(["linux-dtb"]="linux-dtb-${BRANCH}-${LINUXFAMILY}") fi - artifact_map_packages+=(["linux-libc-dev"]="linux-libc-dev") + artifact_map_packages+=(["linux-libc-dev"]="linux-libc-dev-${BRANCH}-${LINUXFAMILY}") artifact_name="kernel-${LINUXFAMILY}-${BRANCH}" # default name of regular artifact diff --git a/lib/functions/compilation/kernel-debs.sh b/lib/functions/compilation/kernel-debs.sh index f6247a5935d9..f0d24e34be7a 100644 --- a/lib/functions/compilation/kernel-debs.sh +++ b/lib/functions/compilation/kernel-debs.sh @@ -88,7 +88,7 @@ function prepare_kernel_packaging_debs() { fi display_alert "Packaging linux-libc-dev" "${LINUXFAMILY} ${LINUXCONFIG}" "info" - create_kernel_deb "linux-libc-dev" "${debs_target_dir}" kernel_package_callback_linux_libc_dev "linux-libc-dev" + create_kernel_deb "linux-libc-dev-${BRANCH}-${LINUXFAMILY}" "${debs_target_dir}" kernel_package_callback_linux_libc_dev "linux-libc-dev" } function create_kernel_deb() { @@ -551,9 +551,8 @@ function kernel_package_callback_linux_libc_dev() { Maintainer: ${MAINTAINER} <${MAINTAINERMAIL}> Package: ${package_name} Section: devel - Provides: linux-kernel-headers - Conflicts: linux-kernel-headers - Replaces: linux-kernel-headers + Priority: optional + Provides: linux-libc-dev Architecture: ${ARCH} Description: Armbian Linux support headers for userspace development This package provides userspaces headers from the Linux kernel. These headers