Compare commits
57 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
616f1557b1 | ||
![]() |
a75c29be45 | ||
![]() |
a3a3448d8c | ||
![]() |
58dbb43eac | ||
![]() |
5b2db7d177 | ||
![]() |
aa254c5596 | ||
![]() |
da04062e72 | ||
![]() |
3b51f4f30b | ||
![]() |
5cc26464e0 | ||
![]() |
9719024132 | ||
![]() |
83701d66f6 | ||
![]() |
f601799e94 | ||
![]() |
e2dbd86f09 | ||
![]() |
1b9cae5cb2 | ||
![]() |
259e58a904 | ||
![]() |
a55711cd86 | ||
![]() |
a8e47195dd | ||
![]() |
624b52c440 | ||
![]() |
4f4454b61f | ||
![]() |
e0364f95bc | ||
![]() |
970e646b00 | ||
![]() |
df328b6c36 | ||
![]() |
5b6e76c011 | ||
![]() |
eab677a216 | ||
![]() |
4ce1991856 | ||
![]() |
7e87a0bfa0 | ||
![]() |
7717b4433a | ||
![]() |
5db734030d | ||
![]() |
5966b1b15d | ||
![]() |
3e17f33b27 | ||
![]() |
bd81caa80a | ||
![]() |
f910f00627 | ||
![]() |
22a27a5023 | ||
![]() |
14f450cab2 | ||
![]() |
ada0bc3e5f | ||
![]() |
6fb586f3ef | ||
![]() |
5831685cdb | ||
![]() |
950086e987 | ||
![]() |
440d35d3c0 | ||
![]() |
0aaa523c82 | ||
![]() |
3473f5d938 | ||
![]() |
e7170fb717 | ||
![]() |
9d4c1799fe | ||
![]() |
6da2ee08a6 | ||
![]() |
297cb80bab | ||
![]() |
798d950651 | ||
![]() |
92798bf79b | ||
![]() |
696e68c643 | ||
![]() |
d8b3d672c3 | ||
![]() |
8af0a48521 | ||
![]() |
2d21db6def | ||
![]() |
3847431d3d | ||
![]() |
fb3d8cf7c2 | ||
![]() |
d0d1ea3d87 | ||
![]() |
0286b3b411 | ||
![]() |
5655a3ffbf | ||
![]() |
9794cf831b |
2
Makefile
2
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=0.1
|
||||
VERSION=0.4
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
prefix = /usr
|
||||
|
13
dracut
13
dracut
@@ -19,6 +19,7 @@ Creates initial ramdisk images for preloading modules
|
||||
call when building the initramfs. Modules are located
|
||||
in /usr/share/dracut/modules.d.
|
||||
-o, --omit [LIST] Omit a space-separated list of dracut modules.
|
||||
-a, --add [LIST] Add a space-separated list of dracut modules.
|
||||
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
|
||||
include in the initramfs.
|
||||
-h, --help This message
|
||||
@@ -45,6 +46,7 @@ while (($# > 0)); do
|
||||
-f|--force) force=yes;;
|
||||
-m|--modules) dracutmodules_l="$2"; shift;;
|
||||
-o|--omit) omit_dracutmodules_l="$2"; shift;;
|
||||
-a|--add) add_dracutmodules_l="$2"; shift;;
|
||||
-d|--drivers) drivers_l="$2"; shift;;
|
||||
-h|--help) usage; exit 1 ;;
|
||||
--debug) debug="yes";;
|
||||
@@ -59,6 +61,8 @@ while (($# > 0)); do
|
||||
shift
|
||||
done
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
|
||||
|
||||
[[ $debug ]] && {
|
||||
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
|
||||
set -x
|
||||
@@ -73,6 +77,7 @@ done
|
||||
# these options override the stuff in the config file
|
||||
[[ $dracutmodules_l ]] && dracutmodules=$dracutmodules_l
|
||||
[[ $omit_dracutmodules_l ]] && omit_dracutmodules=$omit_dracutmodules_l
|
||||
[[ $add_dracutmodules_l ]] && add_dracutmodules="$add_dracutmodules $add_dracutmodules_l"
|
||||
[[ $drivers_l ]] && drivers=$drivers_l
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
|
||||
@@ -135,9 +140,11 @@ echo $mods_to_load
|
||||
## final stuff that has to happen
|
||||
|
||||
# generate module dependencies for the initrd
|
||||
if ! /sbin/depmod -a -b "$initdir" $kernel; then
|
||||
echo "\"/sbin/depmod -a $kernel\" failed."
|
||||
exit 1
|
||||
if [ -d "$initdir/lib/modules/$kernel" ]; then
|
||||
if ! depmod -a -b "$initdir" $kernel; then
|
||||
echo "\"depmod -a $kernel\" failed."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure that library links are correct and up to date
|
||||
|
@@ -257,7 +257,9 @@ check_modules() {
|
||||
[[ $dracutmodules != all ]] && ! strstr "$dracutmodules" "$mod" && \
|
||||
continue
|
||||
strstr "$omit_dracutmodules" "$mod" && continue
|
||||
should_source_module "$moddir" || continue
|
||||
if ! strstr "$add_dracutmodules" "$mod"; then
|
||||
should_source_module "$moddir" || continue
|
||||
fi
|
||||
mods_to_load+=" $mod "
|
||||
done
|
||||
}
|
||||
@@ -305,7 +307,7 @@ instmods() {
|
||||
fi
|
||||
inst_simple "$modpath"
|
||||
done
|
||||
for fw in $(/sbin/modinfo -F firmware $mod 2>/dev/null); do
|
||||
for fw in $(modinfo -F firmware $mod 2>/dev/null); do
|
||||
if [[ -f /lib/firmware/$fw ]]; then
|
||||
inst_simple "/lib/firmware/$fw"
|
||||
else
|
||||
|
39
dracut.8
39
dracut.8
@@ -24,6 +24,9 @@ Modules are located in
|
||||
.BR \-o ", " \-\-omit " \fILIST\fR"
|
||||
omit a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR \-a ", " \-\-add " \fILIST\fR"
|
||||
add a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR \-d ", " \-\-drivers " \fILIST\fR"
|
||||
specify a space-separated list of kernel modules to include in the initramfs.
|
||||
.TP
|
||||
@@ -87,9 +90,16 @@ mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given,
|
||||
use dhcp next_server.
|
||||
NFS options can be appended with the prefix "." or ","
|
||||
.TP
|
||||
.B root=dhcp root-path=<server-ip>:<root-dir>[:<nfs-options>]
|
||||
.B root=nfs:[<server-ip>:]<root-dir>[:<nfs-options>]
|
||||
.TP
|
||||
.B root=nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]
|
||||
.TP
|
||||
.B root=dhcp
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
|
||||
options can be specified.
|
||||
root-path=<server-ip>:<root-dir>[,<nfs-options>]
|
||||
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
|
||||
root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
|
||||
.TP
|
||||
.B root=/dev/nfs nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
|
||||
\fBDeprecated!\fR kernel Documentation/filesystems/nfsroot.txt defines
|
||||
@@ -110,16 +120,18 @@ associated fields.
|
||||
|
||||
http://tools.ietf.org/html/rfc4173
|
||||
|
||||
If the root partition is not specified using \fBroot=\fR, one of the partitions found
|
||||
with label \fBROOT\fR or \fB/\fR will be used to boot from.
|
||||
.TP
|
||||
.B root=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
|
||||
e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
|
||||
.TP
|
||||
.B root=??? netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname>
|
||||
e.g. root=LABEL=ROOT netroot=root=LABEL=ROOT netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
|
||||
.B root=??? netroot=iscsi:[<servername>]:[<protocol>]:[<port>]:[<LUN>]:<targetname> ...
|
||||
multiple netroot options allow setting up multiple iscsi disks
|
||||
e.g.
|
||||
root=UUID=12424547 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
|
||||
.B not yet implemented
|
||||
.TP
|
||||
.B root=??? iscsi_initiator= iscsi_target_name= iscsi_target_ip= iscsi_target_port= iscsi_target_group= iscsi_username= iscsi_password= iscsi_in_username= iscsi_in_password=
|
||||
these variables can also be put in a file in /conf/conf.d/, which will be sourced
|
||||
|
||||
.TP
|
||||
.B root=??? iscsi_firmware
|
||||
@@ -130,7 +142,8 @@ will read the iscsi parameter from the BIOS firmware
|
||||
.B root=nbd:<server>:<port>[:<fstype>][:<mountopts>]
|
||||
mount nbd share from <server>
|
||||
.TP
|
||||
.B root=dhcp root-path=nbd:<server>:<port>[:<fstype>][:<mountopts>]
|
||||
.B root=dhcp
|
||||
with dhcp root-path=nbd:<server>:<port>[:<fstype>][:<mountopts>]
|
||||
root=dhcp alone directs initrd to look at the DHCP root-path where NBD options can be specified.
|
||||
This syntax is only usable in cases where you are directly mounting the volume as the rootfs.
|
||||
|
||||
@@ -150,10 +163,13 @@ explicit network configuration
|
||||
.SH Misc
|
||||
.TP
|
||||
.B rdblacklist=<drivername>
|
||||
TBD: do not load kernel drivername
|
||||
do not load kernel module <drivername>
|
||||
|
||||
.SH Debug
|
||||
.TP
|
||||
.B rdshell
|
||||
drop to a shell, if the imitramfs fails
|
||||
.TP
|
||||
.B rdinitdebug
|
||||
set -x for the dracut shell
|
||||
.TP
|
||||
@@ -169,13 +185,12 @@ set udev to loglevel debug
|
||||
.B rdnetdebug
|
||||
debug network scripts in dracut. Output is written to /tmp/
|
||||
|
||||
|
||||
.SH CONFIGURATION IN INITRAMFS
|
||||
.TP
|
||||
.B /conf/conf.d/
|
||||
Any files found in /conf/conf.d/ will be sourced in the initramfs to
|
||||
specify special variables.
|
||||
Command line options can override values set here.
|
||||
set initial values. Command line options will override these values
|
||||
set in the configuration files.
|
||||
|
||||
.SH AUTHORS
|
||||
.nf
|
||||
|
73
dracut.spec
73
dracut.spec
@@ -1,17 +1,22 @@
|
||||
# define gittag 2c02c831
|
||||
%define replace_mkinitrd 0
|
||||
%define with_switch_root 0
|
||||
Name: dracut
|
||||
Version: 0.1
|
||||
%if 0%{?fedora} < 12
|
||||
%define with_switch_root 1
|
||||
%else
|
||||
%define with_switch_root 1
|
||||
%endif
|
||||
|
||||
%if %{defined gittag}
|
||||
Release: 1.git%{gittag}%{?dist}
|
||||
%define rdist 1.git%{gittag}%{?dist}
|
||||
%define dashgittag -%{gittag}
|
||||
%else
|
||||
Release: 1%{?dist}
|
||||
%define rdist %{?dist}
|
||||
%endif
|
||||
|
||||
Name: dracut
|
||||
Version: 0.4
|
||||
Release: 1%{?rdist}
|
||||
Summary: Initramfs generator using udev
|
||||
Group: System Environment/Base
|
||||
License: GPLv2
|
||||
License: GPLv2+
|
||||
URL: http://apps.sourceforge.net/trac/dracut/wiki
|
||||
Source0: dracut-%{version}%{?dashgittag}.tar.bz2
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
@@ -21,17 +26,25 @@ Requires: module-init-tools
|
||||
Requires: cpio
|
||||
Requires: coreutils
|
||||
Requires: findutils
|
||||
Requires: binutils
|
||||
Requires: grep
|
||||
Requires: mktemp
|
||||
Requires: mount
|
||||
Requires: bash
|
||||
|
||||
%if 0%{?replace_mkinitrd}
|
||||
Obsoletes: mkinitrd < 7.0
|
||||
Provides: mkinitrd = 7.0
|
||||
Requires: /bin/sh
|
||||
Requires: fileutils, grep, mount, gzip, tar, mktemp >= 1.5-5, findutils
|
||||
Requires: lvm2 >= 2.02.33-9, dhclient
|
||||
Requires: filesystem >= 2.1.0, cpio, device-mapper, initscripts >= 8.63-1
|
||||
Requires: e2fsprogs >= 1.38-12, libselinux, libsepol, coreutils
|
||||
Requires: mdadm, elfutils-libelf, plymouth >= 0.7.0
|
||||
Requires: cryptsetup-luks
|
||||
%ifnarch s390 s390x
|
||||
Requires: dmraid
|
||||
Requires: kbd
|
||||
%endif
|
||||
|
||||
%if ! 0%{?with_switch_root}
|
||||
Requires: /sbin/switch_root
|
||||
BuildArch: noarch
|
||||
%endif
|
||||
|
||||
@@ -42,20 +55,21 @@ dracut is a new, event-driven initramfs infrastructure based around udev.
|
||||
%package generic
|
||||
Summary: Metapackage to build a generic initramfs
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: device-mapper
|
||||
Requires: cryptsetup-luks
|
||||
Requires: rpcbind nfs-utils
|
||||
Requires: lvm2
|
||||
Requires: iscsi-initiator-utils
|
||||
Requires: nbd
|
||||
Requires: mdadm
|
||||
Requires: net-tools iproute
|
||||
Requires: kernel-firmware
|
||||
Requires: ql2100-firmware
|
||||
Requires: ql2200-firmware
|
||||
Requires: ql23xx-firmware
|
||||
Requires: ql2400-firmware
|
||||
Requires: ql2500-firmware
|
||||
|
||||
%description generic
|
||||
This package requires everything, which is needed to build a generic
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}%{?dashgittag}
|
||||
|
||||
@@ -67,32 +81,20 @@ make
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin sysconfdir=/etc mandir=%{_mandir}
|
||||
|
||||
%if 0%{?replace_mkinitrd}
|
||||
ln -s dracut $RPM_BUILD_ROOT/sbin/mkinitrd
|
||||
ln -s dracut/dracut-functions $RPM_BUILD_ROOT/usr/libexec/initrd-functions
|
||||
%endif
|
||||
|
||||
%if ! 0%{?with_switch_root}
|
||||
rm -f $RPM_BUILD_ROOT/sbin/switch_root
|
||||
%endif
|
||||
|
||||
#mkdir -p $RPM_BUILD_ROOT/sbin
|
||||
#mv $RPM_BUILD_ROOT/%{_prefix}/lib/dracut/modules.d/99base/switch_root $RPM_BUILD_ROOT/sbin
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING
|
||||
%doc README HACKING TODO COPYING AUTHORS
|
||||
/sbin/dracut
|
||||
%if 0%{?with_switch_root}
|
||||
/sbin/switch_root
|
||||
%endif
|
||||
%if 0%{?replace_mkinitrd}
|
||||
/sbin/mkinitrd
|
||||
/usr/libexec/initrd-functions
|
||||
%endif
|
||||
%dir %{_datadir}/dracut
|
||||
%{_datadir}/dracut/dracut-functions
|
||||
%{_datadir}/dracut/modules.d
|
||||
@@ -104,6 +106,15 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%doc README.generic
|
||||
|
||||
%changelog
|
||||
* Sat Jul 04 2009 Harald Hoyer <harald@redhat.com> 0.4-1
|
||||
- version 0.4
|
||||
|
||||
* Thu Jul 02 2009 Harald Hoyer <harald@redhat.com> 0.3-1
|
||||
- version 0.3
|
||||
|
||||
* Wed Jul 01 2009 Harald Hoyer <harald@redhat.com> 0.2-1
|
||||
- version 0.2
|
||||
|
||||
* Fri Jun 19 2009 Harald Hoyer <harald@redhat.com> 0.1-1
|
||||
- first release
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
# pxelinux provides macaddr '-' separated, but we need ':'
|
||||
fix_bootif() {
|
||||
local macaddr=${1##??-}
|
||||
local macaddr=${1}
|
||||
local IFS='-'
|
||||
macaddr=$(for i in ${macaddr} ; do echo -n $i:; done)
|
||||
macaddr=${macaddr%:}
|
||||
|
@@ -1,11 +0,0 @@
|
||||
# hacky rules to try to try unlocking dm-crypt devs
|
||||
#
|
||||
# Copyright 2008, Red Hat, Inc.
|
||||
# Jeremy Katz <katzj@redhat.com>
|
||||
|
||||
|
||||
SUBSYSTEM!="block", GOTO="luks_end"
|
||||
ACTION!="add|change", GOTO="luks_end"
|
||||
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
|
||||
|
||||
LABEL="luks_end"
|
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
[[ $1 = -d ]] && echo crypt
|
||||
[[ -x /sbin/plymouthd && -x /bin/plymouth && ! /usr/sbin/plymouth-set-default-theme ]]
|
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b /dev/mapper/$2 ] || exec /bin/plymouth ask-for-password --command="/sbin/cryptsetup luksOpen -T1 $1 $2"
|
||||
|
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
. "$moddir"/plymouth-populate-initrd
|
||||
inst_hook pre-udev 10 "$moddir"/plymouth-start.sh
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_rules "$moddir/63-luks.rules"
|
||||
inst "$moddir"/cryptroot-ask.sh /lib/udev/cryptroot-ask
|
||||
inst cryptsetup
|
||||
|
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --newroot=$NEWROOT
|
||||
|
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
if ldd /sbin/plymouthd |grep -q lib64; then
|
||||
LIBDIR="/usr/lib64"
|
||||
else
|
||||
LIBDIR="/usr/lib"
|
||||
fi
|
||||
PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
|
||||
PLYMOUTH_PLUGIN_NAME=$(plymouth-set-default-plugin)
|
||||
|
||||
inst /sbin/plymouthd /bin/plymouthd
|
||||
dracut_install /bin/plymouth "${LIBDIR}/plymouth/text.so" \
|
||||
"${LIBDIR}/plymouth/details.so" "${PLYMOUTH_LOGO_FILE}" \
|
||||
/etc/system-release "${LIBDIR}/plymouth/${PLYMOUTH_PLUGIN_NAME:=text}.so"
|
||||
mkdir -p "${initdir}/usr/share/plymouth"
|
||||
|
||||
[[ -f ${LIBDIR}/plymouth/default.so ]] && inst ${LIBDIR}/plymouth/default.so
|
||||
|
||||
if [[ -d /usr/share/plymouth/${PLYMOUTH_PLUGIN_NAME} ]]; then
|
||||
for x in "/usr/share/plymouth/${PLYMOUTH_PLUGIN_NAME}"/* ; do
|
||||
[[ -f "$x" ]] || break
|
||||
inst $x
|
||||
done
|
||||
fi
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -c /dev/null ] || mknod /dev/null c 1 3
|
||||
mknod /dev/zero c 1 5
|
||||
mknod /dev/systty c 4 0
|
||||
mknod /dev/tty c 5 0
|
||||
[ -c /dev/console ] || mknod /dev/console c 5 1
|
||||
[ -c /dev/ptmx ] || mknod /dev/ptmx c 5 2
|
||||
mknod /dev/fb c 29 0
|
||||
mknod /dev/tty0 c 4 0
|
||||
mknod /dev/tty1 c 4 1
|
||||
mknod /dev/tty2 c 4 2
|
||||
mknod /dev/tty3 c 4 3
|
||||
mknod /dev/tty4 c 4 4
|
||||
mknod /dev/tty5 c 4 5
|
||||
mknod /dev/tty6 c 4 6
|
||||
mknod /dev/tty7 c 4 7
|
||||
mknod /dev/tty8 c 4 8
|
||||
mknod /dev/tty9 c 4 9
|
||||
mknod /dev/tty10 c 4 10
|
||||
mknod /dev/tty11 c 4 11
|
||||
mknod /dev/tty12 c 4 12
|
||||
mknod /dev/ttyS0 c 4 64
|
||||
mknod /dev/ttyS1 c 4 65
|
||||
mknod /dev/ttyS2 c 4 66
|
||||
mknod /dev/ttyS3 c 4 67
|
||||
/lib/udev/console_init tty0
|
||||
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --show-splash
|
||||
|
@@ -7,6 +7,6 @@
|
||||
SUBSYSTEM!="block", GOTO="luks_end"
|
||||
ACTION!="add|change", GOTO="luks_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
|
||||
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue --onetime /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
|
||||
|
||||
LABEL="luks_end"
|
||||
|
@@ -1,4 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -b /dev/mapper/$2 ] || exec /bin/plymouth ask-for-password --command="/sbin/cryptsetup luksOpen -T1 $1 $2"
|
||||
# do not ask, if we already have root
|
||||
[ -f /sysroot/proc ] && exit 0
|
||||
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
|
||||
# we already asked for this device
|
||||
[ -f /tmp/cryptroot-asked-$2 ] && exit 0
|
||||
|
||||
# flock against other interactive activities
|
||||
{ flock -s 9;
|
||||
/bin/plymouth ask-for-password --prompt "$1 is password protected" --command="/sbin/cryptsetup luksOpen -T1 $1 $2"
|
||||
} 9>/.console.lock
|
||||
|
||||
# mark device as asked
|
||||
>> /tmp/cryptroot-asked-$2
|
||||
|
||||
exit 0
|
||||
|
||||
|
@@ -7,6 +7,6 @@
|
||||
SUBSYSTEM!="block", GOTO="luks_end"
|
||||
ACTION!="add|change", GOTO="luks_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
|
||||
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue --onetime /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
|
||||
|
||||
LABEL="luks_end"
|
||||
|
@@ -1,7 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
# do not ask, if we already have root
|
||||
[ -f /sysroot/proc ] && exit 0
|
||||
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
|
||||
# we already asked for this device
|
||||
[ -f /tmp/cryptroot-asked-$2 ] && exit 0
|
||||
|
||||
# flock against other interactive activities
|
||||
{ flock -s 9;
|
||||
/sbin/cryptsetup luksOpen -T1 $1 $2 </dev/console >/dev/console 2>&1
|
||||
echo -n "$1 is password protected "
|
||||
/sbin/cryptsetup luksOpen -T1 $1 $2
|
||||
} 9>/.console.lock
|
||||
|
||||
# mark device as asked
|
||||
>> /tmp/cryptroot-asked-$2
|
||||
|
||||
exit 0
|
12
modules.d/90dmraid/61-dmraid.rules
Normal file
12
modules.d/90dmraid/61-dmraid.rules
Normal file
@@ -0,0 +1,12 @@
|
||||
# This file causes block devices with Linux RAID (mdadm) signatures to
|
||||
# automatically cause mdadm to be run.
|
||||
# See udev(8) for syntax
|
||||
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="*_raid_member", RUN+="/sbin/initqueue /sbin/dmraid_scan \$0"
|
||||
|
||||
LABEL="dm_end"
|
9
modules.d/90dmraid/dmraid.sh
Normal file → Executable file
9
modules.d/90dmraid/dmraid.sh
Normal file → Executable file
@@ -1,3 +1,8 @@
|
||||
dmraid -ay
|
||||
udevadm settle --timeout=30 >/dev/null 2>&1
|
||||
#!/bin/sh
|
||||
|
||||
if udevadm settle --timeout=0 >/dev/null 2>&1; then
|
||||
# run dmraid if udev has settled
|
||||
dmraid -ay -Z
|
||||
[ -e "$job" ] && rm -f "$job"
|
||||
fi
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
dracut_install dmraid
|
||||
inst_hook pre-mount 10 "$moddir/dmraid.sh"
|
||||
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
|
||||
inst_rules 64-md-raid.rules
|
||||
inst_rules "$moddir/61-dmraid.rules"
|
||||
|
@@ -1,7 +1,13 @@
|
||||
#!/bin/bash
|
||||
# FIXME: hard-coded module list of doom.
|
||||
[[ $drivers ]] || drivers="=block sd_mod =fs"
|
||||
if [ -z "$drivers" ]; then
|
||||
drivers="sd_mod =fs"
|
||||
# Include block controller drivers
|
||||
for modname in $(find "/lib/modules/$kernel/kernel/drivers" -name '*.ko'); do
|
||||
if nm -uPA $modname | egrep -q 'ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register'; then
|
||||
drivers="${drivers} $modname"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
instmods $drivers
|
||||
|
||||
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
|
||||
dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf')
|
||||
|
4
modules.d/95debug/check
Executable file
4
modules.d/95debug/check
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
# do not add this module by default
|
||||
exit 1
|
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
dracut_install ln ps grep more dmesg cat rm strace free showmount
|
||||
dracut_install ln ps grep more cat rm strace free showmount
|
||||
dracut_install ping netstat rpcinfo
|
||||
|
@@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
dracut_install umount
|
||||
inst iscsistart
|
||||
inst hostname
|
||||
inst iscsi-iname
|
||||
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
|
||||
inst "$moddir/iscsiroot" "/sbin/iscsiroot"
|
||||
inst "$moddir/mount-lun.sh" "/bin/mount-lun.sh"
|
||||
instmods iscsi_tcp crc32c
|
||||
|
@@ -114,17 +114,15 @@ if [ -z $iscsi_initiator ]; then
|
||||
iscsi_initiator=$(iscsi-iname)
|
||||
fi
|
||||
|
||||
if [ -z $iscsi_lun ]; then
|
||||
iscsi_lun=0
|
||||
fi
|
||||
|
||||
echo "InitiatorName='$iscsi_initiator'" > /dev/.initiatorname.iscsi
|
||||
|
||||
# FIXME $iscsi_lun?? $iscsi_protocol??
|
||||
# FIXME $iscsi_protocol??
|
||||
|
||||
# if root does not specify a block device
|
||||
# we set a fallback to recognize any filesystems labeled
|
||||
# LABEL=/ or LABEL=ROOT
|
||||
if [ "${root#block:*}" = "$root" ]; then
|
||||
( root="block:/dev/disk/by-label/\x2f" . /pre-udev/30-block-genrules.sh )
|
||||
( root="block:/dev/disk/by-label/ROOT" . /pre-udev/30-block-genrules.sh )
|
||||
fi
|
||||
echo "iscsi_lun=$iscsi_lun . /bin/mount-lun.sh " > /mount/01-$$-iscsi.sh
|
||||
|
||||
iscsistart -i $iscsi_initiator -t $iscsi_target_name \
|
||||
-g $iscsi_target_group -a $iscsi_target_ip \
|
||||
@@ -132,7 +130,7 @@ iscsistart -i $iscsi_initiator -t $iscsi_target_name \
|
||||
${iscsi_username+-u $iscsi_username} \
|
||||
${iscsi_password+-w $iscsi_password} \
|
||||
${iscsi_in_username+-U $iscsi_in_username} \
|
||||
${iscsi_in_password+-W $iscsi_in_password}
|
||||
${iscsi_in_password+-W $iscsi_in_password} || exit 1
|
||||
|
||||
# now we have a root filesystem somewhere in /dev/sda*
|
||||
# let the normal block handler handle root=
|
||||
|
14
modules.d/95iscsi/mount-lun.sh
Executable file
14
modules.d/95iscsi/mount-lun.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
if [ -z $iscsi_lun ]; then
|
||||
iscsi_lun=0
|
||||
fi
|
||||
NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
|
||||
for disk in /dev/disk/by-path/*-iscsi-*-$iscsi_lun; do
|
||||
if mount -t ${fstype:-auto} -o "$rflags" $disk $NEWROOT; then
|
||||
if [ ! -d /sysroot/proc ]; then
|
||||
umount $disk
|
||||
continue
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
@@ -93,9 +93,10 @@ done
|
||||
# If we didn't get a root= on the command line, then we need to
|
||||
# add the udev rules for mounting the nbd0 device
|
||||
if [ ! -e /etc/udev/rules.d/99-mount.rules ]; then
|
||||
printf 'KERNEL=="%s", RUN+="/bin/mount -t %s -o %s %s %s"\n' \
|
||||
nbd0 "$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
|
||||
> /etc/udev/rules.d/99-mount.rules
|
||||
printf 'KERNEL=="nbd0", SYMLINK+="root"\n'> /etc/udev/rules.d/99-mount.rules
|
||||
printf '/bin/mount -t %s -o %s %s %s\n' \
|
||||
"$nbdfstype" "$fsopts" /dev/nbd0 "$NEWROOT" \
|
||||
> /mount/01-$$-nbd.sh
|
||||
fi
|
||||
|
||||
nbd-client $preopts "$nbdserver" "$nbdport" /dev/nbd0 $opts || exit 1
|
||||
|
@@ -4,10 +4,6 @@
|
||||
# root=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
|
||||
# [root=*] netroot=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
|
||||
#
|
||||
# Legacy formats:
|
||||
# [net]root=[nbd] nbdroot=srv,port
|
||||
# [net]root=[nbd] nbdroot=srv:port[:fstype[:rootflags[:nbdopts]]]
|
||||
#
|
||||
# nbdopts is a comma seperated list of options to give to nbd-client
|
||||
#
|
||||
# root= takes precedence over netroot= if root=nbd[...]
|
||||
@@ -32,7 +28,6 @@ netroot_to_var() {
|
||||
# This script is sourced, so root should be set. But let's be paranoid
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
[ -z "$nbdroot" ] && nbdroot=$(getarg nbdroot=)
|
||||
|
||||
# Root takes precedence over netroot
|
||||
if [ "${root%%:*}" = "nbd" ] ; then
|
||||
@@ -43,26 +38,6 @@ if [ "${root%%:*}" = "nbd" ] ; then
|
||||
netroot=$root
|
||||
fi
|
||||
|
||||
# If it's not empty or nbd we don't continue
|
||||
[ -z "$netroot" ] || [ "${netroot%%:*}" = "nbd" ] || return
|
||||
|
||||
if [ -n "$nbdroot" ] ; then
|
||||
[ -z "$netroot" ] && netroot=$root
|
||||
|
||||
# Debian legacy style contains no ':' Converting is easy
|
||||
[ "$nbdroot" = "${nbdroot##*:}" ] && nbdroot=${nbdroot%,*}:${nbdroot#*,}
|
||||
|
||||
# @deprecated
|
||||
warn "Argument nbdroot is deprecated and might be removed in a future release. See http://apps.sourceforge.net/trac/dracut/wiki/commandline for more information."
|
||||
|
||||
# Accept nbdroot argument?
|
||||
[ -z "$netroot" ] || [ "$netroot" = "nbd" ] || \
|
||||
die "Argument nbdroot only accepted for empty root= or [net]root=nbd"
|
||||
|
||||
# Override netroot with nbdroot content?
|
||||
[ -z "$netroot" ] || [ "$netroot" = "nbd" ] && netroot=nbd:$nbdroot
|
||||
fi
|
||||
|
||||
# If it's not nbd we don't continue
|
||||
[ "${netroot%%:*}" = "nbd" ] || return
|
||||
|
||||
|
@@ -63,20 +63,12 @@ netif="$1"
|
||||
root="$2"
|
||||
NEWROOT="$3"
|
||||
|
||||
# If it's not nfs we don't continue
|
||||
# Continue if nfs prefix
|
||||
case "${root%%:*}" in
|
||||
nfs|nfs4);;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# Ugly: root=nfs[4] requires dhcp root-path
|
||||
if [ "$root" = "nfs" ] || [ "$root" = "nfs4" ] ; then
|
||||
# No need to check if the file exists. ip cmdline parser takes care of this
|
||||
. /tmp/dhclient.$netif.dhcpopts
|
||||
[ -z "$new_root_path" ] && die "Required dhcp option root-path not available"
|
||||
root=$root:$new_root_path
|
||||
fi
|
||||
|
||||
root_to_var $root
|
||||
|
||||
#Load other data that might provide info
|
||||
@@ -87,8 +79,8 @@ root_to_var $root
|
||||
#already takes care of nfs:... formatted root-path
|
||||
[ -z "$path" ] && root_to_var $nfs:$new_root_path
|
||||
|
||||
#Empty path defaults to "/tftpboot/%s"
|
||||
[ -z "$path" ] && path="/tftpboot/%s"
|
||||
#Empty path defaults to "/tftpboot/%s" only in nfsroot.txt legacy mode
|
||||
[ -z "$path" ] && [ "$(getarg root=)" = "/dev/nfs" ] && path="/tftpboot/%s"
|
||||
|
||||
if [ -z "$server" ] ; then
|
||||
# XXX new_dhcp_next_server is unconfirmed this is an assumption
|
||||
@@ -150,14 +142,16 @@ if [ "$nfs" = "nfs4" ]; then
|
||||
[ -z "$(pidof rpc.idmapd)" ] && rpc.idmapd
|
||||
|
||||
# XXX Should we loop here?
|
||||
exec mount -t nfs4 -o$options${nfslock+,$nfslock} \
|
||||
$server:$path $NEWROOT
|
||||
mount -t nfs4 -o$options${nfslock+,$nfslock} \
|
||||
$server:$path $NEWROOT \
|
||||
&& { [ -e /dev/root ] || >/dev/root ; }
|
||||
else
|
||||
# NFSv{2,3} doesn't support using locks as it requires a helper to transfer
|
||||
# the rpcbind state to the new root
|
||||
[ "$nfslock" = "lock" ] && \
|
||||
warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
|
||||
|
||||
# XXX Should we loop here?
|
||||
mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT \
|
||||
&& { [ -e /dev/root ] || >/dev/root ; }
|
||||
fi
|
||||
|
||||
# NFSv{2,3} doesn't support using locks as it requires a helper to transfer
|
||||
# the rpcbind state to the new root
|
||||
[ "$nfslock" = "lock" ] && \
|
||||
warn "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
|
||||
|
||||
# XXX Should we loop here?
|
||||
exec mount -t nfs -o$options${options:+,}nolock $server:$path $NEWROOT
|
||||
|
@@ -2,15 +2,15 @@
|
||||
#
|
||||
# Preferred format:
|
||||
# root=nfs[4]:[server:]path[:options]
|
||||
# [root=*] netroot=nfs[4]:[server:]path[:options]
|
||||
#
|
||||
# Legacy formats:
|
||||
# [net]root=[[/dev/]nfs[4]] nfsroot=[server:]path[,options]
|
||||
# [net]root=[[/dev/]nfs[4]] nfsroot=[server:]path[:options]
|
||||
# This syntax can come from DHCP root-path as well.
|
||||
#
|
||||
# If the 'nfsroot' parameter is not given on the command line or is empty,
|
||||
# the dhcp root-path is used as [server:]path[:options] or the default
|
||||
# "/tftpboot/%s" will be used.
|
||||
# Legacy format:
|
||||
# root=/dev/nfs nfsroot=[server:]path[,options]
|
||||
#
|
||||
# In Legacy root=/dev/nfs mode, if the 'nfsroot' parameter is not given
|
||||
# on the command line or is empty, the dhcp root-path is used as
|
||||
# [server:]path[:options] or the default "/tftpboot/%s" will be used.
|
||||
#
|
||||
# If server is unspecified it will be pulled from one of the following
|
||||
# sources, in order:
|
||||
@@ -19,10 +19,8 @@
|
||||
# DHCP server-id option
|
||||
# DHCP root-path option
|
||||
#
|
||||
# NFSv4 is only used if explicitly requested; default is NFSv2 or NFSv3
|
||||
# depending on kernel configuration
|
||||
#
|
||||
# root= takes precedence over netroot= if root=nfs[...]
|
||||
# NFSv4 is only used if explicitly requested with nfs4: prefix, otherwise
|
||||
# NFSv3 is used.
|
||||
#
|
||||
|
||||
# Sadly there's no easy way to split ':' separated lines into variables
|
||||
@@ -71,45 +69,39 @@ netroot_to_var() {
|
||||
[ -z "$netroot" ] && netroot=$(getarg netroot=)
|
||||
[ -z "$nfsroot" ] && nfsroot=$(getarg nfsroot=)
|
||||
|
||||
# Handle old style <server-ip>:/<path
|
||||
# netroot= cmdline argument must be ignored, but must be used if
|
||||
# we're inside netroot to parse dhcp root-path
|
||||
if [ -n "$netroot" ] ; then
|
||||
if [ "$netroot" = "$(getarg netroot=)" ] ; then
|
||||
warn "Ignoring netroot argument for NFS"
|
||||
netroot=$root
|
||||
fi
|
||||
else
|
||||
netroot=$root;
|
||||
fi
|
||||
|
||||
# LEGACY: nfsroot= is valid only if root=/dev/nfs
|
||||
if [ -n "$nfsroot" ] ; then
|
||||
# @deprecated
|
||||
warn "Argument nfsroot is deprecated and might be removed in a future release. See http://apps.sourceforge.net/trac/dracut/wiki/commandline for more information."
|
||||
if [ "$(getarg root=)" != "/dev/nfs" ]; then
|
||||
die "Argument nfsroot only accepted for legacy root=/dev/nfs"
|
||||
fi
|
||||
netroot=nfs:$nfsroot;
|
||||
fi
|
||||
|
||||
case "$netroot" in
|
||||
/dev/nfs) netroot=nfs;;
|
||||
/dev/*) unset netroot; return;;
|
||||
# LEGACY: root=<server-ip>:/<path
|
||||
[0-9]*:/*|[0-9]*\.[0-9]*\.[0-9]*[!:]|/*)
|
||||
netroot=nfs:$netroot;;
|
||||
esac
|
||||
|
||||
# Root takes precedence over netroot
|
||||
case "${root%%:*}" in
|
||||
nfs|nfs4|/dev/nfs|/dev/nfs4)
|
||||
if [ -n "$netroot" ] ; then
|
||||
warn "root takes precedence over netroot. Ignoring netroot"
|
||||
|
||||
fi
|
||||
netroot=$root
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it's not empty or nfs we don't continue
|
||||
# Continue if nfs
|
||||
case "${netroot%%:*}" in
|
||||
''|nfs|nfs4|/dev/nfs|/dev/nfs4);;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
if [ -n "$nfsroot" ] ; then
|
||||
[ -z "$netroot" ] && netroot=$root
|
||||
|
||||
# @deprecated
|
||||
warn "Argument nfsroot is deprecated and might be removed in a future release. See http://apps.sourceforge.net/trac/dracut/wiki/commandline for more information."
|
||||
|
||||
case "$netroot" in
|
||||
''|nfs|nfs4|/dev/nfs|/dev/nfs4) netroot=${netroot:-nfs}:$nfsroot;;
|
||||
*) die "Argument nfsroot only accepted for empty root= or root=[/dev/]nfs[4]"
|
||||
esac
|
||||
fi
|
||||
|
||||
# If it's not nfs we don't continue
|
||||
case "${netroot%%:*}" in
|
||||
nfs|nfs4|/dev/nfs|/dev/nfs4);;
|
||||
*) return;;
|
||||
nfs|nfs4|/dev/nfs);;
|
||||
*) unset netroot; return;;
|
||||
esac
|
||||
|
||||
# Check required arguments
|
||||
|
@@ -1,8 +1,12 @@
|
||||
if [ "${root%%:*}" = "block" ]; then
|
||||
(
|
||||
printf 'KERNEL=="%s", RUN+="/bin/mount -t %s -o %s %s %s"\n' \
|
||||
${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
|
||||
printf 'SYMLINK=="%s", RUN+="/bin/mount -t %s -o %s %s %s"\n' \
|
||||
${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
|
||||
printf 'KERNEL=="%s", SYMLINK+="root"\n' \
|
||||
${root#block:/dev/}
|
||||
printf 'SYMLINK=="%s", SYMLINK+="root"\n' \
|
||||
${root#block:/dev/}
|
||||
) >> /etc/udev/rules.d/99-mount.rules
|
||||
(
|
||||
printf '[ -e "%s" ] && { ln -s "%s" /dev/root; rm "$job"; }\n' \
|
||||
"${root#block:}" "${root#block:}"
|
||||
) >> /initqueue/blocksymlink.sh
|
||||
fi
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
dracut_install ln
|
||||
inst_hook cmdline 95 "$moddir/parse-block.sh"
|
||||
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
||||
inst_hook mount 99 "$moddir/mount-root.sh"
|
||||
|
@@ -12,6 +12,11 @@ inst_rules 50-udev.rules 95-late.rules
|
||||
# ignore some devices in the initrd
|
||||
inst_rules "$moddir/01-ignore.rules"
|
||||
|
||||
# for firmware loading
|
||||
inst_rules 50-firmware.rules
|
||||
dracut_install /lib/udev/firmware.sh
|
||||
dracut_install cat uname
|
||||
|
||||
if [ ! -x /lib/udev/vol_id ]; then
|
||||
dracut_install blkid
|
||||
fi
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
[[ $1 = -d ]] && echo udev-rules kernel-modules
|
||||
exit 0
|
||||
[[ $1 = -d ]] && echo udev-rules
|
||||
exit 0
|
||||
|
@@ -7,18 +7,25 @@
|
||||
|
||||
emergency_shell()
|
||||
{
|
||||
source_all emergency
|
||||
exec >/dev/console 2>&1 </dev/console
|
||||
echo ; echo
|
||||
echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!"
|
||||
echo
|
||||
sh -i
|
||||
echo $@
|
||||
source_all emergency
|
||||
if getarg rdshell; then
|
||||
echo ; echo
|
||||
echo "Dropping to a shell. Good luck!"
|
||||
echo
|
||||
sh -i
|
||||
else
|
||||
while :; do sleep 1;done
|
||||
fi
|
||||
}
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export TERM=linux
|
||||
NEWROOT="/sysroot"
|
||||
|
||||
trap "emergency_shell" 0
|
||||
trap "emergency_shell Signal caught!" 0
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
@@ -27,21 +34,32 @@ mknod /dev/null c 1 3
|
||||
# mount some important things
|
||||
mount -t proc /proc /proc >/dev/null 2>&1
|
||||
mount -t sysfs /sys /sys >/dev/null 2>&1
|
||||
mount -t tmpfs -omode=0755 udev /dev >/dev/null 2>&1
|
||||
|
||||
getarg rdinitdebug && set -x
|
||||
# Make some basic devices first, let udev handle the rest
|
||||
mknod /dev/null c 1 3
|
||||
mknod /dev/ptmx c 5 2
|
||||
mknod /dev/console c 5 1
|
||||
mknod /dev/kmsg c 1 11
|
||||
if [ ! -c /dev/ptmx ]; then
|
||||
# try to mount devtmpfs
|
||||
if ! mount -t devtmpfs -omode=0755 udev /dev >/dev/null 2>&1; then
|
||||
# if it failed fall back to normal tmpfs
|
||||
mount -t tmpfs -omode=0755 udev /dev >/dev/null 2>&1
|
||||
# Make some basic devices first, let udev handle the rest
|
||||
mknod /dev/null c 1 3
|
||||
mknod /dev/ptmx c 5 2
|
||||
mknod /dev/console c 5 1
|
||||
mknod /dev/kmsg c 1 11
|
||||
fi
|
||||
fi
|
||||
|
||||
if getarg rdinitdebug; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
mkdir /dev/shm
|
||||
mkdir /dev/pts
|
||||
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1
|
||||
|
||||
UDEVVERSION=$(udevadm --version)
|
||||
|
||||
# run scriptlets to parse the command line
|
||||
getarg 'rdbreak=cmdline' && emergency_shell
|
||||
getarg 'rdbreak=cmdline' && emergency_shell "Break before cmdline"
|
||||
source_all cmdline
|
||||
|
||||
[ -z "$root" ] && die "No or empty root= argument"
|
||||
@@ -58,7 +76,7 @@ source_all cmdline
|
||||
} > /tmp/root.info
|
||||
|
||||
# pre-udev scripts run before udev starts, and are run only once.
|
||||
getarg 'rdbreak=pre-udev' && emergency_shell
|
||||
getarg 'rdbreak=pre-udev' && emergency_shell "Break before pre-udev"
|
||||
source_all pre-udev
|
||||
|
||||
# start up udev and trigger cold plugs
|
||||
@@ -70,28 +88,69 @@ source_all pre-trigger
|
||||
|
||||
# then the rest
|
||||
udevadm trigger $udevtriggeropts >/dev/null 2>&1
|
||||
udevadm settle --timeout=30 >/dev/null 2>&1
|
||||
|
||||
i=0
|
||||
while :; do
|
||||
# bail out, if we have mounted the root filesystem
|
||||
[ -d "$NEWROOT/proc" ] && break;
|
||||
|
||||
# check if root can be mounted
|
||||
[ -e /dev/root ] && break;
|
||||
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=/initqueue/work --exit-if-exists=/dev/root
|
||||
else
|
||||
udevadm settle --timeout=30
|
||||
fi
|
||||
unset queuetriggered
|
||||
if [ -f /initqueue/work ]; then
|
||||
rm /initqueue/work
|
||||
queuetriggered="1"
|
||||
fi
|
||||
|
||||
for job in /initqueue/*.sh; do
|
||||
[ -e "$job" ] || break
|
||||
job=$job . $job
|
||||
|
||||
# bail out, if we have mounted the root filesystem
|
||||
[ -d "$NEWROOT/proc" ] && break;
|
||||
# check if root can be mounted
|
||||
[ -e /dev/root ] && break;
|
||||
done
|
||||
|
||||
[ -n "$queuetriggered" ] && continue
|
||||
|
||||
if udevadm settle --timeout=0 >/dev/null 2>&1; then
|
||||
# no more udev jobs
|
||||
sleep 0.5
|
||||
i=$(($i+1))
|
||||
[ $i -gt 20 ] \
|
||||
&& { flock -s 9 ; emergency_shell "No root device found"; } 9>/.console_lock
|
||||
fi
|
||||
done
|
||||
unset job
|
||||
unset queuetriggered
|
||||
|
||||
# pre-mount happens before we try to mount the root filesystem,
|
||||
# and happens once.
|
||||
getarg 'rdbreak=pre-mount' && emergency_shell
|
||||
getarg 'rdbreak=pre-mount' && emergency_shell "Break pre-mount"
|
||||
source_all pre-mount
|
||||
getarg 'rdbreak=mount' && emergency_shell
|
||||
|
||||
|
||||
getarg 'rdbreak=mount' && emergency_shell "Break mount"
|
||||
# mount scripts actually try to mount the root filesystem, and may
|
||||
# be sourced any number of times. As soon as one suceeds, no more are sourced.
|
||||
i=0
|
||||
while :; do
|
||||
[ -d "$NEWROOT/proc" ] && break;
|
||||
|
||||
for f in /mount/*.sh; do
|
||||
[ -x "$f" ] && . "$f";
|
||||
[ "$ROOTFS_MOUNTED" ] && break;
|
||||
[ -f "$f" ] && . "$f"
|
||||
[ -d "$NEWROOT/proc" ] && break;
|
||||
done
|
||||
|
||||
sleep 0.5
|
||||
i=$(($i+1))
|
||||
{ flock -s 9 ; [ $i -gt 20 ] && emergency_shell; } 9>/.console_lock
|
||||
[ $i -gt 20 ] \
|
||||
&& { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
|
||||
done
|
||||
|
||||
# pre pivot scripts are sourced just before we switch over to the new root.
|
||||
@@ -104,13 +163,20 @@ for i in "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do
|
||||
[ -f "$NEWROOT$i" -a -x "$NEWROOT$i" ] && { INIT="$i"; break; }
|
||||
done
|
||||
[ "$INIT" ] || {
|
||||
echo "Cannot find init! Please check to make sure you passed"
|
||||
echo "a valid root filesystem! Dropping to a shell."
|
||||
echo "Cannot find init!"
|
||||
echo "Please check to make sure you passed a valid root filesystem!"
|
||||
emergency_shell
|
||||
}
|
||||
|
||||
getarg rdbreak && emergency_shell
|
||||
kill $(pidof udevd)
|
||||
|
||||
HARD=""
|
||||
while pidof udevd >/dev/null 2>&1; do
|
||||
for pid in $(pidof udevd); do
|
||||
kill $HARD $pid >/dev/null 2>&1
|
||||
done
|
||||
HARD="-9"
|
||||
done
|
||||
|
||||
# Clean up the environment
|
||||
for i in $(export -p); do
|
||||
|
12
modules.d/99base/initqueue
Executable file
12
modules.d/99base/initqueue
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$1" = "--onetime" ]; then
|
||||
onetime="yes"
|
||||
shift
|
||||
fi
|
||||
echo "$@" > /tmp/$$.sh
|
||||
if [ -n "$onetime" ]; then
|
||||
echo '[ -e "$job" ] && rm "$job"' >> /tmp/$$.sh
|
||||
fi
|
||||
mv /tmp/$$.sh /initqueue/
|
||||
>> /initqueue/work
|
@@ -1,16 +1,21 @@
|
||||
#!/bin/bash
|
||||
dracut_install mount mknod mkdir modprobe pidof sleep chroot sed ls flock cp
|
||||
dracut_install mount mknod mkdir modprobe pidof sleep chroot \
|
||||
sed ls flock cp mv dmesg rm
|
||||
if [ ! -e "${initdir}/bin/sh" ]; then
|
||||
dracut_install bash
|
||||
(ln -s bash "${initdir}/bin/sh" || :)
|
||||
fi
|
||||
# install our scripts and hooks
|
||||
inst "$moddir/init" "/init"
|
||||
inst "$moddir/initqueue" "/sbin/initqueue"
|
||||
mkdir -p ${initdir}/initqueue
|
||||
mkdir -p ${initdir}/tmp
|
||||
# Bail out if switch_root does not exist
|
||||
if which switch_root >/dev/null 2>&1; then
|
||||
dracut_install switch_root
|
||||
else
|
||||
inst "$moddir/switch_root" "/sbin/switch_root"
|
||||
inst "$moddir/switch_root" "/sbin/switch_root" \
|
||||
|| derror "Failed to install switch_root"
|
||||
fi
|
||||
inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
|
||||
inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
|
||||
|
@@ -7,9 +7,9 @@ KVERSION=${KVERSION-$(uname -r)}
|
||||
#DEBUGFAIL="rdinitdebug rdnetdebug"
|
||||
|
||||
test_run() {
|
||||
$testdir/run-qemu -hda root.ext2 -m 128M -nographic \
|
||||
$testdir/run-qemu -hda root.ext2 -m 256M -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/dracut/root rw quiet console=ttyS0,115200n81 $DEBUGFAIL" \
|
||||
-append "root=/dev/dracut/root rw quiet console=ttyS0,115200n81 rdshell $DEBUGFAIL" \
|
||||
-initrd initramfs.testing
|
||||
grep -m 1 -q dracut-root-block-success root.ext2 || return 1
|
||||
}
|
||||
@@ -38,19 +38,19 @@ test_setup() {
|
||||
initdir=overlay
|
||||
. $basedir/dracut-functions
|
||||
dracut_install sfdisk mke2fs poweroff cp umount
|
||||
inst_simple ./create-root.sh /pre-mount/01create-root.sh
|
||||
inst_simple ./create-root.sh /initqueue/01create-root.sh
|
||||
)
|
||||
|
||||
# create an initramfs that will create the target root filesystem.
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut -l -i overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block" \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \
|
||||
-d "ata_piix ext2 sd_mod" \
|
||||
-f initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf overlay
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu -hda root.ext2 -m 128M -nographic -net none \
|
||||
$testdir/run-qemu -hda root.ext2 -m 256M -nographic -net none \
|
||||
-kernel "/boot/vmlinuz-$kernel" \
|
||||
-append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81" \
|
||||
-initrd initramfs.makeroot || return 1
|
||||
@@ -63,7 +63,8 @@ test_setup() {
|
||||
inst ./cryptroot-ask /sbin/cryptroot-ask
|
||||
)
|
||||
sudo $basedir/dracut -l -i overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block" \
|
||||
-o "plymouth" \
|
||||
-a "debug" \
|
||||
-d "ata_piix ext2 sd_mod" \
|
||||
-f initramfs.testing $KVERSION || return 1
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ run_server() {
|
||||
# Start server first
|
||||
echo "NFS TEST SETUP: Starting DHCP/NFS server"
|
||||
|
||||
$testdir/run-qemu -hda server.ext2 -m 128M -nographic \
|
||||
$testdir/run-qemu -hda server.ext2 -m 256M -nographic \
|
||||
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
||||
-net socket,mcast=230.0.0.1:1234 \
|
||||
-serial udp:127.0.0.1:9999 \
|
||||
@@ -42,11 +42,11 @@ client_test() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
$testdir/run-qemu -hda client.img -m 128M -nographic \
|
||||
$testdir/run-qemu -hda client.img -m 256M -nographic \
|
||||
-net nic,macaddr=$mac,model=e1000 \
|
||||
-net socket,mcast=230.0.0.1:1234 \
|
||||
-kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
|
||||
-append "$cmdline $DEBUGFAIL rdshell ro quiet console=ttyS0,115200n81" \
|
||||
-initrd initramfs.testing
|
||||
|
||||
if [[ $? -ne 0 ]] || ! grep -m 1 -q nfs-OK client.img; then
|
||||
@@ -104,69 +104,34 @@ test_nfsv3() {
|
||||
client_test "NFSv3 root=dhcp DHCP path only" 52:54:00:12:34:00 \
|
||||
"root=dhcp" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 netroot=dhcp DHCP path only" 52:54:00:12:34:00 \
|
||||
"netroot=dhcp" 192.168.50.1 -wsize=4096 || return 1
|
||||
client_test "NFSv3 Legacy root=/dev/nfs nfsroot=IP:path" 52:54:00:12:34:01 \
|
||||
"root=/dev/nfs nfsroot=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=nfs DHCP path only" 52:54:00:12:34:00 \
|
||||
"root=nfs" 192.168.50.1 -wsize=4096 || return 1
|
||||
client_test "NFSv3 Legacy root=/dev/nfs DHCP path only" 52:54:00:12:34:00 \
|
||||
"root=/dev/nfs" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=/dev/nfs DHCP path only" 52:54:00:12:34:00 \
|
||||
"root=/dev/nfs" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 netroot=dhcp DHCP IP:path" 52:54:00:12:34:01 \
|
||||
"netroot=dhcp" 192.168.50.2 -wsize=4096 || return 1
|
||||
client_test "NFSv3 Legacy root=/dev/nfs DHCP IP:path" 52:54:00:12:34:01 \
|
||||
"root=/dev/nfs" 192.168.50.2 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=dhcp DHCP IP:path" 52:54:00:12:34:01 \
|
||||
"root=dhcp" 192.168.50.2 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=nfs DHCP IP:path" 52:54:00:12:34:01 \
|
||||
"root=nfs" 192.168.50.2 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=/dev/nfs DHCP IP:path" 52:54:00:12:34:01 \
|
||||
"root=/dev/nfs" 192.168.50.2 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:02 \
|
||||
"root=dhcp" 192.168.50.3 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 netroot=dhcp DHCP proto:IP:path:options" \
|
||||
52:54:00:12:34:03 "netroot=dhcp" 192.168.50.3 wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:03 \
|
||||
"root=dhcp" 192.168.50.3 wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 netroot=nfs:..." 52:54:00:12:34:04 \
|
||||
"netroot=nfs:192.168.50.1:/nfs/client" 192.168.50.1 \
|
||||
-wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=nfs:..." 52:54:00:12:34:04 \
|
||||
"root=nfs:192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 nfsroot=/nfs/client" 52:54:00:12:34:04 \
|
||||
"nfsroot=/nfs/client" 192.168.50.1 -wsize=4096 || return 1
|
||||
client_test "NFSv3 Legacy root=IP:path" 52:54:00:12:34:04 \
|
||||
"root=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 nfsroot=192.168.50.2:/nfs/client" 52:54:00:12:34:04 \
|
||||
"nfsroot=192.168.50.2:/nfs/client" 192.168.50.2 -wsize=4096 || return 1
|
||||
|
||||
# This test must fail: root=dhcp must ignore other arguments
|
||||
client_test "NFSv3 root=dhcp nfsroot=/nfs/client" 52:54:00:12:34:04 \
|
||||
# This test must fail: nfsroot= requires root=/dev/nfs
|
||||
client_test "NFSv3 Invalid root=dhcp nfsroot=/nfs/client" 52:54:00:12:34:04 \
|
||||
"root=dhcp nfsroot=/nfs/client" 192.168.50.1 -wsize=4096 && return 1
|
||||
|
||||
client_test "NFSv3 root=nfs nfsroot=/nfs/client" 52:54:00:12:34:04 \
|
||||
"root=nfs nfsroot=/nfs/client" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=nfs nfsroot=/nfs/%s" 52:54:00:12:34:04 \
|
||||
"root=nfs nfsroot=/nfs/%s" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=nfs nfsroot=/nfs/ip/%s no host name (use IP)" \
|
||||
52:54:00:12:34:7f \
|
||||
"root=nfs nfsroot=/nfs/ip/%s \
|
||||
ip=192.168.50.101:192.168.50.1::255.255.255.0::eth0:off" \
|
||||
192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=nfs nfsroot=/nfs/client,wsize=4096" \
|
||||
52:54:00:12:34:04 "root=nfs nfsroot=/nfs/client,wsize=4096" \
|
||||
192.168.50.1 wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv3 root=dhcp DHCP path,options" \
|
||||
52:54:00:12:34:05 "root=dhcp" 192.168.50.1 wsize=4096 || return 1
|
||||
|
||||
@@ -182,70 +147,16 @@ test_nfsv4() {
|
||||
# server, so put these later in the list to avoid a pause when doing
|
||||
# switch_root
|
||||
|
||||
client_test "NFSv4 netroot=nfs4 DHCP path only" 52:54:00:12:34:80 \
|
||||
"netroot=nfs4" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=nfs4 DHCP path only" 52:54:00:12:34:80 \
|
||||
"root=nfs4" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=/dev/nfs4 DHCP path only" 52:54:00:12:34:80 \
|
||||
"root=/dev/nfs4" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 netroot=nfs4 DHCP IP:path" 52:54:00:12:34:81 \
|
||||
"netroot=nfs4" 192.168.50.2 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=nfs4 DHCP IP:path" 52:54:00:12:34:81 \
|
||||
"root=nfs4" 192.168.50.2 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=/dev/nfs4 DHCP IP:path" 52:54:00:12:34:81 \
|
||||
"root=/dev/nfs4" 192.168.50.2 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 netroot=dhcp DHCP proto:IP:path" 52:54:00:12:34:82 \
|
||||
"netroot=dhcp" 192.168.50.3 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=dhcp DHCP proto:IP:path" 52:54:00:12:34:82 \
|
||||
"root=dhcp" 192.168.50.3 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 netroot=dhcp DHCP proto:IP:path:options" \
|
||||
52:54:00:12:34:83 "netroot=dhcp" 192.168.50.3 wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=dhcp DHCP proto:IP:path:options" 52:54:00:12:34:83 \
|
||||
"root=dhcp" 192.168.50.3 wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 netroot=nfs4:..." 52:54:00:12:34:84 \
|
||||
"netroot=nfs4:192.168.50.1:/client" 192.168.50.1 \
|
||||
-wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=nfs4:..." 52:54:00:12:34:84 \
|
||||
"root=nfs4:192.168.50.1:/client" 192.168.50.1 \
|
||||
-wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=nfs4 nfsroot=/client" 52:54:00:12:34:84 \
|
||||
"root=nfs4 nfsroot=/client" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=nfs4 nfsroot=192.168.50.2:/client" \
|
||||
52:54:00:12:34:84 "root=nfs4 nfsroot=192.168.50.2:/client" \
|
||||
192.168.50.2 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=nfs4 nfsroot=path,opts" \
|
||||
52:54:00:12:34:84 "root=nfs4 nfsroot=/client,wsize=4096" \
|
||||
192.168.50.1 wsize=4096 || return 1
|
||||
|
||||
# These two only work with NFSv4 in the test suite -- NFSv3 needs
|
||||
# a /nfs prefix due to our server configuration
|
||||
|
||||
client_test "NFSv4 netroot=nfs4" 52:54:00:12:34:84 \
|
||||
"netroot=nfs4" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=nfs4" 52:54:00:12:34:84 \
|
||||
"root=nfs4" 192.168.50.1 -wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=nfs4 DHCP path,options" \
|
||||
52:54:00:12:34:85 "root=nfs4" 192.168.50.1 wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=nfs4 DHCP IP:path,options" \
|
||||
52:54:00:12:34:86 "root=nfs4" 192.168.50.2 wsize=4096 || return 1
|
||||
|
||||
client_test "NFSv4 root=dhcp DHCP proto:IP:path,options" \
|
||||
52:54:00:12:34:87 "root=dhcp" 192.168.50.3 wsize=4096 || return 1
|
||||
}
|
||||
@@ -359,13 +270,14 @@ test_setup() {
|
||||
|
||||
# Make server's dracut image
|
||||
$basedir/dracut -l -i overlay / \
|
||||
-m "dash udev-rules base rootfs-block debug" \
|
||||
-m "dash udev-rules base rootfs-block debug kernel-modules" \
|
||||
-d "ata_piix ext2 sd_mod e1000" \
|
||||
-f initramfs.server $KVERSION || return 1
|
||||
|
||||
# Make client's dracut image
|
||||
$basedir/dracut -l -i overlay / \
|
||||
-m "dash udev-rules base network nfs debug" \
|
||||
-o "plymouth" \
|
||||
-a "debug" \
|
||||
-d "e1000 nfs sunrpc" \
|
||||
-f initramfs.testing $KVERSION || return 1
|
||||
}
|
||||
|
@@ -4,27 +4,9 @@ for x in 63-luks.rules 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
|
||||
> "/etc/udev/rules.d/$x"
|
||||
done
|
||||
udevadm control --reload-rules
|
||||
# save a partition at the beginning for future flagging purposes
|
||||
sfdisk -C 640 -H 2 -S 32 -L /dev/sda <<EOF
|
||||
,,
|
||||
EOF
|
||||
#mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda2 /dev/sda3 /dev/sda4
|
||||
# wait for the array to finish initailizing, otherwise this sometimes fails
|
||||
# randomly.
|
||||
#mdadm -W /dev/md0
|
||||
#echo -n test >keyfile
|
||||
#cryptsetup -q luksFormat /dev/sda1 /keyfile
|
||||
#echo "The passphrase is test"
|
||||
#cryptsetup luksOpen /dev/sda1 dracut_crypt_test </keyfile && \
|
||||
#lvm pvcreate -ff -y /dev/mapper/dracut_crypt_test && \
|
||||
#lvm vgcreate dracut /dev/mapper/dracut_crypt_test && \
|
||||
#lvm pvcreate -ff -y /dev/sda1 && \
|
||||
#lvm vgcreate dracut /dev/sda1 && \
|
||||
#lvm lvcreate -l 100%FREE -n root dracut && \
|
||||
#lvm vgchange -ay && \
|
||||
mke2fs -L ROOT /dev/sda1 && \
|
||||
mke2fs -F /dev/sda && \
|
||||
mkdir -p /sysroot && \
|
||||
mount /dev/sda1 /sysroot && \
|
||||
mount /dev/sda /sysroot && \
|
||||
cp -a -t /sysroot /source/* && \
|
||||
umount /sysroot && \
|
||||
echo "dracut-root-block-created" >/dev/sdb
|
||||
|
@@ -3,15 +3,15 @@ TEST_DESCRIPTION="root filesystem over iSCSI"
|
||||
|
||||
KVERSION=${KVERSION-$(uname -r)}
|
||||
|
||||
#DEBUGFAIL="rdinitdebug rdnetdebug rdudevinfo"
|
||||
#DEBUGFAIL="rdinitdebug rdnetdebug"
|
||||
|
||||
run_server() {
|
||||
# Start server first
|
||||
echo "iSCSI TEST SETUP: Starting DHCP/iSCSI server"
|
||||
|
||||
$testdir/run-qemu -hda server.ext2 -hdb root.ext2 -m 128M -nographic \
|
||||
$testdir/run-qemu -hda server.ext2 -hdb root.ext2 -m 256M -nographic \
|
||||
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
||||
-net socket,mcast=230.0.0.1:1234 \
|
||||
-net socket,mcast=230.0.0.1:1235 \
|
||||
-serial udp:127.0.0.1:9999 \
|
||||
-kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/sda rw quiet console=ttyS0,115200n81" \
|
||||
@@ -33,11 +33,11 @@ run_client() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
$testdir/run-qemu -hda client.img -m 128M -nographic \
|
||||
$testdir/run-qemu -hda client.img -m 256M -nographic \
|
||||
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
|
||||
-net socket,mcast=230.0.0.1:1234 \
|
||||
-net socket,mcast=230.0.0.1:1235 \
|
||||
-kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=dhcp rw quiet console=ttyS0,115200n81 $DEBUGFAIL" \
|
||||
-append "root=dhcp rw quiet console=ttyS0,115200n81 rdshell $DEBUGFAIL" \
|
||||
-initrd initramfs.testing
|
||||
grep -m 1 -q iscsi-OK client.img || return 1
|
||||
}
|
||||
@@ -81,14 +81,14 @@ test_setup() {
|
||||
initdir=overlay
|
||||
. $basedir/dracut-functions
|
||||
dracut_install sfdisk mke2fs poweroff cp umount
|
||||
inst_simple ./create-root.sh /pre-mount/01create-root.sh
|
||||
inst_simple ./create-root.sh /initqueue/01create-root.sh
|
||||
)
|
||||
|
||||
# create an initramfs that will create the target root filesystem.
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut -l -i overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block" \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \
|
||||
-d "ata_piix ext2 sd_mod" \
|
||||
-f initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf overlay
|
||||
@@ -100,7 +100,7 @@ test_setup() {
|
||||
return 1
|
||||
fi
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu -hda root.ext2 -hdb client.img -m 128M -nographic -net none \
|
||||
$testdir/run-qemu -hda root.ext2 -hdb client.img -m 256M -nographic -net none \
|
||||
-kernel "/boot/vmlinuz-$kernel" \
|
||||
-append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81" \
|
||||
-initrd initramfs.makeroot || return 1
|
||||
@@ -113,9 +113,9 @@ test_setup() {
|
||||
inst_simple ./hard-off.sh /emergency/01hard-off.sh
|
||||
# inst ./cryptroot-ask /sbin/cryptroot-ask
|
||||
)
|
||||
# -m "debug dash crypt lvm mdraid udev-rules base rootfs-block iscsi" \
|
||||
sudo $basedir/dracut -l -i overlay / \
|
||||
-m "debug dash udev-rules base rootfs-block iscsi" \
|
||||
-o "plymouth dmraid" \
|
||||
-a "debug" \
|
||||
-d "ata_piix ext2 sd_mod" \
|
||||
-f initramfs.testing $KVERSION || return 1
|
||||
|
||||
|
@@ -4,16 +4,16 @@ TEST_DESCRIPTION="root filesystem on NBD"
|
||||
KVERSION=${KVERSION-$(uname -r)}
|
||||
|
||||
# Uncomment this to debug failures
|
||||
#DEBUGFAIL="rdinitdebug rdnetdebug rdbreak"
|
||||
#DEBUGFAIL="rdinitdebug rdnetdebug"
|
||||
|
||||
run_server() {
|
||||
# Start server first
|
||||
echo "NBD TEST SETUP: Starting DHCP/NBD server"
|
||||
|
||||
$testdir/run-qemu -hda server.ext2 -hdb nbd.ext2 -hdc encrypted.ext2 \
|
||||
-m 128M -nographic \
|
||||
-m 256M -nographic \
|
||||
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
|
||||
-net socket,mcast=230.0.0.1:1234 \
|
||||
-net socket,mcast=230.0.0.1:1236 \
|
||||
-serial udp:127.0.0.1:9999 \
|
||||
-kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/sda rw quiet console=ttyS0,115200n81" \
|
||||
@@ -46,11 +46,11 @@ client_test() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
$testdir/run-qemu -hda flag.img -m 128M -nographic \
|
||||
$testdir/run-qemu -hda flag.img -m 256M -nographic \
|
||||
-net nic,macaddr=$mac,model=e1000 \
|
||||
-net socket,mcast=230.0.0.1:1234 \
|
||||
-net socket,mcast=230.0.0.1:1236 \
|
||||
-kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
|
||||
-append "$cmdline $DEBUGFAIL rdshell ro quiet console=ttyS0,115200n81" \
|
||||
-initrd initramfs.testing
|
||||
|
||||
if [[ $? -ne 0 ]] || ! grep -m 1 -q nbd-OK flag.img; then
|
||||
@@ -120,22 +120,6 @@ test_run() {
|
||||
"root=nbd:192.168.50.1:2000:ext2:errors=panic:bs=2048" \
|
||||
ext2 errors=panic || return 1
|
||||
|
||||
# Check legacy parsing
|
||||
|
||||
client_test "NBD root=nbd nbdroot=srv:port" 52:54:00:12:34:00 \
|
||||
"root=nbd nbdroot=192.168.50.1:2000" || return 1
|
||||
|
||||
# This test must fail: root=dhcp ignores nbdroot
|
||||
client_test "NBD root=dhcp nbdroot=srv:port" 52:54:00:12:34:00 \
|
||||
"root=dhcp nbdroot=192.168.50.1:2000" && return 1
|
||||
|
||||
client_test "NBD root=nbd nbdroot=srv,port" 52:54:00:12:34:00 \
|
||||
"root=nbd nbdroot=192.168.50.1,2000" || return 1
|
||||
|
||||
# This test must fail: root=dhcp ignores nbdroot
|
||||
client_test "NBD root=dhcp nbdroot=srv,port" 52:54:00:12:34:00 \
|
||||
"root=dhcp nbdroot=192.168.50.1,2000" && return 1
|
||||
|
||||
# DHCP root-path parsing
|
||||
|
||||
client_test "NBD root=dhcp DHCP root-path nbd:srv:port" 52:54:00:12:34:01 \
|
||||
@@ -200,20 +184,20 @@ make_encrypted_root() {
|
||||
initdir=overlay
|
||||
. $basedir/dracut-functions
|
||||
dracut_install mke2fs poweroff cp umount
|
||||
inst_simple ./create-root.sh /pre-mount/01create-root.sh
|
||||
inst_simple ./create-root.sh /initqueue/01create-root.sh
|
||||
)
|
||||
|
||||
# create an initramfs that will create the target root filesystem.
|
||||
# We do it this way so that we do not risk trashing the host mdraid
|
||||
# devices, volume groups, encrypted partitions, etc.
|
||||
$basedir/dracut -l -i overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block" \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \
|
||||
-d "ata_piix ext2 sd_mod" \
|
||||
-f initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf overlay
|
||||
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu -hda flag.img -hdb encrypted.ext2 -m 128M \
|
||||
$testdir/run-qemu -hda flag.img -hdb encrypted.ext2 -m 256M \
|
||||
-nographic -net none \
|
||||
-kernel "/boot/vmlinuz-$kernel" \
|
||||
-append "root=/dev/dracut/root rw quiet console=ttyS0,115200n81" \
|
||||
@@ -303,12 +287,13 @@ test_setup() {
|
||||
)
|
||||
|
||||
sudo $basedir/dracut -l -i overlay / \
|
||||
-m "dash udev-rules rootfs-block base debug" \
|
||||
-m "dash udev-rules rootfs-block base debug kernel-modules" \
|
||||
-d "ata_piix ext2 sd_mod e1000" \
|
||||
-f initramfs.server $KVERSION || return 1
|
||||
|
||||
sudo $basedir/dracut -l -i overlay / \
|
||||
-m "dash crypt lvm mdraid udev-rules base rootfs-block nbd debug" \
|
||||
-o "plymouth" \
|
||||
-a "debug" \
|
||||
-d "ata_piix ext2 ext3 sd_mod e1000" \
|
||||
-f initramfs.testing $KVERSION || return 1
|
||||
}
|
||||
|
Reference in New Issue
Block a user