mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-08-28 16:31:14 +00:00
Optimization for booting OpenWrt
This commit is contained in:
@@ -27,6 +27,59 @@ vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
|
||||
check_insmod() {
|
||||
if [ -f "$1" ]; then
|
||||
vtlog "insmod $1"
|
||||
insmod "$1" >> $VTOY_PATH/log 2>&1
|
||||
else
|
||||
vtlog "$1 not exist"
|
||||
fi
|
||||
}
|
||||
|
||||
wrt_insmod() {
|
||||
kbit=$1
|
||||
kv=$(uname -r)
|
||||
|
||||
vtlog "insmod $kv $kbit"
|
||||
|
||||
check_insmod /ventoy_openwrt/$kv/$kbit/dax.ko
|
||||
check_insmod /ventoy_openwrt/$kv/$kbit/dm-mod.ko
|
||||
}
|
||||
|
||||
insmod_dm_mod() {
|
||||
if grep -q "device-mapper" /proc/devices; then
|
||||
vtlog "device-mapper enabled by system 0"
|
||||
return
|
||||
fi
|
||||
|
||||
check_insmod /ventoy/modules/dax.ko
|
||||
check_insmod /ventoy/modules/dm-mod.ko
|
||||
|
||||
if grep -q "device-mapper" /proc/devices; then
|
||||
vtlog "device-mapper enabled by system 1"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -f /ventoy_openwrt.xz ]; then
|
||||
tar xf /ventoy_openwrt.xz -C /
|
||||
rm -f /ventoy_openwrt.xz
|
||||
fi
|
||||
|
||||
if uname -m | egrep -q "amd64|x86_64"; then
|
||||
wrt_insmod 64
|
||||
else
|
||||
wrt_insmod generic
|
||||
if lsmod | grep -q 'dm-mod'; then
|
||||
vterr "insmod generic failed"
|
||||
else
|
||||
wrt_insmod legacy
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
insmod_dm_mod
|
||||
|
||||
for i in $(ls /sys/class/block/); do
|
||||
if ! [ -e /dev/$i ]; then
|
||||
blkdev_num=$(sed 's/:/ /g' /sys/class/block/$i/dev)
|
||||
|
Reference in New Issue
Block a user