Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: /, doc/, defaults/
Date: Mon, 29 Jul 2019 20:10:30
Message-Id: 1564430426.c452f3d690dc695a55aee63f0f2e4ab0cbb7b93a.whissi@gentoo
1 commit: c452f3d690dc695a55aee63f0f2e4ab0cbb7b93a
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 28 20:56:30 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 29 20:00:26 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c452f3d6
7
8 Change kernel and initramfs default filename in $BOOTDIR
9
10 This commit will change default kernel and initramfs filename:
11
12 kernel-genkernel-%%ARCH%%-%%KV%% -> vmlinuz-%%KV%%
13 System.map-genkernel--%%ARCH%%-%%KV%% -> System.map-%%KV%%
14 initramfs-genkernel-%%ARCH%%-%%KV%% -> initramfs-%%KV%%.img
15
16 The new naming will be consistent with kernel's "make install" and
17 will allow to match files in /lib/modules with actual kernel.
18
19 In addition, $ARCH value was moved to kernel's LOCALVERSION. This will
20 ensure that this information is still present and when you do
21 cross-compilation, that /lib/modules content don't get mixed.
22
23 Bug: https://bugs.gentoo.org/390407
24 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
25
26 defaults/config.sh | 6 +++---
27 doc/genkernel.8.txt | 21 ++++++++++++++++-----
28 gen_configkernel.sh | 2 +-
29 gen_determineargs.sh | 11 +++++++++--
30 genkernel | 10 ++++++++++
31 genkernel.conf | 6 +++---
32 6 files changed, 42 insertions(+), 14 deletions(-)
33
34 diff --git a/defaults/config.sh b/defaults/config.sh
35 index 7232671..9d15633 100644
36 --- a/defaults/config.sh
37 +++ b/defaults/config.sh
38 @@ -21,11 +21,11 @@ KERNEL_SUPPORT_MICROCODE=no
39 # Arch-specific defaults that can be overridden in the config file or on the
40 # command line.
41 #
42 -DEFAULT_INITRAMFS_FILENAME="initramfs-genkernel-%%ARCH%%-%%KV%%"
43 +DEFAULT_INITRAMFS_FILENAME="initramfs-%%KV%%.img"
44 DEFAULT_INITRAMFS_SYMLINK_NAME="initramfs"
45 -DEFAULT_KERNEL_FILENAME="kernel-genkernel-%%ARCH%%-%%KV%%"
46 +DEFAULT_KERNEL_FILENAME="vmlinuz-%%KV%%"
47 DEFAULT_KERNEL_SYMLINK_NAME="kernel"
48 -DEFAULT_SYSTEMMAP_FILENAME="System.map-%%ARCH%%-%%KV%%"
49 +DEFAULT_SYSTEMMAP_FILENAME="System.map-%%KV%%"
50 DEFAULT_SYSTEMMAP_SYMLINK_NAME="System.map"
51
52 DEFAULT_COMPRESS_INITRD=yes
53
54 diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
55 index e94fa12..35762a2 100644
56 --- a/doc/genkernel.8.txt
57 +++ b/doc/genkernel.8.txt
58 @@ -125,8 +125,19 @@ KERNEL CONFIGURATION
59 Adds, or skip adding VirtIO support to kernel configuration.
60
61 *--kernel-localversion*=<...>::
62 - Set kernel option CONFIG_LOCALVERSION. Use special value "UNSET" to
63 - unset any already set LOCALVERSION.
64 +Set kernel option *LOCALVERSION*. Use special value *UNSET* to
65 +unset any already set *LOCALVERSION*. The following placeholders are
66 +available:
67 ++
68 +[horizontal]
69 +*%%ARCH%%*:::
70 +Will be replaced with genkernel arch value, for example 'x86_64'.
71 +
72 ++
73 +*LOCALVERSION* is only allowed to contain characters like 'a-z' or 'A-Z',
74 +'0-9', '_', '.' and '-'.
75 ++
76 +By default, *LOCALVERSION* will be set to '-%%ARCH%%'.
77
78
79 KERNEL COMPILATION
80 @@ -437,7 +448,7 @@ Set initramfs filename which will be used when initramfs will be installed
81 into *BOOTDIR* (implies *--install* option). Please see
82 *--kernel-filename* option for available placeholders and restrictions.
83 +
84 -By default, initramfs filename will be set to 'initramfs-genkernel-%%ARCH%%-%%KV%%'.
85 +By default, initramfs filename will be set to 'initramfs-%%KV%%.img'.
86
87 *--initramfs-symlink-name*=<...>::
88 Set initramfs symlink name which will be used when initramfs will be
89 @@ -477,7 +488,7 @@ Will be replaced with kernel version, for example '5.2.3-gentoo'.
90 Kernel filename is only allowed to contain characters like 'a-z' or 'A-Z',
91 '0-9', '_', '.' and '-'.
92 +
93 -By default, kernel name will be set to 'kernel-genkernel-%%ARCH%%-%%KV%%'.
94 +By default, kernel name will be set to 'vmlinuz-%%KV%%'.
95
96 NOTE: When setting a custom kernel name make sure that your bootloader and
97 tools like *kexec* when used are recognizing your custom kernel name.
98 @@ -502,7 +513,7 @@ Set System.map filename which will be used when kernel will be installed
99 into *BOOTDIR* (implies *--install* option). Please see
100 *--kernel-filename* option for available placeholders and restrictions.
101 +
102 -By default, System.map filename will be set to 'System.map-genkernel-%%ARCH%%-%%KV%%'.
103 +By default, System.map filename will be set to 'System.map-%%KV%%'.
104
105 *--systemmap-symlink-name*=<...>::
106 Set System.map symlink name which will be used when kernel will be
107
108 diff --git a/gen_configkernel.sh b/gen_configkernel.sh
109 index 124852e..4cfd246 100755
110 --- a/gen_configkernel.sh
111 +++ b/gen_configkernel.sh
112 @@ -27,7 +27,7 @@ determine_kernel_config_file() {
113 then
114 print_info 1 "Default configuration was forced. Will ignore any user kernel configuration!"
115 else
116 - kconfig_candidates=( "/etc/kernels/${GK_FILENAME_CONFIG}" ${kconfig_candidates[@]} )
117 + kconfig_candidates=( "/etc/kernels/${GK_FILENAME_CONFIG}" "/etc/kernels/kernel-config-${ARCH}-${KV}" ${kconfig_candidates[@]} )
118 fi
119
120 local f
121
122 diff --git a/gen_determineargs.sh b/gen_determineargs.sh
123 index 2689f86..df0934d 100755
124 --- a/gen_determineargs.sh
125 +++ b/gen_determineargs.sh
126 @@ -86,7 +86,7 @@ determine_KV() {
127 determine_output_filenames() {
128 print_info 5 '' 1 0
129
130 - GK_FILENAME_CONFIG="kernel-config-${ARCH}-${KV}"
131 + GK_FILENAME_CONFIG="kernel-config-${KV}"
132 GK_FILENAME_KERNELZ="kernelz-${KV}"
133 GK_FILENAME_TEMP_CONFIG="config-${ARCH}-${KV}"
134 GK_FILENAME_TEMP_INITRAMFS="initramfs-${ARCH}-${KV}"
135 @@ -290,7 +290,7 @@ determine_real_args() {
136 set_config_with_override STRING CROSS_COMPILE CMD_CROSS_COMPILE
137 set_config_with_override STRING BOOTDIR CMD_BOOTDIR "/boot"
138 set_config_with_override STRING KERNEL_OUTPUTDIR CMD_KERNEL_OUTPUTDIR "${KERNEL_DIR}"
139 - set_config_with_override STRING KERNEL_LOCALVERSION CMD_KERNEL_LOCALVERSION
140 + set_config_with_override STRING KERNEL_LOCALVERSION CMD_KERNEL_LOCALVERSION "-%%ARCH%%"
141 set_config_with_override STRING MODPROBEDIR CMD_MODPROBEDIR "/etc/modprobe.d"
142
143 set_config_with_override BOOL SPLASH CMD_SPLASH "no"
144 @@ -644,6 +644,13 @@ determine_real_args() {
145 UNSET)
146 ;;
147 *)
148 + KERNEL_LOCALVERSION=$(arch_replace "${KERNEL_LOCALVERSION}")
149 + if [ -z "${KERNEL_LOCALVERSION}" ]
150 + then
151 + # We somehow lost value...
152 + gen_die "Internal error: Variable 'KERNEL_LOCALVERSION' is empty!"
153 + fi
154 +
155 local valid_localversion_pattern='^[A-Za-z0-9_.-]{1,}$'
156 if [[ ! "${KERNEL_LOCALVERSION}" =~ ${valid_localversion_pattern} ]]
157 then
158
159 diff --git a/genkernel b/genkernel
160 index 3c125c9..31a880d 100755
161 --- a/genkernel
162 +++ b/genkernel
163 @@ -247,6 +247,16 @@ then
164 print_warning 1 "Unable to copy the kernel configuration file; Ignoring non-fatal error ..."
165 # Just a warning because ordinary users are not allowed to write in /etc
166 fi
167 +elif [[ -n "${KERNEL_LOCALVERSION}" && "${KERNEL_LOCALVERSION}" != "${LOV}" ]]
168 +then
169 + if [[ "${KERNEL_LOCALVERSION}" == "UNSET" && -z "${LOV}" ]]
170 + then
171 + # LOV is already unset...
172 + :
173 + else
174 + print_warning 1 '' 1 0
175 + print_warning 1 "Current kernel's LOCALVERSION is set to '${LOV}'; Will ignore set --kernel-localversion value '${KERNEL_LOCALVERSION}' because kernel was not build ..."
176 + fi
177 fi
178
179 if isTrue "${CMD_INSTALL}"
180
181 diff --git a/genkernel.conf b/genkernel.conf
182 index 23e015b..aa458fb 100644
183 --- a/genkernel.conf
184 +++ b/genkernel.conf
185 @@ -281,7 +281,7 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux"
186 #
187 # Set kernel filename which will be used when kernel will be installed
188 # into BOOTDIR. See man page to learn more about available placeholders.
189 -#KERNEL_FILENAME="kernel-genkernel-%%ARCH%%-%%KV%%"
190 +#KERNEL_FILENAME="vmlinuz-%%KV%%"
191
192 # Set kernel symlink name which will be used when kernel will be installed
193 # into BOOTDIR and SYMLINK option is enabled
194 @@ -289,7 +289,7 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux"
195
196 # This option will set kernel option CONFIG_LOCALVERSION.
197 # Use special value "UNSET" to unset already set CONFIG_LOCALVERSION.
198 -#KERNEL_LOCALVERSION=""
199 +#KERNEL_LOCALVERSION="-%%ARCH%%"
200
201 # This option is only valid if kerncache is
202 # defined. If there is a valid kerncache no checks
203 @@ -318,7 +318,7 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux"
204 # Set initramfs filename which will be used when initramfs will be
205 # installed into BOOTDIR. See man page to learn more about available
206 # placeholders.
207 -#INITRAMFS_FILENAME="initramfs-genkernel-%%ARCH%%-%%KV%%"
208 +#INITRAMFS_FILENAME="initramfs-%%KV%%.img"
209
210 # Set initramfs symlink name which will be used when initramfs will be
211 # installed into BOOTDIR and SYMLINK option is enabled