public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2016-05-16  6:55 Robin H. Johnson
  0 siblings, 0 replies; 12+ messages in thread
From: Robin H. Johnson @ 2016-05-16  6:55 UTC (permalink / raw
  To: gentoo-commits

commit:     67893b749b83fd716e55fa7c865f4c924454ee24
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon May 16 06:40:43 2016 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon May 16 06:49:04 2016 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=67893b74

defaults/linuxrc: bug #232733: implement rootwait.

Based on patch from John Klug <ski.brimson <AT> gmail.com>.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 defaults/initrd.defaults |  1 +
 defaults/linuxrc         | 15 +++++++++++++++
 doc/genkernel.8.txt      |  5 +++++
 3 files changed, 21 insertions(+)

diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index a5eb3ba..b63ebd0 100755
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -60,6 +60,7 @@ REAL_ROOT=''
 CONSOLE='/dev/console'
 NEW_ROOT='/newroot'
 no_umounts='/newroot|/mnt/aufs-dev|/mnt/aufs-rw-branch|/mnt/livecd|/mnt/cdrom|/.unions/memory|/.unions/memory/xino'
+ROOTDELAY=1
 CDROOT='0'
 CDROOT_DEV=''
 CDROOT_TYPE='auto'

diff --git a/defaults/linuxrc b/defaults/linuxrc
index ac8f215..72e1543 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -133,6 +133,12 @@ do
 		scandelay)
 			SDELAY=3
 		;;
+		rootdelay=*|rootwait=*)
+			ROOTDELAY=${x#*=}
+		;;
+		rootdelay|rootwait)
+			ROOTDELAY=5
+		;;
 		# Module no-loads
 		doload=*)
 			MDOLIST=${x#*=}
@@ -485,10 +491,14 @@ fi
 
 # Determine root device
 good_msg 'Determining root device ...'
+ROOTDELAY_100MSEC=1
+[ -n "${ROOTDELAY}" ] && ROOTDELAY_100MSEC=$(($ROOTDELAY * 10))
 while true
 do
 	while [ "${got_good_root}" != '1' ]
 	do
+		# Start of sleep loop waiting on root
+		while [ ${ROOTDELAY_100MSEC} -ge 0 -a "${got_good_root}" != '1' ] ; do
 		case "${REAL_ROOT}" in
 			LABEL=*|UUID=*)
 
@@ -574,6 +584,11 @@ do
 				;;
 		esac
 
+		if [ "${got_good_root}" != '1' ] ; then
+		  let ROOTDELAY_100MSEC=${ROOTDELAY_100MSEC}-1
+		  usleep 100
+		fi
+		done  # End of sleep loop waiting on root
 		if [ "${REAL_ROOT}" = '' ]
 		then
 			# No REAL_ROOT determined/specified. Prompt user for root block device.

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index ab534cd..bab1034 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -464,6 +464,11 @@ which the ramdisk & initramfs scripts would recognize.
     Pauses for 10 seconds before running devfsd if no argument is
     specified; otherwise pauses for the number of specified seconds.
 
+*rootdelay*[=<...>]::
+*rootwait*[=<...>]::
+	Pauses for up to 3 seconds (or specified number of seconds) while
+	waiting for root device to appear during initramfs root scanning.
+
 *ip*=<...>::
     Normally used to tell the kernel that it should start a network
     interface. If present, the initrd will try to mount a  livecd


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2021-03-14 20:05 Thomas Deutschmann
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Deutschmann @ 2021-03-14 20:05 UTC (permalink / raw
  To: gentoo-commits

commit:     90138e02119bae09efe78f6ece02c039ad132137
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 14 18:24:39 2021 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Mar 14 19:39:48 2021 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=90138e02

linuxrc: Refactor switch_root error handling

Previous idea (commit 93bf318e5114233f3cacc4575ab2e58d60e785c7) never
worked: Exec will replace initramfs' init (PID 1) with specified command
so that any further line will never be reached. If that command will
fail now, init basically ended which will trigger a kernel panic:

  !! A fatal error has occured since /sbin/openrc-init did not
  !! boot correctly. Trying to open a shell ...
  + exec /bin/bash
  /init: exec: line 1366: /bin/bash: not found
  [   55.060649] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00

The new error handling will keep init running in loop which will
allow user to fix every detected problem until we are confident that
switch_root call has a chance to succeed.

In case the user cannot fix the problem (maybe because of
gk.userinteraction.disabled), we will call the newly added
gk.emergency action (reboot, poweroff or halt).

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.defaults |  1 +
 defaults/linuxrc         | 73 +++++++++++++++++++++++++++++++++---------------
 doc/genkernel.8.txt      |  8 +++++-
 3 files changed, 59 insertions(+), 23 deletions(-)

diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index b4e1e1d..18e1382 100644
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -71,6 +71,7 @@ VERIFY=0
 IP='dhcp'
 GK_BOOTFONT_DISABLED=0
 GK_DEBUGMODE_STATEFILE="/tmp/debug.enabled"
+GK_EMERGENCY_ACTION="halt -f"
 GK_HW_LOAD_ALL_MODULES=0
 GK_HW_USE_MODULES_LOAD=0
 GK_INIT_LOG='/run/initramfs/init.log'

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 8356aea..ebed7d8 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -289,6 +289,24 @@ do
 			fi
 			unset tmp_disabled
 		;;
+		gk.emergency=*)
+			tmp_action=${x#*=}
+			case "${tmp_action}" in
+				reboot)
+					GK_EMERGENCY_ACTION="reboot -f"
+					;;
+				poweroff)
+					GK_EMERGENCY_ACTION="poweroff -f"
+					;;
+				halt)
+					GK_EMERGENCY_ACTION="halt -f"
+					;;
+				*)
+					warn_msg "'${x}' is an unsupported emergency action -- ignored!"
+					;;
+			esac
+			unset tmp_action
+		;;
 		gk.hw.load-all=*)
 			tmp_disabled=${x#*=}
 			if is_true "${tmp_disabled}"
@@ -1341,28 +1359,39 @@ fi
 
 # init_opts is set in the environment by the kernel when it parses the command line
 init=${REAL_INIT:-/sbin/init}
-if ! mountpoint "${CHROOT}" 1>/dev/null 2>&1
-then
-	bad_msg "${CHROOT} was not a mountpoint"
-elif chroot "${CHROOT}" test ! -x /${init#/}
-then
-	bad_msg "init=${init} does not exist in the rootfs!"
-elif [ $$ != 1 ]
-then
-	bad_msg "PID was not 1! switch_root would fail"
-else
-	good_msg "Switching to real root: switch_root ${CHROOT} ${init} ${init_opts}"
-	exec switch_root "${CHROOT}" "${init}" ${init_opts}
-fi
 
-# If we get here, something bad has happened
-splash 'verbose'
+while true
+do
+	# switch_root can only be called from PID 1;
+	# So stay in loop as long as user is able
+	# to fix the problem.
 
-bad_msg "A fatal error has occured since ${init} did not"
-bad_msg "boot correctly. Trying to open a shell ..."
+	if  ! mountpoint "${CHROOT}" 1>/dev/null 2>&1
+	then
+		bad_msg "${CHROOT} is not a mountpoint; Was root device (${REAL_ROOT}) not mounted?"
+	elif ! chroot "${CHROOT}" test -x /${init#/} 1>/dev/null 2>&1
+	then
+		mounted_root_device=$(mountpoint -n /newroot 2>/dev/null | awk '{ print $1 }')
+		bad_msg "init (${init}) not found in mounted root device (${mounted_root_device})!"
+	else
+		break
+	fi
+
+	run_emergency_shell
+	if ! is_userinteraction_allowed
+	then
+		${GK_EMERGENCY_ACTION} || exit 1
+	fi
+done
 
-exec /bin/bash
-exec /bin/sh
-exec /bin/ash
-exec /bin/dash
-exec sh
+good_msg "Switching to real root: switch_root ${CHROOT} ${init} ${init_opts}"
+exec switch_root "${CHROOT}" "${init}" ${init_opts}
+
+# If we reached here, something went very badly wrong in the initramfs.
+# However, spawning a rescue shell at this point would not help anymore:
+#   1) We have to assume that switch_root has already messed with
+#      initramfs (i.e. we probably have no /dev anymore).
+#   2) Any shell we would spawn would become child of PID 1 which would
+#      prevent user from calling switch_root once the user believes the
+#      problem was fixed.
+${GK_EMERGENCY_ACTION} || exit 1

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index b75f979..44f3d59 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -832,6 +832,12 @@ 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.
 
+*gk.emergency*=<reboot|poweroff|halt>::
+    By default, genkernel tries to spawn a rescue shell in case of
+    a critical failure (see *gk.userinteraction.disabled* to prevent this).
+    This option controls the action to execute when rescue is not possible.
+    Default is "halt".
+
 *gk.hw.load-all*=<...>::
     By default, genkernel loads various module groups (nvme, sata,
     scsi, pata, usb...) until block device specified in *root* parameter
@@ -856,7 +862,7 @@ or desired, e.g. for a kiosk system, this boolean option will disable
 any prompting, including the rescue shell.
 
 NOTE: Because no user interaction is possible when this option is set,
-system will automatically reboot on error after a timeout.
+on error, system will immediately execute *gk.emergency* action.
 
 *noload*=<...>::
 List of modules to skip loading.


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2021-03-14 20:05 Thomas Deutschmann
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Deutschmann @ 2021-03-14 20:05 UTC (permalink / raw
  To: gentoo-commits

commit:     3fc2bfa183e05fe38bae40deb608bcb4e46ed065
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 13 18:36:22 2021 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Mar 14 19:33:50 2021 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=3fc2bfa1

linuxrc: Mark kernel command-line argument lvmraid as deprecated

Not used anymore since we moved to (e)udev.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/linuxrc    | 3 +--
 doc/genkernel.8.txt | 4 ----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 37a8dfa..28a504b 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -186,8 +186,7 @@ do
 		;;
 		# /dev/md
 		lvmraid=*)
-			RAID_DEVICES="${x#*=}"
-			RAID_DEVICES="$(echo ${RAID_DEVICES} | sed -e 's/,/ /g')"
+			warn_msg "'${x}' kernel command-line argument is deprecated; Use 'dolvm' instead!"
 			USE_LVM_NORMAL=1
 		;;
 		part=*)

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 74729be..d7afc07 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -780,10 +780,6 @@ when not set. This will allow remote user to provide answer through
 *dolvm*::
     Activate LVM volumes on bootup.
 
-*lvmraid*=<...>::
-    Specify RAID devices to set up before the activation of LVM volumes.
-    Implies option *dolvm*.
-
 *domdadm*::
     Scan for RAID arrays on bootup.
 


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2020-01-29 22:28 Thomas Deutschmann
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Deutschmann @ 2020-01-29 22:28 UTC (permalink / raw
  To: gentoo-commits

commit:     93c4a548b0aa06c2b5fd40467b80e945e081be24
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 29 22:04:22 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Wed Jan 29 22:12:36 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=93c4a548

defaults/config.sh: Use --buildpkg=n and --usepkg=n in DEFAULT_MODULEREBUILD_CMD

While we call emerge with "--ignore-default-opts" since commit da5a5fa797a5fffa6c4d694cbfe2edc83bab4890
to avoid conflicting emerge options, we also need to ensure that
we don't clash with problematic emerge FEATURES like "getbinpkg".

Reported-by: Rick Farina <zerochaos <AT> gentoo.org>
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/config.sh  | 2 +-
 doc/genkernel.8.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/defaults/config.sh b/defaults/config.sh
index 694b3e9..fed5355 100644
--- a/defaults/config.sh
+++ b/defaults/config.sh
@@ -34,7 +34,7 @@ DEFAULT_COMPRESS_INITRD_TYPE=best
 PORTAGE_MAKEOPTS="$(portageq envvar MAKEOPTS)"
 DEFAULT_MAKEOPTS="${PORTAGE_MAKEOPTS:- -j2}"
 
-DEFAULT_MODULEREBUILD_CMD="emerge --ignore-default-opts --quiet-build=y @module-rebuild"
+DEFAULT_MODULEREBUILD_CMD="emerge --ignore-default-opts --buildpkg=n --usepkg=n --quiet-build=y @module-rebuild"
 
 DEFAULT_KERNEL_MAKE=make
 DEFAULT_UTILS_MAKE=make

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index aebea03..6c7b9bd 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -196,7 +196,7 @@ specified.
     Copies or does not copy all kernel modules to the initrd.
 
 *--*[*no-*]*module-rebuild*::
-    Runs, or does not run "emerge --ignore-default-opts --quiet-build=y @module-rebuild"
+    Runs, or does not run "emerge --ignore-default-opts --buildpkg=n --usepkg=n --quiet-build=y @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


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2020-01-14  1:36 Thomas Deutschmann
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Deutschmann @ 2020-01-14  1:36 UTC (permalink / raw
  To: gentoo-commits

commit:     fe50a5857ded294fef0d6f28e50616b84f99e111
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 12 22:04:10 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Jan 12 22:09:32 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=fe50a585

defaults/config.sh: Use --quiet-build=y in DEFAULT_MODULEREBUILD_CMD

--quiet-build=y instead of just --quiet will output error message in
case emerge failed. Because we catch output this will make genkernel.log
a single point of truth logfile without the need to consult any additional
logfile.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/config.sh  | 2 +-
 doc/genkernel.8.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/defaults/config.sh b/defaults/config.sh
index 678c0f9..694b3e9 100644
--- a/defaults/config.sh
+++ b/defaults/config.sh
@@ -34,7 +34,7 @@ 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_MODULEREBUILD_CMD="emerge --ignore-default-opts --quiet-build=y @module-rebuild"
 
 DEFAULT_KERNEL_MAKE=make
 DEFAULT_UTILS_MAKE=make

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index e9076a4..aebea03 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -196,7 +196,7 @@ specified.
     Copies or does not copy all kernel modules to the initrd.
 
 *--*[*no-*]*module-rebuild*::
-    Runs, or does not run "emerge --ignore-default-opts --quiet @module-rebuild"
+    Runs, or does not run "emerge --ignore-default-opts --quiet-build=y @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


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2019-07-18 20:15 Thomas Deutschmann
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Deutschmann @ 2019-07-18 20:15 UTC (permalink / raw
  To: gentoo-commits

commit:     b3889e9bf7d486f83db3c182844b1217ce75d472
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 18 20:08:23 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Thu Jul 18 20:08:23 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=b3889e9b

linuxrc: Load network modules only when needed

To avoid problems related to drivers requiring special firmware which
might be not available when loading the module because the user don't really
need that module but it was added based on genkernel's module_load file,
we will no longer load network modules on boot.

Instead we will only load network modules when needed, for example
when dosshd is set or NFS is used.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.defaults |  5 +--
 defaults/initrd.scripts  | 83 +++++++++++++++++++++++++++++++++++++++++-------
 doc/genkernel.8.txt      |  3 ++
 3 files changed, 78 insertions(+), 13 deletions(-)

diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index fbbd214..c617064 100644
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -80,6 +80,7 @@ GK_NET_ROUTES=
 GK_NET_TIMEOUT_DAD=10
 GK_NET_TIMEOUT_DECONFIGURATION=10
 GK_NET_TIMEOUT_DHCP=10
+GK_NET_TIMEOUT_INTERFACE=10
 GK_SHELL_LOCKFILE='/var/run/rescueshell.pid'
 GK_SSHD_LOCKFILE='/tmp/remote-rescueshell.lock'
 GK_SSHD_PIDFILE='/var/run/dropbear.pid'
@@ -119,8 +120,8 @@ DEFAULT_NFSOPTIONS="ro,nolock"
 # - modules
 HWOPTS_BLK='nvme pata sata scsi usb firewire waitscan'
 HWOPTS_OBSOLETE='pcmcia ataraid' # Obsolete stuff that might be useful on old hardware, do$X only.
-HWOPTS="keymap cache modules virtio hyperv ${HWOPTS_BLK} bcache lvm dmraid multipath mdadm zfs fs net iscsi crypto"
+HWOPTS="keymap cache modules virtio hyperv ${HWOPTS_BLK} bcache lvm dmraid multipath mdadm zfs fs iscsi crypto"
 
 # This is the set of default HWOPTS, in the order that they are loaded.
 # This is whitespace aligned with HWOPTS above.
-MY_HWOPTS="          modules virtio hyperv ${HWOPTS_BLK} bcache lvm dmraid           mdadm     fs net       crypto"
+MY_HWOPTS="          modules virtio hyperv ${HWOPTS_BLK} bcache lvm dmraid           mdadm     fs       crypto"

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index bc19fff..61ae534 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1597,6 +1597,10 @@ iface_name() {
 }
 
 start_network() {
+	# Load network modules only when we need them to avoid possible
+	# firmware problems for people not using network that early
+	MY_HWOPTS=net load_modules
+
 	# At least gk.net.iface can only be processed after sysfs was
 	# mounted.
 	local x=
@@ -1620,17 +1624,21 @@ start_network() {
 				GK_NET_GW=${x#*=}
 			;;
 			gk.net.iface=*)
-				local tmp_iface=$(iface_name "${x#*=}")
-				if [ -z "${tmp_iface}" ]
-				then
-					warn_msg "Interface specified by '${x}' not found, falling back to genkernel defaults ..."
-				else
-					GK_NET_IFACE=${tmp_iface}
-				fi
+				GK_NET_IFACE=${x#*=}
 			;;
 			gk.net.routes=*)
 				GK_NET_ROUTES=${x#*=}
 			;;
+			gk.net.timeout.interface=*)
+				local tmp_interface_timeout=${x#*=}
+				if is_int "${tmp_interface_timeout}"
+				then
+					GK_NET_TIMEOUT_INTERFACE=${tmp_interface_timeout}
+				else
+					warn_msg "'${x}' does not look like a valid number -- will keep using default value ${GK_NET_TIMEOUT_INTERFACE}!"
+				fi
+				unset tmp_interface_timeout
+			;;
 			gk.net.timeout.dad=*)
 				local tmp_dad_timeout=${x#*=}
 				if is_int "${tmp_dad_timeout}"
@@ -1664,10 +1672,63 @@ start_network() {
 		esac
 	done
 
-	if [ ! -d "/sys/class/net/${GK_NET_IFACE}" ]
+	local interface_identifier=device
+	if echo "${GK_NET_IFACE}" | grep -qE ':|-'
 	then
-		warn_msg "Interface ${GK_NET_IFACE} not found; Will not try to start network ..."
-		return
+		interface_identifier=mac
+		good_msg_n "Waiting for interface with MAC address ${GK_NET_IFACE} ..."
+	else
+		good_msg_n "Waiting for interface ${GK_NET_IFACE} ..."
+	fi
+
+	local tmp_interface=
+	local have_interface=0
+	local interface_time_waited=0
+	local interface_timeout_100msec_modulo=
+	local interface_timeout && let interface_timeout=$(date +%s)+1
+	[ -n "${GK_NET_TIMEOUT_INTERFACE}" -a "${GK_NET_TIMEOUT_INTERFACE}" -gt 0 ] && let interface_timeout=${interface_timeout}+${GK_NET_TIMEOUT_INTERFACE}-1
+
+	while [ "${have_interface}" != '1' -a $(date +%s) -le ${interface_timeout} ]
+	do
+		tmp_interface=$(iface_name "${GK_NET_IFACE}")
+		if [ -n "${tmp_interface}" ]
+		then
+			# We got at least something to probe
+			if [ -d "/sys/class/net/${tmp_interface}" ]
+			then
+				GK_NET_IFACE="${tmp_interface}"
+				have_interface=1
+				break
+			fi
+		fi
+
+		if [ "${have_interface}" != '1' ]
+		then
+			let interface_time_waited=${interface_time_waited}+1
+			sleep 0.1s
+
+			let interface_timeout_100msec_modulo=${interface_time_waited}%10
+			if [ ${interface_timeout_100msec_modulo} = 0 ]
+			then
+				printf "."
+			fi
+		fi
+	done
+
+	echo
+
+	if [ "${have_interface}" != '1' ]
+	then
+		# Timeout!
+		if [ "${interface_identifier}" = 'mac' ]
+		then
+			bad_msg "Interface with MAC address ${GK_NET_IFACE} not found!"
+		else
+			bad_msg "Interface ${GK_NET_IFACE} not found!"
+		fi
+
+		warn_msg "Will not try to start network ..."
+		return 1
 	fi
 
 	if [ -z "${IP}" -o "${IP}" = 'dhcp' ]
@@ -1677,7 +1738,7 @@ start_network() {
 		if [ $? -ne 0 ]
 		then
 			bad_msg "Failed to start udhcpc for interface ${GK_NET_IFACE}!"
-			return
+			return 1
 		fi
 	else
 		good_msg "Bringing up interface ${GK_NET_IFACE} ..." ${QUIET}

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index da0f44e..3b96d8e 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -572,6 +572,9 @@ recognized by the kernel itself.
 *gk.net.timeout.dhcp*=<...>::
     By default we will wait up to 10 seconds for a DHCP server reply.
 
+*gk.net.timeout.interface*=<...>::
+    By default we will wait up to 10 seconds for interface to show up.
+
 *dosshd*::
     Will start an SSH daemon within initramfs allowing to remotely unlock
     encrypted devices or just for debugging purpose.


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2018-06-12 21:26 Robin H. Johnson
  0 siblings, 0 replies; 12+ messages in thread
From: Robin H. Johnson @ 2018-06-12 21:26 UTC (permalink / raw
  To: gentoo-commits

commit:     5c5c32aa7261a29a3ac48035086bb59449d3804d
Author:     Georgy Yakovlev <ya <AT> sysdump <DOT> net>
AuthorDate: Wed Jun  6 02:33:07 2018 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Jun  6 06:02:35 2018 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=5c5c32aa

Add option to force importing zpool using cache

Add simple option to pass to kernel via loader.

dozfs=cache will use /etc/zfs/zpool.cache
avoiding 30+ second wait for udev in zpool import

Also it's possible to use both cache and force
at the same time:
dozfs=force,cache (order is not important) will
force import and use cache.

Closes: https://bugs.gentoo.org/627320
Signed-off-by: Georgy Yakovlev <ya <AT> sysdump.net>

 defaults/initrd.scripts |  6 +++---
 defaults/linuxrc        | 19 +++++++++++++++----
 doc/genkernel.8.txt     |  6 +++---
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 2fb0eb4..f8f9825 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -1181,7 +1181,7 @@ startVolumes() {
 		then
 			good_msg "Importing ZFS pools"
 
-			/sbin/zpool import -N -a ${ZPOOL_FORCE}
+			/sbin/zpool import -N -a ${ZPOOL_CACHE} ${ZPOOL_FORCE}
 
 			if [ "$?" = '0' ]
 			then
@@ -1199,12 +1199,12 @@ startVolumes() {
 				then
 					good_msg "LUKS detected. Reimporting ${ZFS_POOL}"
 					/sbin/zpool export -f "${ZFS_POOL}"
-					/sbin/zpool import -N ${ZPOOL_FORCE} "${ZFS_POOL}"
+					/sbin/zpool import -N ${ZPOOL_CACHE} ${ZPOOL_FORCE} "${ZFS_POOL}"
 				fi
 			else
 				good_msg "Importing ZFS pool ${ZFS_POOL}"
 
-				/sbin/zpool import -N ${ZPOOL_FORCE} "${ZFS_POOL}"
+				/sbin/zpool import -N ${ZPOOL_CACHE} ${ZPOOL_FORCE} "${ZFS_POOL}"
 
 				if [ "$?" = '0' ]
 				then

diff --git a/defaults/linuxrc b/defaults/linuxrc
index d58ef06..81e7799 100644
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -111,10 +111,21 @@ do
 		dozfs*)
 			USE_ZFS=1
 
-			if [ "${x#*=}" = 'force' ]
-			then
-				ZPOOL_FORCE=-f
-			fi
+			case "${x#*=}" in
+				*force*)
+					ZPOOL_FORCE=-f
+				;;
+			esac
+
+			case "${x#*=}" in
+				*cache*)
+					if [ -s "/etc/zfs/zpool.cache" ]; then
+						ZPOOL_CACHE="-c /etc/zfs/zpool.cache"
+					else
+						bad_msg "zpool.cache not found or empty, zpool import will be slow"
+					fi
+				;;
+			esac
 		;;
 		dobtrfs*)
 			USE_BTRFS=1

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 908212e..ca84816 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -522,9 +522,9 @@ recognized by the kernel itself.
 *domdadm*::
     Scan for RAID arrays on bootup
 
-*dozfs*[=force]::
-    Scan for bootable ZFS pools on bootup. Optionally force import if
-    necessary.
+*dozfs*[=cache,force]::
+    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.


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2013-04-29  8:56 Fabio Erculiani
  0 siblings, 0 replies; 12+ messages in thread
From: Fabio Erculiani @ 2013-04-29  8:56 UTC (permalink / raw
  To: gentoo-commits

commit:     9ead931af140020d4f5f2fed47a17da5dc8cfe24
Author:     Fabio Erculiani <lxnay <AT> sabayon <DOT> org>
AuthorDate: Thu Apr 25 10:45:19 2013 +0000
Commit:     Fabio Erculiani <lxnay <AT> gentoo <DOT> org>
CommitDate: Mon Apr 29 09:54:47 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=9ead931a

linuxrc: use "quiet" cmdline argument for a really quiet initramfs initialization

"quiet" is already used by the kernel to avoid printing messages on the
console unless they are errors or warnings. Genkernel should do the same
wrt its initramfs initialization code.
This has also the advantage of improving the boot speed.

---
 defaults/initrd.scripts |   34 ++++++++++++++++++++++------------
 defaults/linuxrc        |   35 +++++++++++++++++------------------
 doc/genkernel.8.txt     |    4 ++++
 3 files changed, 43 insertions(+), 30 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
old mode 100755
new mode 100644
index ff724b5..c1969d1
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -16,15 +16,16 @@ modules_scan() {
 	local loaded
 
 	MODS=$(cat /etc/modules/${1} 2>/dev/null)
-	[ -n "${MODS}" ] && echo -ne "${BOLD}   ::${NORMAL} "
-	[ -n "${MODS}" ] && echo -ne "Loading from ${1}: "
+	[ -n "${MODS}" ] && [ -z "${QUIET}" ] && \
+		echo -ne "${BOLD}   ::${NORMAL} Loading from ${1}: "
 
 	for x in ${MODS}
 	do
 		MLOAD=$(echo ${MLIST} | sed -e "s/.*${x}.*/${x}/")
 		if [ "${MLOAD}" = "${x}" ] # Only module to no-load
 		then
-			echo -e "${BOLD}   ::${NORMAL} Skipping ${x}..."
+			[ -z "${QUIET}" ] && \
+				echo -e "${BOLD}   ::${NORMAL} Skipping ${x}..."
 		elif [ "${MLOAD}" = "${MLIST}" ]
 		then
 			if [ -n "${DEBUG}" ]; then
@@ -33,17 +34,21 @@ modules_scan() {
 			fi
 			modprobe ${x} > /dev/null 2>&1
 			loaded=${?}
+
 			[ -n "${DEBUG}" -a "${loaded}" = "0" ] && \
 				echo "loaded"
 			[ -n "${DEBUG}" -a "${loaded}" != "0" ] && \
 				echo "not loaded"
+
 			[ -z "${DEBUG}" -a "${loaded}" = "0" ] && \
+				[ -z "${QUIET}" ] && \
 				echo -en "${x} "
 		else
-			echo -e "${BOLD}   ::${NORMAL} Skipping ${x}..."
+			[ -z "${QUIET}" ] && \
+				echo -e "${BOLD}   ::${NORMAL} Skipping ${x}..."
 		fi
 	done
-	[ -n "${MODS}" ] && echo
+	[ -n "${MODS}" ] && [ -z "${QUIET}" ] && echo
 }
 
 uppercase(){
@@ -377,7 +382,9 @@ test_success() {
 # $1 string
 # $2 hide flag
 
-good_msg() {	
+good_msg() {
+	[ -n "${QUIET}" ] && [ -z "${DEBUG}" ] && return 0
+
 	msg_string=$1
 	msg_string="${msg_string:-...}"
 	[ "$2" != 1 ] && echo -e "${GOOD}>>${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
@@ -424,12 +431,15 @@ prompt_user(){
 	eval local oldvalue='$'${1}
 
 	[ $# != 2 -a $# != 3 ] && \
-		bad_msg "Bad invocation of function prompt_user, please file a bug \
-		report with this message" && exit 1
+		bad_msg "Bad invocation of function prompt_user."
+		bad_msg "Please file a bug report with this message" && exit 1
 	[ -n "${3}" ] && local explnt=" or : ${3}" || local explnt="."
-	
+
 	bad_msg "Could not find the ${2} in ${oldvalue}${explnt}"
-	echo '   Please specify another value or: press Enter for the same, type "shell" for a shell, or "q" to skip...'
+	bad_msg "Please specify another value or:"
+	bad_msg "- press Enter for the same"
+	bad_msg '- type "shell" for a shell'
+	bad_msg '- type "q" to skip...'
 	echo -n "${2}(${oldvalue}) :: "
 	read ${1}
 	case `eval echo '$'${1}` in
@@ -440,7 +450,7 @@ prompt_user(){
 			;;
 		'shell')
 			eval ${1}'='${oldvalue}
-			echo "To leave and try again just press <Ctrl>+D"
+			warn_msg "To leave and try again just press <Ctrl>+D"
 			run_shell
 			;;
 		'')
@@ -600,7 +610,7 @@ chooseKeymap() {
 		splash set_msg "Set keymap to ${keymap}"
 	elif [ -z "${keymap}" ]
 	then
-		echo
+		good_msg
 		good_msg "Keeping default keymap"
 		splash set_msg "Keeping default keymap"
 	else

diff --git a/defaults/linuxrc b/defaults/linuxrc
old mode 100755
new mode 100644
index ba9c5d5..1d26aaf
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -31,8 +31,6 @@ then
 	[ -e /linuxrc ] && rm /linuxrc
 fi
 
-quiet_kmsg
-
 CMDLINE=$(cat /proc/cmdline)
 # Scan CMDLINE for any specified real_root= or cdroot arguments
 FAKE_ROOT=''
@@ -41,6 +39,7 @@ FAKE_ROOTFLAGS=''
 INIT_OPTS=''
 ROOTFSTYPE='auto'
 CRYPT_SILENT=0
+QUIET=''
 
 mkdir -p /etc/cmdline /etc/modprobe.d
 for x in ${CMDLINE}
@@ -118,6 +117,9 @@ do
 				ZPOOL_FORCE=-f
 			fi
 		;;
+		quiet)
+			QUIET=1
+		;;
 		# Debug Options
 		debug)
 			DEBUG='yes'
@@ -270,6 +272,8 @@ do
 	esac
 done
 
+quiet_kmsg
+
 if [ "${CDROOT}" = '0' ]
 then
 	if [ -z "${REAL_ROOT}" -a "${FAKE_ROOT}" != "/dev/ram0" ]
@@ -457,17 +461,13 @@ then
 
 	if [ "${REAL_ROOT}" = '' ]
 	then
-		echo -n -e "${WARN}>>${NORMAL}${BOLD} No bootable medium found. Waiting for new devices"
-
+		warn_msg "No bootable medium found. Waiting for new devices..."
 		COUNTER=0
 		while [ ${COUNTER} -lt 3 ]; do
 			sleep 3
-			echo -n '.'
 			let COUNTER=${COUNTER}+1
 		done
-
 		sleep 1
-		echo -e "${NORMAL}"
 		bootstrapCD
 	fi
 
@@ -909,43 +909,42 @@ fi
 
 verbose_kmsg
 
-echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)${NORMAL}"
+good_msg "Booting (initramfs)"
 
 cd "${CHROOT}"
 mkdir "${CHROOT}/proc" "${CHROOT}/sys" "${CHROOT}/run" 2>/dev/null
-echo -ne "${BOLD}.${NORMAL}"
 
 # If devtmpfs is mounted, try move it to the new root
-# If that fails, try to unmount all possible mounts of devtmpfs as stuff breaks otherwise
+# If that fails, try to unmount all possible mounts of
+# devtmpfs as stuff breaks otherwise
 for fs in /dev /sys /proc
 do
 	if grep -qs "$fs" /proc/mounts
 	then
 		if ! mount --move $fs "${CHROOT}"$fs
 		then
-			umount $fs || echo '*: Failed to move and unmount the ramdisk $fs!'
+			umount $fs || \
+			bad_msg "Failed to move and unmount the ramdisk $fs!"
 		fi
 	fi
 done
 
 if [ ! -e "${CHROOT}/dev/console" ] || [ ! -e "${CHROOT}/dev/null" ]
 then
-	echo -ne "${BAD}>>${NORMAL}${BOLD} ERROR: your real /dev is missing files required to boot (console and null)${NORMAL}"
+	bad_msg "ERROR: your real /dev is missing console and null"
 elif [ -e /etc/initrd.splash -a ! -e "${CHROOT}/dev/tty1" ]
 then
-	echo -ne "${BAD}>>${NORMAL}${BOLD} ERROR: your real /dev is missing tty1, which is required for splash${NORMAL}"
+	bad_msg "ERROR: your real /dev is missing tty1, required for splash"
 fi
 
-echo -e "${BOLD}.${NORMAL}"
-
 exec /sbin/switch_root -c "/dev/console" "${CHROOT}" "${REAL_INIT:-/sbin/init}" "${INIT_OPTS}"
 
 # If we get here, something bad has happened
 splash 'verbose'
 
-echo "A fatal error has probably occured since ${REAL_INIT:-/sbin/init} did not"
-echo "boot correctly. Trying to open a shell..."
-echo
+bad_msg "A fatal error has occured since ${REAL_INIT:-/sbin/init} did not"
+bad_msg "boot correctly. Trying to open a shell..."
+
 exec /bin/bash
 exec /bin/sh
 exec /bin/ash

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 54d26d2..f1cc814 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -493,6 +493,10 @@ which the ramdisk scripts would recognize.
     switch_root into "<CHROOT>/<SUBDIR>" instead of "<CHROOT>/".
     <CHROOT> is "/newroot" (or "/union") usually.
 
+*quiet*::
+    Do not print anything but error and warning messages during
+    the execution of the initramfs init scripts.
+
 *debug*::
     Drop into a debug shell early in the process.
 


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2013-04-25  6:22 Fabio Erculiani
  0 siblings, 0 replies; 12+ messages in thread
From: Fabio Erculiani @ 2013-04-25  6:22 UTC (permalink / raw
  To: gentoo-commits

commit:     ffa5076fd4681e6b65968b826b84a66fabcd75f6
Author:     Fabio Erculiani <lxnay <AT> sabayon <DOT> org>
AuthorDate: Tue Apr 23 16:12:46 2013 +0000
Commit:     Fabio Erculiani <lxnay <AT> gentoo <DOT> org>
CommitDate: Thu Apr 25 07:20:52 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=ffa5076f

Drop doslowusb and noslowusb boot parameters.

scandelay=<secs> should be always preferred. Moreover, nowadays
automatically sleeping waiting for USB storage to come up in
the way we were used to do it doesn't work as one expects, because
USB is very common and USB storage devices are very likely to be
present on a system.
Furthermore, the initialization code after setup_slowusb is already
waiting for devices to come up.

---
 defaults/initrd.defaults |    4 ++--
 defaults/initrd.scripts  |   21 ---------------------
 defaults/linuxrc         |    6 ------
 doc/genkernel.8.txt      |    5 -----
 4 files changed, 2 insertions(+), 34 deletions(-)

diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults
index e70beab..cbf18f3 100755
--- a/defaults/initrd.defaults
+++ b/defaults/initrd.defaults
@@ -72,5 +72,5 @@ DEFAULT_NFSOPTIONS="ro,nolock,rsize=1024,wsize=1024"
 
 # Only sections that are in by default or those that
 # are not module groups need to be defined here...
-HWOPTS='keymap cache modules pata sata scsi usb firewire waitscan slowusb lvm dmraid mdadm fs net'
-MY_HWOPTS='modules pata sata scsi slowusb usb firewire waitscan dmraid mdadm fs net iscsi crypto'
+HWOPTS='keymap cache modules pata sata scsi usb firewire waitscan lvm dmraid mdadm fs net'
+MY_HWOPTS='modules pata sata scsi usb firewire waitscan dmraid mdadm fs net iscsi crypto'

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index abd8fad..a216b84 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -446,27 +446,6 @@ prompt_user(){
 	esac
 }
 
-setup_slowusb() {
-	# This function removes unset DO_slowusb if there is no usb-storage attached.
-	# If noslowusb is set, skip this function
-	[ "${DO_slowusb}" ] || return
-
-	# Unset DO_slowusb, so we can set it again if usb-storage has something attached
-	unset DO_slowusb
-
-	local usb_storage_dir="/sys/bus/usb/drivers/usb-storage"
-	if [ ! -d "${usb_storage_dir}" ]
-	then
-		# no automated slowusb required. no usb-storage devices attached.
-		return
-	fi
-	for x in "${usb_storage_dir}"/*
-	do
-		[ -d "${x}" ]  && [ "${x}" != "${usb_storage_dir}/module" ] \
-			&& { DO_slowusb="1" ; break ; }
-	done
-}
-
 cmdline_hwopts() {
 	# Scan CMDLINE for any "doscsi" or "noscsi"-type arguments
 	local FOUND

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 805515b..ba9c5d5 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -359,14 +359,8 @@ mdev -s || bad_msg "mdev -s failed"
 # Apply scan delay if specified
 sdelay
 
-# Setup slow USB bits
-setup_slowusb
-
 cd /
 
-# if doslowusb is passed, pause other 10 seconds here, after mdev load
-[ "${DO_slowusb}" ] && sleep 10
-
 # Start iSCSI
 if [ -e /bin/iscsistart ]
 then

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 86d7d53..54d26d2 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -472,11 +472,6 @@ which the ramdisk scripts would recognize.
     Activate SCSI devices on bootup, necessary when SCSI support is
     compiled as modules and you're using SCSI or SATA devices.
 
-*noslowusb*::
-    By default genkernel pause for 10 seconds if it finds a attached
-    usb-storage device to give them time to initiate.
-    This option skips that pause.
-
 *keymap*='MAP'::
     Set keymap to 'MAP', e.g. *keymap*=de.
     For valid values of 'MAP' please see


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2013-03-31 12:47 Peter Hjalmarsson
  0 siblings, 0 replies; 12+ messages in thread
From: Peter Hjalmarsson @ 2013-03-31 12:47 UTC (permalink / raw
  To: gentoo-commits

commit:     e4ab952d639ff69e57fefa3e3855ee81d4d555fb
Author:     Peter Hjalmarsson <xake <AT> rymdraket <DOT> net>
AuthorDate: Tue Mar  5 21:45:45 2013 +0000
Commit:     Peter Hjalmarsson <xake <AT> rymdraket <DOT> net>
CommitDate: Sun Mar 31 12:45:08 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=e4ab952d

Add rootflags to switches we understand

Nearly every general documentation including the one in the
kernel tree and the scripts for GRUB2 all expects this flag
to work.

Signed-off-by: Peter Hjalmarsson <xake <AT> rymdraket.net>

---
 defaults/linuxrc    |   24 +++++++++++++++++-------
 doc/genkernel.8.txt |    8 ++++++--
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/defaults/linuxrc b/defaults/linuxrc
index f1e20ce..703652d 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -37,7 +37,7 @@ CMDLINE=$(cat /proc/cmdline)
 # Scan CMDLINE for any specified real_root= or cdroot arguments
 FAKE_ROOT=''
 FAKE_INIT=''
-REAL_ROOTFLAGS=''
+FAKE_ROOTFLAGS=''
 INIT_OPTS=''
 ROOTFSTYPE='auto'
 CRYPT_SILENT=0
@@ -236,6 +236,9 @@ do
 		real_rootflags=*)
 			REAL_ROOTFLAGS=${x#*=}
 		;;
+		rootflags=*)
+			FAKE_ROOTFLAGS=${x#*=}
+		;;
 		rootfstype=*)
 			ROOTFSTYPE=${x#*=}
 		;;
@@ -267,13 +270,20 @@ do
 	esac
 done
 
-if [ -z "${REAL_ROOT}" -a \( "${CDROOT}" = '0' \)  -a \( "${FAKE_ROOT}" != "/dev/ram0" \) ]
-then
-	REAL_ROOT="${FAKE_ROOT}"
-fi
-if [ -z "${REAL_INIT}" -a \( "${CDROOT}" = '0' \)  -a \( "${FAKE_INIT}" != "/linuxrc" \) ]
+if [ \( "${CDROOT}" = '0' \) ]
 then
-	REAL_INIT="${FAKE_INIT}"
+	if [ -z "${REAL_ROOT}" -a \( "${FAKE_ROOT}" != "/dev/ram0" \) ]
+	then
+		REAL_ROOT="${FAKE_ROOT}"
+	fi
+	if [ -z "${REAL_INIT}" -a \( "${FAKE_INIT}" != "/linuxrc" \) ]
+	then
+		REAL_INIT="${FAKE_INIT}"
+	fi
+	if [ -z "${REAL_ROOTFLAGS}" ]
+	then
+		REAL_ROOTFLAGS="${FAKE_ROOTFLAGS}"
+	fi
 fi
 
 # Set variables based on the value of REAL_ROOT

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 4691a98..86d7d53 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -545,9 +545,13 @@ which the ramdisk scripts would recognize.
 *aufs*::
     Enables support for AUFS2 (if available in the kernel).
 
-*real_rootflags*=<...>::
+*rootflags*=<...>::
     Additional flags to mount the real root system with.
-    For example *real_rootflags*=noatime would make "-o ro,noatime".
+    For example *rootflags*=noatime would make "-o ro,noatime".
+
+*real_rootflags*=<...>::
+    Legacy kernel parameter from kernel-2.4 initrd.
+    Does the same as *rootflags*=, which should be used in its place.
 
 *real_resume*=<...>::
 *resume*=<...>::


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2012-11-20  0:59 Robin H. Johnson
  0 siblings, 0 replies; 12+ messages in thread
From: Robin H. Johnson @ 2012-11-20  0:59 UTC (permalink / raw
  To: gentoo-commits

commit:     32a9b007bf24be899272a782a9f33d007b1e3c07
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 20 00:47:38 2012 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Nov 20 00:58:55 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=32a9b007

linuxrc: part keyword

Clean up documentation and functionality of "part" argument to
initramfs. It is meant to imitate the same option to the kernel.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 defaults/linuxrc    |    3 +++
 doc/genkernel.8.txt |   10 ++++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 1bc09a7..4166396 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -156,6 +156,9 @@ do
 		part=*)
 			MDPART=${x#*=}
 		;;
+		part|partitionable)
+			MDPART=1
+		;;
 		# NFS
 		ip=*)
 			IP=${x#*=}

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index dc04240..4691a98 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -520,12 +520,10 @@ which the ramdisk scripts would recognize.
 *console*=<...>::
     Override location of console, default is "/dev/console".
 
-*part*=<...>::
-    Specify part for mdadm to start.  This is the relevant code in mdstart:
-------------------------------------------
-    fd = open("/dev/md<MD_NUMBER>", 0, 0);
-    ioctl(fd, RAID_AUTORUN, <MDPART>);
-------------------------------------------
+*part*[=<0,1>]::
+*partitionable*::
+	Enable/Disable partitionable RAIDs (metadata 0.x) during auto-run.
+	Standalone *part* and *partitionable* keywords for kernel compatability.
 
 *iscsi_initiatorname*=<...>::
 *iscsi_target*=<...>::


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/
@ 2012-01-05 16:51 Sebastian Pipping
  0 siblings, 0 replies; 12+ messages in thread
From: Sebastian Pipping @ 2012-01-05 16:51 UTC (permalink / raw
  To: gentoo-commits

commit:     c92fe6f0e654d49f00465e81f8f491ef9240fb80
Author:     Christian Kruse <cjk <AT> wwwtech <DOT> de>
AuthorDate: Thu Jan  5 16:45:38 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Thu Jan  5 16:49:47 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=c92fe6f0

Introduce boot parameter root_trim=(yes|no) for SSDs

---
 defaults/initrd.scripts |    8 +++++++-
 defaults/linuxrc        |    4 ++++
 doc/genkernel.8.txt     |    5 +++++
 3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 89c6d8b..b7b42ab 100755
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -732,7 +732,7 @@ openLUKS() {
 			;;
 	esac
 
-	eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"' LUKS_NAME="$1" LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"' LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"'
+	eval local LUKS_DEVICE='"${CRYPT_'${TYPE}'}"' LUKS_NAME="$1" LUKS_KEY='"${CRYPT_'${TYPE}'_KEY}"' LUKS_KEYDEV='"${CRYPT_'${TYPE}'_KEYDEV}"' LUKS_TRIM='"${CRYPT_'${TYPE}'_TRIM}"'
 	local DEV_ERROR=0 KEY_ERROR=0 KEYDEV_ERROR=0
 	local mntkey="/mnt/key/" cryptsetup_options=''
 
@@ -793,6 +793,12 @@ openLUKS() {
 				continue
 			else
 				# Handle keys
+				if [ "x${LUKS_TRIM}" = "xyes" ]
+				then
+					good_msg "Enabling TRIM support for ${LUKS_NAME}." ${CRYPT_SILENT}
+					cryptsetup_options="${cryptsetup_options} --allow-discards"
+				fi
+
 				if [ -n "${LUKS_KEY}" ] 
 				then
 					if [ ! -e "${mntkey}${LUKS_KEY}" ] 

diff --git a/defaults/linuxrc b/defaults/linuxrc
index 63366bd..28d204e 100755
--- a/defaults/linuxrc
+++ b/defaults/linuxrc
@@ -189,6 +189,10 @@ do
 		root_keydev=*)
 			CRYPT_ROOT_KEYDEV=${x#*=}
 		;;
+		root_trim=*)
+			CRYPT_ROOT_TRIM=${x#*=}
+		;;
+
 		swap_key=*)
 			CRYPT_SWAP_KEY=${x#*=}
 		;;

diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt
index 35c7ff3..d436330 100644
--- a/doc/genkernel.8.txt
+++ b/doc/genkernel.8.txt
@@ -387,6 +387,11 @@ which the ramdisk scripts would recognize.
     root_key.   If unset while using root_key, it will automatically
     look for the device in every boot.
 
+*root_trim*=yes|no::
+    Allows you to enable TRIM support on root device. Only useful
+    for SSD setups. Have a look at http://en.wikipedia.org/wiki/TRIM
+    for more information.
+
 *swap_key*=<...>::
     Same as root_key for swap.
 



^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-03-14 20:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-16  6:55 [gentoo-commits] proj/genkernel:master commit in: doc/, defaults/ Robin H. Johnson
  -- strict thread matches above, loose matches on Subject: below --
2021-03-14 20:05 Thomas Deutschmann
2021-03-14 20:05 Thomas Deutschmann
2020-01-29 22:28 Thomas Deutschmann
2020-01-14  1:36 Thomas Deutschmann
2019-07-18 20:15 Thomas Deutschmann
2018-06-12 21:26 Robin H. Johnson
2013-04-29  8:56 Fabio Erculiani
2013-04-25  6:22 Fabio Erculiani
2013-03-31 12:47 Peter Hjalmarsson
2012-11-20  0:59 Robin H. Johnson
2012-01-05 16:51 Sebastian Pipping

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox