Compare commits

...

214 Commits
RHEL-7 ... 037

Author SHA1 Message Date
Harald Hoyer
96087189e6 NEWS: update for 037 2014-03-19 17:16:08 +01:00
Harald Hoyer
51160a47b1 systemd/dracut-shutdown.service: make failure non-fatal 2014-03-18 13:33:55 +01:00
Harald Hoyer
68dc90c6e9 shutdown: if kexec failed, do a simple reboot 2014-03-18 13:21:22 +01:00
Harald Hoyer
a9d30a4066 network:dhclient-script do PREINIT6 for DHCP6 2014-03-17 13:00:17 +01:00
Harald Hoyer
0cb42c27f9 lvm:lvm_scan.sh handle one LV at a time with lvchange 2014-03-11 12:16:14 +01:00
Harald Hoyer
2bdf760fe0 NEWS: update for dracut-037 2014-03-06 09:55:19 +01:00
Harald Hoyer
ce4167060c AUTHORS: update 2014-03-06 09:55:19 +01:00
Harald Hoyer
ee4b74fb9c Do not wait_for_dev if hostonly_cmdline not set 2014-03-06 09:55:19 +01:00
Harald Hoyer
f60b7d8655 fcoe-up: remove initlog logic 2014-03-05 13:21:25 +01:00
Harald Hoyer
99edb47e85 default conf: set hostonly_cmdline == "no" 2014-03-05 12:33:40 +01:00
Harald Hoyer
8ee1825364 dracut: don't let devices timeout
https://bugzilla.redhat.com/show_bug.cgi?id=949697
2014-03-05 12:32:10 +01:00
Harald Hoyer
83a3cba777 dracut-functions.sh: degrade info about missing binaries to info 2014-03-05 12:23:49 +01:00
Alexander Tsoy
cd501ff74b udev-rules: add 80-net-setup-link.rules and .link files
With systemd >= 209 these file are required for predictable network interface
names
2014-03-05 10:40:22 +01:00
WANG Chao
646e0506f6 Add -[-no]-hostonly-cmdline option handling for getopt
commit ab9457e introduce such new options but it missed to add these
options to getopt arguments.

Signed-off-by: WANG Chao <chaowang@redhat.com>
2014-03-03 12:41:28 +01:00
Harald Hoyer
3a62030116 test/TEST-50-MULTINIC/client-init.sh: skip MAC marker files 2014-02-28 13:26:13 +01:00
Harald Hoyer
be1c0381e5 test/Makefile: add SKIP env to skip certain tests 2014-02-28 13:25:39 +01:00
Harald Hoyer
6fe0abbf12 test: add missing Makefile.testdir 2014-02-28 12:57:57 +01:00
Dave Young
5f6a495bf4 add default values in fstab_lines
It's useful for passing a full fstab line including like fs_passno so fsck
can take effect.

Previously it's assumed that there's no fs_freq and fs_passno in fstab lines
so original code just append "0 0" at the end of each fstab lines.

Improve this issue by assign default value in case they are not passed in.
Three field are handled here:
fs_mntops: default to "defaults"
fs_freq: default to "0"
fs_passno: default to "2"

Signed-off-by: Dave Young <dyoung@redhat.com>
2014-02-28 12:10:47 +01:00
Harald Hoyer
1f680ccc9b systemd: add systemd-sysctl service
https://bugzilla.redhat.com/show_bug.cgi?id=1070086
2014-02-28 12:10:45 +01:00
Harald Hoyer
43a85a7365 network: merge setup_net_$netif.ok and net.$netif.did-setup
one marker per interface is enough
2014-02-28 12:10:41 +01:00
Harald Hoyer
61b4afb424 network: IPv6 status, wait for tentative flag to be cleared
also do not arping the IPv6 address.
2014-02-27 12:13:18 +01:00
Harald Hoyer
2ac599dc75 network/dhclient-script.sh:DHCP IPv6 interface setup
configure IPv6 interface for DHCP6

https://bugzilla.redhat.com/show_bug.cgi?id=1064365
2014-02-26 15:02:51 +01:00
Harald Hoyer
7f70f81153 network/net-lib.sh:wait_for_ipv6_auto() also wait for the tentative flag
Wait until the tentative flag is cleared.

https://bugzilla.redhat.com/show_bug.cgi?id=1069263
2014-02-26 15:02:48 +01:00
Harald Hoyer
79b3c8bfa1 ifcfg/write-ifcfg.sh: do not bind s390 to MAC if SUBCHANNELS set
If SUBCHANNELS are set, do not specify HWADDR, because the SUBCHANNELS
are the identifier for the interface.

https://bugzilla.redhat.com/show_bug.cgi?id=1056438
2014-02-26 15:02:46 +01:00
Harald Hoyer
fa795f29e2 systemd/rootfs-generator.sh: generate units in /run/systemd/generator
Generate the units in /run/systemd/generator, so they are picked up by
systemd.

https://bugzilla.redhat.com/show_bug.cgi?id=1069133
https://bugzilla.redhat.com/show_bug.cgi?id=949697
2014-02-26 15:02:42 +01:00
Harald Hoyer
ab9457efd7 Add flag to toggle hostonly cmdline storing in the initramfs
--hostonly-cmdline:
    Store kernel command line arguments needed in the initramfs

--no-hostonly-cmdline:
    Do not store kernel command line arguments needed in the initramfs
2014-02-26 15:01:55 +01:00
Harald Hoyer
103c5e1ecb systemd: add 70-uaccess.rules 2014-02-26 14:56:28 +01:00
Amadeusz Żołnowski
4eec1a2276 Added missing quotes
See bug report at https://bugs.gentoo.org/show_bug.cgi?id=502064
2014-02-26 14:55:54 +01:00
Alexander Tsoy
8a2db478de Add legacy flag (-l) to lz4 and update magic number
Linux kernel does not support the new default lz4 format.

https://bugs.gentoo.org/show_bug.cgi?id=502102
2014-02-26 14:55:54 +01:00
sfalken@opensuse.org
6e53596cec Patch for Manpage
Patch corrects grub paths in the manpage for both GRUB legacy and GRUB2
2014-02-26 14:55:54 +01:00
Harald Hoyer
dc4c1ee39d dracut.sh: write directly to the output file
Because we already remove the output file before writing to it, we don't
have to play games and write to a temporary file first.
2014-02-19 15:22:39 +01:00
Harald Hoyer
d1c4e5c521 fcoe-uefi: try all FcoeBootDevice-* variables for a DevicePath
try to read the DevicePath from all FcoeBootDevice-* UEFI variables
until one has a MAC.
2014-02-19 15:20:34 +01:00
Harald Hoyer
a324c2111e iscsi: for iBFT read the initiator-name from the correct file
/sys/firmware/ibft/initiator-name should be
/sys/firmware/ibft/initiator/initiator-name

https://github.com/haraldh/dracut/issues/12
2014-02-19 11:49:34 +01:00
Harald Hoyer
e8a7c9bc93 dracut-functions.sh:find_kernel_modules_by_path() fixed updates search
"updates/*" path does not start with "/"
2014-02-17 13:29:42 +01:00
Harald Hoyer
cb802bfbc7 iscsiroot: touch the right marker file 2014-02-12 18:26:36 +01:00
Harald Hoyer
a0b2c69441 kernel-modules: add sdhci_acpi to the static list of kernel modules
Thanks Adam Williamson!

https://bugzilla.redhat.com/show_bug.cgi?id=1063556
2014-02-12 11:23:38 +01:00
Till Maas
9835859f21 Cryptroot-ask.sh: Remove duplicate code
Remove duplicate code introduced with commit
9b5e2e8574.
2014-02-10 11:02:32 +01:00
Till Maas
9b5e2e8574 Cryptroot-ask.sh: Use variables consistently
- Always use $luksname instead of sometimes $2
- define $asked_file instead of using the same path twice
2014-02-09 14:12:44 +01:00
Colin Guthrie
8da51857f0 dracut.sh: Fix variable name typo.
This caused the root_dev variable not to be set which in turn meant that
the root device was not whitelisted in 99base/module-setup.sh when injecting
compile-time devexists hooks in hostonly initrds. This ties the generated
initrd to the root fs device (typically the UUID) rather than relying solely
only the root= kernel command line.

While it is hostonly, not hardcoding e.g. UUIDs is still desirable. Any
swap partition on the host device is still added however.
2014-02-07 18:05:48 +01:00
Brian C. Lane
460cddffa1 new_dhcp_next_server is really new_next_server
The variable that dhclient sets doesn't have dhcp in the name. This
could cause problems with setups where the server is not the same as the
dhcp server.
2014-02-07 18:05:48 +01:00
Harald Hoyer
fac3275a43 network:fix dns parsing in ip= parameter 2014-02-07 15:41:50 +01:00
Harald Hoyer
30e6e809ed Factor out all the "type -V" commands
Add new functions require_binaries() and require_any_binary() to be used
in the check() section of module-setup.sh.

These functions print a warning line telling the user, which binary is
missing for the specific dracut module.

This unifies the way of checking for binaries and makes the life of an
initramfs creator easier, if he wants to find out why a specific dracut
module is not included in the initramfs.
2014-02-06 16:45:20 +01:00
Harald Hoyer
8d21728942 systemd: add sys-kernel-config.mount 2014-02-05 13:58:33 +01:00
Harald Hoyer
352d557d4d Do not reload systemd with wait_for_dev 2014-02-05 13:12:29 +01:00
Harald Hoyer
751c7de98a systemd/dracut-pre-pivot: run for /dev/{nfs,root} and cleanup /dev/nfs
dracut-pre-pivot was not cleaning up /dev/nfs and did not run to clean
up /dev/root.
2014-02-05 13:08:54 +01:00
Harald Hoyer
81aed4f28e nfs/nfsroot: symlink /dev/null to /dev/nfs, as a marker for root=/dev/nfs 2014-02-05 13:06:29 +01:00
Harald Hoyer
c84618d7ac network/ifup: do not run dhclient twice on the same interface 2014-02-04 12:02:34 +01:00
Harald Hoyer
d61a423f7c network/ifup: do not ifup an already setup network interface 2014-02-04 12:02:05 +01:00
Harald Hoyer
f52759131b test: include the same Makefile.testdir 2014-02-04 12:01:11 +01:00
Harald Hoyer
c860837303 base/rdsosreport.sh: add dracut version to rdsosreport 2014-01-31 15:33:41 +01:00
Harald Hoyer
1982098e00 network/ifup.sh: handle $dns1 and $dns2 from "ip=" settings 2014-01-30 17:38:27 +01:00
Harald Hoyer
e95e48c6ee network/net-lib.sh: parse ibft nameserver settings 2014-01-30 17:38:27 +01:00
Harald Hoyer
f57850d7e8 dracut-functions.sh: also search in the updates directory 2014-01-30 17:38:27 +01:00
Harald Hoyer
c8a9a6b4a7 dracut.sh: only set the owner of files to 0:0, if generated as non-root
If the root user generates the initramfs image, preserve the ownership
of the files. This of course cannot be done for non-root users
generating an initramfs image.
2014-01-30 16:18:04 +01:00
Harald Hoyer
66bfe863f5 network: understand ip=.....:<dns1>:<dns2> 2014-01-30 13:50:02 +01:00
Harald Hoyer
d50a99c5ce NEWS: update for version 036 2014-01-29 08:37:43 +01:00
Harald Hoyer
a7316ae4f7 skipcpio: fixed signatured check 2014-01-29 08:35:47 +01:00
Cristian Rodríguez
6b449e8a6d skipcpio: return something at end of program
Otherwise the compiler emits a warning and the return vale is
in theory undefined.
2014-01-29 08:32:17 +01:00
Harald Hoyer
ba9368fa4f dmsquash-live/dmsquash-liveiso-genrules.sh: s/loop0/loop-control/
If loop is a kernel module, /dev/loop0 will never show up as a udev
event, if the loop module is not manually loaded somewhere.
2014-01-28 18:33:36 +01:00
Stig Telfer
1f28dfb2e4 url-lib: extend to enable TFTP support
Libcurl has wider capabilities than those assigned to it by Dracut.
In this patch to url-lib I've added registration for TFTP URLs,
which I've found to be useful.

Enjoy,
Stig Telfer
2014-01-28 15:43:40 +01:00
Harald Hoyer
41351164f8 NEWS: dracut-035 2014-01-28 15:33:29 +01:00
Harald Hoyer
855a549660 Makefile: make dracut.html.sign depend on dracut.html 2014-01-28 15:07:21 +01:00
Harald Hoyer
5c5350b30b dracut.spec: add skipcpio 2014-01-28 12:21:33 +01:00
Stig Telfer
6cc8f694b5 dracut-lib.sh: bugfix for pidof function
In follow-up, the patch requires a second mod: kernel tasks have a /proc/.../exe that links to nothing and derails the for loop:
2014-01-28 12:19:27 +01:00
Stig Telfer
abdf191b64 dracut-lib.sh: bugfix for pidof function
It appears there is a simple substitution error in the pidof shell function which causes it to fail to find processes.  In my case, processes started by 95nfs are not terminated in the cleanup hook.  This causes knock-on effects disturbing the root filesystem service dependencies.

Enjoy,
Stig Telfer
2014-01-28 12:19:26 +01:00
Harald Hoyer
b5b31c9589 iscsi/iscsiroot.sh: beautify warning 2014-01-28 12:14:07 +01:00
Harald Hoyer
247d6d4270 network/dhclient-script.sh: set lease time
The dracut dhclient-script.sh should set address lifetimes to the DHCP
lease time, so that other stuff (like NetworkManager!) knows that the
address is temporary and was created by DHCP.

https://bugzilla.redhat.com/show_bug.cgi?id=1058519
2014-01-28 12:12:43 +01:00
Harald Hoyer
93f44f28a2 dracut-install.c: "make indent" 2014-01-24 15:31:26 +01:00
Harald Hoyer
b208aad51c lsinitrd.sh: make use of the skipcpio utility
With the skipcpio utility, the whole contents of an initramfs with an
early cpio image can be displayed.
2014-01-24 15:30:22 +01:00
Harald Hoyer
b9909e3341 dracut.sh: add early_cpio marker file to the early cpio 2014-01-24 15:29:24 +01:00
Harald Hoyer
9ea68421f6 add skipcpio utility
skipcpio skips a cpio archive at the beginning of a file.

It is used for skipping an early cpio archive for lsinitrd.
2014-01-24 15:27:51 +01:00
Harald Hoyer
8e5db363e8 dracut.sh: set file owners of early cpio files to 0:0 2014-01-24 15:27:15 +01:00
Harald Hoyer
cd08059f49 dracut.sh: create early cpio dir for acpi tables 2014-01-24 15:26:43 +01:00
Harald Hoyer
dade93b4eb Revert "dmraid: let dmraid setup the partitions"
This reverts commit fbf717086e.

dmraid seems to use "p" as a seperator by default.

Reverting to kpartx, until this is fixed.
2014-01-24 12:49:17 +01:00
Harald Hoyer
f49ec88a3f dracut.sh: s#\"#'# for error messages 2014-01-24 12:49:17 +01:00
Harald Hoyer
ae01bd1808 lsinitrd.sh: also print out the arguments used to create the initramfs 2014-01-24 12:49:17 +01:00
Hari Bathini
659dc319d9 Dracut: Add a new argument "--rebuild"
Add "rebuild" option to dracut to  append the current  arguments
to those with  which the input initramfs image was  built.  This
option helps in incrementally building initramfs for testing.

    Usage: dracut [output_file] --rebuild input_file

If optional output file  is not provided, input file provided to
rebuild will be used as output file.

This patch alters  the creation of the initramfs image by adding
the file "/tmp/params.txt" to the image. Command line parameters
excluding "--rebuild",  input  &  output image names and "kernel
version" are stored in this file.  In case "--rebuild" parameter
is specified, "/tmp/params.txt" file, if present in input image,
is read and its contents "prepend"ed to the current command line
parameters, that is if such a file is already present. Also,  it
stores the  cumulative parameters to the file "/tmp/params.txt",
in the  new image. This patch  has been tested successfully on a
PowerBox with f19. It does not alter the behaviour of any of the
existing  options.

Signed-off-by: Manik Bajpai <manibajp@linux.vnet.ibm.com>
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>

[Edited-by: Harald Hoyer]
Simplified the cpio extraction process by using 'lsinitrd'.
2014-01-24 12:49:17 +01:00
Colin Guthrie
e3469d76c7 crypt: Prevent asking for password multiple times if non-default crypt name is used.
If a non-default device mapper name is used for an encrypted partion is
used, (i.e. not luks-$UUID) due to parsing of /etc/crypttab, then the
short-circuits put in place to prevent asking the password twice do not
work.

This would not normally be an issue as the settled job itself should be
removed after it has run and thus cannot be run again. Sadly, due to
the corresponding udev rule using ACTION="add|changed", and the fact
that trying to unlock the device (whether successful or not) seems to
trigger a changed event, it means the settled job is recreated with
each itteration thus causing the whole loop to run again.

It is this situation that the short-circuit exits would normally come
into play but sadly do not work when non-standard names are used.

By the time the /tmp/cryptroot-asked-$2 file is written near the end of
the script, the value of $2 has already been lost due to the argument
parsing code's use of 'shift'. So while on systems where the default
name is used are protected by checking /dev/mapper/xxxx, the
/tmp/cryptroot-asked-$2 file didn't help on systems where this was not
used due to this bug.

So this commit shuffles things around somewhat such that:

 1. The /dev/mapper/xxxx device is checked *after* resolving $2 (which
    contains the default name) to whatever /etc/crypttab specifies.
 2. The cryptroot-asked-xxxx file also uses the translated name both
    for the initial check and to flag when it's written.

As a separate fix, it might make sense to change the udev rule to only
act on add events rather than add|change events, but I'm not sure of the
ramifications of such a change and there may be cases where the add
event is missed and thus the change event needs to be included.
2014-01-24 12:49:17 +01:00
Koen Kooi
149965bd13 dracut-initramfs-restore,lsinitrd: add LZ4 support
Dracut claims to have LZ4 support, but trying to use it will result in an xzcat failure at the end due to missing CAT support.

The lz4 command chokes on '--', so abstract that out into the CAT select.

Something similar will need to be done for LZO.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2014-01-24 12:49:16 +01:00
Koen Kooi
a76a22b779 Use builtin xz/lzma option to use all cores for multihreaded compression
This removes the dependency on 'getconf' as well, which is not installed by default on my embedded systems.

Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
2014-01-24 12:49:16 +01:00
Alexander Tsoy
64fb0900cb udev-rules: add eudev rules
eudev configured with "--enable-modules --disable-libkmod" installs
80-drivers-modprobe.rules instead of 80-drivers.rules

https://bugs.gentoo.org/show_bug.cgi?id=494188
2014-01-24 12:49:16 +01:00
Cristian Rodríguez
314929920f systemd: ensure autofs4 and ipv6 are included
Systemd tries to load this modules very early.
Even though they are not strictly required it it is a good
thing to have them around.

[Edited-by: Harald Hoyer: moved to installkernel() ]
2014-01-24 12:48:08 +01:00
Harald Hoyer
c7e15f0891 iscsi: more iscsiroot fixes
handle iscsiroot with firmware more gracefully
2014-01-22 17:40:10 +01:00
Harald Hoyer
856d659016 dracut-logger.sh: systemd-cat only understands prio 0-7 2014-01-22 11:48:45 +01:00
Harald Hoyer
80525318b7 TODO: update 2014-01-22 11:27:09 +01:00
Harald Hoyer
e2ecc2d8c6 base/dracut-lib.sh: "halt" the machine in systemd mode for die()
and only go in emergency shell if "rd.debug" is specified

https://bugzilla.redhat.com/show_bug.cgi?id=1053655
2014-01-22 11:18:47 +01:00
Harald Hoyer
b40e38db98 dracut.spec: add --without doc feature 2014-01-17 14:52:11 +01:00
Harald Hoyer
21a3aab720 iscsi: call "iscsistart -b" until it succeeds 2014-01-17 14:52:01 +01:00
Harald Hoyer
ee9938572e network: add rd.bootif=0 to ignore BOOTIF
https://bugzilla.redhat.com/show_bug.cgi?id=1044623
2014-01-17 14:52:01 +01:00
Harald Hoyer
256c91f837 systemd/module-setup.sh: make use of "ln_r" 2014-01-17 14:52:01 +01:00
Harald Hoyer
8229d06b05 systemd: add seat udev rules and mask loginctl 2014-01-17 14:52:01 +01:00
Harald Hoyer
a0cab31ab8 systemd: add 71-seat.rules 73-seat-late.rules
otherwise plymouth does not work
2014-01-17 14:52:01 +01:00
Harald Hoyer
d0d61e44be systemd/rootfs-generator.sh: ignore legacy root=/dev/nfs 2014-01-17 14:52:01 +01:00
Harald Hoyer
75e4cbb7be systemd/rootfs-generator.sh: exit 0 2014-01-17 14:52:01 +01:00
Harald Hoyer
45404a2ad8 dracut-install,dracut: fix ldd output parsing
dracut-install could not handle output like:
	/lib/$LIB/liblsp.so => /lib/lib64/liblsp.so (0x00007faf00727000)

also unset LD_PRELOAD, so we get a clean environment
2014-01-17 14:52:01 +01:00
Harald Hoyer
7e916ae4e0 network: include all ethernet drivers 2014-01-15 14:40:12 +01:00
Harald Hoyer
ef9ddb915b documentation: line wrap 2014-01-13 09:51:04 +01:00
Harald Hoyer
a956a464ef dracut.sh: add /boot/efi to device paths
Add /boot/efi to device paths, so the filesystem driver is included
and it can be repaired in the initramfs.
2014-01-13 09:51:04 +01:00
Harald Hoyer
87483405a0 dracut.sh: add missing piece for option --add-device 2014-01-13 09:51:04 +01:00
Harald Hoyer
8c828f329b iscsi/iscsiroot.sh: do not trust iscsistart return value 2014-01-13 09:51:04 +01:00
Harald Hoyer
9a3676a88f systemd/dracut-initqueue.sh: fstab is not a directory 2014-01-13 09:51:04 +01:00
Harald Hoyer
53cf50e00f fcoe-uefi: do not include, if fcoe utils not installed 2014-01-13 09:51:04 +01:00
Harald Hoyer
53c1e4834f TODO: update 2014-01-13 09:51:04 +01:00
Harald Hoyer
df6e79bfd2 resume/parse-resume.sh: fixed printf formatting
https://bugzilla.redhat.com/show_bug.cgi?id=1045704
2014-01-13 09:51:03 +01:00
Harald Hoyer
5db9c5c1d9 change dracut tarball compression to xz 2014-01-07 12:21:39 +01:00
Harald Hoyer
bb1ba3a1ca resume: fixed udev rule for /dev/resume instead of /dev/dev/resume
https://bugzilla.redhat.com/show_bug.cgi?id=1045116
2013-12-19 17:09:55 +01:00
Harald Hoyer
3ad42552ca network: include usbnet drivers 2013-12-19 17:06:48 +01:00
Harald Hoyer
2f461da2a0 install: install all PATH binaries found
This should fix the issues with symlinks in /bin pointing to /usr/bin on
some distributions.
2013-12-19 17:00:18 +01:00
Harald Hoyer
3aa35b727f kernel-modules: add more block driver
e.g. nvme
2013-12-19 12:37:47 +01:00
Harald Hoyer
ac5bff2b6f dracut-lib/wait_for_dev(): prevent systemd daemon-reload
prevent a systemd daemon-reload, if it is not necessary to do.
2013-12-18 15:22:27 +01:00
Harald Hoyer
ab6f4a825e iscsi: do iscsi_firmware regardless of network
Do the iscsi_firmware iscsistart at least once, even if the network is
not up, to activate offload HBA iSCSI.

https://bugzilla.redhat.com/show_bug.cgi?id=1031160
2013-12-18 15:22:24 +01:00
Harald Hoyer
859e3a77d0 test/TEST-17-LVM-THIN: remove .testdir 2013-12-17 13:36:55 +01:00
Harald Hoyer
61a02caca4 test/TEST-17-LVM-THIN: add test case for lvm thin pools 2013-12-16 13:15:48 +01:00
Harald Hoyer
08f06c9341 dracut.spec: add 95fcoe-uefi and 99uefi-lib 2013-12-16 12:30:43 +01:00
Harald Hoyer
831625d29e lvm: fixed lvm thin check 2013-12-13 11:13:40 +01:00
Harald Hoyer
89031be373 move uefi-lib to a seperate module 2013-12-12 09:49:06 +01:00
Harald Hoyer
ab173bb4c1 fcoe: move uefi parsing to fcoe-uefi module 2013-12-12 09:21:44 +01:00
Alexander Tsoy
ded4c82ace usrmount: always install
/usr should be mounted by initramfs even if /sbin/init lives in /
2013-12-11 14:38:28 +01:00
Harald Hoyer
f11712ea21 base/rdsosreport.sh: add "ip a" output 2013-12-10 12:58:37 +01:00
Harald Hoyer
3934ca8e6c systemd/dracut-initqueue.sh: fixed waiting in the loop if PW asked
continue the main loop instead of the for loop, if a password is
currently asked
2013-12-05 18:38:35 +01:00
Harald Hoyer
ce052202f0 TODO: update 2013-12-05 18:38:23 +01:00
Harald Hoyer
11ee2ca8d4 dracut.spec: remove suse man pages 2013-12-05 17:32:07 +01:00
Harald Hoyer
57575f3c9c dracut.spec: add new modules 2013-12-05 17:27:57 +01:00
Harald Hoyer
45845cb6a5 i18n: introduce i18n_install_all, to install everything
if i18n_install_all is set to "yes", then install all keyboard layouts
and fonts regardless of the hostonly setting.

This way, people can switch keyboard layouts, without having to recreate
the initramfs.
2013-12-05 16:42:05 +01:00
Harald Hoyer
c21c4dc2b4 lvm: install thin tools, only when needed in hostonly 2013-12-05 15:57:42 +01:00
Hannes Reinecke
336bd09d2c Remove shebang from shell-completion files
Shell-completion files are meant to be sourced, not executed.
So they shouldn't have a shebang at the start.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
1c89fd148d Fixup script permissions
Scripts with a shebang should be marked as executable.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
1d3496b4c1 Fixup keymap setting for openSUSE
openSUSE is using compressed keymaps.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
463e13fe81 mkinitrd-suse.8.asc: Add manpage for SUSE compat mkinitrd
Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
2b3e22d602 mkinitrd-suse: Add SUSE compability wrapper for dracut
SUSE has its own mkinitrd system. As the arguments clash
with the dracut-provided mkinitrd script I've added a new
mkinitrd-suse.sh wrapper.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
ee54b8404c Make logfile configurable
Add '--logfile' option to make the log file configurable during
runtime.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
d6f0467edf Add zfcp scripts for SUSE
SuSE is storing the zfcp configuration in udev files, so we should
be including these.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
bfa1db78cd Add DASD configuration for SuSE
On SuSE the DASD configuration is kept in udev rules, one rule
file per device. So add a new module for copying and creating
these rules during boot.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
dda7ae7dcd 95znet: Make installation optional
znet_cio_free is a RedHat-specific tool, so do not install this
module on systems where the program is missing.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
61c0665dad 95zfcp: Make installation optional
zfcp_cio_free is a RedHat-specific tool, so do not install this
module if the program isn't present.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
8b2b77e460 95dasd_mod: make dasd_cio_free optional
dasd_cio_free is a RedHat-specific tool, so make it optional.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
07cacb2455 95dasd: Only install module if normalize_dasd_arg is present
normalize_dasd_arg is a RedHat specific script, so no point
installing this module if the script isn't present.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Hannes Reinecke
690905cea0 95dasd: Install kernel modules only once
Move kernel module selection to 95dasd_mod and make 95dasd depend
on that module.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Harald Hoyer
443fb52487 10i18n/parse-i18n.sh: fixed vconsole.conf/locale.conf generation 2013-12-05 15:13:29 +01:00
Harald Hoyer
b29cb51654 dracut-functions.sh: do not force require modules.builtin* 2013-12-05 15:13:29 +01:00
Harald Hoyer
64ae4e07a4 dracut.sh: skip crypt swaps with password files 2013-12-03 16:21:04 +01:00
Harald Hoyer
8064f68d60 resume: no more autoresume 2013-12-03 16:21:04 +01:00
Harald Hoyer
40da1e5a31 resume: autoconf resume 2013-12-03 16:21:04 +01:00
Harald Hoyer
b92896ece4 base/dracut-lib.sh:wait_for_dev() relax requirement
Do not "require" the devices, but "want" them. This might boot more
systems, where:
- the UUID changed
- swap devices do not show up
2013-12-03 16:21:04 +01:00
Harald Hoyer
271cd19dbe network/ifup.sh: before doing dhcp, check, if the link has a carrier 2013-12-03 16:21:04 +01:00
Harald Hoyer
7c8da72c11 network/net-lib.sh:iface_has_link() fixup
Just echo'ing the flags IFF_UP|IFF_RUNNING does _not_ reflect the
carrier state immediately. So wait for it to really show up.
2013-12-03 16:21:04 +01:00
Harald Hoyer
56ee31ccfe network/net-lib.sh:wait_for_if_up() wait for "state UP"
really wait for "state UP", otherwise it returns earlier than we want
2013-12-03 16:21:04 +01:00
Harald Hoyer
e41f3f9025 dracut.sh:_get_fs_type() if block device exists return early
even, if no ID_FS_TYPE was found, return if the block device exists
2013-12-03 16:21:04 +01:00
Harald Hoyer
e38e73d5a6 dracut.cmdline.7.asc: document "server-ip" of "ip=" parameter 2013-12-03 16:21:04 +01:00
Harald Hoyer
928da57447 fips: fix RHEV vmlinuz check 2013-12-03 16:21:04 +01:00
Peter Rajnoha
297b8edc05 lvm: do not run pvscan for lvmetad update
The lvmetad daemon is not yet running in initramfs so there's no
need to run pvscan (or instantiate any lvm2-pvscan systemd service).
If pvscan was called in this case (either directly or via systemd
instantiated service), it would fail because there's no lvmetad
daemon to update. This could cause confusion, especially in systemd
instantiated service which is run only once!
2013-12-03 16:20:25 +01:00
Harald Hoyer
28609baf6e kernel-modules: add ohci-pci to the list of forced module installs 2013-11-14 10:07:04 +01:00
Vratislav Podzimek
a3bfaa1919 Run 'xz' and 'lzma' with multiple threads
This speeds up compression a lot on multicore systems.

https://bugzilla.redhat.com/show_bug.cgi?id=1029786

[Edited-by: Harald Hoyer: use getconf for cpu_count]
2013-11-13 13:20:39 +01:00
Harald Hoyer
7e4f74f504 systemd: do not exit the initqueue, if systemd asks a password
this prevents bailing out the initqueue, while passwords are still to be
asked
2013-11-12 17:02:44 +01:00
Harald Hoyer
c2ab990938 iscsi,nbd: do not fail in hostonly mode 2013-11-11 16:57:09 +01:00
Colin Guthrie
1d50dfe602 dracut-functions.sh: Avoid loading unnecessary 32-bit libraries for 64-bit initrds
Due to the 'inst_libdir_file "libnss_files*"' in the udev-rules module
this caues the /usr/lib/libnss_files-2.18.so* to be included. This is a
32-bit library and pulls in a 32-bit version of glibc also even on a
64-bit system.

This is due to the fact that ldconfig -pN will print [/usr]/lib paths
from the cache as well as [/usr]/lib64. As we handle these paths
specifically we should ignore these results from the cache.

Also there was a missing space when appending the ldconfig paths
onto our list meaning the last builtin and first ldconfig path
were unusable.
2013-11-07 15:23:24 +01:00
Harald Hoyer
185e940e27 fips: also install /etc/system-fips in the initramfs 2013-11-04 17:32:22 +01:00
Harald Hoyer
095fa15591 dracut.modules.7.asc: removed empty section 2013-11-02 13:20:32 +01:00
Harald Hoyer
cf3fd99e72 dracut.sh: fixed PATH shortener 2013-11-02 13:14:40 +01:00
Harald Hoyer
06d418abd1 dracut.spec: move /sbin/dracut to /usr/sbin/dracut 2013-10-30 19:50:53 +01:00
Harald Hoyer
fa9384b1c0 iscsi/nbd: do not try to mount the whole disk, if root= is missing
only mount the whole disk for root=dhcp
2013-10-30 17:38:43 +01:00
Kyle McMartin
0a8e91bb24 fips: include crct10dif_generic
Resolves: rhbz#1024455
2013-10-30 12:35:27 +01:00
Harald Hoyer
4d7c18c7c0 Handle crypto modules with and without modaliases
If new kernels have modules split out, handle the case, where modules
have to modalias and just install them.

Also add the crypto drivers and names to host_modalias.
2013-10-30 12:24:37 +01:00
Alexander Tsoy
0106da599a usrmount/module-setup.sh: fixed typo 2013-10-25 17:06:44 +02:00
Harald Hoyer
5d623b1775 lvm: always install thin utils for lvm 2013-10-21 09:09:26 +02:00
Harald Hoyer
76a4478264 kernel-modules(ARM): add mmc_block usb_storage to statis list of kernel mods 2013-10-18 14:56:51 +02:00
Marian Csontos
96c6f6f3d1 dracut-functions.sh:check_block_and_slaves*() skip LVM internal devs
Not every device in /dev/mapper should be examined.
If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
2013-10-18 14:40:40 +02:00
Harald Hoyer
56903458d7 mkdir basic dirs in /run
for systemd initramfs, /run is also mounted
for non-systemd the contents of /run is copied over, when mounting /run
2013-10-16 11:49:57 +02:00
Harald Hoyer
8795467533 network/fcoe: only redirect output to loginit.pipe, if exists 2013-10-16 11:39:34 +02:00
Harald Hoyer
8d89fc6bb1 dracut.sh: no need to make subdirs in run 2013-10-16 11:39:17 +02:00
Harald Hoyer
68b736b50f dracut.sh: also mkdir /run/lock, which is copied to 2013-10-16 11:31:54 +02:00
Harald Hoyer
aabea6f7b9 lvm: fix thin recognition
The global var setting was happening in a pipe and did not have an
effect.

Use <<<$() instead.

< <() cannot be used, because dracut is called in chroot's environments,
where /dev/fd does not point to /proc/self/fd, but bash wants
/dev/fd/<num> for this construct.
2013-10-16 11:30:08 +02:00
P J P
871c8e40d1 Add lzo, lz4 compression and read INITRD_COMPRESS
This patch adds support for lzop(1) & lz4(1) compression
algorithms to compress iniramfs image file. Both are supported
by the Linux kernel.

Linux kernel exports user's choice of initramfs compression
algorithm as a shell environment variable: INITRD_COMPRESS.
This patch adds support to read this variable and duly compress
the initramfs image file.

Environment variable INITRD_COMPRESS has less precedence than the
command line options --gzip, etc. Ie. command line options could
override the compression algorithm defined by $INITRD_COMPRESS.

Signed-off-by: P J P <ppandit@redhat.com>

[Edited-by: Harald Hoyer: add documentation about lzo and lz4]
2013-10-14 09:38:06 +02:00
Alexander Tsoy
1aedbb7886 resume: remove resume-genrules.sh
parse-resume.sh already contains all the code from resume-genrules.sh.
Also parse-resume.sh is executed before resume-genrules.sh, so there is
no point to keep the latter.

This fixes the following error messages:
dracut-initqueue: ln: failed to create symbolic link '/dev/resume': File exists
dracut-initqueue: rm: cannot remove '/lib/dracut/hooks/initqueue/settled/resume.sh': No such file or directory
dracut-initqueue: rm: cannot remove '/lib/dracut/hooks/initqueue/timeout/resume.sh': No such file or directory
2013-10-09 16:21:50 +02:00
Alexander Tsoy
cfdec163f9 resume: fix swap detection in hostonly
Check for other possible fs types. This fixes swap detection when using
TuxOnIce kernel.

Note that parse-resume.sh generate udev rules with support for
ID_FS_TYPE=suspend, but we do not include it here, because it is
libvolume_id thing and host_fs_types is populated using blkid.
2013-10-09 16:21:50 +02:00
Harald Hoyer
ab2676d291 base/init.sh: also mkdir /run/lock 2013-10-09 08:20:39 +02:00
Brian C. Lane
3622d6d7b0 dmsquash-live: add /dev/mapper/live-base
This is similar to the reason for adding the
/run/initramfs/live-baseloop symlink -- access to the original live
image without overlays.

livemedia-creator does not create a osmin.img, so there is no mountable
device for it to use when rsyncing the live image to the target. It
needs a device that points to the original live image without overlays.

Note that lmc won't be creating osmin.img, since really isn't needed any
longer. Its purpose was to provide a minimal image that could be dd'd to
the target. Now that we use rsync this is no longer necessary.

The included patch adds a /dev/mapper/live-base device that Anaconda can
use whether or not there is an osmin present.
2013-10-08 15:13:44 +02:00
Harald Hoyer
b6c8976811 Doc: cleanup, extend and split and reuse 2013-10-08 15:13:12 +02:00
Harald Hoyer
05214a0bed dracut.sh: do not bail out, if kernel modules dir is missing
and only print a warning message
2013-10-08 15:05:21 +02:00
Harald Hoyer
6c8fc6e377 10i18n/parse-i18n.sh: parse rd.vconsole and rd.locale
and removed systemd part, because parse-i18n.sh is not even installed in
systemd driven initramfs images.
2013-10-08 15:05:21 +02:00
Harald Hoyer
8bcfd683bd */module-setup.sh: add comments for dracut called functions 2013-10-08 10:37:56 +02:00
Harald Hoyer
a3c0cef9a7 lvm: install thin utils for non-hostonly 2013-10-08 10:30:00 +02:00
Harald Hoyer
2f6ed29d04 prepare 034 release 2013-10-08 09:55:26 +02:00
Harald Hoyer
a3044aba53 mkinitrd-dracut.sh: removed trailing space in comment 2013-10-07 17:25:58 +02:00
Harald Hoyer
50f5bbbbaf btrfs: use inst_hook to install the timeout hook 2013-10-07 17:25:58 +02:00
Harald Hoyer
c4c1c4f456 rootfs-block: add support for the rootfallback= kernel cmdline option 2013-10-07 17:25:58 +02:00
Harald Hoyer
46cc29261f fcoe: add FCoE UEFI boot device support 2013-10-07 15:18:38 +02:00
Harald Hoyer
7f5701eb8d dracut.spec: remove bcache module 2013-10-07 11:18:11 +02:00
Harald Hoyer
b7d1b6f904 mkinitrd-dracut.sh: do not "--keep" files for --verbose 2013-10-04 13:57:15 +02:00
Thomas Renninger
58ef91ff50 mkinitrd-dracut.sh: Build host images for default_kernel_images and -i/-k paths
default_kernel_images and -i/-k paths are new (SuSE) code paths and
would have resulted in usage errors before.

There we want to build host only images for faster building and
smaller images.
Also force creation (overriding) of initrd images in these code paths.

Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-04 13:56:41 +02:00
Thomas Renninger
fbf338ff98 mkinitrd-dracut.sh: Also allow -d to specify the root_fs and -s dummy
-d is the SUSE mkinitrd version option to pass the rootfs.
-s is to enable splash which may not be needed, but some callers rely on it,
not to return an error.

Make this wrapper compatible to it.

Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-04 13:56:41 +02:00
Thomas Renninger
40db1daf00 mkinitrd-dracut.sh: Allow mkinitrd call without passing any parameters
Before this gave a "usage" error.
Now boot_dir (by default /boot) is scanned for available kernels and sane
initrd default targets get defined and the corresponding initramfs files
are generated.

Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-04 13:56:41 +02:00
Thomas Renninger
cbd1b385a2 mkinitrd-dracut.sh: Implement --quiet|-q option
Dracut is rather verbose. This optional parameter is to limit the output
to the essential: For each generated initrd show the kernel, target and
possibly additional options passed to dracut.

Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-04 13:56:41 +02:00
Thomas Renninger
6470e0a12b mkinitrd-dracut.sh: Enhance param parsing: Allow multiple arguments per param
Currently --with parameter had to be passed as: --with="mod1 mod2".
Now one can pass: --with "mod1 mod2" or even --with mod1 mod2.

Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-04 13:56:41 +02:00
Thomas Renninger
da5ef1737e mkinitrd-dracut.sh: Introduce -i -k parameters
In SUSE, one can pass a list of kernel files via -k parameter.
For each an initrd is generated as passed via -i parameters.

Make the dracut mkinitrd wrapper compatible to those.
For now only one kernel file and initrd target can be specified.
This will get enhanced with a follow-up patch.

Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-04 13:56:41 +02:00
Alexander Tsoy
ecc13ef17e mdraid/module-setup.sh: fixes for mdadm-3.2.6+
mdadm-3.2.6+:
Incremental assembly rule contains "--offroot" arg. Update
regexp to catch this variant.

mdadm-3.3+:
Rules was splitted into two files: 63-md-raid-arrays.rules
and 64-md-raid-assembly.rules. Install them both and edit
the latter.
2013-10-04 13:56:41 +02:00
Alexander Tsoy
5bcf262d59 mdraid/module-setup.sh: install configs from /etc/mdadm.conf.d
/etc/mdadm.conf.d directory is supported since mdadm-3.3
2013-10-04 13:56:41 +02:00
Harald Hoyer
d97eb42593 dracut.spec: conflict with old bcache-tools 2013-10-04 13:36:36 +02:00
Harald Hoyer
63330a89fc dracut-functions.sh:inst_rules() do not install rules in CWD 2013-10-04 13:36:25 +02:00
Harald Hoyer
49268028b9 bcache: removed, it's in the upstream bcache-tools package 2013-10-04 10:43:02 +02:00
Peter Rajnoha
b874d4b5be lvm/mdraid: Fix LVM on MD activation
The 69-dm-lvm-metad.rules set some udev env. variables that makes it
possible to detect the right time to activate LVM on MD. The MD is very
similar to DM during activation - it's usable only after proper device
activation - the CHANGE event. We need to make a difference between a
CHANGE event that comes from this activation and CHANGE event that is
the outcome of the WATCH udev rule (otherwise we'd end up with LVM
activation done on each CHANGE event - which is wrong).

So we need the udev databse to be persistent during pivot to root fs
even for MD devices.
2013-10-04 10:41:24 +02:00
Harald Hoyer
283d385fbd dracut-logger.sh: do not log to syslog/kmsg/journal for UID != 0
Don't clutter the system log with user actions.

Also check, if systemd-cat works, before using it.
2013-10-02 12:48:57 +02:00
Harald Hoyer
96cf7270da dracut.sh: bail out early, if destination dir is not writeable 2013-10-02 12:48:11 +02:00
Harald Hoyer
b19bdcbea7 dracut-bash-completion.sh: add --prelink --noprelink 2013-10-02 12:47:34 +02:00
Thomas Renninger
4e93c3f707 dracut.conf.5.asc: Add ACPI table override and uncompressed cpio doc
Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-02 12:47:11 +02:00
Thomas Renninger
f3b14c2b6a dracut: Implement ACPI table overriding
An example config file for this feature could be:

/etc/dracut.conf.d/03-acpi-override.conf

with this content:
acpi_override="yes"
acpi_table_dir="/etc/dracut.conf.d/acpi_tables"

Then all files ending with *.aml will be put into the early cpio
(kernel/firmware/acpi) and will be used to replace the BIOS provided tables
if the kernel supports this feature.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-02 12:47:11 +02:00
Thomas Renninger
d8b04dc184 dracut: Do not create early_cpio if no suitable microcode exist in hostonly case
Intel microcodes only exist for very specific family/model/stepping CPUs.
If no microcode gets added, there is no need to create an empty
(only directories) cpio later that gets glued to the initrd.

This also fixes:

*** Constructing GenuineIntel.bin ****
cat: /lib/firmware/intel-ucode/06-3c-03: No such file or directory

in hostonly mode if there is no suitable microcode for the CPU.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-02 12:47:11 +02:00
Thomas Renninger
b5b608e44a dracut: Generlize microcode early cpio usage
ACPI early table override also may need to place files into an early cpio.
Reflect this in variable and file names.
This change is renaming only and does not introduce any real change.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
2013-10-02 12:47:11 +02:00
Harald Hoyer
78d5cf7cb4 add /etc/system-fips for dracut-fips subpackage 2013-10-02 12:36:25 +02:00
Harald Hoyer
f4a942783a Add option to turn on/off prelinking
--prelink, --noprelink

do_prelink=[yes|no]
2013-09-17 12:25:29 -05:00
Harald Hoyer
3b9aaaab42 dracut.sh: we don't need to read the modalias files
udev does only parse the uevent MODALIAS line, so whatever is in the
modalias files would not trigger any module load.
2013-09-13 18:05:48 +02:00
Harald Hoyer
fc68c87afa dracut.sh: also search uevent's for MODALIAS 2013-09-13 17:34:18 +02:00
WANG Chao
63f3bcd852 ifup: do not dhcp on network interface of secondary stack
Configure cmdline to:
 ip=br0:dhcp bridge=br0:bond0 bond=bond0:eth0

By default ifup bond0 will run dhcp on bond0, which is wrong. bond0
isn't the top interface. we should really run dhcp on br0.

So if we ifup an network interface on secondary stack, we should not
dhcp. Fix this issue with this patch.
2013-09-13 17:04:16 +02:00
Harald Hoyer
57f90974f9 dracut.sh: harden host_modalias reading
Some weird PPC driver make their modulias unreadable

$ cat /sys/devices/vio/4000/modalias
cat: /sys/devices/vio/4000/modalias: No such device
2013-09-13 16:33:01 +02:00
177 changed files with 5405 additions and 2605 deletions

View File

@@ -13,3 +13,4 @@ Luca Berra <bluca@vodka.it> <bluca@comedia.it>
Dave Young <dyoung@redhat.com> dyoung@redhat.com Dave Young <dyoung@redhat.com> dyoung@redhat.com
Frederick Grose <fgrose@sugarlabs.org> <fgrose@gmail.com> Frederick Grose <fgrose@sugarlabs.org> <fgrose@gmail.com>
Frederic Crozat <fcrozat@suse.com> <fcrozat@mandriva.com> Frederic Crozat <fcrozat@suse.com> <fcrozat@mandriva.com>
Shawn W Dunn <sfalken@opensuse.org> <sfalken@opensuse.org>

21
AUTHORS
View File

@@ -12,19 +12,24 @@ Amerigo Wang <amwang@redhat.com>
Colin Guthrie <colin@mageia.org> Colin Guthrie <colin@mageia.org>
Andrey Borzenkov <arvidjaar@gmail.com> Andrey Borzenkov <arvidjaar@gmail.com>
Peter Jones <pjones@redhat.com> Peter Jones <pjones@redhat.com>
WANG Chao <chaowang@redhat.com>
Andreas Thienemann <andreas@bawue.net> Andreas Thienemann <andreas@bawue.net>
Hannes Reinecke <hare@suse.de>
Hans de Goede <hdegoede@redhat.com> Hans de Goede <hdegoede@redhat.com>
John Reiser <jreiser@bitwagon.com> John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it> Luca Berra <bluca@vodka.it>
WANG Chao <chaowang@redhat.com> Thomas Renninger <trenn@suse.de>
Alexander Tsoy <alexander@tsoy.me>
Daniel Drake <dsd@laptop.org> Daniel Drake <dsd@laptop.org>
Brian C. Lane <bcl@redhat.com>
Dan Horák <dhorak@redhat.com> Dan Horák <dhorak@redhat.com>
Baoquan He <bhe@redhat.com> Baoquan He <bhe@redhat.com>
Leho Kraav <leho@kraav.com> Leho Kraav <leho@kraav.com>
Brian C. Lane <bcl@redhat.com>
Kamil Rytarowski <n54@gmx.com> Kamil Rytarowski <n54@gmx.com>
Marc Grimme <grimme@atix.de> Marc Grimme <grimme@atix.de>
Peter Rajnoha <prajnoha@redhat.com>
Chao Wang <chaowang@redhat.com> Chao Wang <chaowang@redhat.com>
Colin Walters <walters@verbum.org>
Frederic Crozat <fcrozat@suse.com> Frederic Crozat <fcrozat@suse.com>
Jesse Keating <jkeating@redhat.com> Jesse Keating <jkeating@redhat.com>
Milan Broz <mbroz@redhat.com> Milan Broz <mbroz@redhat.com>
@@ -32,7 +37,6 @@ Radek Vykydal <rvykydal@redhat.com>
Roberto Sassu <roberto.sassu@polito.it> Roberto Sassu <roberto.sassu@polito.it>
Anton Blanchard <anton@samba.org> Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com> Bill Nottingham <notting@redhat.com>
Colin Walters <walters@verbum.org>
David Cantrell <dcantrell@redhat.com> David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us> Dennis Gilmore <dennis@ausil.us>
Jon Ander Hernandez <jonan.h@gmail.com> Jon Ander Hernandez <jonan.h@gmail.com>
@@ -40,20 +44,23 @@ Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org> Lance Albertson <lance@osuosl.org>
Marian Ganisin <mganisin@redhat.com> Marian Ganisin <mganisin@redhat.com>
Michael Ploujnikov <plouj@somanetworks.com> Michael Ploujnikov <plouj@somanetworks.com>
Peter Rajnoha <prajnoha@redhat.com> Stig Telfer <stelfer@cray.com>
Wim Muskee <wimmuskee@gmail.com> Wim Muskee <wimmuskee@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk> Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com> Alan Pevec <apevec@redhat.com>
Cristian Rodríguez <crrodriguez@opensuse.org>
Frederick Grose <fgrose@sugarlabs.org> Frederick Grose <fgrose@sugarlabs.org>
Ian Dall <ian@beware.dropbear.id.au> Ian Dall <ian@beware.dropbear.id.au>
James Buren <ryuo@frugalware.org> James Buren <ryuo@frugalware.org>
James Lee <jlee@thestaticvoid.com> James Lee <jlee@thestaticvoid.com>
Joey Boggs <jboggs@redhat.com> Joey Boggs <jboggs@redhat.com>
Koen Kooi <koen@dominion.thruhere.net>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mike Snitzer <snitzer@redhat.com> Mike Snitzer <snitzer@redhat.com>
Przemysław Rudy <prudy1@o2.pl> Przemysław Rudy <prudy1@o2.pl>
Stefan Reimer <it@startux.de> Stefan Reimer <it@startux.de>
Thomas Lange <lange@informatik.uni-koeln.de> Thomas Lange <lange@informatik.uni-koeln.de>
Till Maas <opensource@till.name>
Vivek Goyal <vgoyal@redhat.com> Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com> Vladislav Bogdanov <bubble@hoster-ok.com>
Adam Williamson <awilliam@redhat.com> Adam Williamson <awilliam@redhat.com>
@@ -71,16 +78,19 @@ Dave Young <dave@redhat.com>
Dennis Schridde <devurandom@gmx.net> Dennis Schridde <devurandom@gmx.net>
Duane Griffin <duaneg@dghda.com> Duane Griffin <duaneg@dghda.com>
Glen Gray <slaine@slaine.org> Glen Gray <slaine@slaine.org>
Hari Bathini <hbathini@linux.vnet.ibm.com>
Hermann Gausterer <git-dracut-2012@mrq1.org> Hermann Gausterer <git-dracut-2012@mrq1.org>
James Laska <jlaska@redhat.com> James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com> Jan Stodola <jstodola@redhat.com>
Jiri Pirko <jiri@resnulli.us> Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com> Joe Lawrence <Joe.Lawrence@stratus.com>
Kevin Yung <Kevin.Yung@myob.com> Kevin Yung <Kevin.Yung@myob.com>
Kyle McMartin <kmcmarti@redhat.com>
Kyle McMartin <kyle@redhat.com> Kyle McMartin <kyle@redhat.com>
Lars R. Damerow <lars@pixar.com> Lars R. Damerow <lars@pixar.com>
Lennert Buytenhek <buytenh@wantstofly.org> Lennert Buytenhek <buytenh@wantstofly.org>
Lubomir Rintel <lkundrak@v3.sk> Lubomir Rintel <lkundrak@v3.sk>
Marian Csontos <mcsontos@redhat.com>
Matt <smoothsailing72@hotmail.com> Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com> Matt Smith <shadowfax@gmx.com>
Michal Schmidt <mschmidt@redhat.com> Michal Schmidt <mschmidt@redhat.com>
@@ -89,17 +99,20 @@ Munehiro Matsuda <haro@kgt.co.jp>
Nicolas Chauvet <kwizart@gmail.com> Nicolas Chauvet <kwizart@gmail.com>
Nikoli <nikoli@lavabit.com> Nikoli <nikoli@lavabit.com>
Olivier Blin <dev@blino.org> Olivier Blin <dev@blino.org>
P J P <ppandit@redhat.com>
Paolo Bonzini <pbonzini@redhat.com> Paolo Bonzini <pbonzini@redhat.com>
Peter Robinson <pbrobinson@fedoraproject.org> Peter Robinson <pbrobinson@fedoraproject.org>
Pádraig Brady <P@draigBrady.com> Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk> Quentin Armitage <quentin@armitage.org.uk>
Robert Buchholz <rbu@goodpoint.de> Robert Buchholz <rbu@goodpoint.de>
Sergey Fionov <fionov@gmail.com> Sergey Fionov <fionov@gmail.com>
Shawn W Dunn <sfalken@opensuse.org>
Srinivasa T N <seenutn@linux.vnet.ibm.com> Srinivasa T N <seenutn@linux.vnet.ibm.com>
Thilo Bangert <thilo.bangert@gmx.net> Thilo Bangert <thilo.bangert@gmx.net>
Thomas Backlund <tmb@mageia.org> Thomas Backlund <tmb@mageia.org>
Tomasz Torcz <tomek@pipebreaker.pl> Tomasz Torcz <tomek@pipebreaker.pl>
Vadim Kuznetsov <vadimk@gentoo.org> Vadim Kuznetsov <vadimk@gentoo.org>
Ville Skyttä <ville.skytta@iki.fi> Ville Skyttä <ville.skytta@iki.fi>
Vratislav Podzimek <vpodzime@redhat.com>
Yanko Kaneti <yaneti@declera.com> Yanko Kaneti <yaneti@declera.com>
maximilian attems <max@stro.at> maximilian attems <max@stro.at>

View File

@@ -21,11 +21,13 @@ man1pages = lsinitrd.1
man5pages = dracut.conf.5 man5pages = dracut.conf.5
man7pages = dracut.cmdline.7 \ man7pages = dracut.cmdline.7 \
dracut.bootup.7 dracut.bootup.7 \
dracut.modules.7
man8pages = dracut.8 \ man8pages = dracut.8 \
dracut-catimages.8 \ dracut-catimages.8 \
mkinitrd.8 \ mkinitrd.8 \
mkinitrd-suse.8 \
modules.d/98systemd/dracut-cmdline.service.8 \ modules.d/98systemd/dracut-cmdline.service.8 \
modules.d/98systemd/dracut-initqueue.service.8 \ modules.d/98systemd/dracut-initqueue.service.8 \
modules.d/98systemd/dracut-mount.service.8 \ modules.d/98systemd/dracut-mount.service.8 \
@@ -37,15 +39,15 @@ man8pages = dracut.8 \
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages) manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh .PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
all: dracut-version.sh dracut-install all: dracut-version.sh dracut-install skipcpio/skipcpio
DRACUT_INSTALL_OBJECTS = \ DRACUT_INSTALL_OBJECTS = \
install/dracut-install.o \ install/dracut-install.o \
install/hashmap.o\ install/hashmap.o\
install/log.o \ install/log.o \
install/strv.o \
install/util.o install/util.o
# deps generated with gcc -MM # deps generated with gcc -MM
@@ -55,14 +57,22 @@ install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.
install/hashmap.h install/hashmap.h
install/log.o: install/log.c install/log.h install/macro.h install/util.h install/log.o: install/log.c install/log.h install/macro.h install/util.h
install/util.o: install/util.c install/util.h install/macro.h install/log.h install/util.o: install/util.c install/util.h install/macro.h install/log.h
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
install/dracut-install: $(DRACUT_INSTALL_OBJECTS) install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
dracut-install: install/dracut-install dracut-install: install/dracut-install
ln -fs $< $@ ln -fs $< $@
SKIPCPIO_OBJECTS= \
skipcpio/skipcpio.o
skipcpio/skipcpio.o: skipcpio/skipcpio.c
skipcpio/skipcpio: skipcpio/skipcpio.o
indent: indent:
indent -i8 -nut -br -linux -l120 install/dracut-install.c indent -i8 -nut -br -linux -l120 install/dracut-install.c
indent -i8 -nut -br -linux -l120 skipcpio/skipcpio.c
doc: $(manpages) dracut.html doc: $(manpages) dracut.html
@@ -76,7 +86,9 @@ endif
%.xml: %.asc %.xml: %.asc
asciidoc -d manpage -b docbook -o $@ $< asciidoc -d manpage -b docbook -o $@ $<
dracut.html: dracut.asc $(manpages) dracut.css dracut.8: dracut.usage.asc dracut.8.asc
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
xsltproc -o dracut.html --xinclude -nonet \ xsltproc -o dracut.html --xinclude -nonet \
--stringparam custom.css.source dracut.css \ --stringparam custom.css.source dracut.css \
@@ -134,6 +146,9 @@ endif
if [ -f install/dracut-install ]; then \ if [ -f install/dracut-install ]; then \
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \ install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
fi fi
if [ -f skipcpio/skipcpio ]; then \
install -m 0755 skipcpio/skipcpio $(DESTDIR)$(pkglibdir)/skipcpio; \
fi
mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d mkdir -p $(DESTDIR)${prefix}/lib/kernel/install.d
install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install install -m 0755 50-dracut.install $(DESTDIR)${prefix}/lib/kernel/install.d/50-dracut.install
install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install install -m 0755 51-dracut-rescue.install $(DESTDIR)${prefix}/lib/kernel/install.d/51-dracut-rescue.install
@@ -150,27 +165,28 @@ clean:
$(RM) */*/*~ $(RM) */*/*~
$(RM) $(manpages:%=%.xml) dracut.xml $(RM) $(manpages:%=%.xml) dracut.xml
$(RM) test-*.img $(RM) test-*.img
$(RM) dracut-*.rpm dracut-*.tar.bz2 $(RM) dracut-*.rpm dracut-*.tar.bz2 dracut-*.tar.xz
$(RM) dracut-version.sh $(RM) dracut-version.sh
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS) $(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
$(RM) skipcpio/skipcpio $(SKIPCPIO_OBJECTS)
$(RM) $(manpages) dracut.html $(RM) $(manpages) dracut.html
$(MAKE) -C test clean $(MAKE) -C test clean
dist: dracut-$(VERSION).tar.bz2 dist: dracut-$(VERSION).tar.xz
dracut-$(VERSION).tar.bz2: doc syncheck dracut-$(VERSION).tar.xz: doc syncheck
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh @echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
mkdir -p dracut-$(VERSION) mkdir -p dracut-$(VERSION)
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f) tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
rm -fr -- dracut-$(VERSION).tar.bz2 dracut-$(VERSION) rm -fr -- dracut-$(VERSION).tar.xz dracut-$(VERSION)
bzip2 -9 dracut-$(VERSION).tar xz -9 dracut-$(VERSION).tar
rm -f -- dracut-$(VERSION).tar rm -f -- dracut-$(VERSION).tar
rpm: dracut-$(VERSION).tar.bz2 syncheck rpm: dracut-$(VERSION).tar.xz syncheck
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \ rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \ cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \ LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \ (cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \ --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
@@ -210,9 +226,9 @@ hostimage: all
AUTHORS: AUTHORS:
git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS
dracut.html.sign: dracut-$(VERSION).tar.bz2 dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
gpg-sign-all dracut-$(VERSION).tar.bz2 dracut.html gpg-sign-all dracut-$(VERSION).tar.xz dracut.html
upload: dracut.html.sign upload: dracut.html.sign
kup put dracut-$(VERSION).tar.bz2 dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/ kup put dracut-$(VERSION).tar.xz dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/ kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/

101
NEWS
View File

@@ -1,3 +1,98 @@
dracut-037
==========
- dracut: hostonly_cmdline variable and command line switch
Toggle hostonly cmdline storing in the initramfs
--hostonly-cmdline:
Store kernel command line arguments needed in the initramfs
--no-hostonly-cmdline:
Do not store kernel command line arguments needed in the initramfs
- dracut: --mount now understands full fstab lines
- dracut now also includes drivers from the /lib/modules/<version>/updates directory
- dracut: only set the owner of files to 0:0, if generated as non-root
- dracut now directly writes to the initramfs file
- dracut: call lz4 with the legacy flag (linux kernel does not support the new format)
- systemd: rootfs-generator generates JobTimeout=0 units for the root device
- systemd: added the systemd-sysctl service
- systemd: add 80-net-setup-link.rules and .link files for persistent interface renaming
- systemd: make dracut-shutdown.service failure non-fatal
- network: various IPv6 fixes
- network: DCHCP for IPv6
- network: understand ip=.....:<dns1>:<dns2>
- network: parse ibft nameserver settings
- shutdown: if kexec fails, just reboot
- lvm: handle one LV at a time with lvchange
- module-setup.sh:
New functions require_binaries() and require_any_binary() to be used
in the check() section of module-setup.sh.
- a lot of small bugfixes
Contributions from:
Harald Hoyer
Alexander Tsoy
Till Maas
Amadeusz Żołnowski
Brian C. Lane
Colin Guthrie
Dave Young
WANG Chao
Shawn W Dunn
dracut-036
==========
- fixed skipcpio signature checking
dracut-035
==========
- changed dracut tarball compression to xz
- new argument "--rebuild"
- add lzo, lz4 compression
- install: install all binaries with <name> found in PATH
- lsinitrd can now handle initramfs images with an early cpio prepended
(microcode, ACPI tables)
- mkinitrd-suse added as a compat stub for dracut
- lvm: install thin utils for non-hostonly
- resume: fix swap detection in hostonly
- avoid loading unnecessary 32-bit libraries for 64-bit initrds
- crypt: wait for systemd password agents
- crypt: skip crypt swaps with password files
- network: before doing dhcp, dracut now checks, if the link has a carrier
- network: dhclient-script.sh now sets the lease time
- network: include usbnet drivers
- network: include all ethernet drivers
- network: add rd.bootif=0 to ignore BOOTIF
- i18n: introduce i18n_install_all, to install everything i18n related
- support SuSE DASD configurations
- support SuSE zfcp configurations
- support SuSE compressed KEYMAP= setting
- usrmount: always install the module,
so always mount /usr from within the initramfs
- test/TEST-17-LVM-THIN: new test case for lvm thin pools
- "halt" the machine in systemd mode for die()
dracut-034
==========
- do not run dhcp on parts of assembled network interfaces (bond, bridge)
- add option to turn on/off prelinking
--prelink, --noprelink
do_prelink=[yes|no]
- add ACPI table overriding
- do not log to syslog/kmsg/journal for UID != 0
- lvm/mdraid: Fix LVM on MD activation
- bcache module removed (now in bcache-tools upstream)
- mdadm: also install configs from /etc/mdadm.conf.d
- fixes for mdadm-3.2.6+
- mkinitrd: better compat support for SUSE
- fcoe: add FCoE UEFI boot device support
- rootfs-block: add support for the rootfallback= kernel cmdline option
Contributions from:
Thomas Renninger
Alexander Tsoy
Peter Rajnoha
WANG Chao
Harald Hoyer
dracut-033 dracut-033
========== ==========
- improved hostonly device recognition - improved hostonly device recognition
@@ -16,6 +111,12 @@ dracut-033
- fixed ifup udev rules - fixed ifup udev rules
- ifup with dhcp, if no "ip=" specified for the interface - ifup with dhcp, if no "ip=" specified for the interface
Contributions from:
WANG Chao
Colin Walters
Harald Hoyer
dracut-032 dracut-032
========== ==========
- add parameter --print-cmdline - add parameter --print-cmdline

5
TODO
View File

@@ -6,6 +6,10 @@ Items are ordered in priority.
INITRAMFS TODO INITRAMFS TODO
- allow dual stack configuration (IPv4, IPv6) for the same interface
- "bind-mount" kernel drivers in real root for the rescue image,
if the real root does not have any kernel modules for this kernel
https://bugzilla.redhat.com/show_bug.cgi?id=1046510
- use info and warn prefix - use info and warn prefix
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically - generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
- put "root=" parsing hooks in separate hook dir - put "root=" parsing hooks in separate hook dir
@@ -22,6 +26,7 @@ INITRAMFS TODO
GENERATOR TODO GENERATOR TODO
- report errors on missing files in check()
- remove wait for swap devs, if no "resume=" is given on the kernel command line - remove wait for swap devs, if no "resume=" is given on the kernel command line
- add presets (predefined set of modules) - add presets (predefined set of modules)
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions) - add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)

View File

@@ -1,4 +1,4 @@
#!/bin/bash #
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# #
@@ -34,7 +34,7 @@ _dracut() {
--local --hostonly --no-hostonly --fstab --help --bzip2 --lzma --local --hostonly --no-hostonly --fstab --help --bzip2 --lzma
--xz --no-compress --gzip --list-modules --show-modules --keep --xz --no-compress --gzip --list-modules --show-modules --keep
--printsize --regenerate-all --noimageifnotneeded --early-microcode --printsize --regenerate-all --noimageifnotneeded --early-microcode
--no-early-microcode --print-cmdline' --no-early-microcode --print-cmdline --prelink --noprelink'
[ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers [ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers
--omit-drivers --modules --omit --drivers --filesystems --install --omit-drivers --modules --omit --drivers --filesystems --install

View File

@@ -35,6 +35,51 @@ fi
# Generic substring function. If $2 is in $1, return 0. # Generic substring function. If $2 is in $1, return 0.
strstr() { [[ $1 = *$2* ]]; } strstr() { [[ $1 = *$2* ]]; }
# helper function for check() in module-setup.sh
# to check for required installed binaries
# issues a standardized warning message
require_binaries() {
local _module_name="${moddir##*/}"
local _ret=0
if [[ "$1" = "-m" ]]; then
_module_name="$2"
shift 2
fi
for cmd in "$@"; do
if ! find_binary "$cmd" &>/dev/null; then
dinfo "$_module_name: Could not find command '$cmd'!"
((_ret++))
fi
done
return $_ret
}
require_any_binary() {
local _module_name="${moddir##*/}"
local _ret=1
if [[ "$1" = "-m" ]]; then
_module_name="$2"
shift 2
fi
for cmd in "$@"; do
if find_binary "$cmd" &>/dev/null; then
_ret=0
break
fi
done
if (( $_ret != 0 )); then
dinfo "$_module_name: Could not find any command of '$@'!"
return 1
fi
return 0
}
# find a binary. If we were not passed the full path directly, # find a binary. If we were not passed the full path directly,
# search in the usual places to find the binary. # search in the usual places to find the binary.
find_binary() { find_binary() {
@@ -65,6 +110,7 @@ ldconfig_paths()
printf "%s\n" ${d%/*}; printf "%s\n" ${d%/*};
done done
); do ); do
[[ "$i" = "/lib" || "$i" = "/usr/lib" || "$i" = "/lib64" || "$i" = "/usr/lib64" ]] && continue
a["$i"]=1; a["$i"]=1;
done; done;
printf "%s\n" ${!a[@]} printf "%s\n" ${!a[@]}
@@ -81,7 +127,7 @@ if ! [[ $libdirs ]] ; then
[[ -d /usr/lib ]] && libdirs+=" /usr/lib" [[ -d /usr/lib ]] && libdirs+=" /usr/lib"
fi fi
libdirs+="$(ldconfig_paths)" libdirs+=" $(ldconfig_paths)"
export libdirs export libdirs
fi fi
@@ -579,7 +625,7 @@ host_fs_all()
check_block_and_slaves() { check_block_and_slaves() {
local _x local _x
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry. [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
"$1" $2 && return if ! lvm_internal_dev $2; then "$1" $2 && return; fi
check_vol_slaves "$@" && return 0 check_vol_slaves "$@" && return 0
if [[ -f /sys/dev/block/$2/../dev ]]; then if [[ -f /sys/dev/block/$2/../dev ]]; then
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0 check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
@@ -595,7 +641,7 @@ check_block_and_slaves() {
check_block_and_slaves_all() { check_block_and_slaves_all() {
local _x _ret=1 local _x _ret=1
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry. [[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
if "$1" $2; then if ! lvm_internal_dev $2 && "$1" $2; then
_ret=0 _ret=0
fi fi
check_vol_slaves "$@" && return 0 check_vol_slaves "$@" && return 0
@@ -882,7 +928,10 @@ inst_rules() {
fi fi
done done
fi fi
for r in '' ./ $dracutbasedir/rules.d/; do for r in '' $dracutbasedir/rules.d/; do
# skip rules without an absolute path
[[ "${r}$_rule" != /* ]] && continue
if [[ -f ${r}$_rule ]]; then if [[ -f ${r}$_rule ]]; then
_found="${r}$_rule" _found="${r}$_rule"
inst_rule_programs "$_found" inst_rule_programs "$_found"
@@ -895,6 +944,34 @@ inst_rules() {
done done
} }
inst_rules_wildcard() {
local _target=/etc/udev/rules.d _rule _found
inst_dir "${udevdir}/rules.d"
inst_dir "$_target"
for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
if [[ -e $_rule ]]; then
inst_rule_programs "$_rule"
inst_rule_group_owner "$_rule"
inst_rule_initqueue "$_rule"
inst_simple "$_rule"
_found=$_rule
fi
done
if [ -n ${hostonly} ] ; then
for _rule in ${_target}/$1 ; do
if [[ -f $_rule ]]; then
inst_rule_programs "$_rule"
inst_rule_group_owner "$_rule"
inst_rule_initqueue "$_rule"
inst_simple "$_rule"
_found=$_rule
fi
done
fi
[[ $_found ]] || dinfo "Skipping udev rule: $_rule"
}
prepare_udev_rules() { prepare_udev_rules() {
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version) [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
@@ -1052,7 +1129,7 @@ module_check() {
. $_moddir/module-setup.sh . $_moddir/module-setup.sh
is_func check || return 0 is_func check || return 0
[ $_forced -ne 0 ] && unset hostonly [ $_forced -ne 0 ] && unset hostonly
check $hostonly moddir=$_moddir check $hostonly
_ret=$? _ret=$?
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
fi fi
@@ -1078,7 +1155,7 @@ module_check_mount() {
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
check() { false; } check() { false; }
. $_moddir/module-setup.sh . $_moddir/module-setup.sh
check 0 moddir=$_moddir check 0
_ret=$? _ret=$?
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
fi fi
@@ -1102,7 +1179,7 @@ module_depends() {
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
depends() { true; } depends() { true; }
. $_moddir/module-setup.sh . $_moddir/module-setup.sh
depends moddir=$_moddir depends
_ret=$? _ret=$?
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
return $_ret return $_ret
@@ -1123,7 +1200,7 @@ module_cmdline() {
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
cmdline() { true; } cmdline() { true; }
. $_moddir/module-setup.sh . $_moddir/module-setup.sh
cmdline moddir=$_moddir cmdline
_ret=$? _ret=$?
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
return $_ret return $_ret
@@ -1144,7 +1221,7 @@ module_install() {
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
install() { true; } install() { true; }
. $_moddir/module-setup.sh . $_moddir/module-setup.sh
install moddir=$_moddir install
_ret=$? _ret=$?
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
return $_ret return $_ret
@@ -1165,7 +1242,7 @@ module_installkernel() {
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
installkernel() { true; } installkernel() { true; }
. $_moddir/module-setup.sh . $_moddir/module-setup.sh
installkernel moddir=$_moddir installkernel
_ret=$? _ret=$?
unset check depends cmdline install installkernel unset check depends cmdline install installkernel
return $_ret return $_ret
@@ -1452,13 +1529,6 @@ dracut_kernel_post() {
wait $_pid wait $_pid
fi fi
for _f in modules.builtin.bin modules.builtin; do
[[ $srcmods/$_f ]] && break
done || {
dfatal "No modules.builtin.bin and modules.builtin found!"
return 1
}
for _f in modules.builtin.bin modules.builtin modules.order; do for _f in modules.builtin.bin modules.builtin modules.order; do
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f" [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
done done
@@ -1477,7 +1547,7 @@ dracut_kernel_post() {
module_is_host_only() { module_is_host_only() {
local _mod=$1 local _mod=$1
local _modenc a i local _modenc a i _k _s _v _aliases
_mod=${_mod##*/} _mod=${_mod##*/}
_mod=${_mod%.ko} _mod=${_mod%.ko}
_modenc=${_mod//-/_} _modenc=${_mod//-/_}
@@ -1494,19 +1564,25 @@ module_is_host_only() {
# this covers the case, where a new module is introduced # this covers the case, where a new module is introduced
# or a module was renamed # or a module was renamed
# or a module changed from builtin to a module # or a module changed from builtin to a module
if [[ -d /lib/modules/$kernel_current ]]; then if [[ -d /lib/modules/$kernel_current ]]; then
# if the modinfo can be parsed, but the module # if the modinfo can be parsed, but the module
# is not loaded, then we can safely return 1 # is not loaded, then we can safely return 1
modinfo -F filename "$_mod" &>/dev/null && return 1 modinfo -F filename "$_mod" &>/dev/null && return 1
fi fi
# Finally check all modalias, if we install for a kernel _aliases=$(modinfo -k $kernel -F alias $_mod 2>/dev/null)
# different from the current one
for a in $(modinfo -k $kernel -F alias $_mod 2>/dev/null); do # if the module has no aliases, install it
[[ $_aliases ]] || return 0
# finally check all modalias
for a in $_aliases; do
for i in "${!host_modalias[@]}"; do for i in "${!host_modalias[@]}"; do
[[ $i == $a ]] && return 0 [[ $i == $a ]] && return 0
done done
done done
fi fi
return 1 return 1
@@ -1520,7 +1596,7 @@ find_kernel_modules_by_path () {
_OLDIFS=$IFS _OLDIFS=$IFS
IFS=: IFS=:
while read a rest; do while read a rest; do
[[ $a = */$1/* ]] || continue [[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue
printf "%s\n" "$srcmods/$a" printf "%s\n" "$srcmods/$a"
done < "$srcmods/modules.dep" done < "$srcmods/modules.dep"
IFS=$_OLDIFS IFS=$_OLDIFS
@@ -1669,3 +1745,15 @@ get_ucode_file ()
printf "%02x-%02x-%02x" ${family} ${model} ${stepping} printf "%02x-%02x-%02x" ${family} ${model} ${stepping}
fi fi
} }
# Not every device in /dev/mapper should be examined.
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
lvm_internal_dev() {
local dev_dm_dir=/sys/dev/block/$1/dm
[[ ! -f $dev_dm_dir/uuid || $(<$dev_dm_dir/uuid) != LVM-* ]] && return 1 # Not an LVM device
local DM_VG_NAME DM_LV_NAME DM_LV_LAYER
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$(<$dev_dm_dir/name)" 2>/dev/null)
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 0 # Better skip this!
[[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
}

View File

@@ -20,6 +20,8 @@ if zcat "$IMG" | cpio -id --quiet >/dev/null; then
rm -f -- .need_shutdown rm -f -- .need_shutdown
elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
rm -f -- .need_shutdown rm -f -- .need_shutdown
elif lz4 -d -c "$IMG" | cpio -id --quiet >/dev/null; then
rm -f -- .need_shutdown
else else
# something failed, so we clean up # something failed, so we clean up
echo "Unpacking of $IMG to /run/initramfs failed" >&2 echo "Unpacking of $IMG to /run/initramfs failed" >&2

View File

@@ -140,19 +140,25 @@ dlog_init() {
fi fi
fi fi
if (( $UID != 0 )); then
kmsgloglvl=0
sysloglvl=0
fi
if (( $sysloglvl > 0 )); then if (( $sysloglvl > 0 )); then
if [[ -d /run/systemd/journal ]] \ if [[ -d /run/systemd/journal ]] \
&& type -P systemd-cat &>/dev/null \ && type -P systemd-cat &>/dev/null \
&& (( $UID == 0 )) \ && systemctl --quiet is-active systemd-journald.socket &>/dev/null \
&& systemctl is-active systemd-journald.socket &>/dev/null; then && { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)" readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
readonly _systemdcatfile="$_dlogdir/systemd-cat" readonly _systemdcatfile="$_dlogdir/systemd-cat"
mkfifo "$_systemdcatfile" mkfifo "$_systemdcatfile"
readonly _dlogfd=15 readonly _dlogfd=15
systemd-cat -t 'dracut' <"$_systemdcatfile" & systemd-cat -t 'dracut' --level-prefix=true <"$_systemdcatfile" &
exec 15>"$_systemdcatfile" exec 15>"$_systemdcatfile"
elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
# We cannot log to syslog, so turn this facility off. # We cannot log to syslog, so turn this facility off.
kmsgloglvl=$sysloglvl
sysloglvl=0 sysloglvl=0
ret=1 ret=1
errmsg="No '/dev/log' or 'logger' included for syslog logging" errmsg="No '/dev/log' or 'logger' included for syslog logging"
@@ -324,7 +330,7 @@ _do_dlog() {
if (( $lvl <= $sysloglvl )); then if (( $lvl <= $sysloglvl )); then
if [[ "$_dlogfd" ]]; then if [[ "$_dlogfd" ]]; then
echo "<$(_dlvl2syslvl $lvl)>$msg" >&$_dlogfd printf -- "<%s>%s\n" "$(($(_dlvl2syslvl $lvl) & 7))" "$msg" >&$_dlogfd
else else
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg" logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) -- "$msg"
fi fi

View File

@@ -10,7 +10,7 @@ dracut - low-level tool for generating an initramfs image
SYNOPSIS SYNOPSIS
-------- --------
*dracut* ['OPTION...'] [<image> [_<kernel version>_]] *dracut* [__OPTION...__] [__<image>__ [__<kernel version>__]]
DESCRIPTION DESCRIPTION
----------- -----------
@@ -33,57 +33,14 @@ For a complete list of kernel command line options see *dracut.cmdline*(7).
If you are dropped to an emergency shell, while booting your initramfs, If you are dropped to an emergency shell, while booting your initramfs,
the file _/run/initramfs/rdsosreport.txt_ is created, which can be safed to a the file _/run/initramfs/rdsosreport.txt_ is created, which can be safed to a
(to be mounted by hand) partition (usually /boot) or a USB stick. (to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel command line. Additional debugging info can be produced by adding **rd.debug** to the kernel
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools. command line. _/run/initramfs/rdsosreport.txt_ contains all logs and the output
It should be attached to any report about dracut problems. of some tools. It should be attached to any report about dracut problems.
EXAMPLE USAGE
------- -----
To create a initramfs image, the most simple command is:
----
# dracut
----
This will generate a general purpose initramfs image, with all possible
functionality resulting of the combination of the installed dracut modules and
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
contains the kernel modules of the currently active kernel with version
_++<kernel version>++_.
If the initramfs image already exists, dracut will display an error message, and
to overwrite the existing image, you have to use the --force option.
----
# dracut --force
----
If you want to specify another filename for the resulting image you would issue
a command like:
----
# dracut foobar.img
----
To generate an image for a specific kernel version, the command would be:
----
# dracut foobar.img 2.6.40-1.rc5.f20
----
A shortcut to generate the image at the default location for a specific kernel
version is:
----
# dracut --kver 2.6.40-1.rc5.f20
----
If you want to create lighter, smaller initramfs images, you may want to specify
the --hostonly or -H option. Using this option, the resulting image will
contain only those dracut modules, kernel modules and filesystems, which are
needed to boot this specific machine. This has the drawback, that you can't put
the disk on another controller or machine, and that you can't switch to another
root filesystem, without recreating the initramfs image. The usage of the
--hostonly option is only for experts and you will have to keep the broken
pieces. At least keep a copy of a general purpose image (and corresponding
kernel) as a fallback to rescue your system.
include::dracut.usage.asc[]
OPTIONS OPTIONS
------- -------
@@ -269,6 +226,12 @@ example:
**--nostrip**:: **--nostrip**::
do not strip binaries in the initramfs do not strip binaries in the initramfs
**--prelink**::
prelink binaries in the initramfs (default)
**--noprelink**::
do not prelink binaries in the initramfs
**--hardlink**:: **--hardlink**::
hardlink files in the initramfs (default) hardlink files in the initramfs (default)
@@ -312,6 +275,12 @@ Default:
**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module. **--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.
**--logfile** _<logfile>_:: logfile to use; overrides any setting from
the configuration files.
+
Default:
_/var/log/dracut.log_
**-l, --local**:: **-l, --local**::
activates the local mode. dracut will use modules from the current working activates the local mode. dracut will use modules from the current working
directory instead of the system-wide installed modules in directory instead of the system-wide installed modules in
@@ -331,7 +300,13 @@ provide a valid _/etc/fstab_.
**-N, --no-hostonly**:: **-N, --no-hostonly**::
Disable Host-Only mode Disable Host-Only mode
**--persistent-policy** _<policy>_:: **--hostonly-cmdline**:
Store kernel command line arguments needed in the initramfs
**--no-hostonly-cmdline**:
Do not store kernel command line arguments needed in the initramfs
**--persistent-policy** _<policy>_::
Use _<policy>_ to address disks and partitions. Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk. _<policy>_ can be any directory name found in /dev/disk.
E.g. "by-uuid", "by-label" E.g. "by-uuid", "by-label"
@@ -339,12 +314,16 @@ provide a valid _/etc/fstab_.
**--fstab**:: **--fstab**::
Use _/etc/fstab_ instead of _/proc/self/mountinfo_. Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
**--add-fstab** _<filename>_ :: **--add-fstab** _<filename>_::
Add entries of _<filename>_ to the initramfs /etc/fstab. Add entries of _<filename>_ to the initramfs /etc/fstab.
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ _<filesystem options>_":: **--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ [_<filesystem options>_ [_<dump frequency>_ [_<fsck order>_]]]"::
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ in the
options>_ in the initramfs initramfs. _<filesystem options>_, _<dump options>_ and _<fsck order>_ can
be specified, see fstab manpage for the details.
The default _<filesystem options>_ is "defaults".
The default _<dump frequency>_ is "0".
the default _<fsck order>_ is "2".
**--add-device** _<device>_ :: **--add-device** _<device>_ ::
Bring up _<device>_ in initramfs, _<device>_ should be the device name. Bring up _<device>_ in initramfs, _<device>_ should be the device name.
@@ -352,13 +331,13 @@ provide a valid _/etc/fstab_.
LVM or an encrypted partition. LVM or an encrypted partition.
[NB --device can be used for compatibility with earlier releases] [NB --device can be used for compatibility with earlier releases]
**-i, --include** _<SOURCE>_ _<TARGET>_:: **-i, --include** _<SOURCE>_ _<TARGET>_::
include the files in the SOURCE directory into the include the files in the SOURCE directory into the
TARGET directory in the final initramfs. If SOURCE is a file, it will be TARGET directory in the final initramfs. If SOURCE is a file, it will be
installed to TARGET in the final initramfs. This parameter can be specified installed to TARGET in the final initramfs. This parameter can be specified
multiple times. multiple times.
**-I, --install** _<file list>_:: **-I, --install** _<file list>_::
install the space separated list of files into the initramfs. install the space separated list of files into the initramfs.
+ +
[NOTE] [NOTE]
@@ -399,7 +378,24 @@ will not be able to boot. Equivalent to "lzma --compress=lzma -9"
[WARNING] [WARNING]
==== ====
Make sure your kernel has xz decompression support compiled in, otherwise you Make sure your kernel has xz decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma2=dict=1MiB" will not be able to boot. Equivalent to
"lzma --compress=xz --check=crc32 --lzma2=dict=1MiB"
====
**--lzo**::
Compress the generated initramfs using lzop.
[WARNING]
====
Make sure your kernel has lzo decompression support compiled in, otherwise you
will not be able to boot.
====
**--lz4**::
Compress the generated initramfs using lz4.
[WARNING]
====
Make sure your kernel has lz4 decompression support compiled in, otherwise you
will not be able to boot.
==== ====
**--compress** _<compressor>_:: **--compress** _<compressor>_::
@@ -444,8 +440,8 @@ will not be able to boot. Equivalent to "lzma --compress=xz --check=crc32 --lzma
---- ----
**--regenerate-all**:: **--regenerate-all**::
Regenerate all initramfs images at the default location with the kernel versions found on the system. Regenerate all initramfs images at the default location with the kernel
Additional parameters are passed through. versions found on the system. Additional parameters are passed through.
FILES FILES
----- -----
@@ -473,9 +469,10 @@ _/etc/conf.d/_::
set in the configuration files. set in the configuration files.
_/etc/cmdline_:: _/etc/cmdline_::
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf. Can contain additional command line options. Deprecated, better use
/etc/cmdline.d/*.conf.
_/etc/cmdline.d/*.conf:: _/etc/cmdline.d/*.conf_::
Can contain additional command line options. Can contain additional command line options.
AVAILABILITY AVAILABILITY

View File

@@ -1,7 +1,7 @@
dracut dracut
====== ======
Harald Hoyer <harald@redhat.com> Harald Hoyer <harald@redhat.com>
v2.0, March 2011 v3.0, October 2013
:language: bash :language: bash
@@ -125,12 +125,14 @@ started looks like <<dracutbootup7>>.
== Dracut on shutdown == Dracut on shutdown
On a systemd driven system, the dracut initramfs is also used for the shutdown procedure. On a systemd driven system, the dracut initramfs is also used for the shutdown
procedure.
The following steps are executed during a shutdown: The following steps are executed during a shutdown:
* systemd switches to the shutdown.target * systemd switches to the shutdown.target
* systemd starts /lib/systemd/system/shutdown.target.wants/dracut-shutdown.service * systemd starts
/lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
* dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore * dracut-shutdown.service executes /usr/lib/dracut/dracut-initramfs-restore
which unpacks the initramfs to /run/initramfs which unpacks the initramfs to /run/initramfs
* systemd finishes shutdown.target * systemd finishes shutdown.target
@@ -138,892 +140,19 @@ The following steps are executed during a shutdown:
* systemd tries to unmount everything and mounts the remaining read-only * systemd tries to unmount everything and mounts the remaining read-only
* systemd checks, if there is a /run/initramfs/shutdown executable * systemd checks, if there is a /run/initramfs/shutdown executable
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown. * if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
The old root is then mounted on /oldroot. /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable. The old root is then mounted on /oldroot.
* shutdown will try to umount every /oldroot mount and calls the various shutdown hooks from the dracut modules /usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
* shutdown will try to umount every /oldroot mount and calls the various
shutdown hooks from the dracut modules
This ensures, that all devices are disassembled and unmounted cleanly. This ensures, that all devices are disassembled and unmounted cleanly.
= User Manual = User Manual
== Creating an initramfs Image
To create a initramfs image, the most simple command is:
----
# dracut
----
This will generate a general purpose initramfs image, with all possible
functionality resulting of the combination of the installed dracut modules and
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
contains the kernel modules of the currently active kernel with version
_++<kernel version>++_.
If the initramfs image already exists, dracut will display an error message, and
to overwrite the existing image, you have to use the --force option.
----
# dracut --force
----
If you want to specify another filename for the resulting image you would issue
a command like:
----
# dracut foobar.img
----
To generate an image for a specific kernel version, the command would be:
----
# dracut foobar.img 2.6.40-1.rc5.f20
----
A shortcut to generate the image at the default location for a specific kernel
version is:
----
# dracut --kver 2.6.40-1.rc5.f20
----
If you want to create lighter, smaller initramfs images, you may want to specify
the --host-only or -H option. Using this option, the resulting image will
contain only those dracut modules, kernel modules and filesystems, which are
needed to boot this specific machine. This has the drawback, that you can't put
the disk on another controller or machine, and that you can't switch to another
root filesystem, without recreating the initramfs image. The usage of the
--host-only option is only for experts and you will have to keep the broken
pieces. At least keep a copy of a general purpose image (and corresponding
kernel) as a fallback to rescue your system.
=== Inspecting the Contents
To see the contents of the image created by dracut, you can use the lsinitrd tool.
----
# lsinitrd /boot/initramfs-$(uname -r).img | less
----
To display the contents of a file in the initramfs also use the lsinitrd tool:
----
# lsinitrd /boot/initramfs-$(uname -r).img /etc/ld.so.conf
include ld.so.conf.d/*.conf
----
=== Adding dracut Modules
Some dracut modules are turned off by default and have to be activated manually.
You can do this by adding the dracut modules to the configuration file
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See <<dracutconf5>>.
You can also add dracut modules on the command line
by using the -a or --add option:
----
# dracut --add bootchart initramfs-bootchart.img
----
To see a list of available dracut modules, use the --list-modules option:
----
# dracut --list-modules
----
or, if you have a dracut version earlier than +008+, issue the command:
----
# for mod in /usr/lib/dracut/modules.d/*; do echo ${mod##*/??}; done
----
=== Omitting dracut Modules
Sometimes you don't want a dracut module to be included for reasons of speed,
size or functionality. To do this, either specify the omit_dracutmodules
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
file (see <<dracutconf5>>), or use the -o or --omit option
on the command line:
----
# dracut -o "multipath lvm" no-multipath-lvm.img
----
=== Adding Kernel Modules
If you need a special kernel module in the initramfs, which is not
automatically picked up by dracut, you have the use the --add-drivers option
on the command line or the drivers vaiable in the _/etc/dracut.conf_
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see <<dracutconf5>>):
----
# dracut --add-drivers mymod initramfs-with-mymod.img
----
== Boot parameters
The generated initramfs.img file normally does not contain any system
configuration files (except for some special exceptions), so the configuration
has to be done on the kernel command line. With this flexibility, you can easily
boot from a changed root partition, without the need to recompile the initramfs
image. So, you could completly change your root partition (move it inside a md
raid with encryption and LVM on top), as long as you specify the correct
filesystem LABEL or UUID on the kernel command line for your root device, dracut
will find it and boot from it.
The kernel command line usually can be configured in _/boot/grub/grub.conf_, if
grub is your bootloader and it also can be edited in the real boot process in
the grub menu.
The kernel command line can also be provided by the dhcp server with the
root-path option. See <<NetworkBoot>>.
For a full reference of all kernel command line parameters, see <<dracut8>>.
=== Specifying the root Device
This is the only option dracut really needs to boot from your root partition.
Because your root partition can live in various environments, there are a lot of
formats for the root= option. The most basic one is root=_++<path to device
node>++_:
----
root=/dev/sda2
----
Because device node names can change, dependent on the drive ordering, you are
encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL)
to specify your root partition:
----
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
----
or
----
root=LABEL=myrootpartitionlabel
----
To see all UUIDs or LABELs on your system, do:
----
# ls -l /dev/disk/by-uuid
----
or
----
# ls -l /dev/disk/by-label
----
If your root partition is on the network see <<NetworkBoot>>.
=== Keyboard Settings
If you have to input passwords for encrypted disk volumes, you might want to set
the keyboard layout and specify a display font.
A typical german kernel command would contain:
----
vconsole.font=latarcyrheb-sun16 vconsole.keymap=de-latin1-nodeadkeys locale.LANG=de_DE.UTF-8
----
Setting these options can override the setting stored on your system, if you use
a modern init system, like systemd.
For dracut versions prior to version +008+ the line would look like:
----
LANG=de_DE.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de-latin1-nodeadkeys
----
=== Blacklisting Kernel Modules
Sometimes it is required to prevent the automatic kernel module loading of a
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
name>++_, with _++<kernel module name>++_ not containing the _.ko_
suffix, to the kernel command line. For example:
----
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
----
The option can be specified multiple times on the kernel command line.
=== Speeding up the Boot Process
If you want to speed up the boot process, you can specify as much information
for dracut on the kernel command as possible. For example, you can tell dracut,
that you root partition is not on a LVM volume or not on a raid partition, or
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
searches everywhere. A typical dracut kernel command line for a plain primary or
logical partition would contain:
----
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
----
On systems with dracut version prior to +008+ the line would look like:
----
rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM
----
This turns off every automatic assembly of LVM, MD raids, DM raids and crypto LUKS.
Of course, you could also omit the dracut modules in the initramfs creation
process, but then you would lose the posibility to turn it on on demand.
[[Injecting]]
=== Injecting custom Files
To add your own files to the initramfs image, you have several possibilities.
The --include option let you specify a source path and a target path. For example
----
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
----
will create an initramfs image, where the file cmdline-preset will be copied
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only be specified once.
----
# mkdir rd.live.overlay
# mkdir rd.live.overlay/etc
# mkdir rd.live.overlay/etc/conf.d
# mkdir rd.live.overlay/etc/cmdline.d
# echo "ip=auto" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# tree rd.live.overlay/
rd.live.overlay/
└── etc
├── cmdline.d
│   └── mycmdline.conf
└── conf.d
└── testvar.conf
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
----
This will put the contents of the rd.live.overlay directory into the root of the
initramfs image.
The --install option let you specify several files, which will get installed in
the initramfs image at the same location, as they are present on initramfs
creation time.
----
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
----
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
together with the libraries needed to start those. The --install option can be
specified multiple times.
[[NetworkBoot]]
== Network Boot
If your root partition is on a network drive, you have to have the network
dracut modules installed to create a network aware initramfs image.
On a Red Hat Enterprise Linux or Fedora system, this means, you have to install
the _dracut-network_ rpm package:
----
# yum install dracut-network
----
The resulting initramfs image can be served by a boot manager residing on your
local hard drive or it can be served by a PXE/TFTP server.
How to setup your PXE/TFTP server can be found in the
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
Hat Enterprise Linux Storage Administration Guide].
If you specify ip=auto on the kernel command line, then dracut asks a dhcp
server about the ip adress for the machine. The dhcp server can also serve an
additional root-path, which will set the root device for dracut. With this
mechanism, you have static configuration on your client machine and a
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a method described
in <<Injecting>>.
=== Reducing the Image Size
To reduce the size of the initramfs, you should create it with by ommitting all
dracut modules, which you know, you don't need to boot the machine.
You can also specify the exact dracut and kernel modules to produce a very tiny
initramfs image.
For example for a NFS image, you would do:
----
# dracut -m "nfs network base" initramfs-nfs-only.img
----
Then you would boot from this image with your target machine and reduce the size
once more by creating it on the target machine with the --host-only option:
----
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
----
This will reduce the size of the initramfs image significantly.
=== NFS Root Device
FIXME
=== iSCSI Root Device
FIXME
=== FCoE Root Device
FIXME
== Troubleshooting
If the boot process does not succeed, you have several options to debug the
situation. Some of the basic operations are covered here. For more information
you should also visit:
http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
[[identifying-your-problem-area]]
=== Identifying your problem area
. Remove ''rhgb'' and ''quiet'' from the kernel command line
. Add ''rd.shell'' to the kernel command line. This will present a shell should
dracut be unable to locate your root device
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
dracut shell commands are printed as they are executed
. With dracut >= 002-11, you can inspect the rd.debug output with:
+
----
# less /run/initramfs/init.log
# dmesg | less
----
. With dracut >= 022 and systemd, you can inspect the rd.debug output with:
----
# journalctl -ab
----
. With dracut >= 025 the file /run/initramfs/rdsosreport.txt is generated, which contains all the logs and the output of all significant tools, which are mentioned later.
If you want to save that output, simply mount /boot by hand or insert an USB stick and mount that.
Then you can store the output for later inspection.
[[information-to-include-in-your-report]]
=== Information to include in your report
[[all-bug-reports]]
==== All bug reports
In all cases, the following should be mentioned and attached to your bug report:
* The exact kernel command-line used. Typically from the bootloader
configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
* A copy of your disk partition information from _/etc/fstab_, which might be
obtained booting an old working initramfs or a rescue medium.
* A device listing from device-mapper. This can be obtained by running the
command
+
----
# dmsetup ls --tree
----
+
* A list of block device attributes. This can be obtained by running the commands:
+
----
# blkid -p
# blkid -p -o udev
----
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
all relevant information from the boot log. This can be obtained by running the
command
+
----
# dmesg|grep dracut
----
+
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
all files in _/etc/dracut.conf.d/*.conf_
[[logical-volume-management-related-problems]]
==== Logical Volume Management related problems
As well as the information from <<all-bug-reports>> include the following
information:
* Include physical volume information by running the command:
+
----
# lvm pvdisplay
----
+
* Include volume group information by running the command:
+
----
# lvm vgdisplay
----
+
* Include logical volume information by running the command:
+
----
# lvm lvdisplay
----
[[software-raid-related-problems]]
==== Software RAID related problems
As well as the information from <<all-bug-reports>>, include the following
information:
* If using software RAID disk partitions, please include the output of
+
----
# cat /proc/mdstat
----
[[network-root-device-related-problems]]
==== Network root device related problems
This section details information to include when experiencing problems on a
system whose root device is located on a network attached volume (e.g. iSCSI,
NFS or NBD). As well as the information from <<all-bug-reports>>, include the
following information:
* Please include the output of
+
----
# /sbin/ifup <interfacename>
# ip addr show
----
[[debugging-dracut]]
=== Debugging dracut
[[configure-a-serial-console]]
==== Configure a serial console
Successfully debugging dracut will require some form of console
logging during the system boot. This section documents configuring a
serial console connection to record boot messages.
. First, enable serial console output for both the kernel and the bootloader.
. Open the file _/etc/grub.conf_ for editing. Below the line ''timeout=5'', add
the following:
+
----
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
----
+
. Also in _/etc/grub.conf_, add the following boot arguemnts to the ''kernel''
line:
+
----
console=tty0 console=ttyS0,9600
----
+
. When finished, the _/etc/grub.conf_ file should look similar to the example
below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
----
+
. More detailed information on how to configure the kernel for console output
can be found at
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
. Redirecting non-interactive output
+
--
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
will put it out on the console when it reaches the kernel buffer by doing
----
# exec >/dev/kmsg 2>&1 </dev/console
----
--
[[using-the-dracut-shell]]
==== Using the dracut shell
dracut offers a shell for interactive debugging in the event dracut fails to
locate your root filesystem. To enable the shell:
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
(e.g. _/etc/grub.conf_)
. Remove the boot arguments ''rhgb'' and ''quiet''
+
A sample _/etc/grub.conf_ bootloader configuration file is listed below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
----
+
. If system boot fails, you will be dropped into a shell as seen in the example below.
+
----
No root device found
Dropping to debug shell.
#
----
+
. Use this shell prompt to gather the information requested above (see <<all-bug-reports>>).
[[accessing-the-root-volume-from-the-dracut-shell]]
==== Accessing the root volume from the dracut shell
From the dracut debug shell, you can manually perform the task of locating and
preparing your root volume for boot. The required steps will depend on how your
root volume is configured. Common scenarios include:
* A block device (e.g. _/dev/sda7_)
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
* An encrypted device (e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
* A network attached device (e.g. netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.fedoraproject:for.all)
The exact method for locating and preparing will vary. However, to continue with
a successful boot, the objective is to locate your root volume and create a
symlink _/dev/root_ which points to the file system. For example, the following
example demonstrates accessing and booting a root volume that is an encrypted
LVM Logical volume.
. Inspect your partitions using parted
+
----
# parted /dev/sda -s p
Model: ATA HTS541060G9AT00 (scsi)
Disk /dev/sda: 60.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 10.8GB 107MB primary ext4 boot
2 10.8GB 55.6GB 44.7GB logical lvm
----
+
. You recall that your root volume was a LVM logical volume. Scan and activate
any logical volumes.
+
----
# lvm vgscan
# lvm vgchange -ay
----
+
. You should see any logical volumes now using the command blkid:
+
----
# blkid
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
----
+
. From the output above, you recall that your root volume exists on an encrypted
block device. Following the guidance disk encryption guidance from the
Installation Guide, you unlock your encrypted root volume.
+
----
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
Enter passphrase for /dev/mapper/linux-root:
Key slot 0 unlocked.
----
+
. Next, make a symbolic link to the unlocked root volume
+
----
# ln -s /dev/mapper/luks-$UUID /dev/root
----
+
. With the root volume available, you may continue booting the system by exiting
the dracut shell
+
----
# exit
----
[[additional-dracut-boot-parameters]]
==== Additional dracut boot parameters
For more debugging options, see <<dracutkerneldebug>> in <<dracutcmdline7>>.
[[debugging-dracut-on-shutdown]]
==== Debugging dracut on shutdown
To debug the shutdown sequence on systemd systems, you can _rd.break_
on _pre-shutdown_ or _shutdown_.
To do this from an already booted system:
----
# mkdir -p /run/initramfs/etc/cmdline.d
# echo "rd.break=pre-shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
# touch /run/initramfs/.need_shutdown
----
This will give you a dracut shell after the system pivot'ed back in the initramfs.
= Developer Manual
== dracut Components
dracut uses a modular system to build and extend the initramfs image. All
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
The most basic dracut module is _99base_. In _99base_ the initial shell script
init is defined, which gets run by the kernel after initramfs loading. Although
you can replace init with your own version of _99base_, this is not encouraged.
Instead you should use, if possible, the hooks of dracut. All hooks, and the
point of time in which they are executed, are described in <<stages>>.
The main script, which creates the initramfs is dracut itsself. It parses all
arguments and sets up the directory, in which everything is installed. It then
executes all check, install, installkernel scripts found in the modules, which
are to be processed. After everything is installed, the install directory is
archived and compressed to the final initramfs image. All helper functions used
by check, install and installkernel are found in in the file _dracut-functions_.
These shell functions are available to all module installer (install,
installkernel) scripts, without the need to source _dracut-functions_.
A module can check the preconditions for install and installkernel with the
check script. Also dependencies can be expressed with check. If a module passed
check, install and installkernel will be called to install all of the necessary
files for the module. To split between kernel and non-kernel parts of the
installation, all kernel module related parts have to be in installkernel. All
other files found in a module directory are module specific and mostly are hook
scripts and udev rules.
[[stages]]
== Boot Process Stages
dracut modules can insert custom script at various points, to control the boot
process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
=== Hook: cmdline
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
and prepare the later actions, like setting up udev rules and configuration
files.
In this hook the most important environment variable is defined: root. The
second one is rootok, which indicates, that a module claimed to be able to parse
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
iscsi dracut module, which then sets rootok.
=== Hook: pre-udev
This hook is executed right after the cmdline hook and a check if root and
rootok were set. Here modules can take action with the final root, and before
udev has been run.
=== Start Udev
Now udev is started and the logging for udev is setup.
=== Hook: pre-trigger
In this hook, you can set udev environment variables with **udevadm control
--property=KEY=_value_** or control the further execution of udev with
udevadm.
=== Trigger Udev
udev is triggered by calling udevadm trigger, which sends add events for all
devices and subsystems.
=== Main Loop
In the main loop of dracut loops until udev has settled and
all scripts in _initqueue/finished_ returned true.
In this loop there are three hooks, where scripts can be inserted
by calling /sbin/initqueue.
==== Initqueue
This hook gets executed every time a script is inserted here, regardless of the
udev state.
==== Initqueue settled
This hooks (initqueue/settled) gets executed every time udev has settled.
==== Initqueue timeout
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes half of the
rd.retry counter.
==== Initqueue finished
This hook (initqueue/finished) is called after udev has settled and
if all scripts herein return 0 the main loop will be ended.
Abritary scripts can be added here, to loop in the
initqueue until something happens, which a dracut module wants to wait for.
=== Hook: pre-mount
Before the root device is mounted all scripts in the hook pre-mount are
executed. In some cases (e.g. NFS) the real root device is already mounted,
though.
=== Hook: mount
This hook is mainly to mount the real root device.
=== Hook: pre-pivot
This hook is called before cleanup hook, This is a good place for
actions other than cleanups which need to be called before pivot.
=== Hook: cleanup
This hook is the last hook and is called before init finally switches root to
the real root device. This is a good place to clean up and kill processes not
needed anymore.
=== Cleanup and switch_root
Init (or systemd) kills all udev processes, cleans up the environment,
sets up the arguments for the real init process and finally calls switch_root.
switch_root removes the whole filesystem hierarchy of the initramfs,
chroot()s to the real root device and calls /sbin/init with the specified arguments.
To ensure all files in the initramfs hierarchy can be removed, all processes
still running from the initramfs should not have any open file descriptors left.
== Network Infrastructure
FIXME
== Writing a Module
A simple example module is _96insmodpost_, which modprobes a kernel module after
udev has settled and the basic device drivers have been loaded.
All module installation information is in the file module-setup.sh.
First we create a check() function, which just exits with 0 indicating that this
module should be included by default.
check():
----
return 0
----
The we create the install() function, which installs a cmdline hook with
priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.
install():
----
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
----
The _pase-instmodpost.sh_ parses the kernel command line for a argument
rd.driver.post, blacklists the module from being autoloaded and installs the
hook _insmodpost.sh_ in the _initqueue/settled_.
_parse-insmodpost.sh_:
----
for p in $(getargs rd.driver.post=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
_do_insmodpost=1
done
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
unset _do_insmodpost
----
_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
modprobe the kernel modules specified in all rd.driver.post kernel command line
parameters. It runs after udev has settled and is only called once (--onetime).
_insmodpost.sh_:
----
. /lib/dracut-lib.sh
for p in $(getargs rd.driver.post=); do
modprobe $p
done
----
=== check()
_check()_ is called by dracut to evaluate the inclusion of a dracut module in
the initramfs.
$hostonly:: If the $hostonly variable is set, then the module check() function
should be in "hostonly" mode, which means, that the check() should only return
0, if the module is really needed to boot this specific host.
check() should return with:
0:: Include the dracut module in the initramfs.
1:: Do not include the dracut module. The requirements are not fullfilled
(missing tools, etc.)
255:: Only include the dracut module, if another module requires it or if
explicitly specified in the config file or on the argument list.
=== depends()
The function depends() should echo all other dracut module names the module
depends on.
=== install()
inst_multiple
inst
inst_hook
inst_rules
=== installkernel()
instmods
=== Creation Functions
FIXME
=== Initramfs Functions
FIXME
=== Network Modules
FIXME
:leveloffset: 1 :leveloffset: 1
[[dracutbootup7]]
include::dracut.bootup.7.asc[]
:leveloffset: 1
[[dracut8]]
include::dracut.8.asc[] include::dracut.8.asc[]
:leveloffset: 1
[[dracutconf5]] [[dracutconf5]]
include::dracut.conf.5.asc[] include::dracut.conf.5.asc[]
@@ -1036,6 +165,15 @@ include::lsinitrd.1.asc[]
[[mkinitrd8]] [[mkinitrd8]]
include::mkinitrd.8.asc[] include::mkinitrd.8.asc[]
= Developer Manual
:leveloffset: 1
[[dracutmodules7]]
include::dracut.modules.7.asc[]
[[dracutbootup7]]
include::dracut.bootup.7.asc[]
:leveloffset: 0 :leveloffset: 0
[appendix] [appendix]
License License

View File

@@ -11,7 +11,8 @@ dracut.bootup - boot ordering in the initramfs
DESCRIPTION DESCRIPTION
----------- -----------
This flow chart illustrates the ordering of the services, if systemd is used in the dracut initramfs. This flow chart illustrates the ordering of the services, if systemd is used in
the dracut initramfs.
---- ----
systemd-journal.socket systemd-journal.socket

View File

@@ -31,16 +31,16 @@ line is the value, which is honored.
Standard Standard
~~~~~~~~ ~~~~~~~~
**init=**_<path to real init>_:: **init=**__<path to real init>__::
specify the path to the init programm to be started after the initramfs has specify the path to the init programm to be started after the initramfs has
finished finished
**root=**_<path to blockdevice>_:: **root=**__<path to blockdevice>__::
specify the block device to use as the root filesystem. specify the block device to use as the root filesystem.
+ +
E.g.: [listing]
+ .Example
---- --
root=/dev/sda1 root=/dev/sda1
root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
root=/dev/disk/by-label/Root root=/dev/disk/by-label/Root
@@ -48,15 +48,17 @@ root=LABEL=Root
root=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7 root=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7 root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7 root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
---- --
**rootfstype=**_<filesystem type>_:: "auto" if not specified, e.g.: **rootfstype=**__<filesystem type>__:: "auto" if not specified.
+ +
---- [listing]
.Example
--
rootfstype=ext3 rootfstype=ext3
---- --
**rootflags=**_<mount options>_:: **rootflags=**__<mount options>__::
specify additional mount options for the root filesystem. If not set, specify additional mount options for the root filesystem. If not set,
_/etc/fstab_ of the real root will be parsed for special mount options and _/etc/fstab_ of the real root will be parsed for special mount options and
mounted accordingly. mounted accordingly.
@@ -69,24 +71,30 @@ rootfstype=ext3
force mounting _/_ and _/usr_ (if it is a separate device) read-write. force mounting _/_ and _/usr_ (if it is a separate device) read-write.
See also ro option. See also ro option.
**rootfallback=**__<path to blockdevice>__::
specify the block device to use as the root filesystem, if the normal root
cannot be found. This can only be a simple block device with a simple file
system, for which the filesystem driver is either compiled in, or added
manually to the initramfs. This parameter can be specified multiple times.
**rd.auto** **rd.auto=1**:: **rd.auto** **rd.auto=1**::
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or lvm. enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or
Default is off as of dracut version >= 024. lvm. Default is off as of dracut version >= 024.
**rd.fstab=0**:: **rd.fstab=0**::
do not honor special mount options for the root filesystem found in do not honor special mount options for the root filesystem found in
_/etc/fstab_ of the real root. _/etc/fstab_ of the real root.
**resume=**_<path to resume partition>_:: **resume=**__<path to resume partition>__::
resume from a swap partition resume from a swap partition
+ +
E.g.: [listing]
+ .Example
---- --
resume=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 resume=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
resume=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7 resume=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7 resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
---- --
**rd.skipfsck**:: **rd.skipfsck**::
skip fsck for rootfs and _/usr_. If you're mounting _/usr_ read-only and skip fsck for rootfs and _/usr_. If you're mounting _/usr_ read-only and
@@ -96,19 +104,19 @@ resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
Misc Misc
~~~~ ~~~~
**rd.driver.blacklist=**_<drivername>[,<drivername>,...]_:: **rd.driver.blacklist=**__<drivername>__[,__<drivername>__,...]::
do not load kernel module <drivername>. This parameter can be specified do not load kernel module <drivername>. This parameter can be specified
multiple times. multiple times.
**rd.driver.pre=**_<drivername>[,<drivername>,...]_:: **rd.driver.pre=**__<drivername>__[,__<drivername>__,...]::
force loading kernel module <drivername>. This parameter can be specified force loading kernel module <drivername>. This parameter can be specified
multiple times. multiple times.
**rd.driver.post=**_<drivername>[,<drivername>,...]_:: **rd.driver.post=**__<drivername>__[,__<drivername>__,...]::
force loading kernel module <drivername> after all automatic loading modules force loading kernel module <drivername> after all automatic loading modules
have been loaded. This parameter can be specified multiple times. have been loaded. This parameter can be specified multiple times.
**rd.retry=**_<seconds>_:: **rd.retry=**__<seconds>__::
specify how long dracut should wait for devices to appear. specify how long dracut should wait for devices to appear.
The default is 30 seconds. After 2/3 of the time, degraded raids are force The default is 30 seconds. After 2/3 of the time, degraded raids are force
started. If you have hardware, which takes a very long time to announce its started. If you have hardware, which takes a very long time to announce its
@@ -117,16 +125,17 @@ Misc
**rd.noverifyssl**:: **rd.noverifyssl**::
accept self-signed certificates for ssl downloads. accept self-signed certificates for ssl downloads.
**rd.ctty=**_<terminal device>_**:: **rd.ctty=**__<terminal device>__::
specify the controlling terminal for the console. specify the controlling terminal for the console.
This is useful, if you have multiple "console=" arguments. This is useful, if you have multiple "console=" arguments.
[[dracutkerneldebug]] [[dracutkerneldebug]]
Debug Debug
~~~~~ ~~~~~
If you are dropped to an emergency shell, the file _/run/initramfs/rdsosreport.txt_ is created, If you are dropped to an emergency shell, the file
which can be safed to a (to be mounted by hand) partition (usually /boot) or a USB stick. _/run/initramfs/rdsosreport.txt_ is created, which can be safed to a (to be
Additional debugging info can be produced by adding **rd.debug** to the kernel command line. mounted by hand) partition (usually /boot) or a USB stick. Additional debugging
info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools. _/run/initramfs/rdsosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems. It should be attached to any report about dracut problems.
@@ -138,23 +147,28 @@ It should be attached to any report about dracut problems.
**rd.debug**:: **rd.debug**::
set -x for the dracut shell. set -x for the dracut shell.
If systemd is active in the initramfs, all output is logged to the systemd journal, If systemd is active in the initramfs, all output is logged to the systemd
which you can inspect with "journalctl -ab". journal, which you can inspect with "journalctl -ab".
If systemd is not active, the logs are written to dmesg and _/run/initramfs/init.log_. If systemd is not active, the logs are written to dmesg and
_/run/initramfs/init.log_.
If "quiet" is set, it also logs to the console. If "quiet" is set, it also logs to the console.
**rd.memdebug=[0-3]**:: **rd.memdebug=[0-3]**::
Print memory usage info at various points, set the verbose level from 0 to 3 Print memory usage info at various points, set the verbose level from 0 to 3.
+
Higher level means more debugging output: Higher level means more debugging output:
+
----
0 - no output 0 - no output
1 - partial /proc/meminfo 1 - partial /proc/meminfo
2 - /proc/meminfo 2 - /proc/meminfo
3 - /proc/meminfo + /proc/slabinfo 3 - /proc/meminfo + /proc/slabinfo
----
**rd.break**:: **rd.break**::
drop to a shell at the end drop to a shell at the end
**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}_:: **rd.break=**__{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}__::
drop to a shell on defined breakpoint drop to a shell on defined breakpoint
**rd.udev.info**:: **rd.udev.info**::
@@ -165,50 +179,56 @@ It should be attached to any report about dracut problems.
I18N I18N
~~~~ ~~~~
**vconsole.keymap=**_<keymap base file name>_:: **rd.vconsole.keymap=**__<keymap base file name>__::
keyboard translation table loaded by loadkeys; taken from keymaps directory; keyboard translation table loaded by loadkeys; taken from keymaps directory;
will be written as KEYMAP to _/etc/vconsole.conf_ in the initramfs, e.g.: will be written as KEYMAP to _/etc/vconsole.conf_ in the initramfs.
+ +
---- [listing]
vconsole.keymap=de-latin1-nodeadkeys .Example
---- --
rd.vconsole.keymap=de-latin1-nodeadkeys
--
**vconsole.keymap.ext=**_<list of keymap base file names>_:: **rd.vconsole.keymap.ext=**__<list of keymap base file names>__::
list of extra keymaps to bo loaded (sep. by space); will be written as list of extra keymaps to bo loaded (sep. by space); will be written as
EXT_KEYMAP to _/etc/vconsole.conf_ in the initramfs EXT_KEYMAP to _/etc/vconsole.conf_ in the initramfs
**vconsole.unicode**[=_{0|1}_]:: **rd.vconsole.unicode**::
boolean, indicating UTF-8 mode; will be written as UNICODE to boolean, indicating UTF-8 mode; will be written as UNICODE to
_/etc/vconsole.conf_ in the initramfs _/etc/vconsole.conf_ in the initramfs
**vconsole.font=**_<font base file name>_:: **rd.vconsole.font=**__<font base file name>__::
console font; taken from consolefonts directory; will be written as FONT to console font; taken from consolefonts directory; will be written as FONT to
_/etc/vconsole.conf_ in the initramfs; e.g.: _/etc/vconsole.conf_ in the initramfs.
+ +
---- [listing]
vconsole.font=LatArCyrHeb-16 .Example
---- --
rd.vconsole.font=LatArCyrHeb-16
--
**vconsole.font.map=**_<console map base file name>_:: **rd.vconsole.font.map=**__<console map base file name>__::
see description of '-m' parameter in setfont manual; taken from consoletrans see description of '-m' parameter in setfont manual; taken from consoletrans
directory; will be written as FONT_MAP to _/etc/vconsole.conf_ in the directory; will be written as FONT_MAP to _/etc/vconsole.conf_ in the
initramfs initramfs
**vconsole.font.unimap=**_<unicode table base file name>_:: **rd.vconsole.font.unimap=**__<unicode table base file name>__::
see description of '-u' parameter in setfont manual; taken from unimaps see description of '-u' parameter in setfont manual; taken from unimaps
directory; will be written as FONT_UNIMAP to _/etc/vconsole.conf_ in the directory; will be written as FONT_UNIMAP to _/etc/vconsole.conf_ in the
initramfs initramfs
**locale.LANG=**_<locale>_:: **rd.locale.LANG=**__<locale>__::
taken from the environment; if no UNICODE is defined we set its value in taken from the environment; if no UNICODE is defined we set its value in
basis of LANG value (whether it ends with ".utf8" (or similar) or not); will basis of LANG value (whether it ends with ".utf8" (or similar) or not); will
be written as LANG to _/etc/locale.conf_ in the initramfs; e.g.: be written as LANG to _/etc/locale.conf_ in the initramfs.
+ +
---- [listing]
locale.LANG=pl_PL.utf8 .Example
---- --
rd.locale.LANG=pl_PL.utf8
--
**locale.LC_ALL=**_<locale>_:: **rd.locale.LC_ALL=**__<locale>__::
taken from the environment; will be written as LC_ALL to _/etc/locale.conf_ taken from the environment; will be written as LC_ALL to _/etc/locale.conf_
in the initramfs in the initramfs
@@ -217,11 +237,11 @@ LVM
**rd.lvm=0**:: **rd.lvm=0**::
disable LVM detection disable LVM detection
**rd.lvm.vg=**_<volume group name>_:: **rd.lvm.vg=**__<volume group name>__::
only activate the volume groups with the given name. rd.lvm.vg can be only activate the volume groups with the given name. rd.lvm.vg can be
specified multiple times on the kernel command line. specified multiple times on the kernel command line.
**rd.lvm.lv=**_<logical volume name>_:: **rd.lvm.lv=**__<logical volume name>__::
only activate the logical volumes with the given name. rd.lvm.lv can be only activate the logical volumes with the given name. rd.lvm.lv can be
specified multiple times on the kernel command line. specified multiple times on the kernel command line.
@@ -233,18 +253,18 @@ crypto LUKS
**rd.luks=0**:: **rd.luks=0**::
disable crypto LUKS detection disable crypto LUKS detection
**rd.luks.uuid=**_<luks uuid>_:: **rd.luks.uuid=**__<luks uuid>__::
only activate the LUKS partitions with the given UUID. Any "luks-" of the only activate the LUKS partitions with the given UUID. Any "luks-" of the
LUKS UUID is removed before comparing to _<luks uuid>_. LUKS UUID is removed before comparing to _<luks uuid>_.
The comparisons also matches, if _<luks uuid>_ is only the beginning of the The comparisons also matches, if _<luks uuid>_ is only the beginning of the
LUKS UUID, so you don't have to specify the full UUID. LUKS UUID, so you don't have to specify the full UUID.
This parameter can be specified multiple times. This parameter can be specified multiple times.
**rd.luks.allow-discards=**_<luks uuid>_:: **rd.luks.allow-discards=**__<luks uuid>__::
Allow using of discards (TRIM) requests for LUKS partitions with the given UUID. Allow using of discards (TRIM) requests for LUKS partitions with the given
Any "luks-" of the LUKS UUID is removed before comparing to _<luks uuid>_. UUID. Any "luks-" of the LUKS UUID is removed before comparing to
The comparisons also matches, if _<luks uuid>_ is only the beginning of the _<luks uuid>_. The comparisons also matches, if _<luks uuid>_ is only the
LUKS UUID, so you don't have to specify the full UUID. beginning of the LUKS UUID, so you don't have to specify the full UUID.
This parameter can be specified multiple times. This parameter can be specified multiple times.
**rd.luks.allow-discards**:: **rd.luks.allow-discards**::
@@ -255,16 +275,28 @@ crypto LUKS
crypto LUKS - key on removable device support crypto LUKS - key on removable device support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**rd.luks.key=**_<keypath>:<keydev>:<luksdev>_:: **rd.luks.key=**__<keypath>__:__<keydev>__:__<luksdev>__::
_keypath_ is a path to key file to look for. It's REQUIRED. When _keypath_ ends with '.gpg' it's considered to be key encrypted symmetrically with GPG. You will be prompted for password on boot. GPG support comes with 'crypt-gpg' module which needs to be added explicitly. _keypath_ is a path to key file to look for. It's REQUIRED. When _keypath_
ends with '.gpg' it's considered to be key encrypted symmetrically with GPG.
You will be prompted for password on boot. GPG support comes with
'crypt-gpg' module which needs to be added explicitly.
+ +
_keydev_ is a device on which key file resides. It might be kernel name of devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label (prefix with "LABEL="). You don't have to specify full UUID. Just its beginning will suffice, even if its ambiguous. All matching devices will be probed. This parameter is recommended, but not required. If not present, all block devices will be probed, which may significantly increase boot time. _keydev_ is a device on which key file resides. It might be kernel name of
devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label
(prefix with "LABEL="). You don't have to specify full UUID. Just its beginning
will suffice, even if its ambiguous. All matching devices will be probed.
This parameter is recommended, but not required. If not present, all block
devices will be probed, which may significantly increase boot time.
+ +
If _luksdev_ is given, the specified key will only be applied for that LUKS device. Possible values are the same as for _keydev_. Unless you have several LUKS devices, you don't have to specify this parameter. The simplest usage is: If _luksdev_ is given, the specified key will only be applied for that LUKS
device. Possible values are the same as for _keydev_. Unless you have several
LUKS devices, you don't have to specify this parameter. The simplest usage is:
+ +
---- [listing]
.Example
--
rd.luks.key=/foo/bar.key rd.luks.key=/foo/bar.key
---- --
+ +
As you see, you can skip colons in such a case. As you see, you can skip colons in such a case.
+ +
@@ -275,20 +307,20 @@ to crypsetup luksFormat with _-d -_, too!
Here follows example for key encrypted with GPG: Here follows example for key encrypted with GPG:
---- [listing]
gpg --quiet --decrypt rootkey.gpg \ --
| cryptsetup -d - -v \ gpg --quiet --decrypt rootkey.gpg | \
--cipher serpent-cbc-essiv:sha256 \ cryptsetup -d - -v --cipher serpent-cbc-essiv:sha256 \
--key-size 256 luksFormat /dev/sda3 --key-size 256 luksFormat /dev/sda3
---- --
If you use plain keys, just add path to _-d_ option: If you use plain keys, just add path to _-d_ option:
---- [listing]
cryptsetup -d rootkey.key -v \ --
--cipher serpent-cbc-essiv:sha256 \ cryptsetup -d rootkey.key -v --cipher serpent-cbc-essiv:sha256 \
--key-size 256 luksFormat /dev/sda3 --key-size 256 luksFormat /dev/sda3
---- --
=============================== ===============================
MD RAID MD RAID
@@ -306,9 +338,10 @@ MD RAID
ignore mdadm.conf included in initramfs ignore mdadm.conf included in initramfs
**rd.md.waitclean=1**:: **rd.md.waitclean=1**::
wait for any resync, recovery, or reshape activity to finish before continuing wait for any resync, recovery, or reshape activity to finish before
continuing
**rd.md.uuid=**_<md raid uuid>_:: **rd.md.uuid=**__<md raid uuid>__::
only activate the raid sets with the given UUID. This parameter can be only activate the raid sets with the given UUID. This parameter can be
specified multiple times. specified multiple times.
@@ -317,7 +350,7 @@ DM RAID
**rd.dm=0**:: **rd.dm=0**::
disable DM RAID detection disable DM RAID detection
**rd.dm.uuid=**_<dm raid uuid>_:: **rd.dm.uuid=**__<dm raid uuid>__::
only activate the raid sets with the given UUID. This parameter can be only activate the raid sets with the given UUID. This parameter can be
specified multiple times. specified multiple times.
@@ -326,15 +359,17 @@ FIPS
**rd.fips**:: **rd.fips**::
enable FIPS enable FIPS
**boot=**_<boot device>_:: **boot=**__<boot device>__::
specify the device, where /boot is located. e.g. specify the device, where /boot is located.
+ +
---- [listing]
.Example
--
boot=/dev/sda1 boot=/dev/sda1
boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
boot=UUID=<uuid> boot=UUID=<uuid>
boot=LABEL=<label> boot=LABEL=<label>
---- --
**rd.fips.skipkernel**:: **rd.fips.skipkernel**::
skip checksum check of the kernel image. Useful, if the kernel image is not skip checksum check of the kernel image. Useful, if the kernel image is not
@@ -342,10 +377,70 @@ boot=LABEL=<label>
Network Network
~~~~~~~ ~~~~~~~
**ip=**_{dhcp|on|any|dhcp6|auto6|ibft}_::
dhcp|on|any::: get ip from dhcp server from all interfaces. If root=dhcp, loop [IMPORTANT]
sequentially through all interfaces (eth0, eth1, ...) and use the first with =====================
a valid DHCP root-path. It is recommended to either bind an interface to a MAC with the **ifname**
argument, or to use the systemd-udevd predictable network interface names.
Predictable network interface device names based on:
- firmware/bios-provided index numbers for on-board devices
- firmware-provided pci-express hotplug slot index number
- physical/geographical location of the hardware
- the interface's MAC address
See:
http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames
Two character prefixes based on the type of interface:
en:: ethernet
wl:: wlan
ww:: wwan
Type of names:
o<index>:: on-board device index number
s<slot>[f<function>][d<dev_id>]:: hotplug slot index number
x<MAC>:: MAC address
[P<domain>]p<bus>s<slot>[f<function>][d<dev_id>]:: PCI geographical location
[P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]:: USB port number chain
All multi-function PCI devices will carry the [f<function>] number in the
device name, including the function 0 device.
When using PCI geography, The PCI domain is only prepended when it is not 0.
For USB devices the full chain of port numbers of hubs is composed. If the
name gets longer than the maximum number of 15 characters, the name is not
exported.
The usual USB configuration == 1 and interface == 0 values are suppressed.
PCI ethernet card with firmware index "1"::
* eno1
PCI ethernet card in hotplug slot with firmware index number::
* ens1
PCI ethernet multi-function card with 2 ports::
* enp2s0f0
* enp2s0f1
PCI wlan card::
* wlp3s0
USB built-in 3G modem::
* wwp0s29u1u4i6
USB Android phone::
* enp0s29u1u2
=====================
**ip=**__{dhcp|on|any|dhcp6|auto6|ibft}__::
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.
auto6::: IPv6 autoconfiguration auto6::: IPv6 autoconfiguration
@@ -353,7 +448,7 @@ Network
ibft::: iBFT autoconfiguration ibft::: iBFT autoconfiguration
**ip=**_<interface>_:_{dhcp|on|any|dhcp6|auto6}_[:[_<mtu>_][:_<macaddr>_]]:: **ip=**__<interface>__:__{dhcp|on|any|dhcp6|auto6}__[:[__<mtu>__][:__<macaddr>__]]::
This parameter can be specified multiple times. This parameter can be specified multiple times.
+ +
===================== =====================
@@ -364,19 +459,12 @@ cannot be used in conjunction with the **ifname** argument for the
same <interface>. same <interface>.
===================== =====================
[IMPORTANT] **ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__:[:[__<mtu>__][:__<macaddr>__]]::
=====================
It is recommended to either bind <interface> to a MAC with the **ifname**
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location.
em<port>::: for embedded NICs
p<slot>#<port>_<virtual instance>::: for cards in PCI slots
=====================
**ip=**_<client-IP>_:_<server-IP>_:_<gateway-IP>_:_<netmask>_:_<client_hostname>_:_<interface>_:_{none|off|dhcp|on|any|dhcp6|auto6|ibft}_[:[_<mtu>_][:_<macaddr>_]]::
explicit network configuration. If you want do define a IPv6 address, put it explicit network configuration. If you want do define a IPv6 address, put it
in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
times. times. __<peer>__ is optional and is the address of the remote endpoint
for pointopoint interfaces and it may be followed by a slash and a decimal
number, encoding the network prefix length.
+ +
===================== =====================
<macaddr>::: optionally **set** <macaddr> on the <interface>. This <macaddr>::: optionally **set** <macaddr> on the <interface>. This
@@ -384,28 +472,31 @@ cannot be used in conjunction with the **ifname** argument for the
same <interface>. same <interface>.
===================== =====================
[IMPORTANT] **ip=**__<client-IP>__:[__<peer>__]:__<gateway-IP>__:__<netmask>__:__<client_hostname>__:__<interface>__:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[__<dns1>__][:__<dns2>__]]::
===================== explicit network configuration. If you want do define a IPv6 address, put it
It is recommended to either bind <interface> to a MAC with the **ifname** in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location. times. __<peer>__ is optional and is the address of the remote endpoint
for pointopoint interfaces and it may be followed by a slash and a decimal
number, encoding the network prefix length.
em<port>::: for embedded NICs **ifname=**__<interface>__:__<MAC>__::
p<slot>#<port>_<virtual instance>::: for cards in PCI slots Assign network device name <interface> (ie "bootnet") to the NIC with
===================== MAC <MAC>.
**ifname=**_<interface>_:_<MAC>_::
Assign network device name <interface> (ie "bootnet") to the NIC with MAC <MAC>.
+ +
[IMPORTANT] WARNING: Do **not** use the default kernel naming scheme for the interface name,
Do **not** use the default kernel naming scheme for the interface name,
as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the
interface name. Better name it "bootnet" or "bluesocket". interface name. Better name it "bootnet" or "bluesocket".
**bootdev=**_<interface>_:: **bootdev=**__<interface>__::
specify network interface to use routing and netroot information from. specify network interface to use routing and netroot information from.
Required if multiple ip= lines are used. Required if multiple ip= lines are used.
**BOOTIF=**__<MAC>__::
specify network interface to use routing and netroot information from.
**rd.bootif=0**::
Disable BOOTIF parsing, which is provided by PXE
**nameserver=**__<IP>__ [**nameserver=**__<IP>__ ...]:: **nameserver=**__<IP>__ [**nameserver=**__<IP>__ ...]::
specify nameserver(s) to use specify nameserver(s) to use
@@ -415,81 +506,83 @@ interface name. Better name it "bootnet" or "bluesocket".
**rd.neednet=1**:: **rd.neednet=1**::
boolean, bring up network even without netroot set boolean, bring up network even without netroot set
**vlan=_<vlanname>_:_<phydevice>_**:: **vlan=**__<vlanname>__:__<phydevice>__::
Setup vlan device named <vlanname> on <phydeivce>. Setup vlan device named <vlanname> on <phydeivce>.
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5), We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005),
DEV_PLUS_VID (eth0.0005), DEV_PLUS_VID_NO_PAD (eth0.5) VLAN_PLUS_VID_NO_PAD (vlan5), DEV_PLUS_VID (eth0.0005),
DEV_PLUS_VID_NO_PAD (eth0.5)
**bond=_<bondname>_[:_<bondslaves>_:[:_<options>_]]**:: **bond=**__<bondname>__[:__<bondslaves>__:[:__<options>__]]::
Setup bonding device <bondname> on top of <bondslaves>. Setup bonding device <bondname> on top of <bondslaves>.
<bondslaves> is a comma-separated list of physical (ethernet) interfaces. <bondslaves> is a comma-separated list of physical (ethernet) interfaces.
<options> is a comma-separated list on bonding options (modinfo bonding for details) <options> is a comma-separated list on bonding options (modinfo bonding for
in format compatible with initscripts. If <options> includes multi-valued arp_ip_target option, details) in format compatible with initscripts. If <options> includes
then its values should be separated by semicolon. multi-valued arp_ip_target option, then its values should be separated by
Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr semicolon. Bond without parameters assumes
bond=bond0:eth0,eth1:mode=balance-rr
**team =_<teammaster>_:_<teamslaves>_**:: **team=**__<teammaster>__:__<teamslaves>__::
Setup team device <teammaster> on top of <teamslaves>. Setup team device <teammaster> on top of <teamslaves>.
<teamslaves> is a comma-separated list of physical (ethernet) interfaces. <teamslaves> is a comma-separated list of physical (ethernet) interfaces.
**bridge=_<bridgename>_:_<ethnames>_**:: **bridge=**__<bridgename>__:__<ethnames>__::
Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated
list of physical (ethernet) interfaces. Bridge without parameters assumes bridge=br0:eth0 list of physical (ethernet) interfaces. Bridge without parameters assumes
bridge=br0:eth0
NFS NFS
~~~ ~~~
**root=**[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_]:: **root=**\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__]::
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
dhcp next_server. if server-ip is an IPv6 address it has to be put in dhcp next_server. if server-ip is an IPv6 address it has to be put in
brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
":" or "," and are seperated by ",". ":" or "," and are seperated by ",".
**root=**nfs:[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_], **root=**nfs4:[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_], **root=**_{dhcp|dhcp6}_:: **root=**nfs:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**nfs4:\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__], **root=**__{dhcp|dhcp6}__::
root=dhcp alone directs initrd to look at the DHCP root-path where NFS root=dhcp alone directs initrd to look at the DHCP root-path where NFS
options can be specified. options can be specified.
+ +
---- [listing]
.Example
--
root-path=<server-ip>:<root-dir>[,<nfs-options>] root-path=<server-ip>:<root-dir>[,<nfs-options>]
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>] root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>] root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
---- --
**root=**_/dev/nfs_ nfsroot=[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_]:: **root=**_/dev/nfs_ nfsroot=\[_<server-ip>_:]__<root-dir>__[:__<nfs-options>__]::
_Deprecated!_ kernel Documentation_/filesystems/nfsroot.txt_ defines this _Deprecated!_ kernel Documentation_/filesystems/nfsroot.txt_ defines this
method. This is supported by dracut, but not recommended. method. This is supported by dracut, but not recommended.
**rd.nfs.domain=**_<NFSv4 domain name>_:: **rd.nfs.domain=**__<NFSv4 domain name>__::
Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_. Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_.
CIFS CIFS
~~~ ~~~
**root=**cifs://[_<username>_[:_<password>_]@]_<server-ip>_:_<root-dir>_:: **root=**cifs://[__<username>__[:__<password>__]@]__<server-ip>__:__<root-dir>__::
mount cifs share from <server-ip>:/<root-dir>, if no server-ip is given, use mount cifs share from <server-ip>:/<root-dir>, if no server-ip is given, use
dhcp next_server. if server-ip is an IPv6 address it has to be put in dhcp next_server. if server-ip is an IPv6 address it has to be put in
brackets, e.g. [2001:DB8::1]. If a username or password are not specified brackets, e.g. [2001:DB8::1]. If a username or password are not specified
as part of the root, then they must be passed on the command line through as part of the root, then they must be passed on the command line through
cifsuser/cifspass. cifsuser/cifspass.
+ +
[WARNING] WARNING: Passwords specified on the kernel command line are visible for all
==== users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. network, when using DHCP with DHCP root-path.
====
**cifsuser=_<username>_:: **cifsuser**=__<username>__::
Set the cifs username, if not specified as part of the root. Set the cifs username, if not specified as part of the root.
**cifspass=_<password>_:: **cifspass**=__<password>__::
Set the cifs password, if not specified as part of the root. Set the cifs password, if not specified as part of the root.
+ +
[WARNING] WARNING: Passwords specified on the kernel command line are visible for all
==== users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. network, when using DHCP with DHCP root-path.
====
iSCSI iSCSI
~~~~~ ~~~~~
**root=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_:: **root=**iscsi:[__<username>__:__<password>__[:__<reverse>__:__<password>__]@][__<servername>__]:[__<protocol>__]:[__<port>__][:[__<iscsi_iface_name>__]:[__<netdev_name>__]]:[__<LUN>__]:__<targetname>__::
protocol defaults to "6", LUN defaults to "0". If the "servername" field is protocol defaults to "6", LUN defaults to "0". If the "servername" field is
provided by BOOTP or DHCP, then that field is used in conjunction with other provided by BOOTP or DHCP, then that field is used in conjunction with other
associated fields to contact the boot server in the Boot stage. However, if associated fields to contact the boot server in the Boot stage. However, if
@@ -497,85 +590,92 @@ iSCSI
used in the Discovery Service stage in conjunction with other associated used in the Discovery Service stage in conjunction with other associated
fields. See fields. See
link:$$http://tools.ietf.org/html/rfc4173#section-5$$[rfc4173]. link:$$http://tools.ietf.org/html/rfc4173#section-5$$[rfc4173].
e.g.:
+ +
---- WARNING: Passwords specified on the kernel command line are visible for all
users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
network, when using DHCP with DHCP root-path.
+
[listing]
.Example
--
root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
---- --
+ +
If servername is an IPv6 address, it has to be put in brackets. e.g.: If servername is an IPv6 address, it has to be put in brackets:
+ +
---- [listing]
.Example
--
root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0 root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
---- --
+
[WARNING]
====
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
====
**root=**_???_ **netroot=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_ ...:: **root=**__???__ **netroot=**iscsi:[__<username>__:__<password>__[:__<reverse>__:__<password>__]@][__<servername>__]:[__<protocol>__]:[__<port>__][:[__<iscsi_iface_name>__]:[__<netdev_name>__]]:[__<LUN>__]:__<targetname>__ ...::
multiple netroot options allow setting up multiple iscsi disks. e.g.: multiple netroot options allow setting up multiple iscsi disks:
+ +
---- [listing]
.Example
--
root=UUID=12424547 root=UUID=12424547
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
---- --
+ +
If servername is an IPv6 address, it has to be put in brackets. e.g.: If servername is an IPv6 address, it has to be put in brackets:
+ +
---- [listing]
.Example
--
netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0 netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
---- --
+ +
[WARNING] WARNING: Passwords specified on the kernel command line are visible for all
==== users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware. network, when using DHCP with DHCP root-path.
==== You may want to use rd.iscsi.firmware.
**root=**_???_ **rd.iscsi.initiator=**_<initiator>_ **rd.iscsi.target.name=**_<target name>_ **rd.iscsi.target.ip=**_<target ip>_ **rd.iscsi.target.port=**_<target port>_ **rd.iscsi.target.group=**_<target group>_ **rd.iscsi.username=**_<username>_ **rd.iscsi.password=**_<password>_ **rd.iscsi.in.username=**_<in username>_ **rd.iscsi.in.password=**_<in password>_:: **root=**__???__ **rd.iscsi.initiator=**__<initiator>__ **rd.iscsi.target.name=**__<target name>__ **rd.iscsi.target.ip=**__<target ip>__ **rd.iscsi.target.port=**__<target port>__ **rd.iscsi.target.group=**__<target group>__ **rd.iscsi.username=**__<username>__ **rd.iscsi.password=**__<password>__ **rd.iscsi.in.username=**__<in username>__ **rd.iscsi.in.password=**__<in password>__::
manually specify all iscsistart parameter (see **+iscsistart --help+**) manually specify all iscsistart parameter (see **+iscsistart --help+**)
+ +
[WARNING] WARNING: Passwords specified on the kernel command line are visible for all
==== users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware. network, when using DHCP with DHCP root-path.
==== You may want to use rd.iscsi.firmware.
**root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**:: **root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**::
will read the iscsi parameter from the BIOS firmware will read the iscsi parameter from the BIOS firmware
**rd.iscsi.param=**_<param>_:: **rd.iscsi.param=**__<param>__::
<param> will be passed as "--param <param>" to iscsistart. <param> will be passed as "--param <param>" to iscsistart.
This parameter can be specified multiple times. This parameter can be specified multiple times.
e.g.:
+ +
---- [listing]
.Example
--
"netroot=iscsi rd.iscsi.firmware=1 rd.iscsi.param=node.session.timeo.replacement_timeout=30" "netroot=iscsi rd.iscsi.firmware=1 rd.iscsi.param=node.session.timeo.replacement_timeout=30"
---- --
+ +
will result in will result in
+ +
---- [listing]
--
iscsistart -b --param node.session.timeo.replacement_timeout=30 iscsistart -b --param node.session.timeo.replacement_timeout=30
---- --
FCoE FCoE
~~~~ ~~~~
**fcoe=**_<edd|interface|MAC>_:_{dcb|nodcb}_:: **fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__::
Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
_<MAC>_ or EDD settings. For the second argument, currently only nodcb is _<MAC>_ or EDD settings. For the second argument, currently only nodcb is
supported. This parameter can be specified multiple times. supported. This parameter can be specified multiple times.
+ +
[NOTE] NOTE: letters in the MAC-address must be lowercase!
letters in the MAC-address must be lowercase!
NBD NBD
~~~ ~~~
**root=**??? **netroot=**nbd:_<server>_:_<port>_[:_<fstype>_[:_<mountopts>_[:_<nbdopts>_]]]:: **root=**??? **netroot=**nbd:__<server>__:__<port>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
mount nbd share from <server> mount nbd share from <server>
**root=dhcp** with **dhcp** **root-path=**nbd:_<server>_:_<port>_[:_<fstype>_[:_<mountopts>_[:_<nbdopts>_]]]:: **root=dhcp** with **dhcp** **root-path=**nbd:__<server>__:__<port>__[:__<fstype>__[:__<mountopts>__[:__<nbdopts>__]]]::
root=dhcp alone directs initrd to look at the DHCP root-path where NBD 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 options can be specified. This syntax is only usable in cases where you are
directly mounting the volume as the rootfs. directly mounting the volume as the rootfs.
@@ -587,25 +687,29 @@ DASD
ZFCP ZFCP
~~~~ ~~~~
**rd.zfcp=**_<zfcp adaptor device bus ID>_,_<WWPN>_,_<FCPLUN>_:: **rd.zfcp=**__<zfcp adaptor device bus ID>__,__<WWPN>__,__<FCPLUN>__::
rd.zfcp can be specified multiple times on the kernel command line. e.g.: rd.zfcp can be specified multiple times on the kernel command line.
+ +
---- [listing]
.Example
--
rd.zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000 rd.zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000
---- --
**rd.zfcp.conf=0**:: **rd.zfcp.conf=0**::
ignore zfcp.conf included in the initramfs ignore zfcp.conf included in the initramfs
ZNET ZNET
~~~~ ~~~~
**rd.znet=**_<nettype>_,_<subchannels>_,_<options>_:: **rd.znet=**__<nettype>__,__<subchannels>__,__<options>__::
rd.znet can be specified multiple times on the kernel command line. e.g.: rd.znet can be specified multiple times on the kernel command line.
+ +
---- [listing]
.Example
--
rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
rd.znet=ctc,0.0.0600,0.0.0601,protocol=bar rd.znet=ctc,0.0.0600,0.0.0601,protocol=bar
---- --
Plymouth Boot Splash Plymouth Boot Splash
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
@@ -617,37 +721,46 @@ Plymouth Boot Splash
Kernel keys Kernel keys
~~~~~~~~~~~ ~~~~~~~~~~~
**masterkey=**_<kernel master key path name>_:: **masterkey=**__<kernel master key path name>__::
Set the path name of the kernel master key. e.g.: Set the path name of the kernel master key.
+ +
---- [listing]
.Example
--
masterkey=/etc/keys/kmk-trusted.blob masterkey=/etc/keys/kmk-trusted.blob
---- --
**masterkeytype=**_<kernel master key type>_:: **masterkeytype=**__<kernel master key type>__::
Set the type of the kernel master key. e.g.: Set the type of the kernel master key.
+ +
---- [listing]
.Example
--
masterkeytype=trusted masterkeytype=trusted
---- --
**evmkey=**_<EVM key path name>_:: **evmkey=**__<EVM key path name>__::
Set the path name of the EVM key. e.g.: Set the path name of the EVM key.
+ +
---- [listing]
.Example
--
evmkey=/etc/keys/evm-trusted.blob evmkey=/etc/keys/evm-trusted.blob
---- --
**ecryptfskey=**_<eCryptfs key path name>_:: **ecryptfskey=**__<eCryptfs key path name>__::
Set the path name of the eCryptfs key. e.g.: Set the path name of the eCryptfs key.
+ +
---- [listing]
.Example
--
ecryptfskey=/etc/keys/ecryptfs-trusted.blob ecryptfskey=/etc/keys/ecryptfs-trusted.blob
---- --
Deprecated, renamed Options Deprecated, renamed Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is a list of options, which were used in dracut prior to version 008, and their new replacement. Here is a list of options, which were used in dracut prior to version 008, and
their new replacement.
rdbreak:: rd.break rdbreak:: rd.break
@@ -781,7 +894,8 @@ _/etc/conf.d/_::
set in the configuration files. set in the configuration files.
_/etc/cmdline_:: _/etc/cmdline_::
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf. Can contain additional command line options. Deprecated, better use
/etc/cmdline.d/*.conf.
_/etc/cmdline.d/*.conf_:: _/etc/cmdline.d/*.conf_::
Can contain additional command line options. Can contain additional command line options.

View File

@@ -10,17 +10,19 @@ dracut.conf - configuration file(s) for dracut
SYNOPSIS SYNOPSIS
-------- --------
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_ _/usr/lib/dracut/dracut.conf.d/*.conf_ _/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
_/usr/lib/dracut/dracut.conf.d/*.conf_
Description Description
----------- -----------
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line _dracut.conf_ is loaded during the initialisation phase of dracut. Command line
parameter will overwrite any values set here. parameter will overwrite any values set here.
_*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and /etc/dracut.conf.d. _*.conf_ files are read from /usr/lib/dracut/dracut.conf.d and
Files with the same name in /etc/dracut.conf.d will replace files in /usr/lib/dracut/dracut.conf.d. /etc/dracut.conf.d. Files with the same name in /etc/dracut.conf.d will replace
The files are then read in alphanumerical order and will overwrite parameters set in files in /usr/lib/dracut/dracut.conf.d.
_/etc/dracut.conf_. Each line specifies an attribute and a value. A '#' The files are then read in alphanumerical order and will overwrite parameters
set in _/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
indicates the beginning of a comment; following characters, up to the end of the indicates the beginning of a comment; following characters, up to the end of the
line are not interpreted. line are not interpreted.
@@ -67,10 +69,16 @@ Configuration files must have the extension .conf; other extensions are ignored.
*do_strip=*"__{yes|no}__":: *do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes) Strip binaries in the initramfs (default=yes)
*do_prelink=*"__{yes|no}__"::
Prelink binaries in the initramfs (default=yes)
*hostonly=*"__{yes|no}__":: *hostonly=*"__{yes|no}__"::
Host-Only mode: Install only what is needed for booting the local host Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration. instead of a generic host and generate host-specific configuration.
*hostonly_cmdline*"__{yes|no}__"::
If set, store the kernel command line arguments needed in the initramfs
*persistent_policy=*"__<policy>__":: *persistent_policy=*"__<policy>__"::
Use _<policy>_ to address disks and partitions. Use _<policy>_ to address disks and partitions.
_<policy>_ can be any directory name found in /dev/disk. _<policy>_ can be any directory name found in /dev/disk.
@@ -81,7 +89,8 @@ Configuration files must have the extension .conf; other extensions are ignored.
[WARNING] [WARNING]
==== ====
If chrooted to another root other than the real root device, use --fstab and provide a valid _/etc/fstab_. If chrooted to another root other than the real root device, use --fstab and
provide a valid _/etc/fstab_.
==== ====
*use_fstab=*"__{yes|no}__":: *use_fstab=*"__{yes|no}__"::
@@ -119,9 +128,24 @@ If chrooted to another root other than the real root device, use --fstab and pro
*kernel_only=*"__{yes|no}__":: *kernel_only=*"__{yes|no}__"::
Only install kernel drivers and firmware files. (default=no) Only install kernel drivers and firmware files. (default=no)
*no_kernel=*"{yes|no}":: *no_kernel=*"__{yes|no}__"::
Do not install kernel drivers and firmware files (default=no) Do not install kernel drivers and firmware files (default=no)
*acpi_override=*"__{yes|no}__"::
[WARNING] ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING! +
Override BIOS provided ACPI tables. For further documentation read
Documentation/acpi/initrd_table_override.txt in the kernel sources.
Search for ACPI table files (must have .aml suffix) in acpi_table_dir=
directory (see below) and add them to a separate uncompressed cpio
archive. This cpio archive gets glued (concatenated, uncompressed one
must be the first one) to the compressed cpio archive. The first,
uncompressed cpio archive is for data which the kernel must be able
to access very early (and cannot make use of uncompress alogrithms yet)
like microcode or ACPI tables (default=no).
*acpi_table_dir=*"__<dir>__"::
Directory to search for ACPI tables if acpi_override= is set to yes.
*early_microcode=*"{yes|no}":: *early_microcode=*"{yes|no}"::
Combine early microcode with ramdisk (default=no) Combine early microcode with ramdisk (default=no)
@@ -140,6 +164,17 @@ If chrooted to another root other than the real root device, use --fstab and pro
*show_modules=*"__{yes|no}__":: *show_modules=*"__{yes|no}__"::
Print the name of the included modules to standard output during build. Print the name of the included modules to standard output during build.
*i18n_vars="__<variable mapping>__"::
Distribution specific variable mapping.
See dracut/modules.d/10i18n/README for a detailed description.
*i18n_default_font=*"__<fontname>__"::
The font <fontname> to install, if not specified otherwise.
Default is "LatArCyrHeb-16".
*i18n_install_all=*"__{yes|no}__"::
Install everything regardless of generic or hostonly mode.
Files Files
----- -----
_/etc/dracut.conf_:: _/etc/dracut.conf_::

View File

@@ -3,6 +3,7 @@
# i18n # i18n
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP" i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
i18n_default_font="latarcyrheb-sun16" i18n_default_font="latarcyrheb-sun16"
i18n_install_all="yes"
stdloglvl=3 stdloglvl=3
sysloglvl=5 sysloglvl=5
install_items+=" vi /etc/virc ps grep cat rm " install_items+=" vi /etc/virc ps grep cat rm "
@@ -12,3 +13,4 @@ systemdsystemunitdir=/usr/lib/systemd/system
systemdsystemconfdir=/etc/systemd/system systemdsystemconfdir=/etc/systemd/system
udevdir=/usr/lib/udev udevdir=/usr/lib/udev
hostonly="yes" hostonly="yes"
hostonly_cmdline="no"

View File

@@ -14,45 +14,6 @@ body {
color:black; color:black;
} }
body.toc_embeded {
/*for web hosting system only*/
margin-left: 300px;
}
object.toc, iframe.toc {
/*for web hosting system only*/
border-style:none;
position:fixed;
width:290px;
height:99.99%;
top:0;
left:0;
z-index: 100;
border-style:none;
border-right:1px solid #999;
}
/* Hide web menu */
body.notoc {
margin-left: 3em;
}
iframe.notoc {
border-style:none;
border: none;
padding: 0em;
position:fixed;
width: 21px;
height: 29px;
top: 0px;
left:0;
overflow: hidden;
margin: 0em;
margin-left: -3px;
}
/* End hide web menu */
/* desktop styles */ /* desktop styles */
body.desktop { body.desktop {
margin-left: 26em; margin-left: 26em;
@@ -166,7 +127,6 @@ h1 {
margin-bottom: 0em; margin-bottom: 0em;
font-size: 3.0em; font-size: 3.0em;
font-weight: bold; font-weight: bold;
background: #003d6e url(../images/h1-bg.png) top left repeat-x;
color: white; color: white;
text-align: center; text-align: center;
padding: 0.7em; padding: 0.7em;
@@ -480,106 +440,14 @@ h3.author {
font-weight:bold; font-weight:bold;
} }
/* inline syntax highlighting */
.perl_Alert {
color: #0000ff;
}
.perl_BaseN {
color: #007f00;
}
.perl_BString {
color: #5C3566;
}
.perl_Char {
color: #ff00ff;
}
.perl_Comment {
color: #FF00FF;
}
.perl_DataType {
color: #0000ff;
}
.perl_DecVal {
color: #00007f;
}
.perl_Error {
color: #ff0000;
}
.perl_Float {
color: #00007f;
}
.perl_Function {
color: #007f00;
}
.perl_IString {
color: #5C3566;
}
.perl_Keyword {
color: #002F5D;
}
.perl_Operator {
color: #ffa500;
}
.perl_Others {
color: #b03060;
}
.perl_RegionMarker {
color: #96b9ff;
}
.perl_Reserved {
color: #9b30ff;
}
.perl_String {
color: #5C3566;
}
.perl_Variable {
color: #0000ff;
}
.perl_Warning {
color: #0000ff;
}
/*Lists*/ /*Lists*/
ul { ul {
padding-left:1.6em; padding-left:1.6em;
list-style-image:url(../images/dot.png);
list-style-type: circle; list-style-type: circle;
} }
ul ul { ul ul {
list-style-image:url(../images/dot2.png);
list-style-type: circle; list-style-type: circle;
} }
@@ -769,21 +637,6 @@ code {
word-wrap: break-word; /* Internet Explorer 5.5+ */ word-wrap: break-word; /* Internet Explorer 5.5+ */
} }
/*Notifications*/
div.warning:before {
content:url(../images/warning.png);
padding-left: 5px;
}
div.note:before {
content:url(../images/note.png);
padding-left: 5px;
}
div.important:before {
content:url(../images/important.png);
padding-left: 5px;
}
div.warning, div.note, div.important { div.warning, div.note, div.important {
color: black; color: black;
@@ -792,7 +645,8 @@ div.warning, div.note, div.important {
background: none; background: none;
background-color: white; background-color: white;
margin-bottom: 1em; margin-bottom: 1em;
border-bottom: 1px solid #aaaaaa; padding-left: 1em;
border-left: 2px solid #aaaaaa;
} }
div.warning h2, div.note h2,div.important h2 { div.warning h2, div.note h2,div.important h2 {
@@ -817,20 +671,6 @@ div.admonition_header {
font-size: 1.0em; font-size: 1.0em;
} }
div.warning div.admonition_header {
background: url(../images/red.png) top left repeat-x;
background-color: #590000;
}
div.note div.admonition_header {
background: url(../images/green.png) top right repeat-x;
background-color: #597800;
}
div.important div.admonition_header {
background: url(../images/yellow.png) top right repeat-x;
background-color: #a6710f;
}
div.warning p, div.warning div.para, div.warning p, div.warning div.para,
div.note p, div.note div.para, div.note p, div.note div.para,
@@ -1131,266 +971,6 @@ ul li p:last-child, ul li div.para:last-child {
padding-bottom:0em; padding-bottom:0em;
} }
/*document navigation*/
.docnav a, .docnav strong {
border:none;
text-decoration:none;
font-weight:normal;
}
.docnav {
list-style:none;
margin:0em;
padding:0em;
position:relative;
width:100%;
padding-bottom:2em;
padding-top:1em;
border-top:1px dotted #ccc;
}
.docnav li {
list-style:none;
margin:0em;
padding:0em;
display:inline;
font-size:.8em;
}
.docnav li:before {
content:" ";
}
.docnav li.previous, .docnav li.next {
position:absolute;
top:1em;
}
.docnav li.up, .docnav li.home {
margin:0em 1.5em;
}
.docnav li.previous {
left:0px;
text-align:left;
}
.docnav li.next {
right:0px;
text-align:right;
}
.docnav li.previous strong, .docnav li.next strong {
height:22px;
display:block;
}
.docnav {
margin:0 auto;
text-align:center;
}
.docnav li.next a strong {
background: url(../images/stock-go-forward.png) top right no-repeat;
padding-top:3px;
padding-bottom:4px;
padding-right:28px;
font-size:1.2em;
}
.docnav li.previous a strong {
background: url(../images/stock-go-back.png) top left no-repeat;
padding-top:3px;
padding-bottom:4px;
padding-left:28px;
padding-right:0.5em;
font-size:1.2em;
}
.docnav li.home a strong {
background: url(../images/stock-home.png) top left no-repeat;
padding:5px;
padding-left:28px;
font-size:1.2em;
}
.docnav li.up a strong {
background: url(../images/stock-go-up.png) top left no-repeat;
padding:5px;
padding-left:28px;
font-size:1.2em;
}
.docnav a:link, .docnav a:visited {
color:#666;
}
.docnav a:hover, .docnav a:focus, .docnav a:active {
color:black;
}
.docnav a {
max-width: 10em;
overflow:hidden;
}
.docnav a:link strong {
text-decoration:none;
}
.docnav {
margin:0 auto;
text-align:center;
}
ul.docnav {
margin-bottom: 1em;
}
/* Reports */
.reports ul {
list-style:none;
margin:0em;
padding:0em;
}
.reports li{
margin:0em;
padding:0em;
}
.reports li.odd {
background-color: #eeeeee;
margin:0em;
padding:0em;
}
.reports dl {
display:inline;
margin:0em;
padding:0em;
float:right;
margin-right: 17em;
margin-top:-1.3em;
}
.reports dt {
display:inline;
margin:0em;
padding:0em;
}
.reports dd {
display:inline;
margin:0em;
padding:0em;
padding-right:.5em;
}
.reports h2, .reports h3{
display:inline;
padding-right:.5em;
font-size:10pt;
font-weight:normal;
}
.reports div.progress {
display:inline;
float:right;
width:16em;
background:#c00 url(../images/shine.png) top left repeat-x;
margin:0em;
margin-top:-1.3em;
padding:0em;
border:none;
}
/*uniform*/
body.results, body.reports {
max-width:57em ;
padding:0em;
}
/*Progress Bar*/
div.progress {
display:block;
float:left;
width:16em;
background:#c00 url(../images/shine.png) top left repeat-x;
height:1em;
}
div.progress span {
height:1em;
float:left;
}
div.progress span.translated {
background:#6c3 url(../images/shine.png) top left repeat-x;
}
div.progress span.fuzzy {
background:#ff9f00 url(../images/shine.png) top left repeat-x;
}
/*Results*/
.results ul {
list-style:none;
margin:0em;
padding:0em;
}
.results li{
margin:0em;
padding:0em;
}
.results li.odd {
background-color: #eeeeee;
margin:0em;
padding:0em;
}
.results dl {
display:inline;
margin:0em;
padding:0em;
float:right;
margin-right: 17em;
margin-top:-1.3em;
}
.results dt {
display:inline;
margin:0em;
padding:0em;
}
.results dd {
display:inline;
margin:0em;
padding:0em;
padding-right:.5em;
}
.results h2, .results h3 {
display:inline;
padding-right:.5em;
font-size:10pt;
font-weight:normal;
}
.results div.progress {
display:inline;
float:right;
width:16em;
background:#c00 url(../images/shine.png) top left repeat-x;
margin:0em;
margin-top:-1.3em;
padding:0em;
border:none;
}
/* Dirty EVIL Mozilla hack for round corners */ /* Dirty EVIL Mozilla hack for round corners */
pre { pre {
@@ -1423,12 +1003,6 @@ span.remark {
background-color: #ff00ff; background-color: #ff00ff;
} }
.draft {
background-image: url(../images/watermark-draft.png);
background-repeat: repeat-y;
background-position: center;
}
.foreignphrase { .foreignphrase {
font-style: inherit; font-style: inherit;
} }
@@ -1513,10 +1087,6 @@ h1 {
color:#3c6eb4 color:#3c6eb4
} }
.producttitle {
background: #3c6eb4 url(../images/h1-bg.png) top left repeat;
}
.section h1.title { .section h1.title {
color:#3c6eb4; color:#3c6eb4;
} }

299
dracut.modules.7.asc Normal file
View File

@@ -0,0 +1,299 @@
DRACUT.MODULES(7)
=================
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut.modules - dracut modules
DESCRIPTION
-----------
dracut uses a modular system to build and extend the initramfs image. All
modules are located in _/usr/lib/dracut/modules.d_ or in _<git-src>/modules.d_.
The most basic dracut module is _99base_. In _99base_ the initial shell script
init is defined, which gets run by the kernel after initramfs loading. Although
you can replace init with your own version of _99base_, this is not encouraged.
Instead you should use, if possible, the hooks of dracut. All hooks, and the
point of time in which they are executed, are described in <<stages>>.
The main script, which creates the initramfs is dracut itsself. It parses all
arguments and sets up the directory, in which everything is installed. It then
executes all check, install, installkernel scripts found in the modules, which
are to be processed. After everything is installed, the install directory is
archived and compressed to the final initramfs image. All helper functions used
by check, install and installkernel are found in in the file _dracut-functions_.
These shell functions are available to all module installer (install,
installkernel) scripts, without the need to source _dracut-functions_.
A module can check the preconditions for install and installkernel with the
check script. Also dependencies can be expressed with check. If a module passed
check, install and installkernel will be called to install all of the necessary
files for the module. To split between kernel and non-kernel parts of the
installation, all kernel module related parts have to be in installkernel. All
other files found in a module directory are module specific and mostly are hook
scripts and udev rules.
[[stages]]
== Boot Process Stages
dracut modules can insert custom script at various points, to control the boot
process.
These hooks are plain directories containing shell scripts ending with ".sh",
which are sourced by init.
Common used functions are in _dracut-lib.sh_, which can be sourced by any script.
=== Hook: cmdline
The _cmdline_ hook is a place to insert scripts to parse the kernel command line
and prepare the later actions, like setting up udev rules and configuration
files.
In this hook the most important environment variable is defined: root. The
second one is rootok, which indicates, that a module claimed to be able to parse
the root defined. So for example, **root=**__iscsi:....__ will be claimed by the
iscsi dracut module, which then sets rootok.
=== Hook: pre-udev
This hook is executed right after the cmdline hook and a check if root and
rootok were set. Here modules can take action with the final root, and before
udev has been run.
=== Start Udev
Now udev is started and the logging for udev is setup.
=== Hook: pre-trigger
In this hook, you can set udev environment variables with **udevadm control
--property=KEY=_value_** or control the further execution of udev with
udevadm.
=== Trigger Udev
udev is triggered by calling udevadm trigger, which sends add events for all
devices and subsystems.
=== Main Loop
In the main loop of dracut loops until udev has settled and
all scripts in _initqueue/finished_ returned true.
In this loop there are three hooks, where scripts can be inserted
by calling /sbin/initqueue.
==== Initqueue
This hook gets executed every time a script is inserted here, regardless of the
udev state.
==== Initqueue settled
This hooks (initqueue/settled) gets executed every time udev has settled.
==== Initqueue timeout
This hooks (initqueue/timeout) gets executed, when the main loop counter becomes
half of the rd.retry counter.
==== Initqueue finished
This hook (initqueue/finished) is called after udev has settled and
if all scripts herein return 0 the main loop will be ended.
Abritary scripts can be added here, to loop in the
initqueue until something happens, which a dracut module wants to wait for.
=== Hook: pre-mount
Before the root device is mounted all scripts in the hook pre-mount are
executed. In some cases (e.g. NFS) the real root device is already mounted,
though.
=== Hook: mount
This hook is mainly to mount the real root device.
=== Hook: pre-pivot
This hook is called before cleanup hook, This is a good place for
actions other than cleanups which need to be called before pivot.
=== Hook: cleanup
This hook is the last hook and is called before init finally switches root to
the real root device. This is a good place to clean up and kill processes not
needed anymore.
=== Cleanup and switch_root
Init (or systemd) kills all udev processes, cleans up the environment,
sets up the arguments for the real init process and finally calls switch_root.
switch_root removes the whole filesystem hierarchy of the initramfs,
chroot()s to the real root device and calls /sbin/init with the specified
arguments.
To ensure all files in the initramfs hierarchy can be removed, all processes
still running from the initramfs should not have any open file descriptors left.
== Network Infrastructure
FIXME
== Writing a Module
A simple example module is _96insmodpost_, which modprobes a kernel module after
udev has settled and the basic device drivers have been loaded.
All module installation information is in the file module-setup.sh.
First we create a check() function, which just exits with 0 indicating that this
module should be included by default.
check():
----
return 0
----
The we create the install() function, which installs a cmdline hook with
priority number 20 called _parse-insmodpost.sh_. It also installs the
_insmodpost.sh_ script in _/sbin_.
install():
----
inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
----
The _pase-instmodpost.sh_ parses the kernel command line for a argument
rd.driver.post, blacklists the module from being autoloaded and installs the
hook _insmodpost.sh_ in the _initqueue/settled_.
_parse-insmodpost.sh_:
----
for p in $(getargs rd.driver.post=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
_do_insmodpost=1
done
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
unset _do_insmodpost
----
_insmodpost.sh_, which is called in the _initqueue/settled_ hook will just
modprobe the kernel modules specified in all rd.driver.post kernel command line
parameters. It runs after udev has settled and is only called once (--onetime).
_insmodpost.sh_:
----
. /lib/dracut-lib.sh
for p in $(getargs rd.driver.post=); do
modprobe $p
done
----
=== module-setup.sh: check()
_check()_ is called by dracut to evaluate the inclusion of a dracut module in
the initramfs.
$hostonly:: If the $hostonly variable is set, then the module check() function
should be in "hostonly" mode, which means, that the check() should only return
0, if the module is really needed to boot this specific host.
check() should return with:
0:: Include the dracut module in the initramfs.
1:: Do not include the dracut module. The requirements are not fullfilled
(missing tools, etc.)
255:: Only include the dracut module, if another module requires it or if
explicitly specified in the config file or on the argument list.
=== module-setup.sh: depends()
The function depends() should echo all other dracut module names the module
depends on.
=== module-setup.sh: cmdline()
This function should print the kernel command line options needed to boot the
current machine setup. It should start with a space and should not print a
newline.
=== module-setup.sh: install()
The install() function is called to install everything non-kernel related.
To install binaries, scripts, and other files, you can use the functions
mentioned in <<creation>>.
To address a file in the current module directory, use the variable "$moddir".
=== module-setup.sh: installkernel()
In installkernel() all kernel related files should be installed. You can use all
of the functions mentioned in <<creation>> to install files.
=== [[creation]]Creation Functions
==== inst_multiple [-o] <file> [ <file> ...]
installs multiple binaries and files. If executables are specified without a
path, dracut will search the path PATH=/usr/sbin:/sbin:/usr/bin:/bin for the
binary. If the option "-o" is given as the first parameter, a missing file does
not lead to an error.
==== inst <src> [<dst>]
installs _one_ file <src> either to the same place in the initramfs or to an
optional <dst>.
==== inst_hook <hookdir> <prio> <src>
installs an executable/script <src> in the dracut hook <hookdir> with priority
<prio>.
==== inst_rules <udevrule> [ <udevrule> ...]
installs one ore more udev rules. Non-existant udev rules are reported, but do
not let dracut fail.
==== instmods <kernelmodule> [ <kernelmodule> ... ]
instmods should be used only in the installkernel() function.
instmods installs one or more kernel modules in the initramfs. <kernelmodule>
can also be a whole subsystem, if prefixed with a "=", like "=drivers/net/team".
instmods will not install the kernel module, if $hostonly is set and the kernel
module is not currently needed by any /sys/*...*/uevent MODALIAS.
To install a kernel module regardless of the hostonly mode use the form:
----
hostonly='' instmods <kernelmodule>
----
=== Initramfs Functions
FIXME
=== Network Modules
FIXME
AUTHOR
------
Harald Hoyer
SEE ALSO
--------
*dracut*(8)

531
dracut.sh
View File

@@ -70,6 +70,7 @@ Creates initial ramdisk images for preloading modules
--kver [VERSION] Set kernel version to [VERSION]. --kver [VERSION] Set kernel version to [VERSION].
-f, --force Overwrite existing initramfs file. -f, --force Overwrite existing initramfs file.
-a, --add [LIST] Add a space-separated list of dracut modules. -a, --add [LIST] Add a space-separated list of dracut modules.
--rebuild Append arguments to those of existing image and rebuild
-m, --modules [LIST] Specify a space-separated list of dracut modules to -m, --modules [LIST] Specify a space-separated list of dracut modules to
call when building the initramfs. Modules are located call when building the initramfs. Modules are located
in /usr/lib/dracut/modules.d. in /usr/lib/dracut/modules.d.
@@ -97,6 +98,8 @@ Creates initial ramdisk images for preloading modules
--kernel-cmdline [PARAMETERS] Specify default kernel command line parameters --kernel-cmdline [PARAMETERS] Specify default kernel command line parameters
--strip Strip binaries in the initramfs --strip Strip binaries in the initramfs
--nostrip Do not strip binaries in the initramfs --nostrip Do not strip binaries in the initramfs
--prelink Prelink binaries in the initramfs
--noprelink Do not prelink binaries in the initramfs
--hardlink Hardlink files in the initramfs --hardlink Hardlink files in the initramfs
--nohardlink Do not hardlink files in the initramfs --nohardlink Do not hardlink files in the initramfs
--prefix [DIR] Prefix initramfs files with [DIR] --prefix [DIR] Prefix initramfs files with [DIR]
@@ -134,6 +137,10 @@ Creates initial ramdisk images for preloading modules
-H, --hostonly Host-Only mode: Install only what is needed for -H, --hostonly Host-Only mode: Install only what is needed for
booting the local host instead of a generic host. booting the local host instead of a generic host.
-N, --no-hostonly Disables Host-Only mode -N, --no-hostonly Disables Host-Only mode
--hostonly-cmdline Store kernel command line arguments needed
in the initramfs
--no-hostonly-cmdline Do not store kernel command line arguments needed
in the initramfs
--persistent-policy [POLICY] --persistent-policy [POLICY]
Use [POLICY] to address disks and partitions. Use [POLICY] to address disks and partitions.
POLICY can be any directory name found in /dev/disk. POLICY can be any directory name found in /dev/disk.
@@ -163,6 +170,12 @@ Creates initial ramdisk images for preloading modules
--xz Compress the generated initramfs using xz. --xz Compress the generated initramfs using xz.
Make sure that your kernel has xz support compiled Make sure that your kernel has xz support compiled
in, otherwise you will not be able to boot. in, otherwise you will not be able to boot.
--lzo Compress the generated initramfs using lzop.
Make sure that your kernel has lzo support compiled
in, otherwise you will not be able to boot.
--lz4 Compress the generated initramfs using lz4.
Make sure that your kernel has lz4 support compiled
in, otherwise you will not be able to boot.
--compress [COMPRESSION] Compress the generated initramfs with the --compress [COMPRESSION] Compress the generated initramfs with the
passed compression program. Make sure your kernel passed compression program. Make sure your kernel
knows how to decompress the generated initramfs, knows how to decompress the generated initramfs,
@@ -175,6 +188,7 @@ Creates initial ramdisk images for preloading modules
--keep Keep the temporary initramfs for debugging purposes --keep Keep the temporary initramfs for debugging purposes
--printsize Print out the module install size --printsize Print out the module install size
--sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module) --sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module)
--logfile [FILE] Logfile to use (overrides configuration setting)
If [LIST] has multiple arguments, then you have to put these in quotes. If [LIST] has multiple arguments, then you have to put these in quotes.
@@ -270,130 +284,226 @@ dropindirs_sort()
} }
} }
rearrange_params()
{
# Workaround -i, --include taking 2 arguments
set -- "${@/--include/++include}"
# This prevents any long argument ending with "-i"
# -i, like --opt-i but I think we can just prevent that
set -- "${@/%-i/++include}"
TEMP=$(unset POSIXLY_CORRECT; getopt \
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \
--long kver: \
--long add: \
--long force-add: \
--long add-drivers: \
--long omit-drivers: \
--long modules: \
--long omit: \
--long drivers: \
--long filesystems: \
--long install: \
--long fwdir: \
--long libdirs: \
--long fscks: \
--long add-fstab: \
--long mount: \
--long device: \
--long add-device: \
--long nofscks: \
--long ro-mnt \
--long kmoddir: \
--long conf: \
--long confdir: \
--long tmpdir: \
--long stdlog: \
--long compress: \
--long prefix: \
--long rebuild: \
--long force \
--long kernel-only \
--long no-kernel \
--long print-cmdline \
--long kernel-cmdline: \
--long strip \
--long nostrip \
--long prelink \
--long noprelink \
--long hardlink \
--long nohardlink \
--long noprefix \
--long mdadmconf \
--long nomdadmconf \
--long lvmconf \
--long nolvmconf \
--long debug \
--long profile \
--long sshkey: \
--long logfile: \
--long verbose \
--long quiet \
--long local \
--long hostonly \
--long host-only \
--long no-hostonly \
--long no-host-only \
--long hostonly-cmdline \
--long no-hostonly-cmdline \
--long persistent-policy: \
--long fstab \
--long help \
--long bzip2 \
--long lzma \
--long xz \
--long lzo \
--long lz4 \
--long no-compress \
--long gzip \
--long list-modules \
--long show-modules \
--long keep \
--long printsize \
--long regenerate-all \
--long noimageifnotneeded \
--long early-microcode \
--long no-early-microcode \
-- "$@")
if (( $? != 0 )); then
usage
exit 1
fi
}
verbosity_mod_l=0 verbosity_mod_l=0
unset kernel unset kernel
unset outfile unset outfile
# Workaround -i, --include taking 2 arguments rearrange_params "$@"
set -- "${@/--include/++include}" eval set -- "$TEMP"
# This prevents any long argument ending with "-i" # parse command line args to check if '--rebuild' option is present
# -i, like --opt-i but I think we can just prevent that unset append_args_l
set -- "${@/%-i/++include}" unset rebuild_file
while :
do
if [ "$1" == "--" ]; then
shift; break
fi
if [ "$1" == "--rebuild" ]; then
append_args_l="yes"
rebuild_file=$2
if [ ! -e $rebuild_file ]; then
echo "Image file '$rebuild_file', for rebuild, does not exist!"
exit 1
fi
abs_rebuild_file=$(readlink -f "$rebuild_file") && rebuild_file="$abs_rebuild_file"
shift; continue
fi
shift
done
TEMP=$(unset POSIXLY_CORRECT; getopt \ # get output file name and kernel version from command line arguments
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \ while (($# > 0)); do
--long kver: \ case ${1%%=*} in
--long add: \ ++include)
--long force-add: \ shift 2;;
--long add-drivers: \ *)
--long omit-drivers: \ if ! [[ ${outfile+x} ]]; then
--long modules: \ outfile=$1
--long omit: \ elif ! [[ ${kernel+x} ]]; then
--long drivers: \ kernel=$1
--long filesystems: \ else
--long install: \ printf "\nUnknown arguments: %s\n\n" "$*" >&2
--long fwdir: \ usage; exit 1;
--long libdirs: \ fi
--long fscks: \ ;;
--long add-fstab: \ esac
--long mount: \ shift
--long device: \ done
--long nofscks: \
--long ro-mnt \
--long kmoddir: \
--long conf: \
--long confdir: \
--long tmpdir: \
--long stdlog: \
--long compress: \
--long prefix: \
--long force \
--long kernel-only \
--long no-kernel \
--long print-cmdline \
--long kernel-cmdline: \
--long strip \
--long nostrip \
--long hardlink \
--long nohardlink \
--long noprefix \
--long mdadmconf \
--long nomdadmconf \
--long lvmconf \
--long nolvmconf \
--long debug \
--long profile \
--long sshkey: \
--long verbose \
--long quiet \
--long local \
--long hostonly \
--long host-only \
--long no-hostonly \
--long no-host-only \
--long persistent-policy: \
--long fstab \
--long help \
--long bzip2 \
--long lzma \
--long xz \
--long no-compress \
--long gzip \
--long list-modules \
--long show-modules \
--long keep \
--long printsize \
--long regenerate-all \
--long noimageifnotneeded \
--long early-microcode \
--long no-early-microcode \
-- "$@")
if (( $? != 0 )); then # extract input image file provided with rebuild option to get previous parameters, if any
usage if [[ $append_args_l == "yes" ]]; then
exit 1 unset rebuild_param
# determine resultant file
if ! [[ $outfile ]]; then
outfile=$rebuild_file
fi
if ! rebuild_param=$(lsinitrd $rebuild_file '*lib/dracut/build-parameter.txt'); then
echo "Image '$rebuild_file' has no rebuild information stored"
exit 1
fi
# prepend previous parameters to current command line args
if [[ $rebuild_param ]]; then
TEMP="$rebuild_param $TEMP"
eval set -- "$TEMP"
rearrange_params "$@"
fi
# clean the temporarily used scratch-pad directory
rm -rf $scratch_dir
fi fi
unset PARMS_TO_STORE
PARMS_TO_STORE=""
eval set -- "$TEMP" eval set -- "$TEMP"
while :; do while :; do
if [ $1 != "--" ] && [ $1 != "--rebuild" ]; then
PARMS_TO_STORE+=" $1";
fi
case $1 in case $1 in
--kver) kernel="$2"; shift;; --kver) kernel="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-a|--add) push add_dracutmodules_l "$2"; shift;; -a|--add) push add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--force-add) push force_add_dracutmodules_l "$2"; shift;; --force-add) push force_add_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--add-drivers) push add_drivers_l "$2"; shift;; --add-drivers) push add_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--omit-drivers) push omit_drivers_l "$2"; shift;; --omit-drivers) push omit_drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-m|--modules) push dracutmodules_l "$2"; shift;; -m|--modules) push dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-o|--omit) push omit_dracutmodules_l "$2"; shift;; -o|--omit) push omit_dracutmodules_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-d|--drivers) push drivers_l "$2"; shift;; -d|--drivers) push drivers_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--filesystems) push filesystems_l "$2"; shift;; --filesystems) push filesystems_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-I|--install) push install_items_l "$2"; shift;; -I|--install) push install_items_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--fwdir) push fw_dir_l "$2"; shift;; --fwdir) push fw_dir_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--libdirs) push libdirs_l "$2"; shift;; --libdirs) push libdirs_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--fscks) push fscks_l "$2"; shift;; --fscks) push fscks_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--add-fstab) push add_fstab_l "$2"; shift;; --add-fstab) push add_fstab_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--mount) push fstab_lines "$2"; shift;; --mount) push fstab_lines "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--add-device|--device) --add-device|--device)
push add_device_l "$2"; shift;; push add_device_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--kernel-cmdline) push kernel_cmdline_l "$2"; shift;; --kernel-cmdline) push kernel_cmdline_l "$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--nofscks) nofscks_l="yes";; --nofscks) nofscks_l="yes";;
--ro-mnt) ro_mnt_l="yes";; --ro-mnt) ro_mnt_l="yes";;
-k|--kmoddir) drivers_dir_l="$2"; shift;; -k|--kmoddir) drivers_dir_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-c|--conf) conffile="$2"; shift;; -c|--conf) conffile="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--confdir) confdir="$2"; shift;; --confdir) confdir="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--tmpdir) tmpdir_l="$2"; shift;; --tmpdir) tmpdir_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-L|--stdlog) stdloglvl_l="$2"; shift;; -L|--stdlog) stdloglvl_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--compress) compress_l="$2"; shift;; --compress) compress_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--prefix) prefix_l="$2"; shift;; --prefix) prefix_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--rebuild) if [ $rebuild_file == $outfile ]; then
force=yes
fi
shift
;;
-f|--force) force=yes;; -f|--force) force=yes;;
--kernel-only) kernel_only="yes"; no_kernel="no";; --kernel-only) kernel_only="yes"; no_kernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";; --no-kernel) kernel_only="no"; no_kernel="yes";;
--print-cmdline) print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";; --print-cmdline)
--early-microcode) early_microcode_l="yes";; print_cmdline="yes"; hostonly_l="yes"; kernel_only="yes"; no_kernel="yes";;
--no-early-microcode) early_microcode_l="no";; --early-microcode)
early_microcode_l="yes";;
--no-early-microcode)
early_microcode_l="no";;
--strip) do_strip_l="yes";; --strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";; --nostrip) do_strip_l="no";;
--prelink) do_prelink_l="yes";;
--noprelink) do_prelink_l="no";;
--hardlink) do_hardlink_l="yes";; --hardlink) do_hardlink_l="yes";;
--nohardlink) do_hardlink_l="no";; --nohardlink) do_hardlink_l="no";;
--noprefix) prefix_l="/";; --noprefix) prefix_l="/";;
@@ -403,7 +513,8 @@ while :; do
--nolvmconf) lvmconf_l="no";; --nolvmconf) lvmconf_l="no";;
--debug) debug="yes";; --debug) debug="yes";;
--profile) profile="yes";; --profile) profile="yes";;
--sshkey) sshkey="$2"; shift;; --sshkey) sshkey="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--logfile) logfile_l="$2"; shift;;
-v|--verbose) ((verbosity_mod_l++));; -v|--verbose) ((verbosity_mod_l++));;
-q|--quiet) ((verbosity_mod_l--));; -q|--quiet) ((verbosity_mod_l--));;
-l|--local) -l|--local)
@@ -415,15 +526,21 @@ while :; do
hostonly_l="yes" ;; hostonly_l="yes" ;;
-N|--no-hostonly|--no-host-only) -N|--no-hostonly|--no-host-only)
hostonly_l="no" ;; hostonly_l="no" ;;
--hostonly-cmdline)
hostonly_cmdline_l="yes" ;;
--no-hostonly-cmdline)
hostonly_cmdline_l="no" ;;
--persistent-policy) --persistent-policy)
persistent_policy_l="$2"; shift;; persistent_policy_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--fstab) use_fstab_l="yes" ;; --fstab) use_fstab_l="yes" ;;
-h|--help) long_usage; exit 1 ;; -h|--help) long_usage; exit 1 ;;
-i|--include) push include_src "$2" -i|--include) push include_src "$2"; PARMS_TO_STORE+=" '$2'";
shift;; shift;;
--bzip2) compress_l="bzip2";; --bzip2) compress_l="bzip2";;
--lzma) compress_l="lzma";; --lzma) compress_l="lzma";;
--xz) compress_l="xz";; --xz) compress_l="xz";;
--lzo) compress_l="lzo";;
--lz4) compress_l="lz4";;
--no-compress) _no_compress_l="cat";; --no-compress) _no_compress_l="cat";;
--gzip) compress_l="gzip";; --gzip) compress_l="gzip";;
--list-modules) do_list="yes";; --list-modules) do_list="yes";;
@@ -447,21 +564,12 @@ done
# the old fashioned way # the old fashioned way
while (($# > 0)); do while (($# > 0)); do
case ${1%%=*} in if [ "${1%%=*}" == "++include" ]; then
++include) push include_src "$2" push include_src "$2"
push include_target "$3" push include_target "$3"
shift 2;; PARMS_TO_STORE+=" --include '$2' '$3'"
*) shift 2
if ! [[ ${outfile+x} ]]; then fi
outfile=$1
elif ! [[ ${kernel+x} ]]; then
kernel=$1
else
printf "\nUnknown arguments: %s\n\n" "$*" >&2
usage; exit 1;
fi
;;
esac
shift shift
done done
@@ -485,22 +593,23 @@ if [[ $regenerate_all == "yes" ]]; then
cd /lib/modules cd /lib/modules
for i in *; do for i in *; do
[[ -f $i/modules.builtin ]] || continue [[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
dracut --kver="$i" "${dracut_args[@]}" dracut --kver="$i" "${dracut_args[@]}"
((ret+=$?)) ((ret+=$?))
done done
exit $ret exit $ret
elif [[ $kernel ]]; then
if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
printf -- "Kernel version $kernel has no modules in /lib/modules/$kernel\n" >&2
exit 1
fi
fi fi
if ! [[ $kernel ]]; then if ! [[ $kernel ]]; then
kernel=$(uname -r) kernel=$(uname -r)
fi fi
if [[ $kernel ]]; then
if ! [[ -d /lib/modules/$kernel ]] && [[ $no_kernel != yes ]]; then
printf -- "Kernel version $kernel has no module directory /lib/modules/$kernel\n" >&2
fi
fi
if ! [[ $outfile ]]; then if ! [[ $outfile ]]; then
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
@@ -516,7 +625,7 @@ for i in /usr/sbin /sbin /usr/bin /bin; do
if [ -L "$i" ]; then if [ -L "$i" ]; then
rl=$(readlink -f $i) rl=$(readlink -f $i)
fi fi
if [[ "$NPATH" != "*:$rl*" ]] ; then if [[ "$NPATH" != *:$rl* ]] ; then
NPATH+=":$rl" NPATH+=":$rl"
fi fi
done done
@@ -527,6 +636,7 @@ export LC_ALL=C
export LANG=C export LANG=C
unset NPATH unset NPATH
unset LD_LIBRARY_PATH unset LD_LIBRARY_PATH
unset LD_PRELOAD
unset GREP_OPTIONS unset GREP_OPTIONS
export DRACUT_LOG_LEVEL=warning export DRACUT_LOG_LEVEL=warning
@@ -651,11 +761,14 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l [[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l [[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $do_strip ]] || do_strip=yes [[ $do_strip ]] || do_strip=yes
[[ $do_prelink_l ]] && do_prelink=$do_prelink_l
[[ $do_prelink ]] || do_prelink=yes
[[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l [[ $do_hardlink_l ]] && do_hardlink=$do_hardlink_l
[[ $do_hardlink ]] || do_hardlink=yes [[ $do_hardlink ]] || do_hardlink=yes
[[ $prefix_l ]] && prefix=$prefix_l [[ $prefix_l ]] && prefix=$prefix_l
[[ $prefix = "/" ]] && unset prefix [[ $prefix = "/" ]] && unset prefix
[[ $hostonly_l ]] && hostonly=$hostonly_l [[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $hostonly_cmdline_l ]] && hostonly_cmdline=$hostonly_cmdline_l
[[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l [[ $persistent_policy_l ]] && persistent_policy=$persistent_policy_l
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l [[ $use_fstab_l ]] && use_fstab=$use_fstab_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
@@ -664,12 +777,14 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware" [[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l" [[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
[[ $tmpdir ]] || tmpdir=/var/tmp [[ $tmpdir ]] || tmpdir=/var/tmp
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
[[ $compress_l ]] && compress=$compress_l [[ $compress_l ]] && compress=$compress_l
[[ $show_modules_l ]] && show_modules=$show_modules_l [[ $show_modules_l ]] && show_modules=$show_modules_l
[[ $nofscks_l ]] && nofscks="yes" [[ $nofscks_l ]] && nofscks="yes"
[[ $ro_mnt_l ]] && ro_mnt="yes" [[ $ro_mnt_l ]] && ro_mnt="yes"
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l [[ $early_microcode_l ]] && early_microcode=$early_microcode_l
[[ $early_microcode ]] || early_microcode=no [[ $early_microcode ]] || early_microcode=no
[[ $logfile_l ]] && logfile="$logfile_l"
# eliminate IFS hackery when messing with fw_dir # eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ } fw_dir=${fw_dir//:/ }
@@ -677,9 +792,11 @@ fw_dir=${fw_dir//:/ }
[[ $compress ]] || compress="gzip" [[ $compress ]] || compress="gzip"
case $compress in case $compress in
bzip2) compress="bzip2 -9";; bzip2) compress="bzip2 -9";;
lzma) compress="lzma -9";; lzma) compress="lzma -9 -T0";;
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";; xz) compress="xz --check=crc32 --lzma2=dict=1MiB -T0";;
gzip) compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";; gzip) compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
lzo) compress="lzop -9";;
lz4) compress="lz4 -l -9";;
esac esac
if [[ $_no_compress_l = "cat" ]]; then if [[ $_no_compress_l = "cat" ]]; then
compress="cat" compress="cat"
@@ -691,23 +808,22 @@ fi
readonly TMPDIR="$tmpdir" readonly TMPDIR="$tmpdir"
readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)" readonly initdir="$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)"
[ -d "$initdir" ] || { [ -d "$initdir" ] || {
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXX failed." >&2 printf "%s\n" "dracut: mktemp --tmpdir='$TMPDIR/' -d -t initramfs.XXXXXX failed." >&2
exit 1 exit 1
} }
if [[ $early_microcode = yes ]]; then if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]] ); then
readonly microcode_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_microcode.XXXXXX)" readonly early_cpio_dir="$(mktemp --tmpdir="$TMPDIR/" -d -t early_cpio.XXXXXX)"
[ -d "$microcode_dir" ] || { [ -d "$early_cpio_dir" ] || {
printf "%s\n" "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t early_microcode.XXXXXX failed." >&2 printf "%s\n" "dracut: mktemp --tmpdir='$TMPDIR/' -d -t early_cpio.XXXXXX failed." >&2
exit 1 exit 1
} }
fi fi
# clean up after ourselves no matter how we die. # clean up after ourselves no matter how we die.
trap ' trap '
ret=$?; ret=$?;
[[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";
[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; }; [[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
[[ $keep ]] && echo "Not removing $microcode_dir." >&2 || { [[ $microcode_dir ]] && rm -Rf -- "$microcode_dir"; }; [[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
[[ $_dlogdir ]] && rm -Rf -- "$_dlogdir"; [[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
exit $ret; exit $ret;
' EXIT ' EXIT
@@ -816,9 +932,25 @@ if [[ -d $srcmods ]]; then
} }
fi fi
if [[ -f $outfile && ! $force && ! $print_cmdline ]]; then if [[ ! $print_cmdline ]]; then
dfatal "Will not override existing initramfs ($outfile) without --force" if [[ -f $outfile && ! $force ]]; then
exit 1 dfatal "Will not override existing initramfs ($outfile) without --force"
exit 1
fi
outdir=${outfile%/*}
[[ $outdir ]] || outdir="/"
if [[ ! -d "$outdir" ]]; then
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
exit 1
elif [[ ! -w "$outdir" ]]; then
dfatal "No permission to write to $outdir."
exit 1
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
dfatal "No permission to write $outfile."
exit 1
fi
fi fi
# Need to be able to have non-root users read stuff (rpcbind etc) # Need to be able to have non-root users read stuff (rpcbind etc)
@@ -876,7 +1008,9 @@ if [[ $hostonly ]]; then
"/usr/sbin" \ "/usr/sbin" \
"/usr/lib" \ "/usr/lib" \
"/usr/lib64" \ "/usr/lib64" \
"/boot"; "/boot" \
"/boot/efi" \
;
do do
mp=$(readlink -f "$mp") mp=$(readlink -f "$mp")
mountpoint "$mp" >/dev/null 2>&1 || continue mountpoint "$mp" >/dev/null 2>&1 || continue
@@ -884,7 +1018,7 @@ if [[ $hostonly ]]; then
_bdev=$(readlink -f "/dev/block/$_dev") _bdev=$(readlink -f "/dev/block/$_dev")
[[ -b $_bdev ]] && _dev=$_bdev [[ -b $_bdev ]] && _dev=$_bdev
push host_devs $_dev push host_devs $_dev
[[ "$_mp" == "/" ]] && root_dev="$_dev" [[ "$mp" == "/" ]] && root_dev="$_dev"
push host_devs "$_dev" push host_devs "$_dev"
done done
@@ -907,6 +1041,8 @@ if [[ $hostonly ]]; then
[[ $_mapper = \#* ]] && continue [[ $_mapper = \#* ]] && continue
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue [[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
[[ "$_o" ]] || _o="$_p" [[ "$_o" ]] || _o="$_p"
# skip entries with password files
[[ "$_p" == /* ]] && [[ -f $_p ]] && continue 2
# skip mkswap swap # skip mkswap swap
[[ $_o == *swap* ]] && continue 2 [[ $_o == *swap* ]] && continue 2
done < /etc/crypttab done < /etc/crypttab
@@ -919,12 +1055,22 @@ if [[ $hostonly ]]; then
fi fi
# record all host modaliases # record all host modaliases
declare -A host_modalias declare -A host_modalias
find /sys/devices/ -name modalias -print > "$initdir/.modalias" find /sys/devices/ -name uevent -print > "$initdir/.modalias"
while read m; do while read m; do
host_modalias["$(<"$m")"]=1 while read line; do
[[ "$line" != MODALIAS\=* ]] && continue
modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
break
done < "$m"
done < "$initdir/.modalias" done < "$initdir/.modalias"
rm -f -- "$initdir/.modalias" rm -f -- "$initdir/.modalias"
while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
host_modalias["$_v"]=1
done </proc/crypto
# check /proc/modules # check /proc/modules
declare -A host_modules declare -A host_modules
while read m rest; do while read m rest; do
@@ -937,12 +1083,12 @@ unset rest
_get_fs_type() { _get_fs_type() {
[[ $1 ]] || return [[ $1 ]] || return
if [[ -b /dev/block/$1 ]] && ID_FS_TYPE=$(get_fs_env "/dev/block/$1"); then if [[ -b /dev/block/$1 ]]; then
host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE" ID_FS_TYPE=$(get_fs_env "/dev/block/$1") && host_fs_types["$(readlink -f "/dev/block/$1")"]="$ID_FS_TYPE"
return 1 return 1
fi fi
if [[ -b $1 ]] && ID_FS_TYPE=$(get_fs_env "$1"); then if [[ -b $1 ]]; then
host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE" ID_FS_TYPE=$(get_fs_env "$1") && host_fs_types["$(readlink -f "$1")"]="$ID_FS_TYPE"
return 1 return 1
fi fi
if fstype=$(find_dev_fstype "$1"); then if fstype=$(find_dev_fstype "$1"); then
@@ -1006,7 +1152,7 @@ export initdir dracutbasedir dracutmodules \
debug host_fs_types host_devs sshkey add_fstab \ debug host_fs_types host_devs sshkey add_fstab \
DRACUT_VERSION udevdir prefix filesystems drivers \ DRACUT_VERSION udevdir prefix filesystems drivers \
systemdutildir systemdsystemunitdir systemdsystemconfdir \ systemdutildir systemdsystemunitdir systemdsystemconfdir \
host_modalias host_modules host_modalias host_modules hostonly_cmdline
mods_to_load="" mods_to_load=""
# check all our modules to see if they should be sourced. # check all our modules to see if they should be sourced.
@@ -1028,20 +1174,6 @@ if [[ $print_cmdline ]]; then
exit 0 exit 0
fi fi
outdir=${outfile%/*}
[[ $outdir ]] || outdir="/"
if [[ ! -d "$outdir" ]]; then
dfatal "Can't write to $outdir: Directory $outdir does not exist or is not accessible."
exit 1
elif [[ ! -w "$outdir" ]]; then
dfatal "No permission to write to $outdir."
exit 1
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
dfatal "No permission to write $outfile."
exit 1
fi
# Create some directory structure first # Create some directory structure first
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}" [[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
@@ -1065,7 +1197,7 @@ if [[ $kernel_only != yes ]]; then
fi fi
done done
for d in dev proc sys sysroot root run run/lock run/initramfs; do for d in dev proc sys sysroot root run; do
if [ -L "/$d" ]; then if [ -L "/$d" ]; then
inst_symlink "/$d" inst_symlink "/$d"
else else
@@ -1180,7 +1312,11 @@ if [[ $kernel_only != yes ]]; then
[[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf" [[ $kernel_cmdline ]] && printf "%s\n" "$kernel_cmdline" >> "${initdir}/etc/cmdline.d/01-default.conf"
while pop fstab_lines line; do while pop fstab_lines line; do
printf "%s\n" "$line 0 0" >> "${initdir}/etc/fstab" line=($line)
[ -z "${line[3]}" ] && line[3]="defaults"
[ -z "${line[4]}" ] && line[4]="0"
[ -z "${line[5]}" ] && line[5]="2"
echo "${line[@]}" >> "${initdir}/etc/fstab"
done done
for f in $add_fstab; do for f in $add_fstab; do
@@ -1246,18 +1382,20 @@ if [[ $kernel_only != yes ]]; then
fi fi
fi fi
PRELINK_BIN="$(command -v prelink)" if [[ $do_prelink == yes ]]; then
if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then PRELINK_BIN="$(command -v prelink)"
if [[ $DRACUT_FIPS_MODE ]]; then if [[ $UID = 0 ]] && [[ $PRELINK_BIN ]]; then
dinfo "*** Installing prelink files ***" if [[ $DRACUT_FIPS_MODE ]]; then
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache dinfo "*** Installing prelink files ***"
else inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf /etc/prelink.cache
dinfo "*** Pre-linking files ***" else
inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf dinfo "*** Pre-linking files ***"
chroot "$initdir" "$PRELINK_BIN" -a inst_multiple -o prelink /etc/prelink.conf /etc/prelink.conf.d/*.conf
rm -f -- "$initdir/$PRELINK_BIN" chroot "$initdir" "$PRELINK_BIN" -a
rm -fr -- "$initdir"/etc/prelink.* rm -f -- "$initdir/$PRELINK_BIN"
dinfo "*** Pre-linking files done ***" rm -fr -- "$initdir"/etc/prelink.*
dinfo "*** Pre-linking files done ***"
fi
fi fi
fi fi
@@ -1296,7 +1434,7 @@ if [[ $early_microcode = yes ]]; then
dinfo "*** Generating early-microcode cpio image ***" dinfo "*** Generating early-microcode cpio image ***"
ucode_dir=(amd-ucode intel-ucode) ucode_dir=(amd-ucode intel-ucode)
ucode_dest=(AuthenticAMD.bin GenuineIntel.bin) ucode_dest=(AuthenticAMD.bin GenuineIntel.bin)
_dest_dir="$microcode_dir/d/kernel/x86/microcode" _dest_dir="$early_cpio_dir/d/kernel/x86/microcode"
_dest_idx="0 1" _dest_idx="0 1"
mkdir -p $_dest_dir mkdir -p $_dest_dir
if [[ $hostonly ]]; then if [[ $hostonly ]]; then
@@ -1311,26 +1449,49 @@ if [[ $early_microcode = yes ]]; then
dinfo "*** Constructing ${ucode_dest[$idx]} ****" dinfo "*** Constructing ${ucode_dest[$idx]} ****"
if [[ $hostonly ]]; then if [[ $hostonly ]]; then
_src=$(get_ucode_file) _src=$(get_ucode_file)
if ! [[ -r $_fwdir/$_fw/$_src ]];then
break;
fi
fi fi
cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]} cat $_fwdir/$_fw/$_src > $_dest_dir/${ucode_dest[$idx]}
create_early_cpio="yes"
fi fi
done done
done done
(cd "$microcode_dir/d"; find . -print0 | cpio --null -o -H newc --quiet >../ucode.cpio) fi
if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
dinfo "*** Packaging ACPI tables to override BIOS provided ones ***"
_dest_dir="$early_cpio_dir/d/kernel/firmware/acpi"
mkdir -p $_dest_dir
for table in $acpi_table_dir/*.aml; do
dinfo " Adding ACPI table: $table"
cp $table $_dest_dir
create_early_cpio="yes"
done
fi
dinfo "*** Store current command line parameters ***"
if ! ( echo $PARMS_TO_STORE > $initdir/lib/dracut/build-parameter.txt ); then
dfatal "Could not store the current command line parameters"
exit 1
fi fi
rm -f -- "$outfile" rm -f -- "$outfile"
dinfo "*** Creating image file ***" dinfo "*** Creating image file ***"
if [[ $early_microcode = yes ]]; then
[[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0"
if [[ $create_early_cpio = yes ]]; then
echo 1 > "$early_cpio_dir/d/early_cpio"
# The microcode blob is _before_ the initramfs blob, not after # The microcode blob is _before_ the initramfs blob, not after
mv $microcode_dir/ucode.cpio $outfile.$$ (cd "$early_cpio_dir/d"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet > $outfile)
fi fi
if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet| \ if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet | \
$compress >> "$outfile.$$"; ); then $compress >> "$outfile"; ); then
dfatal "dracut: creation of $outfile.$$ failed" dfatal "dracut: creation of $outfile failed"
exit 1 exit 1
fi fi
mv -- "$outfile.$$" "$outfile"
dinfo "*** Creating image file done ***" dinfo "*** Creating image file done ***"
if (( maxloglvl >= 5 )); then if (( maxloglvl >= 5 )); then

View File

@@ -1,4 +1,5 @@
%define dracutlibdir %{_prefix}/lib/dracut %define dracutlibdir %{_prefix}/lib/dracut
%bcond_without doc
# Variables must be defined # Variables must be defined
%define with_nbd 1 %define with_nbd 1
@@ -28,7 +29,7 @@ URL: https://dracut.wiki.kernel.org/
# Source can be generated by # Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz # http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2 Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.xz
BuildRequires: bash git BuildRequires: bash git
@@ -45,6 +46,7 @@ BuildRequires: pkgconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif %endif
%if %{with doc}
%if 0%{?fedora} || 0%{?rhel} %if 0%{?fedora} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds libxslt BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif %endif
@@ -54,6 +56,8 @@ BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif %endif
BuildRequires: asciidoc BuildRequires: asciidoc
%endif
%if 0%{?fedora} > 12 || 0%{?rhel} %if 0%{?fedora} > 12 || 0%{?rhel}
# no "provides", because dracut does not offer # no "provides", because dracut does not offer
@@ -97,16 +101,14 @@ Requires: util-linux >= 2.21
Requires: systemd >= 199 Requires: systemd >= 199
Requires: procps-ng Requires: procps-ng
Conflicts: grubby < 8.23 Conflicts: grubby < 8.23
Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
Conflicts: bcache-tools < 0-0.14.20130909git
%else %else
Requires: udev > 166 Requires: udev > 166
Requires: util-linux-ng >= 2.21 Requires: util-linux-ng >= 2.21
%endif %endif
%if 0%{?fedora} || 0%{?rhel} > 6
Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
%endif
Conflicts: mdadm < 3.2.6-14 Conflicts: mdadm < 3.2.6-14
%description %description
@@ -205,7 +207,10 @@ git am -p1 %{patches}
%endif %endif
%build %build
%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib %configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib \
%if %{without doc}
--disable-documentation
%endif
make %{?_smp_mflags} make %{?_smp_mflags}
@@ -248,15 +253,18 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} %if 0%{?fedora} || 0%{?rhel}
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
%endif %endif
%if 0%{?suse_version} %if 0%{?suse_version}
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif %endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/40-fips.conf
%endif
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999 %if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
@@ -271,19 +279,25 @@ echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-i
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%endif %endif
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
> $RPM_BUILD_ROOT/etc/system-fips
%endif
# create compat symlink # create compat symlink
mkdir -p $RPM_BUILD_ROOT/sbin mkdir -p $RPM_BUILD_ROOT%{_sbindir}
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut ln -sr $RPM_BUILD_ROOT%{_bindir}/dracut $RPM_BUILD_ROOT%{_sbindir}/dracut
%clean %clean
rm -rf -- $RPM_BUILD_ROOT rm -rf -- $RPM_BUILD_ROOT
%files %files
%defattr(-,root,root,0755) %defattr(-,root,root,0755)
%if %{with doc}
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg %doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
%endif
%{_bindir}/dracut %{_bindir}/dracut
# compat symlink # compat symlink
/sbin/dracut %{_sbindir}/dracut
%{_datadir}/bash-completion/completions/dracut %{_datadir}/bash-completion/completions/dracut
%{_datadir}/bash-completion/completions/lsinitrd %{_datadir}/bash-completion/completions/lsinitrd
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999 %if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
@@ -298,12 +312,15 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/dracut-logger.sh %{dracutlibdir}/dracut-logger.sh
%{dracutlibdir}/dracut-initramfs-restore %{dracutlibdir}/dracut-initramfs-restore
%{dracutlibdir}/dracut-install %{dracutlibdir}/dracut-install
%{dracutlibdir}/skipcpio
%config(noreplace) %{_sysconfdir}/dracut.conf %config(noreplace) %{_sysconfdir}/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} %if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
%{dracutlibdir}/dracut.conf.d/01-dist.conf %{dracutlibdir}/dracut.conf.d/01-dist.conf
%endif %endif
%dir %{_sysconfdir}/dracut.conf.d %dir %{_sysconfdir}/dracut.conf.d
%dir %{dracutlibdir}/dracut.conf.d %dir %{dracutlibdir}/dracut.conf.d
%if %{with doc}
%{_mandir}/man8/dracut.8* %{_mandir}/man8/dracut.8*
%{_mandir}/man8/*service.8* %{_mandir}/man8/*service.8*
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999 %if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
@@ -312,8 +329,11 @@ rm -rf -- $RPM_BUILD_ROOT
%endif %endif
%{_mandir}/man7/dracut.kernel.7* %{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7* %{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man7/dracut.modules.7*
%{_mandir}/man7/dracut.bootup.7* %{_mandir}/man7/dracut.bootup.7*
%{_mandir}/man5/dracut.conf.5* %{_mandir}/man5/dracut.conf.5*
%endif
%if %{defined _unitdir} %if %{defined _unitdir}
%{dracutlibdir}/modules.d/00systemd-bootchart %{dracutlibdir}/modules.d/00systemd-bootchart
%else %else
@@ -330,7 +350,6 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/50drm %{dracutlibdir}/modules.d/50drm
%{dracutlibdir}/modules.d/50plymouth %{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/80cms %{dracutlibdir}/modules.d/80cms
%{dracutlibdir}/modules.d/90bcache
%{dracutlibdir}/modules.d/90btrfs %{dracutlibdir}/modules.d/90btrfs
%{dracutlibdir}/modules.d/90crypt %{dracutlibdir}/modules.d/90crypt
%{dracutlibdir}/modules.d/90dm %{dracutlibdir}/modules.d/90dm
@@ -348,8 +367,10 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/95rootfs-block %{dracutlibdir}/modules.d/95rootfs-block
%{dracutlibdir}/modules.d/95dasd %{dracutlibdir}/modules.d/95dasd
%{dracutlibdir}/modules.d/95dasd_mod %{dracutlibdir}/modules.d/95dasd_mod
%{dracutlibdir}/modules.d/95dasd_rules
%{dracutlibdir}/modules.d/95fstab-sys %{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95zfcp %{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95zfcp_rules
%{dracutlibdir}/modules.d/95terminfo %{dracutlibdir}/modules.d/95terminfo
%{dracutlibdir}/modules.d/95udev-rules %{dracutlibdir}/modules.d/95udev-rules
%{dracutlibdir}/modules.d/95virtfs %{dracutlibdir}/modules.d/95virtfs
@@ -407,17 +428,24 @@ rm -rf -- $RPM_BUILD_ROOT
%{dracutlibdir}/modules.d/95ssh-client %{dracutlibdir}/modules.d/95ssh-client
%{dracutlibdir}/modules.d/45ifcfg %{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/95znet %{dracutlibdir}/modules.d/95znet
%{dracutlibdir}/modules.d/95fcoe-uefi
%{dracutlibdir}/modules.d/99uefi-lib
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version} %if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
%files fips %files fips
%defattr(-,root,root,0755) %defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/01fips %{dracutlibdir}/modules.d/01fips
%{dracutlibdir}/dracut.conf.d/40-fips.conf %{dracutlibdir}/dracut.conf.d/40-fips.conf
%config(missingok) /etc/system-fips
%endif %endif
%files fips-aesni %files fips-aesni
%defattr(-,root,root,0755) %defattr(-,root,root,0755)
%if %{with doc}
%doc COPYING %doc COPYING
%endif
%{dracutlibdir}/modules.d/02fips-aesni %{dracutlibdir}/modules.d/02fips-aesni
%files caps %files caps
@@ -426,7 +454,11 @@ rm -rf -- $RPM_BUILD_ROOT
%files tools %files tools
%defattr(-,root,root,0755) %defattr(-,root,root,0755)
%{_mandir}/man8/dracut-catimages.8*
%if %{with doc}
%doc %{_mandir}/man8/dracut-catimages.8*
%endif
%{_bindir}/dracut-catimages %{_bindir}/dracut-catimages
%dir /boot/dracut %dir /boot/dracut
%dir /var/lib/dracut %dir /var/lib/dracut

537
dracut.usage.asc Normal file
View File

@@ -0,0 +1,537 @@
To create a initramfs image, the most simple command is:
----
# dracut
----
This will generate a general purpose initramfs image, with all possible
functionality resulting of the combination of the installed dracut modules and
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
contains the kernel modules of the currently active kernel with version
_++<kernel version>++_.
If the initramfs image already exists, dracut will display an error message, and
to overwrite the existing image, you have to use the --force option.
----
# dracut --force
----
If you want to specify another filename for the resulting image you would issue
a command like:
----
# dracut foobar.img
----
To generate an image for a specific kernel version, the command would be:
----
# dracut foobar.img 2.6.40-1.rc5.f20
----
A shortcut to generate the image at the default location for a specific kernel
version is:
----
# dracut --kver 2.6.40-1.rc5.f20
----
If you want to create lighter, smaller initramfs images, you may want to specify
the --hostonly or -H option. Using this option, the resulting image will
contain only those dracut modules, kernel modules and filesystems, which are
needed to boot this specific machine. This has the drawback, that you can't put
the disk on another controller or machine, and that you can't switch to another
root filesystem, without recreating the initramfs image. The usage of the
--hostonly option is only for experts and you will have to keep the broken
pieces. At least keep a copy of a general purpose image (and corresponding
kernel) as a fallback to rescue your system.
=== Inspecting the Contents
To see the contents of the image created by dracut, you can use the lsinitrd
tool.
----
# lsinitrd | less
----
To display the contents of a file in the initramfs also use the lsinitrd tool:
----
# lsinitrd -f /etc/ld.so.conf
include ld.so.conf.d/*.conf
----
=== Adding dracut Modules
Some dracut modules are turned off by default and have to be activated manually.
You can do this by adding the dracut modules to the configuration file
_/etc/dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_. See *dracut.conf*(5).
You can also add dracut modules on the command line
by using the -a or --add option:
----
# dracut --add bootchart initramfs-bootchart.img
----
To see a list of available dracut modules, use the --list-modules option:
----
# dracut --list-modules
----
=== Omitting dracut Modules
Sometimes you don't want a dracut module to be included for reasons of speed,
size or functionality. To do this, either specify the omit_dracutmodules
variable in the _dracut.conf_ or _/etc/dracut.conf.d/myconf.conf_ configuration
file (see *dracut.conf*(5)), or use the -o or --omit option
on the command line:
----
# dracut -o "multipath lvm" no-multipath-lvm.img
----
=== Adding Kernel Modules
If you need a special kernel module in the initramfs, which is not
automatically picked up by dracut, you have the use the --add-drivers option
on the command line or the drivers vaiable in the _/etc/dracut.conf_
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
----
# dracut --add-drivers mymod initramfs-with-mymod.img
----
=== Boot parameters
An initramfs generated without the "hostonly" mode, does not contain any system
configuration files (except for some special exceptions), so the configuration
has to be done on the kernel command line. With this flexibility, you can easily
boot from a changed root partition, without the need to recompile the initramfs
image. So, you could completly change your root partition (move it inside a md
raid with encryption and LVM on top), as long as you specify the correct
filesystem LABEL or UUID on the kernel command line for your root device, dracut
will find it and boot from it.
The kernel command line usually can be configured in _/boot/grub/grub.conf_ or
_/boot/grub2/grub.cfg_, if grub is your bootloader and it also can be edited in
the real boot process in the grub menu.
The kernel command line can also be provided by the dhcp server with the
root-path option. See <<NetworkBoot>>.
For a full reference of all kernel command line parameters,
see *dracut.cmdline*(5).
To get a quick start for the suitable kernel command line on your system,
use the __--print-cmdline__ option:
----
# dracut --print-cmdline
root=UUID=8b8b6f91-95c7-4da2-831b-171e12179081 rootflags=rw,relatime,discard,data=ordered rootfstype=ext4
----
==== Specifying the root Device
This is the only option dracut really needs to boot from your root partition.
Because your root partition can live in various environments, there are a lot of
formats for the root= option. The most basic one is root=_++<path to device
node>++_:
----
root=/dev/sda2
----
Because device node names can change, dependent on the drive ordering, you are
encouraged to use the filesystem identifier (UUID) or filesystem label (LABEL)
to specify your root partition:
----
root=UUID=19e9dda3-5a38-484d-a9b0-fa6b067d0331
----
or
----
root=LABEL=myrootpartitionlabel
----
To see all UUIDs or LABELs on your system, do:
----
# ls -l /dev/disk/by-uuid
----
or
----
# ls -l /dev/disk/by-label
----
If your root partition is on the network see <<NetworkBoot>>.
==== Keyboard Settings
If you have to input passwords for encrypted disk volumes, you might want to set
the keyboard layout and specify a display font.
A typical german kernel command would contain:
----
rd.vconsole.font=latarcyrheb-sun16 rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
----
Setting these options can override the setting stored on your system, if you use
a modern init system, like systemd.
==== Blacklisting Kernel Modules
Sometimes it is required to prevent the automatic kernel module loading of a
specific kernel module. To do this, just add rd.blacklist=_++<kernel module
name>++_, with _++<kernel module name>++_ not containing the _.ko_
suffix, to the kernel command line. For example:
----
rd.driver.blacklist=mptsas rd.driver.blacklist=nouveau
----
The option can be specified multiple times on the kernel command line.
==== Speeding up the Boot Process
If you want to speed up the boot process, you can specify as much information
for dracut on the kernel command as possible. For example, you can tell dracut,
that you root partition is not on a LVM volume or not on a raid partition, or
that it lives inside a specific crypto LUKS encrypted volume. By default, dracut
searches everywhere. A typical dracut kernel command line for a plain primary or
logical partition would contain:
----
rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0
----
This turns off every automatic assembly of LVM, MD raids, DM raids and
crypto LUKS.
Of course, you could also omit the dracut modules in the initramfs creation
process, but then you would lose the posibility to turn it on on demand.
[[Injecting]]
=== Injecting custom Files
To add your own files to the initramfs image, you have several possibilities.
The --include option let you specify a source path and a target path.
For example
----
# dracut --include cmdline-preset /etc/cmdline.d/mycmdline.conf initramfs-cmdline-pre.img
----
will create an initramfs image, where the file cmdline-preset will be copied
inside the initramfs to _/etc/cmdline.d/mycmdline.conf_. --include can only
be specified once.
----
# mkdir -p rd.live.overlay/etc/cmdline.d
# mkdir -p rd.live.overlay/etc/conf.d
# echo "ip=auto" >> rd.live.overlay/etc/cmdline.d/mycmdline.conf
# echo export FOO=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# echo export BAR=testtest >> rd.live.overlay/etc/conf.d/testvar.conf
# tree rd.live.overlay/
rd.live.overlay/
`-- etc
|-- cmdline.d
| `-- mycmdline.conf
`-- conf.d
`-- testvar.conf
# dracut --include rd.live.overlay / initramfs-rd.live.overlay.img
----
This will put the contents of the rd.live.overlay directory into the root of the
initramfs image.
The --install option let you specify several files, which will get installed in
the initramfs image at the same location, as they are present on initramfs
creation time.
----
# dracut --install 'strace fsck.ext3 ssh' initramfs-dbg.img
----
This will create an initramfs with the strace, fsck.ext3 and ssh executables,
together with the libraries needed to start those. The --install option can be
specified multiple times.
[[NetworkBoot]]
=== Network Boot
If your root partition is on a network drive, you have to have the network
dracut modules installed to create a network aware initramfs image.
On a Red Hat Enterprise Linux or Fedora system, this means, you have to install
the _dracut-network_ rpm package:
----
# yum install dracut-network
----
The resulting initramfs image can be served by a boot manager residing on your
local hard drive or it can be served by a PXE/TFTP server.
How to setup your PXE/TFTP server can be found in the
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
Hat Enterprise Linux Storage Administration Guide].
If you specify ip=auto on the kernel command line, then dracut asks a dhcp
server about the ip adress for the machine. The dhcp server can also serve an
additional root-path, which will set the root device for dracut. With this
mechanism, you have static configuration on your client machine and a
centralized boot configuration on your TFTP/DHCP server. If you can't pass a
kernel command line, then you can inject _/etc/cmdline.d/mycmdline.conf_, with a
method described in <<Injecting>>.
==== Reducing the Image Size
To reduce the size of the initramfs, you should create it with by ommitting all
dracut modules, which you know, you don't need to boot the machine.
You can also specify the exact dracut and kernel modules to produce a very tiny
initramfs image.
For example for a NFS image, you would do:
----
# dracut -m "nfs network base" initramfs-nfs-only.img
----
Then you would boot from this image with your target machine and reduce the size
once more by creating it on the target machine with the --host-only option:
----
# dracut -m "nfs network base" --host-only initramfs-nfs-host-only.img
----
This will reduce the size of the initramfs image significantly.
== Troubleshooting
If the boot process does not succeed, you have several options to debug the
situation. Some of the basic operations are covered here. For more information
you should also visit:
http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
[[identifying-your-problem-area]]
=== Identifying your problem area
. Remove ''rhgb'' and ''quiet'' from the kernel command line
. Add ''rd.shell'' to the kernel command line. This will present a shell should
dracut be unable to locate your root device
. Add ''rd.shell rd.debug log_buf_len=1M'' to the kernel command line so that
dracut shell commands are printed as they are executed
. The file /run/initramfs/rdsosreport.txt is generated,
which contains all the logs and the output of all significant tools, which are
mentioned later.
If you want to save that output, simply mount /boot by hand or insert an USB
stick and mount that. Then you can store the output for later inspection.
[[information-to-include-in-your-report]]
=== Information to include in your report
[[all-bug-reports]]
==== All bug reports
In all cases, the following should be mentioned and attached to your bug report:
* The exact kernel command-line used. Typically from the bootloader
configuration file (e.g. _/etc/grub.conf_) or from _/proc/cmdline_.
* A copy of your disk partition information from _/etc/fstab_, which might be
obtained booting an old working initramfs or a rescue medium.
* Turn on dracut debugging (see _the 'debugging dracut' section_), and attach
the file /run/initramfs/rdsosreport.txt.
* If you use a dracut configuration file, please include _/etc/dracut.conf_ and
all files in _/etc/dracut.conf.d/*.conf_
[[network-root-device-related-problems]]
==== Network root device related problems
This section details information to include when experiencing problems on a
system whose root device is located on a network attached volume (e.g. iSCSI,
NFS or NBD). As well as the information from <<all-bug-reports>>, include the
following information:
* Please include the output of
+
----
# /sbin/ifup <interfacename>
# ip addr show
----
[[debugging-dracut]]
=== Debugging dracut
[[configure-a-serial-console]]
==== Configure a serial console
Successfully debugging dracut will require some form of console
logging during the system boot. This section documents configuring a
serial console connection to record boot messages.
. First, enable serial console output for both the kernel and the bootloader.
. Open the file _/etc/grub.conf_ for editing. Below the line ''timeout=5'', add
the following:
+
----
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
----
+
. Also in _/etc/grub.conf_, add the following boot arguemnts to the ''kernel''
line:
+
----
console=tty0 console=ttyS0,9600
----
+
. When finished, the _/etc/grub.conf_ file should look similar to the example
below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 console=ttyS0,9600
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
----
+
. More detailed information on how to configure the kernel for console output
can be found at
http://www.faqs.org/docs/Linux-HOWTO/Remote-Serial-Console-HOWTO.html#CONFIGURE-KERNEL.
. Redirecting non-interactive output
+
--
NOTE: You can redirect all non-interactive output to _/dev/kmsg_ and the kernel
will put it out on the console when it reaches the kernel buffer by doing
----
# exec >/dev/kmsg 2>&1 </dev/console
----
--
[[using-the-dracut-shell]]
==== Using the dracut shell
dracut offers a shell for interactive debugging in the event dracut fails to
locate your root filesystem. To enable the shell:
. Add the boot parameter ''rd.shell'' to your bootloader configuration file
(e.g. _/etc/grub.conf_)
. Remove the boot arguments ''rhgb'' and ''quiet''
+
A sample _/etc/grub.conf_ bootloader configuration file is listed below.
+
----
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
initrd /dracut-2.6.29.5-191.fc11.x86_64.img
----
+
. If system boot fails, you will be dropped into a shell as seen in the example
below.
+
----
No root device found
Dropping to debug shell.
#
----
+
. Use this shell prompt to gather the information requested above
(see <<all-bug-reports>>).
[[accessing-the-root-volume-from-the-dracut-shell]]
==== Accessing the root volume from the dracut shell
From the dracut debug shell, you can manually perform the task of locating and
preparing your root volume for boot. The required steps will depend on how your
root volume is configured. Common scenarios include:
* A block device (e.g. _/dev/sda7_)
* A LVM logical volume (e.g. _/dev/VolGroup00/LogVol00_)
* An encrypted device
(e.g. _/dev/mapper/luks-4d5972ea-901c-4584-bd75-1da802417d83_)
* A network attached device
(e.g. _netroot=iscsi:@192.168.0.4::3260::iqn.2009-02.org.example:for.all_)
The exact method for locating and preparing will vary. However, to continue with
a successful boot, the objective is to locate your root volume and create a
symlink _/dev/root_ which points to the file system. For example, the following
example demonstrates accessing and booting a root volume that is an encrypted
LVM Logical volume.
. Inspect your partitions using parted
+
----
# parted /dev/sda -s p
Model: ATA HTS541060G9AT00 (scsi)
Disk /dev/sda: 60.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 10.8GB 107MB primary ext4 boot
2 10.8GB 55.6GB 44.7GB logical lvm
----
+
. You recall that your root volume was a LVM logical volume. Scan and activate
any logical volumes.
+
----
# lvm vgscan
# lvm vgchange -ay
----
+
. You should see any logical volumes now using the command blkid:
+
----
# blkid
/dev/sda1: UUID="3de247f3-5de4-4a44-afc5-1fe179750cf7" TYPE="ext4"
/dev/sda2: UUID="Ek4dQw-cOtq-5MJu-OGRF-xz5k-O2l8-wdDj0I" TYPE="LVM2_member"
/dev/mapper/linux-root: UUID="def0269e-424b-4752-acf3-1077bf96ad2c" TYPE="crypto_LUKS"
/dev/mapper/linux-home: UUID="c69127c1-f153-4ea2-b58e-4cbfa9257c5e" TYPE="ext3"
/dev/mapper/linux-swap: UUID="47b4d329-975c-4c08-b218-f9c9bf3635f1" TYPE="swap"
----
+
. From the output above, you recall that your root volume exists on an encrypted
block device. Following the guidance disk encryption guidance from the
Installation Guide, you unlock your encrypted root volume.
+
----
# UUID=$(cryptsetup luksUUID /dev/mapper/linux-root)
# cryptsetup luksOpen /dev/mapper/linux-root luks-$UUID
Enter passphrase for /dev/mapper/linux-root:
Key slot 0 unlocked.
----
+
. Next, make a symbolic link to the unlocked root volume
+
----
# ln -s /dev/mapper/luks-$UUID /dev/root
----
+
. With the root volume available, you may continue booting the system by exiting
the dracut shell
+
----
# exit
----
[[additional-dracut-boot-parameters]]
==== Additional dracut boot parameters
For more debugging options, see *dracut.cmdline*(7).
[[debugging-dracut-on-shutdown]]
==== Debugging dracut on shutdown
To debug the shutdown sequence on systemd systems, you can _rd.break_
on _pre-shutdown_ or _shutdown_.
To do this from an already booted system:
----
# mkdir -p /run/initramfs/etc/cmdline.d
# echo "rd.break=pre-shutdown" > /run/initramfs/etc/cmdline.d/debug.conf
# touch /run/initramfs/.need_shutdown
----
This will give you a dracut shell after the system pivot'ed back in the
initramfs.

View File

@@ -44,6 +44,7 @@
#include "log.h" #include "log.h"
#include "hashmap.h" #include "hashmap.h"
#include "util.h" #include "util.h"
#include "strv.h"
static bool arg_hmac = false; static bool arg_hmac = false;
static bool arg_createdir = false; static bool arg_createdir = false;
@@ -63,12 +64,12 @@ static size_t dir_len(char const *file)
{ {
size_t length; size_t length;
if(!file) if (!file)
return 0; return 0;
/* Strip the basename and any redundant slashes before it. */ /* Strip the basename and any redundant slashes before it. */
for (length = strlen(file)-1; 0 < length; length--) for (length = strlen(file) - 1; 0 < length; length--)
if (file[length] == '/' && file[length-1] != '/') if (file[length] == '/' && file[length - 1] != '/')
break; break;
return length; return length;
} }
@@ -101,9 +102,9 @@ static char *convert_abs_rel(const char *from, const char *target)
/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one /* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
* character - need to skip all leading /'s */ * character - need to skip all leading /'s */
rl = strlen(target); rl = strlen(target);
for (i = dirlen+1; i < rl; ++i) for (i = dirlen + 1; i < rl; ++i)
if (target_dir_p[i] != '/') if (target_dir_p[i] != '/')
break; break;
ret = asprintf(&realtarget, "%s/%s", realpath_p, &target_dir_p[i]); ret = asprintf(&realtarget, "%s/%s", realpath_p, &target_dir_p[i]);
if (ret < 0) { if (ret < 0) {
log_error("Out of memory!"); log_error("Out of memory!");
@@ -220,7 +221,7 @@ static int cp(const char *src, const char *dst)
if (ret == 0) { if (ret == 0) {
struct timeval tv[2]; struct timeval tv[2];
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0) if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
fchown(dest_desc, (__uid_t)-1, sb.st_gid); fchown(dest_desc, (__uid_t) - 1, sb.st_gid);
tv[0].tv_sec = sb.st_atime; tv[0].tv_sec = sb.st_atime;
tv[0].tv_usec = 0; tv[0].tv_usec = 0;
tv[1].tv_sec = sb.st_mtime; tv[1].tv_sec = sb.st_mtime;
@@ -239,14 +240,16 @@ static int cp(const char *src, const char *dst)
normal_copy: normal_copy:
pid = fork(); pid = fork();
if (pid == 0) { if (pid == 0) {
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst, NULL); execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,timestamps", "-fL", src, dst,
NULL);
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} }
while (waitpid(pid, &ret, 0) < 0) { while (waitpid(pid, &ret, 0) < 0) {
if (errno != EINTR) { if (errno != EINTR) {
ret = -1; ret = -1;
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src, dst); log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,timestamps -fL %s %s", src,
dst);
break; break;
} }
} }
@@ -286,7 +289,7 @@ static int library_install(const char *src, const char *lib)
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6 libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6 libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6
libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6 libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6
*/ */
free(p); free(p);
p = strdup(lib); p = strdup(lib);
@@ -372,7 +375,7 @@ static int resolve_deps(const char *src)
if (strstr(buf, "you do not have execution permission")) { if (strstr(buf, "you do not have execution permission")) {
log_error("%s", buf); log_error("%s", buf);
ret+=1; ret += 1;
break; break;
} }
@@ -391,7 +394,11 @@ static int resolve_deps(const char *src)
if (strstr(buf, destrootdir)) if (strstr(buf, destrootdir))
break; break;
p = strchr(buf, '/'); p = strstr(buf, "=>");
if (!p)
p = buf;
p = strchr(p, '/');
if (p) { if (p) {
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ; for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
*q = '\0'; *q = '\0';
@@ -421,7 +428,7 @@ static int hmac_install(const char *src, const char *dst, const char *hmacpath)
if (endswith(src, ".hmac")) if (endswith(src, ".hmac"))
return 0; return 0;
if (!hmacpath) { if (!hmacpath) {
hmac_install(src, dst, "/lib/fipscheck"); hmac_install(src, dst, "/lib/fipscheck");
hmac_install(src, dst, "/lib64/fipscheck"); hmac_install(src, dst, "/lib64/fipscheck");
hmac_install(src, dst, "/lib/hmaccalc"); hmac_install(src, dst, "/lib/hmaccalc");
@@ -635,8 +642,8 @@ static void item_free(char *i)
} }
static void usage(int status) static void usage(int status)
{ {
/* */ /* */
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n" printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n" "or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
"\n" "\n"
@@ -676,8 +683,8 @@ static void usage(int status)
" |-- libdl.so -> libdl-2.15.90.so\n" " |-- libdl.so -> libdl-2.15.90.so\n"
" |-- libdl.so.2 -> libdl-2.15.90.so\n" " |-- libdl.so.2 -> libdl-2.15.90.so\n"
" |-- libtinfo.so.5 -> libtinfo.so.5.9\n" " |-- libtinfo.so.5 -> libtinfo.so.5.9\n"
" `-- libtinfo.so.5.9\n" " `-- libtinfo.so.5.9\n", program_invocation_short_name, program_invocation_short_name,
, program_invocation_short_name, program_invocation_short_name, program_invocation_short_name); program_invocation_short_name);
exit(status); exit(status);
} }
@@ -784,13 +791,13 @@ static int resolve_lazy(int argc, char **argv)
return ret; return ret;
} }
static char *find_binary(const char *src) static char **find_binary(const char *src)
{ {
_cleanup_free_ char *path = NULL; char *path = NULL;
char *p, *q; _cleanup_strv_free_ char **p = NULL;
bool end = false; char **ret = NULL;
char **q;
char *newsrc = NULL; char *newsrc = NULL;
int ret;
path = getenv("PATH"); path = getenv("PATH");
@@ -798,34 +805,21 @@ static char *find_binary(const char *src)
log_error("PATH is not set"); log_error("PATH is not set");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
path = strdup(path);
p = path;
if (path == NULL) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
log_debug("PATH=%s", path); log_debug("PATH=%s", path);
do { p = strv_split(path, ":");
STRV_FOREACH(q, p) {
struct stat sb; struct stat sb;
int r;
for (q = p; *q && *q != ':'; q++) ; r = asprintf(&newsrc, "%s/%s", *q, src);
if (r < 0) {
if (*q == '\0')
end = true;
else
*q = '\0';
ret = asprintf(&newsrc, "%s/%s", p, src);
if (ret < 0) {
log_error("Out of memory!"); log_error("Out of memory!");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
p = q + 1;
if (stat(newsrc, &sb) != 0) { if (stat(newsrc, &sb) != 0) {
log_debug("stat(%s) != 0", newsrc); log_debug("stat(%s) != 0", newsrc);
free(newsrc); free(newsrc);
@@ -833,30 +827,37 @@ static char *find_binary(const char *src)
continue; continue;
} }
end = true; strv_push(&ret, newsrc);
} while (!end); };
if (newsrc) if (ret) {
log_debug("find_binary(%s) == %s", src, newsrc); STRV_FOREACH(q, ret) {
log_debug("find_binary(%s) == %s", src, *q);
}
}
return newsrc; return ret;
} }
static int install_one(const char *src, const char *dst) static int install_one(const char *src, const char *dst)
{ {
int r = EXIT_SUCCESS; int r = EXIT_SUCCESS;
int ret; int ret = 0;
if (strchr(src, '/') == NULL) { if (strchr(src, '/') == NULL) {
char *newsrc = find_binary(src); char **q = NULL;
if (newsrc) { char **p = find_binary(src);
log_debug("dracut_install '%s' '%s'", newsrc, dst); if (p) {
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true); STRV_FOREACH(q, p) {
if (ret == 0) { char *newsrc = *q;
log_debug("dracut_install '%s' '%s' OK", newsrc, dst); log_debug("dracut_install '%s' '%s'", newsrc, dst);
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
if (ret == 0) {
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
}
} }
free(newsrc); strv_free(p);
} else { } else {
ret = -1; ret = -1;
} }
@@ -877,17 +878,22 @@ static int install_all(int argc, char **argv)
int r = EXIT_SUCCESS; int r = EXIT_SUCCESS;
int i; int i;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
int ret; int ret = 0;
log_debug("Handle '%s'", argv[i]); log_debug("Handle '%s'", argv[i]);
if (strchr(argv[i], '/') == NULL) { if (strchr(argv[i], '/') == NULL) {
_cleanup_free_ char *newsrc = find_binary(argv[i]); char **q = NULL;
if (newsrc) { char **p = find_binary(argv[i]);
log_debug("dracut_install '%s'", newsrc); if (p) {
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true); STRV_FOREACH(q, p) {
if (ret == 0) { char *newsrc = *q;
log_debug("dracut_install '%s' OK", newsrc); log_debug("dracut_install '%s'", newsrc);
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
if (ret == 0) {
log_debug("dracut_install '%s' OK", newsrc);
}
} }
strv_free(p);
} else { } else {
ret = -1; ret = -1;
} }

587
install/strv.c Normal file
View File

@@ -0,0 +1,587 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include "util.h"
#include "strv.h"
char *strv_find(char **l, const char *name) {
char **i;
assert(name);
STRV_FOREACH(i, l)
if (streq(*i, name))
return *i;
return NULL;
}
char *strv_find_prefix(char **l, const char *name) {
char **i;
assert(name);
STRV_FOREACH(i, l)
if (startswith(*i, name))
return *i;
return NULL;
}
void strv_free(char **l) {
char **k;
if (!l)
return;
for (k = l; *k; k++)
free(*k);
free(l);
}
char **strv_copy(char * const *l) {
char **r, **k;
k = r = new(char*, strv_length(l) + 1);
if (!r)
return NULL;
if (l)
for (; *l; k++, l++) {
*k = strdup(*l);
if (!*k) {
strv_free(r);
return NULL;
}
}
*k = NULL;
return r;
}
unsigned strv_length(char * const *l) {
unsigned n = 0;
if (!l)
return 0;
for (; *l; l++)
n++;
return n;
}
char **strv_new_ap(const char *x, va_list ap) {
const char *s;
char **a;
unsigned n = 0, i = 0;
va_list aq;
/* As a special trick we ignore all listed strings that equal
* (const char*) -1. This is supposed to be used with the
* STRV_IFNOTNULL() macro to include possibly NULL strings in
* the string list. */
if (x) {
n = x == (const char*) -1 ? 0 : 1;
va_copy(aq, ap);
while ((s = va_arg(aq, const char*))) {
if (s == (const char*) -1)
continue;
n++;
}
va_end(aq);
}
a = new(char*, n+1);
if (!a)
return NULL;
if (x) {
if (x != (const char*) -1) {
a[i] = strdup(x);
if (!a[i])
goto fail;
i++;
}
while ((s = va_arg(ap, const char*))) {
if (s == (const char*) -1)
continue;
a[i] = strdup(s);
if (!a[i])
goto fail;
i++;
}
}
a[i] = NULL;
return a;
fail:
strv_free(a);
return NULL;
}
char **strv_new(const char *x, ...) {
char **r;
va_list ap;
va_start(ap, x);
r = strv_new_ap(x, ap);
va_end(ap);
return r;
}
char **strv_merge(char **a, char **b) {
char **r, **k;
if (!a)
return strv_copy(b);
if (!b)
return strv_copy(a);
r = new(char*, strv_length(a) + strv_length(b) + 1);
if (!r)
return NULL;
for (k = r; *a; k++, a++) {
*k = strdup(*a);
if (!*k)
goto fail;
}
for (; *b; k++, b++) {
*k = strdup(*b);
if (!*k)
goto fail;
}
*k = NULL;
return r;
fail:
strv_free(r);
return NULL;
}
char **strv_merge_concat(char **a, char **b, const char *suffix) {
char **r, **k;
/* Like strv_merge(), but appends suffix to all strings in b, before adding */
if (!b)
return strv_copy(a);
r = new(char*, strv_length(a) + strv_length(b) + 1);
if (!r)
return NULL;
k = r;
if (a)
for (; *a; k++, a++) {
*k = strdup(*a);
if (!*k)
goto fail;
}
for (; *b; k++, b++) {
*k = strappend(*b, suffix);
if (!*k)
goto fail;
}
*k = NULL;
return r;
fail:
strv_free(r);
return NULL;
}
char **strv_split(const char *s, const char *separator) {
char *state;
char *w;
size_t l;
unsigned n, i;
char **r;
assert(s);
n = 0;
FOREACH_WORD_SEPARATOR(w, l, s, separator, state)
n++;
r = new(char*, n+1);
if (!r)
return NULL;
i = 0;
FOREACH_WORD_SEPARATOR(w, l, s, separator, state) {
r[i] = strndup(w, l);
if (!r[i]) {
strv_free(r);
return NULL;
}
i++;
}
r[i] = NULL;
return r;
}
char **strv_split_quoted(const char *s) {
char *state;
char *w;
size_t l;
unsigned n, i;
char **r;
assert(s);
n = 0;
FOREACH_WORD_QUOTED(w, l, s, state)
n++;
r = new(char*, n+1);
if (!r)
return NULL;
i = 0;
FOREACH_WORD_QUOTED(w, l, s, state) {
r[i] = cunescape_length(w, l);
if (!r[i]) {
strv_free(r);
return NULL;
}
i++;
}
r[i] = NULL;
return r;
}
char **strv_split_newlines(const char *s) {
char **l;
unsigned n;
assert(s);
/* Special version of strv_split() that splits on newlines and
* suppresses an empty string at the end */
l = strv_split(s, NEWLINE);
if (!l)
return NULL;
n = strv_length(l);
if (n <= 0)
return l;
if (isempty(l[n-1])) {
free(l[n-1]);
l[n-1] = NULL;
}
return l;
}
char *strv_join(char **l, const char *separator) {
char *r, *e;
char **s;
size_t n, k;
if (!separator)
separator = " ";
k = strlen(separator);
n = 0;
STRV_FOREACH(s, l) {
if (n != 0)
n += k;
n += strlen(*s);
}
r = new(char, n+1);
if (!r)
return NULL;
e = r;
STRV_FOREACH(s, l) {
if (e != r)
e = stpcpy(e, separator);
e = stpcpy(e, *s);
}
*e = 0;
return r;
}
char **strv_append(char **l, const char *s) {
char **r, **k;
if (!l)
return strv_new(s, NULL);
if (!s)
return strv_copy(l);
r = new(char*, strv_length(l)+2);
if (!r)
return NULL;
for (k = r; *l; k++, l++) {
*k = strdup(*l);
if (!*k)
goto fail;
}
k[0] = strdup(s);
if (!k[0])
goto fail;
k[1] = NULL;
return r;
fail:
strv_free(r);
return NULL;
}
int strv_push(char ***l, char *value) {
char **c;
unsigned n;
if (!value)
return 0;
n = strv_length(*l);
c = realloc(*l, sizeof(char*) * (n + 2));
if (!c)
return -ENOMEM;
c[n] = value;
c[n+1] = NULL;
*l = c;
return 0;
}
int strv_extend(char ***l, const char *value) {
char *v;
int r;
if (!value)
return 0;
v = strdup(value);
if (!v)
return -ENOMEM;
r = strv_push(l, v);
if (r < 0)
free(v);
return r;
}
char **strv_uniq(char **l) {
char **i;
/* Drops duplicate entries. The first identical string will be
* kept, the others dropped */
STRV_FOREACH(i, l)
strv_remove(i+1, *i);
return l;
}
char **strv_remove(char **l, const char *s) {
char **f, **t;
if (!l)
return NULL;
assert(s);
/* Drops every occurrence of s in the string list, edits
* in-place. */
for (f = t = l; *f; f++) {
if (streq(*f, s)) {
free(*f);
continue;
}
*(t++) = *f;
}
*t = NULL;
return l;
}
char **strv_remove_prefix(char **l, const char *s) {
char **f, **t;
if (!l)
return NULL;
assert(s);
/* Drops every occurrence of a string prefixed with s in the
* string list, edits in-place. */
for (f = t = l; *f; f++) {
if (startswith(*f, s)) {
free(*f);
continue;
}
*(t++) = *f;
}
*t = NULL;
return l;
}
char **strv_parse_nulstr(const char *s, size_t l) {
const char *p;
unsigned c = 0, i = 0;
char **v;
assert(s || l <= 0);
if (l <= 0)
return new0(char*, 1);
for (p = s; p < s + l; p++)
if (*p == 0)
c++;
if (s[l-1] != 0)
c++;
v = new0(char*, c+1);
if (!v)
return NULL;
p = s;
while (p < s + l) {
const char *e;
e = memchr(p, 0, s + l - p);
v[i] = strndup(p, e ? e - p : s + l - p);
if (!v[i]) {
strv_free(v);
return NULL;
}
i++;
if (!e)
break;
p = e + 1;
}
assert(i == c);
return v;
}
char **strv_split_nulstr(const char *s) {
const char *i;
char **r = NULL;
NULSTR_FOREACH(i, s)
if (strv_extend(&r, i) < 0) {
strv_free(r);
return NULL;
}
if (!r)
return strv_new(NULL, NULL);
return r;
}
bool strv_overlap(char **a, char **b) {
char **i, **j;
STRV_FOREACH(i, a) {
STRV_FOREACH(j, b) {
if (streq(*i, *j))
return true;
}
}
return false;
}
static int str_compare(const void *_a, const void *_b) {
const char **a = (const char**) _a, **b = (const char**) _b;
return strcmp(*a, *b);
}
char **strv_sort(char **l) {
if (strv_isempty(l))
return l;
qsort(l, strv_length(l), sizeof(char*), str_compare);
return l;
}
void strv_print(char **l) {
char **s;
if (!l)
return;
STRV_FOREACH(s, l)
puts(*s);
}

118
install/strv.h Normal file
View File

@@ -0,0 +1,118 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdarg.h>
#include <stdbool.h>
#include "util.h"
char *strv_find(char **l, const char *name) _pure_;
char *strv_find_prefix(char **l, const char *name) _pure_;
void strv_free(char **l);
DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free);
#define _cleanup_strv_free_ _cleanup_(strv_freep)
char **strv_copy(char * const *l);
unsigned strv_length(char * const *l) _pure_;
char **strv_merge(char **a, char **b);
char **strv_merge_concat(char **a, char **b, const char *suffix);
char **strv_append(char **l, const char *s);
int strv_extend(char ***l, const char *value);
int strv_push(char ***l, char *value);
char **strv_remove(char **l, const char *s);
char **strv_remove_prefix(char **l, const char *s);
char **strv_uniq(char **l);
#define strv_contains(l, s) (!!strv_find((l), (s)))
char **strv_new(const char *x, ...) _sentinel_;
char **strv_new_ap(const char *x, va_list ap);
static inline const char* STRV_IFNOTNULL(const char *x) {
return x ? x : (const char *) -1;
}
static inline bool strv_isempty(char * const *l) {
return !l || !*l;
}
char **strv_split(const char *s, const char *separator);
char **strv_split_quoted(const char *s);
char **strv_split_newlines(const char *s);
char *strv_join(char **l, const char *separator);
char **strv_parse_nulstr(const char *s, size_t l);
char **strv_split_nulstr(const char *s);
bool strv_overlap(char **a, char **b) _pure_;
#define STRV_FOREACH(s, l) \
for ((s) = (l); (s) && *(s); (s)++)
#define STRV_FOREACH_BACKWARDS(s, l) \
STRV_FOREACH(s, l) \
; \
for ((s)--; (l) && ((s) >= (l)); (s)--)
#define STRV_FOREACH_PAIR(x, y, l) \
for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
char **strv_sort(char **l);
void strv_print(char **l);
#define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL }))
#define STRV_MAKE_EMPTY ((char*[1]) { NULL })
#define strv_from_stdarg_alloca(first) \
({ \
char **_l; \
\
if (!first) \
_l = (char**) &first; \
else { \
unsigned _n; \
va_list _ap; \
\
_n = 1; \
va_start(_ap, first); \
while (va_arg(_ap, char*)) \
_n++; \
va_end(_ap); \
\
_l = newa(char*, _n+1); \
_l[_n = 0] = (char*) first; \
va_start(_ap, first); \
for (;;) { \
_l[++_n] = va_arg(_ap, char*); \
if (!_l[_n]) \
break; \
} \
va_end(_ap); \
} \
_l; \
})

View File

@@ -277,3 +277,238 @@ char *strjoin(const char *x, ...) {
return r; return r;
} }
char *cunescape_length_with_prefix(const char *s, size_t length, const char *prefix) {
char *r, *t;
const char *f;
size_t pl;
assert(s);
/* Undoes C style string escaping, and optionally prefixes it. */
pl = prefix ? strlen(prefix) : 0;
r = new(char, pl+length+1);
if (!r)
return r;
if (prefix)
memcpy(r, prefix, pl);
for (f = s, t = r + pl; f < s + length; f++) {
if (*f != '\\') {
*(t++) = *f;
continue;
}
f++;
switch (*f) {
case 'a':
*(t++) = '\a';
break;
case 'b':
*(t++) = '\b';
break;
case 'f':
*(t++) = '\f';
break;
case 'n':
*(t++) = '\n';
break;
case 'r':
*(t++) = '\r';
break;
case 't':
*(t++) = '\t';
break;
case 'v':
*(t++) = '\v';
break;
case '\\':
*(t++) = '\\';
break;
case '"':
*(t++) = '"';
break;
case '\'':
*(t++) = '\'';
break;
case 's':
/* This is an extension of the XDG syntax files */
*(t++) = ' ';
break;
case 'x': {
/* hexadecimal encoding */
int a, b;
a = unhexchar(f[1]);
b = unhexchar(f[2]);
if (a < 0 || b < 0) {
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = 'x';
} else {
*(t++) = (char) ((a << 4) | b);
f += 2;
}
break;
}
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7': {
/* octal encoding */
int a, b, c;
a = unoctchar(f[0]);
b = unoctchar(f[1]);
c = unoctchar(f[2]);
if (a < 0 || b < 0 || c < 0) {
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = f[0];
} else {
*(t++) = (char) ((a << 6) | (b << 3) | c);
f += 2;
}
break;
}
case 0:
/* premature end of string.*/
*(t++) = '\\';
goto finish;
default:
/* Invalid escape code, let's take it literal then */
*(t++) = '\\';
*(t++) = *f;
break;
}
}
finish:
*t = 0;
return r;
}
char *cunescape_length(const char *s, size_t length) {
return cunescape_length_with_prefix(s, length, NULL);
}
/* Split a string into words, but consider strings enclosed in '' and
* "" as words even if they include spaces. */
char *split_quoted(const char *c, size_t *l, char **state) {
const char *current, *e;
bool escaped = false;
assert(c);
assert(l);
assert(state);
current = *state ? *state : c;
current += strspn(current, WHITESPACE);
if (*current == 0)
return NULL;
else if (*current == '\'') {
current ++;
for (e = current; *e; e++) {
if (escaped)
escaped = false;
else if (*e == '\\')
escaped = true;
else if (*e == '\'')
break;
}
*l = e-current;
*state = (char*) (*e == 0 ? e : e+1);
} else if (*current == '\"') {
current ++;
for (e = current; *e; e++) {
if (escaped)
escaped = false;
else if (*e == '\\')
escaped = true;
else if (*e == '\"')
break;
}
*l = e-current;
*state = (char*) (*e == 0 ? e : e+1);
} else {
for (e = current; *e; e++) {
if (escaped)
escaped = false;
else if (*e == '\\')
escaped = true;
else if (strchr(WHITESPACE, *e))
break;
}
*l = e-current;
*state = (char*) e;
}
return (char*) current;
}
/* Split a string into words. */
char *split(const char *c, size_t *l, const char *separator, char **state) {
char *current;
current = *state ? *state : (char*) c;
if (!*current || *c == 0)
return NULL;
current += strspn(current, separator);
*l = strcspn(current, separator);
*state = current+*l;
return (char*) current;
}
int unhexchar(char c) {
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
return -1;
}
int unoctchar(char c) {
if (c >= '0' && c <= '7')
return c - '0';
return -1;
}

View File

@@ -134,8 +134,16 @@ static inline bool isempty(const char *p) {
return !p || !p[0]; return !p || !p[0];
} }
static inline const char *startswith(const char *s, const char *prefix) {
if (strncmp(s, prefix, strlen(prefix)) == 0)
return s + strlen(prefix);
return NULL;
}
bool endswith(const char *s, const char *postfix); bool endswith(const char *s, const char *postfix);
bool startswith(const char *s, const char *prefix);
bool startswith_no_case(const char *s, const char *prefix); bool startswith_no_case(const char *s, const char *prefix);
bool first_word(const char *s, const char *word); bool first_word(const char *s, const char *word);
@@ -562,4 +570,16 @@ void warn_melody(void);
char *strjoin(const char *x, ...) _sentinel_; char *strjoin(const char *x, ...) _sentinel_;
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
static inline void func##p(type *p) { \
if (*p) \
func(*p); \
} \
struct __useless_struct_to_allow_trailing_semicolon__
char *split_quoted(const char *c, size_t *l, char **state);
char *cunescape_length(const char *s, size_t length);
int unhexchar(char c) _const_;
int unoctchar(char c) _const_;
#endif #endif

View File

@@ -1,4 +1,4 @@
#!/bin/bash #
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# #

View File

@@ -33,6 +33,9 @@ usage()
} >&2 } >&2
} }
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
sorted=0 sorted=0
declare -A filenames declare -A filenames
@@ -103,50 +106,108 @@ if ! [[ -f "$image" ]]; then
exit 1 exit 1
fi fi
read -N 6 bin < "$image" extract_files()
case $bin in {
$'\x1f\x8b'*)
CAT="zcat";;
BZh*)
CAT="bzcat";;
$'\x71\xc7'*|070701)
CAT="cat";;
*)
CAT="xzcat";
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
CAT="xzcat --single-stream"
fi
;;
esac
ret=0
if (( ${#filenames[@]} > 0 )); then
(( ${#filenames[@]} == 1 )) && nofileinfo=1 (( ${#filenames[@]} == 1 )) && nofileinfo=1
for f in ${!filenames[@]}; do for f in ${!filenames[@]}; do
[[ $nofileinfo ]] || echo "initramfs:/$f" [[ $nofileinfo ]] || echo "initramfs:/$f"
[[ $nofileinfo ]] || echo "========================================================================" [[ $nofileinfo ]] || echo "========================================================================"
$CAT -- $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null $CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
((ret+=$?)) ((ret+=$?))
[[ $nofileinfo ]] || echo "========================================================================" [[ $nofileinfo ]] || echo "========================================================================"
[[ $nofileinfo ]] || echo [[ $nofileinfo ]] || echo
done done
else }
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
echo "========================================================================" list_files()
version=$($CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/dracut-*' 2>/dev/null) {
((ret+=$?))
echo "$version with dracut modules:"
$CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- '*lib/dracut/modules.txt' 2>/dev/null
((ret+=$?))
echo "========================================================================" echo "========================================================================"
if [ "$sorted" -eq 1 ]; then if [ "$sorted" -eq 1 ]; then
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -n -k5 $CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
else else
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -k9 $CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
fi fi
((ret+=$?)) ((ret+=$?))
echo "========================================================================" echo "========================================================================"
}
if (( ${#filenames[@]} <= 0 )); then
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
echo "========================================================================"
fi
read -N 6 bin < "$image"
case $bin in
$'\x71\xc7'*|070701)
CAT="cat --"
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
if [[ "$is_early" ]]; then
if (( ${#filenames[@]} > 0 )); then
extract_files
else
echo "Early CPIO image"
list_files
fi
SKIP="$dracutbasedir/skipcpio"
if ! [[ -x $SKIP ]]; then
echo
echo "'$SKIP' not found, cannot display remaining contents!" >&2
echo
exit 0
fi
fi
;;
esac
if [[ $SKIP ]]; then
read -N 6 bin < <($SKIP "$image")
fi
case $bin in
$'\x1f\x8b'*)
CAT="zcat --";;
BZh*)
CAT="bzcat --";;
$'\x71\xc7'*|070701)
CAT="cat --"
;;
$'\x02\x21'*)
CAT="lz4 -d -c";;
*)
CAT="xzcat --";
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
CAT="xzcat --single-stream --"
fi
;;
esac
skipcpio()
{
$SKIP "$@" | $ORIG_CAT
}
if [[ $SKIP ]]; then
ORIG_CAT="$CAT"
CAT=skipcpio
fi
ret=0
if (( ${#filenames[@]} > 0 )); then
extract_files
else
version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/dracut-*' 'usr/lib/dracut/dracut-*' 2>/dev/null)
((ret+=$?))
echo "Version: $version"
echo
echo -n "Arguments: "
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/build-parameter.txt' 'usr/lib/dracut/build-parameter.txt' 2>/dev/null
echo
echo "dracut modules:"
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- 'lib/dracut/modules.txt' 'usr/lib/dracut/modules.txt' 2>/dev/null
((ret+=$?))
list_files
fi fi
exit $ret exit $ret

175
mkinitrd-dracut.sh Normal file → Executable file
View File

@@ -1,6 +1,11 @@
#!/bin/bash --norc #!/bin/bash --norc
kver=$(uname -r) kver=$(uname -r)
boot_dir="/boot"
quiet=0
host_only=0
force=0
error() { echo "$@" >&2; } error() { echo "$@" >&2; }
usage () { usage () {
@@ -24,36 +29,105 @@ read_arg() {
# $1 = arg name # $1 = arg name
# $2 = arg value # $2 = arg value
# $3 = arg parameter # $3 = arg parameter
local rematch='^[^=]*=(.*)$' param="$1"
local rematch='^[^=]*=(.*)$' result
if [[ $2 =~ $rematch ]]; then if [[ $2 =~ $rematch ]]; then
read "$1" <<< "${BASH_REMATCH[1]}" read "$param" <<< "${BASH_REMATCH[1]}"
elif [[ $3 != -* ]]; then else
# Only read next arg if it not an arg itself. for ((i=3; $i <= $#; i++)); do
read "$1" <<< "$3" # Only read next arg if it not an arg itself.
# There is no way to shift our callers args, so if [[ ${@:$i:1} = -* ]];then
# return 1 to indicate they should do it instead. break
return 1 fi
result="$result ${@:$i:1}"
# There is no way to shift our callers args, so
# return "no of args" to indicate they should do it instead.
done
read "$1" <<< "$result"
return $(($i - 3))
fi fi
} }
# Taken over from SUSE mkinitrd
default_kernel_images() {
local regex kernel_image kernel_version version_version initrd_image
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
case "$(uname -m)" in
s390|s390x)
regex='image'
;;
ppc|ppc64)
regex='vmlinux'
;;
i386|x86_64)
regex='vmlinuz'
;;
arm*)
regex='[uz]Image'
;;
aarch64)
regex='Image'
;;
*) regex='vmlinu.'
;;
esac
# user mode linux
if grep -q UML /proc/cpuinfo; then
regex='linux'
fi
kernel_images=""
initrd_images=""
for kernel_image in $(ls $boot_dir \
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
| grep -v kdump$ ) ; do
# Note that we cannot check the RPM database here -- this
# script is itself called from within the binary kernel
# packages, and rpm does not allow recursive calls.
[ -L "$boot_dir/$kernel_image" ] && continue
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
kernel_version=$(/usr/bin/get_kernel_version \
$boot_dir/$kernel_image 2> /dev/null)
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
if [ "$kernel_image" != "$initrd_image" -a \
-n "$kernel_version" -a \
-d "/lib/modules/$kernel_version" ]; then
kernel_images="$kernel_images $boot_dir/$kernel_image"
initrd_images="$initrd_images $boot_dir/$initrd_image"
fi
done
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
for initrd_image in $initrd_images;do
targets="$targets $initrd_image"
done
host_only=1
force=1
}
while (($# > 0)); do while (($# > 0)); do
case ${1%%=*} in case ${1%%=*} in
--with-usb) read_arg usbmodule "$@" || shift --with-usb) read_arg usbmodule "$@" || shift $?
basicmodules="$basicmodules ${usbmodule:-usb-storage}" basicmodules="$basicmodules ${usbmodule:-usb-storage}"
unset usbmodule;; unset usbmodule;;
--with-avail) read_arg modname "$@" || shift --with-avail) read_arg modname "$@" || shift $?
basicmodules="$basicmodules $modname";; basicmodules="$basicmodules $modname";;
--with) read_arg modname "$@" || shift --with) read_arg modname "$@" || shift $?
basicmodules="$basicmodules $modname";; basicmodules="$basicmodules $modname";;
--version) --version)
echo "mkinitrd: dracut compatibility wrapper" echo "mkinitrd: dracut compatibility wrapper"
exit 0;; exit 0;;
-v|--verbose) dracut_args="${dracut_args} -v";; -v|--verbose) dracut_args="${dracut_args} -v";;
-f|--force) dracut_args="${dracut_args} -f";; -f|--force) force=1;;
--preload) read_arg modname "$@" || shift --preload) read_arg modname "$@" || shift $?
basicmodules="$basicmodules $modname";; basicmodules="$basicmodules $modname";;
--image-version) img_vers=yes;; --image-version) img_vers=yes;;
--rootfs) read_arg rootfs "$@" || shift --rootfs|-d) read_arg rootfs "$@" || shift $?
dracut_args="${dracut_args} --filesystems $rootfs";; dracut_args="${dracut_args} --filesystems $rootfs";;
--nocompress) dracut_args="$dracut_args --no-compress";; --nocompress) dracut_args="$dracut_args --no-compress";;
--help) usage -n;; --help) usage -n;;
@@ -80,10 +154,31 @@ while (($# > 0)); do
--looppath*) ;; --looppath*) ;;
--dsdt*) ;; --dsdt*) ;;
--bootchart) ;; --bootchart) ;;
*) if [[ ! $target ]]; then -s) ;;
target=$1 --quiet|-q) quiet=1;;
elif [[ ! $kernel ]]; then -b) read_arg boot_dir "$@" || shift $?
kernel=$1 if [ ! -d $boot_dir ];then
error "Boot directory $boot_dir does not exist"
exit 1
fi
;;
-k) # Would be nice to get a list of images here
read_arg kernel_images "$@" || shift $?
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
host_only=1
force=1
;;
-i) read_arg initrd_images "$@" || shift $?
for initrd_image in $initrd_images;do
targets="$targets $boot_dir/$initrd_image"
done
;;
*) if [[ ! $targets ]]; then
targets=$1
elif [[ ! $kernels ]]; then
kernels=$1
else else
usage usage
fi;; fi;;
@@ -91,11 +186,41 @@ while (($# > 0)); do
shift shift
done done
[[ $target && $kernel ]] || usage [[ $targets && $kernels ]] || default_kernel_images
[[ $img_vers ]] && target="$target-$kernel" [[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
if [[ $basicmodules ]]; then # We can have several targets/kernels, transform the list to an array
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel" targets=( $targets )
else [[ $kernels ]] && kernels=( $kernels )
dracut $dracut_args "$target" "$kernel"
fi [[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
echo "Creating: target|kernel|dracut args|basicmodules "
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
target="${targets[$i]}-${kernels[$i]}"
else
target="${targets[$i]}"
fi
kernel="${kernels[$i]}"
# Duplicate code: No way found how to redirect output based on $quiet
if [[ $quiet == 1 ]];then
echo "$target|$kernel|$dracut_args|$basicmodules"
if [[ $basicmodules ]]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
"$kernel" &>/dev/null
else
dracut $dracut_args "$target" "$kernel" &>/dev/null
fi
else
if [[ $basicmodules ]]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" \
"$kernel"
else
dracut $dracut_args "$target" "$kernel"
fi
fi
done

106
mkinitrd-suse.8.asc Normal file
View File

@@ -0,0 +1,106 @@
MKINITRD(8)
===========
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
mkinitrd-suse - is a compat wrapper, which calls dracut to generate an initramfs
SYNOPSIS
--------
*mkinitrd* ['OPTION...']
DESCRIPTION
-----------
*mkinitrd* creates an initramfs image <initrd-image> for the kernel with
version <kernel-version> by calling *dracut*.
[IMPORTANT]
This version of mkinitrd is provided for compability with older
versions of mkinitrd. If a more fine grained control over the
resulting image is needed, *dracut* should be called directly.
OPTIONS
-------
**-R, --version**::
print info about the version
**-k** _<kernel_list>_::
List of kernel images for which initrd files are created (relative
to _boot_dir_), defaults to _vmlinux_ on ppc/ppc64, _image_ on s390/s390x
and _vmlinuz_ for everything else.
**-i** _<initrd_list>_::
List of file names (relative to _boot_dir_) for the initrd; positions
have to match the _kernel_list_. Defaults to _initrd_.
**-m** _<module_list>_::
Modules to include in initrd, defaults to _INITRD_MODULES_ variable
in */etc/sysconfig/kernel*.
**-f** _<feature_list>_::
Features to be enabled for the initrd. In general mkinitrd
configures the initrd for the root device it is started from. With
this option additional feature can be enabled.
**-b** _<bootdir>_::
Boot directory, defaults to */boot*, where the initrd is created.
**-d** _<root_device>_::
Root device, defaults to the device from which the root_dir is
mounted; overwrites the rootdev enviroment variable if set
**-s** _<size>_::
Add splash animation and bootscreen to initrd.
**-D** _<interface>::
Run dhcp on the specified interface (for example "eth0").
**-I** _<interface>::
Configure the specified interface statically.
**-a** _<acpi_dsdt>::
Attach compiled ACPI DSDT (Differentiated System Description Table)
to initrd. This replaces the DSDT of the BIOS. Defaults to the
_ACPI_DSDT_ variable in */etc/sysconfig/kernel*.
**-M** _<map>::
System.map file to use.
**-B**::
Dont run the *update-bootloader(8)* script after the initrd(s) have
been created. This is useful if you call mkinitrd(8) for anything
else than the running system.
**-A**::
Create a so called "monster initrd" which includes all available
features and modules.
**-v, --verbose**::
increase verbosity level
**-L**::
Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for
testing if you dont want to clutter the system log.
**--force**::
overwrite existing initramfs file.
**--help**::
print a help message and exit.
AVAILABILITY
------------
The mkinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
AUTHORS
-------
Harald Hoyer, Hannes Reinecke
SEE ALSO
--------
*dracut*(8)
*update-bootloader*(8)

354
mkinitrd-suse.sh Executable file
View File

@@ -0,0 +1,354 @@
#!/bin/bash --norc
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# mkinitrd compability wrapper for SUSE.
#
# Copyright (c) 2013 SUSE Linux Products GmbH. 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/>.
#
boot_dir="/boot"
quiet=0
host_only=1
force=0
logfile=/var/log/YaST2/mkinitrd.log
dracut_cmd=dracut
error() { echo "$@" >&2; }
usage () {
[[ $1 = '-n' ]] && cmd=echo || cmd=error
$cmd "usage: ${0##*/} [options]"
$cmd ""
$cmd " Create initial ramdisk images that contain all kernel modules needed"
$cmd " in the early boot process, before the root file system becomes"
$cmd " available."
$cmd " This usually includes SCSI and/or RAID modules, a file system module"
$cmd " for the root file system, or a network interface driver module for dhcp."
$cmd ""
$cmd " options:"
$cmd " -f \"feature list\" Features to be enabled when generating initrd."
$cmd " Available features are:"
$cmd " iscsi, md, multipath, lvm, lvm2,"
$cmd " ifup, fcoe, dcbd"
$cmd " -k \"kernel list\" List of kernel images for which initrd files are"
$cmd " created. Defaults to all kernels found in /boot."
$cmd " -i \"initrd list\" List of file names for the initrd; position have"
$cmd " match to \"kernel list\". Defaults to all kernels"
$cmd " found in /boot."
$cmd " -b boot_dir Boot directory. Defaults to /boot."
$cmd " -t tmp_dir Temporary directory. Defaults to /var/tmp."
$cmd " -M map System.map file to use."
$cmd " -A Create a so called \"monster initrd\" which"
$cmd " includes all features and modules possible."
$cmd " -B Do not update bootloader configuration."
$cmd " -v Verbose mode."
$cmd " -L Disable logging."
$cmd " -h This help screen."
$cmd " -m \"module list\" Modules to include in initrd. Defaults to the"
$cmd " INITRD_MODULES variable in /etc/sysconfig/kernel"
$cmd " -u \"DomU module list\" Modules to include in initrd. Defaults to the"
$cmd " DOMU_INITRD_MODULES variable in"
$cmd " /etc/sysconfig/kernel."
$cmd " -d root_device Root device. Defaults to the device from"
$cmd " which / is mounted. Overrides the rootdev"
$cmd " enviroment variable if set."
$cmd " -j device Journal device"
$cmd " -D interface Run dhcp on the specified interface."
$cmd " -I interface Configure the specified interface statically."
$cmd " -a acpi_dsdt Attach compiled ACPI DSDT (Differentiated"
$cmd " System Description Table) to initrd. This"
$cmd " replaces the DSDT of the BIOS. Defaults to"
$cmd " the ACPI_DSDT variable in /etc/sysconfig/kernel."
$cmd " -s size Add splash animation and bootscreen to initrd."
[[ $1 = '-n' ]] && exit 0
exit 1
}
# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
param="$1"
local rematch='^[^=]*=(.*)$' result
if [[ $2 =~ $rematch ]]; then
read "$param" <<< "${BASH_REMATCH[1]}"
else
for ((i=3; $i <= $#; i++)); do
# Only read next arg if it not an arg itself.
if [[ ${@:$i:1} = -* ]];then
break
fi
result="$result ${@:$i:1}"
# There is no way to shift our callers args, so
# return "no of args" to indicate they should do it instead.
done
read "$1" <<< "$result"
return $(($i - 3))
fi
}
# Helper functions to calculate ipconfig command line
calc_netmask() {
local prefix=$1
[ -z "$prefix" ] && return
mask=$(echo "(2 ^ 32) - (2 ^ $prefix)" | bc -l)
byte1=$(( mask >> 24 ))
byte2=$(( mask >> 16 ))
byte3=$(( mask >> 8 ))
byte4=$(( mask & 0xff ))
netmask=$(printf "%d.%d.%d.%d" $(( byte1 & 0xff )) $(( byte2 & 0xff )) $(( byte3 & 0xff )) $byte4);
echo $netmask
}
ipconfig() {
local interface=$1
local iplink macaddr broadcast gateway ipaddr prefix netmask
iplink=$(ip addr show dev $interface | sed -n 's/ *inet \(.*\) brd.*/\1/p')
macaddr=$(ip addr show dev $interface | sed -n 's/.*ether \(.*\) brd.*/\1/p')
broadcast=$(ip addr show dev $interface | sed -n 's/.*brd \(.*\) scope.*/\1/p')
gateway=$(ip route show dev $interface | sed -n 's/default via \([0-9\.]*\).*/\1/p')
ipaddr=${iplink%%/*}
prefix=${iplink##*/}
netmask=$(calc_netmask $prefix)
echo "${ipaddr}:${serveraddr}:${gateway}:${netmask}:${hostname}:${interface}:none::${macaddr}"
}
is_xen_kernel() {
local kversion=$1
local root_dir=$2
local cfg
for cfg in ${root_dir}/boot/config-$kversion $root_dir/lib/modules/$kversion/build/.config
do
test -r $cfg || continue
grep -q "^CONFIG_XEN=y\$" $cfg
return
done
test $kversion != "${kversion%-xen*}"
return
}
# Taken over from SUSE mkinitrd
default_kernel_images() {
local regex kernel_image kernel_version version_version initrd_image
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
case "$(uname -m)" in
s390|s390x)
regex='image'
;;
ppc|ppc64)
regex='vmlinux'
;;
i386|x86_64)
regex='vmlinuz'
;;
arm*)
regex='[uz]Image'
;;
aarch64)
regex='Image'
;;
*) regex='vmlinu.'
;;
esac
kernel_images=""
initrd_images=""
for kernel_image in $(ls $boot_dir \
| sed -ne "\|^$regex\(-[0-9.]\+-[0-9]\+-[a-z0-9]\+$\)\?|p" \
| grep -v kdump$ ) ; do
# Note that we cannot check the RPM database here -- this
# script is itself called from within the binary kernel
# packages, and rpm does not allow recursive calls.
[ -L "$boot_dir/$kernel_image" ] && continue
[ "${kernel_image%%.gz}" != "$kernel_image" ] && continue
kernel_version=$(/usr/bin/get_kernel_version \
$boot_dir/$kernel_image 2> /dev/null)
initrd_image=$(echo $kernel_image | sed -e "s|${regex}|initrd|")
if [ "$kernel_image" != "$initrd_image" -a \
-n "$kernel_version" -a \
-d "/lib/modules/$kernel_version" ]; then
kernel_images="$kernel_images $boot_dir/$kernel_image"
initrd_images="$initrd_images $boot_dir/$initrd_image"
fi
done
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
for initrd_image in $initrd_images;do
targets="$targets $initrd_image"
done
host_only=1
force=1
}
while (($# > 0)); do
case ${1%%=*} in
-f) read_arg feature_list "$@" || shift $?
# Could be several features
;;
-k) # Would be nice to get a list of images here
read_arg kernel_images "$@" || shift $?
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
host_only=1
force=1
;;
-i) read_arg initrd_images "$@" || shift $?
for initrd_image in $initrd_images;do
# Check if the initrd_image contains a path.
# if not, then add the default boot_dir
dname=`dirname $initrd_image`
if [ "$dname" == "." ]; then
targets="$targets $boot_dir/$initrd_image";
else
targets="$targets $initrd_image";
fi
done
;;
-b) read_arg boot_dir "$@" || shift $?
if [ ! -d $boot_dir ];then
error "Boot directory $boot_dir does not exist"
exit 1
fi
;;
-t) read_arg tmp_dir "$@" || shift $?
dracut_args="${dracut_args} --tmpdir $tmp_dir"
;;
-M) read_arg map_file "$@" || shift $?
;;
-A) host_only=0;;
-B) skip_update_bootloader=1;;
-v|--verbose) dracut_args="${dracut_args} -v";;
-L) logfile=;;
-h|--help) usage -n;;
-m) read_arg module_list "$@" || shift $? ;;
-u) read_arg domu_module_list "$@" || shift $?
echo "mkinitrd: DomU modules not yet supported" ;;
-d) read_arg rootfs "$@" || shift $?
dracut_args="${dracut_args} --filesystems $rootfs" ;;
-D) read_arg dhcp_if "$@" || shift $?
dracut_cmdline="${dracut_cmdline} ip=${dhcp_if}:dhcp"
;;
-I) read_arg static_if "$@" || shift $?
dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)":
;;
-a) read_arg acpi_dsdt "$@" || shift $?
echo "mkinitrd: custom DSDT not yet supported"
exit 1
;;
-s) read_arg boot_splash "$@" || shift $?
echo "mkinitrd: boot splash not yet supported"
exit 1
;;
-V) echo "mkinitrd: vendor scipts are no longer supported"
exit 1;;
--dracut)
read_arg dracut_cmd "$@" || shift $? ;;
--version|-R)
echo "mkinitrd: dracut compatibility wrapper"
exit 0;;
--force) force=1;;
--quiet|-q) quiet=1;;
*) if [[ ! $targets ]]; then
targets=$1
elif [[ ! $kernels ]]; then
kernels=$1
else
usage
fi;;
esac
shift
done
[[ $targets && $kernels ]] || default_kernel_images
[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
# We can have several targets/kernels, transform the list to an array
targets=( $targets )
[[ $kernels ]] && kernels=( $kernels )
[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile"
[[ $host_only == 1 ]] && dracut_args="${dracut_args} --hostonly"
[[ $force == 1 ]] && dracut_args="${dracut_args} --force"
[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}"
[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1
# Update defaults from /etc/sysconfig/kernel
if [ -f /etc/sysconfig/kernel ] ; then
. /etc/sysconfig/kernel
fi
[[ $module_list ]] || module_list="${INITRD_MODULES}"
basicmodules="$basicmodules ${module_list}"
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
[[ $acpi_dsdt ]] || acpi_dsdt="${ACPI_DSDT}"
echo "Creating: target|kernel|dracut args|basicmodules "
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
target="${targets[$i]}-${kernels[$i]}"
else
target="${targets[$i]}"
fi
kernel="${kernels[$i]}"
# Duplicate code: No way found how to redirect output based on $quiet
if [[ $quiet == 1 ]];then
echo "$target|$kernel|$dracut_args|$basicmodules"
if is_xen_kernel $kernel $rootfs ; then
basicmodules="$basicmodules ${domu_module_list}"
fi
if [[ $basicmodules ]]; then
$dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \
"$kernel" &>/dev/null
else
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
fi
else
if is_xen_kernel $kernel $rootfs ; then
basicmodules="$basicmodules ${domu_module_list}"
fi
if [[ $basicmodules ]]; then
$dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \
"$kernel"
else
$dracut_cmd $dracut_args "$target" "$kernel"
fi
fi
done
if [ "$skip_update_bootloader" ] ; then
echo 2>&1 "Did not refresh the bootloader. You might need to refresh it manually."
else
update-bootloader --refresh
fi

View File

@@ -41,8 +41,8 @@ OPTIONS
**--preload=<module>**:: **--preload=<module>**::
preload the kernel module <module> in the initramfs before any other kernel preload the kernel module <module> in the initramfs before any other kernel
modules are loaded. This can be used to ensure a certain device naming, which modules are loaded. This can be used to ensure a certain device naming,
should in theory be avoided and the use of symbolic links in /dev is which should in theory be avoided and the use of symbolic links in /dev is
encouraged. encouraged.
**--nocompress**:: **--nocompress**::

View File

@@ -2,14 +2,17 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
[ -x /bin/bash ] require_binaries /bin/bash
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
# If another shell is already installed, do not use bash # If another shell is already installed, do not use bash
[[ -x $initdir/bin/sh ]] && return [[ -x $initdir/bin/sh ]] && return

View File

@@ -2,16 +2,19 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
[[ "$mount_needs" ]] && return 1 [[ "$mount_needs" ]] && return 1
[ -x /sbin/bootchartd ] || return 1 require_binaries /sbin/bootchartd || return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
inst_symlink /init /sbin/init inst_symlink /init /sbin/init
inst_dir /lib/bootchart/tmpfs inst_dir /lib/bootchart/tmpfs

View File

@@ -2,14 +2,17 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
[ -x /bin/dash ] require_binaries /bin/dash
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
# If another shell is already installed, do not use dash # If another shell is already installed, do not use dash
[[ -x $initdir/bin/sh ]] && return [[ -x $initdir/bin/sh ]] && return

View File

@@ -2,16 +2,19 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
[[ "$mount_needs" ]] && return 1 [[ "$mount_needs" ]] && return 1
[ -x $systemdutildir/systemd-bootchart ] || return 1 require_binaries $systemdutildir/systemd-bootchart || return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
inst_symlink /init /sbin/init inst_symlink /init /sbin/init
inst_multiple $systemdutildir/systemd-bootchart inst_multiple $systemdutildir/systemd-bootchart

View File

@@ -60,8 +60,8 @@ do_rhevh_check()
KERNEL=$(uname -r) KERNEL=$(uname -r)
kpath=${1} kpath=${1}
# If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0 # If we're on RHEV-H, the kernel is in /run/initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(cat /boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done) HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1) HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch" warn "HMAC sum mismatch"
@@ -96,7 +96,6 @@ do_fips()
_found=0 _found=0
while read _k _s _v; do while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue [ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
[ "$_v" != "$_module" ] && continue [ "$_v" != "$_module" ] && continue
_found=1 _found=1
break break
@@ -112,10 +111,10 @@ do_fips()
rmmod tcrypt rmmod tcrypt
info "Checking integrity of kernel" info "Checking integrity of kernel"
if [ -e "$NEWROOT/dev/.initramfs/live/vmlinuz0" ]; then if [ -e "/run/initramfs/live/vmlinuz0" ]; then
do_rhevh_check "$NEWROOT/dev/.initramfs/live/vmlinuz0" || return 1 do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
elif [ -e "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" ]; then elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
do_rhevh_check "$NEWROOT/dev/.initramfs/live/isolinux/vmlinuz0" || return 1 do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
else else
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1 sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
fi fi

View File

@@ -2,18 +2,21 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
local _fipsmodules _mod local _fipsmodules _mod
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm " _fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
_fipsmodules+="chainiv crc32c cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod " _fipsmodules+="chainiv crc32c crct10dif_generic cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod "
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 " _fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic " _fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib" _fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
@@ -28,6 +31,7 @@ installkernel() {
done done
} }
# called by dracut
install() { install() {
local _dir local _dir
inst_hook pre-trigger 01 "$moddir/fips-boot.sh" inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
@@ -41,5 +45,6 @@ install() {
libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10 libssl.so 'hmaccalc/sha512hmac.hmac' libssl.so.10
inst_multiple -o prelink inst_multiple -o prelink
inst_simple /etc/system-fips
} }

View File

@@ -2,18 +2,25 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
type -P capsh >/dev/null 2>&1 require_binaries capsh
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
inst_hook pre-pivot 00 "$moddir/caps.sh" if ! dracut_module_included "systemd"; then
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh inst_hook pre-pivot 00 "$moddir/caps.sh"
# capsh wants bash and we need bash also inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
inst /bin/bash # capsh wants bash and we need bash also
inst /bin/bash
else
dwarning "caps: does not work with systemd in the initramfs"
fi
} }

View File

@@ -2,14 +2,17 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
local _fipsmodules _mod local _fipsmodules _mod
_fipsmodules="aesni-intel ghash_clmulni_intel" _fipsmodules="aesni-intel ghash_clmulni_intel"
@@ -24,6 +27,7 @@ installkernel() {
done done
} }
# called by dracut
install() { install() {
return 0 return 0
} }

0
modules.d/03modsign/load-modsign-keys.sh Normal file → Executable file
View File

5
modules.d/03modsign/module-setup.sh Normal file → Executable file
View File

@@ -7,8 +7,9 @@
# Copyright 2013 Red Hat, Inc. # Copyright 2013 Red Hat, Inc.
# Peter Jones <pjones@redhat.com> # Peter Jones <pjones@redhat.com>
# called by dracut
check() { check() {
[[ -x /usr/bin/keyctl ]] || return 1 require_binaries keyctl || return 1
# do not include module in hostonly mode, # do not include module in hostonly mode,
# if no keys are present # if no keys are present
@@ -20,10 +21,12 @@ check() {
return 0 return 0
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
inst_dir /lib/modules/keys inst_dir /lib/modules/keys
inst_binary /usr/bin/keyctl inst_binary /usr/bin/keyctl

View File

@@ -2,15 +2,18 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
# do not add this module by default # do not add this module by default
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
inst_multiple -o ps grep more cat rm strace free showmount \ inst_multiple -o ps grep more cat rm strace free showmount \
ping netstat rpcinfo vi scp ping6 ssh \ ping netstat rpcinfo vi scp ping6 ssh \

View File

@@ -2,14 +2,17 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
inst_hook cmdline 00 "$moddir/watchdog.sh" inst_hook cmdline 00 "$moddir/watchdog.sh"
inst_hook cmdline 50 "$moddir/watchdog.sh" inst_hook cmdline 50 "$moddir/watchdog.sh"

View File

@@ -2,16 +2,19 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
type -P busybox >/dev/null || return 1 require_binaries busybox || return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
local _i _progs _path _busybox local _i _progs _path _busybox
_busybox=$(type -P busybox) _busybox=$(type -P busybox)

View File

@@ -2,31 +2,28 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
[[ "$mount_needs" ]] && return 1 [[ "$mount_needs" ]] && return 1
for i in setfont loadkeys kbd_mode; do require_binaries setfont loadkeys kbd_mode || return 1
type -P "$i" >/dev/null || return 1
done
return 0 return 0
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
if dracut_module_included "systemd"; then if dracut_module_included "systemd"; then
[[ -f /etc/vconsole.conf ]] || return 0
unset FONT unset FONT
unset KEYMAP unset KEYMAP
. /etc/vconsole.conf [[ -f /etc/vconsole.conf ]] && . /etc/vconsole.conf
# if vconsole.conf has no settings, do not include anything
[[ $FONT ]] || [[ $KEYMAP ]] || return 0
fi fi
inst_multiple -o $systemdutildir/systemd-vconsole-setup
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}" DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
I18N_CONF="/etc/locale.conf" I18N_CONF="/etc/locale.conf"
@@ -158,6 +155,9 @@ install() {
# Gentoo user may have KEYMAP set to something like "-u pl2", # Gentoo user may have KEYMAP set to something like "-u pl2",
KEYMAP=${KEYMAP#-* } KEYMAP=${KEYMAP#-* }
# openSUSE user may have KEYMAP set to something like ".gz"
KEYMAP=${KEYMAP/.gz/}
# KEYTABLE is a bit special - it defines base keymap name and UNICODE # KEYTABLE is a bit special - it defines base keymap name and UNICODE
# determines whether non-UNICODE or UNICODE version is used # determines whether non-UNICODE or UNICODE version is used
@@ -207,10 +207,20 @@ install() {
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
fi fi
mksubdirs ${initdir}${I18N_CONF} if dracut_module_included "systemd" && [[ -f ${I18N_CONF} ]]; then
mksubdirs ${initdir}${VCONFIG_CONF} inst_simple ${I18N_CONF}
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF} else
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF} mksubdirs ${initdir}${I18N_CONF}
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
fi
if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then
inst_simple ${VCONFIG_CONF}
else
mksubdirs ${initdir}${VCONFIG_CONF}
print_vars KEYMAP EXT_KEYMAPS UNICODE FONT FONT_MAP FONT_UNIMAP >> ${initdir}${VCONFIG_CONF}
fi
return 0 return 0
} }
@@ -234,16 +244,13 @@ install() {
return 0 return 0
} }
if checks if checks; then
then
install_base install_base
if [[ ${hostonly} ]] if [[ ${hostonly} ]] && ! [[ ${i18n_install_all} ]]; then
then
install_local_i18n || install_all_kbd install_local_i18n || install_all_kbd
else else
install_all_kbd install_all_kbd
fi fi
fi fi
} }

View File

@@ -6,37 +6,30 @@ inst_key_val() {
local _value local _value
local _file local _file
local _default local _default
_default=$1 _file="$1"; shift
shift _key="$1"; shift
_file=$1 _default="$1"; shift
shift _value="$(getarg $@)"
_value=$(getarg $@)
[ -z "${_value}" ] && _value=$_default [ -z "${_value}" ] && _value=$_default
if [ -n "${_value}" ]; then if [ -n "${_value}" ]; then
printf '%s="%s"\n' $2 ${_value} >> $_file printf '%s="%s"\n' $key ${_value} >> $_file
fi fi
unset _file unset _file
unset _value unset _value
} }
inst_key_val '' /etc/vconsole.conf vconsole.keymap KEYMAP -d KEYTABLE inst_key_val /etc/vconsole.conf KEYMAP '' rd.vconsole.keymap KEYMAP -d KEYTABLE
inst_key_val '' /etc/vconsole.conf vconsole.font FONT -d SYSFONT inst_key_val /etc/vconsole.conf FONT '' rd.vconsole.font FONT -d SYSFONT
inst_key_val '' /etc/vconsole.conf vconsole.font.map FONT_MAP -d CONTRANS inst_key_val /etc/vconsole.conf FONT_MAP '' rd.vconsole.font.map FONT_MAP -d CONTRANS
inst_key_val '' /etc/vconsole.conf vconsole.font.unimap FONT_UNIMAP -d UNIMAP inst_key_val /etc/vconsole.conf FONT_UNIMAP '' rd.vconsole.font.unimap FONT_UNIMAP -d UNIMAP
inst_key_val 1 /etc/vconsole.conf vconsole.font.unicode UNICODE vconsole.unicode inst_key_val /etc/vconsole.conf UNICODE 1 rd.vconsole.font.unicode UNICODE vconsole.unicode
inst_key_val '' /etc/vconsole.conf vconsole.keymap.ext EXT_KEYMAP inst_key_val /etc/vconsole.conf EXT_KEYMAP '' rd.vconsole.keymap.ext EXT_KEYMAP
inst_key_val '' /etc/locale.conf locale.LANG LANG inst_key_val /etc/locale.conf LANG '' rd.locale.LANG LANG
inst_key_val '' /etc/locale.conf locale.LC_ALL LC_ALL inst_key_val /etc/locale.conf LC_ALL '' rd.locale.LC_ALL LC_ALL
if [ -f /etc/locale.conf ]; then if [ -f /etc/locale.conf ]; then
. /etc/locale.conf . /etc/locale.conf
export LANG export LANG
export LC_ALL export LC_ALL
fi fi
if [ -n "$DRACUT_SYSTEMD" ]; then
rm -f -- /etc/udev/rules.d/10-console.rules
rm -f -- /lib/udev/rules.d/10-console.rules
rm -f -- /lib/udev/console_init
fi

View File

@@ -2,15 +2,18 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
[[ $mount_needs ]] && return 1 [[ $mount_needs ]] && return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
inst_multiple bash find ldconfig mv rm cp ln inst_multiple bash find ldconfig mv rm cp ln
inst_hook pre-pivot 99 "$moddir/do-convertfs.sh" inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"

View File

@@ -2,6 +2,17 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
# We already need a set netif here
netif=$interface
# Huh? Interface configured?
[ -f "/tmp/net.$netif.up" ] && exit 0
setup_interface() { setup_interface() {
ip=$new_ip_address ip=$new_ip_address
mtu=$new_interface_mtu mtu=$new_interface_mtu
@@ -12,6 +23,7 @@ setup_interface() {
search=$(printf -- "$new_domain_search") search=$(printf -- "$new_domain_search")
namesrv=$new_domain_name_servers namesrv=$new_domain_name_servers
hostname=$new_host_name hostname=$new_host_name
lease_time=$new_dhcp_lease_time
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
@@ -29,7 +41,9 @@ setup_interface() {
fi fi
fi fi
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} \
valid_lft ${lease_time} preferred_lft ${lease_time} \
dev $netif
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
@@ -45,24 +59,42 @@ setup_interface() {
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
} }
PATH=/usr/sbin:/usr/bin:/sbin:/bin setup_interface6() {
domain=$new_domain_name
search=$(printf -- "$new_domain_search")
namesrv=$new_domain_name_servers
hostname=$new_host_name
lease_time=$new_dhcp_lease_time
export PS4="dhclient.$interface.$$ + " [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
# We already need a set netif here ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
netif=$interface dev ${netif} scope global valid_lft ${lease_time} \
preferred_lft ${lease_time}
# Huh? Interface configured? [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
[ -f "/tmp/net.$netif.up" ] && exit 0 if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
# Note: hostname can be fqdn OR short hostname, so chop off any
# trailing domain name and explicity add any domain if set.
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
}
case $reason in case $reason in
PREINIT) PREINIT)
echo "dhcp: PREINIT $netif up" echo "dhcp: PREINIT $netif up"
linkup $netif linkup $netif
;; ;;
PREINIT6)
echo "dhcp: PREINIT $netif up"
linkup $netif
;;
BOUND) BOUND)
echo "dhcp: BOND setting $netif" echo "dhcp: BOND setting $netif"
unset layer2 unset layer2
@@ -87,12 +119,31 @@ case $reason in
echo "setup_net $netif" echo "setup_net $netif"
echo "source_hook initqueue/online $netif" echo "source_hook initqueue/online $netif"
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif" [ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
echo "> /tmp/setup_net_$netif.ok"
echo "> /tmp/setup_net_\$(cat /sys/class/net/$netif/address).ok"
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh" echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
} > $hookdir/initqueue/setup_net_$netif.sh } > $hookdir/initqueue/setup_net_$netif.sh
echo "[ -f /tmp/setup_net_$netif.ok ]" > $hookdir/initqueue/finished/dhclient-$netif.sh echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
>/tmp/net.$netif.up
;;
BOUND6)
echo "dhcp: BOND6 setting $netif"
setup_interface6
set | while read line; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
{
echo '. /lib/net-lib.sh'
echo "setup_net $netif"
echo "source_hook initqueue/online $netif"
[ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif"
echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh"
} > $hookdir/initqueue/setup_net_$netif.sh
echo "[ -f /tmp/net.$netif.did-setup ]" > $hookdir/initqueue/finished/dhclient-$netif.sh
>/tmp/net.$netif.up >/tmp/net.$netif.up
;; ;;
*) echo "dhcp: $reason";; *) echo "dhcp: $reason";;

View File

@@ -80,13 +80,26 @@ fi
# in netroot case we prefer netroot to bringup $netif automaticlly # in netroot case we prefer netroot to bringup $netif automaticlly
[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2" [ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2"
[ -z "$netroot" ] && [ -z "$manualup" ] && exit 0 [ -z "$netroot" ] && [ -z "$manualup" ] && exit 0
[ -n "$manualup" ] && >/tmp/net.$netif.manualup if [ -n "$manualup" ]; then
>/tmp/net.$netif.manualup
else
[ -e /tmp/net.${netif}.did-setup ] && exit 0
[ -e /sys/class/net/$netif/address ] && \
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
fi
# Run dhclient # Run dhclient
do_dhcp() { do_dhcp() {
# dhclient-script will mark the netif up and generate the online # dhclient-script will mark the netif up and generate the online
# event for nfsroot # event for nfsroot
# XXX add -V vendor class and option parsing per kernel # XXX add -V vendor class and option parsing per kernel
[ -e /tmp/dhclient.$netif.pid ] && return 0
if ! iface_has_link $netif; then
echo "No carrier detected"
return 1
fi
echo "Starting dhcp for interface $netif" echo "Starting dhcp for interface $netif"
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \ dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|| echo "dhcp failed" || echo "dhcp failed"
@@ -125,6 +138,7 @@ do_static() {
if strstr $ip '*:*:*'; then if strstr $ip '*:*:*'; then
# note no ip addr flush for ipv6 # note no ip addr flush for ipv6
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
wait_for_ipv6_dad $netif
else else
ip addr flush dev $netif ip addr flush dev $netif
ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
@@ -133,7 +147,6 @@ do_static() {
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw [ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname [ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
> /tmp/setup_net_${netif}.ok
return 0 return 0
} }
@@ -260,18 +273,15 @@ if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then
ip link set "$vlanname" up ip link set "$vlanname" up
fi fi
# setup nameserver
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
# No ip lines default to dhcp # No ip lines default to dhcp
ip=$(getarg ip) ip=$(getarg ip)
if [ -z "$ip" ]; then if [ -z "$ip" ]; then
namesrv=$(getargs nameserver)
for s in $namesrv; do
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
if [ "$netroot" = "dhcp6" ]; then if [ "$netroot" = "dhcp6" ]; then
do_dhcp -6 do_dhcp -6
else else
@@ -303,8 +313,14 @@ for p in $(getargs ip=); do
[ "$use_bridge" != 'true' ] && \ [ "$use_bridge" != 'true' ] && \
[ "$use_vlan" != 'true' ] && continue [ "$use_vlan" != 'true' ] && continue
# setup nameserver
namesrv="$dns1 $dns2 $(getargs nameserver)"
for s in $namesrv; do
echo nameserver $s >> /tmp/net.$netif.resolv.conf
done
# Store config for later use # Store config for later use
for i in ip srv gw mask hostname macaddr; do for i in ip srv gw mask hostname macaddr dns1 dns2; do
eval '[ "$'$i'" ] && echo '$i'="$'$i'"' eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
done > /tmp/net.$netif.override done > /tmp/net.$netif.override
@@ -312,6 +328,7 @@ for p in $(getargs ip=); do
dhcp|on|any) dhcp|on|any)
do_dhcp -4 ;; do_dhcp -4 ;;
dhcp6) dhcp6)
load_ipv6
do_dhcp -6 ;; do_dhcp -6 ;;
auto6) auto6)
do_ipv6auto ;; do_ipv6auto ;;
@@ -319,6 +336,8 @@ for p in $(getargs ip=); do
do_static ;; do_static ;;
esac esac
> /tmp/net.${netif}.up
case $autoconf in case $autoconf in
dhcp|on|any|dhcp6) dhcp|on|any|dhcp6)
;; ;;
@@ -336,8 +355,15 @@ for p in $(getargs ip=); do
exit 0 exit 0
done done
# netif isn't the top stack? Then we should exit here.
# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp
# bond0 doesn't make sense.
if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then
exit 0
fi
# no ip option directed at our interface? # no ip option directed at our interface?
if [ ! -e /tmp/setup_net_${netif}.ok ]; then if [ ! -e /tmp/net.${netif}.up ]; then
do_dhcp -4 do_dhcp -4
fi fi

View File

@@ -2,29 +2,27 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
local _program local _program
for _program in ip arping dhclient ; do require_binaries ip arping dhclient || return 1
if ! type -P $_program >/dev/null; then
derror "Could not find program \"$_program\" required by network."
return 1
fi
done
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
# Include wired net drivers, excluding wireless # Include wired net drivers, excluding wireless
net_module_filter() { net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device' local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
local _unwanted_drivers='/(wireless|isdn|uwb)/' local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
local _ret local _ret
# subfunctions inherit following FDs # subfunctions inherit following FDs
local _merge=8 _side2=9 local _merge=8 _side2=9
@@ -64,9 +62,14 @@ installkernel() {
| net_module_filter | instmods | net_module_filter | instmods
#instmods() will take care of hostonly #instmods() will take care of hostonly
instmods =drivers/net/phy ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net =drivers/net/team instmods \
=drivers/net/phy \
=drivers/net/team \
=drivers/net/ethernet \
ecb arc4 bridge stp llc ipv6 bonding 8021q af_packet virtio_net
} }
# called by dracut
install() { install() {
local _arch _i _dir local _arch _i _dir
inst_multiple ip arping dhclient sed inst_multiple ip arping dhclient sed

View File

@@ -89,7 +89,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
for iface in $wait_ifaces; do for iface in $wait_ifaces; do
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
echo "[ -f /tmp/setup_net_${iface}.ok ]" >$hookdir/initqueue/finished/wait-$iface.sh echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
fi fi
done done
# Default: We don't know the interface to use, handle all # Default: We don't know the interface to use, handle all

103
modules.d/40network/net-lib.sh Normal file → Executable file
View File

@@ -28,30 +28,6 @@ iface_for_mac() {
done done
} }
iface_has_link() {
local interface="$1" flags=""
[ -n "$interface" ] || return 2
interface="/sys/class/net/$interface"
[ -d "$interface" ] || return 2
flags=$(cat $interface/flags)
echo $(($flags|0x41)) > $interface/flags # 0x41: IFF_UP|IFF_RUNNING
[ "$(cat $interface/carrier)" = 1 ] || return 1
# XXX Do we need to reset the flags here? anaconda never bothered..
}
find_iface_with_link() {
local iface_path="" iface=""
for iface_path in /sys/class/net/*; do
iface=${iface_path##*/}
str_starts "$iface" "lo" && continue
if iface_has_link $iface; then
echo "$iface"
return 0
fi
done
return 1
}
# get the iface name for the given identifier - either a MAC, IP, or iface name # get the iface name for the given identifier - either a MAC, IP, or iface name
iface_name() { iface_name() {
case $1 in case $1 in
@@ -106,12 +82,16 @@ ifdown() {
ip addr flush dev $netif ip addr flush dev $netif
echo "#empty" > /etc/resolv.conf echo "#empty" > /etc/resolv.conf
rm -f -- /tmp/net.$netif.did-setup rm -f -- /tmp/net.$netif.did-setup
[ -e /sys/class/net/$netif/address ] && \
rm -f -- /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
# TODO: send "offline" uevent? # TODO: send "offline" uevent?
} }
setup_net() { setup_net() {
local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES="" local netif="$1" f="" gw_ip="" netroot_ip="" iface="" IFACES=""
[ -e /tmp/net.$netif.did-setup ] && return [ -e /tmp/net.$netif.did-setup ] && return
[ -e /sys/class/net/$netif/address ] && \
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && return
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces [ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
[ -z "$IFACES" ] && IFACES="$netif" [ -z "$IFACES" ] && IFACES="$netif"
# run the scripts written by ifup # run the scripts written by ifup
@@ -147,12 +127,14 @@ setup_net() {
read layer2 < /sys/class/net/$netif/device/layer2 read layer2 < /sys/class/net/$netif/device/layer2
fi fi
if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
info "Resolving $dest via ARP on $netif failed" arping -q -f -w 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
fi fi
unset layer2 unset layer2
> /tmp/net.$netif.did-setup > /tmp/net.$netif.did-setup
[ -e /sys/class/net/$netif/address ] && \
> /tmp/net.$(cat /sys/class/net/$netif/address).did-setup
} }
save_netinfo() { save_netinfo() {
@@ -209,6 +191,7 @@ ibft_to_cmdline() {
for iface in /sys/firmware/ibft/ethernet*; do for iface in /sys/firmware/ibft/ethernet*; do
local mac="" dev="" local mac="" dev=""
local dhcp="" ip="" gw="" mask="" hostname="" local dhcp="" ip="" gw="" mask="" hostname=""
local dns1 dns2
[ -e ${iface}/mac ] || continue [ -e ${iface}/mac ] || continue
mac=$(read a < ${iface}/mac; echo $a) mac=$(read a < ${iface}/mac; echo $a)
@@ -227,9 +210,11 @@ ibft_to_cmdline() {
[ "$ip" = "0.0.0.0" ] && continue [ "$ip" = "0.0.0.0" ] && continue
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a) [ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a) [ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
[ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a)
[ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a)
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a) [ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
if [ -n "$ip" ] && [ -n "$mask" ]; then if [ -n "$ip" ] && [ -n "$mask" ]; then
echo "ip=$ip::$gw:$mask:$hostname:$dev:none" echo "ip=$ip::$gw:$mask:$hostname:$dev:none${dns1:+:$dns1}${dns2:+:$dns2}"
else else
warn "${iface} does not contain a valid iBFT configuration" warn "${iface} does not contain a valid iBFT configuration"
warn "ip-addr=$ip" warn "ip-addr=$ip"
@@ -363,7 +348,7 @@ ip_to_var() {
fi fi
done done
unset ip srv gw mask hostname dev autoconf macaddr mtu unset ip srv gw mask hostname dev autoconf macaddr mtu dns1 dns2
case $# in case $# in
0) autoconf="error" ;; 0) autoconf="error" ;;
1) autoconf=$1 ;; 1) autoconf=$1 ;;
@@ -371,11 +356,22 @@ ip_to_var() {
3) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3 ;; 3) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3 ;;
4) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3; [ -n "$4" ] && macaddr=$4 ;; 4) [ -n "$1" ] && dev=$1; [ -n "$2" ] && autoconf=$2; [ -n "$3" ] && mtu=$3; [ -n "$4" ] && macaddr=$4 ;;
*) [ -n "$1" ] && ip=$1; [ -n "$2" ] && srv=$2; [ -n "$3" ] && gw=$3; [ -n "$4" ] && mask=$4; *) [ -n "$1" ] && ip=$1; [ -n "$2" ] && srv=$2; [ -n "$3" ] && gw=$3; [ -n "$4" ] && mask=$4;
[ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7; [ -n "$8" ] && mtu=$8; [ -n "$5" ] && hostname=$5; [ -n "$6" ] && dev=$6; [ -n "$7" ] && autoconf=$7;
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then case "$8" in
macaddr="${9}:${10}:${11}:${12}:${13}:${14}" [0-9]*:*|[0-9]*.[0-9]*.[0-9]*.[0-9]*)
fi dns1="$8"
;; [ -n "$9" ] && dns2="$9"
;;
[0-9]*)
mtu="$8"
;;
*)
if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then
macaddr="${9}:${10}:${11}:${12}:${13}:${14}"
fi
;;
esac
;;
esac esac
# ip=<ipv4-address> means anaconda-style static config argument cluster: # ip=<ipv4-address> means anaconda-style static config argument cluster:
@@ -443,7 +439,7 @@ wait_for_if_up() {
local li local li
while [ $cnt -lt 200 ]; do while [ $cnt -lt 200 ]; do
li=$(ip -o link show up dev $1) li=$(ip -o link show up dev $1)
[ -n "$li" ] && return 0 [ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0
sleep 0.1 sleep 0.1
cnt=$(($cnt+1)) cnt=$(($cnt+1))
done done
@@ -461,12 +457,26 @@ wait_for_route_ok() {
return 1 return 1
} }
wait_for_ipv6_dad() {
local cnt=0
local li
while [ $cnt -lt 500 ]; do
li=$(ip -6 addr show dev $1)
strstr "$li" "tentative" || return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}
wait_for_ipv6_auto() { wait_for_ipv6_auto() {
local cnt=0 local cnt=0
local li local li
while [ $cnt -lt 400 ]; do while [ $cnt -lt 400 ]; do
li=$(ip -6 addr show dev $1) li=$(ip -6 addr show dev $1)
strstr "$li" "dynamic" && return 0 if ! strstr "$li" "tentative"; then
strstr "$li" "dynamic" && return 0
fi
sleep 0.1 sleep 0.1
cnt=$(($cnt+1)) cnt=$(($cnt+1))
done done
@@ -483,3 +493,26 @@ type hostname >/dev/null 2>&1 || \
hostname() { hostname() {
cat /proc/sys/kernel/hostname cat /proc/sys/kernel/hostname
} }
iface_has_link() {
local interface="$1" flags=""
[ -n "$interface" ] || return 2
interface="/sys/class/net/$interface"
[ -d "$interface" ] || return 2
linkup "$1"
[ "$(cat $interface/carrier)" = 1 ] || return 1
# XXX Do we need to reset the flags here? anaconda never bothered..
}
find_iface_with_link() {
local iface_path="" iface=""
for iface_path in /sys/class/net/*; do
iface=${iface_path##*/}
str_starts "$iface" "lo" && continue
if iface_has_link $iface; then
echo "$iface"
return 0
fi
done
return 1
}

View File

@@ -108,7 +108,7 @@ for p in $(getargs ip=); do
done done
# put BOOTIF in IFACES to make sure it comes up # put BOOTIF in IFACES to make sure it comes up
if BOOTIF="$(getarg BOOTIF=)"; then if getargbool 1 "rd.bootif" && BOOTIF="$(getarg BOOTIF=)"; then
BOOTDEV=$(fix_bootif $BOOTIF) BOOTDEV=$(fix_bootif $BOOTIF)
IFACES="$BOOTDEV $IFACES" IFACES="$BOOTDEV $IFACES"
fi fi

0
modules.d/40network/parse-vlan.sh Normal file → Executable file
View File

View File

@@ -2,15 +2,18 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
[[ -d /etc/sysconfig/network-scripts ]] && return 0 [[ -d /etc/sysconfig/network-scripts ]] && return 0
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh" inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
} }

View File

@@ -55,9 +55,9 @@ print_s390() {
SUBCHANNELS=${SUBCHANNELS%,} SUBCHANNELS=${SUBCHANNELS%,}
echo "SUBCHANNELS=\"${SUBCHANNELS}\"" echo "SUBCHANNELS=\"${SUBCHANNELS}\""
CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
[ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0
OLD_IFS=$IFS OLD_IFS=$IFS
IFS="," IFS=","
@@ -77,6 +77,7 @@ print_s390() {
OPTIONS=${OPTIONS## } OPTIONS=${OPTIONS## }
echo "NETTYPE=\"${NETTYPE}\"" echo "NETTYPE=\"${NETTYPE}\""
echo "OPTIONS=\"${OPTIONS}\"" echo "OPTIONS=\"${OPTIONS}\""
return 0
} }
for netup in /tmp/net.*.did-setup ; do for netup in /tmp/net.*.did-setup ; do
@@ -84,6 +85,7 @@ for netup in /tmp/net.*.did-setup ; do
netif=${netup%%.did-setup} netif=${netup%%.did-setup}
netif=${netif##*/net.} netif=${netif##*/net.}
strstr "$netif" ":*:*:*:*:" && continue
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue [ -e /tmp/ifcfg/ifcfg-$netif ] && continue
unset bridge unset bridge
unset bond unset bond
@@ -110,7 +112,8 @@ for netup in /tmp/net.*.did-setup ; do
if [ "$netif" = "$vlanname" ]; then if [ "$netif" = "$vlanname" ]; then
vlan=yes vlan=yes
fi fi
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr [ -e /sys/class/net/$netif/address ] && \
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
{ {
echo "# Generated by dracut initrd" echo "# Generated by dracut initrd"
echo "DEVICE=\"$netif\"" echo "DEVICE=\"$netif\""
@@ -159,12 +162,10 @@ for netup in /tmp/net.*.did-setup ; do
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
# standard interface # standard interface
{ {
if [ -n "$macaddr" ]; then [ -n "$macaddr" ] && echo "MACADDR=\"$macaddr\""
echo "MACADDR=\"$macaddr\"" if ! print_s390 $netif; then
else [ -n "$macaddr" ] || echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
fi fi
print_s390 $netif
echo "TYPE=Ethernet" echo "TYPE=Ethernet"
echo "NAME=\"$netif\"" echo "NAME=\"$netif\""
[ -n "$mtu" ] && echo "MTU=\"$mtu\"" [ -n "$mtu" ] && echo "MTU=\"$mtu\""

View File

@@ -1,16 +1,19 @@
#!/bin/bash #!/bin/bash
# module-setup for url-lib # module-setup for url-lib
# called by dracut
check() { check() {
command -v curl >/dev/null || return 1 require_binaries curl || return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
echo network echo network
return 0 return 0
} }
# called by dracut
install() { install() {
local _dir _crt _found _lib local _dir _crt _found _lib
inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh" inst_simple "$moddir/url-lib.sh" "/lib/url-lib.sh"

View File

@@ -76,7 +76,7 @@ curl_fetch_url() {
fi fi
if [ -z "$2" ]; then echo "$outloc" ; fi if [ -z "$2" ]; then echo "$outloc" ; fi
} }
add_url_handler curl_fetch_url http https ftp add_url_handler curl_fetch_url http https ftp tftp
set_http_header() { set_http_header() {
echo "header = \"$1: $2\"" >> $CURL_HOME/.curlrc echo "header = \"$1: $2\"" >> $CURL_HOME/.curlrc

3
modules.d/50drm/module-setup.sh Normal file → Executable file
View File

@@ -2,14 +2,17 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
local _modname local _modname
# Include KMS capable drm drivers # Include KMS capable drm drivers

View File

@@ -2,16 +2,19 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
# TODO: splash_geninitramfs # TODO: splash_geninitramfs
# TODO: /usr/share/splashutils/initrd.splash # TODO: /usr/share/splashutils/initrd.splash
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
local _opts local _opts
local _splash_theme local _splash_theme

View File

@@ -2,15 +2,18 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
[[ "$mount_needs" ]] && return 1 [[ "$mount_needs" ]] && return 1
type -P plymouthd >/dev/null && type -P plymouth >/dev/null require_binaries plymouthd plymouth
} }
# called by dracut
depends() { depends() {
echo drm echo drm
} }
# called by dracut
install() { install() {
if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \ if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
|| [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then || [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then

View File

@@ -2,12 +2,14 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
arch=$(uname -m) arch=$(uname -m)
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
arch=$(uname -m) arch=$(uname -m)
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1 [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
@@ -15,10 +17,12 @@ depends() {
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
instmods zfcp instmods zfcp
} }
# called by dracut
install() { install() {
inst_hook pre-trigger 30 "$moddir/cmssetup.sh" inst_hook pre-trigger 30 "$moddir/cmssetup.sh"
inst_hook pre-pivot 95 "$moddir/cms-write-ifcfg.sh" inst_hook pre-pivot 95 "$moddir/cms-write-ifcfg.sh"

View File

@@ -1,33 +0,0 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
if ! blkid -k | { while read line; do [[ $line == bcache ]] && exit 0; done; exit 1; } \
&& ! type -P probe-bcache >/dev/null; then
return 1
fi
[[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in "${host_fs_types[@]}"; do
[[ $fs = "bcache" ]] && return 0
done
return 255
}
return 0
}
depends() {
return 0
}
installkernel() {
instmods bcache
}
install() {
blkid -k | { while read line; do [[ $line == bcache ]] && exit 0; done; exit 1; } || inst_multiple probe-bcache
inst_multiple ${udevdir}/bcache-register
inst_rules 61-bcache.rules
}

View File

@@ -2,11 +2,12 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
local _rootdev local _rootdev
# if we don't have btrfs installed on the host system, # if we don't have btrfs installed on the host system,
# no point in trying to support it in the initramfs. # no point in trying to support it in the initramfs.
type -P btrfs >/dev/null || return 1 require_binaries btrfs || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && { [[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in ${host_fs_types[@]}; do for fs in ${host_fs_types[@]}; do
@@ -18,15 +19,18 @@ check() {
return 0 return 0
} }
# called by dracut
depends() { depends() {
echo udev-rules echo udev-rules
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
instmods btrfs instmods btrfs
} }
# called by dracut
install() { install() {
if ! inst_rules 64-btrfs.rules; then if ! inst_rules 64-btrfs.rules; then
inst_rules "$moddir/80-btrfs.rules" inst_rules "$moddir/80-btrfs.rules"
@@ -39,8 +43,7 @@ install() {
fi fi
if ! dracut_module_included "systemd"; then if ! dracut_module_included "systemd"; then
inst_script "$moddir/btrfs_timeout.sh" \ inst_hook initqueue/timeout 10 "$moddir/btrfs_timeout.sh"
/usr/lib/dracut/hooks/initqueue/timeout/btrfs_timeout.sh
fi fi
inst_multiple -o btrfsck btrfs-zero-log inst_multiple -o btrfsck btrfs-zero-log

View File

@@ -8,22 +8,7 @@ NEWROOT=${NEWROOT:-"/sysroot"}
# do not ask, if we already have root # do not ask, if we already have root
[ -f $NEWROOT/proc ] && exit 0 [ -f $NEWROOT/proc ] && exit 0
# check if destination already exists . /lib/dracut-lib.sh
[ -b /dev/mapper/$2 ] && exit 0
# we already asked for this device
[ -f /tmp/cryptroot-asked-$2 ] && exit 0
# load dm_crypt if it is not already loaded
[ -d /sys/module/dm_crypt ] || modprobe dm_crypt
. /lib/dracut-crypt-lib.sh
# default luksname - luks-UUID
luksname=$2
# fallback to passphrase
ask_passphrase=1
# if device name is /dev/dm-X, convert to /dev/mapper/name # if device name is /dev/dm-X, convert to /dev/mapper/name
if [ "${1##/dev/dm-}" != "$1" ]; then if [ "${1##/dev/dm-}" != "$1" ]; then
@@ -32,6 +17,9 @@ else
device="$1" device="$1"
fi fi
# default luksname - luks-UUID
luksname=$2
# number of tries # number of tries
numtries=${3:-10} numtries=${3:-10}
@@ -45,7 +33,7 @@ if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; t
# UUID used in crypttab # UUID used in crypttab
if [ "${dev%%=*}" = "UUID" ]; then if [ "${dev%%=*}" = "UUID" ]; then
if [ "luks-${dev##UUID=}" = "$2" ]; then if [ "luks-${dev##UUID=}" = "$luksname" ]; then
luksname="$name" luksname="$name"
break break
fi fi
@@ -63,6 +51,18 @@ if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -d -n rd_NO_CRYPTTAB; t
unset name dev unset name dev
fi fi
# check if destination already exists
[ -b /dev/mapper/$luksname ] && exit 0
# we already asked for this device
asked_file=/tmp/cryptroot-asked-$luksname
[ -f $asked_file ] && exit 0
# load dm_crypt if it is not already loaded
[ -d /sys/module/dm_crypt ] || modprobe dm_crypt
. /lib/dracut-crypt-lib.sh
# #
# Open LUKS device # Open LUKS device
# #
@@ -112,6 +112,9 @@ fi
unset allowdiscards unset allowdiscards
# fallback to passphrase
ask_passphrase=1
if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then
if cryptsetup --key-file "$luksfile" $cryptsetupopts luksOpen "$device" "$luksname"; then if cryptsetup --key-file "$luksfile" $cryptsetupopts luksOpen "$device" "$luksname"; then
ask_passphrase=0 ask_passphrase=0
@@ -157,7 +160,7 @@ fi
unset device luksname luksfile unset device luksname luksfile
# mark device as asked # mark device as asked
>> /tmp/cryptroot-asked-$2 >> $asked_file
need_shutdown need_shutdown
udevsettle udevsettle

View File

@@ -2,10 +2,11 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
local _rootdev local _rootdev
# if cryptsetup is not installed, then we cannot support encrypted devices. # if cryptsetup is not installed, then we cannot support encrypted devices.
type -P cryptsetup >/dev/null || return 1 require_binaries cryptsetup || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && { [[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in "${host_fs_types[@]}"; do for fs in "${host_fs_types[@]}"; do
@@ -17,15 +18,18 @@ check() {
return 0 return 0
} }
# called by dracut
depends() { depends() {
echo dm rootfs-block echo dm rootfs-block
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
instmods dm_crypt =crypto instmods dm_crypt =crypto
} }
# called by dracut
cmdline() { cmdline() {
local dev UUID local dev UUID
for dev in "${!host_fs_types[@]}"; do for dev in "${!host_fs_types[@]}"; do
@@ -44,10 +48,13 @@ cmdline() {
done done
} }
# called by dracut
install() { install() {
cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf" if [[ $hostonly_cmdline == "yes" ]]; then
echo >> "${initdir}/etc/cmdline.d/90crypt.conf" cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
fi
inst_multiple cryptsetup rmdir readlink umount inst_multiple cryptsetup rmdir readlink umount
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask

View File

@@ -2,20 +2,24 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
type -P dmsetup >/dev/null || return 1 require_binaries dmsetup || return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
instmods =drivers/md instmods =drivers/md
instmods dm_mod instmods dm_mod
} }
# called by dracut
install() { install() {
modinfo -k $kernel dm_mod >/dev/null 2>&1 && \ modinfo -k $kernel dm_mod >/dev/null 2>&1 && \
inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh" inst_hook pre-udev 30 "$moddir/dm-pre-udev.sh"

View File

@@ -27,7 +27,8 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
for s in $SETS; do for s in $SETS; do
if [ "${s##$r}" != "$s" ]; then if [ "${s##$r}" != "$s" ]; then
info "Activating $s" info "Activating $s"
dmraid -ay -i --rm_partitions "$s" 2>&1 | vinfo dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
[ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
udevsettle udevsettle
fi fi
done done
@@ -36,7 +37,8 @@ if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
# scan and activate all DM RAIDS # scan and activate all DM RAIDS
for s in $SETS; do for s in $SETS; do
info "Activating $s" info "Activating $s"
dmraid -ay -i --rm_partitions "$s" 2>&1 | vinfo dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
[ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
done done
fi fi

View File

@@ -2,11 +2,12 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
local _rootdev local _rootdev
# if we don't have dmraid installed on the host system, no point # if we don't have dmraid installed on the host system, no point
# in trying to support it in the initramfs. # in trying to support it in the initramfs.
type -P dmraid >/dev/null || return 1 require_binaries dmraid || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && { [[ $hostonly ]] || [[ $mount_needs ]] && {
for dev in "${!host_fs_types[@]}"; do for dev in "${!host_fs_types[@]}"; do
@@ -27,11 +28,13 @@ check() {
return 0 return 0
} }
# called by dracut
depends() { depends() {
echo dm rootfs-block echo dm rootfs-block
return 0 return 0
} }
# called by dracut
cmdline() { cmdline() {
local _activated local _activated
declare -A _activated declare -A _activated
@@ -58,11 +61,14 @@ cmdline() {
done done
} }
# called by dracut
install() { install() {
local _i local _i
cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf" if [[ $hostonly_cmdline == "yes" ]]; then
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf" cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
fi
inst_multiple dmraid inst_multiple dmraid
inst_multiple -o kpartx inst_multiple -o kpartx

View File

@@ -9,7 +9,7 @@ case "$root" in
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \ printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
${root#live:/dev/} ${root#live:/dev/}
} >> /etc/udev/rules.d/99-live-squash.rules } >> /etc/udev/rules.d/99-live-squash.rules
wait_for_dev "${root#live:}" wait_for_dev -n "${root#live:}"
;; ;;
live:*) live:*)
if [ -f "${root#live:}" ]; then if [ -f "${root#live:}" ]; then

View File

@@ -144,6 +144,9 @@ do_live_overlay() {
over=$OVERLAY_LOOPDEV over=$OVERLAY_LOOPDEV
fi fi
echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw echo 0 $sz snapshot $base $over p 8 | dmsetup create live-rw
# Create a device that always points to a ro base image
echo 0 $sz linear $base 0 | dmsetup create --readonly live-base
} }
# live cd helper function # live cd helper function
@@ -225,9 +228,6 @@ if [ -n "$ROOTFLAGS" ]; then
ROOTFLAGS="-o $ROOTFLAGS" ROOTFLAGS="-o $ROOTFLAGS"
fi fi
if [ -b "$BASE_LOOPDEV" ]; then
ln -s $BASE_LOOPDEV /run/initramfs/live-baseloop
fi
ln -s /dev/mapper/live-rw /dev/root ln -s /dev/mapper/live-rw /dev/root
printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh printf 'mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > $hookdir/mount/01-$$-live.sh

View File

@@ -3,7 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
if [ "${root%%:*}" = "liveiso" ]; then if [ "${root%%:*}" = "liveiso" ]; then
{ {
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \ printf 'KERNEL=="loop-control", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
${root#liveiso:} ${root#liveiso:}
} >> /etc/udev/rules.d/99-liveiso-mount.rules } >> /etc/udev/rules.d/99-liveiso-mount.rules
fi fi

View File

@@ -2,12 +2,14 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
# a live host-only image doesn't really make a lot of sense # a live host-only image doesn't really make a lot of sense
[[ $hostonly ]] && return 1 [[ $hostonly ]] && return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
# if dmsetup is not installed, then we cannot support fedora/red hat # if dmsetup is not installed, then we cannot support fedora/red hat
# style live images # style live images
@@ -15,10 +17,12 @@ depends() {
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
instmods squashfs loop iso9660 instmods squashfs loop iso9660
} }
# called by dracut
install() { install() {
inst_multiple umount dmsetup blkid dd losetup grep blockdev inst_multiple umount dmsetup blkid dd losetup grep blockdev
inst_multiple -o checkisomd5 inst_multiple -o checkisomd5

View File

@@ -56,4 +56,4 @@ info "root was $liveroot, is now $root"
# make sure that init doesn't complain # make sure that init doesn't complain
[ -z "$root" ] && root="live" [ -z "$root" ] && root="live"
wait_for_dev /dev/mapper/live-rw wait_for_dev -n /dev/mapper/live-rw

View File

@@ -2,10 +2,11 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
installkernel() { installkernel() {
if [[ -z $drivers ]]; then if [[ -z $drivers ]]; then
block_module_filter() { block_module_filter() {
local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect' local _blockfuncs='ahci_init_controller|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect'
# subfunctions inherit following FDs # subfunctions inherit following FDs
local _merge=8 _side2=9 local _merge=8 _side2=9
function bmf1() { function bmf1() {
@@ -35,20 +36,24 @@ installkernel() {
return 0 return 0
} }
hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix \ hostonly='' instmods \
ehci-hcd ehci-pci ehci-platform ohci-hcd uhci-hcd xhci-hcd hid_generic \ sr_mod sd_mod scsi_dh ata_piix hid_generic unix \
unix ehci-hcd ehci-pci ehci-platform \
ohci-hcd ohci-pci \
uhci-hcd \
xhci-hcd
instmods yenta_socket scsi_dh_rdac scsi_dh_emc \ instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \ atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
hid-logitech-dj hid-microsoft firewire-ohci \ hid-logitech-dj hid-microsoft firewire-ohci \
pcmcia usb_storage nvme hid-hyperv hv-vmbus pcmcia usb_storage nvme hid-hyperv hv-vmbus \
sdhci_acpi
if [[ "$(uname -p)" == arm* ]]; then if [[ "$(uname -p)" == arm* ]]; then
# arm specific modules # arm specific modules
hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \ hostonly='' instmods sdhci_esdhc_imx mmci sdhci_tegra mvsdio omap omapdrm \
omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv \ omap_hsmmc panel-tfp410 sdhci_dove ahci_platform pata_imx sata_mv \
ehci-tegra ehci-tegra mmc_block usb_storage
fi fi
# install virtual machine support # install virtual machine support
@@ -73,6 +78,7 @@ installkernel() {
: :
} }
# called by dracut
install() { install() {
inst_multiple -o /lib/modprobe.d/*.conf inst_multiple -o /lib/modprobe.d/*.conf
[[ $hostonly ]] && inst_multiple -o /etc/modprobe.d/*.conf /etc/modprobe.conf [[ $hostonly ]] && inst_multiple -o /etc/modprobe.d/*.conf /etc/modprobe.conf

View File

@@ -1,15 +1,18 @@
#!/bin/bash #!/bin/bash
# module-setup.sh for livenet # module-setup.sh for livenet
# called by dracut
check() { check() {
return 255 return 255
} }
# called by dracut
depends() { depends() {
echo network url-lib dmsquash-live img-lib echo network url-lib dmsquash-live img-lib
return 0 return 0
} }
# called by dracut
install() { install() {
inst_hook cmdline 29 "$moddir/parse-livenet.sh" inst_hook cmdline 29 "$moddir/parse-livenet.sh"
inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh" inst_hook initqueue/online 95 "$moddir/fetch-liveupdate.sh"

View File

@@ -27,7 +27,7 @@ if get_url_handler "$liveurl" >/dev/null; then
netroot="livenet:$liveurl" netroot="livenet:$liveurl"
root="livenet" # quiet complaints from init root="livenet" # quiet complaints from init
rootok=1 rootok=1
wait_for_dev /dev/root wait_for_dev -n /dev/root
else else
info "livenet: no url handler for $liveurl" info "livenet: no url handler for $liveurl"
fi fi

View File

@@ -107,11 +107,13 @@ fi
if [ -n "$LVS" ] ; then if [ -n "$LVS" ] ; then
info "Scanning devices $lvmdevs for LVM logical volumes $LVS" info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
lvm lvscan --ignorelockingfailure 2>&1 | vinfo lvm lvscan --ignorelockingfailure 2>&1 | vinfo
if [ -z "$sysinit" ]; then for LV in $LVS; do
lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo if [ -z "$sysinit" ]; then
else lvm lvchange --yes -ay --ignorelockingfailure $nopoll --ignoremonitoring $LV 2>&1 | vinfo
lvm lvchange --yes -ay $sysinit $LVS 2>&1 | vinfo else
fi lvm lvchange --yes -ay $sysinit $LV 2>&1 | vinfo
fi
done
fi fi
if [ -z "$LVS" -o -n "$VGS" ]; then if [ -z "$LVS" -o -n "$VGS" ]; then

View File

@@ -2,9 +2,10 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
# No point trying to support lvm if the binaries are missing # No point trying to support lvm if the binaries are missing
type -P lvm >/dev/null || return 1 require_binaries lvm || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && { [[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in "${host_fs_types[@]}"; do for fs in "${host_fs_types[@]}"; do
@@ -16,13 +17,15 @@ check() {
return 0 return 0
} }
# called by dracut
depends() { depends() {
# We depend on dm_mod being loaded # We depend on dm_mod being loaded
echo rootfs-block dm echo rootfs-block dm
return 0 return 0
} }
get_host_lvs() { # called by dracut
cmdline() {
local _activated local _activated
declare -A _activated declare -A _activated
@@ -35,30 +38,22 @@ get_host_lvs() {
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null) eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1 [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then
printf "%s\n" "${DM_VG_NAME}/${DM_LV_NAME} " printf " rd.lvm.lv=%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
_activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1 _activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
fi fi
done done
} }
cmdline() { # called by dracut
get_host_lvs | while read line; do
printf " rd.lvm.lv=$line"
done
}
install() { install() {
local _i _needthin local _i
inst lvm inst lvm
get_host_lvs | while read line; do if [[ $hostonly_cmdline == "yes" ]]; then
printf "%s" " rd.lvm.lv=$line" cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
if ! [[ $_needthin ]]; then echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
[[ "$(lvs --noheadings -o segtype ${line%%/*} 2>/dev/null)" == *thin* ]] && _needthin=1 fi
fi
done >> "${initdir}/etc/cmdline.d/90lvm.conf"
echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
inst_rules "$moddir/64-lvm.rules" inst_rules "$moddir/64-lvm.rules"
@@ -82,7 +77,17 @@ install() {
} > "${initdir}/etc/lvm/lvm.conf" } > "${initdir}/etc/lvm/lvm.conf"
fi fi
inst_rules 11-dm-lvm.rules inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules
# Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut!
if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
else
sed -i -e 's/.*lvm pvscan.*/# No LVM pvscan for in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
fi
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules # Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
# files, but provides the one below: # files, but provides the one below:
inst_rules 64-device-mapper.rules inst_rules 64-device-mapper.rules
@@ -94,9 +99,18 @@ install() {
inst_libdir_file "libdevmapper-event-lvm*.so" inst_libdir_file "libdevmapper-event-lvm*.so"
if [[ $_needthin ]]; then if [[ $hostonly ]] && type -P lvs &>/dev/null; then
for dev in "${!host_fs_types[@]}"; do
[ -e /sys/block/${dev#/dev/}/dm/name ] || continue
dev=$(</sys/block/${dev#/dev/}/dm/name)
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || continue
if [[ "$(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null)" == *thin* ]] ; then
inst_multiple -o thin_dump thin_restore thin_check thin_repair
break
fi
done
else
inst_multiple -o thin_dump thin_restore thin_check thin_repair inst_multiple -o thin_dump thin_restore thin_check thin_repair
fi fi
} }

View File

@@ -13,7 +13,7 @@ if ! getargbool 1 rd.lvm -d -n rd_NO_LVM \
rm -f -- /etc/udev/rules.d/64-lvm*.rules rm -f -- /etc/udev/rules.d/64-lvm*.rules
else else
for dev in $LV_DEVS; do for dev in $LV_DEVS; do
wait_for_dev "/dev/$dev" wait_for_dev -n "/dev/$dev"
done done
fi fi

View File

@@ -20,4 +20,5 @@ IMPORT{program}="/sbin/mdadm --detail --export $tempnode"
IMPORT BLKID IMPORT BLKID
OPTIONS+="link_priority=100" OPTIONS+="link_priority=100"
OPTIONS+="watch" OPTIONS+="watch"
OPTIONS+="db_persist"
LABEL="md_end" LABEL="md_end"

View File

@@ -2,10 +2,11 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
local _rootdev local _rootdev
# No mdadm? No mdraid support. # No mdadm? No mdraid support.
type -P mdadm >/dev/null || return 1 require_binaries mdadm || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && { [[ $hostonly ]] || [[ $mount_needs ]] && {
for dev in "${!host_fs_types[@]}"; do for dev in "${!host_fs_types[@]}"; do
@@ -26,15 +27,18 @@ check() {
return 0 return 0
} }
# called by dracut
depends() { depends() {
echo rootfs-block echo rootfs-block
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
instmods =drivers/md instmods =drivers/md
} }
# called by dracut
cmdline() { cmdline() {
local _activated dev line UUID local _activated dev line UUID
declare -A _activated declare -A _activated
@@ -58,21 +62,33 @@ cmdline() {
done done
} }
# called by dracut
install() { install() {
local rule rule_path
inst_multiple cat inst_multiple cat
inst_multiple -o mdmon inst_multiple -o mdmon
inst $(command -v partx) /sbin/partx inst $(command -v partx) /sbin/partx
inst $(command -v mdadm) /sbin/mdadm inst $(command -v mdadm) /sbin/mdadm
cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf" if [[ $hostonly_cmdline == "yes" ]]; then
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf" cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
fi
# <mdadm-3.3 udev rule
inst_rules 64-md-raid.rules inst_rules 64-md-raid.rules
# >=mdadm-3.3 udev rules
inst_rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules
# remove incremental assembly from stock rules, so they don't shadow # remove incremental assembly from stock rules, so they don't shadow
# 65-md-inc*.rules and its fine-grained controls, or cause other problems # 65-md-inc*.rules and its fine-grained controls, or cause other problems
# when we explicitly don't want certain components to be incrementally # when we explicitly don't want certain components to be incrementally
# assembled # assembled
sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules" for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
rule_path="${initdir}${udevdir}/rules.d/${rule}"
[ -f "${rule_path}" ] && sed -i -r \
-e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
"${rule_path}"
done
inst_rules "$moddir/65-md-incremental-imsm.rules" inst_rules "$moddir/65-md-incremental-imsm.rules"
@@ -93,6 +109,14 @@ install() {
else else
[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf [ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf
fi fi
if [ -d /etc/mdadm.conf.d ]; then
local f
inst_dir /etc/mdadm.conf.d
for f in /etc/mdadm.conf.d/*.conf; do
[ -f "$f" ] || continue
inst "$f"
done
fi
fi fi
inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh" inst_hook pre-udev 30 "$moddir/mdmon-pre-udev.sh"

View File

@@ -2,10 +2,11 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
local _rootdev local _rootdev
# if there's no multipath binary, no go. # if there's no multipath binary, no go.
type -P multipath >/dev/null || return 1 require_binaries multipath || return 1
is_mpath() { is_mpath() {
local _dev=$1 local _dev=$1
@@ -21,12 +22,14 @@ check() {
return 0 return 0
} }
# called by dracut
depends() { depends() {
echo rootfs-block echo rootfs-block
echo dm echo dm
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
local _ret local _ret
local _arch=$(uname -m) local _arch=$(uname -m)
@@ -67,6 +70,7 @@ installkernel() {
find_kernel_modules_by_path drivers/md ) | mp_mod_filter | instmods find_kernel_modules_by_path drivers/md ) | mp_mod_filter | instmods
} }
# called by dracut
install() { install() {
local _f local _f
inst_multiple -o \ inst_multiple -o \

View File

@@ -2,6 +2,7 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
if type -P systemd-detect-virt >/dev/null 2>&1; then if type -P systemd-detect-virt >/dev/null 2>&1; then
vm=$(systemd-detect-virt --vm >/dev/null 2>&1) vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
@@ -21,6 +22,7 @@ check() {
return 255 return 255
} }
# called by dracut
installkernel() { installkernel() {
# qemu specific modules # qemu specific modules
hostonly='' instmods virtio_net e1000 8139cp pcnet32 e100 ne2k_pci hostonly='' instmods virtio_net e1000 8139cp pcnet32 e100 ne2k_pci

View File

@@ -2,6 +2,7 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
if type -P systemd-detect-virt >/dev/null 2>&1; then if type -P systemd-detect-virt >/dev/null 2>&1; then
vm=$(systemd-detect-virt --vm >/dev/null 2>&1) vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
@@ -20,6 +21,7 @@ check() {
return 255 return 255
} }
# called by dracut
installkernel() { installkernel() {
# qemu specific modules # qemu specific modules
hostonly='' instmods virtio_blk virtio virtio_ring virtio_pci ata_piix ata_generic pata_acpi cdrom sr_mod ahci virtio_scsi hostonly='' instmods virtio_blk virtio virtio_ring virtio_pci ata_piix ata_generic pata_acpi cdrom sr_mod ahci virtio_scsi

View File

@@ -3,16 +3,19 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# GPG support is optional # GPG support is optional
# called by dracut
check() { check() {
type -P gpg >/dev/null || return 1 require_binaries gpg || return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
echo crypt echo crypt
} }
# called by dracut
install() { install() {
inst_multiple gpg inst_multiple gpg
inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh" inst "$moddir/crypt-gpg-lib.sh" "/lib/dracut-crypt-gpg-lib.sh"

0
modules.d/91crypt-loop/crypt-loop-lib.sh Normal file → Executable file
View File

View File

@@ -1,19 +1,27 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
type -P losetup >/dev/null || return 1 require_binaries losetup || return 1
return 255 return 255
} }
# called by dracut
depends() { depends() {
echo crypt echo crypt
} }
# called by dracut
installkernel() { installkernel() {
instmods loop instmods loop
} }
# called by dracut
install() { install() {
inst_multiple losetup inst_multiple losetup
inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh" inst "$moddir/crypt-loop-lib.sh" "/lib/dracut-crypt-loop-lib.sh"
dracut_need_initqueue dracut_need_initqueue
} }

View File

@@ -2,9 +2,10 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
# If our prerequisites are not met, fail anyways. # If our prerequisites are not met, fail anyways.
type -P mount.cifs >/dev/null || return 1 require_binaries mount.cifs || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && { [[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in ${host_fs_types[@]}; do for fs in ${host_fs_types[@]}; do
@@ -16,15 +17,18 @@ check() {
return 0 return 0
} }
# called by dracut
depends() { depends() {
# We depend on network modules being loaded # We depend on network modules being loaded
echo network echo network
} }
# called by dracut
installkernel() { installkernel() {
instmods cifs ipv6 instmods cifs ipv6
} }
# called by dracut
install() { install() {
local _i local _i
local _nsslibs local _nsslibs

View File

@@ -2,20 +2,21 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
local _arch=$(uname -m) local _arch=$(uname -m)
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
require_binaries normalize_dasd_arg || return 1
return 0 return 0
} }
# called by dracut
depends() { depends() {
echo "dasd_mod"
return 0 return 0
} }
installkernel() { # called by dracut
instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod
}
install() { install() {
inst_hook cmdline 30 "$moddir/parse-dasd.sh" inst_hook cmdline 30 "$moddir/parse-dasd.sh"
inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg

View File

@@ -2,23 +2,29 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
local _arch=$(uname -m) local _arch=$(uname -m)
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1 [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
require_binaries grep sed seq
return 0 return 0
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod
} }
# called by dracut
install() { install() {
inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh" inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh"
inst_multiple dasd_cio_free grep sed seq inst_multiple grep sed seq
inst_multiple -o dasd_cio_free
} }

View File

@@ -15,4 +15,6 @@ if [ -n "$mod_args" ]; then
fi fi
unset dasd_arg unset dasd_arg
dasd_cio_free if [ -x /sbin/dasd_cio_free ] ; then
dasd_cio_free
fi

View File

@@ -0,0 +1,27 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
local _arch=$(uname -m)
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
require_binaries dasd_configure /usr/lib/udev/collect || return 1
return 0
}
# called by dracut
depends() {
echo 'dasd_mod'
return 0
}
# called by dracut
install() {
inst_multiple /usr/lib/udev/collect
inst_hook cmdline 30 "$moddir/parse-dasd.sh"
if [[ $hostonly ]] ; then
inst_rules_wildcard 51-dasd-*.rules
fi
inst_rules 59-dasd.rules
}

View File

@@ -0,0 +1,56 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
create_udev_rule() {
local ccw=$1
local _drv _cu_type _dev_type
local _rule=/etc/udev/rules.d/51-dasd-${ccw}.rules
if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
fi
case "$_cu_type" in
3990/*|2105/*|2107/*|1750/*|9343/*)
_drv=dasd-eckd
;;
6310/*)
_drv=dasd-fba
;;
3880/*)
case "$_dev_type" in
3380/*)
_drv=dasd_eckd
;;
3370/*)
_drv=dasd-fba
;;
esac
;;
esac
[ -z "${_drv}" ] && return 0
[ -e ${_rule} ] && return 0
cat > $_rule <<EOF
ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$ccw", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="$_drv", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
EOF
}
for dasd_arg in $(getargs root=) $(getargs resume=); do
(
case $dasd_arg in
/dev/disk/by-path/ccw-*)
ccw_arg=${dasd_arg##*/}
break;
esac
if [ -n "$ccw_arg" ] ; then
IFS="-"
set -- $ccw_arg
create_udev_rule $2
fi
)
done

View File

@@ -2,15 +2,18 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
# do not add this module by default # do not add this module by default
return 255 return 255
} }
# called by dracut
depends() { depends() {
return 0 return 0
} }
# called by dracut
install() { install() {
inst_multiple -o ps grep more cat rm strace free showmount \ inst_multiple -o ps grep more cat rm strace free showmount \
ping netstat rpcinfo vi scp ping6 ssh \ ping netstat rpcinfo vi scp ping6 ssh \

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() {
require_binaries dcbtool fipvlan lldpad ip readlink || return 1
return 0
}
# called by dracut
depends() {
echo fcoe uefi-lib
return 0
}
# called by dracut
install() {
inst_hook cmdline 20 "$moddir/parse-uefifcoe.sh"
}

View File

@@ -0,0 +1,36 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
command -v getarg >/dev/null || . /lib/dracut-lib.sh
command -v get_fcoe_boot_mac >/dev/null || . /lib/uefi-lib.sh
command -v set_ifname >/dev/null || . /lib/net-lib.sh
print_fcoe_uefi_conf()
{
local mac dev vlan
mac=$(get_fcoe_boot_mac "$1")
[ -z "$mac" ] && return 1
dev=$(set_ifname fcoe $mac)
vlan=$(get_fcoe_boot_vlan "$1")
if [ "$vlan" -ne "0" ]; then
case "$vlan" in
[0-9]*)
printf "%s\n" "vlan=$dev.$vlan:$dev"
dev="$dev.$vlan"
;;
*)
printf "%s\n" "vlan=$vlan:$dev"
dev="$vlan"
;;
esac
fi
# fcoe=eth0:nodcb
printf "%s\n" "$dev:nodcb"
return 0
}
for i in /sys/firmware/efi/vars/FcoeBootDevice-*/data; do
[ -e "$i" ] || continue
print_fcoe_uefi_conf $i > /etc/cmdline.d/40-fcoe-uefi.conf && break
done

View File

@@ -9,15 +9,12 @@
# future use. # future use.
PATH=/usr/sbin:/usr/bin:/sbin:/bin PATH=/usr/sbin:/usr/bin:/sbin:/bin
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
# Huh? Missing arguments ?? # Huh? Missing arguments ??
[ -z "$1" -o -z "$2" ] && exit 1 [ -z "$1" -o -z "$2" ] && exit 1
export PS4="fcoe-up.$1.$$ + "
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
netif=$1 netif=$1
dcb=$2 dcb=$2

View File

@@ -2,28 +2,24 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
# FIXME require_binaries dcbtool fipvlan lldpad ip readlink || return 1
# If hostonly was requested, fail the check until we have some way of
# knowing we are booting from FCoE
[[ $hostonly ]] || [[ $mount_needs ]] && return 1
for i in dcbtool fipvlan lldpad ip readlink; do
type -P $i >/dev/null || return 1
done
return 0 return 0
} }
# called by dracut
depends() { depends() {
echo network rootfs-block echo network rootfs-block
return 0 return 0
} }
# called by dracut
installkernel() { installkernel() {
instmods fcoe 8021q edd instmods fcoe 8021q edd
} }
# called by dracut
install() { install() {
inst_multiple ip dcbtool fipvlan lldpad readlink inst_multiple ip dcbtool fipvlan lldpad readlink

View File

@@ -2,14 +2,17 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh # ex: ts=8 sw=4 sts=4 et filetype=sh
# called by dracut
check() { check() {
test -f /etc/fstab.sys || [[ -n $add_fstab || -n $fstab_lines ]] test -f /etc/fstab.sys || [[ -n $add_fstab || -n $fstab_lines ]]
} }
# called by dracut
depends() { depends() {
echo fs-lib echo fs-lib
} }
# called by dracut
install() { install() {
[ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys [ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys
inst_hook pre-pivot 00 "$moddir/mount-sys.sh" inst_hook pre-pivot 00 "$moddir/mount-sys.sh"

Some files were not shown because too many files have changed in this diff Show More