Commit Graph

201 Commits (014)

Author SHA1 Message Date
Harald Hoyer c97e1a76f3 dracut-functions: install udev rules
Install the udev rules to /lib, if the original rule is found there.
2011-03-25 16:10:46 +01:00
Harald Hoyer 94f4923039 mkdir -m 0755
add the missing directory permissions to mkdir
2011-03-25 15:44:00 +01:00
Amadeusz Żołnowski e103615be2 dracut-logger: logging facility module for build- and boot-time
It's dash compatible to be used also at boot-time. For now it's included
by dracut-functions and replaces functions: dinfo(), dwarning() and
derror(). New options are introduced: -L|--stdlog, and -q|--quiet to
control stderr verbosity. Logging to file or syslog may be controlled by
options set in config file.

Note that code is not adjusted to the meaning of the new logging
functions, yet.

Doxygen formatted documentation (as a proposal, by the way) is included
in dracut-logger.
2011-03-15 19:52:59 +01:00
Will Woods fe9cdf741f inst_dir: fix handling of relative symlinks outside the current dir
inst_dir used the following to try to resolve a relative path:
  [[ $target = ${target##*/} ]] && target="${file%/*}/$target"
  inst_dir $target

This will only match if $target has no slashes, so something like
/usr/bin -> ../sbin would result in: inst_dir ../sbin, or
/usr/share -> local/share would result in: inst_dir local/share
which is not going to do the right thing.

Instead, we resolve any non-absolute link, like so:
  [[ $target == ${target#/} ]] && target=$(dirname "$file")/$target
Thus /usr/bin -> ../sbin results in: inst_dir /usr/../sbin, and
/usr/share -> local/share results in: inst_dir /usr/local/share
which is what you would expect.
2011-03-09 12:09:10 +01:00
Harald Hoyer 0b440844bd dracut-functions: fixed instmods() return value
The FIPS installkernel() relies on the instmods() return value. So only
return 0, if the module and its dependencies were actually installed
correctly.
2011-03-07 13:37:18 +01:00
Harald Hoyer 724b87a6f8 dracut-functions: check for missing dracut modules
If the user explicitly specified "-a <modules>" or "-m <modules>",
   warn him about possible missing modules.
2011-03-07 13:37:18 +01:00
Harald Hoyer 5242d8fb57 dracut-functions: if .hmac files are present, install them also
For FIPS mode, we need all checksum files, called .<filename>.hmac. So,
if we find one, we install it.
2011-03-07 13:37:18 +01:00
Harald Hoyer 1a0d82a3dd dracut-functions: space 2011-03-07 13:37:17 +01:00
Harald Hoyer ebaee770ac dracut-functions: more verbose logging message format 2011-03-07 13:37:17 +01:00
Harald Hoyer ee89f47453 dracut-functions: check if directory of logfile is writable
Do not check, if the logfile itsself is writable. Check the directory
instead.
2011-03-07 13:37:11 +01:00
Amadeusz Żołnowski f90fd5b34b dracut-functions: fixed doubled $initdir prefix inst_library()
Commit 172d85b9c9 caused following error:

./dracut-functions: line 307: cd: /tmp/initramfs.mP7cPY/tmp/initramfs.mP7cPY/lib64: No such file or directory

Patch removes beginning $initdir for symlink case.
2011-02-25 10:06:35 +01:00
Jon Ander Hernandez 172d85b9c9 dracut-functions: fixed installing libraries which links to another directory
$ ldd `which bash` | grep ld
/lib64/ld-linux-x86-64.so.2 (0x00007fa1cc3ff000)

$ readlink -f /lib64/ld-linux-x86-64.so.2
/lib/ld-2.12.1.so

So inst_library /lib64/ld-linux-x86-64.so.2 was doing :

(cd "/tmp/initramfs.4uaeD9/lib64" && ln -s "/lib/ld-2.12.1.so"
 "ld-linux-x86-64.so.2")

But, /tmp/initramfs.4uaeD9/lib64 -> /lib... :-S
2011-02-17 10:50:18 +01:00
Harald Hoyer 81c6e7fb69 dracut-functions: handle shared objects in find_binary w/o the exec flag 2011-02-17 10:50:16 +01:00
maximilian attems f63c30d89b dracut: Don't suppress the modprobe error output.
It happens that either due to newer modprobe or missing depmod
module-init-tools cries.
Suppressing the error ensures for a funny debug search for the user.
Resulting initramfs is generally unbootable due to missing module deps.

Better use the quiet option of modprobe itself.
It makes it less chatty, but doesn't suppress "fatal" errors.

Signed-off-by: maximilian attems <max@stro.at>
2011-02-16 15:01:30 +01:00
Harald Hoyer 52889453c1 dracut-functions: write to $HOME/dracut.log instead of /tmp/dracut.log 2011-02-08 17:59:48 +01:00
Harald Hoyer 71df3c4329 renamed module-info.sh to module-setup.sh 2011-02-02 16:35:18 +01:00
Harald Hoyer 95d2dabc25 replaced check,install,installkernel with module-info.sh 2011-02-02 13:56:03 +01:00
Harald Hoyer 51c977d1ff dracut-functions:find_block_device() workaround for btrfs
/proc/self/mountinfo contains the btrfs virtual device major minor.
Determine the real major minor with the device.
2010-10-29 12:34:27 +02:00
Harald Hoyer 11adeb7c01 dracut-functions:inst_symlink() create target dir
if the target directory of the symlink didn't exist, we failed
2010-10-28 17:11:34 +02:00
Harald Hoyer 54b01e99d3 dracut-functions: suppress modinfo errors for hostonly mode 2010-10-27 11:19:27 +02:00
Harald Hoyer 1f9de919e0 dracut-functions: filter_kernel_modules() search in extra dirs
search also in "extra" and "weak-updates" for kernel modules
https://bugzilla.redhat.com/show_bug.cgi?id=622641
2010-09-22 16:19:11 +02:00
Harald Hoyer cc02093d69 reformat source code
removed tabs and set indention to 4 spaces
added emacs and vi format headers
2010-09-10 15:34:36 +02:00
Victor Lowther 3478b3146f Trivial cleanups in dracut-functions
This is a patch series I have been playing with for awhile.

It cleans up some of the dracut code and adds a PKGBUILD file to make
it easier to use in Arch Linux.
2010-08-23 11:51:33 +02:00
Harald Hoyer 7c1796860f dracut: add --fstab, to ignore /proc/self/mountinfo 2010-08-06 13:54:34 +02:00
Harald Hoyer 029f2691f8 dracut-functions: use /proc/self/mountinfo, instead of /proc/mounts
1. it's easier to get the major:minor
2. it's more failsafe in a chroot() (rescue CD case)
2010-08-05 18:59:51 +02:00
Andrey Borzenkov 62f8a2b63c Harden check for used modules in hostonly mode
Make sure that we do not accept module name which is substring of
some other module name. This resulted in piix being mistakenly loaded
together with ata_piix. It completely broke DVD access here.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-08-04 18:30:02 +02:00
Harald Hoyer 578c24a473 dracut-functions: fixed --omit 2010-08-04 17:46:54 +02:00
Harald Hoyer f007e84e8e dracut-functions: fix check=255 logic and dependencies 2010-08-02 14:17:52 +02:00
Harald Hoyer bb7645459e dracut-functions: fix "-m -a" handling 2010-07-27 11:51:27 +02:00
Amadeusz Żołnowski a10a1416c1 dracut-functions: additional symlinks for library files
rev_lib_symlinks: it's new
inst_library: creating additional symlinks for installed library files
2010-07-21 13:38:46 +02:00
Amadeusz Żołnowski fd2312e03d dracut-functions: cosmetic changes to inst_rules 2010-07-06 10:19:02 +02:00
Amadeusz Żołnowski 5f70a1bd06 dracut-functions: info which udev rules are skipped
I found it useful.  Maybe help others debugging.
2010-07-06 10:19:01 +02:00
Amadeusz Żołnowski 87122afcda add module i18n
dracut-functions: added functions: mksubdirs, inst_decompress,
                  inst_opt_decompress and print_vars

dracut.conf.d: added configuration files for Gentoo and RedHat/Fedora
2010-07-06 10:18:30 +02:00
Harald Hoyer 45b5a4e142 dracut-functions: use LC_ALL=C rather than LANG=C 2010-06-22 11:59:49 +02:00
Harald Hoyer e4ebd474ec dracut-functions: set LANG=C for ldd output parsing 2010-06-22 10:32:25 +02:00
Amadeusz Żołnowski 22ecea456b dracut, dracut-functions: better vercmp
credits go to V. Lowther
2010-06-17 09:43:16 +02:00
Amadeusz Żołnowski 2c24ee9a72 dracut-functions: fun. vercmp optimized; credits go to Victor Lowther 2010-06-09 17:36:02 +02:00
Amadeusz Żołnowski ecf42850c3 Support old version of module-init-tools
modprobe included in version prior to 3.7 of module-init-tools doesn't
have -d | --dirname option which allows to give a prefix other than
'/' for kernel modules path. Dracut assumes existence of that
option and uses it even with default '/'. The patch passes -d option
only if it's different from default and also checks module-init-tools
version if user changes the prefix by --kmoddir Dracut option.
2010-06-09 10:46:38 +02:00
Harald Hoyer ed8c7bf5c2 dracut-functions: beautified warnings 2010-05-26 17:43:18 +02:00
Harald Hoyer 70503db416 dracut-functions: check if specific dracut module is missing 2010-05-26 17:42:57 +02:00
Andy Lutomirski a3afcf2a5a 90mdraid dracut-functions: fix md raid hostonly detection
check_block_and_slaves looks at slaves but not parents.
2010-05-19 08:13:12 +02:00
Harald Hoyer d8b9844c61 dracut-functions: use udevadm to get ID_FS_* 2010-05-03 11:34:30 +02:00
Luca Berra 74c5dd2158 dracut-functions: add additional drivers in host-only mode, too
this makes dracut load kernel module specified in add-drivers even
if building an host-only mkinitrd, it is useful in cases where we
might change some storage drivers and still don't want to build
an enormous initrd (e.g. ahci/ata_piix)
2010-01-13 16:02:10 +01:00
Luca Berra 9b37edbff5 dracut-functions: add support for compressed kernel modules 2010-01-13 15:53:17 +01:00
Harald Hoyer ba67b9239b changed hostonly documentation and handling 2009-11-27 14:29:32 +01:00
Harald Hoyer 3c56f37265 dracut-functions: inst_simple(): do not bail out if target is a dir and exists 2009-11-26 10:56:53 +01:00
Peter Jones c761b26aef Handle modules with hyphens in their names properly.
If a module has a hyphen in its name, it will show up as an underscore
in /proc/modules.  Because of this, when we're testing /proc/modules,
we have to munge our module filename expression to match.
2009-11-25 13:40:22 -05:00
Harald Hoyer 116cb137fe dracut-functions: dinfo() on missing firmware, rather than dwarning() 2009-11-05 17:06:26 +01:00
Alan Jenkins 95bde7588c Tidy up some comments
Fix a few typos.
2009-11-03 17:47:38 +01:00
Harald Hoyer 5d791c0ea9 join $dsrc and $dracutbasedir 2009-10-27 16:02:56 +01:00
Harald Hoyer d46c2e8b0a dracut-functions: let inst*() honor and handle symlinks correctly 2009-09-30 15:35:33 +02:00
Harald Hoyer f6d1cb89de dracut-functions: inst_simple() with cp -p to preserver timestamps, etc. 2009-09-30 15:34:12 +02:00
Lance Albertson 1961248339 dir symlinks
On amd64 multilib Gentoo, /lib is a symlink to /lib64, and dracut creates
duplicate files in /lib and /lib64 in a resulting cpio image. Other files are
missing in /lib64 but exists in /lib in that image. So /usr/sbin/lvm fails to
run from initrd due to missing libraries.  A possible solution is to create in
the initrd the same /lib symlink as in host system, if /lib is a symlink.

http://bugs.gentoo.org/show_bug.cgi?id=278442#c10
2009-09-29 19:01:29 +02:00
Harald Hoyer 94dcc5b8d8 fix backwards inst() compat 2009-09-14 19:33:54 +02:00
Harald Hoyer 9541165d33 dracut-functions: fixed inst() for mkinitrd compat 2009-09-14 15:53:55 +02:00
Harald Hoyer f165864f09 dracut-functions: make inst() mkinitrd compatible 2009-09-09 18:05:00 +02:00
Harald Hoyer 59580f28a1 dracut-functions: do not try to clear logfile, if not writable 2009-09-01 15:42:28 +02:00
Harald Hoyer 533d7dc4ab dracut-function: add check for volume group members
see https://bugzilla.redhat.com/show_bug.cgi?id=506189

not all members of a linear volume group are listed in /sys slaves
2009-09-01 15:42:28 +02:00
Harald Hoyer 6568d86aec instmods(): fixed "instmods =drivers/md" 2009-08-28 13:33:57 +02:00
Harald Hoyer 973c23b0d6 should_source_module(): refined check
Do not bail out early if no install exists.
Check also for installkernel.
2009-08-27 12:53:38 +02:00
Victor Lowther 9ede1929b2 Oops, clean up broken get_fs_type implementation.
While we are at it, make a couple of other fixups.
2009-08-22 12:04:11 -05:00
Victor Lowther fb8923f681 Minor fixups to kernel module loading
Also rewrite filter_kernel_modules to make it a little easier to read.
2009-08-20 22:21:33 -05:00
Victor Lowther 240cc7c480 Abstract out hostonly vs. generic module installation differences.
This introduces filter_kernel_modules, which should be used to install
all kernel modules that match whatever criteria you want.

If running in --hostonly, filter_kernel_modules will only consider
modules that are loaded in the kernel, otherwise it will consider
all the modules installed on the system for the appropriate kernel.

This drastically reduces initramfs generation time when using --hostonly
by eliminating lots of unneeded filesystem activity.
2009-08-20 15:52:45 -05:00
Victor Lowther 16df64ef1f Abstract out vol_id vs. blkid usage.
vol_id seems to be going away, and blkid can be used as a drop-in replacement
for it.
2009-08-20 07:28:04 -05:00
Victor Lowther f76ef3aa3d Speed up loading block drivers when running with --hostonly
Instead of grovelling through all the modules available for the
kernel looking for block devices, only look at the modules that are
actually loaded. This speeds things up by a rather large amount
when generating the initramfs with --hostonly.

While we are at it, only load the filesystem module that will actually
be used for the root filesystem when running in --hostonly instead
of all the filesystem modules that happen to be loaded at the time.
2009-08-19 22:21:29 -05:00
Victor Lowther 59c88f499f Abstract out vol_id vs. blkid usage
Since different distros may or may not use vol_id in udev, and blkid
is generally replacing vol_id, abstract them out into a function which
tries to use vol_id first and blkid second, on the assumption that
blkid can take over for vol_id if vol_id is no longer there.
2009-08-19 22:21:07 -05:00
Harald Hoyer 9defc609e8 dracut-functions: check for existance of slave devices before opening it 2009-08-19 17:08:57 +02:00
Victor Lowther 17829e94aa Move common rootfs finding and backing store tree checking to dracut-functions 2009-08-16 15:29:50 -05:00
Victor Lowther e0dca0e43c Minor spacing fixups in dracut-finctions 2009-08-16 15:29:49 -05:00
Victor Lowther ddfd1d10a0 Split kernel module loading into smaller chunks.
This prepares to more tightly integrate dracut-gencmdline with the
rest of the dracut scripts
2009-08-16 15:28:45 -05:00
Victor Lowther 0c1a8ebc37 More quotation fixups in dracut-functions 2009-08-15 10:56:36 -05:00
Victor Lowther bd4c4bcb76 Simplify dracut_install a bit, an make a minor fixup to check_module_deps 2009-08-15 07:55:59 -05:00
Victor Lowther 161efa1f40 Some quotation cleanups in dracut-functions.
Quotes are generally not needed in when assigning one variable to another,
and are also not needed inside [[ ]] comaprisons, as word splitting and
pathname expansion are not performed in these cases.
2009-08-15 07:38:26 -05:00
Harald Hoyer 860ace56f8 inst_simple(): add -p flag to cp 2009-08-13 14:22:54 +02:00
Sergey Fionov 0c296f15b1 Fix full pathname condition in find_library
Hello,

Now a fact that the path is full is checked by
[[ -x $1 ]]

But if the working directory is /bin or a directory with a file named
"mount",
this condition will be met for "inst mount", and "mount" will not be copied
into initrd at all.
2009-08-04 16:21:58 +02:00
Michael Ploujnikov fdb3d52d59 use a variable to hold the regex
single quote regexps in variables to make it work with bash-3.1
2009-07-23 15:33:40 +02:00
Marc Grimme 9aaf7c3a33 dracut_install: add "-o" option
Calling dracut_install will optionally install the file. This is useful
for the debug module.
2009-07-23 12:15:54 +02:00
Harald Hoyer 33ee031c4a dracut: add --kernel-only and --no-kernel arguments
--kernel-only
              only install kernel drivers and firmware files

       --no-kernel
              do not install kernel drivers and firmware files

All kernel module related install commands moved from "install"
to "installkernel".

For "--kernel-only" all installkernel scripts of the specified
modules are used, regardless of any checks, so that all modules
which might be needed by any dracut generic image are in.

The basic idea is to create two images. One image with the kernel
modules and one without. So if the kernel changes, you only have
to replace one image.

Grub and the kernel can handle multiple images, so grub entry can
look like this:

title Fedora (2.6.29.5-191.fc11.i586)
        root (hd0,0)
        kernel /vmlinuz-2.6.29.5-191.fc11.i586 ro rhgb quiet
        initrd /initrd-20090722.img
        initrd /initrd-kernel-2.6.29.5-191.fc11.i586.img
        initrd /initrd-config.img

initrd-20090722.img
  the image provided by the initrd rpm
  one old backup version is kept like with the kernel

initrd-kernel-2.6.29.5-191.fc11.i586.img
  the image provided by the kernel rpm

initrd-config.img
  optional image with local configuration files
2009-07-22 15:07:11 +02:00
Harald Hoyer f24a2d46b7 fix kernel modules dir handling 2009-07-21 18:26:47 +02:00
Harald Hoyer 26537a5b79 add --fwdir parameter to dracut
--fwdir [DIR]
              specify additional directory, where to look for firmwares
2009-07-21 18:11:43 +02:00
Harald Hoyer 441d31b927 use kernel module directory specified on command line in modules also 2009-07-21 17:37:41 +02:00
Harald Hoyer 04db5fdc15 dracut: add --kmoddir directory, where to look for kernel modules
-k, --kmoddir [DIR]
              specify the directory, where to look for kernel modules
2009-07-21 17:25:12 +02:00
Seewer Philippe a55711cd86 Don't use absolute paths for utilities 2009-07-02 17:13:06 +02:00
Harald Hoyer 624b52c440 fixed adding modules via -a 2009-07-02 14:50:22 +02:00
Harald Hoyer 970e646b00 fixed --add option handling 2009-07-02 11:57:23 +02:00
Harald Hoyer 3e17f33b27 add --add option to add modules to the "all" list 2009-07-02 11:46:29 +02:00
Harald Hoyer 73198d53f3 /usr/lib/dracut -> /usr/share/dracut 2009-06-19 13:57:13 +02:00
Warren Togami 71afe645d7 Exclude i2o_scsi driver.
This kernel module is dangerous to load here.  It is meant only to allow direct
access to SCSI disks, which can destroy data.  The i2o_block driver gives you
access to the defined hardware RAID arrays.
2009-06-11 19:28:02 -04:00
Harald Hoyer c1d71b7ea3 fix dracut logging 2009-06-04 13:17:57 +02:00
Victor Lowther 71a19ef6e0 Excise excess logging verbosity when installing kernel modules. 2009-05-30 12:04:33 -05:00
Victor Lowther ac9a118354 Fix bug in kernel module loading
We were not loading all the required kernel modules due to a bug in the
dependency checking code.  This was causing us to load only the first
dependent module and ignore the rest.
2009-05-30 10:52:12 -05:00
Victor Lowther 4cf262689e Modify kernel module installation routine to respect --hostonly.
If dracut was run with --hostonly, instmods will only load a module
into the initramfs if it is already loaded on the host machine.

This really trims the fat out of a --hostonly  generated initramfs, and
eliminates the need for the kernel-modules-loaded hook.

This patch also allows a module to flag that it should only load as
a dependency by exiting 255 instead of 0.  Currently, only the network module
uses this functionality.
2009-05-29 23:07:56 -05:00
Victor Lowther 1a918b40b6 Log dracut output.
If we are installed, log to /var/log/dracut.log.
If we are not installed, log to /tmp/dracut.log
2009-05-28 21:41:05 -05:00
Victor Lowther c93d9f6265 Fix firmware installation.
Instead of calling firmware checking once per instmods invocation,
call only when we install an actual module on the initramfs.
2009-05-28 21:13:16 -05:00
Warren Togami e19d6bf603 Disambiguate modules and drivers. modules are dracutmodules. drivers are kernel modules. 2009-05-28 14:27:02 -04:00
Victor Lowther 0c2e3d1221 Add infrastructure for dracut module dependency checking.
This also eliminates --skip-missing.  Check scripts should now check
to ensure that any files and settings they will copy from the host
system actually exist when called without arguments.

The check scripts are also updated to not try to source dracut-functions
which(1) is a perfectly good way of checking if a command is on the path.
2009-05-25 17:49:39 +02:00
Harald Hoyer b649f1c21b let find_rule find absolute path rules 2009-05-25 14:08:39 +02:00
Victor Lowther cdad82fd14 Changed multiline conditional lists to if statements in dracut-functions
It seems that some people object to multiline conditional lists.
Oh, well, no accounting for taste.
2009-05-25 12:03:39 +02:00
David Dillow 5686cd41d6 dracut-funtions: fix 'instmods =modname'
Move srcmods definition into the function, as $kernel isn't defined yet when
dracut-functions is sourced from dracut.

Signed-off-by: David Dillow <dave@thedillows.org>
2009-05-25 11:51:36 +02:00
Andreas Thienemann 84ffb877fd dinfo print only when verbose defined 2009-05-20 12:30:22 +02:00