hostonly mode support
This commit is contained in:
parent
716aef47ee
commit
340cf9ff52
3
config
3
config
@ -20,6 +20,9 @@ root="UUID=07729c48-25d8-4096-acaf-ce5322915680"
|
||||
# device manager ( mdev,mdevd,udev )
|
||||
devmgr="mdev"
|
||||
|
||||
# hostonly mode
|
||||
#hostonly=1
|
||||
|
||||
# drivers
|
||||
#drivers=""
|
||||
|
||||
|
40
generate
40
generate
@ -123,19 +123,27 @@ install_luks() {
|
||||
# install drivers
|
||||
install_drivers() {
|
||||
modker="${moddir}${kernel}"
|
||||
find \
|
||||
"${modker}/kernel/drivers/virtio" \
|
||||
"${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" \
|
||||
-type f | cpio -pd "$tmpdir" >/dev/null 2>&1
|
||||
if [ "$hostonly" = 1 ]; then
|
||||
for modalias in $(find /sys/devices -name modalias -exec sort -u "{}" "+"); do
|
||||
for driver in $(modprobe -D $modalias 2>/dev/null | cut -d " " -f 2); do
|
||||
install -Dm644 "$driver" "${tmpdir}${driver}"
|
||||
done
|
||||
done
|
||||
else
|
||||
find \
|
||||
"${modker}/kernel/drivers/virtio" \
|
||||
"${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" \
|
||||
-type f | cpio -pd "$tmpdir" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# install list of drivers
|
||||
cp "${modker}/modules.softdep" "${modker}/modules.builtin" "${modker}/modules.order" "${tmpdir}/${modker}"
|
||||
@ -249,6 +257,9 @@ create_initramfs() {
|
||||
# check root
|
||||
[ "$(id -u)" = 0 ] || panic "must be run as root"
|
||||
|
||||
# remove tmpdir on exit or unexpected error
|
||||
trap remove_tmpdir EXIT INT
|
||||
|
||||
check_currentdir
|
||||
|
||||
# source config
|
||||
@ -262,9 +273,6 @@ check_currentdir
|
||||
trap : EXIT INT
|
||||
}
|
||||
|
||||
# remove tmpdir on exit or unexpected error
|
||||
trap remove_tmpdir EXIT INT
|
||||
|
||||
# variables
|
||||
tmpdir="$(mktemp -d /tmp/initramfs.XXXXXXXX)" || panic "failed to create working directory"
|
||||
kernel="$(uname -r)"
|
||||
|
Loading…
Reference in New Issue
Block a user