initial commit

This commit is contained in:
longpanda
2020-04-05 00:07:50 +08:00
parent 2090c6fa97
commit 05a1b863a6
487 changed files with 114253 additions and 0 deletions

Binary file not shown.

BIN
INSTALL/Ventoy2Disk.exe Normal file

Binary file not shown.

234
INSTALL/Ventoy2Disk.sh Normal file
View File

@@ -0,0 +1,234 @@
#!/bin/sh
. ./tool/ventoy_lib.sh
print_usage() {
echo 'Usage: VentoyInstaller.sh OPTION /dev/sdX'
echo ' OPTION:'
echo ' -i install ventoy to sdX (fail if disk already installed with ventoy)'
echo ' -u update ventoy in sdX'
echo ' -I force install ventoy to sdX (no matter installed or not)'
echo ''
}
echo ''
echo '***********************************************************'
echo '* Ventoy2Disk Script *'
echo '* longpanda admin@ventoy.net *'
echo '***********************************************************'
echo ''
vtdebug "############# Ventoy2Disk ################"
if ! [ -e ventoy/version ]; then
vterr "Please run under the correct directory!"
exit 1
fi
if [ "$1" = "-i" ]; then
MODE="install"
elif [ "$1" = "-I" ]; then
MODE="install"
FORCE="Y"
elif [ "$1" = "-u" ]; then
MODE="update"
else
print_usage
exit 1
fi
if ! [ -b "$2" ]; then
print_usage
exit 1
fi
if [ -z "$SUDO_USER" ]; then
if [ "$USER" != "root" ]; then
vterr "EUID is $EUID root permission is required."
echo ''
exit 1
fi
fi
vtdebug "MODE=$MODE FORCE=$FORCE"
#decompress tool
cd tool
chmod +x ./xzcat
for file in $(ls); do
if [ "$file" != "xzcat" ]; then
if [ "$file" != "ventoy_lib.sh" ]; then
./xzcat $file > ${file%.xz}
chmod +x ${file%.xz}
fi
fi
done
cd ../
if ! check_tool_work_ok; then
vterr "Some tools can not run in current system. Please check log.txt for detail."
exit 1
fi
DISK=$2
if ! [ -b "$DISK" ]; then
vterr "Disk $DISK does not exist"
exit 1
fi
if [ -e /sys/class/block/${DISK#/dev/}/start ]; then
vterr "$DISK is a partition, please use the whole disk"
exit 1
fi
if grep "$DISK" /proc/mounts; then
vterr "$DISK is already mounted, please umount it first!"
exit 1
fi
if [ "$MODE" = "install" ]; then
vtdebug "install ventoy ..."
if ! fdisk -v >/dev/null 2>&1; then
vterr "fdisk is needed by ventoy installation, but is not found in the system."
exit 1
fi
version=$(get_disk_ventoy_version $DISK)
if [ $? -eq 0 ]; then
if [ -z "$FORCE" ]; then
vtwarn "$DISK already contains a Ventoy with version $version"
vtwarn "Use -u option to do a safe upgrade operation."
vtwarn "OR if you really want to reinstall ventoy to $DISK, please use -I option."
vtwarn ""
exit 1
fi
fi
disk_sector_num=$(cat /sys/block/${DISK#/dev/}/size)
disk_size_gb=$(expr $disk_sector_num / 2097152)
if [ $disk_sector_num -gt 4294967296 ]; then
vterr "$DISK is over 2TB size, MBR will not work on it."
exit 1
fi
#Print disk info
echo "Disk : $DISK"
parted $DISK p 2>&1 | grep Model
echo "Size : $disk_size_gb GB"
echo ''
vtwarn "Attention:"
vtwarn "You will install Ventoy to $DISK."
vtwarn "All the data on the disk $DISK will be lost!!!"
echo ""
read -p 'Continue? (y/n)' Answer
if [ "$Answer" != "y" ]; then
if [ "$Answer" != "Y" ]; then
exit 0
fi
fi
echo ""
vtwarn "All the data on the disk $DISK will be lost!!!"
read -p 'Double-check. Continue? (y/n)' Answer
if [ "$Answer" != "y" ]; then
if [ "$Answer" != "Y" ]; then
exit 0
fi
fi
if [ $disk_sector_num -le $VENTOY_SECTOR_NUM ]; then
vterr "No enough space in disk $DISK"
exit 1
fi
if ! dd if=/dev/zero of=$DISK bs=1 count=512 status=none; then
vterr "Write data to $DISK failed, please check whether it's in use."
exit 1
fi
format_ventoy_disk $DISK
# format part1
if ventoy_is_linux64; then
cmd=./tool/mkexfatfs_64
else
cmd=./tool/mkexfatfs_32
fi
chmod +x ./tool/*
# DiskSize > 32GB Cluster Size use 128KB
# DiskSize < 32GB Cluster Size use 32KB
if [ $disk_size_gb -gt 32 ]; then
cluster_sectors=256
else
cluster_sectors=64
fi
$cmd -n ventoy -s $cluster_sectors ${DISK}1
dd status=none if=./boot/boot.img of=$DISK bs=1 count=446
./tool/xzcat ./boot/core.img.xz | dd status=none of=$DISK bs=512 count=2047 seek=1
./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start_sector
chmod +x ./tool/vtoy_gen_uuid
./tool/vtoy_gen_uuid | dd status=none of=${DISK} seek=384 bs=1 count=16
sync
echo ""
vtinfo "Install Ventoy to $DISK successfully finished."
echo ""
else
vtdebug "update ventoy ..."
oldver=$(get_disk_ventoy_version $DISK)
if [ $? -ne 0 ]; then
vtwarn "$DISK does not contain ventoy or data corupted"
echo ""
vtwarn "Please use -i option if you want to install ventoy to $DISK"
echo ""
exit 1
fi
curver=$(cat ./ventoy/version)
vtinfo "Upgrade operation is safe, all the data in the 1st partition (iso files and other) will be unchanged!"
echo ""
read -p "Update Ventoy $oldver ===> $curver Continue? (y/n)" Answer
if [ "$Answer" != "y" ]; then
if [ "$Answer" != "Y" ]; then
exit 0
fi
fi
PART2=$(get_disk_part_name $DISK 2)
dd status=none if=./boot/boot.img of=$DISK bs=1 count=446
./tool/xzcat ./boot/core.img.xz | dd status=none of=$DISK bs=512 count=2047 seek=1
disk_sector_num=$(cat /sys/block/${DISK#/dev/}/size)
part2_start=$(expr $disk_sector_num - $VENTOY_SECTOR_NUM)
./tool/xzcat ./ventoy/ventoy.disk.img.xz | dd status=none of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start
sync
echo ""
vtinfo "Update Ventoy to $DISK successfully finished."
echo ""
fi

Binary file not shown.

359
INSTALL/grub/grub.cfg Normal file
View File

@@ -0,0 +1,359 @@
#************************************************************************************
# Copyright (c) 2020, longpanda <admin@ventoy.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#************************************************************************************
function get_os_type {
set vtoy_os=Linux
for file in "efi/microsoft" "sources/boot.wim" "boot/bcd" "bootmgr.efi" "boot/etfsboot.com"; do
if [ -e $1/$file ]; then
set vtoy_os=Windows
break
fi
done
if [ -n "${vtdebug_flag}" ]; then
echo ISO is $vtoy_os
fi
}
function locate_initrd {
vt_linux_locate_initrd
if [ -n "${vtdebug_flag}" ]; then
vt_linux_dump_initrd
sleep 5
fi
}
function find_wim_file {
unset ventoy_wim_file
for file in "sources/boot.wim" "sources/BOOT.WIM" "Sources/Win10PEx64.WIM" "boot/BOOT.WIM" "winpe_x64.wim"; do
if [ -e $1/$file ]; then
set ventoy_wim_file=$1/$file
break
fi
done
}
function distro_specify_initrd_file {
if [ -e (loop)/boot/all.rdz ]; then
vt_linux_specify_initrd_file /boot/all.rdz
elif [ -e (loop)/boot/xen.gz ]; then
if [ -e (loop)/install.img ]; then
vt_linux_specify_initrd_file /install.img
fi
elif [ -d (loop)/casper ]; then
if [ -e (loop)/casper/initrd ]; then
vt_linux_specify_initrd_file /casper/initrd
fi
if [ -e (loop)/casper/initrd-oem ]; then
vt_linux_specify_initrd_file /casper/initrd-oem
fi
fi
}
function uefi_windows_menu_func {
vt_windows_reset
if [ "$ventoy_compatible" = "NO" ]; then
find_wim_file (loop)
if [ -n "$ventoy_wim_file" ]; then
vt_windows_locate_wim $ventoy_wim_file
fi
fi
vt_windows_chain_data ${1}${chosen_path}
if [ -n "$vtoy_chain_mem_addr" ]; then
terminal_output console
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
echo "chain empty failed"
sleep 5
fi
}
function uefi_linux_menu_func {
if [ "$ventoy_compatible" = "NO" ]; then
vt_load_cpio ${vtoy_path}/ventoy.cpio
vt_linux_clear_initrd
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf"; do
if [ -e (loop)/$file ]; then
vt_linux_parse_initrd_grub file (loop)/$file
fi
done
vt_linux_initrd_count initrd_count
# special process for special distros
if vt_cmp $initrd_count eq 0; then
if [ -d (loop)/loader/entries ]; then
set LoadIsoEfiDriver=on
vt_linux_parse_initrd_grub dir (loop)/loader/entries/
elif [ -d (loop)/boot/grub ]; then
vt_linux_parse_initrd_grub dir (loop)/boot/grub/
fi
fi
vt_linux_initrd_count initrd_count
if vt_cmp $initrd_count eq 0; then
distro_specify_initrd_file
fi
locate_initrd
fi
vt_linux_chain_data ${1}${chosen_path}
if [ -n "$vtoy_chain_mem_addr" ]; then
terminal_output console
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
echo "chain empty failed"
sleep 5
fi
}
function uefi_iso_menu_func {
if [ -d (loop)/ ]; then
loopback -d loop
fi
unset LoadIsoEfiDriver
vt_chosen_img_path chosen_path
if vt_is_udf ${1}${chosen_path}; then
set ventoy_fs_probe=udf
else
set ventoy_fs_probe=iso9660
fi
loopback loop ${1}${chosen_path}
get_os_type (loop)
vt_check_compatible (loop)
vt_img_sector ${1}${chosen_path}
if [ "$vtoy_os" = "Windows" ]; then
uefi_windows_menu_func $1
else
uefi_linux_menu_func $1
fi
terminal_output gfxterm
}
function legacy_windows_menu_func {
vt_windows_reset
if [ "$ventoy_compatible" = "NO" ]; then
find_wim_file (loop)
if [ -n "$ventoy_wim_file" ]; then
vt_windows_locate_wim $ventoy_wim_file
elif [ -n "${vtdebug_flag}" ]; then
echo No wim file found
fi
fi
vt_windows_chain_data ${1}${chosen_path}
if [ -n "${vtdebug_flag}" ]; then
sleep 5
fi
if [ -n "$vtoy_chain_mem_addr" ]; then
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} ibft
initrd16 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
echo "chain empty failed"
sleep 5
fi
}
function legacy_linux_menu_func {
if [ "$ventoy_compatible" = "NO" ]; then
vt_load_cpio $vtoy_path/ventoy.cpio
vt_linux_clear_initrd
for dir in "isolinux" "boot/isolinux" "boot/x86_64/loader" "syslinux" "boot/syslinux"; do
if [ -d (loop)/$dir ]; then
vt_linux_parse_initrd_isolinux (loop)/$dir/
fi
done
vt_linux_initrd_count initrd_count
# special process for special distros
if vt_cmp $initrd_count eq 0; then
#archlinux
if [ -d (loop)/arch/boot/syslinux ]; then
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/
vt_linux_parse_initrd_isolinux (loop)/arch/boot/syslinux/ /arch/boot/syslinux/
#manjaro
elif [ -d (loop)/manjaro ]; then
if [ -e (loop)/boot/grub/kernels.cfg ]; then
vt_linux_parse_initrd_grub file (loop)/boot/grub/kernels.cfg
fi
elif [ -e (loop)/boot/grub/grub.cfg ]; then
vt_linux_parse_initrd_grub file (loop)/boot/grub/grub.cfg
fi
fi
vt_linux_initrd_count initrd_count
if vt_cmp $initrd_count eq 0; then
distro_specify_initrd_file
fi
locate_initrd
fi
vt_linux_chain_data ${1}${chosen_path}
if [ -n "${vtdebug_flag}" ]; then
sleep 5
fi
if [ -n "$vtoy_chain_mem_addr" ]; then
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag}
initrd16 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
echo "chain empty failed"
sleep 5
fi
}
function legacy_iso_menu_func {
if [ -d (loop)/ ]; then
loopback -d loop
fi
vt_chosen_img_path chosen_path
if vt_is_udf ${1}${chosen_path}; then
set ventoy_fs_probe=udf
else
set ventoy_fs_probe=iso9660
fi
loopback loop ${1}${chosen_path}
get_os_type (loop)
vt_check_compatible (loop)
vt_img_sector ${1}${chosen_path}
if [ "$vtoy_os" = "Windows" ]; then
legacy_windows_menu_func $1
else
legacy_linux_menu_func $1
fi
}
#############################################################
#############################################################
#############################################################
####### Main Process ###########
#############################################################
#############################################################
#############################################################
set VENTOY_VERSION="1.0.00"
#disable timeout
unset timeout
vt_device $root vtoy_dev
if [ "$vtoy_dev" = "tftp" ]; then
set vtoy_path=($root)
for vtid in 0 1 2 3; do
if [ -d (hd$vtid,2)/grub ]; then
set iso_path=(hd$vtid,1)
break
fi
done
else
set vtoy_path=($root)/ventoy
set iso_path=($vtoy_dev,1)
fi
loadfont ascii
if [ -f $iso_path/ventoy/ventoy.json ]; then
vt_load_plugin $iso_path
fi
terminal_output gfxterm
if [ -n "$vtoy_theme" ]; then
set theme=$vtoy_theme
else
set theme=$prefix/themes/ventoy/theme.txt
fi
if [ -n "$vtoy_gfxmode" ]; then
set gfxmode=$vtoy_gfxmode
else
set gfxmode=1024x768
fi
#colect all image files (iso files)
set ventoy_img_count=0
vt_list_img $iso_path ventoy_img_count
#Dynamic menu for every iso file
if vt_cmp $ventoy_img_count ne 0; then
set imgid=0
while vt_cmp $imgid lt $ventoy_img_count; do
vt_img_name $imgid img_name
menuentry "$img_name" {
if [ "$grub_platform" = "pc" ]; then
legacy_iso_menu_func $iso_path
else
uefi_iso_menu_func $iso_path
fi
}
vt_incr imgid 1
done
else
menuentry "No ISO files found (Press enter to reboot ...)" {
echo -e "\n Rebooting ... "
reboot
}
fi

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

View File

@@ -0,0 +1,50 @@
desktop-image: "background.png"
title-text: " "
title-font: "ascii"
title-color: "#ffffff"
message-font: "ascii"
message-color: "#f2f2f2"
terminal-box: "terminal_box_*.png"
+ boot_menu {
left = 10%
width = 80%
top = 30%
height = 50%
menu_pixmap_style = "menu_*.png"
item_font = "ascii"
item_color = "#ffffff"
item_height = 30
item_icon_space = 1
item_spacing = 1
item_padding = 1
selected_item_font = "ascii"
selected_item_color= "#f2f2f2"
selected_item_pixmap_style = "select_*.png"
#icon_height = 30
#icon_width = 30
scrollbar = true
scrollbar_width = 10
scrollbar_thumb = "slider_*.png"
}
+ progress_bar {
id = "__timeout__"
text = "@TIMEOUT_NOTIFICATION_SHORT@"
left = 95%
width = 48
top = 95%
height = 48
text_color = "#f2f2f2"
bar_style = "*"
highlight_style = "*"
}

Binary file not shown.

BIN
INSTALL/tool/hexdump Normal file

Binary file not shown.

BIN
INSTALL/tool/mkexfatfs_32 Normal file

Binary file not shown.

BIN
INSTALL/tool/mkexfatfs_64 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

289
INSTALL/tool/ventoy_lib.sh Normal file
View File

@@ -0,0 +1,289 @@
#!/bin/sh
#Ventoy partition 32MB
VENTOY_PART_SIZE=33554432
VENTOY_SECTOR_SIZE=512
VENTOY_SECTOR_NUM=65536
ventoy_false() {
[ "1" = "2" ]
}
ventoy_true() {
[ "1" = "1" ]
}
ventoy_is_linux64() {
if [ -e /lib64 ]; then
ventoy_true
return
fi
if [ -e /usr/lib64 ]; then
ventoy_true
return
fi
if uname -a | egrep -q 'x86_64|amd64'; then
ventoy_true
return
fi
ventoy_false
}
ventoy_is_dash() {
if [ -L /bin/sh ]; then
vtdst=$(readlink /bin/sh)
if [ "$vtdst" = "dash" ]; then
ventoy_true
return
fi
fi
ventoy_false
}
vtinfo() {
if ventoy_is_dash; then
echo "\033[32m$*\033[0m"
else
echo -e "\033[32m$*\033[0m"
fi
}
vtwarn() {
if ventoy_is_dash; then
echo "\033[33m$*\033[0m"
else
echo -e "\033[33m$*\033[0m"
fi
}
vterr() {
if ventoy_is_dash; then
echo "\033[31m$*\033[0m"
else
echo -e "\033[31m$*\033[0m"
fi
}
vtdebug() {
echo "$*" >> ./log.txt
}
check_tool_work_ok() {
if ventoy_is_linux64; then
vtdebug "This is linux 64"
mkexfatfs=mkexfatfs_64
vtoyfat=vtoyfat_64
else
vtdebug "This is linux 32"
mkexfatfs=mkexfatfs_32
vtoyfat=vtoyfat_32
fi
if echo 1 | ./tool/hexdump > /dev/null; then
vtdebug "hexdump test ok ..."
else
vtdebug "hexdump test fail ..."
ventoy_false
return
fi
if ./tool/$mkexfatfs -V > /dev/null; then
vtdebug "$mkexfatfs test ok ..."
else
vtdebug "$mkexfatfs test fail ..."
ventoy_false
return
fi
if ./tool/$vtoyfat -T; then
vtdebug "$vtoyfat test ok ..."
else
vtdebug "$vtoyfat test fail ..."
ventoy_false
return
fi
vtdebug "tool check success ..."
ventoy_true
}
get_disk_part_name() {
DISK=$1
if echo $DISK | grep -q "/dev/loop"; then
echo ${DISK}p${2}
elif echo $DISK | grep -q "/dev/nvme[0-9][0-9]*n[0-9]"; then
echo ${DISK}p${2}
else
echo ${DISK}${2}
fi
}
get_ventoy_version_from_cfg() {
if grep -q 'set.*VENTOY_VERSION=' $1; then
grep 'set.*VENTOY_VERSION=' $1 | awk -F'"' '{print $2}'
else
echo 'none'
fi
}
is_disk_contains_ventoy() {
DISK=$1
PART1=$(get_disk_part_name $1 1)
PART2=$(get_disk_part_name $1 2)
if [ -e /sys/class/block/${PART2#/dev/}/size ]; then
SIZE=$(cat /sys/class/block/${PART2#/dev/}/size)
else
SIZE=0
fi
if ! [ -b $PART1 ]; then
vtdebug "$PART1 not exist"
ventoy_false
return
fi
if ! [ -b $PART2 ]; then
vtdebug "$PART2 not exist"
ventoy_false
return
fi
PART2_TYPE=$(dd if=$DISK bs=1 count=1 skip=466 status=none | ./tool/hexdump -n1 -e '1/1 "%02X"')
if [ "$PART2_TYPE" != "EF" ]; then
vtdebug "part2 type is $PART2_TYPE not EF"
ventoy_false
return
fi
PART1_TYPE=$(dd if=$DISK bs=1 count=1 skip=450 status=none | ./tool/hexdump -n1 -e '1/1 "%02X"')
if [ "$PART1_TYPE" != "07" ]; then
vtdebug "part1 type is $PART2_TYPE not 07"
ventoy_false
return
fi
if [ -e /sys/class/block/${PART1#/dev/}/start ]; then
PART1_START=$(cat /sys/class/block/${PART1#/dev/}/start)
fi
if [ "$PART1_START" != "2048" ]; then
vtdebug "part1 start is $PART1_START not 2048"
ventoy_false
return
fi
if [ "$VENTOY_SECTOR_NUM" != "$SIZE" ]; then
vtdebug "part2 size is $SIZE not $VENTOY_SECTOR_NUM"
ventoy_false
return
fi
ventoy_true
}
get_disk_ventoy_version() {
if ! is_disk_contains_ventoy $1; then
ventoy_false
return
fi
PART2=$(get_disk_part_name $1 2)
if ventoy_is_linux64; then
cmd=./tool/vtoyfat_64
else
cmd=./tool/vtoyfat_32
fi
ParseVer=$($cmd $PART2)
if [ $? -eq 0 ]; then
vtdebug "Ventoy version in $PART2 is $ParseVer"
echo $ParseVer
ventoy_true
return
fi
ventoy_false
}
format_ventoy_disk() {
DISK=$1
PART2=$(get_disk_part_name $DISK 2)
sector_num=$(cat /sys/block/${DISK#/dev/}/size)
part1_start_sector=2048
part1_end_sector=$(expr $sector_num - $VENTOY_SECTOR_NUM - 1)
export part2_start_sector=$(expr $part1_end_sector + 1)
part2_end_sector=$(expr $sector_num - 1)
if [ -e $PART2 ]; then
echo "delete $PART2"
rm -f $PART2
fi
echo ""
echo "Create partitions on $DISK ..."
fdisk $DISK >/dev/null 2>&1 <<EOF
o
n
p
1
$part1_start_sector
$part1_end_sector
n
p
2
$part2_start_sector
$part2_end_sector
t
1
7
t
2
ef
a
2
w
EOF
echo "Done"
udevadm trigger >/dev/null 2>&1
partprobe >/dev/null 2>&1
sleep 3
echo 'mkfs on disk partitions ...'
while ! [ -e $PART2 ]; do
echo "wait $PART2 ..."
sleep 1
done
echo "create efi fat fs ..."
for i in 0 1 2 3 4 5 6 7 8 9; do
if mkfs.vfat -F 16 -n EFI $PART2; then
echo 'success'
break
else
echo "$? retry ..."
sleep 2
fi
done
}

BIN
INSTALL/tool/vtoy_gen_uuid Normal file

Binary file not shown.

BIN
INSTALL/tool/vtoyfat_32 Normal file

Binary file not shown.

BIN
INSTALL/tool/vtoyfat_64 Normal file

Binary file not shown.

BIN
INSTALL/tool/xzcat Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
INSTALL/ventoy/ipxe.krn Normal file

Binary file not shown.

Binary file not shown.

BIN
INSTALL/ventoy/ventoy.cpio Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.