summaryrefslogtreecommitdiff
path: root/hook-functions
AgeCommit message (Collapse)Author
2016-01-21hook-functions: Include drivers for all keyboards when MODULES=depBen Hutchings
Additional modular drivers (e.g. ohci_pci, hid) may be needed for entering a disk encryption passphrase or for the panic shell. Closes: #639876 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2016-01-20hook-functions: Include any modular RTC drivers in the initramfsBen Hutchings
The RTC is needed for periodic filesystem checks to work. Debian currently builds-in all RTC drivers though. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-22hook-functions: Preserve symlinks when copying filesBen Hutchings
When the source for copy_file is a symlink, copy both the symlink and the file it points to. Resolve the symlink fully rather than trying to replicate a potentially complex chain of symlinks. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-12hook-functions: Use copy_file to install modulesBen Hutchings
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-12Use copy_file to copy config files and firmware, instead of copy_execBen Hutchings
We shouldn't run ldd on non-executable files (see #799443). Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-12hook-functions: Introduce copy_file functionBen Hutchings
Split the file copying logic out of copy_exec so we can use it without invoking ldd. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-10Merge branch 'benh/block-sysfs-generic'Ben Hutchings
2015-12-09hook-functions: Include drivers/nvme in block driver modulesBen Hutchings
nvme moves to its own directory in Linux 4.4, so include modules from there. Closes: #807000 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-09When adding i8042 also add psmouse as some keyboards are behind the mouse. ↵Andy Whitcroft
LP: #1314764 * hook-functions/auto_add_modules: include psmouse as some keyboards are connected to the "pass-thru" port on the PS2 mouse port because that is such a good idea). (LP: #1314764) Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-08hook-functions: Include modules for all components of a multi-disk deviceBen Hutchings
Now that we can generically find components, we can also iterate over them and recurse. Closes: #620814 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-08hook-functions: Rewrite block device sysfs lookup to be genericBen Hutchings
There is no need to parse device names or call utilities to find device relationships; they are all included in sysfs. (The generic 'slaves' subdirectory has been present since 2.6.17, DEVTYPE=partiton since 2.6.25 and /sys/dev/block since 2.6.27.) This fixes a number of cases where we would wrongly strip a numeric suffix from a whole-disk device name. It also allows us to find the components of a bcache device. Closes: #747871, #785147, #807004, #807256 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-08hook-functions: Remove loop-aes supportBen Hutchings
loop-aes is obsolete since a compatible mode was added to dm-crypt. It's also no longer included in Debian. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-08hook-functions: Split block device sysfs lookup into a separate functionBen Hutchings
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-08hook-functions: Fold sys_walk_modalias into sys_walk_mod_addBen Hutchings
sys_walk_modalias is only called from sys_walk_mod_add and (redundantly) if we find an old-style IDE device. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-12-06hook-functions: Always use /proc/mounts, avoiding mangling of /dev/rootBen Hutchings
lilo may pass the kernel parameter root=XXXX, specifiying a block device by number in hex. In this case a block device node is created with that number at /dev/root. However, the mount command translates this back to the block device number. Avoid this misfeature by always reading /proc/mounts. Closes: #766920 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-09-17hook-functions: Include soft-dependencies of all kernel modulesBen Hutchings
The proper solution to hidden module dependencies is to add 'softdep' information to the depending modules. Unfortunately we currently still won't see those dependencies as 'modprobe --ignore-install' inhibits processing of both 'install' and 'softdep' configuration lines and embedded softdep information. There are good reasons for using --ignore-install (see #384043), so instead of removing this option we run modprobe twice, with and without it. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-01-27Allow passing arguments to hooks and scriptsBen Hutchings
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2015-01-27Merge branch 'bwh/usr-dependencies'Ben Hutchings
2015-01-21hook-functions: Add xhci-pci to module listBastian Blank
Closes: #773250 Signed-off-by: Bastian Blank <waldi@debian.org>
2015-01-18dep_add_modules: Add modules needed for /usr deviceBen Hutchings
In case the root and /usr filesystems are of different types, or are on different types of device, we must add the modules needed for both. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2014-10-14hook-functions: Add modules for various important device typesBen Hutchings
Storage and networking devices may depend on PHYs that aren't clearly linked to them in the device model, so add those drivers. If MODULES=most then add all of them. On ARM systems without useful firmware we may also need to do a lot more chip/board configuration, so also add clk, gpio, pinctrl and regulator drivers. If MODULES=most then add all drivers built from the corresponding source directories. If MODULES=dep then add drivers for the visible devices in these classes. As clk and regulator don't have real device classes but do have driver names beginning with common prefixes, add modules based on the current loaded or built-in modules matching these prefixes. The same goes for USB-PHY drivers. Closes: #762042 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2014-10-13Move get_source, set_initlist, get_prereq_pairs, call_scripts to hook-functionsBen Hutchings
These functions are not needed at boot time. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2014-10-13Always generate ORDER files in mkinitramfsBen Hutchings
Execute scripts from their source location, not the temporary directory. Remove functions to generate ORDER at boot time. Closes: #688794 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2014-10-03Fix handling of root filesystem with LABEL=/ (/dev/disk/by-label/\x2f)nandhp
My root filesystem has label "/". Since creating the filesystem, I have realized that this is not the best choice of label, for it results in device names like '/dev/disk/by-label/\x2f'. However, I used to use labels only for convenience in my partition editor. (I believe this naming scheme used to be the default in RedHat.[1]) Yesterday, I switched to using labels in my fstab (LABEL=/ for the root filesystem). However, after rebooting, update-initramfs no longer works: $ sudo update-initramfs -u update-initramfs: Generating /boot/initrd.img-3.2.0-4-ixp4xx /dev/disk/by-label/x2f: No such file or directory mkinitramfs: for root /dev/disk/by-label/x2f missing disk/by-label/x /sys/block/ entry mkinitramfs: workaround is MODULES=most mkinitramfs: Error please report the bug update-initramfs: failed for /boot/initrd.img-3.2.0-4-ixp4xx with 1. $ The problem is that the `dep_add_modules` function in /usr/share/initramfs-tools/hook-functions uses the following routine to identify the root block device and its filesystem type: eval "$( mount | while read dev foo mp foo fs opts rest ; do \ [ "$mp" = "/" ] && [ "$fs" != "rootfs" ] \ && printf "root=$dev\nFSTYPE=$fs" \ && break; done)" and when presented with the following line from mount, /dev/disk/by-label/\x2f on / type ext3 (rw,relatime,errors=remount-ro,barrier=1,data=ordered) the routine fails for two reasons: 1) the call to read does not use the -r option, so the backslash is stripped, and 2) the device name is interpolated into the format string of printf (which turns \x2f into a literal /). I propose the following patch, which allows / to be used in disk labels (enabling me to rebuild my own initrd). However, some other special characters that could appear in disk labels, like apostrophe and space, will remain problematic -- a more complete patch might be desirable. I believe that version 0.115 is also susceptible to this problem, as it uses the same code to identify the root block device, but I have not tested it with non-alphanumeric disk labels.
2014-09-30Merge branch 'fix-firmware-list'Ben Hutchings
2014-09-28Check for root device's module dependencies at all levels of device hierarchyBen Hutchings
Currently sys_walk_modalias only looks for a modalias in the grandparent of the given device path. This doesn't match what the name 'walk' implies. sys_walk_mod_add calls it for each level of the device hierarchy, but since it only looks at the grandparent it will miss some modaliases, e.g. sd_mod or virtio_blk. We explicitly add sd_mod when we see any SCSI device, so we usually get away with this. However, virtio_blk is currently not added to a MODULES=dep initramfs if it is modular for the target kernel but built into the running kernel. Related-to: #760127 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2014-09-28Support MODULES=dep usage when root was mounted from hidden /dev/rootBen Hutchings
When a current kernel boots without an initramfs provided, it creates /dev/root on an empty initramfs and mounts that. There is no /dev/root on the running system, so we fail to find the real device. In that case, look up the root device in /proc/cmdline. Related-to: #760127 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2014-09-28Add more sanity checks on root device name in dep_add_modulesBen Hutchings
Check that readlink succeeds and that the block device exists, after eliminating the ubifs case. Related-to: #760127 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2014-09-27manual_add_modules: Set the kernel version when checking module firmware depsBen Hutchings
Currently we don't tell modinfo which kernel version to look at when checking which firmware files a module may need. It will default to the running kernel, not the one we're building the initramfs for. So we may not copy all the necessary firmware or we may provoke warnings in case a module doesn't exist in the running kernel. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2014-08-30Support usage of partitioned nbd devices with MODULES=depMichael Prokop
Otherwise fails with: | mkinitramfs: for root /dev/nbd0p2 missing nbd /sys/block/ entry Closes: #697368 Thanks: Ian Campbell <ijc@hellion.org.uk> for the patch
2014-08-30Support MODULES=dep usage on i2o hardware RAID controllerMichael Prokop
Closes: #689558 Thanks: Stephen Powell <zlinuxman@wowway.com> for the patch
2014-08-30Fix hidden dependency issue with btrfs and crc32cMichael Prokop
Quoting Markus Wanner in #748805: | Since Linux 3.14 (or 0b947aff1599afbbd2ec07ada87b05af0f94cf10, to be | precise), the btrfs module no longer depends on libcrc32c, but only on | crc32c. However, this is one of the "hidden" dependencies, so | modules.dep doesn't list it. If mkinitramfs doesn't happen to include | crc32c for some other reason, an initrd without that module is | generated, even if btrfs needs it to boot. For me, this led to the same | error upon boot, as others have posted, before: | | modprobe: can't load module btrfs (kernel/fs/btrfs/btrfs.ko): unknown | symbol in module, or unknown parametr | | (Without any further hints in dmegs, BTW) | | The attached patch adds an entry to the list of hidden dependencies to | /usr/share/initramfs-tools/hook-functions to fix this issue. This also | renders the work-around proposed by Tristan unnecessary. Thanks: Markus Wanner <markus@bluegap.ch> for the analysis and patch Closes: #748805
2014-06-11hook-functions: add support for virtio-mmioAurelien Jarno
On most virtual machines it is possible to use the virtio interface through the PCI bus to export for example block or net devices. On some architectures the emulated machine does not have a PCI bus, and thus the transport goes through an MMIO interface. Currently initramfs-tools correctly handle the PCI case, but not the MMIO on. In case of a virtio based root device, the virtio_mmio module is not available in the initramfs causing the boot to fail. This commit adds the virtio_mmio module if virtio is used (in dep mode), or by default (in most mode). Closes: #751143 Signed-off-by: Michael Prokop <mika@debian.org>
2013-11-04Add ohci-pci to base modulesMichael Prokop
Closes: #726957 Signed-off-by: Michael Prokop <mika@debian.org>
2013-09-11include ehci-orion in auto_add_modules_listIan Campbell
This became a separate driver in v3.10 (a76dd463c58e), it is used on the Orion and Kirkwood flavours. Closes: #721519 Reviewed-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: maximilian attems <max@stro.at>
2013-06-17implement early initramfs supportHenrique de Moraes Holschuh
Add a new hook function, prepend_earlyinitramfs(), which prepends the content of the file passed as a parameter to the initramfs that will be generated. This will be used to pass system processor microcode and ACPI table overrides to the kernel (requires Linux kernel v3.9 or later). Signed-off-by: Henrique de Moraes Holschuh <hmh@debian.org>
2013-03-30hook-functions: Exclude more unnecessary net driversBen Hutchings
Exclude drivers for: - software devices: dummy, ifb, tun, veth. - layered devices: macvlan, macvtap, team - physical devices unlikely to be useful at boot: hippi/*, sb1000, xen-netback Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2013-03-30hook-functions: Include more HID drivers in baseBen Hutchings
Currently we're not including all the HID drivers that support keyboards. Further, there are occasional regressions when a keyboard that was previously handled by the generic code gets a specialised drivers that's not on our list. Instead of trying to list all the HID driver modules, include the whole drivers/hid tree and exclude specific modules that we know don't support keyboards. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Closes: #697619
2013-03-01include ehci-pci in auto_add_modules listMichael Prokop
Linux v3.8 changes the name of the PCI ehci driver from ehci-hcd to ehci-pci. Ref | commit adfa79d1c06a32650332930ca4c488ca570b3407 | Author: Alan Stern <stern@rowland.harvard.edu> | Date: Thu Nov 1 11:13:04 2012 -0400 | | USB: EHCI: make ehci-pci a separate driver | | This patch (as1625) splits the PCI portion of ehci-hcd out into its | own separate driver module, called ehci-pci. Consistently with the | current practice, the decision whether to build this module is not | user-configurable. If EHCI and PCI are enabled then the module will | be built, always. | | Signed-off-by: Alan Stern <stern@rowland.harvard.edu> | CC: Felipe Balbi <balbi@ti.com> | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Thanks: Bjørn Mork <bjorn@mork.no> for bug report + patch Closes: #700572
2013-01-21Install nfsv{2,3,4} kernel modules as used by Kernels >=3.6Michael Prokop
Starting with kernel version 3.6 the nfs module has been split into version specific modules, so nfsv2, nfsv3 and nfsv4 are also required to get the according NFS version working. See kernel.git commit 1c606fb74c758beafd98cbad9a9133eadeec2371 ("NFS: Convert v3 into a module") for further details. Therefore also add the nfsv{2,3,4} kernel modules via hook-functions' auto_add_modules() so netbooting works. Thanks: Julien Cristau <jcristau@debian.org> for the hint regarding the split
2012-07-22hook-functions: add hid-generic modulemaximilian attems
When upgrading to Linux 3.5, USB keyboards don’t work anymore because the usbhid module has been renamed to hid-generic and the new module is not included in the initramfs. Add hid-generic to modules most list. Closes: #682340 Reported-by: Michael Stapelberg <stapelberg@debian.org> Signed-off-by: maximilian attems <max@stro.at>
2012-06-08initramfs-tools: copy_exec add pattern for nonoptimized multiarch librariesMichal Suchanek
initramfs-tools hook-functions has copy_exec function needs some updates. There is one unquoted occurence of ${src} and the pattern for nonoptimized libraries does not match multiarch libraries. It does not match multilib libraries in /lib32 and /lib64 but those are rare and should not multiply. The only library that is installed in /lib32/i586 and /lib32/i686/cmov is libssl on mu system. Note that for x in ... does not handle spaces in library paths but I am not particularly concerned. Closes: #659752 Signed-off-by: maximilian attems <max@stro.at>
2012-06-08initramfs-tools: copy_exec quote ${src}Michal Suchanek
Fix unquoted occurence of ${src}. Signed-off-by: maximilian attems <max@stro.at>
2012-06-07initramfs-tools: Make manual_add_modules a no-op with no argumentsJosh Triplett
manual_add_modules can potentially get called with no arguments, such as if all the modules hidden_dep_add_modules wants to add don't exist in the target kernel. Check for that case to avoid triggering an error by calling modprobe with no arguments. Closes: 676439 Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: maximilian attems <max@stro.at>
2012-06-06initramfs-tools: fix update-initramfs with modprobe optionsJosh Triplett
Ignore module options printed by modprobe, long story: > Using update-initramfs -u gives me the following output: > > # update-initramfs -u > update-initramfs: Generating /boot/initrd.img-3.3.0-trunk-amd64 > install: cannot stat `/lib/modules/3.3.0-trunk-amd64/kernel/drivers/hid/hid-apple.ko fnmode=2 ': No such file or directory > ERROR: Module /lib/modules/3.3.0-trunk-amd64/kernel/drivers/hid/hid-apple.ko fnmode=2 not found. > install: cannot stat `/lib/modules/3.3.0-trunk-amd64/kernel/drivers/gpu/drm/radeon/radeon.ko modeset=1 ': No such file or directory > E: /usr/share/initramfs-tools/hooks/plymouth failed with return 1. > update-initramfs: failed for /boot/initrd.img-3.3.0-trunk-amd64 with 1. > > # cat /etc/modprobe.d/radeon-kms.conf > options radeon modeset=1 > > # dpkg -S /etc/modprobe.d/radeon-kms.conf > xserver-xorg-video-radeon: /etc/modprobe.d/radeon-kms.conf Looks like modprobe's current behavior doesn't quite match what it appeared to do when I originally wrote the patch for bug 652525; in particular, modprobe --show-depends now outputs the options for a module, not just the module. (It must not have done so at the time I wrote the patch, or I would have seen this failure when I tested the patch on my system, since I have the same option set for i915.) When reading the output of modprobe, only use the first word after "insmod" as the module name, not the remainder of the line (which may include module options). Closes: #676400 Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: maximilian attems <max@stro.at>
2012-06-05nitramfs-tools: speed-up by avoiding forks in the per-module hot pathJosh Triplett
> This results in a long delay every time I upgrade either a kernel or any > package with an update-initramfs hook. > > As far as I can tell, a large part of this processing time seems to > consist of the per-module processing for the ~500 kernel modules copied > into the initramfs, forking off a pile of programs for each one. I > tried optimizing the per-module hot path to eliminate as many forks as > possible, and managed to speed it up considerably: > > ~$ time sudo update-initramfs -u > update-initramfs: Generating /boot/initrd.img-3.1.0-1-amd64 > > real 0m21.385s > user 0m14.393s > sys 0m0.740s > > I've attached a patch implementing these optimizations. > > A few other possible improvements: > > - Generate a list of modules and processing them all in batch at the > end of update-initramfs, to allow calling modprobe and modinfo only > once. Likely to make a huge difference. > - In the absence of the above, make manual_add_modules take a list of > modules and process them all, and make the various hooks pass a list > of modules to manual_add_modules rather than calling it repeatedly. I implemented this addition, making manual_add_modules take multiple arguments, and it provided another significant performance improvement: ~$ time sudo update-initramfs -u update-initramfs: Generating /boot/initrd.img-3.1.0-1-amd64 real 0m18.763s user 0m14.569s sys 0m0.720s The difference between the original and patched versions in terms of executed programs: ~$ grep -c 'execve' /tmp/update-initramfs.orig.strace 6355 ~$ grep -c 'execve' /tmp/update-initramfs.patched.strace 2153 And more specifically the calls to modprobe: ~$ grep -c 'execve.*modprobe' /tmp/update-initramfs.orig.strace 549 ~$ grep -c 'execve.*modprobe' /tmp/update-initramfs.patched.strace 34 Implementing full batching would reduce the modprobe calls down to 1, but 34 still represents a significant improvement with relatively little effort. Closes: #652525 [ minor whitespace nitpicking + smallish porting to current git -maks ] Signed-off-by: maximilian attems <max@stro.at>
2012-06-04hook-functions: handle rootfs output from mount(8)maximilian attems
During my upgrade, sysvinit-utils and initscripts have been upgraded from 2.88dsf-13.1 to 2.88dsf-22.1. I think (I did not check) that this move /etc/mtab into a symlink to /proc/mounts. So, the result of "mount" should be handled the same as the contents of /proc/mounts. And indeed, adding " && [ "$fs" != "rootfs" ]" when handling the output of mount fixed the problem for me. Closes: #668616 Reported-by: Vincent Danjean <vdanjean@debian.org> Signed-off-by: maximilian attems <max@stro.at>
2012-03-06initramfs-tools: Add per default missing hid-logitech-djVadim Solomin
Initramfs for the 3.2 linux kernels doesn't include hid-logitech-dj module, rendering certain Logitech keyboards unusable. Patch attached. -- Vadim Solomin Closes: #658029 Signed-off-by: maximilian attems <max@stro.at> Signed-off-by: Michael Prokop <mika@debian.org> [rebased against current master]
2012-03-06hook-functions: ext4dev is gonemaximilian attems
This name is used by ext4 developers from time to time, but has no longer anything to search in stable linux 3.X releases. Signed-off-by: maximilian attems <max@stro.at> Signed-off-by: Michael Prokop <mika@debian.org>
2011-11-23copy_exec: Handle optimized libraries under multiarch pathsSven Joachim
In a multiarch world, libraries are not directly installed under {/usr,}/lib, but one directory below. Adjust the search accordingly. Closes: #636495 Signed-off-by: Michael Prokop <mika@debian.org> Signed-off-by: maximilian attems <max@stro.at>