[gentoo-commits] proj/genkernel:master commit in: defaults/, /, doc/
commit: 732bd70737b784aa5e6b15430b7cf9f4e28948a1 Author: FlyingWaffle pm me> AuthorDate: Thu May 19 23:43:24 2022 + Commit: Sam James gentoo org> CommitDate: Wed Aug 30 05:47:41 2023 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=732bd707 Plymouth support for genkernel (squashed). Bug: https://bugs.gentoo.org/753617 Signed-off-by: FlyingWaffle pm.me> Signed-off-by: Sam James gentoo.org> defaults/initrd.scripts | 95 +++-- defaults/linuxrc| 19 -- doc/genkernel.8.txt | 7 gen_cmdline.sh | 14 gen_determineargs.sh| 16 + gen_initramfs.sh| 57 + genkernel.conf | 7 7 files changed, 210 insertions(+), 5 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 3d00a55..01bfe07 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1031,6 +1031,8 @@ run_emergency_shell() { } run_shell() { + splash 'verbose' >/dev/null & + if ! is_userinteraction_allowed then bad_msg "gk.userinteraction.disabled is set; Spawning a shell is disabled!" @@ -1226,9 +1228,22 @@ write_env_file() { } crypt_filter() { + local ask_pass=${2} + good_msg "Using the following decryption command: ${1}" ${CRYPT_SILENT} + if [ "${CRYPT_SILENT}" = '1' ] then eval run ${1} + elif [ "${PLYMOUTH}" = '1' ] && [ ${ask_pass} -eq 1 ] + then + local ply_cmd_file="$(mktemp -t 'ply_cmd.XX' 2>/dev/null)" + printf '#!/bin/sh\n%s\n' "${1}" > "${ply_cmd_file}" + run chmod 500 "${ply_cmd_file}" + plymouthRun ask-for-password --prompt "Enter LUKS passphrase" \ + --number-of-tries=3 --command="${ply_cmd_file}" + res=$? + run rm "${ply_cmd_file}" >/dev/null 2>&1 + return ${res} else splash 'verbose' >/dev/null & eval run ${1} @@ -1306,6 +1321,7 @@ prompt_user() { fi [ -n "${3}" ] && local explnt=" or : ${3}" || local explnt="." + splash 'verbose' >/dev/null & bad_msg "Could not find the ${2} in ${oldvalue}${explnt}" if [ -f "${GK_USERINTERACTION_DISABLED_STATEFILE}" ] @@ -1388,6 +1404,8 @@ prompt_user() { eval ${1}'='${oldvalue} ;; esac + + splash 'quiet' >/dev/null & } cmdline_hwopts() { @@ -1550,7 +1568,64 @@ copyKeymap() { } splash() { - return 0 + if [ "${FBSPLASH}" = '1' ] + then + return 0 + elif [ "${PLYMOUTH}" = '1' ] + then + case "${1}" in + init) + plymouthInit + ;; + + verbose) + plymouthRun --hide-splash + ;; + + set_msg) + plymouthRun --update="${2}" + ;; + + quiet) + plymouthRun --show-splash + ;; + + hasroot) + plymouthRun --newroot="${2}" + ;; + esac + fi +} + +plymouthRun() { + run plymouth --ping 2>/dev/null || return $? + run plymouth "${@}" 2>/dev/null +} + +plymouthInit() { + good_msg "Starting Plymouth..." + run mkdir -p -m 0755 /run/plymouth || return 1 + + # Make sure that udev is done loading tty and drm + run udevadm trigger --action=add --attr-match=class=0x03 >/dev/null 2>&1 + run udevadm trigger --action=add --subsystem-match=graphics \ + --subsystem-match=drm --subsystem-match=tty >/dev/null 2>&1 + udevsettle + + run plymouthd --mode=boot --attach-to-session \ + --pid-file=/run/plymouth/pid + if [ $? -ne 0 ] + then + bad_msg "Can't start plymouthd!" + PLYMOUTH=0 + return 1 + fi + + plymouthRun --show-splash + if [ $? -eq 0 ] + then + good_msg "Plymouth initialized" + fi } start_volumes() { @@ -1825,6 +1900,7 @@ openLUKS() { eval local LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' eval local LUKS_KEYDEV_FSTYPE='"${CRYPT_'${TYPE}'_KEYDEV_FSTYPE}"' eval local OPENED_LOCKFILE='"${CRYPT_'${TYPE}'_OPENED_LOCKFILE}"' + local ASK_PASS=0 local DEV_ERROR=0 local HEADER_ERROR=0 HEADERDEV_ERROR=0 local KEY_ERROR=0 KEYDEV_ERROR=0 @@ -2054,12 +2130,25 @@ openLUKS() { else [ -e /dev/tty ] && run mv /dev/tty /dev/tty.org run mknod /dev/tty c 5 1 +
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: 73a05632d61171685ac4960c6b684cefa6d82afd Author: Dmitry Baranov gmail com> AuthorDate: Wed Oct 14 19:03:01 2020 + Commit: Robin H. Johnson gentoo org> CommitDate: Sat Aug 7 17:20:10 2021 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=73a05632 Add support for LUKS detached header Signed-off-by: Dmitry Baranov gmail.com> defaults/initrd.scripts | 162 +++- defaults/linuxrc| 18 ++ doc/genkernel.8.txt | 22 +++ 3 files changed, 186 insertions(+), 16 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 33a48b3..5a83d93 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -306,7 +306,7 @@ bootstrapFS() { fi # Setup the filesystem nodes and directories - for i in ${CDROOT_PATH} /mnt/livecd /mnt/key /mnt/gentoo /tmp /tmp/.initrd /dev /proc /run /sys; do + for i in ${CDROOT_PATH} /mnt/header /mnt/livecd /mnt/key /mnt/gentoo /tmp /tmp/.initrd /dev /proc /run /sys; do run mkdir -p "${NEW_ROOT}${i}" run chmod 755 "${NEW_ROOT}${i}" done @@ -391,6 +391,14 @@ bootstrapCD() { fi } +bootstrapHeader() { + # $1 = ROOT/SWAP + local HEADERDEVS=$(devicelist) + eval local headerloc='"${CRYPT_'${1}'_HEADER}"' + + findmediamount "header" "${headerloc}" "CRYPT_${1}_HEADERDEV" "/mnt/header" ${HEADERDEVS} +} + bootstrapKey() { # $1 = ROOT/SWAP local KEYDEVS=$(devicelist) @@ -1828,12 +1836,17 @@ openLUKS() { local LUKS_NAME="${1}" eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"' + eval local LUKS_HEADER='"${CRYPT_'${TYPE}'_HEADER}"' + eval local LUKS_HEADERDEV='"${CRYPT_'${TYPE}'_HEADERDEV}"' + eval local LUKS_HEADERDEV_FSTYPE='"${CRYPT_'${TYPE}'_HEADERDEV_FSTYPE}"' eval local LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"' eval local LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' eval local LUKS_KEYDEV_FSTYPE='"${CRYPT_'${TYPE}'_KEYDEV_FSTYPE}"' eval local OPENED_LOCKFILE='"${CRYPT_'${TYPE}'_OPENED_LOCKFILE}"' - local DEV_ERROR=0 KEY_ERROR=0 KEYDEV_ERROR=0 - local mntkey="/mnt/key/" crypt_filter_ret= + local DEV_ERROR=0 + local HEADER_ERROR=0 HEADERDEV_ERROR=0 + local KEY_ERROR=0 KEYDEV_ERROR=0 + local mntheader="/mnt/header/" mntkey="/mnt/key/" crypt_filter_ret= if [ -z "${LUKS_DEVICE}" ] then @@ -1853,13 +1866,27 @@ openLUKS() { good_msg "The LUKS device ${LUKS_DEVICE} meanwhile was opened by someone else." break # if crypt_silent=1 and some error occurs, enter shell quietly - elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${DEV_ERROR} -eq 1 \) -o \( ${KEY_ERROR} -eq 1 \) \) -o \( ${KEYDEV_ERROR} -eq 1 \) \) ] + elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${DEV_ERROR} -eq 1 \) \) ] + then + run_emergency_shell + elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${HEADER_ERROR} -eq 1 \) \) -o \( ${HEADERDEV_ERROR} -eq 1 \) \) ] + then + run_emergency_shell + elif [ \( ${CRYPT_SILENT} -eq 1 \) -a \( \( \( ${KEY_ERROR} -eq 1 \) \) -o \( ${KEYDEV_ERROR} -eq 1 \) \) ] then run_emergency_shell elif [ ${DEV_ERROR} -eq 1 ] then prompt_user "LUKS_DEVICE" "${LUKS_NAME}" DEV_ERROR=0 + elif [ ${HEADER_ERROR} -eq 1 ] + then + prompt_user "LUKS_HEADER" "${LUKS_NAME} header" + HEADER_ERROR=0 + elif [ ${HEADERDEV_ERROR} -eq 1 ] + then + prompt_user "LUKS_HEADERDEV" "${LUKS_NAME} header device" + HEADERDEV_ERROR=0 elif [ ${KEY_ERROR} -eq 1 ] then prompt_user "LUKS_KEY" "${LUKS_NAME} key" @@ -1877,18 +1904,93 @@ openLUKS() { continue fi - if ! run cryptsetup isLuks ${LUKS_DEVICE} + # Handle headers + if [ -n "${LUKS_HEADER}" ] + then + local REAL_LUKS_HEADERDEV="${LUKS_HEADERDEV}" + if [ ! -e "${mntheader}${LUKS_HEADER}" ] + then + REAL_LUKS_HEADERDEV=$(find_real_device "${LUKS_HEADERDEV}") + if [ -b "${REAL_LUKS_HEADERDEV}" ] + then + good_msg "Using header device ${REAL_LUKS_HEADERDEV}." ${CRYPT_SILENT} + else +
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: 858e9bbef4421cd4a1f85a1b5eeb3ebd4f3dce8a Author: Thomas Deutschmann gentoo org> AuthorDate: Sat Mar 13 18:40:10 2021 + Commit: Thomas Deutschmann gentoo org> CommitDate: Sun Mar 14 19:33:54 2021 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=858e9bbe linuxrc: Drop "console" kernel argument handling It was never really used; Kernel's console handling already did the work. Signed-off-by: Thomas Deutschmann gentoo.org> defaults/linuxrc| 21 - doc/genkernel.8.txt | 4 2 files changed, 25 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index 28a504b..acb246c 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -178,12 +178,6 @@ do MLIST=$(echo ${MLIST} ${x#*=} | sed -e 's/^\ *//;s/,/ /g') export MLIST ;; - # Redirect output to a specific tty - CONSOLE=*|console=*) - NEW_CONSOLE=${x#*=} - NEW_CONSOLE=$(basename ${NEW_CONSOLE}) - NEW_CONSOLE=${NEW_CONSOLE%%,*} - ;; # /dev/md lvmraid=*) warn_msg "'${x}' kernel command-line argument is deprecated; Use 'dolvm' instead!" @@ -455,21 +449,6 @@ do esac done -if [ -n "${NEW_CONSOLE}" ] -then - # We cannot update console while processing CMDLINE because we - # are only interested in last console= value. - [ ! -c "${NEW_CONSOLE}" ] && NEW_CONSOLE="/dev/${NEW_CONSOLE}" - if [ -c "${NEW_CONSOLE}" ] - then - exec 0<>${NEW_CONSOLE} 1<>${NEW_CONSOLE} 2<>${NEW_CONSOLE} - good_msg "Console switched from '${CONSOLE}' to '${NEW_CONSOLE}'!" - CONSOLE="${NEW_CONSOLE}" - else - bad_msg "Unable to switch console: '${NEW_CONSOLE}' not found or not a character device!" - fi -fi - good_msg "${gk_ver} (${gk_build_date}). Linux kernel ${kernel_ver}" if [ "${GK_BOOTFONT_DISABLED}" = '0' -a -e /lib/console/font ] diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index d7afc07..b75f979 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -872,10 +872,6 @@ enabled. *nomodules*:: Enables/disables loading of modules in general. -*CONSOLE*=<...>:: -*console*=<...>:: -Override location of console, default is "/dev/console". - *part*[=<0,1>]:: *partitionable*:: Enable/Disable partitionable RAIDs (metadata 0.x) during auto-run.
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: a0a6d6313874a7567a26c405713aaf610695285d Author: Thomas Deutschmann gentoo org> AuthorDate: Sun Feb 7 18:02:29 2021 + Commit: Thomas Deutschmann gentoo org> CommitDate: Sun Feb 7 18:02:29 2021 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=a0a6d631 linuxrc: add kernel command-line argument to allow user to pass additional options to cryptsetup Cryptsetup supports additional options like "--perf-no_read_workqueue" or "--perf-no_write_workqueue". While it is recommended to use LUKS2 format and make these activiation flags permanent, you can also make use of the new kernel command-line arguments "crypt_root_options" for root device or "crypt_swap_options" for swap device to pass additional options to cryptsetup. These arguments can be specified multiple times or separate multiple options with a comma. Bug: https://bugs.gentoo.org/755587 Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.defaults | 2 ++ defaults/initrd.scripts | 16 +++- defaults/linuxrc | 13 - defaults/unlock-luks.sh | 8 +++- doc/genkernel.8.txt | 10 ++ 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index cd485ca..ac3b072 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -104,9 +104,11 @@ CRYPT_ENV_FILE='/etc/CRYPT_ENV.conf' CRYPT_ROOT_KEYDEV_FSTYPE='auto' CRYPT_ROOT_KEYFILE='/tmp/root.key' CRYPT_ROOT_OPENED_LOCKFILE='/tmp/ROOT.opened' +CRYPT_ROOT_OPTIONS='' CRYPT_SWAP_KEYDEV_FSTYPE='auto' CRYPT_SWAP_KEYFILE='/tmp/swap.key' CRYPT_SWAP_OPENED_LOCKFILE='/tmp/SWAP.opened' +CRYPT_SWAP_OPTIONS='' ZFS_ENC_ENV_FILE='/etc/ZFS_ENC_ENV.conf' ZFS_ENC_OPENED_LOCKFILE='/tmp/ZFS.opened' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index f6e84fc..5d744ee 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1193,7 +1193,7 @@ write_env_file() { for varname in $* do eval varvalue=\$${varname} - echo "${varname}=${varvalue}" >> "${env_file}" + echo "${varname}='${varvalue}'" >> "${env_file}" done } @@ -1774,15 +1774,13 @@ openLUKS() { eval local LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"' eval local LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' eval local LUKS_KEYDEV_FSTYPE='"${CRYPT_'${TYPE}'_KEYDEV_FSTYPE}"' - eval local LUKS_TRIM='"${CRYPT_'${TYPE}'_TRIM}"' + eval local cryptsetup_options='"${CRYPT_'${TYPE}'_OPTIONS}"' eval local OPENED_LOCKFILE='"${CRYPT_'${TYPE}'_OPENED_LOCKFILE}"' local DEV_ERROR=0 KEY_ERROR=0 KEYDEV_ERROR=0 local mntkey="/mnt/key/" crypt_filter_ret= while true do - local cryptsetup_options='' - local gpg_cmd="" if [ -e "${OPENED_LOCKFILE}" ] then @@ -1819,10 +1817,9 @@ openLUKS() { DEV_ERROR=1 continue else - if [ "x${LUKS_TRIM}" = "xyes" ] + if [ -n "${cryptsetup_options}" ] then - good_msg "Enabling TRIM support for ${LUKS_NAME} ..." ${CRYPT_SILENT} - cryptsetup_options="${cryptsetup_options} --allow-discards" + good_msg "Using the following cryptsetup options for ${LUKS_NAME}: ${cryptsetup_options}" ${CRYPT_SILENT} fi # Handle keys @@ -2333,9 +2330,10 @@ start_sshd() { write_env_file \ "${CRYPT_ENV_FILE}" \ CRYPT_ROOT \ - CRYPT_ROOT_TRIM \ + CRYPT_ROOT_OPTIONS \ CRYPT_SILENT \ - CRYPT_SWAP + CRYPT_SWAP \ + CRYPT_SWAP_OPTIONS run touch /var/log/lastlog diff --git a/defaults/linuxrc b/defaults/linuxrc index df0f570..e33576d 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -244,10 +244,16 @@ do CRYPT_ROOT=${x#*=} USE_CRYPTSETUP=1 ;; + crypt_root_options=*) + CRYPT_ROOT_OPTIONS=$(echo ${CRYPT_ROOT_OPTIONS} ${x#*=} | sed -e 's/,/ /g') + ;; crypt_swap=*) CRYPT_SWAP=${x#*=} USE_CRYPTSETUP=1 ;; + crypt_swap_options=*) + CRYPT_SWAP_OPTIONS=$(echo ${CRYPT_SWAP_OPTIONS} ${x#*=} | sed -e 's/,/ /g') + ;; root_key=*) CRYPT_ROOT_KEY=${x#*=} ;; @@ -258,7 +264,12 @@ do CRYPT_ROOT_KEYDEV_FSTYPE=${x#*=} ;; root_trim=*) -
[gentoo-commits] proj/genkernel:master commit in: /, defaults/, doc/
commit: 369cfa98f72675a285ec98439e9054ab57b234c9 Author: Thomas Deutschmann gentoo org> AuthorDate: Fri Sep 11 20:01:37 2020 + Commit: Thomas Deutschmann gentoo org> CommitDate: Fri Sep 11 20:03:24 2020 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=369cfa98 Remove "dobtrfs" kernel command-line argument This is no longer necessary with the switch to UDEV. Bug: https://bugs.gentoo.org/739892 Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.scripts | 32 defaults/linuxrc| 6 -- doc/genkernel.8.txt | 3 --- genkernel | 1 - 4 files changed, 42 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 5181d6c..f6e84fc 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -75,7 +75,6 @@ modules_scan() { elif [ "${USE_MDADM}" = '1' ] \ || [ "${USE_LVM_NORMAL}" = '1' ] \ || [ "${USE_CRYPTSETUP}" = '1' ] \ - || [ "${USE_BTRFS}" = '1' ] \ || [ "${USE_ZFS}" = '1' ] \ || [ "${USE_DMRAID_NORMAL}" = '1' ] then @@ -1612,25 +1611,6 @@ start_volumes() { fi fi - if [ "${USE_BTRFS}" = '1' ] - then - if ! hash btrfs >/dev/null 2>&1 - then - bad_msg "dobtrfs invoked but 'btrfs' not found; Skipping btrfs device scanning ..." - else - good_msg "Scanning for BTRFS devices ..." - - local btrfs_cmd="run btrfs device scan 2>&1" - is_log_enabled && btrfs_cmd="${btrfs_cmd} | tee -a '${GK_INIT_LOG}'" - - eval "${btrfs_cmd}" - if [ $? -ne 0 ] - then - bad_msg "Scanning for BTRFS devices failed!" - fi - fi - fi - if [ "${USE_ZFS}" = '1' ] then # Avoid race involving asynchronous module loading @@ -2510,18 +2490,6 @@ cdupdate() { fi } -setup_btrfsctl() { - # start BTRFS volume detection, if available - if hash btrfsctl >/dev/null 2>&1 - then - local btrfs_cmd="run btrfsctl -a 2>&1" - is_log_enabled && btrfs_cmd="${btrfs_cmd} | tee -a '${GK_INIT_LOG}'" - - eval "${btrfs_cmd}" - udevsettle - fi -} - rundebugshell() { if is_debug then diff --git a/defaults/linuxrc b/defaults/linuxrc index 6d07d9b..df0f570 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -151,9 +151,6 @@ do ;; esac ;; - dobtrfs) - USE_BTRFS=1 - ;; quiet|quiet_genkernel) QUIET=1 ;; @@ -615,9 +612,6 @@ fi # Apply scan delay if specified sdelay -# Setup btrfs, see bug 303529 -setup_btrfsctl - # Scan volumes start_volumes diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 5d7b74d..8909fc7 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -775,9 +775,6 @@ when not set. This will allow remote user to provide answer through Scan for bootable ZFS pools on bootup. Optionally use cachefile or force import if necessary or perform both actions. -*dobtrfs*:: -Scan for attached Btrfs devices on bootup. - *domultipath*:: Activate Multipath on bootup. diff --git a/genkernel b/genkernel index 595c6ea..6ec8905 100755 --- a/genkernel +++ b/genkernel @@ -485,7 +485,6 @@ then print_warning 1 "${BOLD}WARNING... WARNING... WARNING...${NORMAL}" print_warning 1 'Additional kernel parameters that *may* be required to boot properly:' isTrue "${SPLASH}"&& print_warning 1 "- Add \"vga=791 splash=silent,theme:${SPLASH_THEME} console=tty1 quiet\" if you use a splash framebuffer ]" - isTrue "${BTRFS}" && print_warning 1 '- Add "dobtrfs" for Btrfs device scanning support' isTrue "${MULTIPATH}" && print_warning 1 '- Add "domultipath" for multipath support' isTrue "${ISCSI}" && print_warning 1 '- For iSCSI support, add at least:' isTrue "${ISCSI}" && print_warning 1 ' - "iscsi_initiatorname="'
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: 97b3a9235fdba36bfc6197baf1f47fd472fb74b6 Author: Thomas Deutschmann gentoo org> AuthorDate: Wed Sep 2 13:13:40 2020 + Commit: Thomas Deutschmann gentoo org> CommitDate: Wed Sep 2 13:13:40 2020 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=97b3a923 defaults/initrd.scripts: openLUKS(): Trigger module loading when mounting {root,swap}_keydev We need to do the same we do for rootfs since commit 05f968fda2c6839744b36c442b3feaa6de974e63 also for {root,swap}_keydev. Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.defaults | 2 ++ defaults/initrd.scripts | 15 +++ defaults/linuxrc | 6 ++ doc/genkernel.8.txt | 6 ++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index cf7406d..cd485ca 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -101,8 +101,10 @@ GK_UDEV_TIMEOUT=120 GK_USERINTERACTION_DISABLED_STATEFILE='/tmp/user-interaction.disabled' CRYPT_ENV_FILE='/etc/CRYPT_ENV.conf' +CRYPT_ROOT_KEYDEV_FSTYPE='auto' CRYPT_ROOT_KEYFILE='/tmp/root.key' CRYPT_ROOT_OPENED_LOCKFILE='/tmp/ROOT.opened' +CRYPT_SWAP_KEYDEV_FSTYPE='auto' CRYPT_SWAP_KEYFILE='/tmp/swap.key' CRYPT_SWAP_OPENED_LOCKFILE='/tmp/SWAP.opened' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 7a84755..5181d6c 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1780,7 +1780,7 @@ openLUKS() { exit 1 fi - case $1 in + case ${1} in root) local TYPE=ROOT ;; @@ -1789,8 +1789,12 @@ openLUKS() { ;; esac - eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"' LUKS_NAME="$1" LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"' - eval local LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' LUKS_TRIM='"${CRYPT_'${TYPE}'_TRIM}"' + local LUKS_NAME="${1}" + eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"' + eval local LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"' + eval local LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' + eval local LUKS_KEYDEV_FSTYPE='"${CRYPT_'${TYPE}'_KEYDEV_FSTYPE}"' + eval local LUKS_TRIM='"${CRYPT_'${TYPE}'_TRIM}"' eval local OPENED_LOCKFILE='"${CRYPT_'${TYPE}'_OPENED_LOCKFILE}"' local DEV_ERROR=0 KEY_ERROR=0 KEYDEV_ERROR=0 local mntkey="/mnt/key/" crypt_filter_ret= @@ -1886,7 +1890,10 @@ openLUKS() { # At this point a device was recognized, now let's see if the key is there [ ! -d "${mntkey}" ] && mkdir -p "${mntkey}" >/dev/null 2>&1 - if ! run mount -n -o ro ${REAL_LUKS_KEYDEV} ${mntkey} >/dev/null 2>&1 + # determine fs -- 'auto' will not trigger module loading! + LUKS_KEYDEV_FSTYPE=$(determine_fs "${REAL_LUKS_KEYDEV}" "${LUKS_KEYDEV_FSTYPE}") + + if ! run mount -n -t ${LUKS_KEYDEV_FSTYPE} -o ro ${REAL_LUKS_KEYDEV} ${mntkey} >/dev/null 2>&1 then KEYDEV_ERROR=1 bad_msg "Mounting of device ${REAL_LUKS_KEYDEV} failed." ${CRYPT_SILENT} diff --git a/defaults/linuxrc b/defaults/linuxrc index bab54e1..6d07d9b 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -257,6 +257,9 @@ do root_keydev=*) CRYPT_ROOT_KEYDEV=${x#*=} ;; + root_keydev_fstype=*) + CRYPT_ROOT_KEYDEV_FSTYPE=${x#*=} + ;; root_trim=*) CRYPT_ROOT_TRIM=${x#*=} ;; @@ -266,6 +269,9 @@ do swap_keydev=*) CRYPT_SWAP_KEYDEV=${x#*=} ;; + swap_keydev_fstype=*) + CRYPT_SWAP_KEYDEV_FSTYPE=${x#*=} + ;; real_resume=*|resume=*) REAL_RESUME=${x#*=} ;; diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 7ce7391..5d7b74d 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -646,6 +646,9 @@ recognized by the kernel itself. root_key. If unset while using root_key, it will automatically look for the device in every boot. +*root_keydev_fstype*=<...>:: +Used filesystem for *root_keydev*. See *rootfstype* for more details. + *root_trim*=(yes|no):: Enables TRIM support for a LUKS-based root device. Only useful with SSD setups. Have a look at 'https://en.wikipedia.org/wiki/TRIM' @@ -657,6 +660,9 @@ recognized by the kernel itself. *swap_keydev*=<...>:: Same as root_keydev for swap.
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: 8cca1dada7be5625cbdbcf4e8ab14c51d131e099 Author: Thomas Deutschmann gentoo org> AuthorDate: Fri Aug 28 13:28:33 2020 + Commit: Thomas Deutschmann gentoo org> CommitDate: Fri Aug 28 16:35:59 2020 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=8cca1dad defaults/linuxrc: Add gk.udev.debug to run udevd in debug mode When gk.udev.debug=yes is set (boolean option), udevd will run in debug mode. Output will be written to /run/initramfs/udevd.log. Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.defaults | 1 + defaults/linuxrc | 10 +- doc/genkernel.8.txt | 4 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index fa71ecb..b665355 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -96,6 +96,7 @@ GK_SSHD_PIDFILE='/var/run/dropbear.pid' GK_SSHD_PORT=22 GK_SSHD_WAIT= GK_UDEV_LOG='/run/initramfs/udevd.log' +GK_UDEV_DEBUG=0 GK_UDEV_TIMEOUT=120 GK_USERINTERACTION_DISABLED_STATEFILE='/tmp/user-interaction.disabled' diff --git a/defaults/linuxrc b/defaults/linuxrc index 1a4ddac..b42366f 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -332,6 +332,14 @@ do fi unset tmp_wait ;; + gk.udev.debug=*) + tmp_enabled=${x#*=} + if is_true "${tmp_enabled}" + then + GK_UDEV_DEBUG=1 + fi + unset tmp_enabled + ;; gk.udev.timeout=*) tmp_timeout=${x#*=} if is_int "${tmp_timeout}" @@ -566,7 +574,7 @@ fi good_msg 'Activating udev ...' udevd_cmd="run udevd --resolve-names=never" -if is_debug +if [ "${GK_UDEV_DEBUG}" = '1' ] then udevd_cmd="${udevd_cmd} --debug > ${GK_UDEV_LOG} 2>&1 &" else diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index d8b9e09..7b96879 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -721,6 +721,10 @@ recognized by the kernel itself. *gk.net.timeout.interface*=<...>:: By default we will wait up to 10 seconds for interface to show up. +*gk.udev.debug*=<...>:: +This boolean option allows you to run udevd in debug mode. Output +will be logged to '/run/initramfs/udevd.log'. + *gk.udev.timeout*=<...>:: By default we will wait up to 120 seconds (UDEV default) for UDEV event queue to become empty.
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: 809f1f547f0ba8bfa38bbd0977ab2c57ec4c4581 Author: Thomas Deutschmann gentoo org> AuthorDate: Wed Aug 26 21:35:52 2020 + Commit: Thomas Deutschmann gentoo org> CommitDate: Wed Aug 26 21:46:37 2020 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=809f1f54 defaults/linuxrc: Disable processing of modules_load file by default Now that we are using (e)udev with kmod support, we can rely on UDEV to load required kernel modules. Old module loading based on modules_load file can still be enabled via boolean "gk.hw.use-modules_load" kernel command-line option which is inverting and replacing previous "nodetect" kernel command-line option. Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.defaults | 1 + defaults/initrd.scripts | 11 +++ defaults/linuxrc | 26 ++ doc/genkernel.8.txt | 17 +++-- 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 3ac5856..e4c861b 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -73,6 +73,7 @@ IP='dhcp' GK_BOOTFONT_DISABLED=0 GK_DEBUGMODE_STATEFILE="/tmp/debug.enabled" GK_HW_LOAD_ALL_MODULES=0 +GK_HW_USE_MODULES_LOAD=0 GK_INIT_LOG='/tmp/init.log' GK_INIT_LOG_COPYTO= GK_INIT_LOG_COPYTO_DEFAULT='/genkernel-boot.log' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index fd87623..29ec123 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -2019,10 +2019,13 @@ iface_name() { start_network() { good_msg "Starting network ..." - # Load network modules only when we need them to avoid possible - # firmware problems for people not using network that early - modules_scan net - udevsettle + if [ "${GK_HW_USE_MODULES_LOAD}" = '1' ] + then + # Load network modules only when we need them to avoid possible + # firmware problems for people not using network that early + modules_scan net + udevsettle + fi # At least gk.net.iface can only be processed after sysfs was # mounted. diff --git a/defaults/linuxrc b/defaults/linuxrc index 9793fde..263f738 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -175,9 +175,6 @@ do doload=*) MDOLIST=$(echo ${MDOLIST} ${x#*=} | sed -e 's/^\ *//;s/,/ /g') ;; - nodetect) - NODETECT=1 - ;; noload=*) MLIST=$(echo ${MLIST} ${x#*=} | sed -e 's/^\ *//;s/,/ /g') export MLIST @@ -291,6 +288,14 @@ do fi unset tmp_disabled ;; + gk.hw.use-modules_load=*) + tmp_disabled=${x#*=} + if is_true "${tmp_disabled}" + then + GK_HW_USE_MODULES_LOAD=1 + fi + unset tmp_disabled + ;; gk.log.disabled=*) tmp_disabled=${x#*=} if is_true "${tmp_disabled}" @@ -542,26 +547,31 @@ fi # Load modules listed in MY_HWOPTS if /lib/modules exists for the running kernel if [ -z "${DO_modules}" ] then - good_msg 'Skipping module load; disabled via commandline' + good_msg 'Skipping module load; disabled via command-line' elif [ -d "/lib/modules/${KV}" ] then - good_msg 'Loading modules ...' if [ -n "${FIRSTMODS}" ] then + good_msg 'Loading first modules ...' # try these modules first -- detected modules for root device: modules_load firstmods ${FIRSTMODS} fi # Load appropriate kernel modules - if [ "${NODETECT}" != '1' ] + if [ "${GK_HW_USE_MODULES_LOAD}" = '1' ] then + good_msg 'Loading modules ...' for modules in ${MY_HWOPTS} do modules_scan ${modules} done fi - # Always eval doload=... - modules_load extra_load ${MDOLIST} + + if [ -n "${MDOLIST}" ] + then + good_msg 'Loading modules from command-line ...' + modules_load extra_load ${MDOLIST} + fi else good_msg 'Skipping module load; no modules in the ramdisk!' fi diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 8c527b0..f0e4414 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -823,6 +823,12 @@ when not set. This will allow remote user to provide answer through loading of all module groups regardless whether root device is already available. +*gk.hw.use-modules_load*=<...>:: +By default, genkernel relies on UDEV's capability to load required +kernel modules. This boolean option
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: 1a68a5349bb423ddff5ec56ea733631621eba862 Author: Thomas Deutschmann gentoo org> AuthorDate: Thu Jul 16 18:22:57 2020 + Commit: Thomas Deutschmann gentoo org> CommitDate: Thu Jul 16 18:34:28 2020 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=1a68a534 linuxrc: Add gk.userinteraction.disabled When this option is set and enabled, genkernel initramfs will not prompt on errors, i.e. this will disable any user interaction, e.g. for a kiosk system. Bug: https://bugs.gentoo.org/730966 Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.defaults | 1 + defaults/initrd.scripts | 52 defaults/linuxrc | 8 doc/genkernel.8.txt | 8 4 files changed, 69 insertions(+) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 15326dd..79d7322 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -96,6 +96,7 @@ GK_SSHD_LOCKFILE='/tmp/remote-rescueshell.lock' GK_SSHD_PIDFILE='/var/run/dropbear.pid' GK_SSHD_PORT=22 GK_SSHD_WAIT= +GK_USERINTERACTION_DISABLED_STATEFILE='/tmp/user-interaction.disabled' CRYPT_ENV_FILE='/etc/CRYPT_ENV.conf' CRYPT_KEYFILE_ROOT='/tmp/root.key' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index d5378b7..6dc588f 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -959,6 +959,12 @@ run() { } run_shell() { + if [ -f "${GK_USERINTERACTION_DISABLED_STATEFILE}" ] + then + bad_msg "gk.userinteraction.disabled is set; Spawning a shell is disabled!" + return + fi + [ -x /bin/sh ] && SH=/bin/sh || SH=/bin/ash run touch "${GK_SHELL_LOCKFILE}" @@ -1114,6 +1120,15 @@ warn_msg() { [ "$2" != '1' ] && printf "%b\n" "${WARN}**${NORMAL}${BOLD} ${msg_string} ${NORMAL}" } +warn_msg_n() { + local msg_string=${1} + msg_string="${msg_string:-...}" + + log_msg "[**] ${msg_string}" + + [ "$2" != '1' ] && printf "%b" "${WARN}**${NORMAL}${BOLD} ${msg_string}" +} + write_env_file() { local env_file=${1} shift @@ -1233,6 +1248,43 @@ prompt_user() { [ -n "${3}" ] && local explnt=" or : ${3}" || local explnt="." bad_msg "Could not find the ${2} in ${oldvalue}${explnt}" + + if [ -f "${GK_USERINTERACTION_DISABLED_STATEFILE}" ] + then + bad_msg "gk.userinteraction.disabled is set; No user interaction allowed!" + + wait_sshd + + if [ -f "${GK_SSHD_LOCKFILE}" ] + then + warn_msg "The lockfile at '${GK_SSHD_LOCKFILE}' exists." + warn_msg "The boot process will be paused until the lock is removed." + while true + do + if [ -f "${GK_SSHD_LOCKFILE}" ] + then + sleep 1 + else + break + fi + done + fi + + local timeout=${GK_PROMPT_TIMEOUT} + [ ${timeout} -eq 0 ] && timeout=10 + + warn_msg_n "System will automatically reboot in ${timeout} seconds ..." + while [ ${timeout} -gt 0 ] + do + let timeout=${timeout}-1 + sleep 1 + printf "." + done + echo + + reboot -f + fi + bad_msg "Please specify another value or:" bad_msg "- press Enter for the same" bad_msg '- type "shell" for a shell' diff --git a/defaults/linuxrc b/defaults/linuxrc index 682f647..5354d09 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -356,6 +356,14 @@ do fi unset tmp_wait ;; + gk.userinteraction.disabled=*) + tmp_disabled=${x#*=} + if is_true "${tmp_disabled}" + then + touch "${GK_USERINTERACTION_DISABLED_STATEFILE}" + fi + unset tmp_disabled + ;; gk.prompt.timeout=*) tmp_timeout=${x#*=} if is_int "${tmp_timeout}" diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 5b15a02..f84892c 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -835,6 +835,14 @@ genkernel's initramfs will only mount root filesystem by default. If you want to store the log file in '/var/log/genkernel-boot.log' for example make sure that this mountpoint is accessible, see *initramfs.mounts*. +*gk.userinteraction.disabled*=<...>:: +By default, genkernel will prompt on errors. In case this is not wanted +or desired, e.g. for a kiosk
[gentoo-commits] proj/genkernel:master commit in: defaults/, /, doc/
commit: 80e3a6086c92e30101f772170c4b056f1ff4c81c Author: Thomas Deutschmann gentoo org> AuthorDate: Wed Jul 15 22:05:53 2020 + Commit: Thomas Deutschmann gentoo org> CommitDate: Thu Jul 16 14:29:17 2020 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=80e3a608 Add ZSTD compression support for initramfs Bug: https://bugs.gentoo.org/731294 Signed-off-by: Thomas Deutschmann gentoo.org> defaults/compression_methods.sh | 5 + doc/genkernel.8.txt | 3 ++- gen_cmdline.sh | 2 +- gen_funcs.sh| 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/defaults/compression_methods.sh b/defaults/compression_methods.sh index 41ee9c4..b65f057 100644 --- a/defaults/compression_methods.sh +++ b/defaults/compression_methods.sh @@ -35,3 +35,8 @@ GKICM_XZ_KOPTNAME="XZ" GKICM_XZ_CMD="xz -e --check=none -z -f -9" GKICM_XZ_EXT=".xz" GKICM_XZ_PKG="app-arch/xz-utils" + +GKICM_ZSTD_KOPTNAME="ZSTD" +GKICM_ZSTD_CMD="zstd -f -19 -q" +GKICM_ZSTD_EXT=".zst" +GKICM_ZSTD_PKG="app-arch/zstd" diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 40c591e..5b15a02 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -598,7 +598,8 @@ NOTE: System.map filename and System.map symlink name must be different. Deprecated alias for *--*[*no-*]*compress-initramfs*. *--compress-initramfs-type*=:: -Compression type for initramfs (best, bzip2, fastest, gzip, lz4, lzma, lza, xz). +Compression type for initramfs (best, bzip2, fastest, gzip, lz4, lzma, +lza, xz, zstd). + *best* will select the algorithm providing best compression from those selected in your kernel configuration. diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 1daee5c..5e667bd 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -244,7 +244,7 @@ longusage() { echo " --no-compress-initrdDeprecated alias for --no-compress-initramfs" echo " --compress-initramfs-type=" echo " Compression type for initramfs (best, bzip2, fastest, gzip, lz4," - echo " lzma, lza, xz)" + echo " lzma, lza, xz, zstd)" echo " --strip=(all|kernel|modules|none)" echo " Strip debug symbols from none, all, installed kernel (obsolete) or" echo " modules (default)" diff --git a/gen_funcs.sh b/gen_funcs.sh index 69e7242..a58fbbb 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -468,6 +468,7 @@ get_initramfs_compression_method_by_compression() { local -a methods=() methods+=( XZ ) methods+=( LZMA ) + methods+=( ZSTD ) methods+=( GZIP ) methods+=( BZIP2 ) methods+=( LZO ) @@ -479,6 +480,7 @@ get_initramfs_compression_method_by_compression() { get_initramfs_compression_method_by_speed() { local -a methods=() methods+=( LZ4 ) + methods+=( ZSTD ) methods+=( LZO ) methods+=( GZIP ) methods+=( BZIP2 )
[gentoo-commits] proj/genkernel:master commit in: /, defaults/, doc/
commit: da5a5fa797a5fffa6c4d694cbfe2edc83bab4890 Author: Thomas Deutschmann gentoo org> AuthorDate: Fri Jan 10 17:10:08 2020 + Commit: Thomas Deutschmann gentoo org> CommitDate: Sat Jan 11 19:54:40 2020 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=da5a5fa7 --module-rebuild: Call emerge with --ignore-default-opts It's possible that user has set conflicting emerge options like "--ask" in EMERGE_DEFAULT_OPTS which could break genkernel. Calling emerge with --ignore-default-opts will allow us to avoid such scenarios. In addition, --module-rebuild-cmd (MODULEREBUILD_CMD) option was added to allow user to alter default command. Closes: https://bugs.gentoo.org/705082 Signed-off-by: Thomas Deutschmann gentoo.org> defaults/config.sh | 2 ++ doc/genkernel.8.txt | 15 +++ gen_cmdline.sh | 6 ++ gen_compile.sh | 18 -- gen_determineargs.sh | 12 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/defaults/config.sh b/defaults/config.sh index d9ea32c..678c0f9 100644 --- a/defaults/config.sh +++ b/defaults/config.sh @@ -34,6 +34,8 @@ DEFAULT_COMPRESS_INITRD_TYPE=best PORTAGE_MAKEOPTS="$(portageq envvar MAKEOPTS)" DEFAULT_MAKEOPTS="${PORTAGE_MAKEOPTS:- -j2}" +DEFAULT_MODULEREBUILD_CMD="emerge --ignore-default-opts --quiet @module-rebuild" + DEFAULT_KERNEL_MAKE=make DEFAULT_UTILS_MAKE=make diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 6c4c155..e9076a4 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -196,10 +196,17 @@ specified. Copies or does not copy all kernel modules to the initrd. *--*[*no-*]*module-rebuild*:: -Runs, or does not run "emerge @module-rebuild" to build out-of-tree -modules when possible, i.e. when non-static kernel and modules will be -build, installed, no custom INSTALL_MOD_PATH is set, -'/var/lib/module-rebuild/moduledb' exists and is not empty. +Runs, or does not run "emerge --ignore-default-opts --quiet @module-rebuild" +to build out-of-tree modules when possible, i.e. when non-static +kernel and modules will be build, installed, no custom +'INSTALL_MOD_PATH' is set, '/var/lib/module-rebuild/moduledb' exists +and is not empty. + +NOTE: Command can be customized using '--module-rebuild-cmd' command-line +argument or 'MODULEREBUILD_CMD' in '/etc/genkernel.conf'. + +*--module-rebuild-cmd*=<...>:: +Overwrite default *--module-rebuild* command. *--callback*=<...>:: Run the specified arguments in the current environment after the diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 025187f..db9c1f8 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -65,6 +65,8 @@ longusage() { echo " --module-rebuildAutomatically run 'emerge @module-rebuild' when" echo " necessary (and possible)" echo " --no-module-rebuild Don't automatically run 'emerge @module-rebuild'" + echo " --module-rebuild-cmd=<...>" + echo " Overwrite default --module-rebuild command" echo " --callback=<...>Run the specified arguments after the" echo " kernel and modules have been compiled" echo " --staticBuild a static (monolithic kernel)" @@ -606,6 +608,10 @@ parse_cmdline() { CMD_MODULEREBUILD=$(parse_optbool "$*") print_info 3 "CMD_MODULEREBUILD: ${CMD_MODULEREBUILD}" ;; + --module-rebuild-cmd=*) + CMD_MODULEREBUILD_CMD="${*#--module-rebuild-cmd=}" + print_info 3 "CMD_MODULEREBUILD_CMD: ${CMD_MODULEREBUILD_CMD}" + ;; --callback=*) CMD_CALLBACK="${*#*=}" print_info 3 "CMD_CALLBACK: ${CMD_CALLBACK}/$*" diff --git a/gen_compile.sh b/gen_compile.sh index 3f10adb..3b96f48 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -2,53 +2,51 @@ # $Id$ compile_external_modules() { - local command="emerge --quiet @module-rebuild 2>&1" - if ! isTrue "${CMD_MODULEREBUILD}" then - print_info 3 "$(get_indent 1)>> --no-module-rebuild set; Skipping 'emerge @module-rebuild' ..." + print_info 3 "$(get_indent 1)>> --no-module-rebuild set; Skipping '${MODULEREBUILD_CMD}' ..." return fi if isTrue "$(tc-is-cross-compiler)" then - print_info 3 "$(get_indent 1)>> Cross-compilation detected; Skipping 'emerge @module-rebuild' ..." + print_info 3 "$(get_indent 1)>> Cross-compilation detected; Skipping '${MODULEREBUILD_CMD}' ..." return fi if ! isTrue "${CMD_INSTALL}" then - print_info 3 "$(get_indent 1)>> --no-install set; Skipping 'emerge @module-rebuild' ..." +
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: eccc25ea093340a4e3ba662ed8d9e858800cd134 Author: Thomas Deutschmann gentoo org> AuthorDate: Wed Nov 20 00:23:45 2019 + Commit: Thomas Deutschmann gentoo org> CommitDate: Sun Nov 24 19:59:15 2019 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=eccc25ea initrd.scripts: modules_load() refactored - Add support for LABEL/UUID in root kernel parameter - When loading network, always load all network modules even when root block device is already available - Always load crypto and USB module group when CRYPT_{ROOT,SWAP} is set. - Always load fs module group. - Add gk.hw.load-all kernel command-line argument to allow user to force loading of all module groups. Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.defaults | 1 + defaults/initrd.scripts | 43 --- defaults/linuxrc | 8 doc/genkernel.8.txt | 7 +++ 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 8937e65..32f99ec 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -72,6 +72,7 @@ VERIFY=0 IP='dhcp' GK_BOOTFONT_DISABLED=0 GK_DEBUGMODE_STATEFILE="/tmp/debug.enabled" +GK_HW_LOAD_ALL_MODULES=0 GK_INIT_LOG='/tmp/init.log' GK_INIT_LOG_COPYTO= GK_INIT_LOG_COPYTO_DEFAULT='/genkernel-boot.log' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 1004ff5..053ac68 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -29,6 +29,37 @@ modules_load() { modules_scan() { local MODS local loaded + local smart_loading=yes + local _root_dev + local root_dev_found="Root block device found, skipping loading of module group \"${1}\" ..." + + if [ "${GK_HW_LOAD_ALL_MODULES}" = '1' ] + then + smart_loading= + elif [ "${1}" = "net" ] + then + # We already load network modules only when we need + # network so don't stop loading network modules when + # $REAL_ROOT is already present or we will probably + # end up without network we wanted ... + smart_loading= + elif [ "${1}" = "fs" ] + then + # We don't know if kernel supports root filesystem so + # better load all filesystems ... + smart_loading= + elif [ -n "${CRYPT_ROOT}" ] || [ -n "${CRYPT_SWAP}" ] + then + if [ "${1}" = "crypto" ] + then + smart_loading= + elif [ "${1}" = "usb" ] + then + # We don't know if user is using an USB keyboard to + # enter passphrase so better load USB ... + smart_loading= + fi + fi MODS=$(cat /etc/modules/${1} 2>/dev/null) [ -n "${MODS}" ] && [ -z "${QUIET}" ] && \ @@ -54,10 +85,16 @@ modules_scan() { printf "%b\n" "${BOLD} ::${NORMAL} Skipping ${x} ..." elif [ "${MLOAD}" = "${MLIST}" ] then - if [ "${ROOTFSTYPE}" != 'auto' ] && [ -b "${REAL_ROOT}" ] + if [ -n "${smart_loading}" ] then - echo "Root block device found, continuing ..." - break + _root_dev=$(findfs "${REAL_ROOT}" 2>/dev/null) + + if [ $? -eq 0 ] && [ -n "${_root_dev}" ] && [ -b "${_root_dev}" ] + then + log_msg "${root_dev_found}" + printf "%b" "${root_dev_found}" + break + fi fi if is_debug diff --git a/defaults/linuxrc b/defaults/linuxrc index ee46293..f01203b 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -283,6 +283,14 @@ do fi unset tmp_disabled ;; + gk.hw.load-all=*) + tmp_disabled=${x#*=} + if is_true "${tmp_disabled}" + then + GK_HW_LOAD_ALL_MODULES=1 + fi + unset tmp_disabled + ;; gk.log.disabled=*) tmp_disabled=${x#*=} if is_true "${tmp_disabled}" diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index bee3017..cb2009f 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -787,6 +787,13 @@ when not set. This will allow remote user to provide answer through will load that font. This boolean option allows you to disable loading of the user embedded bootfont.
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: 1d79338fa7391f8bc41bb74411c9a955e24d81cd Author: Thomas Deutschmann gentoo org> AuthorDate: Tue Aug 6 18:04:20 2019 + Commit: Thomas Deutschmann gentoo org> CommitDate: Wed Aug 7 15:03:44 2019 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=1d79338f initrd.scripts: prompt_user(): Read answer from $GK_PROMPT_FILE on timeout This commit will bring back read timeout which was removed in Commit a280829. Read timeout is still disabled by default but can now be controlled via gk.prompt.timeout kernel command-line argument. When gk.prompt.timeout is != 0, the current prompt will be written to $GK_PROMPT_FILE. This will allow remote user to notice that there's a prompt. In addition, on timeout, $GK_PROMPT_FILE will be read allowing remote user to answer prompt and hopefully to fix the problem and resume booting. To make this work, gk.prompt.timeout will be set to 30 seconds by default when SSH usage is enabled. Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.defaults | 2 ++ defaults/initrd.scripts | 36 ++-- defaults/linuxrc | 10 ++ doc/genkernel.8.txt | 9 + 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 553600d..06057d7 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -85,6 +85,8 @@ GK_NET_TIMEOUT_DAD=10 GK_NET_TIMEOUT_DECONFIGURATION=10 GK_NET_TIMEOUT_DHCP=10 GK_NET_TIMEOUT_INTERFACE=10 +GK_PROMPT_FILE='/tmp/current_prompt' +GK_PROMPT_TIMEOUT=0 GK_SHELL_LOCKFILE='/tmp/rescueshell.lock' GK_SSHD_LOCKFILE='/tmp/remote-rescueshell.lock' GK_SSHD_PIDFILE='/var/run/dropbear.pid' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 68adfb9..88046b4 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -1108,12 +1108,30 @@ prompt_user() { bad_msg '- type "shell" for a shell' bad_msg '- type "q" to skip ...' printf "%s" "${2}(${oldvalue}) :: " - read ${1} - #if [ $? -gt 0 ] - #then - # # prompt timed out - # printf "\n" - #fi + + if [ "${GK_PROMPT_TIMEOUT}" = '0' ] + then + read ${1} + else + local read_timeout_timestamp + let read_timeout_timestamp=$(date +%s)+${GK_PROMPT_TIMEOUT} + + echo "# Could not find the ${2} in ${oldvalue}${explnt}" > "${GK_PROMPT_FILE}" + echo "# Please specify another value (file will be processed at $(date -d @${read_timeout_timestamp}):" >> "${GK_PROMPT_FILE}" + echo "${1}=${oldvalue}" >> "${GK_PROMPT_FILE}" + read -t ${GK_PROMPT_TIMEOUT} ${1} + if [ $? -gt 0 ] + then + # prompt timed out + printf "\n" + + if [ -f "${GK_PROMPT_FILE}" ] + then + warn_msg "Timeout! Trying to read answer from '${GK_PROMPT_FILE}' ..." + . "${GK_PROMPT_FILE}" && run rm "${GK_PROMPT_FILE}" + fi + fi + fi case $(eval echo '$'${1}) in 'q') @@ -2145,6 +2163,12 @@ start_sshd() { return fi + if [ "${GK_PROMPT_TIMEOUT}" = '0' ] + then + warn_msg "Changing gk.prompt.timeout=0 to 30 ..." + GK_PROMPT_TIMEOUT=30 + fi + if [ ! -x "/usr/sbin/dropbear" ] then bad_msg "/usr/sbin/dropbear not found! Did you call genkernel with --ssh parameter?" diff --git a/defaults/linuxrc b/defaults/linuxrc index b2ac54e..a57de1c 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -336,6 +336,16 @@ do fi unset tmp_wait ;; + gk.prompt.timeout=*) + tmp_timeout=${x#*=} + if is_int "${tmp_timeout}" + then + GK_PROMPT_TIMEOUT=${tmp_timeout} + else + warn_msg "'${x}' does not look like a valid time (second) value -- ignored!" + fi + unset tmp_timeout + ;; real_rootflags=*) REAL_ROOTFLAGS=${x#*=} ;; diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 3ab28ce..3ebd320 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -687,6 +687,15 @@ recognized by the kernel itself. *gk.net.timeout.interface*=<...>:: By default we will wait up to 10 seconds for interface to show up. +*gk.prompt.timeout*=<...>:: +By default a prompt within genkernel initramfs like shown when set +*root* could not be found will never timeout. Use this option to set +a timeout. + +NOTE: When *dosshd* is used,
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: e7735c6b2e2cbfb44ce550fa8e7f4359ab5f073c Author: Thomas Deutschmann gentoo org> AuthorDate: Tue Aug 6 17:45:19 2019 + Commit: Thomas Deutschmann gentoo org> CommitDate: Wed Aug 7 15:03:40 2019 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=e7735c6b linuxrc: Log initramfs output/commands By default, any {bad,good,warn}_msg output and external command calls will now be logged to /tmp/init.log in initramfs. This can be turned off via gk.log.disabled={1,yes} kernel command-line argument. This is especially helpful when working with remote servers when you can access initramfs system through SSH. In addition, initramfs' log file can be preserved, i.e. copied to real system just before switch_root call. This can be controlled via gk.log.keep kernel command-line argument: When just enabled, initramfs will copy log to $NEWROOT/genkernel-boot.log. Keep in my that the file path must be accessible for initramfs and by default, initramfs will only mount / as $NEWROOT and no additional mountpoints. Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.defaults | 4 + defaults/initrd.scripts | 535 --- defaults/linuxrc | 142 - defaults/login-remote.sh | 27 ++- defaults/unlock-luks.sh | 18 +- doc/genkernel.8.txt | 16 ++ 6 files changed, 522 insertions(+), 220 deletions(-) diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index fdf948e..553600d 100644 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -71,6 +71,10 @@ VERIFY=0 IP='dhcp' GK_DEBUGMODE_STATEFILE="/tmp/debug.enabled" +GK_INIT_LOG='/tmp/init.log' +GK_INIT_LOG_COPYTO= +GK_INIT_LOG_DISABLED='/tmp/no-init.log' +GK_INIT_LOG_PREFIX= GK_NET_DHCP_PIDFILE='/var/run/udhcpc.pid' GK_NET_DHCP_RETRIES=3 GK_NET_GW= diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 6f7530f..f95f434 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -34,6 +34,17 @@ modules_scan() { [ -n "${MODS}" ] && [ -z "${QUIET}" ] && \ printf "%b" "${BOLD} ::${NORMAL} Loading from ${1}: " + if [ -z "${MODULES_SCAN_WARNING_SHOWN}" ] + then + local note_msg="NOTE: Due to how genkernel auto-detects your" + note_msg="${note_msg} hardware you will now see a lot of failed modprobe" \ + note_msg="${note_msg} attempts which you can ignore:" + + log_msg "${note_msg}" + + MODULES_SCAN_WARNING_SHOWN=yes + fi + for x in ${MODS} do MLOAD=$(echo ${MLIST} | sed -e "s/.*${x}.*/${x}/") @@ -55,7 +66,7 @@ modules_scan() { printf "%b" "Scanning for ${x} ..." fi - modprobe ${x} >/dev/null 2>&1 + run modprobe ${x} >/dev/null 2>&1 loaded=${?} is_debug && [ "${loaded}" = "0" ] && \ @@ -79,7 +90,6 @@ uppercase() { echo $1 | tr 'a-z' 'A-Z' } - findmediamount() { # $1 = mount dir name / media name # $2 = recognition file @@ -130,14 +140,14 @@ findmediamount() { fi good_msg "Attempting to mount media: ${x}" ${CRYPT_SILENT} - mount -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1 + run mount -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1 if [ $? -eq 0 ] then if [ -n "${ISOBOOT}" ] then if [ -f "${mntcddir}/${ISOBOOT}" ] then - mount -o loop "${mntcddir}/${ISOBOOT}" "${mntdir}" + run mount -o loop "${mntcddir}/${ISOBOOT}" "${mntdir}" if [ $? -eq 0 ] then good_msg "iso mounted on ${mntdir}" @@ -153,7 +163,7 @@ findmediamount() { good_msg "Media found on ${x}" ${CRYPT_SILENT} break else - umount ${mntcddir} + run umount ${mntcddir} fi fi fi @@ -203,37 +213,37 @@ bootstrapFS() { aufs_branch=${aufs_memory}/aufs-rw-branch/${aufs_dev_uid} fi - mkdir -p ${aufs_memory}
[gentoo-commits] proj/genkernel:master commit in: defaults/, doc/
commit: 6cdbff3a7571e3e814fded0774e9b48cdcbffe38 Author: Robin H. Johnson gentoo org> AuthorDate: Tue Jan 3 05:36:08 2017 + Commit: Robin H. Johnson gentoo org> CommitDate: Tue Jan 3 05:36:08 2017 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=6cdbff3a Add quiet_genkernel to make quieter boot. The kernel boot option 'quiet' makes both the kernel & genkernel boot quietly. The new kernel boot option 'quiet_genkernel' just makes genkernel boot quietly, while not affecting the kernel verbosity. Fixes: https://bugs.gentoo.org/show_bug.cgi?id=474472 Signed-off-by: Robin H. Johnson gentoo.org> defaults/linuxrc| 2 +- doc/genkernel.8.txt | 6 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/defaults/linuxrc b/defaults/linuxrc index 965d28f..d09b96f 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -119,7 +119,7 @@ do dobtrfs*) USE_BTRFS=1 ;; - quiet) + quiet|quiet_genkernel) QUIET=1 ;; # Debug Options diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index ca8eff0..dafa25b 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -551,10 +551,14 @@ recognized by the kernel itself. switch_root into "/" instead of "/". is "/newroot" (or "/union") usually. -*quiet*:: +*quiet_genkernel*:: Do not print anything but error and warning messages during the execution of the initramfs init scripts. +*quiet*:: +Implies *quiet_genkernel*, but also recognized by the kernel to +suppress kernel messages. + *debug*:: Drop into a debug shell early in the process.
[gentoo-commits] proj/genkernel:master commit in: /, defaults/, doc/
commit: d41ebc4d721a8706d0b0f7c5cd1ed8dab42d667c Author: Niklas Haas git AT nand DOT wakku DOT to AuthorDate: Wed Aug 19 19:13:20 2015 + Commit: Richard Farina zerochaos AT gentoo DOT org CommitDate: Wed Aug 19 19:27:25 2015 + URL:https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=d41ebc4d Support multi-device Btrfs filesystems This requires running `/sbin/btrfs device` scan during boot, which is exposed via the new parameter ``dobtrfs''. defaults/initrd.scripts | 10 ++ defaults/linuxrc| 3 +++ doc/genkernel.8.txt | 6 ++ gen_cmdline.sh | 6 ++ gen_determineargs.sh| 1 + gen_initramfs.sh| 21 + genkernel | 1 + genkernel.conf | 3 +++ 8 files changed, 51 insertions(+) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index e05809c..4724b55 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -997,6 +997,16 @@ startVolumes() { bad_msg vgscan or vgchange not found: skipping LVM volume group activation! fi fi + + if [ ${USE_BTRFS} = '1' ] + then + if [ -x '/sbin/btrfs' ] + then + /sbin/btrfs device scan + else + bad_msg btrfs not found: skipping btrfs device scanning! + fi + fi if [ ${USE_ZFS} = '1' ] then diff --git a/defaults/linuxrc b/defaults/linuxrc index 19b9878..46b2151 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -120,6 +120,9 @@ do ZPOOL_FORCE=-f fi ;; + dobtrfs*) + USE_BTRFS=1 + ;; quiet) QUIET=1 ;; diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index f8d7a10..45af60e 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -275,6 +275,9 @@ INITIALIZATION *--*[*no-*]*zfs*:: Includes or excludes ZFS support. +*--*[*no-*]*btrfs*:: +Includes or excludes Btrfs support. + *--*[*no-*]*multipath*:: Includes or excludes Multipath support @@ -476,6 +479,9 @@ which the ramdisk initramfs scripts would recognize. Scan for bootable ZFS pools on bootup. Optionally force import if necessary. +*dobtrfs*:: +Scan for attached Btrfs devices on bootup. + *domultipath*:: Activate Multipath on bootup diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 2678d5d..c4f027a 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -99,6 +99,8 @@ longusage() { echo--no-e2fsprogs Exclude e2fsprogs echo--zfs Include ZFS support echo--no-zfsExclude ZFS support + echo--btrfs Include Btrfs support + echo--no-btrfs Exclude Btrfs support echo--multipath Include Multipath support echo--no-multipath Exclude Multipath support echo--iscsi Include iSCSI support @@ -331,6 +333,10 @@ parse_cmdline() { CMD_ZFS=`parse_optbool $*` print_info 2 CMD_ZFS: ${CMD_ZFS} ;; + --btrfs|--no-btrfs) + CMD_BTRFS=`parse_optbool $*` + print_info 2 CMD_BTRFS: ${CMD_BTRFS} + ;; --virtio) CMD_VIRTIO=`parse_optbool $*` print_info 2 CMD_VIRTIO: ${CMD_VIRTIO} diff --git a/gen_determineargs.sh b/gen_determineargs.sh index 59af78b..cbc88ba 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -125,6 +125,7 @@ determine_real_args() { set_config_with_override STRING MDADM_CONFIG CMD_MDADM_CONFIG set_config_with_override BOOL E2FSPROGSCMD_E2FSPROGS no set_config_with_override BOOL ZFS CMD_ZFS $(rootfs_type_is zfs) + set_config_with_override BOOL BTRFSCMD_BTRFS $(rootfs_type_is btrfs) set_config_with_override BOOL VIRTIO CMD_VIRTIO no set_config_with_override BOOL MULTIPATHCMD_MULTIPATH set_config_with_override BOOL FIRMWARE CMD_FIRMWARE diff --git a/gen_initramfs.sh b/gen_initramfs.sh index e7f72df..99a99c4 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -462,6 +462,25 @@ append_zfs(){ rm -rf ${TEMP}/initramfs-zfs-temp /dev/null } +append_btrfs() { + if [ -d ${TEMP}/initramfs-btrfs-temp ] + then + rm -r ${TEMP}/initramfs-btrfs-temp + fi + + mkdir -p ${TEMP}/initramfs-btrfs-temp + + # Copy binaries + copy_binaries ${TEMP}/initramfs-btrfs-temp /sbin/btrfs + + cd