1 |
commit: 19df7f243f9440a8192d112363daa26aca69c846 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Aug 1 18:08:44 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Aug 1 20:35:00 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=19df7f24 |
7 |
|
8 |
gen_initramfs.sh: create_initramfs(): Use correct kernel config |
9 |
|
10 |
Bug: https://bugs.gentoo.org/733946 |
11 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
12 |
|
13 |
gen_initramfs.sh | 45 ++++++++++++++++++++++----------------------- |
14 |
1 file changed, 22 insertions(+), 23 deletions(-) |
15 |
|
16 |
diff --git a/gen_initramfs.sh b/gen_initramfs.sh |
17 |
index c583318..d1a0e33 100755 |
18 |
--- a/gen_initramfs.sh |
19 |
+++ b/gen_initramfs.sh |
20 |
@@ -2022,21 +2022,21 @@ create_initramfs() { |
21 |
|
22 |
cd "${TEMP}" || gen_die "Failed to chdir to '${TEMP}'" |
23 |
|
24 |
- # NOTE: We do not work with ${KERNEL_CONFIG} here, since things like |
25 |
- # "make oldconfig" or --no-clean could be in effect. |
26 |
- if [ -s "${KERNEL_OUTPUTDIR}/.config" ] |
27 |
+ local kconfig_file_used="${KERNEL_CONFIG}" |
28 |
+ if isTrue "${BUILD_KERNEL}" |
29 |
then |
30 |
- local ACTUAL_KERNEL_CONFIG="${KERNEL_OUTPUTDIR}/.config" |
31 |
- else |
32 |
- local ACTUAL_KERNEL_CONFIG="${KERNEL_CONFIG}" |
33 |
+ kconfig_file_used="${KERNEL_OUTPUTDIR}/.config" |
34 |
fi |
35 |
|
36 |
- if isTrue "$(is_gzipped "${ACTUAL_KERNEL_CONFIG}")" |
37 |
+ if isTrue "$(is_gzipped "${kconfig_file_used}")" |
38 |
then |
39 |
- # Support --kernel-config=/proc/config.gz, mainly |
40 |
- local CONFGREP=zgrep |
41 |
- else |
42 |
- local CONFGREP=grep |
43 |
+ print_info 5 "Compressed kernel config '${kconfig_file_used}' found; Must decompress to temporary file ..." |
44 |
+ |
45 |
+ local kconfig_file_tmp="${TEMP}/current_kernel.config" |
46 |
+ zcat "${kconfig_file_used}" > "${kconfig_file_tmp}" \ |
47 |
+ || gen_die "Failed to decompress '${kconfig_file_used}' to '${kconfig_file_tmp}'!" |
48 |
+ |
49 |
+ kconfig_file_used="${kconfig_file_tmp}" |
50 |
fi |
51 |
|
52 |
if isTrue "${INTEGRATED_INITRAMFS}" |
53 |
@@ -2044,20 +2044,18 @@ create_initramfs() { |
54 |
# Explicitly do not compress if we are integrating into the kernel. |
55 |
# The kernel will do a better job of it than us. |
56 |
mv "${CPIO_ARCHIVE}" "${CPIO_ARCHIVE}.cpio" |
57 |
- sed -i '/^.*CONFIG_INITRAMFS_SOURCE=.*$/d' "${KERNEL_OUTPUTDIR}/.config" \ |
58 |
- || gen_die "failed to delete CONFIG_INITRAMFS_SOURCE from '${KERNEL_OUTPUTDIR}/.config'" |
59 |
|
60 |
print_info 1 "$(get_indent 1)>> --integrated-initramfs is set; Setting CONFIG_INITRAMFS_* options ..." |
61 |
|
62 |
[ -f "${KCONFIG_MODIFIED_MARKER}" ] && rm "${KCONFIG_MODIFIED_MARKER}" |
63 |
[ -f "${KCONFIG_REQUIRED_OPTIONS}" ] && rm "${KCONFIG_REQUIRED_OPTIONS}" |
64 |
|
65 |
- kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_BLK_DEV_INITRD" "y" |
66 |
- kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_INITRAMFS_SOURCE" "\"${CPIO_ARCHIVE}.cpio\"" |
67 |
- kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_INITRAMFS_ROOT_UID" "0" |
68 |
- kconfig_set_opt "${KERNEL_OUTPUTDIR}/.config" "CONFIG_INITRAMFS_ROOT_GID" "0" |
69 |
+ kconfig_set_opt "${kconfig_file_used}" "CONFIG_BLK_DEV_INITRD" "y" |
70 |
+ kconfig_set_opt "${kconfig_file_used}" "CONFIG_INITRAMFS_SOURCE" "\"${CPIO_ARCHIVE}.cpio\"" |
71 |
+ kconfig_set_opt "${kconfig_file_used}" "CONFIG_INITRAMFS_ROOT_UID" "0" |
72 |
+ kconfig_set_opt "${kconfig_file_used}" "CONFIG_INITRAMFS_ROOT_GID" "0" |
73 |
|
74 |
- set_initramfs_compression_method "${KERNEL_OUTPUTDIR}/.config" |
75 |
+ set_initramfs_compression_method "${kconfig_file_used}" |
76 |
|
77 |
if [ -f "${KCONFIG_MODIFIED_MARKER}" ] |
78 |
then |
79 |
@@ -2072,8 +2070,9 @@ create_initramfs() { |
80 |
if ! isTrue "${BUILD_KERNEL}" || isTrue "${KERNCACHE_IS_VALID}" |
81 |
then |
82 |
# We need to initialize COMPRESS_INITRD_TYPE in case it was set |
83 |
- # to best/fastest |
84 |
- set_initramfs_compression_method "${KERNEL_OUTPUTDIR}/.config" |
85 |
+ # to best/fastest and validate if used kernel config can decompress |
86 |
+ # set COMPRESS_INITRD_TYPE at all. |
87 |
+ set_initramfs_compression_method "${kconfig_file_used}" |
88 |
fi |
89 |
|
90 |
print_info 1 "$(get_indent 1)>> Compressing cpio data (${GKICM_LOOKUP_TABLE_EXT[${COMPRESS_INITRD_TYPE}]}) ..." |
91 |
@@ -2090,9 +2089,9 @@ create_initramfs() { |
92 |
## be before the other cpio archives in the stream. |
93 |
if isTrue "${MICROCODE_INITRAMFS}" |
94 |
then |
95 |
- local cfg_CONFIG_MICROCODE=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}"/.config CONFIG_MICROCODE) |
96 |
- local cfg_CONFIG_MICROCODE_INTEL=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}"/.config CONFIG_MICROCODE_INTEL) |
97 |
- local cfg_CONFIG_MICROCODE_AMD=$(kconfig_get_opt "${KERNEL_OUTPUTDIR}"/.config CONFIG_MICROCODE_AMD) |
98 |
+ local cfg_CONFIG_MICROCODE=$(kconfig_get_opt "${kconfig_file_used}" CONFIG_MICROCODE) |
99 |
+ local cfg_CONFIG_MICROCODE_INTEL=$(kconfig_get_opt "${kconfig_file_used}" CONFIG_MICROCODE_INTEL) |
100 |
+ local cfg_CONFIG_MICROCODE_AMD=$(kconfig_get_opt "${kconfig_file_used}" CONFIG_MICROCODE_AMD) |
101 |
print_info 1 "$(get_indent 1)>> Adding early-microcode support ..." |
102 |
local UCODEDIR="${TEMP}/ucode_tmp/kernel/x86/microcode/" |
103 |
mkdir -p "${UCODEDIR}" || gen_die "Failed to create '${UCODEDIR}'!" |