Commit Graph

96 Commits (951cedf8cb2228dc3064d5fde727543d96d23e5b)

Author SHA1 Message Date
Harald Hoyer 5bbfd48475 dracut: do not enable early microcode inclusion by default 2013-07-17 14:36:34 +02:00
Harald Hoyer 5a6a98f875 do not wait_for_dev for the root device
it's specified on the kernel command line
2013-07-17 12:03:01 +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 c00f8e05a6 dracut.sh: correct dropindirs_sort 2013-07-12 10:35:49 +02:00
Harald Hoyer 02b5c8e3a3 dracut.sh: unset all LC_* and LANG
saves 10% of time :-)
2013-07-05 16:27:34 +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 bcfbddefe1 don't add volatile swap partitions to host_devs 2013-05-28 13:36:37 +02:00
Harald Hoyer fefd3f66f9 dracut.sh: degrade message about missing tools for stripping
warning -> info

https://bugzilla.redhat.com/show_bug.cgi?id=958519
2013-05-06 14:20:16 +02:00
Harald Hoyer 8461734ee4 dracut.sh: do not preunlink for fips mode
just install prelink and the cache files
2013-04-25 21:16:03 +02:00
Harald Hoyer 6f4c2dada4 fixed fips mode
- preserve timestamps
- copy /lib*/hmaccalc files
- run sha512hmac after kernel module loading
- add more fips kernel modules
2013-04-25 19:44:01 +02:00
Harald Hoyer ea3c4e8273 Add missing options to manpage and --help output
https://bugzilla.redhat.com/show_bug.cgi?id=948510
2013-04-05 09:01:48 +02:00
Harald Hoyer 6c6d805765 use systemd*dir variables everywhere 2013-03-26 16:19:00 +01:00
Harald Hoyer cb8def95c4 dracut.sh: export systemdsystemconfdir 2013-03-22 09:09:10 +01:00
Harald Hoyer 78d1d4f86d dracut.sh: turn off hostonly mode, if udev database is not found 2013-03-20 10:25:23 +01:00
Harald Hoyer 5bfa3b363a dracut.sh: turn off host-only mode, if essential system filesystems not mounted 2013-03-20 10:22:41 +01:00
Harald Hoyer 02566acdd7 dracut.sh: remove temporary cpio output in trap 2013-03-20 07:08:29 +01:00
Harald Hoyer 83bb0893ed dracut.sh: Add --noimageifnotneeded parameter
Do not create an image in host-only mode, if no kernel driver is needed
and no $initdir/etc/cmdline/*.conf is generated.
2013-03-13 14:49:20 +01:00
Harald Hoyer 7d848c55a6 dracut.sh: add --regenerate-all 2013-03-13 13:01:33 +01:00
Harald Hoyer dd5875499e dracut.sh: add swap partitions to host-only setup 2013-03-11 18:58:32 +01:00
Harald Hoyer d351541ee6 make host_fs_types a hashmap
This requires bash >= 4, but hash maps are so much more comfortable
2013-03-11 18:58:32 +01:00
Harald Hoyer d008b6b89f dracut.sh: move cleanup trap, just after mktemp 2013-03-09 15:31:09 +01:00
Harald Hoyer cc2303001e dracut.sh: add new default path to initramfs according to bootloader spec
see kernel-install(8) and
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
2013-03-09 15:17:26 +01:00
Harald Hoyer 54e7d7c32d dracut.sh: remove (default) marker in --help 2013-03-09 15:17:26 +01:00
Harald Hoyer 335bc217b3 dracut.sh: rename source_dirs_prio() to dropindirs_sort() 2013-03-07 11:43:52 +01:00
Lars R. Damerow 9a9c6e1256 dracut: write initramfs to temp file then move into place
We've been finding cases where multiple instances of dracut can be launched
simultaneously, resulting in a corrupted initramfs file. This patch makes
dracut write the initramfs to a new file, then move it into place atomically.
2013-02-22 11:05:29 +01:00
Harald Hoyer a42b2b8133 introduce /usr/lib/dracut/dracut.conf.d/ drop-in directory
/usr/lib/dracut/dracut.conf.d/*.conf can be overwritten by the same
filenames in /etc/dracut.conf.d.

Packages should use /usr/lib/dracut/dracut.conf.d rather than
/etc/dracut.conf.d. /etc/dracut.conf.d belongs to the system
administrator.
2013-02-19 17:46:24 +01:00
Harald Hoyer 5db6ca5a4b dracut: enable initramfs building without kernel modules 2013-02-18 12:03:02 +01:00
Harald Hoyer 3f54a83ca8 dracut.sh: make /var/log a symlink to /run/log 2013-02-08 16:52:38 +01:00
Harald Hoyer 19bab59c48 dracut.sh: reverting return value change
reverting _get_fs_type() return values of patch
c8d685c9d3
2013-02-05 16:45:42 +01:00
Harald Hoyer c8d685c9d3 dracut-functions.sh: cope with optional field #7 in mountinfo
also handle fstab entries with LABEL=, UUID= and PARTUUID=
2013-01-23 15:24:27 +01:00
Colin Guthrie c586b033a7 Extend 52f1b041 to allow devices to be specified in config files as well as cmdline.
This also changes the command line switch to be --add-device and the
config directive is set to add_device. This was chosen as device= in the
config file seems too generic and not quite as consistent with other
directives (i.e. drivers/add_drivers)

The --device command line is still supported but it should be considered
deprecated in favour of --add-device.
2013-01-23 15:24:27 +01:00
Harald Hoyer 2d9b156e9e dracut.sh: do not strip signed kernel modules
https://bugzilla.redhat.com/show_bug.cgi?id=873796
2012-11-21 14:07:32 +01:00
Harald Hoyer b26897fb60 dracut.sh: only 'warn' not 'error', if we don't strip 2012-10-19 11:20:30 +02:00
Harald Hoyer 636e5cd2d5 dracut.sh: only save $kernel_cmdline, if set 2012-10-19 11:09:38 +02:00
Harald Hoyer 404815eaf0 prelink and preunlink (for FIPS) in the initramfs
also hardlink before strip
2012-10-16 14:57:09 +02:00
Harald Hoyer 6c128565b1 strip initramfs binaries by default (not all for FIPS) 2012-10-16 14:55:45 +02:00
Harald Hoyer d20fb951fa add "--kernel-cmdline" and kernel_cmdline options for default parameters 2012-10-04 13:23:19 -04:00
Harald Hoyer e1b48995c2 dracut.sh: create the initramfs non-world readable 2012-09-27 10:18:29 +02:00
Harald Hoyer 73088e46f7 moved the /etc/host_devs write out to 99base
also removed some left-over debugging code
2012-08-23 12:13:02 +02:00
dyoung@redhat.com 52f1b04183 Add a dracut option --device to bring up a device in initramfs
Kdump support dump to raw device which could be on top of complex storage
such as multipath and iscsi which are standalone dracut modules.

Add a --device option to dracut which will add the device to host_devs so
dracut can add the dependent modules automaticlly and enable them in initramfs.

--device will accept device node name as the param.

Signed-off-by: Dave Young <dyoung@redhat.com>
Tested-by: Chao Wang <chaowang@redhat.com>
2012-08-23 10:15:09 +02:00
dyoung@redhat.com c4bb88715c wait host devs in base module
each dev in host_devs[] should be waited in initqueue to make sure they
are oneline before initqueue finish.

Add a new wait_host_devs.sh in base module to make this a generic thing.
Because all the devs in fstab lines are also added to host_devs, so no need
do same wait in fstab-sys module anymore.

[v2->v3]: do not add slave devices to host_devs
          wait for persistent dev name in initramfs

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-08-23 10:15:09 +02:00
Harald Hoyer 506b219237 dracut.sh: create relative symlinks for /var/lock and /var/run 2012-07-31 11:48:03 +02:00
Harald Hoyer 6c83d7d5bf dracut.sh: do not copy /var/run and /var/lock from the system
https://bugs.gentoo.org/show_bug.cgi?id=428142

If /var/run and /var/lock are real directories, we would end up with:
var/lock/lock -> /run/lock
var/run/run -> /run
2012-07-31 11:44:40 +02:00
Harald Hoyer bfd2e8c25f dracut.sh: test if we can lazy resolve with ldd 2012-07-30 13:02:41 +02:00
Harald Hoyer 3e964eeb96 dracut.sh: put $drivers and $filesystems back in export 2012-07-27 16:06:36 +02:00
Harald Hoyer aec9f902f0 kernel-modules/module-setup.sh: move "$drivers" "$filesystems" and "$add_drivers" to dracut.sh 2012-07-27 16:03:42 +02:00
Amadeusz Żołnowski ff3953efe1 ro_mnt - option at build time to force ro mount of / and /usr 2012-07-26 17:16:56 +02:00
Harald Hoyer 472189da15 dracut.sh: add -N option for --no-hostonly 2012-07-21 13:03:56 +02:00