Skip to content

Commit

Permalink
Bump version to 1.0.30
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
sakaki- committed May 3, 2018
1 parent 1809430 commit e95ed47
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 13 deletions.
38 changes: 29 additions & 9 deletions buildkernel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Build kernel, modules and initial ramdisk in correct sequence, ensuring kernel
# config is conformed, then sign if possible and copy to EFI boot partition.
#
# Copyright (c) 2014-2017 sakaki <[email protected]>
# Copyright (c) 2014-2018 sakaki <[email protected]>
#
# License (GPL v3.0)
# ------------------
Expand Down Expand Up @@ -31,7 +31,7 @@ shopt -s nullglob
# ********************** variables *********************
PROGNAME="$(basename "${0}")"
CONFFILE="/etc/${PROGNAME}.conf"
VERSION="1.0.29"
VERSION="1.0.30"
ETCPROFILE="/etc/profile"
DEFAULTEFIBOOTFILE="bootx64.efi"
EFIBOOTFILE="${DEFAULTEFIBOOTFILE}"
Expand Down Expand Up @@ -77,6 +77,8 @@ CMDLINE_REAL_ROOT="/dev/mapper/vg1-root"
CMDLINE_REAL_RESUME="/dev/mapper/vg1-swap"
declare -i DEFAULTCREATEEFIBOOT=1
declare -i CREATEEFIBOOT="${DEFAULTCREATEEFIBOOT}"
declare -i DEFAULTCOMPRESSINITRAMFS=1
declare -i COMPRESSINITRAMFS="${DEFAULTCOMPRESSINITRAMFS}"
# you can use xconfig etc if you like - override in /etc/buildkernel.conf
CONFIGTYPE="menuconfig"
# following should already be in the environment; but to be safe...
Expand Down Expand Up @@ -1633,12 +1635,28 @@ conform_config_file() {
set_kernel_config "CMDLINE" "\"${KERNEL_CMD_LINE}\""
show "Setting up initramfs location and type..."
set_kernel_config "INITRAMFS_SOURCE" "\"${UNCOMPRESSEDINITRAMFS}\""
# initramfs compression must be 'none' - not as big a deal as it sounds,
# since the encapsulating kernel image will itself be compressed...
for COMP_TYPE in "GZIP" "BZIP2" "LZMA" "XZ" "LZO"; do
unset_kernel_config "INITRAMFS_COMPRESSION_${COMP_TYPE}"
done
set_kernel_config "INITRAMFS_COMPRESSION_NONE" "y"
# unless the user specifically directs, we will compress the initramfs with
# XZ - although the enclosing kernel will be compressed anyway, this can
# help on low-memory systems; also the need to leave compression off seems
# to no longer apply with modern kernels
if ((COMPRESSINITRAMFS==1)); then
show "Using XZ compression for built-in initramfs"
unset_kernel_config "INITRAMFS_COMPRESSION_NONE"
for COMP_TYPE in "GZIP" "BZIP2" "LZMA" "LZO" "LZ4"; do
unset_kernel_config "INITRAMFS_COMPRESSION_${COMP_TYPE}"
done
set_kernel_config "INITRAMFS_COMPRESSION_XZ" "y"
set_kernel_config "INITRAMFS_COMPRESSION" ".xz"
else
warning "As requested, not compressing the built-in initramfs"
warning "This can lead to boot failure on memory-constrained systems"
for COMP_TYPE in "GZIP" "BZIP2" "LZMA" "XZ" "LZO" "LZ4"; do
unset_kernel_config "INITRAMFS_COMPRESSION_${COMP_TYPE}"
done
set_kernel_config "INITRAMFS_COMPRESSION_NONE" "y"
set_kernel_config "INITRAMFS_COMPRESSION" ""
fi

# ensure we can get at the LUKS volume! note that these could also be
# modules really, since we copy all modules into the initramfs
show "Ensuring Serpent, Whirlpool and SHA-512 are included..."
Expand Down Expand Up @@ -1767,7 +1785,9 @@ rebuild_external_modules_if_necessary() {
create_initramfs_using_genkernel() {
show "Creating initramfs (uncompressed)..."
# this is a partial use of genkernel, we don't use it to build the kernel
# itself; also note, EFI kernels *require* an uncompressed ramdisk
# itself; also note, we build an uncompressed ramdisk, as the kernel
# build process will compress it on integration into the
# unified kernel image
# we suppress gpg here as we don't want to add gpg v2 which is installed,
# but rather our static gpg v1, which will be inserted into the initramfs
local PLYMOUTH_OPTS=""
Expand Down
4 changes: 2 additions & 2 deletions buildkernel.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH BUILDKERNEL 8 "Version 1.0.29: January 2018"
.TH BUILDKERNEL 8 "Version 1.0.30: May 2018"
.SH NAME
buildkernel \- build secure boot kernel, save to EFI system partition
.SH SYNOPSIS
Expand Down Expand Up @@ -244,7 +244,7 @@ A post-reboot run of \fBgenup\fR(8) will achieve this.

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

Expand Down
6 changes: 6 additions & 0 deletions buildkernel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@
# the below (capitalization is unimportant)
#INITSYSTEM="openrc"

# if you want to revert to the old (<=1.0.29) behaviour of _not_ compressing
# the built-in initramfs, uncomment the line below; XZ compression is now
# used by default; some systems will not boot large kernels that contain an
# uncompressed ramfs, even though the enclosing kernel is itself compressed
#COMPRESSINITRAMFS=0

# if you need to conform the config file for some reason, uncomment this
# hook function and fill it out to suit your requirements
# NB you should only really need to do this to override a setting forced
Expand Down
14 changes: 12 additions & 2 deletions buildkernel.conf.5
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH BUILDKERNEL 5 "Version 1.0.29: January 2018"
.TH BUILDKERNEL 5 "Version 1.0.30: May 2018"
.SH NAME
buildkernel.conf \- a configuration file for \fBbuildkernel\fR(8)
.SH SYNOPSIS
Expand Down Expand Up @@ -176,6 +176,16 @@ Set to \fB0\fR only if you have your own EFI bootloader,
or want to insert appropriate EFI boot settings manually.

Most users will not need to override the default.
.br
.TP
.BR COMPRESSINITRAMFS
When set to \fB0\fR the \fBbuildkernel\fR script will \fInot\fR
intruct the kernel to XZ compress its integral initrams (the default
behaviour prior to version 1.0.30); doing so may cause boot
issues on certain systems with modest RAM.

Most users will not need to override the default.

.RE
.SH FUNCTIONS
The following hook functions \fImay\fR be specified in \fB/etc/buildkernel.conf\fR if
Expand All @@ -201,7 +211,7 @@ function exit.
.RE
.SH COPYRIGHT
.nf
Copyright \(co 2014-2017 sakaki
Copyright \(co 2014-2018 sakaki
License GPLv3+ (GNU GPL version 3 or later)
<http://gnu.org/licenses/gpl.html>

Expand Down

0 comments on commit e95ed47

Please sign in to comment.