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