From 92b8320edddfeff9829a4e3156c43c59bc8bebd3 Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Tue, 29 Jun 2021 21:18:52 +0300 Subject: [PATCH] Packaging (#2935) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * kbuild: deb-pkg: do not build linux-headers package if CONFIG_MODULES=n Since commit 269a535ca931 ("modpost: generate vmlinux.symvers and reuse it for the second modpost"), with CONFIG_MODULES disabled, "make deb-pkg" (or "make bindeb-pkg") fails with: find: ‘Module.symvers’: No such file or directory If CONFIG_MODULES is disabled, it doesn't really make sense to build the linux-headers package. Author: Masahiro Yamada Date: Wed Oct 14 03:38:19 2020 +0900 Upstream commit bac977cbc0d6731fb8e67c2be0e4acbd959e10b3 Fixes: 269a535ca931 ("modpost: generate vmlinux.symvers and reuse it for the second modpost") Reported-by: Josh Triplett Signed-off-by: Masahiro Yamada Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> * mkdebian: fix: build a package for version 5.13 upstream commit 82526ef43399a7556b860538041802042b3872c1 Author: Masahiro Yamada Date: Tue Apr 20 02:05:05 2021 +0900 kbuild: deb-pkg: change the source package name to linux-upstream Change the source package name from 'linux-$(KERNELRELEASE)' to 'linux-upstream'. Initially, I tried to use 'linux' to be aligned with the Debian kernel package, but Ben suggested 'linux-upstream' so that it is clearly distinguished from distribution packages. [1] The filenames will be changed as follows: [Before] linux-5.12.0-rc3+_5.12.0-rc3+-1.dsc linux-5.12.0-rc3+_5.12.0-rc3+.orig.tar.gz linux-5.12.0-rc3+_5.12.0-rc3+-1.diff.gz [After] linux-upstream_5.12.0-rc3+-1.dsc linux-upstream_5.12.0-rc3+.orig.tar.gz linux-upstream_5.12.0-rc3+-1.diff.gz Commit 3716001bcb7f ("deb-pkg: add source package") introduced KDEB_SOURCENAME. If you are unhappy with the default name, you can override it via KDEB_SOURCENAME. Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> * Search by template when updating initramfs Search by pattern first, then use in the command. If unsuccessful then exit by mistake. Fix: depmod: WARNING: could not open modules.order at /var/tmp/mkinitramfs_bp3vP5/lib/modules/5.13.0-sunxi64: No such file or directory could not open modules.builtin at /var/tmp/mkinitramfs_bp3vP5/lib/modules/5.13.0-sunxi64: No such file or directory When a valid directory lib/modules/5.13.0-rc6-sunxi64 Or when the user added a localversion to the configuration file and valid directory lib/modules/5.13.0-rt7-sunxi64 Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> * Code Cleanup: kernel build: Removing EXTRAVERSION Cleanup This was intended for the EDGE kernel and is no longer required. Moreover, this code is not working. Signed-off-by: The-going <48602507+The-going@users.noreply.github.com> --- lib/compilation.sh | 3 --- lib/debootstrap.sh | 9 ++++++++- packages/armbian/builddeb | 6 ++++-- packages/armbian/mkdebian | 26 ++++++++++++++++---------- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/lib/compilation.sh b/lib/compilation.sh index 472c633b63..c3c82c2d59 100644 --- a/lib/compilation.sh +++ b/lib/compilation.sh @@ -381,9 +381,6 @@ compile_kernel() fi cd "${kerneldir}" || exit - if ! grep -qoE '^-rc[[:digit:]]+' <(grep "^EXTRAVERSION" Makefile | head -1 | awk '{print $(NF)}'); then - sed -i 's/EXTRAVERSION = .*/EXTRAVERSION = /' Makefile - fi rm -f localversion # read kernel version diff --git a/lib/debootstrap.sh b/lib/debootstrap.sh index b3ba43a7a1..054d1e29a3 100644 --- a/lib/debootstrap.sh +++ b/lib/debootstrap.sh @@ -668,7 +668,14 @@ prepare_partitions() update_initramfs() { local chroot_target=$1 - update_initramfs_cmd="update-initramfs -uv -k ${VER}-${LINUXFAMILY}" + local target_dir=$( + find ${chroot_target}/lib/modules/ -maxdepth 1 -type d -name "*${VER}*" + ) + if [ "$target_dir" != "" ]; then + update_initramfs_cmd="update-initramfs -uv -k $(basename $target_dir)" + else + exit_with_error "No kernel installed for the version" "${VER}" + fi display_alert "Updating initramfs..." "$update_initramfs_cmd" "" cp /usr/bin/$QEMU_BINARY $chroot_target/usr/bin/ mount_chroot "$chroot_target/" diff --git a/packages/armbian/builddeb b/packages/armbian/builddeb index 585de93ce8..c42baff42d 100755 --- a/packages/armbian/builddeb +++ b/packages/armbian/builddeb @@ -334,8 +334,10 @@ if [ "$ARCH" != "um" ]; then deploy_libc_headers $libc_headers_dir create_package $libc_headers_packagename $libc_headers_dir - deploy_kernel_headers $kernel_headers_dir - create_package $kernel_headers_packagename $kernel_headers_dir "headers" + if is_enabled CONFIG_MODULES; then + deploy_kernel_headers $kernel_headers_dir + create_package $kernel_headers_packagename $kernel_headers_dir "headers" + fi create_package "$dtb_packagename" "$dtb_dir" "dtb" fi diff --git a/packages/armbian/mkdebian b/packages/armbian/mkdebian index 02189b7a3d..23b5280d90 100755 --- a/packages/armbian/mkdebian +++ b/packages/armbian/mkdebian @@ -85,6 +85,7 @@ set_debarch() { } # Some variables and settings used throughout the script +KDEB_SOURCENAME=linux-$KERNELRELEASE version=$KERNELRELEASE if [ -n "$KDEB_PKGVERSION" ]; then packageversion=$KDEB_PKGVERSION @@ -187,16 +188,6 @@ Description: Linux kernel, armbian version $version $BRANCH This package contains the Linux kernel, modules and corresponding other files, version: $version. -Package: $kernel_headers_packagename -Section: devel -Architecture: $debarch -Provides: linux-headers, linux-headers-armbian, armbian-$BRANCH -Depends: make, gcc, libc6-dev, bison, flex, libssl-dev -Description: Linux kernel headers for $version on $debarch $BRANCH - This package provides kernel header files for $version on $debarch - . - This is useful for people who need to build external modules - Package: $libc_headers_packagename Section: devel Provides: linux-kernel-headers @@ -215,6 +206,21 @@ Description: Armbian Linux DTB, version $version $BRANCH This package contains device blobs from the Linux kernel, version $version EOF +if is_enabled CONFIG_MODULES; then +cat <> debian/control + +Package: $kernel_headers_packagename +Section: devel +Architecture: $debarch +Provides: linux-headers, linux-headers-armbian, armbian-$BRANCH +Depends: make, gcc, libc6-dev, bison, flex, libssl-dev +Description: Linux kernel headers for $version on $debarch $BRANCH + This package provides kernel header files for $version on $debarch + . + This is useful for people who need to build external modules +EOF +fi + if is_enabled CONFIG_DEBUG_INFO; then cat <> debian/control Package: $dbg_packagename