summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--install/block45
l---------[-rw-r--r--]install/fw22
l---------[-rw-r--r--]install/mmc19
l---------[-rw-r--r--]install/pata22
l---------[-rw-r--r--]install/sata23
l---------[-rw-r--r--]install/scsi22
l---------[-rw-r--r--]install/usb21
l---------[-rw-r--r--]install/virtio16
-rw-r--r--mkinitcpio.conf14
9 files changed, 57 insertions, 147 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:
diff --git a/install/fw b/install/fw
index 98c05ab..ad926c8 100644..120000
--- a/install/fw
+++ b/install/fw
@@ -1,21 +1 @@
-#!/bin/bash
-
-build() {
- local mod
-
- if add_checked_modules '/drivers/firewire/'; then
- for mod in firewire-sbp2 sd_mod sr_mod; do
- add_module "$mod?"
- done
- fi
-}
-
-help() {
- cat <<HELPEOF
-This hook loads the necessary modules for a firewire root device. 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:
+block \ No newline at end of file
diff --git a/install/mmc b/install/mmc
index 60068df..ad926c8 100644..120000
--- a/install/mmc
+++ b/install/mmc
@@ -1,18 +1 @@
-#!/bin/bash
-
-build() {
- if add_checked_modules '/mmc'; then
- add_module 'tifm_7xx1'
- add_module 'mmc_block'
- fi
-}
-
-help() {
- cat <<HELPEOF
-This hook loads the necessary modules for a mmc root device. 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:
+block \ No newline at end of file
diff --git a/install/pata b/install/pata
index bcf3809..ad926c8 100644..120000
--- a/install/pata
+++ b/install/pata
@@ -1,21 +1 @@
-#!/bin/bash
-
-build() {
- local filter added
-
- for filter in 'ata/pata_*' 'ata/ata_generic' 'ata/ata_piix'; do
- add_checked_modules "$filter" && (( ++added ))
- done
-
- (( added )) && add_module "sd_mod?"
-}
-
-help() {
- cat <<HELPEOF
-This hook loads the necessary modules for a pata (ide) root device, using the
-new libata subsystem. 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:
+block \ No newline at end of file
diff --git a/install/sata b/install/sata
index c6a2ade..ad926c8 100644..120000
--- a/install/sata
+++ b/install/sata
@@ -1,22 +1 @@
-#!/bin/bash
-
-build() {
- local filter added
-
- for filter in 'scsi/.*ata' 'block/sx8' 'ata/sata_*' \
- 'ata/ahci' 'ata/pdc_adma' 'ata/ata_piix'; do
- add_checked_modules "$filter" && (( ++added ))
- done
-
- (( added )) && add_module "sd_mod?"
-}
-
-help() {
- cat <<HELPEOF
-This hook loads the necessary modules for an sata root device. 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:
+block \ No newline at end of file
diff --git a/install/scsi b/install/scsi
index 7c5a771..ad926c8 100644..120000
--- a/install/scsi
+++ b/install/scsi
@@ -1,21 +1 @@
-#!/bin/bash
-
-build(){
- local filter added
-
- add_checked_modules -f '(imm|ata|pcmcia)' '/scsi/' && (( ++added ))
- add_checked_modules -f '(cciss|cpqarray|DAC960)' '/block/' && (( ++added ))
- add_checked_modules '/fusion/' && (( ++added ))
-
- (( added )) && add_module 'sd_mod?'
-}
-
-help() {
- cat <<HELPEOF
-This hook loads the necessary modules for an scsi root device. 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:
+block \ No newline at end of file
diff --git a/install/usb b/install/usb
index 2b36c35..ad926c8 100644..120000
--- a/install/usb
+++ b/install/usb
@@ -1,20 +1 @@
-#!/bin/bash
-
-build() {
- if add_checked_modules -f '(_cs|sl811_hcd|isp116x_hcd)' '/usb/host'; then
- add_module 'usb_storage?'
- add_module 'sd_mod?'
- add_module 'sr_mod?'
- add_checked_modules 'drivers/usb/storage/ums-*'
- fi
-}
-
-help() {
- cat <<HELPEOF
-This hook loads the necessary modules for an usb root device. 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:
+block \ No newline at end of file
diff --git a/install/virtio b/install/virtio
index 10037ab..ad926c8 100644..120000
--- a/install/virtio
+++ b/install/virtio
@@ -1,15 +1 @@
-#!/bin/bash
-
-build() {
- add_checked_modules 'virtio_(blk|pci)'
-}
-
-help() {
- cat <<HELPEOF
-This hook loads the necessary modules for a virtio root device. 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:
+block \ No newline at end of file
diff --git a/mkinitcpio.conf b/mkinitcpio.conf
index 229fa05..c4380af 100644
--- a/mkinitcpio.conf
+++ b/mkinitcpio.conf
@@ -37,26 +37,22 @@ FILES=""
#
## This setup will autodetect all modules for your system and should
## work as a sane default
-# HOOKS="base udev autodetect pata scsi sata filesystems"
-#
-## This is identical to the above, except the old ide subsystem is
-## used for IDE devices instead of the new pata subsystem.
-# HOOKS="base udev autodetect ide scsi sata filesystems"
+# HOOKS="base udev autodetect block filesystems"
#
## This setup will generate a 'full' image which supports most systems.
## No autodetection is done.
-# HOOKS="base udev pata scsi sata usb filesystems"
+# HOOKS="base udev block filesystems"
#
## This setup assembles a pata mdadm array with an encrypted root FS.
## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
-# HOOKS="base udev pata mdadm encrypt filesystems"
+# HOOKS="base udev block mdadm encrypt filesystems"
#
## This setup loads an lvm2 volume group on a usb device.
-# HOOKS="base udev usb lvm2 filesystems"
+# HOOKS="base udev block lvm2 filesystems"
#
## NOTE: If you have /usr on a separate partition, you MUST include the
# usr, fsck and shutdown hooks.
-HOOKS="base udev autodetect pata scsi sata filesystems usbinput fsck"
+HOOKS="base udev autodetect block filesystems usbinput fsck"
# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression