From fa18801b1c925042e3193ab2ab1b6bdcc1ad1138 Mon Sep 17 00:00:00 2001 From: illiliti Date: Sun, 8 Mar 2020 21:37:19 +0300 Subject: [PATCH] better monolithic kernel support --- config | 3 +++ tinyramfs | 32 +++++++++++++-------------- usr/share/man/man5/tinyramfs.config.5 | 7 ++++++ 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/config b/config index d8b585f..2b92ecb 100644 --- a/config +++ b/config @@ -14,6 +14,9 @@ # initramfs name #initramfs="" +# monolithic kernel +#monolith="" + # drivers directory #moddir="" diff --git a/tinyramfs b/tinyramfs index b52f34f..a9582d0 100755 --- a/tinyramfs +++ b/tinyramfs @@ -23,7 +23,7 @@ msg() { usage() { cat << EOF -usage: $0 [options] +usage: $0 [option...] -o, --output set initramfs image name -c, --config set config file path -m, --moddir set drivers directory @@ -199,11 +199,6 @@ install_lvm() { install_binary lvm - [ "$hostonly" = 1 ] && - for _driver in dm-thin-pool dm-multipath dm-snapshot dm-cache dm-log dm-mirror; do - install_driver "$_driver" - done - # install lvm config if [ "$lvm_config" = 1 ]; then mkdir -p "${workdir}/etc/lvm" @@ -231,11 +226,6 @@ install_luks() { install_binary cryptsetup - [ "$hostonly" = 1 ] && - for _driver in aes dm-crypt sha256 sha512 wp512 ecb lrw xts twofish serpent; do - install_driver "$_driver" - done - # avoid libgcc_s.so.1 missing error # see https://bugs.archlinux.org/task/56771 [ -e /usr/lib/libgcc_s.so.1 ] && @@ -467,20 +457,30 @@ create_symlinks [ "$lvm" = 1 ] && install_lvm [ "$luks" = 1 ] && install_luks -# check if moddir exists -if [ -d "$moddir" ]; then +# check monotihic kernel +[ "$monolith" != 1 ] && [ -d "$moddir" ] && { # check hostonly mode if [ "$hostonly" = 1 ]; then install_hostonly_drivers + + # install lvm drivers + [ "$lvm" = 1 ] && + for _driver in dm-thin-pool dm-multipath dm-snapshot dm-cache dm-log dm-mirror; do + install_driver "$_driver" + done + + # install luks drivers + [ "$luks" = 1 ] && + for _driver in aes dm-crypt sha256 sha512 wp512 ecb lrw xts twofish serpent; do + install_driver "$_driver" + done else install_all_drivers fi generate_depmod -else - msg warn "looks like you have monolithic kernel" -fi +} install_devmgr install_files diff --git a/usr/share/man/man5/tinyramfs.config.5 b/usr/share/man/man5/tinyramfs.config.5 index 9276818..0487c17 100644 --- a/usr/share/man/man5/tinyramfs.config.5 +++ b/usr/share/man/man5/tinyramfs.config.5 @@ -26,6 +26,13 @@ Specify init program Specify initramfs output name .TP +.TP +.BR \fBmonolith=\fR"\&\fI {0|1} \fR\&" +Enable monolithic kernel support + +This option required if you using monolithic kernel (builtin drivers) +.TP + .TP .BR \fBmoddir=\fR"\&\fI /path/to/dir \fR\&" Specify directory of drivers