diff --git a/buildkernel b/buildkernel index ed58064..2115326 100755 --- a/buildkernel +++ b/buildkernel @@ -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}" @@ -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" @@ -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... @@ -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" @@ -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 @@ -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 diff --git a/buildkernel.8 b/buildkernel.8 index fe44896..5fdac6b 100644 --- a/buildkernel.8 +++ b/buildkernel.8 @@ -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 diff --git a/buildkernel.conf b/buildkernel.conf index 4eb0498..72afa7d 100644 --- a/buildkernel.conf +++ b/buildkernel.conf @@ -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 diff --git a/buildkernel.conf.5 b/buildkernel.conf.5 index 199be3b..e9b045a 100644 --- a/buildkernel.conf.5 +++ b/buildkernel.conf.5 @@ -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 @@ -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