summaryrefslogtreecommitdiffstats
path: root/install/block
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-10-06 03:09:30 +0200
committerDave Reisner <dreisner@archlinux.org>2012-11-26 02:08:57 +0100
commit97368c0e78f3a4fe4d62f7aedde88d4be13bfdba (patch)
tree4164e1a9134455804c53218d29bdf4b2ef72b789 /install/block
parenteac33ad291fe89bb3e157c2ca8e0d8c152ab8f37 (diff)
downloadmkinitcpio-97368c0e78f3a4fe4d62f7aedde88d4be13bfdba.tar.gz
mkinitcpio-97368c0e78f3a4fe4d62f7aedde88d4be13bfdba.tar.xz
merge most storage hooks into a single 'block' hook
As the autodetect hook gets better with every kernel release, we can "afford" to remove the needless segregation of block device driver hooks and simply merge all the "vanilla" or "unstacked" block device drivers. This should make a lot of setups, like usb or virtio, easier as you won't need to remember to add the hook. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'install/block')
-rw-r--r--install/block45
1 files changed, 45 insertions, 0 deletions
diff --git a/install/block b/install/block
new file mode 100644
index 0000000..1f18bfa
--- /dev/null
+++ b/install/block
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+build() {
+ local filter
+ local -A blockdevs
+
+ # pata, sata, scsi
+ for filter in 'scsi/.*ata' '/(block|scsi|fusion)/' 'ata/[ps]ata_' \
+ 'ata/(ahci|pdc_adma|ata_piix|ata_generic)'; do
+ add_checked_modules "$filter" && blockdevs['sd_mod']=1
+ done
+
+ # usb
+ if add_checked_modules -f '(_cs|sl811_hcd|isp116x_hcd)' '/usb/host'; then
+ blockdevs+=(['usb_storage?']=1 ['sd_mod?']=1 ['sr_mod?']=1)
+ add_checked_modules 'drivers/usb/storage/ums-*'
+ fi
+
+ # firewire
+ if add_checked_modules '/drivers/firewire/'; then
+ blockdevs+=(['firewire-sbp2?']=1 ['sd_mod?']=1 ['sr_mod?']=1)
+ fi
+
+ # mmc
+ if add_checked_modules '/mmc'; then
+ blockdevs+=(['tifm_7xx1?']=1 ['mmc_block?']=1)
+ fi
+
+ # virtio
+ if add_checked_modules 'virtio'; then
+ blockdevs['virtio_blk?']=1
+ fi
+
+ map add_module "${!blockdevs[@]}"
+}
+
+help() {
+ cat <<HELPEOF
+This hook loads the necessary modules for most block devices using pata, sata,
+scsi, firewire, usb, or mmc. Detection will take place at runtime. To minimize
+the modules in the image, add the autodetect hook too.
+HELPEOF
+}
+
+# vim: set ft=sh ts=4 sw=4 et: