Skip to content

Commit e95ed47

Browse files
committed
Bump version to 1.0.30
Use XZ compression for integrated initramfs by default now; some systems will not boot if a large, uncompressed initramfs is used (even though the enclosing kernel is compressed).
1 parent 1809430 commit e95ed47

File tree

4 files changed

+49
-13
lines changed

4 files changed

+49
-13
lines changed

buildkernel

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Build kernel, modules and initial ramdisk in correct sequence, ensuring kernel
44
# config is conformed, then sign if possible and copy to EFI boot partition.
55
#
6-
# Copyright (c) 2014-2017 sakaki <sakaki@deciban.com>
6+
# Copyright (c) 2014-2018 sakaki <sakaki@deciban.com>
77
#
88
# License (GPL v3.0)
99
# ------------------
@@ -31,7 +31,7 @@ shopt -s nullglob
3131
# ********************** variables *********************
3232
PROGNAME="$(basename "${0}")"
3333
CONFFILE="/etc/${PROGNAME}.conf"
34-
VERSION="1.0.29"
34+
VERSION="1.0.30"
3535
ETCPROFILE="/etc/profile"
3636
DEFAULTEFIBOOTFILE="bootx64.efi"
3737
EFIBOOTFILE="${DEFAULTEFIBOOTFILE}"
@@ -77,6 +77,8 @@ CMDLINE_REAL_ROOT="/dev/mapper/vg1-root"
7777
CMDLINE_REAL_RESUME="/dev/mapper/vg1-swap"
7878
declare -i DEFAULTCREATEEFIBOOT=1
7979
declare -i CREATEEFIBOOT="${DEFAULTCREATEEFIBOOT}"
80+
declare -i DEFAULTCOMPRESSINITRAMFS=1
81+
declare -i COMPRESSINITRAMFS="${DEFAULTCOMPRESSINITRAMFS}"
8082
# you can use xconfig etc if you like - override in /etc/buildkernel.conf
8183
CONFIGTYPE="menuconfig"
8284
# following should already be in the environment; but to be safe...
@@ -1633,12 +1635,28 @@ conform_config_file() {
16331635
set_kernel_config "CMDLINE" "\"${KERNEL_CMD_LINE}\""
16341636
show "Setting up initramfs location and type..."
16351637
set_kernel_config "INITRAMFS_SOURCE" "\"${UNCOMPRESSEDINITRAMFS}\""
1636-
# initramfs compression must be 'none' - not as big a deal as it sounds,
1637-
# since the encapsulating kernel image will itself be compressed...
1638-
for COMP_TYPE in "GZIP" "BZIP2" "LZMA" "XZ" "LZO"; do
1639-
unset_kernel_config "INITRAMFS_COMPRESSION_${COMP_TYPE}"
1640-
done
1641-
set_kernel_config "INITRAMFS_COMPRESSION_NONE" "y"
1638+
# unless the user specifically directs, we will compress the initramfs with
1639+
# XZ - although the enclosing kernel will be compressed anyway, this can
1640+
# help on low-memory systems; also the need to leave compression off seems
1641+
# to no longer apply with modern kernels
1642+
if ((COMPRESSINITRAMFS==1)); then
1643+
show "Using XZ compression for built-in initramfs"
1644+
unset_kernel_config "INITRAMFS_COMPRESSION_NONE"
1645+
for COMP_TYPE in "GZIP" "BZIP2" "LZMA" "LZO" "LZ4"; do
1646+
unset_kernel_config "INITRAMFS_COMPRESSION_${COMP_TYPE}"
1647+
done
1648+
set_kernel_config "INITRAMFS_COMPRESSION_XZ" "y"
1649+
set_kernel_config "INITRAMFS_COMPRESSION" ".xz"
1650+
else
1651+
warning "As requested, not compressing the built-in initramfs"
1652+
warning "This can lead to boot failure on memory-constrained systems"
1653+
for COMP_TYPE in "GZIP" "BZIP2" "LZMA" "XZ" "LZO" "LZ4"; do
1654+
unset_kernel_config "INITRAMFS_COMPRESSION_${COMP_TYPE}"
1655+
done
1656+
set_kernel_config "INITRAMFS_COMPRESSION_NONE" "y"
1657+
set_kernel_config "INITRAMFS_COMPRESSION" ""
1658+
fi
1659+
16421660
# ensure we can get at the LUKS volume! note that these could also be
16431661
# modules really, since we copy all modules into the initramfs
16441662
show "Ensuring Serpent, Whirlpool and SHA-512 are included..."
@@ -1767,7 +1785,9 @@ rebuild_external_modules_if_necessary() {
17671785
create_initramfs_using_genkernel() {
17681786
show "Creating initramfs (uncompressed)..."
17691787
# this is a partial use of genkernel, we don't use it to build the kernel
1770-
# itself; also note, EFI kernels *require* an uncompressed ramdisk
1788+
# itself; also note, we build an uncompressed ramdisk, as the kernel
1789+
# build process will compress it on integration into the
1790+
# unified kernel image
17711791
# we suppress gpg here as we don't want to add gpg v2 which is installed,
17721792
# but rather our static gpg v1, which will be inserted into the initramfs
17731793
local PLYMOUTH_OPTS=""

buildkernel.8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH BUILDKERNEL 8 "Version 1.0.29: January 2018"
1+
.TH BUILDKERNEL 8 "Version 1.0.30: May 2018"
22
.SH NAME
33
buildkernel \- build secure boot kernel, save to EFI system partition
44
.SH SYNOPSIS
@@ -244,7 +244,7 @@ A post-reboot run of \fBgenup\fR(8) will achieve this.
244244

245245
.SH COPYRIGHT
246246
.nf
247-
Copyright \(co 2014-2017 sakaki
247+
Copyright \(co 2014-2018 sakaki
248248
License GPLv3+ (GNU GPL version 3 or later)
249249
<http://gnu.org/licenses/gpl.html>
250250

buildkernel.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@
7373
# the below (capitalization is unimportant)
7474
#INITSYSTEM="openrc"
7575

76+
# if you want to revert to the old (<=1.0.29) behaviour of _not_ compressing
77+
# the built-in initramfs, uncomment the line below; XZ compression is now
78+
# used by default; some systems will not boot large kernels that contain an
79+
# uncompressed ramfs, even though the enclosing kernel is itself compressed
80+
#COMPRESSINITRAMFS=0
81+
7682
# if you need to conform the config file for some reason, uncomment this
7783
# hook function and fill it out to suit your requirements
7884
# NB you should only really need to do this to override a setting forced

buildkernel.conf.5

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH BUILDKERNEL 5 "Version 1.0.29: January 2018"
1+
.TH BUILDKERNEL 5 "Version 1.0.30: May 2018"
22
.SH NAME
33
buildkernel.conf \- a configuration file for \fBbuildkernel\fR(8)
44
.SH SYNOPSIS
@@ -176,6 +176,16 @@ Set to \fB0\fR only if you have your own EFI bootloader,
176176
or want to insert appropriate EFI boot settings manually.
177177

178178
Most users will not need to override the default.
179+
.br
180+
.TP
181+
.BR COMPRESSINITRAMFS
182+
When set to \fB0\fR the \fBbuildkernel\fR script will \fInot\fR
183+
intruct the kernel to XZ compress its integral initrams (the default
184+
behaviour prior to version 1.0.30); doing so may cause boot
185+
issues on certain systems with modest RAM.
186+
187+
Most users will not need to override the default.
188+
179189
.RE
180190
.SH FUNCTIONS
181191
The following hook functions \fImay\fR be specified in \fB/etc/buildkernel.conf\fR if
@@ -201,7 +211,7 @@ function exit.
201211
.RE
202212
.SH COPYRIGHT
203213
.nf
204-
Copyright \(co 2014-2017 sakaki
214+
Copyright \(co 2014-2018 sakaki
205215
License GPLv3+ (GNU GPL version 3 or later)
206216
<http://gnu.org/licenses/gpl.html>
207217

0 commit comments

Comments
 (0)