Optimization for booting openwrt

This commit is contained in:
longpanda 2021-06-28 15:15:39 +08:00
parent 092cff8429
commit 37ac3f312f
1 changed files with 24 additions and 7 deletions

View File

@ -27,6 +27,15 @@ vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
check_mkdev_node() {
for i in $(ls /sys/class/block/); do
if ! [ -e /dev/$i ]; then
blkdev_num=$(sed 's/:/ /g' /sys/class/block/$i/dev)
vtlog "mknod -m 0666 /dev/$i b $blkdev_num"
mknod -m 0666 /dev/$i b $blkdev_num
fi
done
}
check_insmod() {
if [ -f "$1" ]; then
@ -80,15 +89,21 @@ insmod_dm_mod() {
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)
vtlog "mknod -m 0666 /dev/$i b $blkdev_num"
mknod -m 0666 /dev/$i b $blkdev_num
fi
check_mkdev_node
sleep 1
while [ -n "Y" ]; do
vtusb_disk=$(get_ventoy_disk_name)
if check_usb_disk_ready "$vtusb_disk"; then
vtlog "get_ventoy_disk_name $vtusb_disk ready"
break;
else
vtlog "get_ventoy_disk_name $vtusb_disk not ready"
sleep 2
check_mkdev_node
fi
done
wait_for_usb_disk_ready
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
@ -105,6 +120,8 @@ echo -n $vtDM > /ventoy/vtDM
ventoy_create_dev_ventoy_part
mdev -s
check_mkdev_node
mkdir /ventoy_rdroot
mount /dev/ventoy2 /ventoy_rdroot