commit: c452f3d690dc695a55aee63f0f2e4ab0cbb7b93a Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> AuthorDate: Sun Jul 28 20:56:30 2019 +0000 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> CommitDate: Mon Jul 29 20:00:26 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c452f3d6
Change kernel and initramfs default filename in $BOOTDIR This commit will change default kernel and initramfs filename: kernel-genkernel-%%ARCH%%-%%KV%% -> vmlinuz-%%KV%% System.map-genkernel--%%ARCH%%-%%KV%% -> System.map-%%KV%% initramfs-genkernel-%%ARCH%%-%%KV%% -> initramfs-%%KV%%.img The new naming will be consistent with kernel's "make install" and will allow to match files in /lib/modules with actual kernel. In addition, $ARCH value was moved to kernel's LOCALVERSION. This will ensure that this information is still present and when you do cross-compilation, that /lib/modules content don't get mixed. Bug: https://bugs.gentoo.org/390407 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> defaults/config.sh | 6 +++--- doc/genkernel.8.txt | 21 ++++++++++++++++----- gen_configkernel.sh | 2 +- gen_determineargs.sh | 11 +++++++++-- genkernel | 10 ++++++++++ genkernel.conf | 6 +++--- 6 files changed, 42 insertions(+), 14 deletions(-) diff --git a/defaults/config.sh b/defaults/config.sh index 7232671..9d15633 100644 --- a/defaults/config.sh +++ b/defaults/config.sh @@ -21,11 +21,11 @@ KERNEL_SUPPORT_MICROCODE=no # Arch-specific defaults that can be overridden in the config file or on the # command line. # -DEFAULT_INITRAMFS_FILENAME="initramfs-genkernel-%%ARCH%%-%%KV%%" +DEFAULT_INITRAMFS_FILENAME="initramfs-%%KV%%.img" DEFAULT_INITRAMFS_SYMLINK_NAME="initramfs" -DEFAULT_KERNEL_FILENAME="kernel-genkernel-%%ARCH%%-%%KV%%" +DEFAULT_KERNEL_FILENAME="vmlinuz-%%KV%%" DEFAULT_KERNEL_SYMLINK_NAME="kernel" -DEFAULT_SYSTEMMAP_FILENAME="System.map-%%ARCH%%-%%KV%%" +DEFAULT_SYSTEMMAP_FILENAME="System.map-%%KV%%" DEFAULT_SYSTEMMAP_SYMLINK_NAME="System.map" DEFAULT_COMPRESS_INITRD=yes diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index e94fa12..35762a2 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -125,8 +125,19 @@ KERNEL CONFIGURATION Adds, or skip adding VirtIO support to kernel configuration. *--kernel-localversion*=<...>:: - Set kernel option CONFIG_LOCALVERSION. Use special value "UNSET" to - unset any already set LOCALVERSION. +Set kernel option *LOCALVERSION*. Use special value *UNSET* to +unset any already set *LOCALVERSION*. The following placeholders are +available: ++ +[horizontal] +*%%ARCH%%*::: +Will be replaced with genkernel arch value, for example 'x86_64'. + ++ +*LOCALVERSION* is only allowed to contain characters like 'a-z' or 'A-Z', +'0-9', '_', '.' and '-'. ++ +By default, *LOCALVERSION* will be set to '-%%ARCH%%'. KERNEL COMPILATION @@ -437,7 +448,7 @@ Set initramfs filename which will be used when initramfs will be installed into *BOOTDIR* (implies *--install* option). Please see *--kernel-filename* option for available placeholders and restrictions. + -By default, initramfs filename will be set to 'initramfs-genkernel-%%ARCH%%-%%KV%%'. +By default, initramfs filename will be set to 'initramfs-%%KV%%.img'. *--initramfs-symlink-name*=<...>:: Set initramfs symlink name which will be used when initramfs will be @@ -477,7 +488,7 @@ Will be replaced with kernel version, for example '5.2.3-gentoo'. Kernel filename is only allowed to contain characters like 'a-z' or 'A-Z', '0-9', '_', '.' and '-'. + -By default, kernel name will be set to 'kernel-genkernel-%%ARCH%%-%%KV%%'. +By default, kernel name will be set to 'vmlinuz-%%KV%%'. NOTE: When setting a custom kernel name make sure that your bootloader and tools like *kexec* when used are recognizing your custom kernel name. @@ -502,7 +513,7 @@ Set System.map filename which will be used when kernel will be installed into *BOOTDIR* (implies *--install* option). Please see *--kernel-filename* option for available placeholders and restrictions. + -By default, System.map filename will be set to 'System.map-genkernel-%%ARCH%%-%%KV%%'. +By default, System.map filename will be set to 'System.map-%%KV%%'. *--systemmap-symlink-name*=<...>:: Set System.map symlink name which will be used when kernel will be diff --git a/gen_configkernel.sh b/gen_configkernel.sh index 124852e..4cfd246 100755 --- a/gen_configkernel.sh +++ b/gen_configkernel.sh @@ -27,7 +27,7 @@ determine_kernel_config_file() { then print_info 1 "Default configuration was forced. Will ignore any user kernel configuration!" else - kconfig_candidates=( "/etc/kernels/${GK_FILENAME_CONFIG}" ${kconfig_candidates[@]} ) + kconfig_candidates=( "/etc/kernels/${GK_FILENAME_CONFIG}" "/etc/kernels/kernel-config-${ARCH}-${KV}" ${kconfig_candidates[@]} ) fi local f diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 2689f86..df0934d 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -86,7 +86,7 @@ determine_KV() { determine_output_filenames() { print_info 5 '' 1 0 - GK_FILENAME_CONFIG="kernel-config-${ARCH}-${KV}" + GK_FILENAME_CONFIG="kernel-config-${KV}" GK_FILENAME_KERNELZ="kernelz-${KV}" GK_FILENAME_TEMP_CONFIG="config-${ARCH}-${KV}" GK_FILENAME_TEMP_INITRAMFS="initramfs-${ARCH}-${KV}" @@ -290,7 +290,7 @@ determine_real_args() { set_config_with_override STRING CROSS_COMPILE CMD_CROSS_COMPILE set_config_with_override STRING BOOTDIR CMD_BOOTDIR "/boot" set_config_with_override STRING KERNEL_OUTPUTDIR CMD_KERNEL_OUTPUTDIR "${KERNEL_DIR}" - set_config_with_override STRING KERNEL_LOCALVERSION CMD_KERNEL_LOCALVERSION + set_config_with_override STRING KERNEL_LOCALVERSION CMD_KERNEL_LOCALVERSION "-%%ARCH%%" set_config_with_override STRING MODPROBEDIR CMD_MODPROBEDIR "/etc/modprobe.d" set_config_with_override BOOL SPLASH CMD_SPLASH "no" @@ -644,6 +644,13 @@ determine_real_args() { UNSET) ;; *) + KERNEL_LOCALVERSION=$(arch_replace "${KERNEL_LOCALVERSION}") + if [ -z "${KERNEL_LOCALVERSION}" ] + then + # We somehow lost value... + gen_die "Internal error: Variable 'KERNEL_LOCALVERSION' is empty!" + fi + local valid_localversion_pattern='^[A-Za-z0-9_.-]{1,}$' if [[ ! "${KERNEL_LOCALVERSION}" =~ ${valid_localversion_pattern} ]] then diff --git a/genkernel b/genkernel index 3c125c9..31a880d 100755 --- a/genkernel +++ b/genkernel @@ -247,6 +247,16 @@ then print_warning 1 "Unable to copy the kernel configuration file; Ignoring non-fatal error ..." # Just a warning because ordinary users are not allowed to write in /etc fi +elif [[ -n "${KERNEL_LOCALVERSION}" && "${KERNEL_LOCALVERSION}" != "${LOV}" ]] +then + if [[ "${KERNEL_LOCALVERSION}" == "UNSET" && -z "${LOV}" ]] + then + # LOV is already unset... + : + else + print_warning 1 '' 1 0 + print_warning 1 "Current kernel's LOCALVERSION is set to '${LOV}'; Will ignore set --kernel-localversion value '${KERNEL_LOCALVERSION}' because kernel was not build ..." + fi fi if isTrue "${CMD_INSTALL}" diff --git a/genkernel.conf b/genkernel.conf index 23e015b..aa458fb 100644 --- a/genkernel.conf +++ b/genkernel.conf @@ -281,7 +281,7 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" # # Set kernel filename which will be used when kernel will be installed # into BOOTDIR. See man page to learn more about available placeholders. -#KERNEL_FILENAME="kernel-genkernel-%%ARCH%%-%%KV%%" +#KERNEL_FILENAME="vmlinuz-%%KV%%" # Set kernel symlink name which will be used when kernel will be installed # into BOOTDIR and SYMLINK option is enabled @@ -289,7 +289,7 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" # This option will set kernel option CONFIG_LOCALVERSION. # Use special value "UNSET" to unset already set CONFIG_LOCALVERSION. -#KERNEL_LOCALVERSION="" +#KERNEL_LOCALVERSION="-%%ARCH%%" # This option is only valid if kerncache is # defined. If there is a valid kerncache no checks @@ -318,7 +318,7 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" # Set initramfs filename which will be used when initramfs will be # installed into BOOTDIR. See man page to learn more about available # placeholders. -#INITRAMFS_FILENAME="initramfs-genkernel-%%ARCH%%-%%KV%%" +#INITRAMFS_FILENAME="initramfs-%%KV%%.img" # Set initramfs symlink name which will be used when initramfs will be # installed into BOOTDIR and SYMLINK option is enabled