Compare commits

...

143 Commits

Author SHA1 Message Date
Harald Hoyer
00efe708ca NEWS, AUTHORS: update 2020-03-04 11:43:22 +01:00
Harald Hoyer
0c983cdc49 TEST-14-IMSM: clear marker disk 2020-03-04 11:06:04 +01:00
Harald Hoyer
821e08da03 fedora-test-github.sh: only fetch tags, if building rpm 2020-03-04 11:06:04 +01:00
Marek Marczykowski-Górecki
ebeed55c07 Consider also drm_dev_register when looking for gpu driver
DRM drivers are filtered for drm_crtc_init symbol,
but not all drivers use it. Especially, cirrus driver
doesn't use it since Linux 5.2.

The practical result is text plymouth theme instead of graphical when in qemu.

Fix it by looking also for drm_dev_register symbol.
Suggested by @haraldh
Fixes #712
2020-03-04 10:41:04 +01:00
Harald Hoyer
991100ba7a .github/workflows: bump timeout to 45min 2020-03-04 09:23:46 +01:00
Daniel Molkentin
f2d33a7f61 90kernel-modules: Add PCI host controller modules
Currently there is no usb support on RPi4 in the
initrd phase as the pcie-brcmstb module is missing.
If part of the boot is handled from a USB stick
(e.g. with Ignition), the stick cannot be accessed.

Reference: boo#1162669
2020-03-04 09:23:09 +01:00
Daniel Molkentin
7dc918cad1 90crypt: install crypt-run-generator in non-systemd environments 2020-03-04 09:22:09 +01:00
Daniel Molkentin
452cb40497 90crypt: Do not call cryptsetup in a systemd environment
systemd provides its own cryptsetup facilities, and the
cryptsetup binary might not even exist, failing
to execute the discard flag processing.

Fixes #602
2020-03-04 09:22:09 +01:00
Daniel Molkentin
286f2a04a1 Merge branch 'regenerate_all' 2020-03-03 20:09:45 +01:00
nabijaczleweli
38c8fed48a Enable resume module if hibernation's enabled on the host
Ref: 34b56de12a
Fixes https://github.com/dracutdevs/dracut/issues/496
2020-03-03 19:51:08 +01:00
Daniel Molkentin
5b1d8bcc58 Merge branch 'master' into regenerate_all 2020-03-03 19:25:16 +01:00
Harald Hoyer
c7403700df TEST-04-FULL-SYSTEMD: use seperate marker disk for root creation 2020-03-03 16:56:43 +01:00
Topi Miettinen
ce62465caf Make lsinitrd usable for images made with Debian mkinitramfs
Debian mkinitramfs does not create the file 'early_cpio', so detection
of additional cpio images fails and only the first cpio is listed.

I checked some Arch and Gentoo initramfs files and these didn't have
'early_cpio' either, but they also have only one cpio part.

Fix this so that if check for 'early_cpio' fails, check if firmware
files ('/kernel/*/microcode/*.bin') exist.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2020-03-03 12:48:58 +01:00
Harald Hoyer
b3d40a4390 TEST-04-FULL-SYSTEMD: change error reporting 2020-03-02 14:55:51 +01:00
Lucas C. Villa Real
3d2a6d29d4 dracut_mkdir(): create parent directories as needed. 2020-03-02 14:48:11 +01:00
Harald Hoyer
1edee0c4a1 test/TEST-0[34] remove qemu return check
remove check of qemu return code $?

seems like it randomly returns with != 0
2020-03-02 14:42:27 +01:00
Topi Miettinen
ecbdff68af Don't resolve libraries lazily if tmpdir is mounted with 'noexec'
If the temporary directory for images is mounted with 'noexec', dracut
would construct unbootable images because most dynamic libraries
aren't installed. Avoid this by not resolving library dependencies
lazily if the temporary directory is mounted with 'noexec'.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2020-03-02 09:56:26 +01:00
Alexander Miroshnichenko
3ea80545d6 stratis module: fix start order
Change start script order to pre-mount as stratis require fully initialized udev.
2020-02-28 20:43:01 +01:00
Frantisek Sumsal
ef8915d7af fcoe/fcoe-genrules.sh: use $name instead of $env{INTERFACE}
Followup to a8ba1c4e25 and
11a5501d0f
2020-02-28 20:41:37 +01:00
Frantisek Sumsal
7261a0540a github: fetch git tags before testing
GitHub workflows fetch a clone of the dracut repository which doesn't
contain git tags, thus "breaking" the RPM build in certain situations
i.e.:
DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`,
which in full git clone returns a tag with a numeric version. However,
without tags it returns SHA of the last commit, which later propagates into
`Provides:` attribute of the built RPM and can break dependency tree when
installed
2020-02-28 20:39:35 +01:00
Frantisek Sumsal
11a5501d0f cms/cmssetup.sh: use $name instead of $env{INTERFACE}
Followup to a8ba1c4e25
2020-02-28 16:32:11 +01:00
Frantisek Sumsal
355df861da test: build docs when running TEST-99-RPM 2020-02-28 16:31:43 +01:00
Frantisek Sumsal
8cba0ff833 github: add TEST-99 to the workflow 2020-02-28 16:31:43 +01:00
Frantisek Sumsal
f1dc2180d4 TEST-99-RPM: ignore weak dependencies in dnf
Weak dependencies are useless for this test and pollute the chroot,
causing unexpected fails.
2020-02-28 16:31:43 +01:00
Frantisek Sumsal
3f4ffebf33 Makefile: fix RPM build
`make rpm` usually chose `/tmp` as the `$rpmbuild` dir, which breaks the
dracut build, since it needs to execute `./configure`, but `/tmp` is
mounted with `-o noexec`, leading to:

```
/var/tmp/rpm-tmp.SwEhJO: line 46: ./configure: Permission denied
error: Bad exit status from /var/tmp/rpm-tmp.SwEhJO (%build)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.SwEhJO (%build)
```

Switching to `/var/tmp` helps in this case.
2020-02-28 16:31:43 +01:00
Harald Hoyer
d5088b1703 TEST-12-RAID-DEG: harden test
use whole sda as marker disk and clear it completly between test runs
2020-02-28 14:41:15 +01:00
Harald Hoyer
9ca53063ee test: use dd to write status to marker disk 2020-02-28 14:41:15 +01:00
Harald Hoyer
69341c9572 fedora-test.sh: set logtee timeout to 5 minutes 2020-02-28 14:41:15 +01:00
Harald Hoyer
55a974bae6 fedora-test.sh / fedora-test-github.sh: don't build the documentation
don't build the documentation, if running a test
2020-02-28 13:02:50 +01:00
Harald Hoyer
3703ec8672 Disable NetworkManager tests for Fedora 30 2020-02-28 12:53:48 +01:00
Harald Hoyer
74ba8f9e1d .travis.yml: add note about test container 2020-02-28 12:53:42 +01:00
Harald Hoyer
a3f73298f2 testsuite: refactor qemu options
- refactor common qemu options
- fix the ens[0-9] interface shift
- add split network-[legacy|network] tests
2020-02-28 12:53:42 +01:00
Harald Hoyer
4b60a34715 Revert "test: run-qemu refactor common qemu parameters"
This reverts commit 77537bf2d7.

Sorry, for the noise!
2020-02-28 08:51:44 +01:00
Harald Hoyer
7374391434 Revert "test/run-qemu: add "-serial stdio""
This reverts commit c6c588d648.
2020-02-28 08:51:31 +01:00
Harald Hoyer
c6c588d648 test/run-qemu: add "-serial stdio" 2020-02-28 08:47:52 +01:00
Harald Hoyer
77537bf2d7 test: run-qemu refactor common qemu parameters 2020-02-28 08:39:31 +01:00
Harald Hoyer
7c51256eb2 TEST-40-NBD: disable again
NBD is still too flaky and hangs hard sometimes
2020-02-27 16:44:28 +01:00
Harald Hoyer
ba66cb2789 TEST-04-FULL-SYSTEMD: more info on failure 2020-02-27 16:42:21 +01:00
Harald Hoyer
2d75433cd7 test/test-functions: colorize startup 2020-02-27 16:17:23 +01:00
Harald Hoyer
58ee6dc7f9 .travis.yml: fix docker pull 2020-02-27 15:51:12 +01:00
Harald Hoyer
0d33ba030b test/TEST-40-NBD/test.sh: bail out early if mount fails 2020-02-27 15:27:30 +01:00
Harald Hoyer
63b67a48f9 nbd/parse-nbdroot.sh: don't create mount unit
let the generator do its thing
2020-02-27 15:27:30 +01:00
Harald Hoyer
4bd0ab61b2 test: remove "sudo" calls in test scripts 2020-02-27 15:27:30 +01:00
Harald Hoyer
b4de4f287f test: do btrfs filesystem sync in create-root.sh 2020-02-27 15:27:30 +01:00
Harald Hoyer
eb8856a58c TEST-40-NBD: run the working tests 2020-02-27 15:27:30 +01:00
Harald Hoyer
3c5036a62f TEST-03-USR-MOUNT: more debugging 2020-02-27 15:27:30 +01:00
Harald Hoyer
074ac62576 TEST-04-FULL-SYSTEMD: report failure on rootfs creation 2020-02-27 15:27:30 +01:00
Harald Hoyer
53e299e6f4 TEST-20-NFS/test.sh TEST-30-ISCSI/test.sh reduce debug output 2020-02-27 15:27:30 +01:00
Harald Hoyer
2996d9e56f test/TEST-60-IFCFG/test.sh: fixed qemu hubport netifs
netifs are offset by one if qemu hubport is used
2020-02-27 15:27:30 +01:00
Harald Hoyer
2f78bafa4b tests: untabify, reformat 2020-02-27 15:27:30 +01:00
Harald Hoyer
f7b9356c9e test: fix server init scripts for network 2020-02-27 15:27:30 +01:00
Harald Hoyer
3aae122c4b Add github workflow 2020-02-27 15:27:30 +01:00
Harald Hoyer
93be2bc6ab add DRACUT_NO_XATTR global environment variable
Useful, if you know, that those can't be copied anyway.
2020-02-27 13:49:21 +01:00
Harald Hoyer
a8ba1c4e25 network-legacy/net-genrules.sh: use $name instead of $env{INTERFACE}
The original behavior of $env{INTERFACE} was undocumented and changed in
the recent udev versions, breaking the ability to bring up networking
reliably. Switching to $name directive should fix this issue.

Related links:
 - systemd/systemd#12700 (udev PR)
 - systemd/systemd#12291 (related udev issue)
 - systemd/systemd#14935 (this issue, udev side)
 - #732 (this issue, dracut side)

Fixes: #732
2020-02-27 13:49:21 +01:00
Jonathan Lebon
4985aa8c6e network-legacy/ifup: fix ip=dhcp,dhcp6 setup_net logic
Previously, we were doing `setup_net` from `ifup` for any setup that
wasn't DHCP, since those are already taken care of by `dhclient-script`.

The issue is that the case-statement we use to detect this doesn't catch
options like `ip=dhcp,dhcp6`.

Fix this by reworking the logic here to just check if a
`setup_net_$netif.sh` hook exists. If so, then we know that `setup_net`
will be called for this interface later.

This was causing issues in RHCOS which now ships with `ip=dhcp,dhcp6` to
support IPv6 environments[1]. The code here would make us do `setup_net`
pre-emptively which IIUC would then cause the initqueue to finish
earlier even if we had more udev netif events to process.

[1] https://github.com/coreos/coreos-assembler/pull/1067

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1803926
2020-02-25 14:34:58 +01:00
Jonathan Lebon
7795fde44c network-legacy/ifup: drop redundant if-statement
No need to check that `$ret` is 0, we're already running inside an
if-statement block which checks this.
2020-02-25 14:34:58 +01:00
Harald Hoyer
2dc0cb50e3 Revert "github workflow"
This reverts commit 150cea0336.
2020-02-25 14:06:36 +01:00
Harald Hoyer
150cea0336 github workflow 2020-02-25 14:01:13 +01:00
Donovan Tremura
4237aeb040 Support the EFI Stub loader's splash image feature.
Checks if `uefi_splash_image` exists in `dracutsysroot` if not unset
`uefi_splash_image`. Alternate Value parameter expansion adds section-vma
for splash image to EFI stub loader when the path to image is valid and
not an empty file.

I did not test on other distributions, but on Arch Linux the `systemd`
package includes a splash image at the path
`/usr/share/systemd/bootctl/splash-arch.bmp`. Perhaps, if this is a
common practice, a default image could be gathered from that directory.

It is required that the image be in bitmap (`.bmp`) format according to
`splash.c`.

The code for `stub.c` and `splash.c` can be found at:
https://github.com/systemd/systemd/blob/master/src/boot/efi/stub.c
https://github.com/systemd/systemd/blob/master/src/boot/efi/splash.c
2020-02-20 11:03:30 +01:00
Harald Hoyer
16abea2592 systemd: install systemd-tty-ask-password-agent systemd-ask-password
fixes https://github.com/dracutdevs/dracut/issues/726
2020-02-18 15:33:23 +01:00
Eugene S. Sobolev
c7ee6b3dbb network/net-lib.sh: Configure all iBFT interfaces
Added boolean command line option rd.iscsi.mp
2020-02-14 10:42:34 +01:00
Renaud Métrich
cdc9cd0e41 dracut.sh: added help for --regenerate-all 2020-02-13 11:37:13 +01:00
Lukas Nykryn
76f6566fd7 Revert "wait for IPv6 RA if using none/static IPv6 assignment"
This reverts commit c603419030.

wait_for_ipv6_dad_link is only called from dhclient script,
so the original intent "wait for IPv6 RA if using none/static IPv6 assignment"
does not seem to be correct.

Anyway, this brings an issue on isolated networks, where you don't
have any routes outside. dhclient-script hangs on this check
and after it times out, dhclient is able to set the address normally.
2020-02-11 14:23:27 +01:00
Lukas Nykryn
962310483f dhclient-script: ipv6 uses different variables for nameservers
new_domain_name_servers and new_domain_search is only provided vit IPv4

see: https://src.fedoraproject.org/rpms/dhcp/blob/HEAD/f/dhclient-script#_148
2020-02-11 14:23:03 +01:00
Lukas Nykryn
579fbb9fc4 40network: bump rd.net.timeout.carrier to 10 seconds
On some devices kernel currently takes 5.2 seconds to detect carrier,
so let's make the default in dracut bit more sensible.

See also https://bugzilla.redhat.com/show_bug.cgi?id=1772010
2020-02-10 14:37:15 +01:00
Daniel Cordero
f668e7174e dracut.sh: check kmoddir is properly formed
Due to the way dracut-install handles modules from custom kmoddirs, add
a test that ensures the kmoddir argument seems sane.

In addition to erroring out, provide some guidance on how to proceed, as
well as a method of skipping the test via environment variable.
2020-01-27 09:02:46 +01:00
Daniel Cordero
1bef2934d7 dracut-install: fetch kernel modules from kmoddir
dracut, when passing --kmoddir, would only install modules that exist at
the same location as it will appear in the initramfs.

For most (possibly all) outputs, the output path would be /lib/modules,
so previously all kernel modules must be copied there or the module
installation silently fails.

Now use the original path variable, and install to the shortened path
variable (as calculated by kerneldirlen).

Note: This means that the argument to --kmoddir (and the modules filetree)
should be a directory that ends in 'lib/modules/$kernelversion'.
2020-01-27 09:02:46 +01:00
Harald Hoyer
350ec5d9dd uefi-lib/uefi-lib.sh: fixed script for bash version 5
bash 5 `read` behaves differently and returns != 0 for 0 bytes read

fix it with the best effort
2020-01-24 13:42:46 +01:00
Jonas Witschel
d613d88dd2 ucode: use microcode found in packed cpio images
Some distributions (Arch, Gentoo) ship prepacked microcode images. These
are cpio images that follow the structure specified in the Linux kernel
documentation (x86/microcode.rst, "Early load microcode"), the same
structure dracut uses for its early microcode images.

In case of Arch Linux, the microcode for Intel CPUs is currently only
available in this packed form, /usr/lib/firmware/intel-ucode does not
exist. This commit adds a way to make use of these images on such
systems by unpacking them to the early cpio directory. (Note that the
packed image cannot be used directly since dracut might need to add ACPI
tables to the early initramfs.)

This approach has the drawback that it is not possible to control the
selection of CPUs to be included in the microcode file in host-only
mode, so we only try it as a last ressort if no unpacked microcode could
be found in fw_dir.

The list of possible file names for the packed microcode image is taken
from GRUB (cf. GRUB_EARLY_INITRD_LINUX_STOCK), but can be adapted by
setting "early_microcode_image_name" (and "early_microcode_image_dir")
in a dracut configuration file.
2020-01-24 09:06:32 +01:00
Harald Hoyer
2ee69a40c8 add missing crypto modules for aarch64
Fixes https://github.com/dracutdevs/dracut/issues/711
2020-01-23 13:47:53 +01:00
Jonathan Lebon
d0de58f232 network-legacy/ifup: nuke pid and lease files if dhclient failed
Otherwise we won't retry dhclient again on that interface. In
FCOS/RHCOS, we want to bake in `ip=dhcp,dhcp6` so we automatically try
getting a DHCPv6 lease if DHCPv4 failed.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1793591
2020-01-23 09:32:25 +01:00
Kairui Song
f4ad2e5c89 90kernel-modules: don't install any block driver if not needed
If hostonly mode is in use, and there isn't any block device included
as hostonly device, then the initramfs won't need any block driver.

Eg. for kdump built image, there could be only one nfs mount point,
or the initramfs may only execute some network operation then reboot.

In such case, skip block driver installation to save space and time.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-01-17 07:26:24 +01:00
Jan Macku
cb86c560b0 Write dns values passed by ip argument to ifcfg-* files 2020-01-14 09:33:38 +01:00
Jan Macku
70b19acf94 Replace ln with systemctl 2020-01-14 09:29:51 +01:00
Jacob Wen
d5e818f349 35network-legacy: using 'replace' instead of 'add' to add route
This is a simple trick to honor RFC 3442:
If the DHCP server returns both a Classless Static Routes option and
a Router option, the DHCP client MUST ignore the Router option.

Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
2020-01-14 09:26:12 +01:00
Kairui Song
4598b5540e 95iscsi: Fix /etc/iscsi installation
Previous all files are installed with inst_dir, which will not install
the files under /etc/iscsi/, and it create folders with the same of the
files which is wrong.

Now only use inst_dir to install the config dir and ensure it
exists, and use inst_multiple to install the config files.

Signed-off-by: Kairui Song <kasong@redhat.com>
2020-01-14 09:25:29 +01:00
Lubomir Rintel
5965710e01 network-manager: don't run NetworkManager when there are no connections
NetworkManager would unnecessarily bring up the devices, colliding with
further attempts to rename the devices.

This is arguably a NetworkManager bug and should eventually be fixed there.
Running NetworkManager without the connection is unnecessary regardless.
2020-01-14 09:24:42 +01:00
Brian C. Lane
05b75703b0 Check .hmac of boot.iso in fips mode
Instead of carrying the kernel and hmac in the install.img (which takes
up more space) use the vmlinuz installed under /images/pxeboot/ and the
.hmac in the install.img /boot.

This check is triggered by the presence of /run/install/repo/images/pxeboot/vmlinuz

Related: rhbz#1782737
2020-01-14 09:23:21 +01:00
Colin Walters
7fea85ce5f modules/network-manager: Install ip
We don't need `ip` but having it is *really* useful for people debugging
in an emergency shell.
2020-01-14 09:17:22 +01:00
Lukas Nykryn
2181c80c91 network-legacy/ifup: dhclient should be started in oneshot mode
since we handle the retries explicitly via rd.net.dhcp.retry

Without -1 if user sets ip=dhcp6 and there is no dhcp on the network,
dhclient seems to wait indefinitely, ignoring rd.net.timeout.dhcp
2020-01-14 09:16:48 +01:00
Lukas Nykryn
212043f94d network-legacy/ifup: fix typo when calling dhclient --timeout 2020-01-14 09:16:23 +01:00
Alexey Kodanev
958ca9e912 fips: add 'ofb' and 'cts' block cipher modes
Add cts, Linux-5.0 commit:
* 196ad6043e9f ("crypto: testmgr - mark cts(cbc(aes)) as FIPS allowed")

Linux 4.20 commits for 'ofb':
* dfb89ab3f0a7 ("crypto: tcrypt - add OFB functional tests")
* e497c51896b3 ("crypto: ofb - add output feedback mode")

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
2019-11-29 18:56:56 +01:00
Petr Tesarik
7d47d1c423 95ssh-client: improve nsswitch.conf parser
The actual syntax of nsswitch.conf is slightly different from the
current regular expression:

- A comment can appear anywhere, not just at the beginning of a
  line.
- Action items take the general form [STATUS=ACTION] or
  [!STATUS=ACTION] (with some optional whitespace).
- A service name cannot include a colon. This is a nitpick,
  because there should never be more than a single colon per
  line.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
2019-11-22 17:54:00 +01:00
Lubomir Rintel
ff2043fb42 Revert "travis: run TEST-14-IMSM on Fedora 29"
We're on Fedora 31 that should be good enough for this test.

This reverts commit 7a2503ab8c.
2019-11-13 10:08:32 +01:00
Daniel Molkentin
8996d3dfcd test: use hosts randomness, not rngd 2019-11-13 09:07:45 +01:00
Daniel Molkentin
c226bfdda7 test: Provide host's randomness via virtio 2019-11-13 09:07:45 +01:00
Lubomir Rintel
9a752007b3 TEST-30-ISCSI: test iBFT boot as well
Setting up the machinery to boot with the aid of real networked boot loader
(such as iPXE) would involve much hassle, including possibly serving the kernel
and initrd via TFTP, etc.

Let us generate the iBFT table ourselves, with a Perl script. Include the
pregenerated table as well so that the test run won't depend on Perl. In the
end it's just reproducibly built static data, totally independent of the host
system.
2019-11-12 13:27:59 +01:00
Lubomir Rintel
80238086ab git2spec: include contents of binaries in patches
The patches don't include the binary files, such as the iBFT table for testing,
which makes %autosetup sad.
2019-11-12 13:27:59 +01:00
Daniel Molkentin
50057af19c Documentation: dynamically set current version
Fixes #369
2019-11-12 13:24:41 +01:00
Lubomir Rintel
e863807685 spec: dracut-network is happy with either NM or dhclient 2019-11-12 13:11:40 +01:00
Lubomir Rintel
f3f081e542 TEST-{20,50,60,70): set MACAddressPolicy=keep
New systemd defaults to generating MAC addresses for software devices (whereas
previously they would inherit them from the first enslaved slave).

Sadly, among the things this breaks is our test fixture, where the dhcp servers
are configured to expect a particular MAC address. Disable this for the
affected tests, which are essentially the ones that use bridges and bonds.
2019-11-11 21:17:31 +01:00
Lubomir Rintel
c9391e8f6a TEST-{20,30,31,40,50,60,70): wait for server interfaces to come up
The network interfaces appear asynchronously and sometimes just too late,
after we're already halfway throught server-init.sh:

  + ip link set dev eth0 name ens3
  Cannot find device "eth0"
  + ip addr add 192.168.50.1/24 dev ens3
  Cannot find device "ens3"
  + dhcpd -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases ens3 ens5
  ...
  [    8.040825] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:01:12:34:56
  [    8.047105] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
  ...
  No subnet declaration for ens3 (no IPv4 addresses).
  ** Ignoring requests on ens3.  If this is not what
     you want, please write a subnet declaration
     in your dhcpd.conf file for the network segment
     to which interface ens3 is attached. **

Whoopsie. Let's ensure all the interfaces are there before we proceed
fiddling around with them.
2019-11-11 21:16:47 +01:00
Lubomir Rintel
031e949c62 TEST-50-MULTINIC: fix how a basename is determined
Analogous to what commit 687e17aa7f ("network-manager: fix getting of
ifname from the sysfs path") fixes.
2019-11-11 21:15:52 +01:00
Lubomir Rintel
10f8438c1e logtee: time out after a period of no output
Travis cuts us short after 10 minutes of slience, giving us no chance to puke
out the output. Be faster.
2019-11-11 20:30:45 +01:00
Lubomir Rintel
f5d48a31db Revert "travis: run TEST-13-ENC-RAID-LVM on Fedora 29"
We're on Fedora 31 that should be good enough for this test.

This reverts commit 8238f41b34.
2019-11-11 20:04:58 +01:00
Lubomir Rintel
fe54c9b7a9 TEST-13-ENC-RAID-LVM: increase memory
In Fedora 31 it ooms until it has, uh, twice the memory.
2019-11-11 20:04:58 +01:00
Doan Tran Cong Danh
41a37bc626 dmraid: require kpartx binary
dmraid requires kpartx to activate device mapper.
But kpartx is only a recommend dependency.

Check for kpartx's existent first.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-10 01:47:30 +01:00
Doan Tran Cong Danh
cf31ed2ae6 multipath: require kpartx binary
multipath requires kpartx to activate device mapper.
But kpartx is only a recommend dependency.

Check for kpartx's existent first.

Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-10 01:47:30 +01:00
Doan Tran Cong Danh
62f27ee6f1 configure: find cflags and libs for fts on musl
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
2019-11-10 01:47:30 +01:00
Mikhail Novosyolov
718aefda13 Ensure that udevadm --version reported an integer
If it is not an integer, further script will fail unexepectedly.
2019-11-05 14:26:14 +01:00
Mikhail Novosyolov
6e761674ad Fail if udevadm could not be run
Fixes: #668
2019-11-05 14:26:14 +01:00
Lubomir Rintel
687e17aa7f network-manager: fix getting of ifname from the sysfs path
commit 5e0f8c8a4c ('network-manager: remove useless use of basename')
somewhat carelessly didn't take into account that $_i has a slash at
the end which made the result of the ## substitution be just an empty
string.

The slash was put to the end of /sys/class/net/*/ to make sure we're only
iterating directories, but it's not strictly necessary. In an unlikely case
something else than a directory appears in /sys/class/net/, we'll already deal
with it gracefully. Remove it.

This fixes the TEST-30-ISCSI test.
2019-11-05 14:18:01 +01:00
Thomas Blume
3f4bbca751 keep network device naming scheme on upgrade 2019-11-05 11:37:22 +01:00
Jonathan Lebon
cc6792a01e 01fips: trim off GRUB boot device from BOOT_IMAGE
E.g. in RHCOS, the `BOOT_IMAGE` from the cmdline is:

(hd0,gpt1)/ostree/rhcos-e493371e5ee8407889029ec979955a2b86fd7e3cae5a0591b9db1cd248d966e8/vmlinuz-4.18.0-146.el8.x86_64

Which of course is a GRUB thing, not an actual pathname we'll be able to
resolve. In fact, we can simply scrap it off from the variable. Our code
is already able to handle both cases: whether the device refers to a
separate boot partition, or just the root filesystem with a regular
`/boot` directory.
2019-10-31 11:12:36 +01:00
Jonathan Lebon
ca4aa84851 01fips: add / in BOOT_IMAGE_HMAC filename for clarity
It's already the case the `BOOT_IMAGE_PATH` today, in the non-empty
case, includes a trailing `/`, but let's add it to the path we build
here too to make it more obvious.
2019-10-31 11:12:36 +01:00
Jonathan Lebon
ba813779bf 01fips: run sha512hmac from directory HMAC file directory
That way, the HMAC file can contain a relative path instead of an
absolute one. The issue is that right now the kernel RPM bakes the
`/boot/vmlinuz-${kver}` path into the HMAC file which poses an issue for
rpm-ostree systems (and any other system where the kernel isn't simply
in the top-level `/boot`.

For now, we're hacking around this in rpm-ostree:
https://github.com/coreos/rpm-ostree/pull/1934

Though I'd like to propose the same change in the kernel spec file.
2019-10-31 11:12:36 +01:00
Jonathan Lebon
9e759aa969 01fips: fix HMAC file path resolution
There is a small regression in #343: when handling the 'separate boot
partition' case, we're checking for the kernel image in the wrong
location: `BOOT_IMAGE` is the `/boot`-relative path to the kernel image,
so `/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}` expands to e.g.
`/boot/mysubdir1/mysubdir2/mysubdir1/mysubdir2/vmlinuz...`.

We should be using `BOOT_IMAGE_NAME` here instead (and in fact, the next
if-statement does this correctly, so it might've just been accidentally
left out of #343).
2019-10-31 11:12:36 +01:00
Harald Hoyer
27f758e12c iscsi: remove bashisms 2019-10-25 14:29:17 +02:00
Böszörményi Zoltán
4efcd19a4e Add documentation and Yocto examples
Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Böszörményi Zoltán
0595a79b19 Fix version reported by dracut --help
Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Böszörményi Zoltán
9d88e89350 Set systemdutildir correctly
Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Böszörményi Zoltán
b552d364a3 Handle -r / --sysroot option in dracut.sh
It was documented but not implemented.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Böszörményi Zoltán
a01204202b Allow running on a cross-compiled rootfs
For the shell scripts, new environment variables were introduced.

dracutsysrootdir is the root directory, file existence checks use it.

DRACUT_LDCONFIG can override ldconfig with a different one that works
on the sysroot with foreign binaries.

DRACUT_LDD can override ldd with a different one that works
with foreign binaries.

DRACUT_TESTBIN can override /bin/sh. A cross-compiled sysroot
may use symlinks that are valid only when running on the target
so a real file must be provided that exist in the sysroot.

DRACUT_INSTALL now supports debugging dracut-install in itself
when run by dracut but without debugging the dracut scripts.
E.g. DRACUT_INSTALL="valgrind dracut-install or
DRACUT_INSTALL="dracut-install --debug".

DRACUT_COMPRESS_BZIP2, DRACUT_COMPRESS_LBZIP2, DRACUT_COMPRESS_LZMA,
DRACUT_COMPRESS_XZ, DRACUT_COMPRESS_GZIP, DRACUT_COMPRESS_PIGZ,
DRACUT_COMPRESS_LZOP, DRACUT_COMPRESS_ZSTD, DRACUT_COMPRESS_LZ4,
DRACUT_COMPRESS_CAT: All of the compression utilities may be
overridden, to support the native binaries in non-standard places.

DRACUT_ARCH overrides "uname -m".

SYSTEMD_VERSION overrides "systemd --version".

The dracut-install utility was overhauled to support sysroot via
a new option -r and fixes for clang-analyze. It supports
cross-compiler-ldd from
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f

DRACUT_INSTALL_PATH was introduced so dracut-install can work with
a different PATH. In a cross-compiled environment (e.g. Yocto), PATH
points to natively built binaries that are not in the host's /bin,
/usr/bin, etc. dracut-install still needs plain /bin and /usr/bin
that are relative to the cross-compiled sysroot.

The hashmap pool allocate_tile/deallocate_tile code was removed
because clang-analyze showed errors in it. hashmap_copy was removed
because it wasn't used and clang-analyze showed errors in it.

DRACUT_INSTALL_LOG_TARGET and DRACUT_INSTALL_LOG_LEVEL were
introduced so dracut-install can use different settings from
DRACUT_LOG_TARGET and DRACUT_LOG_LEVEL.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2019-10-25 11:58:58 +02:00
Kairui Song
89bc1aa324 Fine tune mksquashfs options for squash module
Drop some unneeded metadata in the squash image, and print the error
message if something went wrong.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-10-25 11:52:05 +02:00
Jiri Konecny
0d609ae274 Support only fips=1 not fips
It looks like only the 'fips=1' is really supported and it is working
correctly. So instead of failing on 'fips' not clear way give user
information why we are failing.
2019-10-25 11:47:04 +02:00
Jiri Konecny
7ff0fcb723 Fix boot with fips without a value
If you boot system with `fips` and not `fips=1` then you will get unary
operator expected error. This will fix this problem.
2019-10-25 11:47:04 +02:00
Daniel Molkentin
feebf17187 ucode: properly include early only ucode
Intel has notified us that some microcode updates are not safe
to be applied during runtime. To accomodate for that, microcode
files shipped by SUSE and openSUSE have an '.early' postfix such
that triggering

/sys/devices/system/cpu/microcode/reload

from a booted system cannot pick up the ucode by accident, while
still allowing the code to be picked up during initrd time.

This change is needed to make this scheme work also in a hostonly
situation.

Currently, this affects only 06-4f-01, which is now 06-4f-01.early.

If a distro does not change the filename, the behavior does not
change.

Reference: osc#1098915
2019-10-25 11:39:16 +02:00
Daniel Molkentin
e3edd247ce 95iscsi: handle qedi like bnx2i
The new qedi driver needs to be handled just like
the bnx2i driver, so update 95iscsi scripts to do this.

References: bsc#1113712

Signed-off-by: Lee Duncan <lduncan@suse.com>
2019-10-25 11:38:17 +02:00
Nathan Rini
916ac45cbe swap for loop to POSIX shell compat 2019-10-25 11:37:43 +02:00
Nathan Rini
0bac59ee5e typo bugfix 2019-10-25 11:37:43 +02:00
Nathan Rini
fb3d292800 fix off by one 2019-10-25 11:37:43 +02:00
Nathan Rini
1b38fa412c bugfix for initialization
exit with error if all retries fail
2019-10-25 11:37:43 +02:00
Nathan Rini
66bfa66add add sleep and max number of retries 2019-10-25 11:37:43 +02:00
Nathan Rini
678627f349 retry image download forever 2019-10-25 11:37:43 +02:00
Frederick Grose
3c8c807db1 iso-scan: Release resources on iso-scan boots with rd.live.ram
Unmounting the image iso, detaching its loop device, and unmounting
its parent partition can simplify installation to the parent disk.

Note that programs or scripts using the /run/initramfs/live mount
point will fail.
2019-10-25 11:35:15 +02:00
Martin Wilck
78efd6988e iscsi: fix error messages with iSCSI root
Fixes these error messages during intird build:

cat: '/sys/devices/platform/host2/flashnode_sess-*/is_boot_target': No such file or directory
/usr/lib/dracut/modules.d/95iscsi/module-setup.sh: line 91: [: -eq: unary operator expected
cat: '/sys/devices/platform/host3/flashnode_sess-*/is_boot_target': No such file or directory
/usr/lib/dracut/modules.d/95iscsi/module-setup.sh: line 91: [: -eq: unary operator expected
2019-10-25 11:34:24 +02:00
Norbert Lange
1aa2d1eddf fix check whether the rootfs init is usable
this now correctly handles:
-   plain files
-   relative symlinks
-   absolute symlinks
2019-10-25 11:30:43 +02:00
tpgxyz
519186e9e6 add mksh support 2019-10-25 11:29:30 +02:00
Harald Hoyer
64082786b2 dracut.spec: add 90ppcmac 2019-10-25 09:23:30 +02:00
q66
159175d525 modules.d: add a module for early fan control on PowerPC Macs
The goal of this module is to enable automatic loading of the
thermal/fan control modules on PowerPC based Macs, as on some
modular kernel configurations this will not happen automatically
which will result in the fans spinning up to 100% until they are
manually loaded.

This is especially a problem in live systems where it takes some
time to boot up and the spin-up happens before the system even
leaves initramfs.
2019-10-25 09:20:04 +02:00
Martin Wilck
9b9dd9993e 35network-legacy: only skip waiting for interfaces if netroot is set
Commmit 8a33e52e2f94 assumes that dracut's work is done if a root device
is found. This holds usually for booting computers, but it may be wrong
for other environments.

Only short-cut the waiting if $netroot is also set.

Fixes: 8a33e52e2f94 ("network: stop waiting for interfaces if root device is present")
References: bsc#1152006
2019-10-25 09:18:12 +02:00
Martin Wilck
c0e5e48aab fixup "Dracut: only login to one target at a time"
On SLE15-SP1 at least, iscsiadm doesn't support combining --op and --login":

> # iscsiadm -m node -T iqn.2018-06.de.suse.zeus:01 --op=update  --name=node.startup --value=onboot --login
> iscsiadm: Invalid parameters. Login/logout and op passed in

This breaks iSCSI login in initrd, and thus, iSCSI boot.

Fix it by not coalescing everything into a single iscsiadm command.
Fixes: a59b776bc215 ("Dracut: only login to one target at a time")
References: bsc#1152650
2019-10-25 09:18:12 +02:00
Martin Wilck
28749d9973 iscsiroot: remove bashisms
According to the dracut README, module code to be run in
the initrd must be POSIX-compliant. Replace remaining
bashisms (as reported by checkbashisms) with POSIX compliant
code.

The use of "type" is not strictly POSIX compliant, but it's
all over the place in dracut code. dash supports it, anyway.
2019-10-25 09:18:12 +02:00
Martin Wilck
ac7582af48 iscsiroot: try targets only once
In multipath scenarios, "iscsiadm -m node" may contain
several records with the same target.
There's no point in trying "iscsiadm --login" multiple
time for the same target, through the same portal.

Moreover, warn if the desired target is not on the node
list.
2019-10-25 09:18:12 +02:00
Martin Wilck
0d5597044f iscsiroot: there's never more than one target per call
iscsi_target_name is set by iscsi_root, and thus can't have
more than one member. This allows us to get rid of one bashism
in iscsiroot.sh.
2019-10-25 09:18:12 +02:00
Martin Wilck
5fbe772b44 iscsiroot: parse_iscsi_root overwrites command line args
iscsi_target_name, iscsi_target_ip, iscsi_target_port are
unconditionally overwritten by parse_iscsi_root. Don't set
them here, for code clarity.
2019-10-25 09:18:12 +02:00
Martin Wilck
906896e220 network: stop waiting for interfaces if root device is present 2019-10-25 09:18:12 +02:00
Martin Wilck
f551886f5c iscsi: don't continue waiting if the root device is present
dracut waits for every iscsiroot connection to be established
before switching root. This is not necessary in multipath scenarios,
where a single path is usually sufficient to set up the root device,
and where users expect booting to succeed unless all paths are down.

Don't wait for the iscsi portal to start if the root device has
already been found.
2019-10-25 09:18:12 +02:00
Lee Duncan
1ab6778ee4 Dracut: only login to one target at a time
For handling the configuration where there are two
paths to an iscsi root target, each using a different
NIC. In such a case, the initramfs was trying to configure
the first NIC, then call iscsiroot to login to both targets,
which would fail for the 2nd target, since the path to the
2nd target was not yet configured. This would eventually
work after a timeout. But it's better to login to just
one target at a time.
This change makes the initramfs handle multiple paths to an
iscsi target better by logging into only one target at a time,
rather than trying to login to all targets when only one of
several NICs is up.

This can be further optimized by using the initrd parameter
"rd.iscsi.testroute", which would skip iscsiadm login attempts
for targets to which no route exists.

If the script is called again via the timeout initqueue,
we try "iscsiadm -L onboot" again, hoping that some targets
may now have become reachable.
2019-10-25 09:18:12 +02:00
jbash aka John Bashinski
7f0b48627a Documentation: add systemd warning for rd.luks.key, clean up related text
Harald Hoyer <harald@redhat.com>: Squashed commit of the following:

commit 4b5e5da6061983964a85d1671bd1c97c48ee76f1
Author: jbash aka John Bashinski <jbash@velvet.com>
Date:   Thu Aug 1 13:21:35 2019 -0400

    Documentation: add systemd warning for rd.luks.key, clean up related text
2019-10-23 14:48:04 +02:00
Kairui Song
5d88809319 99squash: Only start the cleaner on switch-root
Currently it starts the cleaner early and do the clean up job if switch
root is called. It's better to just start the service only on switch
root to avoid any risk of service dependency failure and make is
simpler.

Signed-off-by: Kairui Song <kasong@redhat.com>
2019-10-23 14:40:24 +02:00
gaoyi
da36b76ab0 dracut: check_vol_slaves_all must return 1 when lvm vgs failed
reason:when filter/global_filter is set in lvm.conf, lvm vgs may be
failed

Signed-off-by: gaoyi <ymuemc@163.com>
2019-10-23 14:38:11 +02:00
Kairui Song
a69e6c4eae Only generate hostonly-kernel-modules list in strict mode
Fixes #617.
2019-10-23 14:33:36 +02:00
206 changed files with 3824 additions and 2331 deletions

48
.github/workflows/fedora-30.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
## The test container is created with https://github.com/dracutdevs/fedora-container
name: Fedora-30
on:
push:
branches:
- 'master'
tags:
- '*'
pull_request:
jobs:
test:
runs-on: ubuntu-latest
#container: quay.io/haraldh/dracut-fedora:30
timeout-minutes: 45
strategy:
matrix:
test: [
"01",
"02",
"03",
"04",
"10",
"11",
"12",
"13",
"14",
"15",
"17",
"20",
"30",
"35",
"40",
"50",
"60",
"99",
]
fail-fast: false
steps:
- name: "Checkout Repository"
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: "TEST-${{ matrix.test }}"
run: docker run --privileged -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:30 /dracut/fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}

54
.github/workflows/fedora-31.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
## The test container is created with https://github.com/dracutdevs/fedora-container
name: Fedora-31
on:
push:
branches:
- 'master'
tags:
- '*'
pull_request:
jobs:
test:
runs-on: ubuntu-latest
#container: quay.io/haraldh/dracut-fedora:30
timeout-minutes: 45
strategy:
matrix:
test: [
"01",
"02",
"03",
"04",
"10",
"11",
"12",
"13",
"14",
"15",
"17",
"20",
"21",
"30",
"31",
"35",
"36",
"40",
"41",
"50",
"51",
"60",
"61",
"99",
]
fail-fast: false
steps:
- name: "Checkout Repository"
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: "TEST-${{ matrix.test }}"
run: docker run --privileged -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:31 /dracut/fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}

View File

@@ -9,24 +9,30 @@ env:
- IMAGE=latest TESTS=01
- IMAGE=latest TESTS=12
- IMAGE=latest TESTS=20
- IMAGE=latest TESTS=21
- IMAGE=latest TESTS=50
- IMAGE=latest TESTS=51
- IMAGE=latest TESTS=30
- IMAGE=latest TESTS=31
- IMAGE=latest TESTS=35
- IMAGE=latest TESTS=36
- IMAGE=latest TESTS=40
- IMAGE=latest TESTS=41
- IMAGE=latest TESTS=60
- IMAGE=latest TESTS=70
- IMAGE=latest TESTS=61
- IMAGE=latest TESTS=99
- IMAGE=latest TESTS=02
- IMAGE=latest TESTS=03
- IMAGE=latest TESTS=04
- IMAGE=latest TESTS=10
- IMAGE=latest TESTS=11
- IMAGE=29 TESTS=13
- IMAGE=29 TESTS=14
- IMAGE=latest TESTS=13
- IMAGE=latest TESTS=14
- IMAGE=latest TESTS=15
- IMAGE=latest TESTS=17
before_script:
- docker pull fedora:$IMAGE
- docker pull quay.io/haraldh/dracut-fedora:$IMAGE
- |
sudo modprobe kvm-intel nested=1 || :
sudo modprobe kvm-amd nested=1 || :
@@ -37,7 +43,8 @@ before_script:
git describe --tags || :
script:
- docker run --privileged -it -v $(pwd)/:/dracut fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
## The test container is created with https://github.com/dracutdevs/fedora-container
- docker run --privileged -it -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
notifications:
webhooks:

77
AUTHORS
View File

@@ -5,15 +5,17 @@ Hannes Reinecke <hare@suse.com>
Will Woods <wwoods@redhat.com>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Daniel Molkentin <dmolkentin@suse.com>
Dave Young <dyoung@redhat.com>
Jeremy Katz <katzj@redhat.com>
David Dillow <dave@thedillows.org>
Lubomir Rintel <lkundrak@v3.sk>
Lukas Nykryn <lnykryn@redhat.com>
Michal Soltys <soltys@ziu.info>
Colin Guthrie <colin@mageia.org>
Daniel Molkentin <dmolkentin@suse.com>
Kairui Song <kasong@redhat.com>
Amerigo Wang <amwang@redhat.com>
Thomas Renninger <trenn@suse.com>
Lukas Nykryn <lnykryn@redhat.com>
Alexander Tsoy <alexander@tsoy.me>
Frederick Grose <fgrose@sugarlabs.org>
WANG Chao <chaowang@redhat.com>
@@ -22,24 +24,29 @@ Andrey Borzenkov <arvidjaar@gmail.com>
Hans de Goede <hdegoede@redhat.com>
Peter Jones <pjones@redhat.com>
Andreas Thienemann <andreas@bawue.net>
Martin Wilck <mwilck@suse.de>
Frantisek Sumsal <frantisek@sumsal.cz>
Peter Robinson <pbrobinson@fedoraproject.org>
Fabian Vogt <fvogt@suse.com>
Kairui Song <kasong@redhat.com>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Xunlei Pang <xlpang@redhat.com>
Colin Walters <walters@verbum.org>
Daniel Drake <drake@endlessm.com>
Lubomir Rintel <lkundrak@v3.sk>
Angelo "pallotron" Failla <pallotron@fb.com>
Brian C. Lane <bcl@redhat.com>
Ville Skyttä <ville.skytta@iki.fi>
Böszörményi Zoltán <zboszor@pr.hu>
Cristian Rodríguez <crrodriguez@opensuse.org>
Dan Horák <dhorak@redhat.com>
Jonathan Lebon <jonathan@jlebon.com>
Renaud Métrich <rmetrich@redhat.com>
Baoquan He <bhe@redhat.com>
Brendan Germain <brendan.germain@nasdaqomx.com>
Colin Walters <walters@verbum.org>
Jonas Witschel <diabonas@gmx.de>
Leho Kraav <leho@kraav.com>
Moritz Maxeiner <moritz@ucworks.org>
Nathan Rini <nate@ucar.edu>
Nicolas Chauvet <kwizart@gmail.com>
Ondrej Mosnacek <omosnace@redhat.com>
Fabian Deutsch <fabiand@fedoraproject.org>
@@ -47,20 +54,23 @@ Javier Martinez Canillas <javierm@redhat.com>
Kamil Rytarowski <n54@gmx.com>
Lidong Zhong <lidong.zhong@suse.com>
Marc Grimme <grimme@atix.de>
Mike Gilbert <floppym@gentoo.org>
NeilBrown <neilb@suse.de>
Peter Rajnoha <prajnoha@redhat.com>
Radek Vykydal <rvykydal@redhat.com>
Thorsten Behrens <tbehrens@suse.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Chao Wang <chaowang@redhat.com>
Frederic Crozat <fcrozat@suse.com>
James Lee <jlee@thestaticvoid.com>
Jesse Keating <jkeating@redhat.com>
Martin Wilck <mwilck@suse.de>
Mike Gilbert <floppym@gentoo.org>
Milan Broz <mbroz@redhat.com>
Mimi Zohar <zohar@linux.vnet.ibm.com>
Roberto Sassu <roberto.sassu@polito.it>
Stefan Reimer <it@startux.de>
Takashi Iwai <tiwai@suse.de>
Thomas Blume <thomas.blume@suse.com>
tpgxyz <tpgxyz@gmail.com>
Adam Williamson <awilliam@redhat.com>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
@@ -68,6 +78,7 @@ Chapman Flack <g2@anastigmatix.net>
Chris Leech <cleech@redhat.com>
David Cantrell <dcantrell@redhat.com>
Dennis Gilmore <dennis@ausil.us>
Doan Tran Cong Danh <congdanhqx@gmail.com>
Jan Synacek <jsynacek@redhat.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Juan RP <xtraeme@gmail.com>
@@ -75,7 +86,9 @@ Lance Albertson <lance@osuosl.org>
Marcos Mello <marcosfrm@gmail.com>
Marian Ganisin <mganisin@redhat.com>
Matthias Gerstner <matthias.gerstner@suse.de>
Max Resch <resch.max@gmail.com>
Michael Ploujnikov <plouj@somanetworks.com>
Norbert Lange <norbert.lange@andritz.com>
Pratyush Anand <panand@redhat.com>
Silvio Fricke <silvio.fricke@gmail.com>
Steven Brudenell <steven.brudenell@gmail.com>
@@ -83,13 +96,13 @@ Stig Telfer <stelfer@cray.com>
Thomas Backlund <tmb@mageia.org>
Vasiliy Tolstov <v.tolstov@selfip.ru>
Wim Muskee <wimmuskee@gmail.com>
tpgxyz <tpgxyz@gmail.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Alex Harpin <development@landsofshadow.co.uk>
Ankit Kumar <ankit@linux.vnet.ibm.com>
Antony Messerli <amesserl@rackspace.com>
Chao Fan <cfan@redhat.com>
Daniel Cordero <dracut@0xdc.io>
Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Daniel Schaal <farbing@web.de>
Denis Silakov <dsilakov@virtuozzo.com>
@@ -101,15 +114,21 @@ Hari Bathini <hbathini@linux.vnet.ibm.com>
Ian Dall <ian@beware.dropbear.id.au>
Imran Haider <imran1008@gmail.com>
James Buren <ryuo@frugalware.org>
Jan Macku <jamacku@redhat.com>
Jiri Konecny <jkonecny@redhat.com>
Joey Boggs <jboggs@redhat.com>
Julian Wolf <juwolf@suse.com>
Koen Kooi <koen@dominion.thruhere.net>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Kyle McMartin <kmcmarti@redhat.com>
Lukas Wunner <lukas@wunner.de>
Marko Myllynen <myllynen@redhat.com>
Michal Koutný <mkoutny@suse.com>
Mike Snitzer <snitzer@redhat.com>
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Minfei Huang <mhuang@redhat.com>
Nikoli <nikoli@gmx.us>
Pedro Monreal <pmgdeb@gmail.com>
Pingfan Liu <piliu@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Robert LeBlanc <robert@leblancnet.us>
@@ -117,18 +136,27 @@ Robert Scheck <robert@fedoraproject.org>
Stefan Berger <stefanb@us.ibm.com>
Thomas Lange <lange@informatik.uni-koeln.de>
Till Maas <opensource@till.name>
Tomasz Paweł Gajc <tpgxyz@gmail.com>
Tony Asleson <tasleson@redhat.com>
Topi Miettinen <toiwoton@gmail.com>
Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Alexander Kurtz <alexander@kurtz.be>
Alexander Miroshnichenko <alex@millerson.name>
Alexander Todorov <atodorov@redhat.com>
Alexey Kodanev <alexey.kodanev@oracle.com>
Andreas Schwab <schwab@suse.de>
Andreas Stieger <astieger@suse.com>
Andy Lutomirski <luto@mit.edu>
Anssi Hannula <anssi@mageia.org>
Arnaud Rebillout <arnaud.rebillout@collabora.com>
Artem Savkov <asavkov@redhat.com>
Attila Bruncsak <bruncsak@users.noreply.github.com>
B. Wilson <x@wilsonb.com>
Benjamin Marzinski <bmarzins@redhat.com>
Brandon Philips <brandon@ifup.co>
Brian C. Lane <bcl@brianlane.com>
Bruno E. O. Meneguele <bmeneg@redhat.com>
Bryn M. Reeves <bmr@redhat.com>
Canek Peláez Valdés <caneko@gmail.com>
Carlo Caione <carlo@endlessm.com>
@@ -141,12 +169,16 @@ David Disseldorp <ddiss@suse.de>
David Michael <david.michael@coreos.com>
Dennis Schridde <devurandom@gmx.net>
Derek Higgins <derekh@redhat.com>
Donovan Tremura <neurognostic@protonmail.ch>
Duane Griffin <duaneg@dghda.com>
Dusty Mabe <dusty@dustymabe.com>
Elan Ruusamäe <glen@delfi.ee>
Enno Boland <g@s01.de>
Eugene S. Sobolev <sobolev@protei.ru>
Eugene Syromiatnikov <esyr@redhat.com>
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
Florian Gamböck <mail@floga.de>
Frank Deng <frank.deng@oracle.com>
François Cami <fcami@fedoraproject.org>
Gerd von Egidy <gerd.von.egidy@intra2net.com>
Glen Gray <slaine@slaine.org>
@@ -154,11 +186,14 @@ HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Hendrik Brueckner <brueckner@linux.ibm.com>
Hermann Gausterer <git-dracut-2012@mrq1.org>
Hiroaki Mizuguchi <hiroaki-m@iij.ad.jp>
Hongxu Jia <hongxu.jia@windriver.com>
Hui Wang <john.wanghui@huawei.com>
Ignaz Forster <iforster@suse.com>
Jacob Wen <jian.w.wen@oracle.com>
James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com>
Jason Dana <jasondana@quarksecurity.com>
Jens Heise <46450477+heisej@users.noreply.github.com>
Jeremy Linton <lintonrjeremy@gmail.com>
Jiri Pirko <jiri@resnulli.us>
Joe Lawrence <Joe.Lawrence@stratus.com>
@@ -166,19 +201,21 @@ Johannes Thumshirn <jthumshirn@suse.com>
Jonas Jonsson <jonas@websystem.se>
Kevin Yung <Kevin.Yung@myob.com>
Lars R. Damerow <lars@pixar.com>
Lee Duncan <lduncan@suse.com>
Lennert Buytenhek <buytenh@wantstofly.org>
Lianbo Jiang <lijiang@redhat.com>
Lucas C. Villa Real <lucasvr@gmail.com>
Major Hayden <major@mhtx.net>
Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Marian Csontos <mcsontos@redhat.com>
Mark Fasheh <mfasheh@suse.de>
Marko Myllynen <myllynen@redhat.com>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Matthew Thode <mthode@mthode.org>
Mei Liu <liumbj@linux.vnet.ibm.com>
Michael Chapman <mike@very.puzzling.org>
Michael McCracken <michael.mccracken@gmail.com>
Michal Koutný <mkoutny@suse.com>
Michal Schmidt <mschmidt@redhat.com>
Michal Sekletar <msekleta@redhat.com>
Mike Gorse <mgorse@suse.com>
@@ -186,16 +223,20 @@ Moritz 'Morty' Strübe <morty@gmx.net>
Munehiro Matsuda <haro@kgt.co.jp>
Nicolas Porcel <nicolasporcel06@gmail.com>
Olivier Blin <dev@blino.org>
Ondrej Dubaj <odubaj@redhat.com>
P J P <ppandit@redhat.com>
Paolo Bonzini <pbonzini@redhat.com>
Patrick Talbert <ptalbert@redhat.com>
Paul Robins <exp@users.noreply.github.com>
Pavel Zhukov <pzhukov@redhat.com>
Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
Pekka Wallendahl <wyrmiyu@gmail.com>
Petr Tesarik <ptesarik@suse.com>
Petr Vorel <pvorel@suse.cz>
Prarit Bhargava <prarit@redhat.com>
Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Renaud Métrich <rmetrich@redhat.com>
Robert Buchholz <rbu@goodpoint.de>
Ruben Kerkhof <ruben@rubenkerkhof.com>
Rusty Bird <rustybird@openmailbox.org>
@@ -204,12 +245,12 @@ Shawn W Dunn <sfalken@opensuse.org>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
Stijn Hoop <stijn@sandcat.nl>
Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net>
Thierry Vignaud <thierry.vignaud@gmail.com>
Thilo Bangert <thilo.bangert@gmx.net>
Thomas Blume <thomas.blume@suse.com>
Thomas Abraham <tabraham@suse.com>
Tobias Geerinckx <tobias.geerinckx@gmail.com>
Tobias Klauser <tklauser@distanz.ch>
Tom Gundersen <teg@jklm.no>
Tomasz Paweł Gajc <tpgxyz@gmail.com>
Tomasz Torcz <tomek@pipebreaker.pl>
Tong Li <tonli@redhat.com>
Vadim Kuznetsov <vadimk@gentoo.org>
@@ -218,11 +259,19 @@ Vratislav Podzimek <vpodzime@redhat.com>
Yanko Kaneti <yaneti@declera.com>
Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com>
Ziyue Yang <ziyang@redhat.com>
gaoyi <ymuemc@163.com>
honza801 <honza801@gmail.com>
jbash aka John Bashinski <jbash@velvet.com>
jloeser <jloeser@suse.de>
johannes <johannes.brechtmann@gmail.com>
jonathan-teh <30538043+jonathan-teh@users.noreply.github.com>
logan <logancaldwell23@gmail.com>
masem <matej.semian@gmail.com>
maximilian attems <max@stro.at>
nabijaczleweli <nabijaczleweli@gmail.com>
privb0x23 <privb0x23@users.noreply.github.com>
q66 <daniel@octaforge.org>
tpg <tpgxyz@gmail.com>
xtraeme <xtraeme@voidlinux.eu>
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Дамјан Георгиевски <gdamjan@gmail.com>

View File

@@ -62,7 +62,7 @@ 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)
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS)
logtee: logtee.c
$(CC) $(LDFLAGS) -o $@ $<
@@ -92,13 +92,16 @@ endif
%.xml: %.asc
@rm -f -- "$@"
asciidoc -d manpage -b docbook -o "$@" $<
asciidoc -a "version=$(DRACUT_MAIN_VERSION)$(GITVERSION)" -d manpage -b docbook -o "$@" $<
dracut.8: dracut.usage.asc dracut.8.asc
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
@rm -f -- dracut.xml
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
asciidoc -a "mainversion=$(DRACUT_MAIN_VERSION)" \
-a "version=$(DRACUT_MAIN_VERSION)$(GITVERSION)" \
-a numbered \
-d book -b docbook -o dracut.xml dracut.asc
@rm -f -- dracut.html
xsltproc -o dracut.html --xinclude -nonet \
--stringparam custom.css.source dracut.css \
@@ -207,7 +210,7 @@ dracut-$(DRACUT_MAIN_VERSION).tar.xz: doc syncheck
rm -f -- dracut-$(DRACUT_MAIN_VERSION).tar
rpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
rpmbuild=$$(mktemp -d -p /var/tmp rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; \

65
NEWS
View File

@@ -1,3 +1,68 @@
dracut-050
==========
dracut:
- support for running on a cross-compiled rootfs, see README.cross
- add support for creating secureboot signed UEFI images
- use microcode found in packed cpio images
- `-k/--kmodir` must now contain "lib/modules/$KERNEL_VERSION"
use DRACUT_KMODDIR_OVERRIDE=1 to ignore this check
- support the EFI Stub loader's splash image feature.
`--uefi-splash-image <FILE>`
dracut modules:
- remove bashism in various boot scripts
- emergency mode: use sulogin
fcoe:
- add rd.nofcoe option to disable the FCoE module from the command line
10i18n:
- fix keymaps not getting included sometimes
- use eurlatgr as default console font
iscsi:
- add option `rd.iscsi.testroute`
multipath:
- fix udev rules detection of multipath devices
network:
- support NetworkManager
network-legacy:
- fix classless static route parsing
- ifup: fix typo when calling dhclient --timeout
- ifup: nuke pid and lease files if dhclient failed
- fix ip=dhcp,dhcp6
- use $name instead of $env{INTERFACE} (systemd-udevd regression)
shutdown:
- fix for non-systemd reboot/halt/shutdown commands
- set selinux labels
- fix shutdown with console=null
lsinitrd:
- list squash content as well
- handle UEFI created with dracut --uefi
- make lsinitrd usable for images made with Debian mkinitramfs
dracut-install:
- fixed ldd parsing
- install kernel module dependencies of dependencies
- fixed segfault for hashing NULL pointers
- add support for compressed firmware files
- dracut_mkdir(): create parent directories as needed.
test suite:
- lots of cleanups
- add github actions
new modules:
- rngd
- network-manager
- ppcmac - thermal/fan control modules on PowerPC based Macs
dracut-049
==========
lsinitrd:

70
README.cross Normal file
View File

@@ -0,0 +1,70 @@
Dracut supports running against a sysroot directory that is different
from the actual root (/) directory of the running system. It is most
useful for creating/bootstrapping a new system that may or may not be
using the same CPU architecture as the host system, i.e. building a
whole Linux system with a cross-compiler framework like Yocto.
The user-visible frontend change is the introduction of a new option
called "-r" or "--sysroot". It expects a directory that contains the
complete Linux system that has all the files (kernel drivers, firmware,
executables, libraries and others) necessary to construct the initramfs.
E.g: dracut --sysroot /path/to/sysroot initramfs.img kernelversion
To support this, a new global variable was introduced inside dracut.
This variable is called "dracutsysrootdir" and all the files installed
into the initramfs image is searched relative to the sysroot directory.
This variable can also be set externally to dracut without using option
-r/--sysroot.
There are other details that are necessary to tweak to be able to
run on cross-compiled (a.k.a. foreign) binaries.
dracut uses these crucial utilities during its operation:
ldd
===
It lists dynamic library dependencies for executables or libraries
ldconfig
========
It creates /etc/ld.so.cache, i.e. the cached information about libraries
known to the system.
These utilities the way they exist on the host system only work on
the host system.
To support cross-compiled binaries, a different ldd variant is needed that
works on those binaries. One such ldd script is found at
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f
ldconfig in GLIBC as is does support a sysroot with its -r option.
Extra environment variables needed to run dracut on the sysroot are
documented in the dracut(8) man page.
For the Plymouth boot splash to be added to the initramfs image,
this gitlab PR is needed for Plymouth:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/72
Extensions to be used with Yocto
================================
examples/yocto/classes/dracut.bbclass:
Bitbake class for running dracut during the "do_rootfs" stage of
creating a distribution image and from the postinstall script of
a package. A kernel recipe needs this line to activate it:
inherit dracut
examples/yocto/postinst-intercepts/execute_dracut
The "intercept" script used during "do_rootfs" mentioned above.
examples/yocto/recipes/cross-compiler-ldd_git.bb
Package recipe for the cross-compiler-ldd script from the above link.
All the above three need to be added to a Yocto layer to their
proper locations.
They were tested on Yocto 2.7 with MACHINE="intel-core2-32" and
MACHINE="genericx86-64".

View File

@@ -4,6 +4,8 @@ dracut
dracut is an event driven initramfs infrastructure.
[![Build Status](https://travis-ci.org/dracutdevs/dracut.svg?branch=master)](https://travis-ci.org/dracutdevs/dracut)
![Fedora-30](https://github.com/dracutdevs/dracut/workflows/Fedora-30/badge.svg?branch=master)
![Fedora-31](https://github.com/dracutdevs/dracut/workflows/Fedora-31/badge.svg?branch=master)
dracut (the tool) is used to create an initramfs image by copying tools
and files from an installed system and combining it with the

44
configure vendored
View File

@@ -7,6 +7,7 @@ prefix=/usr
enable_documentation=yes
CC="${CC:-cc}"
PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
# Little helper function for reading args from the commandline.
@@ -57,6 +58,48 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
exit 1
fi
cat <<EOF >conftest.c
#include <fts.h>
int main() {
return 0;
}
EOF
${CC} $CFLAGS $LDFLAGS conftest.c >/dev/null 2>&1
ret=$?
rm -f conftest.c a.out
# musl doesn't have fts.h included
if test $ret -ne 0; then
echo "dracut needs fts development files." >&2
exit 1
fi
cat <<EOF >conftest.c
#include <fts.h>
int main(void) {
fts_open(0, 0, 0);
return 0;
}
EOF
found=no
for lib in "-lc" "-lfts"; do
${CC} $CFLAGS -Wl,$lib $LDFLAGS conftest.c >/dev/null 2>&1
ret=$?
if test $ret -eq 0; then
FTS_LIBS="$lib"
found=yes
break;
fi
done
rm -f conftest.c a.out
if test $found = no; then
echo "dracut couldn't find usable fts library" >&2
exit 1
fi
cat > Makefile.inc.$$ <<EOF
prefix ?= ${prefix}
libdir ?= ${libdir:-${prefix}/lib}
@@ -68,6 +111,7 @@ enable_documentation ?= ${enable_documentation:-yes}
bindir ?= ${bindir:-${prefix}/bin}
KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
FTS_LIBS ?= ${FTS_LIBS}
EOF
{

View File

@@ -40,19 +40,43 @@ str_ends() { [ "${1%*"$2"}" != "$1" ]; }
# find a binary. If we were not passed the full path directly,
# search in the usual places to find the binary.
find_binary() {
if [[ -z ${1##/*} ]]; then
if [[ -x $1 ]] || { [[ "$1" == *.so* ]] && ldd "$1" &>/dev/null; }; then
local _delim
local l
local p
[[ -z ${1##/*} ]] || _delim="/"
if [[ "$1" == *.so* ]]; then
for l in libdirs ; do
if { $DRACUT_LDD "$dracutsysrootdir$l$_delim$1" &>/dev/null; }; then
printf "%s\n" "$1"
return 0
fi
done
if { $DRACUT_LDD "$dracutsysrootdir$_delim$1" &>/dev/null; }; then
printf "%s\n" "$1"
return 0
fi
fi
if [[ "$1" == */* ]]; then
if [[ -L $dracutsysrootdir$_delim$1 ]] || [[ -x $dracutsysrootdir$_delim$1 ]]; then
printf "%s\n" "$1"
return 0
fi
fi
for p in $DRACUT_PATH ; do
if [[ -L $dracutsysrootdir$p$_delim$1 ]] || [[ -x $dracutsysrootdir$p$_delim$1 ]]; then
printf "%s\n" "$1"
return 0
fi
done
[[ -n "$dracutsysrootdir" ]] && return 1
type -P "${1##*/}"
}
ldconfig_paths()
{
ldconfig -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
$DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
}
# Version comparision function. Assumes Linux style version scheme.
@@ -592,6 +616,12 @@ check_vol_slaves_all() {
# strip space
_vg="${_vg//[[:space:]]/}"
if [[ $_vg ]]; then
# when filter/global_filter is set, lvm may be failed
lvm lvs --noheadings -o vg_name $_vg 2>/dev/null 1>/dev/null
if [ $? -ne 0 ]; then
return 1
fi
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
do
check_block_and_slaves_all $1 $(get_maj_min $_pv)
@@ -627,9 +657,9 @@ check_kernel_config()
{
local _config_opt="$1"
local _config_file
[[ -f /boot/config-$kernel ]] \
[[ -f $dracutsysrootdir/boot/config-$kernel ]] \
&& _config_file="/boot/config-$kernel"
[[ -f /lib/modules/$kernel/config ]] \
[[ -f $dracutsysrootdir/lib/modules/$kernel/config ]] \
&& _config_file="/lib/modules/$kernel/config"
# no kernel config file, so return true

View File

@@ -19,7 +19,7 @@
#
export LC_MESSAGES=C
if [[ "$EUID" = "0" ]]; then
if [[ "$EUID" = "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
else
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
@@ -57,7 +57,7 @@ if ! [[ $kernel ]]; then
export kernel
fi
srcmods="/lib/modules/$kernel/"
srcmods="$dracutsysrootdir/lib/modules/$kernel/"
[[ $drivers_dir ]] && {
if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
@@ -79,17 +79,21 @@ export srcmods
export hookdirs
}
DRACUT_LDD=${DRACUT_LDD:-ldd}
DRACUT_TESTBIN=${DRACUT_TESTBIN:-/bin/sh}
DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}
. $dracutbasedir/dracut-functions.sh
# Detect lib paths
if ! [[ $libdirs ]] ; then
if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \
&& [[ -d /lib64 ]]; then
if [[ "$($DRACUT_LDD $dracutsysrootdir$DRACUT_TESTBIN)" == */lib64/* ]] &>/dev/null \
&& [[ -d $dracutsysrootdir/lib64 ]]; then
libdirs+=" /lib64"
[[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64"
[[ -d $dracutsysrootdir/usr/lib64 ]] && libdirs+=" /usr/lib64"
else
libdirs+=" /lib"
[[ -d /usr/lib ]] && libdirs+=" /usr/lib"
[[ -d $dracutsysrootdir/usr/lib ]] && libdirs+=" /usr/lib"
fi
libdirs+=" $(ldconfig_paths)"
@@ -168,7 +172,18 @@ elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]];
DRACUT_INSTALL=$dracutbasedir/install/dracut-install
fi
if ! [[ -x $DRACUT_INSTALL ]]; then
# Test if dracut-install is a standalone executable with no options.
# E.g. DRACUT_INSTALL may be set externally as:
# DRACUT_INSTALL="valgrind dracut-install"
# or
# DRACUT_INSTALL="dracut-install --debug"
# in which case the string cannot be tested for being executable.
DRINSTALLPARTS=0
for i in $DRACUT_INSTALL ; do
DRINSTALLPARTS=$(($DRINSTALLPARTS+1))
done
if [[ $DRINSTALLPARTS = 1 ]] && ! [[ -x $DRACUT_INSTALL ]]; then
dfatal "dracut-install not found!"
exit 10
fi
@@ -176,15 +191,15 @@ fi
if [[ $hostonly == "-h" ]]; then
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
$DRACUT_INSTALL ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
fi
fi
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
inst_dir() {
[[ -e ${initdir}/"$1" ]] && return 0 # already there
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || :
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@" || :
}
inst() {
@@ -194,8 +209,8 @@ inst() {
shift
fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}
inst_simple() {
@@ -206,8 +221,8 @@ inst_simple() {
fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -e $1 ]] || return 1 # no source
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
}
inst_symlink() {
@@ -218,15 +233,15 @@ inst_symlink() {
fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -L $1 ]] || return 1
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}
inst_multiple() {
local _ret
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
_ret=$?
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
return $_ret
}
@@ -243,8 +258,9 @@ dracut_instmods() {
done
$DRACUT_INSTALL \
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"
(($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
(($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
}
inst_library() {
@@ -255,24 +271,24 @@ inst_library() {
fi
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
[[ -e $1 ]] || return 1 # no source
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
}
inst_binary() {
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
}
inst_script() {
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
}
inst_fsck_help() {
local _helper="/run/dracut/fsck/fsck_help_$1.txt"
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
(($? != 0)) && derror $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
}
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
@@ -369,12 +385,12 @@ inst_rule_group_owner() {
for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do
if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep -E "^$i:" $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
fi
done
for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do
if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then
grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
grep -E "^$i:" $dracutsysrootdir/etc/group 2>/dev/null >> "$initdir/etc/group"
fi
done
}
@@ -394,7 +410,7 @@ inst_rules() {
inst_dir "$_target"
for _rule in "$@"; do
if [ "${_rule#/}" = "$_rule" ]; then
for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do
for r in $dracutsysrootdir${udevdir}/rules.d ${hostonly:+$dracutsysrootdir/etc/udev/rules.d}; do
[[ -e $r/$_rule ]] || continue
_found="$r/$_rule"
inst_rule_programs "$_found"
@@ -403,7 +419,7 @@ inst_rules() {
inst_simple "$_found"
done
fi
for r in '' $dracutbasedir/rules.d/; do
for r in '' $dracutsysrootdir$dracutbasedir/rules.d/; do
# skip rules without an absolute path
[[ "${r}$_rule" != /* ]] && continue
[[ -f ${r}$_rule ]] || continue
@@ -445,6 +461,14 @@ inst_rules_wildcard() {
prepare_udev_rules() {
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
if [ -z "$UDEVVERSION" ]; then
derror "Failed to detect udev version!"
return 1
fi
if [ -z "${UDEVVERSION##*[!0-9]*}" ]; then
derror "udevadm --version did not report an integer, udev version cannot be determined!"
return 1
fi
for f in "$@"; do
f="${initdir}/etc/udev/rules.d/$f"
@@ -525,7 +549,7 @@ inst_libdir_file() {
for _i in "$@"; do
for _f in "$_dir"/$_i; do
[[ "$_f" =~ $_pattern ]] || continue
[[ -e "$_f" ]] && _files+="$_f "
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
done
done
done
@@ -533,7 +557,7 @@ inst_libdir_file() {
for _dir in $libdirs; do
for _i in "$@"; do
for _f in "$_dir"/$_i; do
[[ -e "$_f" ]] && _files+="$_f "
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
done
done
done
@@ -947,6 +971,7 @@ instmods() {
$DRACUT_INSTALL \
${initdir:+-D "$initdir"} \
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
${loginstall:+-L "$loginstall"} \
${hostonly:+-H} \
${omit_drivers:+-N "$omit_drivers"} \
@@ -960,6 +985,7 @@ instmods() {
derror "FAILED: " \
$DRACUT_INSTALL \
${initdir:+-D "$initdir"} \
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
${loginstall:+-L "$loginstall"} \
${hostonly:+-H} \
${omit_drivers:+-N "$omit_drivers"} \
@@ -1006,4 +1032,4 @@ is_qemu_virtualized() {
[[ "$vendor" == "Bochs" ]] && return 0
done
return 1
}
}

View File

@@ -3,6 +3,7 @@ DRACUT(8)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
@@ -284,6 +285,15 @@ Default:
Default:
_/var/tmp_
**-r, --sysroot** _<sysroot directory>_::
specify the sysroot directory to collect files from.
This is useful to create the initramfs image from
a cross-compiled sysroot directory. For the extra helper
variables, see *ENVIRONMENT* below.
+
Default:
_empty_
**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.
**--logfile** _<logfile>_:: logfile to use; overrides any setting from
@@ -507,6 +517,10 @@ will not be able to boot.
_$prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
or _$prefix/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
**--uefi-splash-image _<FILE>_**::
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image
format.
**--kernel-image _<FILE>_**::
Specifies the kernel image, which to include in the UEFI executable. The default is
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
@@ -517,6 +531,91 @@ ENVIRONMENT
_INITRD_COMPRESS_::
sets the default compression program. See **--compress**.
_DRACUT_LDCONFIG_::
sets the _ldconfig_ program path and options. Optional.
Used for **--sysroot**.
+
Default:
_ldconfig_
_DRACUT_LDD_::
sets the _ldd_ program path and options. Optional.
Used for **--sysroot**.
+
Default:
_ldd_
_DRACUT_TESTBIN_::
sets the initially tested binary for detecting library paths.
Optional. Used for **--sysroot**. In the cross-compiled sysroot,
the default value (_/bin/sh_) is unusable, as it is an absolute
symlink and points outside the sysroot directory.
+
Default:
_/bin/sh_
_DRACUT_INSTALL_::
overrides path and options for executing _dracut-install_ internally.
Optional. Can be used to debug _dracut-install_ while running the
main dracut script.
+
Default:
_dracut-install_
+
Example:
DRACUT_INSTALL="valgrind dracut-install"
_DRACUT_COMPRESS_BZIP2_::
_DRACUT_COMPRESS_BZIP2_::
_DRACUT_COMPRESS_LBZIP2_::
_DRACUT_COMPRESS_LZMA_::
_DRACUT_COMPRESS_XZ_::
_DRACUT_COMPRESS_GZIP_::
_DRACUT_COMPRESS_PIGZ_::
_DRACUT_COMPRESS_LZOP_::
_DRACUT_COMPRESS_ZSTD_::
_DRACUT_COMPRESS_LZ4_::
_DRACUT_COMPRESS_CAT_::
overrides for compression utilities to support using them from
non-standard paths.
+
Default values are the default compression utility names to be found in **PATH**.
_DRACUT_ARCH_::
overrides the value of **uname -m**. Used for **--sysroot**.
+
Default:
_empty_ (the value of **uname -m** on the host system)
_SYSTEMD_VERSION_::
overrides systemd version. Used for **--sysroot**.
_DRACUT_INSTALL_PATH_::
overrides **PATH** environment for **dracut-install** to look for
binaries relative to **--sysroot**. In a cross-compiled environment
(e.g. Yocto), PATH points to natively built binaries that are not
in the host's /bin, /usr/bin, etc. **dracut-install** still needs plain
/bin and /usr/bin that are relative to the cross-compiled sysroot.
+
Default:
_PATH_
_DRACUT_INSTALL_LOG_TARGET_::
overrides **DRACUT_LOG_TARGET** for **dracut-install**. It allows
running **dracut-install* to run with different log target that
**dracut** runs with.
+
Default:
_DRACUT_LOG_TARGET_
_DRACUT_INSTALL_LOG_LEVEL_::
overrides **DRACUT_LOG_LEVEL** for **dracut-install**. It allows
running **dracut-install* to run with different log level that
**dracut** runs with.
+
Default:
_DRACUT_LOG_LEVEL_
FILES
-----
_/var/log/dracut.log_::

View File

@@ -1,8 +1,8 @@
dracut
======
Harald Hoyer <harald@redhat.com>
v3.0, October 2013
dracut {mainversion}
====================
:author: Harald Hoyer
:email: harald@redhat.com
:revnumber: {version}
:language: bash
= Introduction

View File

@@ -3,6 +3,7 @@ DRACUT.BOOTUP(7)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----

View File

@@ -3,6 +3,7 @@ DRACUT.CMDLINE(7)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
@@ -318,22 +319,37 @@ crypto LUKS
crypto LUKS - key on removable device support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**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.
NB: If systemd is included in the dracut initrd, dracut's built in
removable device keying support won't work. systemd will prompt for
a password from the console even if you've supplied **rd.luks.key**.
You may be able to use standard systemd *fstab*(5) syntax to
get the same effect. If you do need **rd.luks.key** to work,
you will have to exclude the "systemd" dracut module and any modules
that depend on it. See *dracut.conf*(5) and
https://bugzilla.redhat.com/show_bug.cgi?id=905683 for more
information.
**rd.luks.key=**_<keypath>[:<keydev>[:<luksdev>]]_::
_<keypath>_ is the pathname of a key file, relative to the root
of the filesystem on some device. It's REQUIRED. When
_<keypath>_ ends with '.gpg' it's considered to be key encrypted
symmetrically with GPG. You will be prompted for the GPG password on
boot. GPG support comes with the '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>_ identifies the device on which the key file resides. It may
be the kernel name of the device (should start with "/dev/"), a UUID
(prefixed with "UUID=") or a label (prefix with "LABEL="). You don't
have to specify a 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 it's 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 used for
the specified 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
@@ -342,27 +358,40 @@ rd.luks.key=/foo/bar.key
--
+
As you see, you can skip colons in such a case.
+
[NOTE]
===============================
dracut pipes key to cryptsetup with _-d -_ argument, therefore you need to pipe
to cryptsetup luksFormat with _-d -_, too!
Your LUKS partition must match your key file.
Here follows example for key encrypted with GPG:
dracut provides keys to cryptsetup with _-d_ (an older alias for
_--key-file_). This uses the entire binary
content of the key file as part of the secret. If
you pipe a password into cryptsetup *without* _-d_ or _--key-file_,
it will be treated as text user input, and only characters before
the first newline will be used. Therefore, when you're creating
an encrypted partition for dracut to mount, and you pipe a key into
_cryptsetup luksFormat_,you must use _-d -_.
Here is an example for a key encrypted with GPG (warning:
_--batch-mode_ will overwrite the device without asking for
confirmation):
[listing]
--
gpg --quiet --decrypt rootkey.gpg | \
cryptsetup -d - -v --cipher serpent-cbc-essiv:sha256 \
--key-size 256 luksFormat /dev/sda3
cryptsetup --batch-mode --key-file - \
luksFormat /dev/sda47
--
If you use plain keys, just add path to _-d_ option:
If you use unencrypted key files, just use the key file pathname
instead of the standard input. For a random key with 256 bits of
entropy, you might use:
[listing]
--
cryptsetup -d rootkey.key -v --cipher serpent-cbc-essiv:sha256 \
--key-size 256 luksFormat /dev/sda3
head -32c /dev/urandom > rootkey.key
cryptsetup --batch-mode --key-file rootkey.key \
luksFormat /dev/sda47
--
===============================
@@ -645,7 +674,7 @@ NFS
Wait <seconds> until IPv6 automatic addresses are assigned. Default is 40 seconds.
**rd.net.timeout.carrier=**__<seconds>__::
Wait <seconds> until carrier is recognized. Default is 5 seconds.
Wait <seconds> until carrier is recognized. Default is 10 seconds.
CIFS
~~~
@@ -757,6 +786,9 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
**rd.iscsi.ibft** **rd.iscsi.ibft=1**:
Turn on iBFT autoconfiguration for the interfaces
**rd.iscsi.mp** **rd.iscsi.mp=1**:
Configure all iBFT interfaces, not only used for booting (multipath)
**rd.iscsi.waitnet=0**:
Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets.

View File

@@ -3,6 +3,7 @@ DRACUT.CONF(5)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----
@@ -204,6 +205,9 @@ provide a valid _/etc/fstab_.
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
*uefi_splash_image=*"_<FILE>_"::
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image format.
*uefi_secureboot_cert=*"_<FILE>_", *uefi_secureboot_key=*"_<FILE>_"::
Specifies a certificate and corresponding key, which are used to sign the created UEFI executable.
Requires both certificate and key need to be specified and _sbsign_ to be installed.

View File

@@ -3,6 +3,7 @@ DRACUT.MODULES(7)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----

247
dracut.sh
View File

@@ -37,7 +37,8 @@ readonly dracut_cmd="$(readlink -f $0)"
set -o pipefail
usage() {
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
[[ $sysroot_l ]] && dracutsysrootdir="$sysroot_l"
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
. $dracutbasedir/dracut-version.sh
fi
@@ -62,7 +63,7 @@ EOF
}
long_usage() {
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
. $dracutbasedir/dracut-version.sh
fi
@@ -140,6 +141,7 @@ Creates initial ramdisk images for preloading modules
from. Default: /etc/dracut.conf.d
--tmpdir [DIR] Temporary directory to be used instead of default
/var/tmp.
-r, --sysroot [DIR] Specify sysroot directory to collect files from.
-l, --local Local mode. Use modules from the current working
directory instead of the system-wide installed in
/usr/lib/dracut/modules.d.
@@ -182,8 +184,8 @@ Creates initial ramdisk images for preloading modules
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
Mount device [DEV] on mountpoint [MP] with filesystem
[FSTYPE] and options [FSOPTS] in the initramfs
--mount "[MP]" Same as above, but [DEV], [FSTYPE] and [FSOPTS] are
determined by looking at the current mounts.
--mount "[MP]" Same as above, but [DEV], [FSTYPE] and [FSOPTS] are
determined by looking at the current mounts.
--add-device "[DEV]" Bring up [DEV] in initramfs
-i, --include [SOURCE] [TARGET]
Include the files in the SOURCE directory into the
@@ -234,7 +236,12 @@ Creates initial ramdisk images for preloading modules
--uefi Create an UEFI executable with the kernel cmdline and
kernel combined
--uefi-stub [FILE] Use the UEFI stub [FILE] to create an UEFI executable
--uefi-splash-image [FILE]
Use [FILE] as a splash image when creating an UEFI
executable
--kernel-image [FILE] location of the kernel image
--regenerate-all Regenerate all initramfs images at the default location
for the kernel versions found on the system
If [LIST] has multiple arguments, then you have to put these in quotes.
@@ -312,7 +319,7 @@ rearrange_params()
set -- "${newat[@]}" # Set new $@
TEMP=$(unset POSIXLY_CORRECT; getopt \
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \
-o "a:m:o:d:I:k:c:r:L:fvqlHhMN" \
--long kver: \
--long add: \
--long force-add: \
@@ -338,6 +345,7 @@ rearrange_params()
--long conf: \
--long confdir: \
--long tmpdir: \
--long sysroot: \
--long stdlog: \
--long compress: \
--long prefix: \
@@ -395,6 +403,7 @@ rearrange_params()
--long loginstall: \
--long uefi \
--long uefi-stub: \
--long uefi-splash-image: \
--long kernel-image: \
--long no-hostonly-i18n \
--long hostonly-i18n \
@@ -511,6 +520,7 @@ while :; do
-c|--conf) conffile="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--confdir) confdir="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--tmpdir) tmpdir_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-r|--sysroot) sysroot_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
-L|--stdlog) stdloglvl_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--compress) compress_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--prefix) prefix_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
@@ -592,6 +602,8 @@ while :; do
--uefi) uefi="yes";;
--uefi-stub)
uefi_stub_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--uefi-splash-image)
uefi_splash_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--kernel-image)
kernel_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
--no-machineid)
@@ -617,6 +629,8 @@ while (($# > 0)); do
shift
done
[[ $sysroot_l ]] && dracutsysrootdir="$sysroot_l"
if [[ $regenerate_all == "yes" ]]; then
ret=0
if [[ $kernel ]]; then
@@ -635,7 +649,7 @@ if [[ $regenerate_all == "yes" ]]; then
unset dracut_args[$i]
done
cd /lib/modules
cd $dracutsysrootdir/lib/modules
for i in *; do
[[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
"$dracut_cmd" --kver="$i" "${dracut_args[@]}"
@@ -669,14 +683,14 @@ export DRACUT_LOG_LEVEL=warning
debug=yes
}
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
# if we were not passed a config file, try the default one
if [[ ! -f $conffile ]]; then
if [[ $allowlocal ]]; then
conffile="$dracutbasedir/dracut.conf"
else
conffile="/etc/dracut.conf"
conffile="$dracutsysrootdir/etc/dracut.conf"
fi
fi
@@ -684,7 +698,7 @@ if [[ ! -d $confdir ]]; then
if [[ $allowlocal ]]; then
confdir="$dracutbasedir/dracut.conf.d"
else
confdir="/etc/dracut.conf.d"
confdir="$dracutsysrootdir/etc/dracut.conf.d"
fi
fi
@@ -700,8 +714,8 @@ DRACUT_PATH=${DRACUT_PATH:-/sbin /bin /usr/sbin /usr/bin}
for i in $DRACUT_PATH; do
rl=$i
if [ -L "$i" ]; then
rl=$(readlink -f $i)
if [ -L "$dracutsysrootdir$i" ]; then
rl=$(readlink -f $dracutsysrootdir$i)
fi
if [[ "$NPATH" != *:$rl* ]] ; then
NPATH+=":$rl"
@@ -748,10 +762,10 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates:/lib/firmware:/lib/firmware/$kernel"
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
[[ $fw_dir ]] || fw_dir="$dracutsysrootdir/lib/firmware/updates:$dracutsysrootdir/lib/firmware:$dracutsysrootdir/lib/firmware/$kernel"
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
[[ $tmpdir ]] || tmpdir=/var/tmp
[[ $tmpdir ]] || tmpdir=$dracutsysrootdir/var/tmp
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
[[ $compress_l ]] && compress=$compress_l
[[ $show_modules_l ]] && show_modules=$show_modules_l
@@ -759,16 +773,20 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
[[ $ro_mnt_l ]] && ro_mnt="yes"
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l
[[ $early_microcode ]] || early_microcode=yes
[[ $early_microcode_image_dir ]] || early_microcode_image_dir=('/boot')
[[ $early_microcode_image_name ]] || \
early_microcode_image_name=('intel-uc.img' 'intel-ucode.img' 'amd-uc.img' 'amd-ucode.img' 'early_ucode.cpio' 'microcode.cpio')
[[ $logfile_l ]] && logfile="$logfile_l"
[[ $reproducible_l ]] && reproducible="$reproducible_l"
[[ $loginstall_l ]] && loginstall="$loginstall_l"
[[ $uefi_stub_l ]] && uefi_stub="$uefi_stub_l"
[[ $uefi_splash_image_l ]] && uefi_splash_image="$uefi_splash_image_l"
[[ $kernel_image_l ]] && kernel_image="$kernel_image_l"
[[ $machine_id_l ]] && machine_id="$machine_id_l"
if ! [[ $outfile ]]; then
if [[ $machine_id != "no" ]]; then
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
[[ -f $dracutsysrootdir/etc/machine-id ]] && read MACHINE_ID < $dracutsysrootdir/etc/machine-id
fi
if [[ $uefi == "yes" ]]; then
@@ -782,27 +800,34 @@ if ! [[ $outfile ]]; then
exit 1
fi
BUILD_ID=$(cat /etc/os-release /usr/lib/os-release \
BUILD_ID=$(cat $dracutsysrootdir/etc/os-release $dracutsysrootdir/usr/lib/os-release \
| while read -r line || [[ $line ]]; do \
[[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
done)
if [[ -d /efi ]] && mountpoint -q /efi; then
efidir=/efi/EFI
if [[ -z $dracutsysrootdir ]]; then
if [[ -d /efi ]] && mountpoint -q /efi; then
efidir=/efi/EFI
else
efidir=/boot/EFI
if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
efidir=/boot/efi/EFI
fi
fi
else
efidir=/boot/EFI
if [[ -d /boot/efi/EFI ]] && mountpoint -q /boot/efi; then
if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
efidir=/boot/efi/EFI
fi
fi
mkdir -p "$efidir/Linux"
outfile="$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
mkdir -p "$dracutsysrootdir$efidir/Linux"
outfile="$dracutsysrootdir$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
else
if [[ -e "/boot/vmlinuz-$kernel" ]]; then
if [[ -e "$dracutsysrootdir/boot/vmlinuz-$kernel" ]]; then
outfile="/boot/initramfs-$kernel.img"
elif [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
outfile="/boot/${MACHINE_ID}/$kernel/initrd"
elif [[ $MACHINE_ID ]] && ( [[ -d $dracutsysrootdir/boot/${MACHINE_ID} ]] || [[ -L $dracutsysrootdir/boot/${MACHINE_ID} ]] ); then
outfile="$dracutsysrootdir/boot/${MACHINE_ID}/$kernel/initrd"
else
outfile="/boot/initramfs-$kernel.img"
outfile="$dracutsysrootdir/boot/initramfs-$kernel.img"
fi
fi
fi
@@ -822,13 +847,24 @@ if [[ -n "$logfile" ]];then
fi
# handle compression options.
if [[ $_no_compress_l = "cat" ]]; then
compress="cat"
DRACUT_COMPRESS_BZIP2=${DRACUT_COMPRESS_BZIP2:-bzip2}
DRACUT_COMPRESS_LBZIP2=${DRACUT_COMPRESS_LBZIP2:-lbzip2}
DRACUT_COMPRESS_LZMA=${DRACUT_COMPRESS_LZMA:-lzma}
DRACUT_COMPRESS_XZ=${DRACUT_COMPRESS_XZ:-xz}
DRACUT_COMPRESS_GZIP=${DRACUT_COMPRESS_GZIP:-gzip}
DRACUT_COMPRESS_PIGZ=${DRACUT_COMPRESS_PIGZ:-pigz}
DRACUT_COMPRESS_LZOP=${DRACUT_COMPRESS_LZOP:-lzop}
DRACUT_COMPRESS_ZSTD=${DRACUT_COMPRESS_ZSTD:-zstd}
DRACUT_COMPRESS_LZ4=${DRACUT_COMPRESS_LZ4:-lz4}
DRACUT_COMPRESS_CAT=${DRACUT_COMPRESS_CAT:-cat}
if [[ $_no_compress_l = "$DRACUT_COMPRESS_CAT" ]]; then
compress="$DRACUT_COMPRESS_CAT"
fi
if ! [[ $compress ]]; then
# check all known compressors, if none specified
for i in pigz gzip lz4 lzop zstd lzma xz lbzip2 bzip2 cat; do
for i in $DRACUT_COMPRESS_PIGZ $DRACUT_COMPRESS_GZIP $DRACUT_COMPRESS_LZ4 $DRACUT_COMPRESS_LZOP $ $DRACUT_COMPRESS_ZSTD $DRACUT_COMPRESS_LZMA $DRACUT_COMPRESS_XZ $DRACUT_COMPRESS_LBZIP2 $OMPRESS_BZIP2 $DRACUT_COMPRESS_CAT; do
command -v "$i" &>/dev/null || continue
compress="$i"
break
@@ -841,35 +877,35 @@ fi
# choose the right arguments for the compressor
case $compress in
bzip2|lbzip2)
if [[ "$compress" = lbzip2 ]] || command -v lbzip2 &>/dev/null; then
compress="lbzip2 -9"
if [[ "$compress" = lbzip2 ]] || command -v $DRACUT_COMPRESS_LBZIP2 &>/dev/null; then
compress="$DRACUT_COMPRESS_LBZIP2 -9"
else
compress="bzip2 -9"
compress="$DRACUT_COMPRESS_BZIP2 -9"
fi
;;
lzma)
compress="lzma -9 -T0"
compress="$DRACUT_COMPRESS_LZMA -9 -T0"
;;
xz)
compress="xz --check=crc32 --lzma2=dict=1MiB -T0"
compress="$DRACUT_COMPRESS_XZ --check=crc32 --lzma2=dict=1MiB -T0"
;;
gzip|pigz)
if [[ "$compress" = pigz ]] || command -v pigz &>/dev/null; then
compress="pigz -9 -n -T -R"
elif command -v gzip &>/dev/null && gzip --help 2>&1 | grep -q rsyncable; then
compress="gzip -n -9 --rsyncable"
if [[ "$compress" = pigz ]] || command -v $DRACUT_COMPRESS_PIGZ &>/dev/null; then
compress="$DRACUT_COMPRESS_PIGZ -9 -n -T -R"
elif command -v gzip &>/dev/null && $DRACUT_COMPRESS_GZIP --help 2>&1 | grep -q rsyncable; then
compress="$DRACUT_COMPRESS_GZIP -n -9 --rsyncable"
else
compress="gzip -n -9"
compress="$DRACUT_COMPRESS_GZIP -n -9"
fi
;;
lzo|lzop)
compress="lzop -9"
compress="$DRACUT_COMPRESS_LZOP -9"
;;
lz4)
compress="lz4 -l -9"
compress="$DRACUT_COMPRESS_LZ4 -l -9"
;;
zstd)
compress="zstd -15 -q -T0"
compress="$DRACUT_COMPRESS_ZSTD -15 -q -T0"
;;
esac
@@ -891,11 +927,32 @@ esac
[[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1
case "${drivers_dir}" in
''|*lib/modules/${kernel}|*lib/modules/${kernel}/) ;;
*)
[[ "$DRACUT_KMODDIR_OVERRIDE" ]] || {
printf "%s\n" "dracut: -k/--kmoddir path must contain \"lib/modules\" as a parent of your kernel module directory,"
printf "%s\n" "dracut: or modules may not be placed in the correct location inside the initramfs."
printf "%s\n" "dracut: was given: ${drivers_dir}"
printf "%s\n" "dracut: expected: $(dirname ${drivers_dir})/lib/modules/${kernel}"
printf "%s\n" "dracut: Please move your modules into the correct directory structure and pass the new location,"
printf "%s\n" "dracut: or set DRACUT_KMODDIR_OVERRIDE=1 to ignore this check."
exit 1
}
;;
esac
readonly TMPDIR="$(realpath -e "$tmpdir")"
[ -d "$TMPDIR" ] || {
printf "%s\n" "dracut: Invalid tmpdir '$tmpdir'." >&2
exit 1
}
if findmnt --raw -n --target "$tmpdir" --output=options | grep -q noexec; then
[[ $debug == yes ]] && printf "%s\n" "dracut: Tmpdir '$tmpdir' is mounted with 'noexec'."
noexec=1
fi
readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
[ -d "$DRACUT_TMPDIR" ] || {
printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2
@@ -920,7 +977,7 @@ if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_t
mkdir "$early_cpio_dir"
fi
export DRACUT_RESOLVE_LAZY="1"
[[ -n "$dracutsysrootdir" || "$noexec" ]] || export DRACUT_RESOLVE_LAZY="1"
if [[ $print_cmdline ]]; then
stdloglvl=0
@@ -949,8 +1006,8 @@ if [[ $no_kernel != yes ]] && ! [[ -d $srcmods ]]; then
fi
if ! [[ $print_cmdline ]]; then
inst /bin/sh
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
inst $DRACUT_TESTBIN
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R "$DRACUT_TESTBIN" &>/dev/null; then
unset DRACUT_RESOLVE_LAZY
export DRACUT_RESOLVE_DEPS=1
fi
@@ -1010,12 +1067,12 @@ esac
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
[[ -d $systemdutildir ]] \
[[ -d $dracutsysrootdir$systemdutildir ]] \
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
if ! [[ -d "$systemdutildir" ]]; then
[[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
[[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
if ! [[ -d "$dracutsysrootdir$systemdutildir" ]]; then
[[ -e $dracutsysrootdir/lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
[[ -e $dracutsysrootdir/usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
fi
@@ -1093,8 +1150,8 @@ if [[ ! $print_cmdline ]]; then
if ! [[ -s $uefi_stub ]]; then
for uefi_stub in \
"${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
"/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
$dracutsysrootdir"${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
"$dracutsysrootdir/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
[[ -s $uefi_stub ]] || continue
break
done
@@ -1105,7 +1162,7 @@ if [[ ! $print_cmdline ]]; then
fi
if ! [[ $kernel_image ]]; then
for kernel_image in "/lib/modules/$kernel/vmlinuz" "/boot/vmlinuz-$kernel"; do
for kernel_image in "$dracutsysrootdir/lib/modules/$kernel/vmlinuz" "$dracutsysrootdir/boot/vmlinuz-$kernel"; do
[[ -s "$kernel_image" ]] || continue
break
done
@@ -1218,7 +1275,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
"/boot/zipl" \
;
do
mp=$(readlink -f "$mp")
mp=$(readlink -f "$dracutsysrootdir$mp")
mountpoint "$mp" >/dev/null 2>&1 || continue
_dev=$(find_block_device "$mp")
_bdev=$(readlink -f "/dev/block/$_dev")
@@ -1233,7 +1290,8 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
fi
done
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
# TODO - with sysroot, /proc/swaps is not relevant
if [[ -f /proc/swaps ]] && [[ -f $dracutsysrootdir/etc/fstab ]]; then
while read dev type rest || [ -n "$dev" ]; do
[[ -b $dev ]] || continue
[[ "$type" == "partition" ]] || continue
@@ -1247,7 +1305,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
_d=$(expand_persistent_dev "$_d")
[[ "$_d" -ef "$dev" ]] || continue
if [[ -f /etc/crypttab ]]; then
if [[ -f $dracutsysrootdir/etc/crypttab ]]; then
while read _mapper _a _p _o || [ -n "$_mapper" ]; do
[[ $_mapper = \#* ]] && continue
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
@@ -1256,19 +1314,19 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
[[ "$_p" == /* ]] && [[ -f $_p ]] && continue 2
# skip mkswap swap
[[ $_o == *swap* ]] && continue 2
done < /etc/crypttab
done < $dracutsysrootdir/etc/crypttab
fi
_dev="$(readlink -f "$dev")"
push_host_devs "$_dev"
swap_devs+=("$_dev")
break
done < /etc/fstab
done < $dracutsysrootdir/etc/fstab
done < /proc/swaps
fi
# collect all "x-initrd.mount" entries from /etc/fstab
if [[ -f /etc/fstab ]]; then
if [[ -f $dracutsysrootdir/etc/fstab ]]; then
while read _d _m _t _o _r || [ -n "$_d" ]; do
[[ "$_d" == \#* ]] && continue
[[ $_d ]] || continue
@@ -1283,7 +1341,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
push_host_devs "$i"
done
fi
done < /etc/fstab
done < $dracutsysrootdir/etc/fstab
fi
fi
@@ -1328,29 +1386,29 @@ for dev in "${!host_fs_types[@]}"; do
fi
done
[[ -d $udevdir ]] \
[[ -d $dracutsysrootdir$udevdir ]] \
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
if ! [[ -d "$udevdir" ]]; then
[[ -e /lib/udev/ata_id ]] && udevdir=/lib/udev
[[ -e /usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
if ! [[ -d "$dracutsysrootdir$udevdir" ]]; then
[[ -e $dracutsysrootdir/lib/udev/ata_id ]] && udevdir=/lib/udev
[[ -e $dracutsysrootdir/usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
fi
[[ -d $systemdsystemunitdir ]] \
[[ -d $dracutsysrootdir$systemdsystemunitdir ]] \
|| systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
[[ -d "$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
[[ -d "$dracutsysrootdir$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
[[ -d $systemdsystemconfdir ]] \
[[ -d $dracutsysrootdir$systemdsystemconfdir ]] \
|| systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2>/dev/null)
[[ -d "$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
[[ -d "$dracutsysrootdir$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
[[ -d $tmpfilesdir ]] \
[[ -d $dracutsysrootdir$tmpfilesdir ]] \
|| tmpfilesdir=$(pkg-config systemd --variable=tmpfilesdir 2>/dev/null)
if ! [[ -d "$tmpfilesdir" ]]; then
[[ -d /lib/tmpfiles.d ]] && tmpfilesdir=/lib/tmpfiles.d
[[ -d /usr/lib/tmpfiles.d ]] && tmpfilesdir=/usr/lib/tmpfiles.d
if ! [[ -d "$dracutsysrootdir$tmpfilesdir" ]]; then
[[ -d $dracutsysrootdir/lib/tmpfiles.d ]] && tmpfilesdir=/lib/tmpfiles.d
[[ -d $dracutsysrootdir/usr/lib/tmpfiles.d ]] && tmpfilesdir=/usr/lib/tmpfiles.d
fi
export initdir dracutbasedir \
@@ -1399,7 +1457,7 @@ fi
# Create some directory structure first
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
[[ -h /lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
[[ -h $dracutsysrootdir/lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
[[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
if [[ $prefix ]]; then
@@ -1501,7 +1559,7 @@ dinfo "*** Including modules done ***"
## final stuff that has to happen
if [[ $no_kernel != yes ]]; then
if [[ $hostonly ]]; then
if [[ $hostonly_mode = "strict" ]]; then
cp "$DRACUT_KERNEL_MODALIASES" $initdir/lib/dracut/hostonly-kernel-modules.txt
fi
@@ -1569,7 +1627,7 @@ if [[ $kernel_only != yes ]]; then
cat "$f" >> "${initdir}/etc/fstab"
done
if [[ $systemdutildir ]]; then
if [[ $dracutsysrootdir$systemdutildir ]]; then
if [ -d ${initdir}/$systemdutildir ]; then
mkdir -p ${initdir}/etc/conf.d
{
@@ -1583,7 +1641,7 @@ if [[ $kernel_only != yes ]]; then
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
dinfo "*** Resolving executable dependencies ***"
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-f} --
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} --
dinfo "*** Resolving executable dependencies done ***"
fi
@@ -1593,7 +1651,7 @@ if [[ $kernel_only != yes ]]; then
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
for _dir in $libdirs; do
for _f in "$_dir/libpthread.so"*; do
for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
[[ -e "$_f" ]] || continue
inst_libdir_file "libgcc_s.so*"
break 2
@@ -1623,9 +1681,9 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
mkdir -m 0755 -p "$object_destdir"
chmod --reference="$objectname" "$object_destdir"
fi
$DRACUT_CP -t "$object_destdir" "$objectname"/*
$DRACUT_CP -t "$object_destdir" "$dracutsysrootdir$objectname"/*
else
$DRACUT_CP -t "$destdir" "$objectname"
$DRACUT_CP -t "$destdir" "$dracutsysrootdir$objectname"
fi
done
elif [[ -e $src ]]; then
@@ -1638,10 +1696,10 @@ done
if [[ $kernel_only != yes ]]; then
# make sure that library links are correct and up to date
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
[[ -f $f ]] && inst_simple "$f"
for f in $dracutsysrootdir/etc/ld.so.conf $dracutsysrootdir/etc/ld.so.conf.d/*; do
[[ -f $f ]] && inst_simple "${f#$dracutsysrootdir}"
done
if ! ldconfig -r "$initdir"; then
if ! $DRACUT_LDCONFIG -r "$initdir" -f /etc/ld.so.conf; then
if [[ $EUID = 0 ]]; then
derror "ldconfig exited ungracefully"
else
@@ -1695,6 +1753,7 @@ if [[ $early_microcode = yes ]]; then
if [[ $hostonly ]]; then
_src=$(get_ucode_file)
[[ $_src ]] || break
[[ -r $_fwdir/$_fw/$_src ]] || _src="${_src}.early"
[[ -r $_fwdir/$_fw/$_src ]] || break
fi
@@ -1711,6 +1770,21 @@ if [[ $early_microcode = yes ]]; then
create_early_cpio="yes"
fi
done
if [[ ! -e "$_dest_dir/${ucode_dest[$idx]}" ]]; then
cd "$early_cpio_dir/d"
for _ucodedir in "${early_microcode_image_dir[@]}"; do
for _ucodename in "${early_microcode_image_name[@]}"; do
[[ -e "$_ucodedir/$_ucodename" ]] && \
cpio --extract --file "$_ucodedir/$_ucodename" --quiet \
"kernel/x86/microcode/${ucode_dest[$idx]}"
if [[ -e "$_dest_dir/${ucode_dest[$idx]}" ]]; then
dinfo "*** Using microcode found in '$_ucodedir/$_ucodename' ***"
create_early_cpio="yes"
break 2
fi
done
done
fi
done
fi
@@ -1871,7 +1945,7 @@ fi
if dracut_module_included "squash"; then
dinfo "*** Squashing the files inside the initramfs ***"
mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
mksquashfs $squash_dir $squash_img -no-xattrs -no-exports -noappend -always-use-fragments -comp xz -Xdict-size 100% -no-progress 1> /dev/null
if [[ $? != 0 ]]; then
dfatal "dracut: Failed making squash image"
@@ -1957,13 +2031,16 @@ if [[ $uefi = yes ]]; then
dinfo "Using UEFI kernel cmdline:"
dinfo $(tr -d '\000' < "$uefi_outdir/cmdline.txt")
[[ -s /usr/lib/os-release ]] && uefi_osrelease="/usr/lib/os-release"
[[ -s /etc/os-release ]] && uefi_osrelease="/etc/os-release"
[[ -s $dracutsysrootdir/usr/lib/os-release ]] && uefi_osrelease="$dracutsysrootdir/usr/lib/os-release"
[[ -s $dracutsysrootdir/etc/os-release ]] && uefi_osrelease="$dracutsysrootdir/etc/os-release"
[[ -s "${dracutsysrootdir}${uefi_splash_image}" ]] && \
uefi_splash_image="${dracutsysroot}${uefi_splash_image}" || unset uefi_splash_image
if objcopy \
${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \
--add-section .cmdline="${uefi_outdir}/cmdline.txt" --change-section-vma .cmdline=0x30000 \
--add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \
${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=0x40000} \
--add-section .linux="$kernel_image" --change-section-vma .linux=0x2000000 \
--add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \
"$uefi_stub" "${uefi_outdir}/linux.efi"; then
if [[ -n "${uefi_secureboot_key}" && -n "${uefi_secureboot_cert}" ]]; then \
@@ -2003,7 +2080,7 @@ command -v restorecon &>/dev/null && restorecon -- "$outfile"
# and there's no reason to sync, and *definitely* no reason to fsfreeze.
# Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
# globally. See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0
if test -d /run/systemd/system; then
if test -d $dracutsysrootdir/run/systemd/system; then
if ! sync "$outfile" 2> /dev/null; then
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
exit 1

View File

@@ -117,7 +117,8 @@ Requires: %{name} = %{version}-%{release}
%endif
Requires: iputils
Requires: iproute
Requires: dhclient
Requires: (NetworkManager >= 1.20 or dhclient)
Suggests: NetworkManager
Obsoletes: dracut-generic < 008
Provides: dracut-generic = %{version}-%{release}
@@ -222,6 +223,9 @@ rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
# we do not support dash in the initramfs
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
# we do not support mksh in the initramfs
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00mksh
# remove gentoo specific modules
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
@@ -362,6 +366,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/90stratis
%{dracutlibdir}/modules.d/90ppcmac
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop

View File

@@ -0,0 +1,116 @@
DRACUT_PN ??= "${PN}"
def dracut_compression_type(d):
rdtype = d.getVar("INITRAMFS_FSTYPES", True).split('.')
if len(rdtype) != 2:
return ['','','']
if rdtype[0] != 'cpio':
return ['','','']
cmptypes = [['gz','--gzip','gzip'],['bz2', '--bzip2','bzip2'],['lzma','--lzma','xz'],['xz','--xz','xz'],['lzo','--lzo','lzo'],['lz4','--lz4','lz4'],['zstd','--zstd','zstd']]
for cmp in cmptypes:
if rdtype[1] == cmp[0]:
return cmp
return ['','','']
def dracut_compression_opt(d):
cmp = dracut_compression_type(d)
return cmp[1]
def dracut_compression_pkg(d):
cmp = dracut_compression_type(d)
return cmp[2]
def dracut_compression_pkg_native(d):
cmp = dracut_compression_type(d)
if cmp[2] == '':
return ''
return cmp[2] + '-native'
DRACUT_COMPRESS_OPT ??= "${@dracut_compression_opt(d)}"
DRACUT_COMPRESS_PKG ??= "${@dracut_compression_pkg(d)}"
DRACUT_COMPRESS_PKG_NATIVE ??= "${@dracut_compression_pkg_native(d)}"
DRACUT_OPTS ??= "--early-microcode ${DRACUT_COMPRESS_OPT}"
python __anonymous () {
pkg = d.getVar("DRACUT_PN", True)
if pkg != 'dracut':
d.appendVar("RDEPENDS_%s" % pkg, " dracut %s " % d.getVar("DRACUT_COMPRESS_PKG", True))
if not pkg.startswith('kernel'):
d.appendVarFlag("do_configure", "depends", "virtual/kernel:do_shared_workdir")
d.appendVarFlag("do_compile", "depends", "virtual/kernel:do_compile_kernelmodules")
}
export BUILD_TIME_KERNEL_VERSION = "${@oe.utils.read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}"
dracut_postinst () {
MY_KERNEL_VERSION=$(readlink $D/boot/bzimage | sed 's,^.*bzImage-,,')
if [[ -z "$MY_KERNEL_VERSION" ]]; then
MY_KERNEL_VERSION="${KERNEL_VERSION}"
fi
if [[ -z "$MY_KERNEL_VERSION" ]]; then
MY_KERNEL_VERSION="${BUILD_TIME_KERNEL_VERSION}"
fi
if [[ -z "$MY_KERNEL_VERSION" ]]; then
exit 1
fi
if [ -n "$D" ]; then
#DEBUGOPTS="--debug --keep"
DEBUGOPTS="--keep"
$INTERCEPT_DIR/postinst_intercept execute_dracut ${PKG} mlprefix=${MLPREFIX} \
prefix= \
MY_KERNEL_VERSION=$MY_KERNEL_VERSION \
DEBUGOPTS="\"$DEBUGOPTS\"" \
DRACUT_OPTS="\"${DRACUT_OPTS}\"" \
systemdutildir=${systemd_unitdir} \
systemdsystemunitdir=${systemd_system_unitdir} \
systemdsystemconfdir=${sysconfdir}/systemd/system \
udevdir=${libdir}/udev \
DRACUT_TMPDIR=${WORKDIR}/dracut-tmpdir \
DRACUT_ARCH="${TUNE_ARCH}" \
DRACUT_COMPRESS_GZIP=$NATIVE_ROOT${bindir}/gzip \
DRACUT_COMPRESS_BZIP2=$NATIVE_ROOT${bindir}/bzip2 \
DRACUT_COMPRESS_LZMA=$NATIVE_ROOT${bindir}/lzma \
DRACUT_LDD="\"PATH='$PATH' ${STAGING_BINDIR_CROSS}/ldd --root $D\"" \
DRACUT_LDCONFIG=$NATIVE_ROOT${bindir}/ldconfig \
DRACUT_INSTALL="\"$NATIVE_ROOT${libdir}/dracut/dracut-install\"" \
PLYMOUTH_LDD="\"${STAGING_BINDIR_CROSS}/ldd --root $D\"" \
PLYMOUTH_LDD_PATH="'$PATH'" \
PLYMOUTH_PLUGIN_PATH=${libdir}/plymouth \
PLYMOUTH_THEME_NAME=${PLYMOUTH_THEME_NAME:-spinner} \
PLYMOUTH_THEME=${PLYMOUTH_THEME_NAME:-spinner}
else
depmod -a $MY_KERNEL_VERSION
echo RUNNING: dracut -f ${DRACUT_OPTS} /boot/initramfs.img $MY_KERNEL_VERSION
echo "dracut: $(dracut --help | grep 'Version:')"
dracut -f ${DRACUT_OPTS} /boot/initramfs.img $MY_KERNEL_VERSION
fi
}
dracut_populate_packages[vardeps] += "dracut_postinst"
python dracut_populate_packages() {
localdata = d.createCopy()
pkg = d.getVar('DRACUT_PN', True)
postinst = d.getVar('pkg_postinst_%s' % pkg, True)
if not postinst:
postinst = '#!/bin/sh\n'
postinst += localdata.getVar('dracut_postinst', True)
d.setVar('pkg_postinst_%s' % pkg, postinst)
}
PACKAGESPLITFUNCS_prepend = "dracut_populate_packages "
DRACUT_DEPENDS = " \
binutils-cross-${TUNE_ARCH} gcc-cross-${TUNE_ARCH} \
ldconfig-native coreutils-native findutils-native \
cpio-native util-linux-native kmod-native ${DRACUT_COMPRESS_PKG_NATIVE} \
dracut-native pkgconfig-native cross-compiler-ldd \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
"
DEPENDS_append_class-target = " ${DRACUT_DEPENDS}"
PACKAGE_WRITE_DEPS_append = " ${DRACUT_DEPENDS}"

View File

@@ -0,0 +1,44 @@
#!/bin/sh
set -e
if [[ -z "$DRACUT_TMPDIR" ]]; then
echo "DRACUT_TMPDIR is unset, exiting"
exit 0
fi
# We have to unset "prefix" as dracut uses it to move files around.
# Yocto has it set as part of the build environment.
export prefix=
# DRACUT settings
export UDEVVERSION=241
export SYSTEMD_VERSION=241
export DRACUT_TESTBIN=/bin/bash.bash
export DRACUT_INSTALL_PATH="/usr/sbin:/usr/bin:/sbin:/bin"
# PLYMOUTH settings
export PLYMOUTH_SYSROOT=$D
export \
systemdutildir systemdsystemunitdir systemdsystemconfdir udevdir \
DRACUT_ARCH DRACUT_TESTBIN DRACUT_LDD DRACUT_LDCONFIG DRACUT_INSTALL \
DRACUT_COMPRESS_GZIP DRACUT_COMPRESS_BZIP2 DRACUT_COMPRESS_LZMA \
PLYMOUTH_LDD PLYMOUTH_LDD_PATH PLYMOUTH_PLUGIN_PATH \
PLYMOUTH_THEME_NAME PLYMOUTH_THEME
# List environment for debugging
echo ROOTFS-POSTINST-ENVIRONMENT
echo -----------
env
echo -----------
[[ -d $DRACUT_TMPDIR ]] || mkdir -p $DRACUT_TMPDIR
# Execute depmod and dracut
echo "$(date) - RUNNING: depmod -b $D -a $MY_KERNEL_VERSION"
depmod -b $D -a $MY_KERNEL_VERSION
echo "dracut: $(dracut --sysroot $D --help | grep 'Version:')"
echo "$(date) - RUNNING: dracut -f --sysroot $D --tmpdir $DRACUT_TMPDIR $DRACUT_OPTS $DEBUGOPTS -k $D/lib/modules/$MY_KERNEL_VERSION $D/boot/initramfs.img $MY_KERNEL_VERSION"
dracut -f --sysroot $D --tmpdir $DRACUT_TMPDIR $DRACUT_OPTS $DEBUGOPTS -k $D/lib/modules/$MY_KERNEL_VERSION $D/boot/initramfs.img $MY_KERNEL_VERSION
echo "$(date) - DONE: dracut"

View File

@@ -0,0 +1,19 @@
diff --git a/cross-compile-ldd b/cross-compile-ldd
index ef2ca20..332d57f 100644
--- a/cross-compile-ldd
+++ b/cross-compile-ldd
@@ -337,13 +337,13 @@ do_scan_etc_ldsoconf() {
# Build up the full list of search directories
declare -a needed_search_path
do_trace "Adding basic lib dirs\n"
-ld_library_path="${ld_library_path}:"
while [ -n "${ld_library_path}" ]; do
d="${ld_library_path%%:*}"
if [ -n "${d}" ]; then
do_trace "-> adding search dir '%s'\n" "${d}"
needed_search_path+=( "${d}" )
fi
+ [[ "$ld_library_path" == "${ld_library_path#*:}" ]] && break
ld_library_path="${ld_library_path#*:}"
done
do_trace "Done adding basic lib dirs\n"

View File

@@ -0,0 +1,33 @@
SUMMARY = "Cross-compiler LDD"
HOMEPAGE = "https://gist.github.com/c403786c1394f53f44a3b61214489e6f"
BUGTRACKER = ""
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://cross-compile-ldd;beginline=53;endline=57;md5=2b29d19d18a430b931dda3750e865c84"
SRCBRANCH = "master"
SRCREV = "eb44581caf7dd60b149a6691abef46264c46e866"
SRC_URI = " \
git://gist.github.com/c403786c1394f53f44a3b61214489e6f.git;protocol=https;branch=${SRCBRANCH} \
file://cross-compile-ldd-fix-infinite-loop.patch \
"
S = "${WORKDIR}/git"
inherit siteinfo
SYSROOT_PREPROCESS_FUNCS += " cross_ldd_populate_sysroot "
cross_ldd_populate_sysroot() {
mkdir -p ${SYSROOT_DESTDIR}${bindir_crossscripts}
cat ${S}/cross-compile-ldd | \
sed \
-e "s,^prefix=.*$,prefix=${TARGET_SYS}," \
-e "s,^bits=.*$,bits=${SITEINFO_BITS}," \
-e "s,^ld_library_path=.*$,ld_library_path=${LD_LIBRARY_PATH:-/lib:/usr/lib}," \
>${SYSROOT_DESTDIR}${bindir_crossscripts}/ldd
chmod +x ${SYSROOT_DESTDIR}${bindir_crossscripts}/ldd
}
DEPENDS = "coreutils-native sed-native binutils-cross-${TARGET_ARCH} gcc-cross-${TARGET_ARCH}"
PACKAGE_WRITE_DEPS = "coreutils-native sed-native binutils-cross-${TARGET_ARCH} gcc-cross-${TARGET_ARCH}"

45
fedora-test-github.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
set -ex
[[ -d ${0%/*} ]] && cd ${0%/*}
RUN_ID="$1"
TESTS=$2
./configure
NCPU=$(getconf _NPROCESSORS_ONLN)
if ! [[ $TESTS ]]; then
# GitHub workflows fetch a clone of the dracut repository which doesn't
# contain git tags, thus "breaking" the RPM build in certain situations
# i.e.:
# DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`,
# which in full git clone returns a tag with a numeric version. However,
# without tags it returns SHA of the last commit, which later propagates into
# `Provides:` attribute of the built RPM and can break dependency tree when
# installed
[[ -d .git ]] && git fetch --tags && git describe --tags
make -j$NCPU all syncheck rpm logtee
else
if [[ $TESTS == "99" ]]; then
[[ -d .git ]] && git fetch --tags && git describe --tags
make_docs=yes
else
make_docs=no
fi
make -j$NCPU enable_documentation=$make_docs all logtee
cd test
time LOGTEE_TIMEOUT_MS=590000 make \
enable_documentation=$make_docs \
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
DRACUT_NO_XATTR=1 \
TEST_RUN_ID=$RUN_ID \
${TESTS:+TESTS="$TESTS"} \
-k V=1 \
check
fi

View File

@@ -7,41 +7,6 @@ set -ex
RUN_ID="$1"
TESTS=$2
dnf -y update --best --allowerasing &>/dev/null
dnf -y install --best --allowerasing \
dash \
asciidoc \
mdadm \
lvm2 \
dmraid \
cryptsetup \
nfs-utils \
nbd \
dhcp-server \
scsi-target-utils \
iscsi-initiator-utils \
strace \
btrfs-progs \
kmod-devel \
gcc \
bzip2 \
xz \
tar \
wget \
rpm-build \
make \
git \
bash-completion \
sudo \
kernel \
dhcp-client \
/usr/bin/qemu-kvm \
/usr/bin/qemu-system-$(uname -i) \
e2fsprogs \
tcpdump \
$NULL &>/dev/null
./configure
NCPU=$(getconf _NPROCESSORS_ONLN)
@@ -49,12 +14,15 @@ NCPU=$(getconf _NPROCESSORS_ONLN)
if ! [[ $TESTS ]]; then
make -j$NCPU all syncheck rpm logtee
else
make -j$NCPU all logtee
[[ $TESTS == "99" ]] && make_docs=yes || make_docs=no
make -j$NCPU enable_documentation=$make_docs all logtee
cd test
time sudo make \
time sudo LOGTEE_TIMEOUT_MS=300000 make \
enable_documentation=$make_docs \
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
DRACUT_NO_XATTR=1 \
TEST_RUN_ID=$RUN_ID \
${TESTS:+TESTS="$TESTS"} \
-k V=2 \

View File

@@ -10,7 +10,7 @@ sub create_patches {
mkdir $pdir, 0755;
open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse '.$tag.'..HEAD |');
open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse --binary '.$tag.'..HEAD |');
while (<GIT>) {
if (/^From [a-z0-9]{40} .*$/) {

View File

@@ -59,11 +59,15 @@ static bool arg_modalias = false;
static bool arg_resolvelazy = false;
static bool arg_resolvedeps = false;
static bool arg_hostonly = false;
static bool no_xattr = false;
static char *destrootdir = NULL;
static char *sysrootdir = NULL;
static size_t sysrootdirlen = 0;
static char *kerneldir = NULL;
static size_t kerneldirlen = 0;
static char **firmwaredirs = NULL;
static char **pathdirs;
static char *ldd = NULL;
static char *logdir = NULL;
static char *logfile = NULL;
FILE *logfile_f = NULL;
@@ -307,7 +311,7 @@ static int cp(const char *src, const char *dst)
normal_copy:
pid = fork();
if (pid == 0) {
if (geteuid() == 0)
if (geteuid() == 0 && no_xattr == false)
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,xattr,timestamps", "-fL", src, dst,
NULL);
else
@@ -319,7 +323,7 @@ static int cp(const char *src, const char *dst)
while (waitpid(pid, &ret, 0) < 0) {
if (errno != EINTR) {
ret = -1;
if (geteuid() == 0)
if (geteuid() == 0 && no_xattr == false)
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,xattr,timestamps -fL %s %s", src,
dst);
else
@@ -398,6 +402,75 @@ static int library_install(const char *src, const char *lib)
return ret;
}
static char *get_real_file(const char *src, bool fullyresolve)
{
char linktarget[PATH_MAX + 1];
ssize_t linksz;
_cleanup_free_ char *fullsrcpath;
char *abspath = NULL;
struct stat sb;
if (sysrootdirlen) {
if (strncmp(src, sysrootdir, sysrootdirlen) == 0)
fullsrcpath = strdup(src);
else if (asprintf(&fullsrcpath, "%s/%s", (sysrootdirlen ? sysrootdir : ""), (src[0] == '/' ? src+1 : src)) < 0)
_exit(EXIT_FAILURE);
} else
fullsrcpath = strdup(src);
log_debug("get_real_file('%s')", fullsrcpath);
if (lstat(fullsrcpath, &sb) < 0)
return NULL;
switch (sb.st_mode & S_IFMT) {
case S_IFDIR:
case S_IFREG:
return strdup(fullsrcpath);
case S_IFLNK:
break;
default:
return NULL;
}
linksz = readlink(fullsrcpath, linktarget, sizeof(linktarget));
if (linksz < 0)
return NULL;
linktarget[linksz] = '\0';
log_debug("get_real_file: readlink('%s') returns '%s'", fullsrcpath, linktarget);
if (linktarget[0] == '/') {
if (asprintf(&abspath, "%s%s", (sysrootdirlen ? sysrootdir : ""), linktarget) < 0)
return NULL;
} else {
_cleanup_free_ char *fullsrcdir = strdup(fullsrcpath);
if (!fullsrcdir) {
log_error("Out of memory!");
return NULL;
}
fullsrcdir[dir_len(fullsrcdir)] = '\0';
if (asprintf(&abspath, "%s/%s", fullsrcdir, linktarget) < 0)
return NULL;
}
if (fullyresolve) {
struct stat st;
if (lstat(abspath, &st) < 0) {
if (errno != ENOENT)
return NULL;
}
if (S_ISLNK(st.st_mode))
return get_real_file(abspath, fullyresolve);
}
log_debug("get_real_file('%s') => '%s'", src, abspath);
return abspath;
}
static int resolve_deps(const char *src)
{
int ret = 0;
@@ -406,6 +479,12 @@ static int resolve_deps(const char *src)
size_t linesize = LINE_MAX;
_cleanup_pclose_ FILE *fptr = NULL;
_cleanup_free_ char *cmd = NULL;
_cleanup_free_ char *fullsrcpath = NULL;
fullsrcpath = get_real_file(src, true);
log_debug("resolve_deps('%s') -> get_real_file('%s', true) = '%s'", src, src, fullsrcpath);
if (!fullsrcpath)
return 0;
buf = malloc(LINE_MAX);
if (buf == NULL)
@@ -413,7 +492,7 @@ static int resolve_deps(const char *src)
if (strstr(src, ".so") == 0) {
_cleanup_close_ int fd = -1;
fd = open(src, O_RDONLY | O_CLOEXEC);
fd = open(fullsrcpath, O_RDONLY | O_CLOEXEC);
if (fd < 0)
return -errno;
@@ -437,12 +516,14 @@ static int resolve_deps(const char *src)
}
/* run ldd */
ret = asprintf(&cmd, "ldd %s 2>&1", src);
ret = asprintf(&cmd, "%s %s 2>&1", ldd, fullsrcpath);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
}
log_debug("%s", cmd);
ret = 0;
fptr = popen(cmd, "r");
@@ -461,6 +542,13 @@ static int resolve_deps(const char *src)
break;
}
/* errors from cross-compiler-ldd */
if (strstr(buf, "unable to find sysroot") || strstr(buf, "command not found")) {
log_error("%s", buf);
ret += 1;
break;
}
/* musl ldd */
if (strstr(buf, "Not a valid dynamic program"))
break;
@@ -597,16 +685,80 @@ static bool check_hashmap(Hashmap *hm, const char *item)
return false;
}
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
static int dracut_mkdir(const char *src) {
_cleanup_free_ char *parent = NULL;
char *path;
struct stat sb;
parent = strdup(src);
if (!parent)
return 1;
path = parent[0] == '/' ? parent+1 : parent;
while (path) {
path = strstr(path, "/");
if (path)
*path = '\0';
if (stat(parent, &sb) == 0) {
if (!S_ISDIR(sb.st_mode)) {
log_error("%s exists but is not a directory!", parent);
return 1;
}
} else if (errno != ENOENT) {
log_error("ERROR: stat '%s': %s", parent, strerror(errno));
return 1;
} else {
if (mkdir(parent, 0755) < 0) {
log_error("ERROR: mkdir '%s': %s", parent, strerror(errno));
return 1;
}
}
if (path) {
*path = '/';
path++;
}
}
return 0;
}
static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir, bool resolvedeps, bool hashdst)
{
struct stat sb, db;
_cleanup_free_ char *fullsrcpath = NULL;
_cleanup_free_ char *fulldstpath = NULL;
_cleanup_free_ char *fulldstdir = NULL;
int ret;
bool src_exists = true;
bool src_islink = false;
bool src_isdir = false;
mode_t src_mode = 0;
bool dst_exists = true;
char *i = NULL;
_cleanup_free_ char *src;
_cleanup_free_ char *dst;
log_debug("dracut_install('%s', '%s')", src, dst);
if (sysrootdirlen) {
if (strncmp(orig_src, sysrootdir, sysrootdirlen) == 0) {
src = strdup(orig_src + sysrootdirlen);
fullsrcpath = strdup(orig_src);
} else {
src = strdup(orig_src);
if (asprintf(&fullsrcpath, "%s%s", sysrootdir, src) < 0)
_exit(EXIT_FAILURE);
}
if (strncmp(orig_dst, sysrootdir, sysrootdirlen) == 0)
dst = strdup(orig_dst + sysrootdirlen);
else
dst = strdup(orig_dst);
} else {
src = strdup(orig_src);
fullsrcpath = strdup(src);
dst = strdup(orig_dst);
}
log_debug("dracut_install('%s', '%s', %d, %d, %d)", src, dst, isdir, resolvedeps, hashdst);
if (check_hashmap(items_failed, src)) {
log_debug("hash hit items_failed for '%s'", src);
@@ -618,22 +770,19 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
return 0;
}
if (lstat(src, &sb) < 0) {
src_exists = false;
if (lstat(fullsrcpath, &sb) < 0) {
if (!isdir) {
i = strdup(src);
hashmap_put(items_failed, i, i);
/* src does not exist */
return 1;
}
} else {
src_islink = S_ISLNK(sb.st_mode);
src_isdir = S_ISDIR(sb.st_mode);
src_mode = sb.st_mode;
}
i = strdup(dst);
if (!i)
return -ENOMEM;
hashmap_put(items, i, i);
ret = asprintf(&fulldstpath, "%s/%s", destrootdir, (dst[0]=='/' ? (dst+1) : dst));
if (ret < 0) {
log_error("Out of memory!");
@@ -642,15 +791,18 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
ret = stat(fulldstpath, &sb);
if (ret != 0 && (errno != ENOENT)) {
log_error("ERROR: stat '%s': %m", fulldstpath);
return 1;
if (ret != 0) {
dst_exists = false;
if (errno != ENOENT) {
log_error("ERROR: stat '%s': %m", fulldstpath);
return 1;
}
}
if (ret == 0) {
if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
log_debug("'%s' already exists, but checking for any deps", fulldstpath);
ret = resolve_deps(src);
ret = resolve_deps(fullsrcpath + sysrootdirlen);
} else
log_debug("'%s' already exists", fulldstpath);
@@ -660,6 +812,10 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
/* check destination directory */
fulldstdir = strdup(fulldstpath);
if (!fulldstdir) {
log_error("Out of memory!");
return 1;
}
fulldstdir[dir_len(fulldstdir)] = '\0';
ret = stat(fulldstdir, &db);
@@ -686,24 +842,34 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
}
}
if (isdir && !src_exists) {
if (src_isdir) {
if (dst_exists) {
if (S_ISDIR(sb.st_mode)) {
log_debug("dest dir '%s' already exists", fulldstpath);
return 0;
}
log_error("dest dir '%s' already exists but is not a directory", fulldstpath);
return 1;
}
log_info("mkdir '%s'", fulldstpath);
ret = mkdir(fulldstpath, 0755);
ret = dracut_mkdir(fulldstpath);
if (ret == 0) {
i = strdup(dst);
if (!i)
return -ENOMEM;
hashmap_put(items, i, i);
}
return ret;
}
/* ready to install src */
if (S_ISDIR(sb.st_mode)) {
log_info("mkdir '%s'", fulldstpath);
ret = mkdir(fulldstpath, sb.st_mode | S_IWUSR);
return ret;
}
if (S_ISLNK(sb.st_mode)) {
if (src_islink) {
_cleanup_free_ char *abspath = NULL;
abspath = realpath(src, NULL);
abspath = get_real_file(src, false);
if (abspath == NULL)
return 1;
@@ -721,7 +887,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
if (lstat(fulldstpath, &sb) != 0) {
_cleanup_free_ char *absdestpath = NULL;
ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath));
ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath) + sysrootdirlen);
if (ret < 0) {
log_error("Out of memory!");
exit(EXIT_FAILURE);
@@ -738,9 +904,9 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
return 0;
}
if (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
if (src_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
if (resolvedeps)
ret += resolve_deps(src);
ret += resolve_deps(fullsrcpath + sysrootdirlen);
if (arg_hmac) {
/* copy .hmac files also */
hmac_install(src, dst, NULL);
@@ -748,14 +914,28 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
}
log_debug("dracut_install ret = %d", ret);
log_info("cp '%s' '%s'", src, fulldstpath);
if (arg_hostonly && !arg_module)
mark_hostonly(dst);
ret += cp(src, fulldstpath);
if (ret == 0 && logfile_f)
dracut_log_cp(src);
if (isdir) {
log_info("mkdir '%s'", fulldstpath);
ret += dracut_mkdir(fulldstpath);
} else {
log_info("cp '%s' '%s'", fullsrcpath, fulldstpath);
ret += cp(fullsrcpath, fulldstpath);
}
if (ret == 0) {
i = strdup(dst);
if (!i)
return -ENOMEM;
hashmap_put(items, i, i);
if (logfile_f)
dracut_log_cp(src);
}
log_debug("dracut_install ret = %d", ret);
@@ -771,11 +951,11 @@ static void item_free(char *i)
static void usage(int status)
{
/* */
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
"or: %s -D DESTROOTDIR [OPTION]... -m KERNELMODULE [KERNELMODULE …]\n"
printf("Usage: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... -a SOURCE...\n"
"or: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... SOURCE DEST\n"
"or: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... -m KERNELMODULE [KERNELMODULE …]\n"
"\n"
"Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n"
"Install SOURCE (from rootfs or SYSROOTDIR) to DEST in DESTROOTDIR with all needed dependencies.\n"
"\n"
" KERNELMODULE can have the format:\n"
" <absolute path> with a leading /\n"
@@ -783,6 +963,7 @@ static void usage(int status)
" <module name>\n"
"\n"
" -D --destrootdir Install all files to DESTROOTDIR as the root\n"
" -r --sysrootdir Install all files from SYSROOTDIR\n"
" -a --all Install all SOURCE arguments to DESTROOTDIR\n"
" -o --optional If SOURCE does not exist, do not fail\n"
" -d --dir SOURCE is a directory\n"
@@ -842,6 +1023,7 @@ static int parse_argv(int argc, char *argv[])
{"module", no_argument, NULL, 'm'},
{"fips", no_argument, NULL, 'f'},
{"destrootdir", required_argument, NULL, 'D'},
{"sysrootdir", required_argument, NULL, 'r'},
{"logdir", required_argument, NULL, 'L'},
{"mod-filter-path", required_argument, NULL, 'p'},
{"mod-filter-nopath", required_argument, NULL, 'P'},
@@ -855,7 +1037,7 @@ static int parse_argv(int argc, char *argv[])
{NULL, 0, NULL, 0}
};
while ((c = getopt_long(argc, argv, "madfhlL:oD:HRp:P:s:S:N:", options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "madfhlL:oD:Hr:Rp:P:s:S:N:v", options, NULL)) != -1) {
switch (c) {
case ARG_VERSION:
puts(PROGRAM_VERSION_STRING);
@@ -894,6 +1076,10 @@ static int parse_argv(int argc, char *argv[])
case 'D':
destrootdir = strdup(optarg);
break;
case 'r':
sysrootdir = strdup(optarg);
sysrootdirlen = strlen(sysrootdir);
break;
case 'p':
if (regcomp(&mod_filter_path, optarg, REG_NOSUB|REG_EXTENDED) != 0) {
log_error("Module path filter %s is not a regular expression", optarg);
@@ -1022,6 +1208,7 @@ static char **find_binary(const char *src)
{
char **ret = NULL;
char **q;
char *fullsrcpath;
char *newsrc = NULL;
STRV_FOREACH(q, pathdirs) {
@@ -1034,15 +1221,28 @@ static char **find_binary(const char *src)
exit(EXIT_FAILURE);
}
if (stat(newsrc, &sb) != 0) {
log_debug("stat(%s) != 0", newsrc);
fullsrcpath = get_real_file(newsrc, false);
if (!fullsrcpath) {
log_debug("get_real_file(%s) not found", newsrc);
free(newsrc);
newsrc = NULL;
continue;
}
if (lstat(fullsrcpath, &sb) != 0) {
log_debug("stat(%s) != 0", fullsrcpath);
free(newsrc);
newsrc = NULL;
free(fullsrcpath);
fullsrcpath = NULL;
continue;
}
strv_push(&ret, newsrc);
free(fullsrcpath);
fullsrcpath = NULL;
};
if (ret) {
@@ -1711,6 +1911,7 @@ int main(int argc, char **argv)
int r;
char *i;
char *path = NULL;
char *env_no_xattr = NULL;
r = parse_argv(argc, argv);
if (r <= 0)
@@ -1738,7 +1939,13 @@ int main(int argc, char **argv)
exit(0);
}
path = getenv("PATH");
log_debug("Program arguments:");
for (r = 0; r < argc; r++)
log_debug("%s", argv[r]);
path = getenv("DRACUT_INSTALL_PATH");
if (path == NULL)
path = getenv("PATH");
if (path == NULL) {
log_error("PATH is not set");
@@ -1747,6 +1954,15 @@ int main(int argc, char **argv)
log_debug("PATH=%s", path);
ldd = getenv("DRACUT_LDD");
if (ldd == NULL)
ldd = "ldd";
log_debug("LDD=%s", ldd);
env_no_xattr = getenv("DRACUT_NO_XATTR");
if (env_no_xattr != NULL)
no_xattr = true;
pathdirs = strv_split(path, ":");
umask(0022);

View File

@@ -41,86 +41,10 @@ struct Hashmap {
struct hashmap_entry *iterate_list_head, *iterate_list_tail;
unsigned n_entries;
bool from_pool;
};
#define BY_HASH(h) ((struct hashmap_entry**) ((uint8_t*) (h) + ALIGN(sizeof(Hashmap))))
struct pool {
struct pool *next;
unsigned n_tiles;
unsigned n_used;
};
static struct pool *first_hashmap_pool = NULL;
static void *first_hashmap_tile = NULL;
static struct pool *first_entry_pool = NULL;
static void *first_entry_tile = NULL;
static void* allocate_tile(struct pool **first_pool, void **first_tile, size_t tile_size) {
unsigned i;
if (*first_tile) {
void *r;
r = *first_tile;
*first_tile = * (void**) (*first_tile);
return r;
}
if (_unlikely_(!*first_pool) || _unlikely_((*first_pool)->n_used >= (*first_pool)->n_tiles)) {
unsigned n;
size_t size;
struct pool *p;
n = *first_pool ? (*first_pool)->n_tiles : 0;
n = MAX(512U, n * 2);
size = PAGE_ALIGN(ALIGN(sizeof(struct pool)) + n*tile_size);
n = (size - ALIGN(sizeof(struct pool))) / tile_size;
p = malloc(size);
if (!p)
return NULL;
p->next = *first_pool;
p->n_tiles = n;
p->n_used = 0;
*first_pool = p;
}
i = (*first_pool)->n_used++;
return ((uint8_t*) (*first_pool)) + ALIGN(sizeof(struct pool)) + i*tile_size;
}
static void deallocate_tile(void **first_tile, void *p) {
* (void**) p = *first_tile;
*first_tile = p;
}
#ifndef __OPTIMIZE__
static void drop_pool(struct pool *p) {
while (p) {
struct pool *n;
n = p->next;
free(p);
p = n;
}
}
__attribute__((destructor)) static void cleanup_pool(void) {
/* Be nice to valgrind */
drop_pool(first_hashmap_pool);
drop_pool(first_entry_pool);
}
#endif
unsigned string_hash_func(const void *p) {
unsigned hash = 5381;
const signed char *c;
@@ -146,26 +70,15 @@ int trivial_compare_func(const void *a, const void *b) {
}
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
bool b;
Hashmap *h;
size_t size;
b = is_main_thread();
size = ALIGN(sizeof(Hashmap)) + NBUCKETS * sizeof(struct hashmap_entry*);
if (b) {
h = allocate_tile(&first_hashmap_pool, &first_hashmap_tile, size);
if (!h)
return NULL;
h = malloc0(size);
memset(h, 0, size);
} else {
h = malloc0(size);
if (!h)
return NULL;
}
if (!h)
return NULL;
h->hash_func = hash_func ? hash_func : trivial_hash_func;
h->compare_func = compare_func ? compare_func : trivial_compare_func;
@@ -173,8 +86,6 @@ Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
h->n_entries = 0;
h->iterate_list_head = h->iterate_list_tail = NULL;
h->from_pool = b;
return h;
}
@@ -245,7 +156,8 @@ static void unlink_entry(Hashmap *h, struct hashmap_entry *e, unsigned hash) {
h->n_entries--;
}
static void remove_entry(Hashmap *h, struct hashmap_entry *e) {
static void remove_entry(Hashmap *h, struct hashmap_entry **ep) {
struct hashmap_entry *e = *ep;
unsigned hash;
assert(h);
@@ -255,10 +167,8 @@ static void remove_entry(Hashmap *h, struct hashmap_entry *e) {
unlink_entry(h, e, hash);
if (h->from_pool)
deallocate_tile(&first_entry_tile, e);
else
free(e);
free(e);
*ep = NULL;
}
void hashmap_free(Hashmap*h) {
@@ -268,10 +178,7 @@ void hashmap_free(Hashmap*h) {
hashmap_clear(h);
if (h->from_pool)
deallocate_tile(&first_hashmap_tile, h);
else
free(h);
free(h);
}
void hashmap_free_free(Hashmap *h) {
@@ -287,8 +194,10 @@ void hashmap_clear(Hashmap *h) {
if (!h)
return;
while (h->iterate_list_head)
remove_entry(h, h->iterate_list_head);
while (h->iterate_list_head) {
struct hashmap_entry *e = h->iterate_list_head;
remove_entry(h, &e);
}
}
static struct hashmap_entry *hash_scan(Hashmap *h, unsigned hash, const void *key) {
@@ -319,10 +228,7 @@ int hashmap_put(Hashmap *h, const void *key, void *value) {
return -EEXIST;
}
if (h->from_pool)
e = allocate_tile(&first_entry_pool, &first_entry_tile, sizeof(struct hashmap_entry));
else
e = new(struct hashmap_entry, 1);
e = new(struct hashmap_entry, 1);
if (!e)
return -ENOMEM;
@@ -381,7 +287,7 @@ void* hashmap_remove(Hashmap *h, const void *key) {
return NULL;
data = e->value;
remove_entry(h, e);
remove_entry(h, &e);
return data;
}
@@ -426,7 +332,7 @@ int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_
if ((k = hash_scan(h, new_hash, new_key)))
if (e != k)
remove_entry(h, k);
remove_entry(h, &k);
unlink_entry(h, e, old_hash);
@@ -453,7 +359,7 @@ void* hashmap_remove_value(Hashmap *h, const void *key, void *value) {
if (e->value != value)
return NULL;
remove_entry(h, e);
remove_entry(h, &e);
return value;
}
@@ -579,6 +485,7 @@ void* hashmap_last(Hashmap *h) {
}
void* hashmap_steal_first(Hashmap *h) {
struct hashmap_entry *e;
void *data;
if (!h)
@@ -587,13 +494,15 @@ void* hashmap_steal_first(Hashmap *h) {
if (!h->iterate_list_head)
return NULL;
data = h->iterate_list_head->value;
remove_entry(h, h->iterate_list_head);
e = h->iterate_list_head;
data = e->value;
remove_entry(h, &e);
return data;
}
void* hashmap_steal_first_key(Hashmap *h) {
struct hashmap_entry *e;
void *key;
if (!h)
@@ -602,8 +511,9 @@ void* hashmap_steal_first_key(Hashmap *h) {
if (!h->iterate_list_head)
return NULL;
key = (void*) h->iterate_list_head->key;
remove_entry(h, h->iterate_list_head);
e = h->iterate_list_head;
key = (void*) e->key;
remove_entry(h, &e);
return key;
}
@@ -694,22 +604,6 @@ int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key) {
return 0;
}
Hashmap *hashmap_copy(Hashmap *h) {
Hashmap *copy;
assert(h);
if (!(copy = hashmap_new(h->hash_func, h->compare_func)))
return NULL;
if (hashmap_merge(copy, h) < 0) {
hashmap_free(copy);
return NULL;
}
return copy;
}
char **hashmap_get_strv(Hashmap *h) {
char **sv;
Iterator it;

View File

@@ -46,7 +46,6 @@ int trivial_compare_func(const void *a, const void *b);
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func);
void hashmap_free(Hashmap *h);
void hashmap_free_free(Hashmap *h);
Hashmap *hashmap_copy(Hashmap *h);
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func);
int hashmap_put(Hashmap *h, const void *key, void *value);

View File

@@ -264,14 +264,21 @@ int log_set_max_level_from_string(const char *e) {
void log_parse_environment(void) {
const char *e;
if ((e = getenv("DRACUT_LOG_TARGET")))
if ((e = getenv("DRACUT_INSTALL_LOG_TARGET"))) {
if (log_set_target_from_string(e) < 0)
log_warning("Failed to parse log target %s. Ignoring.", e);
} else if ((e = getenv("DRACUT_LOG_TARGET"))) {
if (log_set_target_from_string(e) < 0)
log_warning("Failed to parse log target %s. Ignoring.", e);
}
if ((e = getenv("DRACUT_LOG_LEVEL")))
if ((e = getenv("DRACUT_INSTALL_LOG_LEVEL"))) {
if (log_set_max_level_from_string(e) < 0)
log_warning("Failed to parse log level %s. Ignoring.", e);
} else if ((e = getenv("DRACUT_LOG_LEVEL"))) {
if (log_set_max_level_from_string(e) < 0)
log_warning("Failed to parse log level %s. Ignoring.", e);
}
}
LogTarget log_get_target(void) {

View File

@@ -1,5 +1,6 @@
#define _GNU_SOURCE
#include <fcntl.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -13,13 +14,26 @@ main(int argc, char *argv[])
{
int fd;
int len, slen;
int ret;
int timeout;
char *timeout_env;
struct pollfd fds[] = {{
.fd = STDIN_FILENO,
.events = POLLIN | POLLERR,
}};
timeout_env = getenv("LOGTEE_TIMEOUT_MS");
if (timeout_env)
timeout = atoi(timeout_env);
else
timeout = -1;
if (argc != 2) {
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
exit(EXIT_FAILURE);
}
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, 0644);
if (fd == -1) {
perror("open");
exit(EXIT_FAILURE);
@@ -30,8 +44,13 @@ main(int argc, char *argv[])
slen = 0;
do {
ret = poll (fds, sizeof(fds) / sizeof(fds[0]), timeout);
if (ret == 0) {
fprintf (stderr, "Timed out after %d milliseconds of no output.\n", timeout);
exit(EXIT_FAILURE);
}
len = splice(STDIN_FILENO, NULL, fd, NULL,
BUFLEN, SPLICE_F_MOVE);
BUFLEN, SPLICE_F_MOVE | SPLICE_F_NONBLOCK);
if (len < 0) {
if (errno == EAGAIN)
@@ -51,4 +70,4 @@ main(int argc, char *argv[])
close(fd);
fprintf(stderr, "\n");
exit(EXIT_SUCCESS);
}
}

View File

@@ -3,6 +3,7 @@ LSINITRD(1)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----

View File

@@ -236,6 +236,8 @@ case $bin in
$'\x71\xc7'*|070701)
CAT="cat --"
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
# Debian mkinitramfs does not create the file 'early_cpio', so let's check if firmware files exist
[[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2>/dev/null)
if [[ "$is_early" ]]; then
if [[ -n "$unpack" ]]; then
# should use --unpackearly for early CPIO

View File

@@ -53,7 +53,7 @@ default_kernel_images() {
local regex kernel_image kernel_version version_version initrd_image
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
case "$(uname -m)" in
case "${DRACUT_ARCH:-$(uname -m)}" in
s390|s390x)
regex='image'
;;

View File

@@ -164,7 +164,7 @@ default_kernel_images() {
local regex kernel_image kernel_version version_version initrd_image
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
case "$(uname -m)" in
case "${DRACUT_ARCH:-$(uname -m)}" in
s390|s390x)
regex='image'
;;

View File

@@ -3,6 +3,7 @@ MKINITRD(8)
:doctype: manpage
:man source: dracut
:man manual: dracut
:man version: {version}
NAME
----

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# called by dracut
check() {
require_binaries /bin/mksh
}
# called by dracut
depends() {
return 0
}
# called by dracut
install() {
# If another shell is already installed, do not use mksh
[[ -x $initdir/bin/sh ]] && return
# Prefer mksh as /bin/sh if it is available.
inst /bin/mksh && ln -sf mksh "${initdir}/bin/sh"
}

View File

@@ -1,7 +1,7 @@
#!/bin/bash
getSystemdVersion() {
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
[ -z "$SYSTEMD_VERSION" ] && SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
# Check if the systemd version is a valid number
if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
@@ -154,6 +154,7 @@ install() {
mount umount reboot poweroff \
systemd-run systemd-escape \
systemd-cgls systemd-tmpfiles \
systemd-ask-password systemd-tty-ask-password-agent \
/etc/udev/udev.hwdb \
${NULL}
@@ -163,7 +164,7 @@ install() {
modules_load_get() {
local _line i
for i in "$1"/*.conf; do
for i in "$dracutsysrootdir$1"/*.conf; do
[[ -f $i ]] || continue
while read _line || [ -n "$_line" ]; do
case $_line in
@@ -208,17 +209,17 @@ install() {
# install adm user/group for journald
inst_multiple nologin
grep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
grep '^wheel:' /etc/group >> "$initdir/etc/group"
grep '^adm:' /etc/group >> "$initdir/etc/group"
grep '^utmp:' /etc/group >> "$initdir/etc/group"
grep '^root:' /etc/group >> "$initdir/etc/group"
grep '^systemd-journal:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^adm:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^systemd-journal:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
grep '^wheel:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
grep '^adm:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
grep '^utmp:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
grep '^root:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
grep '^systemd-network:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^systemd-network:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
ln_r $systemdutildir/systemd "/init"
ln_r $systemdutildir/systemd "/sbin/init"
@@ -240,9 +241,7 @@ install() {
systemd-ask-password-console.service \
systemd-ask-password-plymouth.service \
; do
mkdir -p "${initdir}${systemdsystemunitdir}/${i}.wants"
ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \
"${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
systemctl -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service
done
mkdir -p "$initdir/etc/systemd"
@@ -254,6 +253,5 @@ install() {
echo "RateLimitBurst=0"
} >> "$initdir/etc/systemd/journald.conf"
ln_r "${systemdsystemunitdir}/multi-user.target" "${systemdsystemunitdir}/default.target"
systemctl -q --root "$initdir" set-default multi-user.target
}

View File

@@ -5,7 +5,7 @@
# called by dracut
check() {
# hwclock does not exist on S390(x), bail out silently then
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
[ -e /etc/localtime -a -e /etc/adjtime ] || return 1

View File

@@ -1,7 +1,9 @@
#!/bin/sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
elif [ -z "$fipsmode" ]; then
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
elif getarg boot= >/dev/null; then
. /sbin/fips.sh
if mount_boot; then

View File

@@ -1,7 +1,9 @@
#!/bin/sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
elif [ -z "$fipsmode" ]; then
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
elif ! [ -f /tmp/fipsdone ]; then
. /sbin/fips.sh
mount_boot

View File

@@ -111,14 +111,21 @@ do_fips()
do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
elif [ -e "/run/install/repo/images/pxeboot/vmlinuz" ]; then
# This is a boot.iso with the .hmac inside the install.img
do_rhevh_check /run/install/repo/images/pxeboot/vmlinuz || return 1
else
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
# Trim off any leading GRUB boot device (e.g. ($root) )
BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')"
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"
if [ -z "$BOOT_IMAGE_NAME" ]; then
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}" ]; then
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
#if /boot is not a separate partition BOOT_IMAGE might start with /boot
BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"}
#on some achitectures BOOT_IMAGE does not contain path to kernel
@@ -129,13 +136,13 @@ do_fips()
fi
fi
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}.${BOOT_IMAGE_NAME}.hmac"
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}/.${BOOT_IMAGE_NAME}.hmac"
if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then
warn "${BOOT_IMAGE_HMAC} does not exist"
return 1
fi
sha512hmac -c "${BOOT_IMAGE_HMAC}" || return 1
(cd "${BOOT_IMAGE_HMAC%/*}" && sha512hmac -c "${BOOT_IMAGE_HMAC}") || return 1
fi
info "All initrd crypto checks done"

View File

@@ -27,7 +27,7 @@ installkernel() {
_fipsmodules+="cipher_null des3_ede aes cfb "
# Modes/templates:
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac "
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac ofb cts "
# Compression algs:
_fipsmodules+="deflate lzo zlib "

View File

@@ -36,6 +36,5 @@ install() {
$systemdsystemunitdir/initrd-udevadm-cleanup-db.service \
$systemdsystemunitdir/initrd-parse-etc.service
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
systemctl -q --root "$initdir" set-default initrd.target
}

View File

@@ -48,12 +48,12 @@ install() {
# inst_dir /var/lib/systemd/clock
grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
# grep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
# grep '^systemd-timesync:' /etc/group >> "$initdir/etc/group"
grep '^systemd-network:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^systemd-network:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
# grep '^systemd-timesync:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
# grep '^systemd-timesync:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
_arch=$(uname -m)
_arch=${DRACUT_ARCH:-$(uname -m)}
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_myhostname.so.*" \
@@ -61,11 +61,11 @@ install() {
for i in \
systemd-networkd-wait-online.service \
systemd-networkd.service \
systemd-networkd.socket
# systemd-timesyncd.service
systemd-networkd.service \
systemd-networkd.socket
# systemd-timesyncd.service
do
systemctl --root "$initdir" enable "$i"
systemctl -q --root "$initdir" enable "$i"
done
}

View File

@@ -12,8 +12,8 @@ check() {
# do not include module in hostonly mode,
# if no keys are present
if [[ $hostonly ]]; then
x=$(echo /lib/modules/keys/*)
[[ "${x}" = "/lib/modules/keys/*" ]] && return 255
x=$(echo $dracutsysrootdir/lib/modules/keys/*)
[[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && return 255
fi
return 0
@@ -31,8 +31,8 @@ install() {
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
for x in /lib/modules/keys/* ; do
[[ "${x}" = "/lib/modules/keys/*" ]] && break
inst_simple "${x}"
for x in $dracutsysrootdir/lib/modules/keys/* ; do
[[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && break
inst_simple "${x#$dracutsysrootdir}"
done
}

View File

@@ -33,7 +33,6 @@ check() {
install() {
inst rngd
inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"
mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
ln -rfs "${initdir}${systemdsystemunitdir}/rngd.service" \
"${initdir}${systemdsystemunitdir}/sysinit.target.wants/rngd.service"
systemctl -q --root "$initdir" add-wants sysinit.target rngd.service
}

View File

@@ -19,7 +19,7 @@ install() {
if dracut_module_included "systemd"; then
unset FONT
unset KEYMAP
[[ -f /etc/vconsole.conf ]] && . /etc/vconsole.conf
[[ -f $dracutsysrootdir/etc/vconsole.conf ]] && . $dracutsysrootdir/etc/vconsole.conf
fi
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
@@ -32,8 +32,8 @@ install() {
local MAPS=$1
local MAPNAME=${1%.map*}
local map
[[ ! -f $MAPS ]] && \
MAPS=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
[[ ! -f $dracutsysrootdir$MAPS ]] && \
MAPS=$(find $dracutsysrootdir${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
for map in $MAPS; do
KEYMAPS="$KEYMAPS $map "
@@ -44,7 +44,7 @@ install() {
esac
for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
for FN in $(find $dracutsysrootdir${kbddir}/keymaps -type f -name $INCL\*); do
strstr "$KEYMAPS" " $FN " || findkeymap $FN
done
done
@@ -87,8 +87,8 @@ install() {
for map in ${item[1]//,/ }
do
map=(${map//-/ })
if [[ -f "${item[0]}" ]]; then
value=$(grep "^${map[0]}=" "${item[0]}")
if [[ -f "$dracutsysrootdir${item[0]}" ]]; then
value=$(grep "^${map[0]}=" "$dracutsysrootdir${item[0]}")
value=${value#*=}
echo "${map[1]:-${map[0]}}=${value}"
fi
@@ -116,9 +116,10 @@ install() {
install_all_kbd() {
local rel f
for _src in $(eval echo ${kbddir}/{${KBDSUBDIRS}}); do
for __src in $(eval echo $dracutsysrootdir${kbddir}/{${KBDSUBDIRS}}); do
_src=${__src#$dracutsysrootdir}
inst_dir "$_src"
$DRACUT_CP -L -t "${initdir}/${_src}" "$_src"/*
$DRACUT_CP -L -t "${initdir}/${_src}" "$__src"/*
done
# remove unnecessary files
@@ -139,8 +140,8 @@ install() {
local map
eval $(gather_vars ${i18n_vars})
[ -f $I18N_CONF ] && . $I18N_CONF
[ -f $VCONFIG_CONF ] && . $VCONFIG_CONF
[ -f $dracutsysrootdir$I18N_CONF ] && . $dracutsysrootdir$I18N_CONF
[ -f $dracutsysrootdir$VCONFIG_CONF ] && . $dracutsysrootdir$VCONFIG_CONF
shopt -q -s nocasematch
if [[ ${UNICODE} ]]
@@ -222,14 +223,14 @@ install() {
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
fi
if dracut_module_included "systemd" && [[ -f ${I18N_CONF} ]]; then
if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${I18N_CONF} ]]; then
inst_simple ${I18N_CONF}
else
mksubdirs ${initdir}${I18N_CONF}
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
fi
if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then
if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${VCONFIG_CONF} ]]; then
inst_simple ${VCONFIG_CONF}
else
mksubdirs ${initdir}${VCONFIG_CONF}
@@ -242,16 +243,16 @@ install() {
checks() {
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
do
[[ -d "${kbddir}" ]] && \
[[ -d "$dracutsysrootdir${kbddir}" ]] && \
for dir in ${KBDSUBDIRS//,/ }
do
[[ -d "${kbddir}/${dir}" ]] && continue
[[ -d "$dracutsysrootdir${kbddir}/${dir}" ]] && continue
false
done && break
kbddir=''
done
[[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
[[ -f $dracutsysrootdir$I18N_CONF && -f $dracutsysrootdir$VCONFIG_CONF ]] || \
[[ ! ${hostonly} || ${i18n_vars} ]] || {
derror 'i18n_vars not set! Please set up i18n_vars in ' \
'configuration file.'

View File

@@ -75,8 +75,8 @@ setup_interface() {
setup_interface6() {
domain=$new_domain_name
search=$(printf -- "$new_domain_search")
namesrv=$new_domain_name_servers
search=$(printf -- "$new_dhcp6_domain_search")
namesrv=$new_dhcp6_name_servers
hostname=$new_host_name
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
[ -n "$new_max_life" ] && lease_time=$new_max_life
@@ -146,7 +146,7 @@ parse_option_121() {
temp_result="$destination via $gateway dev $interface"
fi
echo "/sbin/ip route add $temp_result"
echo "/sbin/ip route replace $temp_result"
done
}

View File

@@ -50,8 +50,9 @@ do_dhcp() {
while [ $_COUNT -lt $_DHCPRETRY ]; do
info "Starting dhcp for interface $netif"
dhclient "$@" \
${_timeout:+-timeout $_timeout} \
${_timeout:+--timeout $_timeout} \
-q \
-1 \
-cf /etc/dhclient.conf \
-pf /tmp/dhclient.$netif.pid \
-lf /tmp/dhclient.$netif.lease \
@@ -61,6 +62,9 @@ do_dhcp() {
[ $_COUNT -lt $_DHCPRETRY ] && sleep 1
done
warn "dhcp for interface $netif failed"
# nuke those files since we failed; we might retry dhcp again if it's e.g.
# `ip=dhcp,dhcp6` and we check for the PID file at the top
rm -f /tmp/dhclient.$netif.{pid,lease}
return 1
}
@@ -449,19 +453,15 @@ for p in $(getargs ip=); do
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
fi
case $autoconf in
dhcp|on|any|dhcp6)
;;
*)
if [ $ret -eq 0 ]; then
setup_net $netif
source_hook initqueue/online $netif
if [ -z "$manualup" ]; then
/sbin/netroot $netif
fi
fi
;;
esac
# and finally, finish interface set up if there isn't already a script
# to do so (which is the case in the dhcp path)
if [ ! -e $hookdir/initqueue/setup_net_$netif.sh ]; then
setup_net $netif
source_hook initqueue/online $netif
if [ -z "$manualup" ]; then
/sbin/netroot $netif
fi
fi
if command -v wicked >/dev/null && [ -z "$manualup" ]; then
/sbin/netroot $netif

View File

@@ -82,7 +82,7 @@ install() {
)
done
_arch=$(uname -m)
_arch=${DRACUT_ARCH:-$(uname -m)}
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"

View File

@@ -65,9 +65,9 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
bootdev=$(cat /tmp/net.bootdev)
fi
ifup='/sbin/ifup $env{INTERFACE}'
ifup='/sbin/ifup $name'
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$name --unique --onetime $ifup\""
# We have some specific interfaces to handle
if [ -n "${RAW_IFACES}${IFACES}" ]; then
@@ -96,7 +96,11 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
for iface in $IFACES; do
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
if [ -n "$netroot" ] && [ -n "$DRACUT_SYSTEMD" ]; then
echo "systemctl is-active initrd-root-device.target || [ -f /tmp/net.${iface}.did-setup ]"
else
echo "[ -f /tmp/net.${iface}.did-setup ]"
fi >$hookdir/initqueue/finished/wait-$iface.sh
fi
done
# Default: We don't know the interface to use, handle all

View File

@@ -26,7 +26,9 @@ install() {
_nm_version=$(NetworkManager --version)
inst_multiple sed grep
# We don't need `ip` but having it is *really* useful for people debugging
# in an emergency shell.
inst_multiple ip sed grep
inst NetworkManager
inst /usr/libexec/nm-initrd-generator

View File

@@ -1,12 +1,19 @@
#!/bin/sh
if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
/usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
else
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
fi
for i in /usr/lib/NetworkManager/system-connections/* \
/run/NetworkManager/system-connections/* \
/etc/NetworkManager/system-connections/* \
/etc/sysconfig/network-scripts/ifcfg-*; do
[ -f "$i" ] || continue
if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
/usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
else
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
fi
break
done
for _i in /sys/class/net/*/
for _i in /sys/class/net/*
do
state=/run/NetworkManager/devices/$(cat $_i/ifindex)
grep -q connection-uuid= $state 2>/dev/null || continue

View File

@@ -8,7 +8,7 @@ check() {
# called by dracut
depends() {
echo -n "kernel-network-modules "
if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then
if ! dracut_module_included "network-legacy" && [ -x "$dracutsysrootdir/usr/libexec/nm-initrd-generator" ] ; then
echo "network-manager"
else
echo "network-legacy"

View File

@@ -251,8 +251,10 @@ ibft_to_cmdline() {
[ -e ${iface}/flags ] && flags=$(read a < ${iface}/flags; echo $a)
# Skip invalid interfaces
(( $flags & 1 )) || continue
# Skip interfaces not used for booting
(( $flags & 2 )) || continue
# Skip interfaces not used for booting unless using multipath
if ! getargbool 0 rd.iscsi.mp ; then
(( $flags & 2 )) || continue
fi
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
[ -e ${iface}/origin ] && origin=$(read a < ${iface}/origin; echo $a)
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
@@ -655,7 +657,6 @@ wait_for_ipv6_dad_link() {
while [ $cnt -lt $timeout ]; do
[ -n "$(ip -6 addr show dev "$1" scope link)" ] \
&& [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
&& return 0
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
&& return 1
@@ -718,7 +719,7 @@ iface_has_carrier() {
interface="/sys/class/net/$interface"
[ -d "$interface" ] || return 2
local timeout="$(getargs rd.net.timeout.carrier=)"
timeout=${timeout:-5}
timeout=${timeout:-10}
timeout=$(($timeout*10))
linkup "$1"

View File

@@ -2,7 +2,7 @@
# called by dracut
check() {
[[ -d /etc/sysconfig/network-scripts ]] && return 0
[[ -d $dracutsysrootdir/etc/sysconfig/network-scripts ]] && return 0
return 255
}

View File

@@ -270,7 +270,7 @@ for netup in /tmp/net.*.did-setup ; do
done
fi
i=1
for ns in $(getargs nameserver); do
for ns in $(getargs nameserver) $dns1 $dns2; do
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
i=$((i+1))
done

View File

@@ -26,14 +26,14 @@ install() {
inst_libdir_file "libsqlite3.so*"
for _dir in $libdirs; do
[[ -d $_dir ]] || continue
for _lib in $_dir/libcurl.so.*; do
[[ -d $dracutsysrootdir$_dir ]] || continue
for _lib in $dracutsysrootdir$_dir/libcurl.so.*; do
[[ -e $_lib ]] || continue
[[ $_nssckbi ]] || _nssckbi=$(grep -F --binary-files=text -z libnssckbi $_lib)
_crt=$(grep -F --binary-files=text -z .crt $_lib)
[[ $_crt ]] || continue
[[ $_crt == /*/* ]] || continue
if ! inst "$_crt"; then
if ! inst "${_crt#$dracutsysrootdir}"; then
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
continue
fi
@@ -49,23 +49,23 @@ install() {
_found=1
inst_libdir_file "libnssckbi.so*" || _found=
for _dir in $libdirs; do
[[ -e $_dir/libnssckbi.so ]] || continue
[[ -e $dracutsysrootdir$_dir/libnssckbi.so ]] || continue
# this looks for directory-ish strings in the file
for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $_dir/libnssckbi.so) ; do
for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $dracutsysrootdir$_dir/libnssckbi.so) ; do
# the string can be a :-separated list of dirs
for _p11root in $(echo "$_p11roots" | tr ':' '\n') ; do
# check if it's actually a directory (there are
# several false positives in the results)
[[ -d "$_p11root" ]] || continue
[[ -d "$dracutsysrootdir$_p11root" ]] || continue
# check if it has some specific subdirs that all
# p11-kit trust dirs have
[[ -d "${_p11root}/anchors" ]] || continue
[[ -d "${_p11root}/blacklist" ]] || continue
[[ -d "$dracutsysrootdir${_p11root}/anchors" ]] || continue
[[ -d "$dracutsysrootdir${_p11root}/blacklist" ]] || continue
# so now we know it's really a p11-kit trust dir;
# install everything in it
for _p11item in $(find "$_p11root") ; do
if ! inst "$_p11item" ; then
dwarn "Couldn't install '$_p11item' from p11-kit trust dir '$_p11root'; HTTPS might not work."
for _p11item in $(find "$dracutsysrootdir$_p11root") ; do
if ! inst "${_p11item#$dracutsysrootdir}" ; then
dwarn "Couldn't install '${_p11item#$dracutsysrootdir}' from p11-kit trust dir '${_p11root#$dracutsysrootdir}'; HTTPS might not work."
continue
fi
done

View File

@@ -15,7 +15,7 @@ installkernel() {
local _modname
# Include KMS capable drm drivers
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
# arm/aarch64 specific modules needed by drm
instmods \
"=drivers/gpu/drm/i2c" \
@@ -40,6 +40,6 @@ installkernel() {
fi
done
else
dracut_instmods -o -s "drm_crtc_init" "=drivers/gpu/drm" "=drivers/staging"
dracut_instmods -o -s "drm_crtc_init|drm_dev_register" "=drivers/gpu/drm" "=drivers/staging"
fi
}

View File

@@ -52,7 +52,7 @@ install() {
_splash_res=${DRACUT_GENSPLASH_RES}
elif [[ ${hostonly} ]]; then
# Settings from config only in hostonly
[[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash
[[ -e $dracutsysrootdir/etc/conf.d/splash ]] && source $dracutsysrootdir/etc/conf.d/splash
[[ ! ${_splash_theme} ]] && _splash_theme=default
[[ ${_splash_res} ]] && _opts+=" -r ${_splash_res}"
else

View File

@@ -6,7 +6,7 @@ pkglib_dir() {
_dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
fi
for _dir in $_dirs; do
if [ -x $_dir/plymouth-populate-initrd ]; then
if [ -x $dracutsysrootdir$_dir/plymouth-populate-initrd ]; then
echo $_dir
return
fi
@@ -29,12 +29,12 @@ depends() {
# called by dracut
install() {
PKGLIBDIR=$(pkglib_dir)
if grep -q nash ${PKGLIBDIR}/plymouth-populate-initrd \
|| [ ! -x ${PKGLIBDIR}/plymouth-populate-initrd ]; then
if grep -q nash $dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd \
|| [ ! -x $dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd ]; then
. "$moddir"/plymouth-populate-initrd.sh
else
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir"
$dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir"
fi
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh

View File

@@ -17,25 +17,25 @@ if [[ $hostonly ]]; then
"/usr/share/plymouth/themes/details/details.plymouth" \
"/usr/share/plymouth/themes/text/text.plymouth" \
if [[ -d /usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
if [[ -d $dracutsysrootdir/usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
[[ -f "$x" ]] || break
[[ -f "$dracutsysrootdir$x" ]] || break
inst $x
done
fi
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
if [ -L $dracutsysrootdir/usr/share/plymouth/themes/default.plymouth ]; then
inst /usr/share/plymouth/themes/default.plymouth
# Install plugin for this theme
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" $dracutsysrootdir/usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
fi
else
for x in /usr/share/plymouth/themes/{text,details}/* ; do
for x in $dracutsysrootdir/usr/share/plymouth/themes/{text,details}/* ; do
[[ -f "$x" ]] || continue
THEME_DIR=$(dirname "$x")
THEME_DIR=$(dirname "${x#$dracutsysrootdir}")
mkdir -m 0755 -p "${initdir}/$THEME_DIR"
inst_multiple "$x"
inst_multiple "${x#$dracutsysrootdir}"
done
(
cd ${initdir}/usr/share/plymouth/themes;

View File

@@ -164,11 +164,11 @@ processcmsfile()
driver=$NETTYPE
fi
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$name /sbin/cmsifup $name"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
# remove the default net rules
rm -f -- /etc/udev/rules.d/91-default-net.rules
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$name source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
udevadm control --reload
znet_cio_free
fi

View File

@@ -2,14 +2,14 @@
# called by dracut
check() {
arch=$(uname -m)
arch=${DRACUT_ARCH:-$(uname -m)}
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
return 255
}
# called by dracut
depends() {
arch=$(uname -m)
arch=${DRACUT_ARCH:-$(uname -m)}
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
echo znet zfcp dasd dasd_mod
return 0

View File

@@ -5,7 +5,7 @@
# called by dracut
check() {
# do not add this module by default
local arch=$(uname -m)
local arch=${DRACUT_ARCH:-$(uname -m)}
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
return 0
}

View File

@@ -11,7 +11,7 @@ crypttab_contains "$luks" "$dev" && exit 0
allowdiscards="-"
# parse for allow-discards
if strstr "$(cryptsetup --help)" "allow-discards"; then
if [ -n "$DRACUT_SYSTEMD" ] || strstr "$(cryptsetup --help)" "allow-discards"; then
if discarduuids=$(getargs "rd.luks.allow-discards"); then
discarduuids=$(str_replace "$discarduuids" 'luks-' '')
if strstr " $discarduuids " " ${luks##luks-}"; then

View File

@@ -28,6 +28,7 @@ installkernel() {
arch=$(uname -m)
[[ $arch == x86_64 ]] && arch=x86
[[ $arch == s390x ]] && arch=s390
[[ $arch == aarch64 ]] && arch=arm64
instmods dm_crypt =crypto =drivers/crypto =arch/$arch/crypto
}
@@ -67,7 +68,7 @@ install() {
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
fi
if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
if [[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/crypttab ]]; then
# filter /etc/crypttab for the devices we need
while read _mapper _dev _luksfile _luksoptions || [ -n "$_mapper" ]; do
[[ $_mapper = \#* ]] && continue
@@ -113,11 +114,12 @@ install() {
fi
done
fi
done < /etc/crypttab > $initdir/etc/crypttab
done < $dracutsysrootdir/etc/crypttab > $initdir/etc/crypttab
mark_hostonly /etc/crypttab
fi
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
inst_script "$moddir/crypt-run-generator.sh" "/sbin/crypt-run-generator"
if dracut_module_included "systemd"; then
inst_multiple -o \
@@ -128,7 +130,6 @@ install() {
$systemdsystemunitdir/cryptsetup.target \
$systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
systemd-ask-password systemd-tty-ask-password-agent
inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
fi
dracut_need_initqueue

View File

@@ -6,6 +6,7 @@ check() {
# if we don't have dmraid installed on the host system, no point
# in trying to support it in the initramfs.
require_binaries dmraid || return 1
require_binaries kpartx || return 1
[[ $hostonly ]] || [[ $mount_needs ]] && {
for dev in "${!host_fs_types[@]}"; do

View File

@@ -18,3 +18,9 @@ if [ -h /dev/root ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
done
umount $NEWROOT/run
fi
# release resources on iso-scan boots with rd.live.ram
if [ -d /run/initramfs/isoscan ] &&
[ -f /run/initramfs/squashed.img -o -f /run/initramfs/rootfs.img ]; then
umount --detach-loop /run/initramfs/live
umount /run/initramfs/isoscan
fi

View File

@@ -2,6 +2,8 @@
# called by dracut
installkernel() {
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
find_kernel_modules_external () {
local _OLDIFS
local external_pattern="^/"
@@ -16,11 +18,25 @@ installkernel() {
done < "$srcmods/modules.dep"
IFS=$_OLDIFS
}
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
is_block_dev() {
[ -e /sys/dev/block/$1 ] && return 0
return 1
}
install_block_modules () {
hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix
instmods \
scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
=ide nvme vmd nfit \
virtio_blk
dracut_instmods -o -s "${_blockfuncs}" "=drivers"
}
if [[ -z $drivers ]]; then
hostonly='' instmods \
sr_mod sd_mod scsi_dh ata_piix hid_generic unix \
hid_generic unix \
ehci-hcd ehci-pci ehci-platform \
ohci-hcd ohci-pci \
uhci-hcd \
@@ -35,15 +51,16 @@ installkernel() {
"=drivers/input/keyboard" \
"=drivers/usb/storage" \
"=drivers/pci/host" \
"=drivers/pci/controller" \
${NULL}
instmods \
yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
yenta_socket \
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
"=drivers/pcmcia" =ide nvme vmd nfit
virtio virtio_ring virtio_pci virtio_scsi \
"=drivers/pcmcia"
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
# arm/aarch64 specific modules
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
instmods \
@@ -72,10 +89,12 @@ installkernel() {
${NULL}
fi
dracut_instmods -o -s "${_blockfuncs}" "=drivers"
find_kernel_modules_external | instmods
if ! [[ $hostonly ]] || for_each_host_dev_and_slaves is_block_dev; then
install_block_modules
fi
# if not on hostonly mode, install all known filesystems,
# if the required list is not set via the filesystems variable
if ! [[ $hostonly ]]; then

View File

@@ -13,7 +13,7 @@ depends() {
# called by dracut
installkernel() {
# Include wired net drivers, excluding wireless
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'

View File

@@ -6,6 +6,8 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
. /lib/url-lib.sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
RETRIES=${RETRIES:-100}
SLEEP=${SLEEP:-5}
[ -e /tmp/livenet.downloaded ] && exit 0
@@ -13,14 +15,32 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin
netroot="$2"
liveurl="${netroot#livenet:}"
info "fetching $liveurl"
imgfile=$(fetch_url "$liveurl")
if [ $? != 0 ]; then
warn "failed to download live image: error $?"
exit 1
fi
imgfile=
#retry until the imgfile is populated with data or the max retries
i=1
while [ "$i" -le $RETRIES ]
do
imgfile=$(fetch_url "$liveurl")
> /tmp/livenet.downloaded
if [ $? != 0 ]; then
warn "failed to download live image: error $?"
imgfile=
fi
if [ ! -z "$imgfile" -a -s "$imgfile" ]; then
break
else
if [ $i -ge $RETRIES ]; then
warn "failed to download live image after $i attempts."
exit 1
fi
sleep $SLEEP
fi
i=$((i + 1))
done > /tmp/livenet.downloaded
# TODO: couldn't dmsquash-live-root handle this?
if [ ${imgfile##*.} = "iso" ]; then

View File

@@ -60,7 +60,7 @@ install() {
inst_rules "$moddir/64-lvm.rules"
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
if [ -f /etc/lvm/lvm.conf ]; then
if [ -f $dracutsysrootdir/etc/lvm/lvm.conf ]; then
inst_simple -H /etc/lvm/lvm.conf
# FIXME: near-term hack to establish read-only locking;
# use command-line lvm.conf editor once it is available
@@ -70,7 +70,7 @@ install() {
export LVM_SUPPRESS_FD_WARNINGS=1
# Also install any files needed for LVM system id support.
if [ -f /etc/lvm/lvmlocal.conf ]; then
if [ -f $dracutsysrootdir/etc/lvm/lvmlocal.conf ]; then
inst_simple -H /etc/lvm/lvmlocal.conf
fi
eval $(lvm dumpconfig global/system_id_source &>/dev/null)

View File

@@ -104,16 +104,16 @@ install() {
fi
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
if [ -f /etc/mdadm.conf ]; then
if [ -f $dracutsysrootdir/etc/mdadm.conf ]; then
inst -H /etc/mdadm.conf
else
[ -f /etc/mdadm/mdadm.conf ] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
[ -f $dracutsysrootdir/etc/mdadm/mdadm.conf ] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
fi
if [ -d /etc/mdadm.conf.d ]; then
if [ -d $dracutsysrootdir/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
[ -f "$dracutsysrootdir$f" ] || continue
inst -H "$f"
done
fi
@@ -127,13 +127,13 @@ install() {
inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
if dracut_module_included "systemd"; then
if [ -e $systemdsystemunitdir/mdmon@.service ]; then
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdmon@.service ]; then
inst_simple $systemdsystemunitdir/mdmon@.service
fi
if [ -e $systemdsystemunitdir/mdadm-last-resort@.service ]; then
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-last-resort@.service ]; then
inst_simple $systemdsystemunitdir/mdadm-last-resort@.service
fi
if [ -e $systemdsystemunitdir/mdadm-last-resort@.timer ]; then
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-last-resort@.timer ]; then
inst_simple $systemdsystemunitdir/mdadm-last-resort@.timer
fi
fi

View File

@@ -29,6 +29,7 @@ check() {
# if there's no multipath binary, no go.
require_binaries multipath || return 1
require_binaries kpartx || return 1
return 0
}
@@ -52,7 +53,7 @@ cmdline() {
# called by dracut
installkernel() {
local _ret
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
local _funcs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
local _s390
@@ -109,8 +110,7 @@ install() {
if dracut_module_included "systemd"; then
inst_simple "${moddir}/multipathd.service" "${systemdsystemunitdir}/multipathd.service"
mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
ln -rfs "${initdir}${systemdsystemunitdir}/multipathd.service" "${initdir}${systemdsystemunitdir}/sysinit.target.wants/multipathd.service"
systemctl -q --root "$initdir" enable multipathd.service
else
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
inst_hook cleanup 02 "$moddir/multipathd-stop.sh"

View File

@@ -0,0 +1,29 @@
#!/bin/sh
#
# This hook attempts to load the appropriate thermal modules
# for PowerPC Macs depending on the specific machine you have.
[ -r /proc/cpuinfo ] || exit 0
load_windfarm() {
local pm_model="$(sed -n '/model/p' /proc/cpuinfo)"
pm_model="${pm_model##*: }"
# load quietly and respect the blacklist
# this way if the modules are for some reason missing, it will
# still exit successfully and not affect the boot process
case "$pm_model" in
PowerMac3,6) modprobe -b -q therm_windtunnel ;;
PowerMac7,2|PowerMac7,3) modprobe -b -q windfarm_pm72 ;;
PowerMac8,1|PowerMac8,2) modprobe -b -q windfarm_pm81 ;;
PowerMac9,1) modprobe -b -q windfarm_pm91 ;;
PowerMac11,2) modprobe -b -q windfarm_pm112 ;;
PowerMac12,1) modprobe -b -q windfarm_pm121 ;;
RackMac3,1) modprobe -b -q windfarm_rm31 ;;
*) ;;
esac
return 0
}
load_windfarm

View File

@@ -0,0 +1,82 @@
#!/bin/bash
#
# This module attempts to properly deal with thermal behavior on PowerPC
# based Mac systems, by installing the model-appropriate (when hostonly)
# or all (when not) fan control/thermal kernel modules and loading them
# in a hook.
#
# While this is not strictly necessary for all kernels, particularly
# modular kernels will not autoload those drivers, even once the full
# system is up, which results in the fans spinning up to 100%; this is
# particularly annoying on live systems, where the system takes a while
# to load, so it's best to load the drivers early in initramfs stage.
#
# The behavior of this is inspired by the thermal hook in Debian's
# initramfs-tools, but written for dracut specifically and updated
# for modern kernels (2012+).
# called by dracut
check() {
local _arch="$(uname -m)"
# only for PowerPC Macs
[[ "$_arch" == ppc* && "$_arch" != ppc*le ]] || return 1
return 0
}
# called by dracut
depends() {
return 0
}
# called by dracut
installkernel() {
pmac_model() {
local pm_model="$(grep model /proc/cpuinfo)"
echo "${pm_model##*: }"
}
# only PowerMac3,6 has a module, special case
if [[ "$(uname -m)" == ppc ]]; then
if ! [[ $hostonly ]] || [[ "$(pmac_model)" == "PowerMac3,6" ]]; then
instmods therm_windtunnel
fi
return 0
fi
windfarm_modules() {
if ! [[ $hostonly ]]; then
# include all drivers when not hostonly
instmods \
windfarm_pm72 windfarm_pm81 windfarm_pm91 windfarm_pm112 \
windfarm_pm121 windfarm_rm31
else
# guess model specific module, then install the rest
case "$(pmac_model)" in
PowerMac7,2|PowerMac7,3) instmods windfarm_pm72 ;;
PowerMac8,1|PowerMac8,2) instmods windfarm_pm81 ;;
PowerMac9,1) instmods windfarm_pm91 ;;
PowerMac11,2) instmods windfarm_pm112 ;;
PowerMac12,1) instmods windfarm_pm121 ;;
RackMac3,1) instmods windfarm_rm31 ;;
# no match, so skip installation of the rest
*) return 1 ;;
esac
fi
return 0
}
# hostonly and didn't match a model; skip installing other modules
windfarm_modules || return 0
# these are all required by the assorted windfarm_pm*
instmods \
windfarm_core windfarm_cpufreq_clamp windfarm_pid \
windfarm_smu_controls windfarm_smu_sat windfarm_smu_sensors \
windfarm_fcu_controls windfarm_ad7417_sensor windfarm_max6690_sensor \
windfarm_lm75_sensor windfarm_lm87_sensor
}
# called by dracut
install() {
# this will attempt to load the appropriate modules
inst_hook pre-udev 99 "$moddir/load-thermal.sh"
}

View File

@@ -24,10 +24,9 @@ install() {
if dracut_module_included "systemd"; then
inst_simple "${moddir}/stratisd-init.service" "${systemdsystemunitdir}/stratisd-init.service"
mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
ln -rfs "${initdir}${systemdsystemunitdir}/stratisd-init.service" "${initdir}${systemdsystemunitdir}/sysinit.target.wants/stratisd-init.service"
systemctl -q --root "$initdir" enable stratisd-init.service
else
inst_hook cmdline 25 "$moddir/stratisd-start.sh"
inst_hook pre-mount 25 "$moddir/stratisd-start.sh"
inst_hook cleanup 25 "$moddir/stratisd-stop.sh"
fi
}

View File

@@ -30,7 +30,7 @@ install() {
inst_multiple gpg-agent
inst_multiple gpg-connect-agent
inst_multiple /usr/libexec/scdaemon
cp "$(sc_public_key)" "${initdir}/root/"
cp "$dracutsysrootdir$(sc_public_key)" "${initdir}/root/"
fi
}
@@ -46,7 +46,7 @@ sc_supported() {
require_binaries gpg-agent &&
require_binaries gpg-connect-agent &&
require_binaries /usr/libexec/scdaemon &&
(ldd /usr/libexec/scdaemon | grep libusb > /dev/null); then
($DRACUT_LDD $dracutsysrootdir/usr/libexec/scdaemon | grep libusb > /dev/null); then
return 0
else
return 1
@@ -54,7 +54,7 @@ sc_supported() {
}
sc_requested() {
if [ -f "$(sc_public_key)" ]; then
if [ -f "$dracutsysrootdir$(sc_public_key)" ]; then
return 0
else
return 1

View File

@@ -4,7 +4,7 @@
# called by dracut
check() {
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
# Only for systems on s390 using indirect booting via userland grub
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
# /boot/zipl contains a first stage kernel used to launch grub in initrd

View File

@@ -41,7 +41,7 @@ install() {
inst_libdir_file 'libcap-ng.so*'
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' $dracutsysrootdir/etc/nsswitch.conf \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
_nsslibs=${_nsslibs#|}
_nsslibs=${_nsslibs%|}

View File

@@ -2,7 +2,7 @@
# called by dracut
check() {
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
require_binaries normalize_dasd_arg || return 1
return 0

View File

@@ -2,7 +2,7 @@
# called by dracut
check() {
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
require_binaries grep sed seq

View File

@@ -18,7 +18,7 @@ cmdline() {
# called by dracut
check() {
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
local found=0
local bdev
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1

View File

@@ -4,7 +4,7 @@
# called by dracut
check() {
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
return 0
}

View File

@@ -18,6 +18,6 @@ install() {
tcpdump cp dd less hostname mkdir systemd-analyze \
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.f2fs fsck.vfat e2fsck
grep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep '^tcpdump:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
}

View File

@@ -7,10 +7,10 @@
# Write udev rules
{
if [ -n "$fcoe_mac" ] ; then
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode"
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --timeout --unique --name fcoe-timeout-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode"
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode"
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --timeout --unique --name fcoe-timeout-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_mac" "$fcoe_dcb" "$fcoe_mode"
else
printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s %s"\n' "$fcoe_interface" "$fcoe_dcb" "$fcoe_mode"
printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --timeout --unique --name fcoe-timeout-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s %s"\n' "$fcoe_interface" "$fcoe_dcb" "$fcoe_mode"
printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_interface" "$fcoe_dcb" "$fcoe_mode"
printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --timeout --unique --name fcoe-timeout-$name /sbin/fcoe-up $name %s %s"\n' "$fcoe_interface" "$fcoe_dcb" "$fcoe_mode"
fi
} >> /etc/udev/rules.d/92-fcoe.rules

View File

@@ -92,7 +92,7 @@ cmdline() {
# called by dracut
install() {
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
if [ -e "/etc/hba.conf" ]; then
if [ -e "$dracutsysrootdir/etc/hba.conf" ]; then
inst_libdir_file 'libhbalinux.so*'
inst_simple "/etc/hba.conf"
fi

View File

@@ -2,7 +2,7 @@
# called by dracut
check() {
test -f /etc/fstab.sys || [[ -n $add_fstab || -n $fstab_lines ]]
test -f $dracutsysrootdir/etc/fstab.sys || [[ -n $add_fstab || -n $fstab_lines ]]
}
# called by dracut
@@ -12,6 +12,6 @@ depends() {
# called by dracut
install() {
[ -f /etc/fstab.sys ] && inst_simple /etc/fstab.sys
[ -f $dracutsysrootdir/etc/fstab.sys ] && inst_simple /etc/fstab.sys
inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
}

View File

@@ -1,4 +1,5 @@
#!/bin/sh
[ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && killproc iscsiuio
if [ -z "${DRACUT_SYSTEMD}" ] && ( [ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ] ) ; then
killproc iscsiuio
fi

View File

@@ -36,9 +36,12 @@ iroot=${iroot#:}
# figured out a way how to check whether this is built-in or not
modprobe crc32c 2>/dev/null
if [ -z "${DRACUT_SYSTEMD}" ] && [ -e /sys/module/bnx2i ] && ! [ -e /tmp/iscsiuio-started ]; then
iscsiuio
> /tmp/iscsiuio-started
# start iscsiuio if needed
if [ -z "${DRACUT_SYSTEMD}" ] && \
( [ -e /sys/module/bnx2i ] || [ -e /sys/module/qedi ] ) && \
! [ -e /tmp/iscsiuio-started ]; then
iscsiuio
> /tmp/iscsiuio-started
fi
@@ -54,11 +57,11 @@ handle_firmware()
if ! iscsiadm -m fw; then
warn "iscsiadm: Could not get list of targets from firmware."
else
ifaces=( $(echo /sys/firmware/ibft/ethernet*) )
ifaces=$(set -- /sys/firmware/ibft/ethernet*; echo $#)
retry=$(cat /tmp/session-retry)
if [ $retry -lt ${#ifaces[*]} ]; then
let retry++
if [ $retry -lt $ifaces ]; then
retry=$((retry+1))
echo $retry > /tmp/session-retry
return 1
else
@@ -87,17 +90,12 @@ handle_netroot()
local iscsi_in_username iscsi_in_password
local iscsi_iface_name iscsi_netdev_name
local iscsi_param param
local p
local p found
local login_retry_max_seen=
# override conf settings by command line options
arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
[ -n "$arg" ] && iscsi_initiator=$arg
arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
[ -n "$arg" ] && iscsi_target_name=$arg
arg=$(getarg rd.iscsi.target.ip -d iscsi_target_ip)
[ -n "$arg" ] && iscsi_target_ip=$arg
arg=$(getarg rd.iscsi.target.port -d iscsi_target_port=)
[ -n "$arg" ] && iscsi_target_port=$arg
arg=$(getarg rd.iscsi.target.group -d iscsi_target_group=)
[ -n "$arg" ] && iscsi_target_group=$arg
arg=$(getarg rd.iscsi.username -d iscsi_username=)
@@ -109,9 +107,13 @@ handle_netroot()
arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
[ -n "$arg" ] && iscsi_in_password=$arg
for p in $(getargs rd.iscsi.param -d iscsi_param); do
iscsi_param="$iscsi_param $p"
[ "${p%=*}" = node.session.initial_login_retry_max ] && \
login_retry_max_seen=yes
iscsi_param="$iscsi_param $p"
done
# this sets iscsi_target_name and possibly overwrites most
# parameters read from the command line above
parse_iscsi_root "$1" || return 1
# Bail out early, if there is no route to the destination
@@ -120,15 +122,12 @@ handle_netroot()
fi
#limit iscsistart login retries
case "$iscsi_param" in
*node.session.initial_login_retry_max*) ;;
*)
retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max)
if [ $retries -gt 0 ]; then
iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries"
fi
;;
esac
if [ "$login_retry_max_seen" != yes ]; then
retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max)
if [ $retries -gt 0 ]; then
iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries"
fi
fi
# XXX is this needed?
getarg ro && iscsirw=ro
@@ -217,10 +216,9 @@ handle_netroot()
targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
[ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1
for target in $iscsi_target_name; do
case "$targets" in
*$target*)
EXTRA=""
found=
for target in $targets; do
if [ "$target" = "$iscsi_target_name" ]; then
if [ -n "$iscsi_iface_name" ]; then
iscsiadm -m iface -I $iscsi_iface_name --op=new
EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} "
@@ -228,24 +226,32 @@ handle_netroot()
fi
[ -n "$iscsi_param" ] && for param in $iscsi_param; do EXTRA="$EXTRA --name=${param%=*} --value=${param#*=}"; done
iscsiadm -m node -T $target \
CMD="iscsiadm -m node -T $target \
${iscsi_iface_name:+-I $iscsi_iface_name} \
-p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \
--op=update \
-p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port}"
__op="--op=update \
--name=node.startup --value=onboot \
${iscsi_username:+ --name=node.session.auth.username --value=$iscsi_username} \
${iscsi_password:+ --name=node.session.auth.password --value=$iscsi_password} \
${iscsi_in_username:+--name=node.session.auth.username_in --value=$iscsi_in_username} \
${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \
$EXTRA \
$NULL
;;
*)
;;
esac
$NULL"
$CMD $__op
if [ "$netif" != "timeout" ]; then
$CMD --login
fi
found=yes
break
fi
done
iscsiadm -m node -L onboot || :
if [ "$netif" = "timeout" ]; then
iscsiadm -m node -L onboot || :
elif [ "$found" != yes ]; then
warn "iSCSI target \"$iscsi_target_name\" not found on portal $iscsi_target_ip:$iscsi_target_port"
return 1
fi
> $hookdir/initqueue/work
netroot_enc=$(str_replace "$1" '/' '\2f')

View File

@@ -89,6 +89,7 @@ install_iscsiroot() {
iscsi_host=${host##*/}
for flash in ${host}/flashnode_sess-* ; do
[ -f "$flash" ] || continue
[ ! -e "$flash/is_boot_target" ] && continue
is_boot=$(cat $flash/is_boot_target)
if [ $is_boot -eq 1 ] ; then
@@ -187,7 +188,7 @@ depends() {
# called by dracut
installkernel() {
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
local _funcs='iscsi_register_transport'
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi qedi
@@ -227,7 +228,8 @@ install() {
$systemdsystemunitdir/sockets.target.wants/iscsiuio.socket
if [[ $hostonly ]]; then
inst_dir $(/usr/bin/find /etc/iscsi)
inst_dir /etc/iscsi
inst_multiple $(find /etc/iscsi -type f)
else
inst_simple /etc/iscsi/iscsid.conf
fi
@@ -252,20 +254,18 @@ install() {
$systemdsystemunitdir/iscsiuio.socket \
iscsiadm iscsid
mkdir -p "${initdir}/$systemdsystemunitdir/sockets.target.wants"
for i in \
iscsid.socket \
iscsiuio.socket \
; do
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/sockets.target.wants/${i}"
systemctl -q --root "$initdir" enable "$i"
done
mkdir -p "${initdir}/$systemdsystemunitdir/basic.target.wants"
for i in \
iscsid.service \
iscsiuio.service \
; do
ln_r "$systemdsystemunitdir/${i}" "$systemdsystemunitdir/basic.target.wants/${i}"
systemctl -q --root "$initdir" add-wants basic.target "$i"
done
# Make sure iscsid is started after dracut-cmdline and ready for the initqueue

View File

@@ -84,7 +84,7 @@ if [ -n "$iscsi_firmware" ]; then
modprobe -b -q iscsi_boot_sysfs 2>/dev/null
modprobe -b -q iscsi_ibft
# if no ip= is given, but firmware
echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT"
initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT"
initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'"
@@ -145,7 +145,7 @@ for nroot in $(getargs netroot); do
type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh
parse_iscsi_root "$nroot" || return 1
netroot_enc=$(str_replace "$nroot" '/' '\2f')
echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
done
# Done, all good!

View File

@@ -46,10 +46,10 @@ fi
[ "${netroot%%:*}" = "nbd" ] || return
if [ -n "${DRACUT_SYSTEMD}" ] && [ "$root" = "dhcp" ]; then
echo "root=$netroot" > /etc/cmdline.d/root.conf
systemctl --no-block daemon-reload
fi
#if [ -n "${DRACUT_SYSTEMD}" ] && [ "$root" = "dhcp" ]; then
# echo "root=$netroot" > /etc/cmdline.d/root.conf
# systemctl --no-block daemon-reload
#fi
# Check required arguments
netroot_to_var $netroot

View File

@@ -86,7 +86,7 @@ install() {
[[ $_netconf ]] && printf "%s\n" "$_netconf" >> "${initdir}/etc/cmdline.d/95nfs.conf"
fi
if [ -f /lib/modprobe.d/nfs.conf ]; then
if [ -f $dracutsysrootdir/lib/modprobe.d/nfs.conf ]; then
inst_multiple /lib/modprobe.d/nfs.conf
else
[ -d $initdir/etc/modprobe.d/ ] || mkdir $initdir/etc/modprobe.d
@@ -95,7 +95,7 @@ install() {
inst_libdir_file 'libnfsidmap_nsswitch.so*' 'libnfsidmap/*.so' 'libnfsidmap*.so*'
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' $dracutsysrootdir/etc/nsswitch.conf \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
_nsslibs=${_nsslibs#|}
_nsslibs=${_nsslibs%|}
@@ -113,13 +113,13 @@ install() {
# Rather than copy the passwd file in, just set a user for rpcbind
# We'll save the state and restart the daemon from the root anyway
grep -E '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
grep -E '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group"
grep -E '^nfsnobody:|^rpc:|^rpcuser:' $dracutsysrootdir/etc/passwd >> "$initdir/etc/passwd"
grep -E '^nogroup:|^rpc:|^nobody:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
# rpc user needs to be able to write to this directory to save the warmstart
# file
chmod 770 "$initdir/var/lib/rpcbind"
grep -q '^rpc:' /etc/passwd \
&& grep -q '^rpc:' /etc/group
grep -q '^rpc:' $dracutsysrootdir/etc/passwd \
&& grep -q '^rpc:' $dracutsysrootdir/etc/group
dracut_need_initqueue
}

View File

@@ -2,7 +2,7 @@
# called by dracut
check() {
local _arch=$(uname -m)
local _arch=${DRACUT_ARCH:-$(uname -m)}
local _online=0
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
require_binaries /usr/lib/udev/collect || return 1

View File

@@ -2,12 +2,9 @@
# called by dracut
check() {
# No point trying to support resume, if no swap partition exist
# Only support resume if hibernation is currently on
[[ $hostonly ]] || [[ $mount_needs ]] && {
for fs in "${host_fs_types[@]}"; do
[[ $fs =~ ^(swap|swsuspend|swsupend)$ ]] && return 0
done
return 255
[[ "$(cat /sys/power/resume)" == "0:0" ]] && return 255
}
return 0
@@ -34,7 +31,7 @@ install() {
fi
# if systemd is included and has the hibernate-resume tool, use it and nothing else
if dracut_module_included "systemd" && [[ -x $systemdutildir/systemd-hibernate-resume ]]; then
if dracut_module_included "systemd" && [[ -x $dracutsysrootdir$systemdutildir/systemd-hibernate-resume ]]; then
inst_multiple -o \
$systemdutildir/system-generators/systemd-hibernate-resume-generator \
$systemdsystemunitdir/systemd-hibernate-resume@.service \
@@ -45,9 +42,9 @@ install() {
# Optional uswsusp support
for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume
do
[[ -x "${_bin}" ]] && {
[[ -x "$dracutsysrootdir${_bin}" ]] && {
inst "${_bin}" /usr/sbin/resume
[[ $hostonly ]] && [[ -f /etc/suspend.conf ]] && inst -H /etc/suspend.conf
[[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/suspend.conf ]] && inst -H /etc/suspend.conf
break
}
done

View File

@@ -10,7 +10,7 @@ check() {
require_binaries ssh scp || return 1
if [[ $sshkey ]]; then
[ ! -f $sshkey ] && {
[ ! -f $dracutsysrootdir$sshkey ] && {
derror "ssh key: $sshkey is not found!"
return 1
}
@@ -27,7 +27,7 @@ depends() {
inst_sshenv()
{
if [ -d /root/.ssh ]; then
if [ -d $dracutsysrootdir/root/.ssh ]; then
inst_dir /root/.ssh
chmod 700 ${initdir}/root/.ssh
fi
@@ -35,13 +35,13 @@ inst_sshenv()
# Copy over ssh key and knowhosts if needed
[[ $sshkey ]] && {
inst_simple $sshkey
[[ -f /root/.ssh/known_hosts ]] && inst_simple /root/.ssh/known_hosts
[[ -f /etc/ssh/ssh_known_hosts ]] && inst_simple /etc/ssh/ssh_known_hosts
[[ -f $dracutsysrootdir/root/.ssh/known_hosts ]] && inst_simple /root/.ssh/known_hosts
[[ -f $dracutsysrootdir/etc/ssh/ssh_known_hosts ]] && inst_simple /etc/ssh/ssh_known_hosts
}
# Copy over root and system-wide ssh configs.
[[ -f /root/.ssh/config ]] && inst_simple /root/.ssh/config
if [[ -f /etc/ssh/ssh_config ]]; then
[[ -f $dracutsysrootdir/root/.ssh/config ]] && inst_simple /root/.ssh/config
if [[ -f $dracutsysrootdir/etc/ssh/ssh_config ]]; then
inst_simple /etc/ssh/ssh_config
sed -i -e 's/\(^[[:space:]]*\)ProxyCommand/\1# ProxyCommand/' ${initdir}/etc/ssh/ssh_config
while read key val || [ -n "$key" ]; do
@@ -55,7 +55,7 @@ inst_sshenv()
fi
inst_simple "$val"
fi
done < /etc/ssh/ssh_config
done < $dracutsysrootdir/etc/ssh/ssh_config
fi
return 0
@@ -68,7 +68,9 @@ install() {
inst_multiple ssh scp
inst_sshenv
_nsslibs=$(sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' /etc/nsswitch.conf \
_nsslibs=$(
sed -e 's/#.*//; s/^[^:]*://; s/\[[^]]*\]//' \
$dracutsysrootdir/etc/nsswitch.conf \
| tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|')
_nsslibs=${_nsslibs#|}
_nsslibs=${_nsslibs%|}

View File

@@ -5,13 +5,13 @@ install() {
local _terminfodir
# terminfo bits make things work better if you fall into interactive mode
for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
[ -f ${_terminfodir}/l/linux ] && break
[ -f $dracutsysrootdir${_terminfodir}/l/linux ] && break
done
if [ -d ${_terminfodir} ]; then
if [ -d $dracutsysrootdir${_terminfodir} ]; then
for i in "l/linux" "v/vt100" "v/vt102" "v/vt220"; do
inst_dir "$_terminfodir/${i%/*}"
$DRACUT_CP -L -t "${initdir}/${_terminfodir}/${i%/*}" "$_terminfodir/$i"
$DRACUT_CP -L -t "${initdir}/${_terminfodir}/${i%/*}" "$dracutsysrootdir$_terminfodir/$i"
done
fi
}

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