refactor install_all_drivers
This commit is contained in:
parent
b0ae8ec446
commit
56b2550e48
38
generate
38
generate
@ -227,6 +227,9 @@ install_luks() {
|
||||
# install drivers and deps
|
||||
install_drivers() {
|
||||
printf "%s\n" "$@" | while read -r driver; do
|
||||
# strip path and extension
|
||||
driver="${driver##*/}"
|
||||
driver="${driver%%.*}"
|
||||
for driver_dep in $(modprobe -D "$driver" 2> /dev/null | grep -v builtin | cut -d " " -f 2); do
|
||||
install -Dm644 "$driver_dep" "${tmpdir}${driver_dep}"
|
||||
done
|
||||
@ -242,7 +245,7 @@ install_hostonly_drivers() {
|
||||
[ -n "$root_type" ] || msg panic "hostonly mode required root_type option to be configured"
|
||||
|
||||
# perform autodetection of drivers via /sys
|
||||
install_drivers $(find /sys/devices -name modalias -exec sort -u "{}" "+")
|
||||
install_drivers $(find /sys -name modalias -exec sort -u "{}" "+")
|
||||
|
||||
# TODO autodetect root fs driver
|
||||
# TODO separate root type option
|
||||
@ -255,24 +258,28 @@ install_hostonly_drivers() {
|
||||
|
||||
# find and install all drivers
|
||||
install_all_drivers() {
|
||||
# TODO use install_drivers function instead of cpio
|
||||
msg info "installing all drivers"
|
||||
find \
|
||||
"${modker}/kernel/arch" \
|
||||
"${modker}/kernel/crypto" \
|
||||
"${modker}/kernel/fs" \
|
||||
"${modker}/kernel/lib" \
|
||||
"${modker}/kernel/drivers/block" \
|
||||
"${modker}/kernel/drivers/ata" \
|
||||
"${modker}/kernel/drivers/md" \
|
||||
"${modker}/kernel/drivers/scsi" \
|
||||
"${modker}/kernel/drivers/usb/storage" \
|
||||
"${modker}/kernel/drivers/usb/host" \
|
||||
"${modker}/kernel/drivers/virtio" \
|
||||
-type f | cpio -pd "$tmpdir" > /dev/null 2>&1
|
||||
modker="${moddir}/${kernel}/kernel"
|
||||
|
||||
install_drivers \
|
||||
$(find \
|
||||
"${modker}/arch" \
|
||||
"${modker}/crypto" \
|
||||
"${modker}/fs" \
|
||||
"${modker}/lib" \
|
||||
"${modker}/drivers/block" \
|
||||
"${modker}/drivers/ata" \
|
||||
"${modker}/drivers/md" \
|
||||
"${modker}/drivers/scsi" \
|
||||
"${modker}/drivers/usb/storage" \
|
||||
"${modker}/drivers/usb/host" \
|
||||
"${modker}/drivers/virtio" \
|
||||
-type f 2> /dev/null)
|
||||
|
||||
# TODO implement monolithic kernel support
|
||||
[ -e "${tmpdir}/lib/modules" ] || msg panic "failed to install drivers"
|
||||
|
||||
modker="${moddir}/${kernel}"
|
||||
}
|
||||
|
||||
# generate "modules" files
|
||||
@ -415,7 +422,6 @@ check_currentdir
|
||||
tmpdir="$(create_tmpdir)" || msg panic "failed to create working directory"
|
||||
kernel="${kernel:-$(uname -r)}"
|
||||
moddir="/lib/modules"
|
||||
modker="${moddir}/${kernel}"
|
||||
|
||||
check_requirements
|
||||
create_structure
|
||||
|
Loading…
Reference in New Issue
Block a user