Optimization for booting TinyCore series distros

This commit is contained in:
longpanda 2021-02-05 01:14:22 +08:00
parent 3545dfa29f
commit 6ded335527
3 changed files with 40 additions and 10 deletions

View File

@ -19,22 +19,43 @@
. /ventoy/hook/ventoy-hook-lib.sh
if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
if is_ventoy_hook_finished; then
exit 0
fi
vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
wait_for_usb_disk_ready
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
vtlog "ventoy disk not found"
PATH=$VTPATH_OLD
exit 0
fi
if echo $vtdiskname | egrep -q "nvme.*p[0-9]$|mmc.*p[0-9]$"; then
vPart="${vtdiskname}p2"
else
vPart="${vtdiskname}2"
fi
# TinyCore linux distro doesn't contain dmsetup, we use aoe here
sudo $BUSYBOX_PATH/modprobe aoe aoe_iflist=lo
sudo modprobe aoe aoe_iflist=lo
if [ -e /sys/module/aoe ]; then
VBLADE_BIN=$(ventoy_get_vblade_bin)
sudo $VBLADE_BIN -r -f $VTOY_PATH/ventoy_image_map 9 0 lo "/dev/${1:0:-1}" &
sudo nohup $VBLADE_BIN -r -f $VTOY_PATH/ventoy_image_map 9 0 lo "$vtdiskname" > /dev/null &
sleep 2
while ! [ -b /dev/etherd/e9.0 ]; do
vtlog 'Wait for /dev/etherd/e9.0 ....'
$SLEEP 0.1
sleep 2
done
sudo $BUSYBOX_PATH/cp -a /dev/etherd/e9.0 "/dev/$1"
sudo cp -a /dev/etherd/e9.0 "$vPart"
ventoy_find_bin_run rebuildfstab
else
@ -42,4 +63,6 @@ else
fi
# OK finish
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@ -19,6 +19,5 @@
. $VTOY_PATH/hook/ventoy-os-lib.sh
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule_with_name "$VTOY_PATH/hook/tinycore/udev_disk_hook.sh %k" "90-ventoy.rules"
$SED "/\[.*-n.*WAITUSB/i\WAITUSB=10" -i /etc/init.d/tc-config
$SED "/\[.*-n.*AOE/i\$VTOY_PATH/hook/tinycore/ventoy-disk.sh" -i /etc/init.d/tc-config

View File

@ -668,6 +668,14 @@ function uefi_unix_menu_func {
fi
}
function ventoy_reset_nojoliet {
if vt_str_begin "$vt_volume_id" "ARCARESCUE"; then
vt_iso9660_nojoliet 1
else
vt_iso9660_nojoliet 0
fi
}
function uefi_iso_menu_func {
if [ -d (loop)/ ]; then
@ -691,7 +699,7 @@ function uefi_iso_menu_func {
set ventoy_fs_probe=udf
else
set ventoy_fs_probe=iso9660
vt_iso9660_nojoliet 0
ventoy_reset_nojoliet
fi
loopback loop "${1}${chosen_path}"
@ -880,7 +888,7 @@ function legacy_iso_menu_func {
set ventoy_fs_probe=udf
else
set ventoy_fs_probe=iso9660
vt_iso9660_nojoliet 0
ventoy_reset_nojoliet
fi
loopback loop "${1}${chosen_path}"