Skip to content

Commit

Permalink
install/block: avoid conditional addition of drivers
Browse files Browse the repository at this point in the history
Avoid over-optimizing autodetect and always add these. This allows
storage drivers to be builtins and still trigger addition of the block
node driver.
  • Loading branch information
falconindy committed Oct 9, 2018
1 parent cfcc53c commit a3cb799
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions install/block
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,27 @@

build() {
local filter
local -A blockdevs

map add_module sd_mod? sr_mod? usb_storage? mmc_block? firewire-sbp2? virtio_blk?

# pata, sata, scsi, nvme
for filter in 'scsi/.*ata' '/(block|scsi|fusion|nvme)/' 'ata/[ps]ata_' \
'ata/(ahci|pdc_adma|ata_piix|ata_generic)'; do
add_checked_modules "$filter" && blockdevs['sd_mod']=1
add_checked_modules "$filter"
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/'
fi
add_checked_modules -f '(_cs|sl811_hcd|isp116x_hcd)' '/usb/host'
add_checked_modules '/drivers/usb/storage/'

# firewire
if add_checked_modules '/drivers/firewire/'; then
blockdevs+=(['firewire-sbp2?']=1 ['sd_mod?']=1 ['sr_mod?']=1)
fi
add_checked_modules '/drivers/firewire/'

# mmc
if add_checked_modules '/(mmc|tifm_)'; then
blockdevs+=(['mmc_block?']=1)
fi
add_checked_modules '/(mmc|tifm_)'

# virtio
if add_checked_modules 'virtio'; then
blockdevs['virtio_blk?']=1
fi

map add_module "${!blockdevs[@]}"
add_checked_modules 'virtio'
}

help() {
Expand Down

0 comments on commit a3cb799

Please sign in to comment.