Compare commits

..

27 Commits
0.6 ... 0.7

Author SHA1 Message Date
Harald Hoyer
21007cb6ec version 0.7 2009-07-25 11:09:35 +02:00
Harald Hoyer
31f7db66a8 strip binaries in initramfs
--strip
              strip binaries in the initramfs (default)

       --nostrip
              do not strip binaries in the initramfs
2009-07-25 11:09:35 +02:00
Harald Hoyer
4f18fe8296 dracut/dracut-gencmdline: fixed copyright header 2009-07-25 11:09:35 +02:00
Harald Hoyer
5494f08cc5 add dracut-catimages
Usage: ./dracut-catimages [OPTION]... <initramfs> <base image>
[<image>...]
Creates initial ramdisk image by concatenating several images from the
command
line and /boot/dracut/

  -f, --force           Overwrite existing initramfs file.
  -i, --imagedir        Directory with additional images to add
                        (default: /boot/dracut/)
  -o, --overlaydir      Overlay directory, which contains files that
                        will be used to create an additional image
  --nooverlay           Do not use the overlay directory
  --noimagedir          Do not use the additional image directory
  -h, --help            This message
  --debug               Output debug information of the build process
  -v, --verbose         Verbose output during the build process
2009-07-25 11:09:35 +02:00
Harald Hoyer
c1a37d928f dracut-lib: getarg(), getargs() read command line also from /etc/cmdline
Also honor parameters in /etc/cmdline.

getarg(): If the argument is first fround in /proc/cmdline, then it is
used
2009-07-25 11:09:35 +02:00
Harald Hoyer
0375106c78 add source_conf for static configuration variables
source_conf sources all *.conf files of a directory

init will now source all /etc/conf.d/*.conf files
2009-07-25 11:09:34 +02:00
Harald Hoyer
2b9dfbbeae dracut: usage(): break line for 80 chars 2009-07-25 11:09:34 +02:00
Warren Togami
47b5c0f290 With NFS root, it is possible /tmp/net.ifaces might not exist during pre-pivot.
- udevadm settle will wait for it if necessary.
- Move write-ifcfg.sh later during pre-pivot to reduce likelihood of settling being necessary.
2009-07-24 15:26:33 -04:00
Harald Hoyer
4e6d8fd691 dracut.8: correct manpage entry for ip= 2009-07-24 12:06:12 +02:00
Harald Hoyer
34a369ed2d dracut.8: corrections of parameters and fixed typos 2009-07-24 11:54:08 +02:00
Harald Hoyer
3e6d2b31ea removed all direct references to /proc/cmdline
use getarg() and getargs() from /lib/dracut-lib.sh instead of
reinventing the wheel
2009-07-24 11:54:08 +02:00
Harald Hoyer
13beb248bc dracut: print help for unknow options 2009-07-24 11:54:08 +02:00
Harald Hoyer
b03edf372f 40network/parse-bridge: add bridge to $initrdargs 2009-07-24 11:54:08 +02:00
David Dillow
e663608c40 dash compatible substitution 2009-07-23 23:16:31 -04:00
Warren Togami
ef380e9de8 Turns out this is really a misconfigured DHCP server, apply the same workaround as Debian and upstream dhclient-script. 2009-07-23 16:22:00 -04:00
Warren Togami
39f3a51d65 Fix multiple search domains with proper quoting (thanks dcbw)
Otherwise \032 appears instead of spaces.
2009-07-23 14:31:58 -04:00
Harald Hoyer
4809126378 99base/init: fix argument stripping 2009-07-23 18:57:20 +02:00
Harald Hoyer
6c4b24afb0 nfsroot-cleanup: don't try to read from nonexistant /tmp/nfs.rpc_pipefs_path 2009-07-23 18:27:33 +02:00
Harald Hoyer
c1b2cc48d6 40network/check: source dracut-functions over exported variable 2009-07-23 18:20:11 +02:00
Michael Ploujnikov
fdb3d52d59 use a variable to hold the regex
single quote regexps in variables to make it work with bash-3.1
2009-07-23 15:33:40 +02:00
Michael Ploujnikov
d726d811f1 fix spelling use the modules.d directory name 2009-07-23 15:21:18 +02:00
Marc Grimme
2fe2945869 nfsroot-cleanup: make /var/lib/nfs/rpc_pipefs path configurable
/tmp/nfs.rpc_pipefs_path can contain the path where
/var/lib/nfs/rpc_pipefs will be moved before switch_root.

This is useful if /var is a separate partition in the real root.
2009-07-23 12:19:54 +02:00
Marc Grimme
f016dccc89 95debug: optionally install the debug tools 2009-07-23 12:19:17 +02:00
Marc Grimme
c993cfb32f 40network/check: output which binary is missing for the network module 2009-07-23 12:17:57 +02:00
Marc Grimme
9aaf7c3a33 dracut_install: add "-o" option
Calling dracut_install will optionally install the file. This is useful
for the debug module.
2009-07-23 12:15:54 +02:00
Harald Hoyer
0e77eb3782 dmraid/mdraid: only try to delete partition 1-1024
add "--nr 1-1024" to partx, otherwise partx will try to delete
partitions 1-INT_MAX, which takes a long time.
2009-07-23 11:58:24 +02:00
Harald Hoyer
93ce0a7a1c 95s390: add support to boot from s390 dasds
command line parameter:

DASD
       dasd=....
              same syntax as the kernel module parameter (s390 only)
2009-07-22 16:35:49 +02:00
28 changed files with 346 additions and 71 deletions

View File

@@ -1,4 +1,4 @@
VERSION=0.6
VERSION=0.7
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
prefix = /usr
@@ -23,6 +23,7 @@ install:
mkdir -p $(DESTDIR)$(mandir)/man8
install -m 0755 dracut $(DESTDIR)$(sbindir)/dracut
install -m 0755 dracut-gencmdline $(DESTDIR)$(sbindir)/dracut-gencmdline
install -m 0755 dracut-catimages $(DESTDIR)$(sbindir)/dracut-catimages
install -m 0755 modules.d/99base/switch_root $(DESTDIR)$(sbindir)/switch_root
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions

2
README
View File

@@ -21,7 +21,7 @@ as hooks are guaranteed to be the path to slow-down.
Most of the initrd generation functionality in dracut is provided by a bunch
of generator modules that are sourced by the main dracut script to install
specific functionality into the initrd. They live in the modules subdirectory,
specific functionality into the initrd. They live in the modules.d subdirectory,
and use functionality provided by dracut-functions to do their work.
Some general rules for writing modules:
* Use one of the inst family of functions to actually install files

View File

@@ -16,7 +16,7 @@ dracut_install_dir/modules.d/
it easy for an earlier module to override the functionality of a
later module, so that you can have a distro or system specific
module override or modify the functionality of a generic module
without having to patch the mode generic module.
without having to patch the more generic module.
install: dracut sources this script to install the functionality that a
module implements onto the initrd. For the most part, this amounts

56
dracut
View File

@@ -5,8 +5,21 @@
# of the various mkinitrd implementations out there
#
# Copyright 2008, Red Hat, Inc. Jeremy Katz <katzj@redhat.com>
# GPLv2 header here
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
usage() {
@@ -22,11 +35,14 @@ Creates initial ramdisk images for preloading 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.
-k, --kmoddir [DIR] Specify the directory, where to look for kernel modules
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
modules
--fwdir [DIR] Specify additional directories, where to look for
firmwares, separated by :
--kernel-only Only install kernel drivers and firmware files
--no-kernel Do not install kernel drivers and firmware files
--strip Strip binaries in the initramfs (default)
--nostrip Do not strip binaries in the initramfs
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
@@ -57,6 +73,8 @@ while (($# > 0)); do
--fwdir) fw_dir_l="$2"; shift;;
--kernel-only) kernel_only="yes"; nokernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
@@ -65,6 +83,7 @@ while (($# > 0)); do
-H|--hostonly) hostonly="-h" ;;
-i|--include) include_src="$2"; include_target="$3"; shift 2;;
-I|--install) install_items="$2"; shift;;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
esac
shift
@@ -90,8 +109,10 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
[[ $drivers_l ]] && drivers=$drivers_l
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $fw_dir_l ]] && fw_dir=$fw_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $fw_dir ]] || fw_dir=/lib/firmware
[[ $do_strip ]] || do_strip=yes
[[ $allowlocal && -f "$(dirname $0)/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=$dracutbasedir
@@ -188,6 +209,35 @@ unset item
[[ "$beverbose" = "yes" ]] && (du -c "$initdir" | sort -n)
# strip binaries
if [ "$do_strip" = "yes" ] ; then
for p in strip objdump sed grep find; do
if ! which $p >/dev/null 2>&1; then
derror "Could not find '$p'. You should run $0 with '--nostrip'."
do_strip=no
fi
done
fi
if [ "$do_strip" = "yes" ] ; then
for f in $(find "$initdir" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; |
grep -v ' shared object,' |
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do
dinfo "Stripping $f"
strip -g "$f" || :
#
# FIXME: only strip -g for now
#
#strip -g --strip-unneeded "$f" || :
#note="-R .note"
#if objdump -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
# grep -q ALLOC; then
# note=
#fi
#strip -R .comment $note "$f" || :
done
fi
( cd "$initdir"; find . |cpio -H newc -o |gzip -9 > "$outfile"; )
[[ "$beverbose" = "yes" ]] && ls -lh "$outfile"

124
dracut-catimages Executable file
View File

@@ -0,0 +1,124 @@
#!/bin/bash --norc
# Copyright 2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
dwarning() {
echo "Warning: $@" >&2
}
dinfo() {
[[ $beverbose ]] && echo "$@" >&2
}
derror() {
echo "Error: $@" >&2
}
usage() {
# 80x25 linebreak here ^
echo "Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
Creates initial ramdisk image by concatenating several images from the command
line and /boot/dracut/
-f, --force Overwrite existing initramfs file.
-i, --imagedir Directory with additional images to add
(default: /boot/dracut/)
-o, --overlaydir Overlay directory, which contains files that
will be used to create an additional image
--nooverlay Do not use the overlay directory
--noimagedir Do not use the additional image directory
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
"
}
imagedir=/boot/dracut/
overlay=/var/lib/dracut/overlay
while (($# > 0)); do
case $1 in
-f|--force) force=yes;;
-i|--imagedir) imagedir=$2;shift;;
-o|--overlaydir) overlay=$2;shift;;
--nooverlay) no_overlay=yes;shift;;
--noimagedir) no_imagedir=yes;shift;;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
esac
shift
done
outfile=$1; shift
if [ -z "$outfile" ]; then
derror "No output file specified."
usage
exit 1
fi
baseimage=$1; shift
if [ -z "$baseimage" ]; then
derror "No base image specified."
usage
exit 1
fi
if [ -f $outfile -a -z "$force" ]; then
derror "Will not override existing initramfs ($outfile) without --force"
exit 1
fi
if [ -z "$no_imagedir" -a ! -d "$imagedir" ]; then
derror "Image directory $overlay is not a directory"
exit 1
fi
if [ -z "$no_overlay" -a ! -d "$overlay" ]; then
derror "Overlay $overlay is not a directory"
exit 1
fi
if [ -z "$no_overlay" ]; then
ofile="$imagedir/90-overlay.img"
dinfo "Creating image $ofile from directory $overlay"
( cd "$overlay"; find . |cpio --quiet -H newc -o |gzip -9 > "$ofile"; )
fi
if [ -z "$no_imagedir" ]; then
images=$(for i in $imagedir/*.img;do [ -f $i ] || continue; echo $i; done)
fi
images="$images $@"
dinfo "Using base image $baseimage"
cat $baseimage > $outfile
for i in $images; do
dinfo "Appending $i"
cat $i >> $outfile
done
dinfo "Created $outfile"
exit 0

View File

@@ -107,11 +107,13 @@ inst_binary() {
derror "dracut cannot create an initrd."
exit 1
fi
[[ $line =~ ([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*) ]] || continue
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
[[ $line =~ $so_regex ]] || continue
FILE=${BASH_REMATCH[1]}
[[ -f ${initdir}$FILE ]] && continue
# see if we are loading an optimized version of a shared lib.
if [[ $FILE =~ ^(/lib[^/]*).* ]]; then
lib_regex='^(/lib[^/]*).*'
if [[ $FILE =~ $lib_regex ]]; then
TLIBDIR=${BASH_REMATCH[1]}
BASE="${FILE##*/}"
# prefer nosegneg libs, then unoptimized ones.
@@ -137,7 +139,8 @@ inst_script() {
read -r -n 80 line <"$1"
# If debug is set, clean unprintable chars to prevent messing up the term
[[ $debug ]] && line=$(echo -n "$line" | tr -c -d '[:print:][:space:]')
[[ $line =~ (#! *)(/[^ ]+).* ]] || return 1
shebang_regex='(#! *)(/[^ ]+).*'
[[ $line =~ $shebang_regex ]] || return 1
inst "${BASH_REMATCH[2]}" && inst_simple "$@"
}
@@ -200,12 +203,25 @@ inst_hook() {
}
dracut_install() {
local optional=
while (($# > 0)); do
# Might be nice to optionally install a binary
if [ "$1" == "-o" ]; then
optional="yes"
shift
continue
fi
if inst "$1" ; then
shift
continue
fi
derror "Failed to install $1"; exit 1
if [ "$optional" == "yes" ]; then
dwarning "Skipping program $1 as it cannot be found and is flagged to be optional"
shift
continue
else
derror "Failed to install $1"; exit 1
fi
done
}

View File

@@ -1,7 +1,6 @@
#!/bin/bash --norc
#
#
# Copyright 2005-2008 Red Hat, Inc. All rights reserved.
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@@ -30,10 +30,10 @@ add a space-separated list of dracut modules.
.BR \-d ", " \-\-drivers " \fILIST\fR"
specify a space-separated list of kernel modules to include in the initramfs.
.TP
.BR \-k ", " \-\-kmoddir " \fI[DIR]\fR
.BR \-k ", " \-\-kmoddir " \fI{DIR}\fR
specify the directory, where to look for kernel modules
.TP
.BR " \-\-fwdir " \fI[DIR]\fR
.BR " \-\-fwdir " \fI{DIR}\fR
specify additional directory, where to look for firmwares
.TP
.BR \-\-kernel-only
@@ -42,6 +42,12 @@ only install kernel drivers and firmware files
.BR \-\-no-kernel
do not install kernel drivers and firmware files
.TP
.BR \-\-strip
strip binaries in the initramfs (default)
.TP
.BR \-\-nostrip
do not strip binaries in the initramfs
.TP
.BR \-h ", " \-\-help
display help text and exit.
.TP
@@ -151,6 +157,11 @@ disable DM RAID detection
.B rd_DM_UUID=<dmraid uuid>
only activate the raid sets with the given UUID
.SH DASD
.TP
.B dasd=....
same syntax as the kernel module parameter (s390 only)
.SH DHCP
.TP
.B root=dhcp
@@ -224,13 +235,13 @@ This syntax is only usable in cases where you are directly mounting the volume a
.TP bootdev=<interface>
.B specify the network interface to boot from
.TP
.B ip=[dhcp|on|any]
.B ip={dhcp|on|any}
get ip from dhcp server from all interfaces. If root=dhcp, loop sequentially through all interfaces (eth0, eth1, ...) and use the first with a valid DHCP root-path.
.TP
.B ip=<interface>:[dhcp|on|any]
.B ip=<interface>:{dhcp|on|any}
get ip from dhcp server on a specific interface
.TP
.B ip=<client-IP-number>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|]
.B ip=<client-IP-number>:[<server-id>]:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{none|off}
explicit network configuration
.SH Misc
@@ -241,13 +252,16 @@ do not load kernel module <drivername>
.SH Debug
.TP
.B rdshell
drop to a shell, if the imitramfs fails
allow dropping to a shell, if root mounting fails
.TP
.B rdinitdebug
set -x for the dracut shell
.TP
.B rdbreak=[pre-udev|pre-mount|mount|pre-pivot|]
drop the shell on defined breakpoint
.B rdbreak
drop to a shell at the end
.TP
.B rdbreak={pre-udev|pre-mount|mount|pre-pivot|commandline|initqueue}
drop to a shell on defined breakpoint
.TP
.B rdudevinfo
set udev to loglevel info

View File

@@ -12,7 +12,7 @@
%endif
Name: dracut
Version: 0.6
Version: 0.7
Release: 1%{?rdist}
Summary: Initramfs generator using udev
Group: System Environment/Base
@@ -38,6 +38,7 @@ 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
Requires: bridge-utils
%ifnarch s390 s390x
Requires: dmraid
Requires: kbd
@@ -52,21 +53,20 @@ BuildArch: noarch
dracut is a new, event-driven initramfs infrastructure based around udev.
%package generic
Summary: Metapackage to build a generic initramfs
Summary: Metapackage to build a generic initramfs with dracut
Requires: %{name} = %{version}-%{release}
Requires: rpcbind nfs-utils
Requires: iscsi-initiator-utils
Requires: nbd
Requires: bridge-utils
Requires: net-tools iproute
Requires: plymouth-system-theme plymouth-theme-charge plymouth-theme-solar
%description generic
This package requires everything which is needed to build a generic
all purpose initramfs.
all purpose initramfs with dracut.
%package kernel
Summary: Metapackage to build generic initramfs with only kernel modules
Summary: Metapackage to build generic initramfs with dracut with only kernel modules
Requires: %{name} = %{version}-%{release}
Requires: ql2100-firmware
Requires: ql2200-firmware
@@ -78,6 +78,18 @@ Requires: ql2500-firmware
This package requires everything which is needed to build a initramfs with all
kernel modules and firmware files needed by dracut modules.
%package tools
Summary: dracut tools to build the local initramfs
Requires: %{name} = %{version}-%{release}
Requires: ql2100-firmware
Requires: ql2200-firmware
Requires: ql23xx-firmware
Requires: ql2400-firmware
Requires: ql2500-firmware
%description tools
This package contains tools to assemble the local initrd and host configuration.
%prep
%setup -q -n %{name}-%{version}%{?dashgittag}
@@ -93,6 +105,9 @@ make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin sysconfdir=/etc mandir=%{_man
rm -f $RPM_BUILD_ROOT/sbin/switch_root
%endif
mkdir -p $RPM_BUILD_ROOT/boot/dracut
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
%clean
rm -rf $RPM_BUILD_ROOT
@@ -100,7 +115,6 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root,0755)
%doc README HACKING TODO COPYING AUTHORS
/sbin/dracut
/sbin/dracut-gencmdline
%if 0%{?with_switch_root}
/sbin/switch_root
%endif
@@ -118,8 +132,20 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root,0755)
%doc README.kernel
%files tools
%defattr(-,root,root,0755)
%doc COPYING
/sbin/dracut-gencmdline
/sbin/dracut-catimages
%dir /boot/dracut
%dir /var/lib/dracut
%dir /var/lib/dracut/overlay
%changelog
* Wed Jul 22 2009 Harald Hoyer harald@redhat.com 0.6-1
* Fri Jul 24 2009 Harald Hoyer <harald@redhat.com> 0.7-1
- version 0.7
* Wed Jul 22 2009 Harald Hoyer <harald@redhat.com> 0.6-1
- version 0.6
* Fri Jul 17 2009 Harald Hoyer <harald@redhat.com> 0.5-1

View File

@@ -1,4 +1,19 @@
#!/bin/sh
which ip dhclient hostname brctl >/dev/null 2>&1 || exit 1
. $dracutfunctions
for program in ip hostname; do
which $program >/dev/null 2>&1
if [ $? -ne 0 ]; then
dwarning "Could not find program \"$program\" required by network."
exit 1
fi
done
for program in dhclient brctl; do
which $program >/dev/null 2>&1
if [ $? -ne 0 ]; then
dwarning "Could not find program \"$program\" it might be required by network."
fi
done
exit 255

View File

@@ -7,7 +7,7 @@ setup_interface() {
bcast=$new_broadcast_address
gw=${new_routers%%,*}
domain=$new_domain_name
search=$new_domain_search
search=$(printf "$new_domain_search")
namesrv=$new_domain_name_servers
hostname=$new_host_name
@@ -23,7 +23,7 @@ setup_interface() {
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
[ -n "${search}${domain}" ] && echo search $search $domain > /tmp/net.$netif.resolv.conf
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s

View File

@@ -100,10 +100,8 @@ ip=$(getarg ip)
# Specific configuration, spin through the kernel command line
# looking for ip= lines
[ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
for p in $CMDLINE; do
[ -n "${p%ip=*}" ] && continue
ip_to_var ${p#ip=}
for p in $(getargs ip=); do
ip_to_var $p
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue

View File

@@ -12,6 +12,6 @@ inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
# TODO ifcfg config style is redhat specific, this should probably
# go into its own module at one time
inst_hook pre-pivot 20 "$moddir/write-ifcfg.sh"
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
mkdir -p "${initdir}/var/run"

View File

@@ -37,6 +37,7 @@ unset bridgename ethname
# Parse bridge for bridgename and ethname
if getarg bridge >/dev/null; then
initrdargs="$initrdargs bridge"
# Read bridge= parameters if they exist
bridge="$(getarg bridge=)"
if [ ! "$bridge" = "bridge" ]; then

View File

@@ -52,10 +52,9 @@ fi
# Count ip= lines to decide whether we need bootdev= or not
if [ -z "$NEEDBOOTDEV" ] ; then
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
local count=0
for p in $CMDLINE; do
[ "${p%%=*}" = "ip" ] && count=$(( $count + 1 ))
for p in $(getargs ip=); do
count=$(( $count + 1 ))
done
[ $count -gt 1 ] && NEEDBOOTDEV=1
fi
@@ -68,11 +67,8 @@ fi
# Check ip= lines
# XXX Would be nice if we could errorcheck ip addresses here as well
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
for p in $CMDLINE; do
[ -n "${p%ip=*}" ] && continue
ip_to_var ${p#ip=}
for p in $(getargs ip=); do
ip_to_var $p
# We need to have an ip= line for the specified bootdev
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
@@ -85,28 +81,28 @@ for p in $CMDLINE; do
# Error checking for autoconf in combination with other values
case $autoconf in
error) die "Error parsing option '$p'";;
error) die "Error parsing option 'ip=$p'";;
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
none|off) \
[ -z "$ip" ] && \
die "For argument '$p'\nValue '$autoconf' without static configuration does not make sense"
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
[ -z "$mask" ] && \
die "Sorry, automatic calculation of netmask is not yet supported"
;;
dhcp|on|any) \
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
die "Sorry, '$p' does not make sense for multiple interface configurations"
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
[ -n "$ip" ] && \
die "For argument '$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
;;
*) die "For argument '$p'\nSorry, unknown value '$autoconf'";;
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
esac
if [ -n "$dev" ] ; then
# We don't like duplicate device configs
if [ -n "$IFACES" ] ; then
for i in $IFACES ; do
[ "$dev" = "$i" ] && die "For argument '$p'\nDuplication configurations for '$dev'"
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
done
fi
# IFACES list for later use

View File

@@ -1,5 +1,7 @@
#!/bin/sh
# NFS root might have reached here before /tmp/net.ifaces was written
udevadm settle --timeout=30
# Don't write anything if we don't know our bootdev
[ -f /tmp/net.ifaces ] || return 1

View File

@@ -14,6 +14,6 @@ TEST=="/tmp/.dmraid_scan-%k", GOTO="dm_end"
RUN+="/bin/sh -c '>/tmp/.dmraid_scan-%k; /bin/ln -fs /sbin/dmraid_scan /initqueue/dmraid_scan.sh'"
ENV{DEVTYPE}!="partition", \
RUN+="/sbin/partx -d $env{DEVNAME}"
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
LABEL="dm_end"

View File

@@ -16,7 +16,7 @@ IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
LABEL="do_md_inc"
ENV{DEVTYPE}!="partition", \
RUN+="/sbin/partx -d $env{DEVNAME}"
RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"
RUN+="/sbin/mdadm -I --no-degraded $env{DEVNAME}"

View File

@@ -1,3 +1,3 @@
#!/bin/bash
dracut_install ps grep more cat rm strace free showmount
dracut_install ping netstat rpcinfo
dracut_install -o ps grep more cat rm strace free showmount
dracut_install -o ping netstat rpcinfo

View File

@@ -30,10 +30,7 @@ fi
netif="$1"
root="$2"
# read static conf settings
for conf in conf/conf.d/*; do
[ -f ${conf} ] && . ${conf}
done
source_all /etc/conf.d
# If it's not iscsi we don't continue
[ "${root%%:*}" = "iscsi" ] || exit 1

View File

@@ -1,3 +1,6 @@
[ -f /tmp/nfs.rpc_pipefs_path ] && rpcpipefspath=`cat /tmp/nfs.rpc_pipefs_path`
[ -z "$rpcpipefspath" ] && rpcpipefspath=var/lib/nfs/rpc_pipefs
pid=$(pidof rpc.statd)
[ -n "$pid" ] && kill $pid
@@ -9,10 +12,10 @@ pid=$(pidof rpcbind)
if incol2 /proc/mounts /var/lib/nfs/rpc_pipefs; then
# try to create the destination directory
[ -d $NEWROOT/var/lib/nfs/rpc_pipefs ] || mkdir -p $NEWROOT/var/lib/nfs/rpc_pipefs 2>/dev/null
[ -d $NEWROOT/$rpcpipefspath ] || mkdir -p $NEWROOT/$rpcpipefspath 2>/dev/null
if [ -d $NEWROOT/var/lib/nfs/rpc_pipefs ]; then
mount --move /var/lib/nfs/rpc_pipefs $NEWROOT/var/lib/nfs/rpc_pipefs
if [ -d $NEWROOT/$rpcpipefspath ]; then
mount --move /var/lib/nfs/rpc_pipefs $NEWROOT/$rpcpipefspath
else
umount /var/lib/nfs/rpc_pipefs
fi

5
modules.d/95s390/check Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
arch=$(arch)
[ "$arch" = "s390" -o "$arch" = "s390x" ] || exit 1
exit 0

3
modules.d/95s390/install Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
inst_hook cmdline 30 "$moddir/parse-s390.sh"

5
modules.d/95s390/installkernel Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
instmods dasd_mod dasd_eckd_mod dasd_fba_mod \
zfcp

9
modules.d/95s390/parse-s390.sh Executable file
View File

@@ -0,0 +1,9 @@
initrdargs="$initrdargs dasd"
[ -d /etc/modprobe.d ] || mkdir /etc/modprobe.d
dasd_arg=$(getarg dasd=)
if [ -n "$dasd_arg" ]; then
echo "option dasd_mod dasd=$dasd_arg" >> /etc/modprobe.d/dasd.conf
fi
unset dasd_arg

View File

@@ -1,6 +1,10 @@
getarg() {
local o line
[ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
if [ -z "$CMDLINE" ]; then
read CMDLINE_ETC </etc/cmdline;
read CMDLINE </proc/cmdline;
CMDLINE="$CMDLINE $CMDLINE_ETC"
fi
for o in $CMDLINE; do
[ "$o" = "$1" ] && return 0
[ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; return 0; }
@@ -10,7 +14,11 @@ getarg() {
getargs() {
local o line found
[ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
if [ -z "$CMDLINE" ]; then
read CMDLINE_ETC </etc/cmdline;
read CMDLINE </proc/cmdline;
CMDLINE="$CMDLINE $CMDLINE_ETC"
fi
for o in $CMDLINE; do
[ "$o" = "$1" ] && return 0
if [ "${o%%=*}" = "${1%=}" ]; then
@@ -28,6 +36,12 @@ source_all() {
for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done
}
source_conf() {
local f
[ "$1" ] && [ -d "/$1" ] || return
for f in "/$1"/*.conf; do [ -f "$f" ] && . "$f"; done
}
die() {
{
echo "<1>dracut: FATAL: $@";

View File

@@ -59,6 +59,8 @@ mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1
UDEVVERSION=$(udevadm --version)
source_conf /etc/conf.d
# run scriptlets to parse the command line
getarg 'rdbreak=cmdline' && emergency_shell "Break before cmdline"
source_all cmdline
@@ -210,7 +212,7 @@ initrdargs="$initrdargs console BOOT_IMAGE rdbreak rdinitdebug rdudevinfo rdudev
for x in "$@"; do
for s in $initrdargs; do
[ "${x%%=*}" = $s ] && continue 1
[ "${x%%=*}" = $s ] && continue 2
done
initargs="$initargs $x"
done

View File

@@ -1,10 +1,5 @@
#!/bin/sh
if getarg rdblacklist= >/dev/null ; then
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
for p in $CMDLINE; do
[ -n "${p%rdblacklist=*}" ] && continue
echo "blacklist ${p#rdblacklist=}" >> /etc/modprobe.d/initramfsblacklist.conf
done
fi
for p in $(getargs rdblacklist=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
done