From 7bd062ea6be784dc2e28e63fe668b1cd1ba07a16 Mon Sep 17 00:00:00 2001 From: sakaki Date: Tue, 14 Feb 2017 14:19:56 +0000 Subject: [PATCH] Move to using kernelrelease over kernelversion The names are usually the same, but are not so when there is any localversion data. See notes in https://github.com/sakaki-/sakaki-tools/issues/1#issuecomment-279673861 Thanks to tomegathericon for reporting this. Version bumped to 1.0.20 --- buildkernel | 34 ++++++++++++++++++---------------- buildkernel.8 | 2 +- buildkernel.conf.5 | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/buildkernel b/buildkernel index 638ce6a..1b7ec90 100755 --- a/buildkernel +++ b/buildkernel @@ -31,14 +31,14 @@ shopt -s nullglob # ********************** variables ********************* PROGNAME="$(basename "${0}")" CONFFILE="/etc/${PROGNAME}.conf" -VERSION="1.0.19" +VERSION="1.0.20" ETCPROFILE="/etc/profile" DEFAULTEFIBOOTFILE="bootx64.efi" EFIBOOTFILE="${DEFAULTEFIBOOTFILE}" LINUXDIR="/usr/src/linux" -NEWVERSION="linux-$(cd "${LINUXDIR}" && make -s kernelversion)" -INITRAMFSNAME="$(echo $NEWVERSION | sed "s/linux/initramfs-genkernel-x86_64/g")" -VMLINUZNAME="$(echo $NEWVERSION | sed "s/linux/vmlinuz/g")" +NEWVERSION="" +INITRAMFSNAME="" +VMLINUZNAME="" CURRENTVERSION="linux-$(uname -r)" CURRENTCONFIG="/proc/config.gz" TARGETCONFIG="${LINUXDIR}/.config" @@ -263,6 +263,16 @@ read_portage_info_if_necessary() { PORTAGEINFO="$(emerge --info)" fi } +extract_kernel_release_name() { + # extract the kernel release string, and setup the derived strings + # NB we now check kernelrelease, not kernelversion; it is possible that + # the kernelrelease may change during the build (e.g., by a 'clean' + # tagged release directory becoming marked 'dirty', and so having a '+' + # sign appended) + NEWVERSION="linux-$(cd "${LINUXDIR}" && make -s kernelrelease)" + INITRAMFSNAME="$(echo $NEWVERSION | sed "s/linux/initramfs-genkernel-x86_64/")" + VMLINUZNAME="$(echo $NEWVERSION | sed "s/linux/vmlinuz/")" +} check_gcc_config_and_reset_if_necessary() { # check if gcc-config exists with an error - if it does, then # attempt to set one based on the current gcc version number @@ -1521,17 +1531,6 @@ enter_build_directory() { show "Proceeding - entering ${LINUXDIR}..." cd "${LINUXDIR}" } -check_if_deblobbing() { - # run in kernel top-level directory - local EV=$(grep "^EXTRAVERSION =" Makefile) - if grep -q "\-gnu$" <<<"${EV}"; then - # we are deblobbing - fix up the initramfs name if necessary - show "Using a deblobbed kernel" - if [[ "${INITRAMFSNAME}" != *-gnu ]]; then - INITRAMFSNAME+="-gnu" - fi - fi -} copy_config_from_proc_if_necessary () { if [ ! -s "${TARGETCONFIG}" ]; then if ((ARG_ASK==1)); then @@ -1717,6 +1716,9 @@ create_initramfs_using_genkernel() { --kernel-config="${TARGETCONFIG}" --busybox \ --no-compress-initramfs ${ADDITIONALGENKERNELOPTS} \ ${PLYMOUTH_OPTS} initramfs + # re-extract release details, in case these have changed + # (e.g. due to 'SCM dirty suffix' having been added (a '+' sign)) + extract_kernel_release_name cp ${VERBOSITYFLAG} "${BOOTDIR}/${INITRAMFSNAME}" "${UNCOMPRESSEDINITRAMFS}" } unpack_initramfs() { @@ -2116,6 +2118,7 @@ process_command_line_options() { # *************** start of script proper *************** suppress_colour_and_alert_if_output_not_to_a_terminal +extract_kernel_release_name check_if_booted_under_efi find_all_usb_partitions source_etc_conf_file @@ -2126,7 +2129,6 @@ check_gcc_config_and_reset_if_necessary if_option_unset "ARG_STAGEONLY" ensure_efi_partition_mounted if ((ARG_COPYFROMSTAGING==0)); then enter_build_directory - check_if_deblobbing copy_config_from_proc_if_necessary conform_config_file allow_user_to_modify_config_graphically diff --git a/buildkernel.8 b/buildkernel.8 index 2607205..dbb8ea1 100644 --- a/buildkernel.8 +++ b/buildkernel.8 @@ -1,4 +1,4 @@ -.TH BUILDKERNEL 8 "Version 1.0.19: February 2017" +.TH BUILDKERNEL 8 "Version 1.0.20: February 2017" .SH NAME buildkernel \- build secure boot kernel, save to EFI system partition .SH SYNOPSIS diff --git a/buildkernel.conf.5 b/buildkernel.conf.5 index f9b61a8..62f2b0d 100644 --- a/buildkernel.conf.5 +++ b/buildkernel.conf.5 @@ -1,4 +1,4 @@ -.TH BUILDKERNEL 5 "Version 1.0.19: February 2017" +.TH BUILDKERNEL 5 "Version 1.0.20: February 2017" .SH NAME buildkernel.conf \- a configuration file for \fBbuildkernel\fR(8) .SH SYNOPSIS