Skip to content

Commit

Permalink
Merge pull request #25 from petronio-support_disabling_lvm_hibernate
Browse files Browse the repository at this point in the history
Add options to disable hibernation and LVM
  • Loading branch information
sakaki- committed May 7, 2019
2 parents c7b87ed + aa10d0e commit 989689c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 13 deletions.
39 changes: 28 additions & 11 deletions buildkernel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ shopt -s nullglob
# ********************** variables *********************
PROGNAME="$(basename "${0}")"
CONFFILE="/etc/${PROGNAME}.conf"
VERSION="1.0.34"
VERSION="1.0.35"
ETCPROFILE="/etc/profile"
DEFAULTEFIBOOTFILE="bootx64.efi"
EFIBOOTFILE="${DEFAULTEFIBOOTFILE}"
Expand Down Expand Up @@ -66,7 +66,6 @@ else
# fallback for older systems
CMDLINE_REAL_INIT="${SYSTEMD_INIT}"
fi
CMDLINE_DOLVM_FLAG="dolvm"
SECUREBOOTKEY="/etc/efikeys/db.key"
SECUREBOOTCERT="/etc/efikeys/db.crt"
SIGNEDSUFFIX=".signed"
Expand All @@ -78,6 +77,8 @@ declare -i DEFAULTCREATEEFIBOOT=1
declare -i CREATEEFIBOOT="${DEFAULTCREATEEFIBOOT}"
declare -i DEFAULTCOMPRESSINITRAMFS=1
declare -i COMPRESSINITRAMFS="${DEFAULTCOMPRESSINITRAMFS}"
declare -i DISABLE_HIBERNATION=0
declare -i DISABLE_LVM=0
# 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 @@ -511,13 +512,18 @@ setup_final_variables() {
CMDLINE_ROOTFSTYPE="$(head -n 1 <<<"${CMDLINE_ROOTFSTYPE}")"
fi
# we use path syntax rather than "=PARTUUID=" syntax, as more reliable
KERNEL_CMD_LINE="root=${CMDLINE_ROOT} crypt_root=${CRYPTPATHMAP} dolvm "
KERNEL_CMD_LINE="root=${CMDLINE_ROOT} crypt_root=${CRYPTPATHMAP} "
if ((DISABLE_LVM==0)); then
KERNEL_CMD_LINE+="dolvm "
fi
KERNEL_CMD_LINE+="real_root=${CMDLINE_REAL_ROOT} rootfstype=${CMDLINE_ROOTFSTYPE} "
KERNEL_CMD_LINE+="real_init=${CMDLINE_REAL_INIT} "
if [ -n "${LUKSKEYFILE}" ]; then
KERNEL_CMD_LINE+="root_keydev=${KEYFILEPATHMAP} root_key=${LUKSKEYFILE} "
fi
KERNEL_CMD_LINE+="real_resume=${CMDLINE_REAL_RESUME} "
if ((DISABLE_HIBERNATION==0)); then
KERNEL_CMD_LINE+="real_resume=${CMDLINE_REAL_RESUME} "
fi
KERNEL_CMD_LINE+="keymap=${KEYMAP}"
if [ -n "${PLYMOUTHTHEME}" ]; then
KERNEL_CMD_LINE+=" quiet splash"
Expand Down Expand Up @@ -1738,8 +1744,15 @@ conform_config_file() {
set_kernel_config_list_to_y "RTC_CLASS RTC_HCTOSYS RTC_SYSTOHC"
set_kernel_config "RTC_HCTOSYS_DEVICE" "rtc0"
set_kernel_config_list_to_y "RTC_INTF_SYSFS RTC_INTF_PROC RTC_INTF_DEV RTC_DRV_CMOS"
show "Enabling suspend and hibernation support..."
set_kernel_config_list_to_y "SUSPEND HIBERNATION"
show "Enabling suspend support..."
set_kernel_config_list_to_y "SUSPEND"
if ((DISABLE_HIBERNATION==0)); then
show "Enabling hibernation support..."
set_kernel_config_list_to_y "HIBERNATION"
else
show "Disabling hibernation support..."
unset_kernel_config "HIBERNATION"
fi
show "Ensuring deprecated sysfs support turned off..."
unset_kernel_config "SYSFS_DEPRECATED"
# turn off penguin logo at boot if using Plymouth
Expand Down Expand Up @@ -1868,11 +1881,15 @@ create_initramfs_using_genkernel() {
if ((ARG_POSTCLEAR==1)); then
POSTCLEAR_FLAG="--postclear" # clear all caches after genkenrel run
fi
genkernel --install --no-mountboot \
--luks --lvm --no-gpg --udev ${POSTCLEAR_FLAG} \
--kernel-config="${TARGETCONFIG}" --busybox \
--no-compress-initramfs ${ADDITIONALGENKERNELOPTS} \
${PLYMOUTH_OPTS} initramfs
GENKERNEL_OPTS="--install --no-mountboot --luks "
if ((DISABLE_LVM==0)); then
GENKERNEL_OPTS+="--lvm "
fi
GENKERNEL_OPTS+="--no-gpg --udev ${POSTCLEAR_FLAG} "
GENKERNEL_OPTS+="--kernel-config=\"${TARGETCONFIG}\" --busybox "
GENKERNEL_OPTS+="--no-compress-initramfs "
GENKERNEL_OPTS+="${ADDITIONALGENKERNELOPTS} ${PLYMOUTH_OPTS} initramfs"
genkernel ${GENKERNEL_OPTS}
# re-extract release details, in case these have changed
# (e.g. due to 'SCM dirty suffix' having been added (a '+' sign))
extract_kernel_release_name
Expand Down
2 changes: 1 addition & 1 deletion buildkernel.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH BUILDKERNEL 8 "Version 1.0.34: April 2019"
.TH BUILDKERNEL 8 "Version 1.0.35: April 2019"
.SH NAME
buildkernel \- build secure boot kernel, save to EFI system partition
.SH SYNOPSIS
Expand Down
8 changes: 8 additions & 0 deletions buildkernel.conf
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@
#KERNEL_SIGNING_CERT="auto"
#KERNEL_SIGNING_KEY="auto"

# if you don't wish to enable hibernation, uncomment below. Default is 0
# (Hibernation enabled).
#DISABLE_HIBERNATION=1

# if your configuration doesn't use LVM, uncomment below. Default is 0 (LVM
# enabled).
#DISABLE_LVM=1

# 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
12 changes: 11 additions & 1 deletion buildkernel.conf.5
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH BUILDKERNEL 5 "Version 1.0.34: April 2019"
.TH BUILDKERNEL 5 "Version 1.0.35: April 2019"
.SH NAME
buildkernel.conf \- a configuration file for \fBbuildkernel\fR(8)
.SH SYNOPSIS
Expand Down Expand Up @@ -214,6 +214,16 @@ to generate it.

By default this is not set and causes external modules to not be signed.
Requires that the \fBKERNEL_SIGNING_CERT\fR variable is set.
.br
.TP
.BR DISABLE_HIBERNATION
If you wish to disable hibernation, set this to \fB1\fR. This is set to
\fB0\fR (Hibernation enabled) by default.
.br
.TP
.BR DISABLE_LVM
If your configuration doesn't use LVM, set this to \fB1\fR. This is set to
\fB0\fR (LVM enabled) by default.

.RE
.SH FUNCTIONS
Expand Down

0 comments on commit 989689c

Please sign in to comment.