Commit Graph

152 Commits (068531232b994ef93b3245484987df1cf1504dd0)

Author SHA1 Message Date
Harald Hoyer 4ef45f13f4 dracut-functions.sh: fix inst*() functions for "-H" handling
because some inst*() functions check the existance of the source files
and do not know about the "-H" option, some failed to install the
hostonly files.
2014-07-21 16:59:49 +02:00
Harald Hoyer 5ea0be0a8c dracut-functions.sh: speed up ldconfig_paths() 2014-07-08 12:54:21 +02:00
Harald Hoyer 26cd262a6a install: add -H flag for install
inst* functions and dracut-install now accept the "-H" flag, which
logs all installed files to /lib/dracut/hostonly-files. This is used
to remove those files, if rd.hostonly is given on the kernel command line.
2014-06-25 11:42:53 +02:00
Harald Hoyer 0fa5dbedc5 dracut-functions.sh:require_binaries() clarify message
The info message written by require_binaries() was a bit frighten to
users. So just be a little bit more verbose.

If you have ideas on how to improve the message for these "soft"
dependency modules, please submit patches.
2014-05-20 13:23:43 +02:00
Harald Hoyer 7a94a4326f dracut-functions.sh:print_vars() fix for values with spaces
for a variable with spaces, e.g.:
EXT_KEYMAPS='backspace keypad euro2'

The following would occur:
print_vars: eval printf -v _value %s '$EXT_KEYMAPS'
print_vars: printf -v _value %s backspace keypad euro2
print_vars: [[ -n backspacekeypadeuro2 ]]
print_vars: printf '%s=\"%s\"\n' EXT_KEYMAPS backspacekeypadeuro2

Thanks to Sebastian Köln for the fix!
2014-05-20 11:31:16 +02:00
Chapman Flack 2c19a5fa78 Specify strstr tightly, add strglob/strglobin.
By convention, strstr should be a literal string match. Previously, it
would match as a glob pattern. Some code used that, so add new
functions strglob and strglobin to do what that code expects, and
specify them tightly too. strglob tests whether the glob pattern
matches the entire string (the name strglob is also used in the yorick
language, and that's what it does there), while strglobin tests whether
the glob pattern matches anywhere in the string.

Also tightens str_starts, str_ends, and str_replace to deal with
literal strings only. In a quick grep I did not find code that depended
on these functions matching globs.

Changes the call sites where strstr was used with glob patterns to use
strglobin or strglob as the intention seemed to be (or, in one case,
strstr with the * removed as it did not affect the result anyway).
2014-04-07 10:49:07 +02:00
Harald Hoyer 83a3cba777 dracut-functions.sh: degrade info about missing binaries to info 2014-03-05 12:23:49 +01:00
Harald Hoyer e8a7c9bc93 dracut-functions.sh:find_kernel_modules_by_path() fixed updates search
"updates/*" path does not start with "/"
2014-02-17 13:29:42 +01:00
Harald Hoyer 30e6e809ed Factor out all the "type -V" commands
Add new functions require_binaries() and require_any_binary() to be used
in the check() section of module-setup.sh.

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

This unifies the way of checking for binaries and makes the life of an
initramfs creator easier, if he wants to find out why a specific dracut
module is not included in the initramfs.
2014-02-06 16:45:20 +01:00
Harald Hoyer f57850d7e8 dracut-functions.sh: also search in the updates directory 2014-01-30 17:38:27 +01:00
Hannes Reinecke bfa1db78cd Add DASD configuration for SuSE
On SuSE the DASD configuration is kept in udev rules, one rule
file per device. So add a new module for copying and creating
these rules during boot.

Signed-off-by: Hannes Reinecke <hare@suse.de>
2013-12-05 15:13:29 +01:00
Harald Hoyer b29cb51654 dracut-functions.sh: do not force require modules.builtin* 2013-12-05 15:13:29 +01:00
Colin Guthrie 1d50dfe602 dracut-functions.sh: Avoid loading unnecessary 32-bit libraries for 64-bit initrds
Due to the 'inst_libdir_file "libnss_files*"' in the udev-rules module
this caues the /usr/lib/libnss_files-2.18.so* to be included. This is a
32-bit library and pulls in a 32-bit version of glibc also even on a
64-bit system.

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

Also there was a missing space when appending the ldconfig paths
onto our list meaning the last builtin and first ldconfig path
were unusable.
2013-11-07 15:23:24 +01:00
Harald Hoyer 4d7c18c7c0 Handle crypto modules with and without modaliases
If new kernels have modules split out, handle the case, where modules
have to modalias and just install them.

Also add the crypto drivers and names to host_modalias.
2013-10-30 12:24:37 +01:00
Marian Csontos 96c6f6f3d1 dracut-functions.sh:check_block_and_slaves*() skip LVM internal devs
Not every device in /dev/mapper should be examined.
If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
2013-10-18 14:40:40 +02:00
Harald Hoyer 63330a89fc dracut-functions.sh:inst_rules() do not install rules in CWD 2013-10-04 13:36:25 +02:00
Harald Hoyer 3c4315fa13 dracut-functions.sh: extend module_is_host_only()
If the currently running kernel is not present in the installer root,
fall back to modalias checking.
2013-09-11 12:53:50 +02:00
Harald Hoyer 00ed3ccfd9 dracut-functions.sh:for_each_module_dir() skip empty modules
skip modules, which have no module-setup.sh, install or installkernel

https://bugzilla.redhat.com/show_bug.cgi?id=1003153
2013-09-02 10:28:36 +02:00
Harald Hoyer 8552a3270c dracut-functions.sh:get_devpath_block() make local vars local 2013-08-27 11:34:39 +02:00
Harald Hoyer 281327f72c dmraid/mdraid: improve hostonly recognition
Factor out get_devpath_block(), which also fixes a dmraid hostonly bug.

Also only include dmraid and mdraid, if they are actually in use.
2013-08-26 14:04:56 +02:00
Harald Hoyer 2b9d8f65a6 dracut-functions.sh:get_persistent_dev() do not check non-existent dirs 2013-08-23 19:04:12 +02:00
Harald Hoyer ffc68f357e use ${var:+val} rather than ${var+val}
${var:+val} also catches var=""
2013-08-22 11:24:01 +02:00
Harald Hoyer ace51ef520 dracut-functions.sh:inst_rules() do not install from /etc in generic mode
In generic mode, local configuration should not be part of the image.

Also handle symlinks for rule files.
2013-08-22 10:53:43 +02:00
Harald Hoyer 93b02f502e dracut-functions.sh: use builtin bash functions rather than tr
convert uppercase to lowercase using bash syntax
2013-08-22 10:53:25 +02:00
Harald Hoyer c82a11334d dracut-functions.sh: add expand_persistent_dev()
also fixes missing '{' for LABEL=... swaps
2013-08-20 16:03:17 +02:00
Harald Hoyer 3411ad661a add persistent_policy configuration option 2013-08-20 10:28:14 +02:00
Harald Hoyer 50411d30d5 dracut-functions.sh:dracut_module_included() check with spaces
check also for surrounding spaces in the module strings
2013-08-20 09:04:20 +02:00
Harald Hoyer 324ea606da dracut.sh: add --persistent-policy option
--persistent-policy <policy>:
    Use <policy> to address disks and partitions.
    <policy> can be any directory name found in /dev/disk.
    E.g. "by-uuid", "by-label"
2013-08-16 11:52:07 +02:00
Harald Hoyer 1743473b2b add parameter --print-cmdline
This prints the kernel command line parameters for the current disk
layout.

$ dracut --print-cmdline
rd.luks.uuid=luks-e68c8906-6542-4a26-83c4-91b4dd9f0471
rd.lvm.lv=debian/root rd.lvm.lv=debian/usr root=/dev/mapper/debian-root
rootflags=rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered
rootfstype=ext4
2013-08-15 16:06:37 +02:00
Harald Hoyer bbc9bfe16e dracut-functions.sh: add find_mp_fsopts 2013-08-15 12:23:04 +02:00
Harald Hoyer 466a59984a dracut-functions.sh: no more 'echo' 2013-08-15 12:22:55 +02:00
Harald Hoyer 97af51db9d dracut-functions.sh: add find_dev_fsopts() 2013-08-15 11:14:46 +02:00
Harald Hoyer 69f7ed9610 Create initramfs without using udevadm
This enables building a hostonly image, without the udev database
populated.
2013-08-15 10:44:20 +02:00
Harald Hoyer f06c2b5852 dracut-functions.sh: fixed vercmp() 2013-08-14 15:04:05 +02:00
Harald Hoyer 4fe1bdd406 dracut-functions.sh: if no libdirs are set, take the ld.so.cache paths 2013-08-14 15:04:05 +02:00
dyoung@redhat.com beb26a0847 omit drivers fix
Because omit_drivers list use underline always, so when maching with it
the _mod need to be converted as well or sometimes omit-drivers will fail
silently.

Fix this by replace '-' with '_' in instmods function.

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-08-09 14:13:30 +02:00
Harald Hoyer af11946054 dracut-functions.sh: inst_multiple == dracut_install 2013-08-07 10:33:15 +02:00
Harald Hoyer 55a0b3abc7 dracut-functions.sh: removed non dracut-install shell functions 2013-08-07 10:33:15 +02:00
Harald Hoyer a4f7b50471 dracut.sh/dracut-functions.sh: handle root on non-block device 2013-08-07 10:33:14 +02:00
Harald Hoyer 868f935e23 kernel-modules/module-setup.sh: silently omit some filesystem drivers 2013-07-31 13:56:03 +02:00
Harald Hoyer dba2055979 remove "< <(" syntax
bash seems to want /dev/fd in that case. dracut is sometimes called in
environments, where /proc and /dev are not mounted.
2013-07-31 11:00:29 +02:00
Harald Hoyer 7b3ff4e055 dracut-functions.sh:get_fs_env() fallback to blkid for ID_FS_TYPE not found 2013-07-24 13:38:57 +02:00
Harald Hoyer 3c4bfd685a dracut-functions.sh: only wait for the last pid spawned 2013-07-19 09:34:04 +02:00
Harald Hoyer 9dde7a66b5 dracut-functions.sh: don't warn twice about omitted modules 2013-07-19 09:33:45 +02:00
Konrad Rzeszutek Wilk 5f2c30d9bc dracut.sh: Support early microcode loading.
On Wed, Jul 10, 2013 at 10:58:15AM -0400, Konrad Rzeszutek Wilk wrote:
> On Wed, Jul 10, 2013 at 09:37:11AM +0200, Harald Hoyer wrote:
> > On 07/10/2013 02:29 AM, Yu, Fenghua wrote:
> > >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@oracle.com]
> > >> Sent: Tuesday, July 09, 2013 12:24 PM
> > >> Implement it per Linux kernel Documentation/x86/early-microcode.txt
> > >> (from v3.11-rc0):
> > [...]
> > > This patch works fine with one microcode blob in binary format. There are situations that the microcode is not delivered in one blob in binary format:
> > >
> > > First, each microcode patch is one file instead all microcode patches are in one big blob. Secondly, old delivered microcode file is in ascii format.
> > >
> > > To handle those formats, additional code needs to convert the formats into one big binary microcode blob. I'm not sure if we should consider the code and if we should put the code in dracut.
> > >
> > > Thanks.
> > >
> > > -Fenghua
> > >
> >
> >
> > $ ls /lib/firmware/amd-ucode
> > microcode_amd.bin  microcode_amd_fam15h.bin  microcode_amd_solaris.bin
>
> Right, so all of those blobs (for AMD) get stuck in AuthenticAMD.bin.
>
> > $ ls /lib/firmware/intel-ucode
> > 06-03-02  06-06-00  06-07-02  06-08-0a  06-0b-04  06-0f-06  06-16-01  06-1c-02
> > 06-25-02  06-2d-07  0f-01-02  0f-02-09  0f-04-03  0f-04-0a
> > 06-05-00  06-06-05  06-07-03  06-09-05  06-0d-06  06-0f-07  06-17-06  06-1c-0a
> > 06-25-05  06-2f-02  0f-02-04  0f-03-02  0f-04-04  0f-06-02
> > 06-05-01  06-06-0a  06-08-01  06-0a-00  06-0e-08  06-0f-0a  06-17-07  06-1d-01
> > 06-26-01  06-3a-09  0f-02-05  0f-03-03  0f-04-07  0f-06-04
> > 06-05-02  06-06-0d  06-08-03  06-0a-01  06-0e-0c  06-0f-0b  06-17-0a  06-1e-04
> > 06-2a-07  0f-00-07  0f-02-06  0f-03-04  0f-04-08  0f-06-05
> > 06-05-03  06-07-01  06-08-06  06-0b-01  06-0f-02  06-0f-0d  06-1a-04  06-1e-05
> > 06-2d-06  0f-00-0a  0f-02-07  0f-04-01  0f-04-09  0f-06-08
>
> And all of those get catted in GenuineIntel.bin.
>
> >
> > Also, for [[ $hostonly ]], we only want to add the current running CPU microcode.
>
> <nods> Will do that. Are you OK with me adding some of this CPU detection logic
> in dracut-functions.sh?

This is still RFC, as I had not done the --no-compress logic (or tested it).
Please see if this is OK:

>From 5f853d2ececd4cadff648e22cb9c9287a01a9783 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Tue, 9 Jul 2013 13:57:01 -0400
Subject: [PATCH] dracut.sh: Support early microcode loading.

Implement it per Linux kernel Documentation/x86/early-microcode.txt
(from v3.11-rc0):

<start>
Early load microcode
====================
By Fenghua Yu <fenghua.yu@intel.com>

Kernel can update microcode in early phase of boot time. Loading microcode early
can fix CPU issues before they are observed during kernel boot time.

Microcode is stored in an initrd file. The microcode is read from the initrd
file and loaded to CPUs during boot time.

The format of the combined initrd image is microcode in cpio format followed by
the initrd image (maybe compressed). Kernel parses the combined initrd image
during boot time. The microcode file in cpio name space is:
on Intel: kernel/x86/microcode/GenuineIntel.bin
on AMD  : kernel/x86/microcode/AuthenticAMD.bin

During BSP boot (before SMP starts), if the kernel finds the microcode file in
the initrd file, it parses the microcode and saves matching microcode in memory.
If matching microcode is found, it will be uploaded in BSP and later on in all
APs.

The cached microcode patch is applied when CPUs resume from a sleep state.

There are two legacy user space interfaces to load microcode, either through
/dev/cpu/microcode or through /sys/devices/system/cpu/microcode/reload file
in sysfs.

In addition to these two legacy methods, the early loading method described
here is the third method with which microcode can be uploaded to a system's
CPUs.

The following example script shows how to generate a new combined initrd file in
/boot/initrd-3.5.0.ucode.img with original microcode microcode.bin and
original initrd image /boot/initrd-3.5.0.img.

mkdir initrd
cd initrd
mkdir -p kernel/x86/microcode
cp ../microcode.bin kernel/x86/microcode/GenuineIntel.bin (or AuthenticAMD.bin)
find . | cpio -o -H newc >../ucode.cpio
cd ..
cat ucode.cpio /boot/initrd-3.5.0.img >/boot/initrd-3.5.0.ucode.img
<end>

That is what we do in the patch. Furthermoere there is also
an off-switch: "no-early-microcode" to disable it.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
[v1: Support --host-only parameter]
2013-07-15 14:06:40 +02:00
Harald Hoyer b093aa2dc7 beautified shell code
checked with shellcheck http://www.shellcheck.net/about.html
2013-07-04 12:31:15 +02:00
Harald Hoyer 32bd2fbb4c use "rm --" to guard against filenames beginning with "-" 2013-06-28 10:31:18 +02:00
Harald Hoyer 5e60145449 use findmnt with "--source" or "--target"
This avoids hanging on stale NFS mounts, which are not part of the boot
process.

https://bugzilla.redhat.com/show_bug.cgi?id=975401
2013-06-24 12:47:53 +02:00
Harald Hoyer 15c5c072f4 dracut-functions.sh:get_persistent_dev() fix case for multipath
/dev/mapper/mpath* is not a persistent device path

https://bugzilla.redhat.com/show_bug.cgi?id=969068
2013-05-31 07:47:01 +02:00
Harald Hoyer 19b5c10963 dracut-functions.sh: clarify instmods() error message 2013-05-28 14:25:49 +02:00