mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-08-28 00:11:15 +00:00
add support to freebsd
This commit is contained in:
@@ -89,6 +89,14 @@ function get_os_type {
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$vtoy_os" = "Linux" ]; then
|
||||
if vt_strstr "$vt_system_id" "FreeBSD"; then
|
||||
set vtoy_os=Unix
|
||||
elif [ -e (loop)/bin/freebsd-version ]; then
|
||||
set vtoy_os=Unix
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo ISO is $vtoy_os
|
||||
fi
|
||||
@@ -211,6 +219,70 @@ function distro_specify_initrd_file_phase2 {
|
||||
fi
|
||||
}
|
||||
|
||||
function ventoy_freebsd_proc {
|
||||
if regexp "^12_[0-9]" $vt_volume_id; then
|
||||
set vt_freebsd_ver=12.x
|
||||
elif regexp "^11_[0-9]" $vt_volume_id; then
|
||||
set vt_freebsd_ver=11.x
|
||||
elif regexp "^10_[0-9]" $vt_volume_id; then
|
||||
set vt_freebsd_ver=10.x
|
||||
elif [ -e (loop)/bin/freebsd-version ]; then
|
||||
vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver
|
||||
if regexp "\"12\.[0-9]-" $vt_userland_ver; then
|
||||
set vt_freebsd_ver=12.x
|
||||
elif regexp "\"11\.[0-9]-" $vt_userland_ver; then
|
||||
set vt_freebsd_ver=11.x
|
||||
elif regexp "\"10\.[0-9]-" $vt_userland_ver; then
|
||||
set vt_freebsd_ver=10.x
|
||||
fi
|
||||
else
|
||||
set vt_freebsd_ver=12.x
|
||||
fi
|
||||
|
||||
if file --is-i386-kfreebsd (loop)/boot/kernel/kernel; then
|
||||
set vt_freebsd_bit=32
|
||||
else
|
||||
set vt_freebsd_bit=64
|
||||
fi
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo "This is FreeBSD $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
fi
|
||||
|
||||
for file in "geom_nop" "ipmi"; do
|
||||
if [ -e (loop)/boot/kernel/${file}.ko ]; then
|
||||
set vt_unix_ko=$file
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
vt_unix_replace_ko $vt_unix_ko (vtunix)/ventoy_unix/FreeBSD/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
|
||||
vt_unix_replace_conf FreeBSD ${1}${chosen_path}
|
||||
}
|
||||
|
||||
function ventoy_unix_comm_proc {
|
||||
vt_unix_reset
|
||||
|
||||
if [ "$ventoy_compatible" = "NO" ]; then
|
||||
loopback vtunix $vtoy_efi_part/ventoy/ventoy_unix.cpio
|
||||
|
||||
set vt_unix_type=unknown
|
||||
if vt_strstr "$vt_system_id" "FreeBSD"; then
|
||||
ventoy_freebsd_proc $1 ${chosen_path}
|
||||
elif [ -e (loop)/bin/freebsd-version ]; then
|
||||
ventoy_freebsd_proc $1 ${chosen_path}
|
||||
else
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo "Unknown unix type"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
vt_unix_chain_data ${1}${chosen_path}
|
||||
ventoy_debug_pause
|
||||
}
|
||||
|
||||
|
||||
function uefi_windows_menu_func {
|
||||
vt_windows_reset
|
||||
|
||||
@@ -330,6 +402,18 @@ function uefi_linux_menu_func {
|
||||
fi
|
||||
}
|
||||
|
||||
function uefi_unix_menu_func {
|
||||
ventoy_unix_comm_proc $1 ${chosen_path}
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_cli_console
|
||||
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
else
|
||||
echo "chain empty failed"
|
||||
ventoy_pause
|
||||
fi
|
||||
}
|
||||
|
||||
function uefi_iso_menu_func {
|
||||
|
||||
@@ -358,6 +442,7 @@ function uefi_iso_menu_func {
|
||||
fi
|
||||
|
||||
loopback loop ${1}${chosen_path}
|
||||
vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
|
||||
get_os_type (loop)
|
||||
|
||||
if [ -d (loop)/EFI ]; then
|
||||
@@ -382,6 +467,8 @@ function uefi_iso_menu_func {
|
||||
if [ "$vtoy_os" = "Windows" ]; then
|
||||
vt_check_compatible_pe (loop)
|
||||
uefi_windows_menu_func $1 ${chosen_path}
|
||||
elif [ "$vtoy_os" = "Unix" ]; then
|
||||
uefi_unix_menu_func $1 ${chosen_path}
|
||||
else
|
||||
uefi_linux_menu_func $1 ${chosen_path}
|
||||
fi
|
||||
@@ -501,6 +588,20 @@ function legacy_linux_menu_func {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function legacy_unix_menu_func {
|
||||
ventoy_unix_comm_proc $1 ${chosen_path}
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
else
|
||||
echo "chain empty failed"
|
||||
ventoy_pause
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function legacy_iso_menu_func {
|
||||
|
||||
if [ -d (loop)/ ]; then
|
||||
@@ -519,6 +620,7 @@ function legacy_iso_menu_func {
|
||||
fi
|
||||
|
||||
loopback loop ${1}${chosen_path}
|
||||
vt_parse_iso_volume ${1}${chosen_path} vt_system_id vt_volume_id
|
||||
get_os_type (loop)
|
||||
|
||||
if [ -n "$vtcompat" ]; then
|
||||
@@ -535,6 +637,8 @@ function legacy_iso_menu_func {
|
||||
if [ "$vtoy_os" = "Windows" ]; then
|
||||
vt_check_compatible_pe (loop)
|
||||
legacy_windows_menu_func $1 ${chosen_path}
|
||||
elif [ "$vtoy_os" = "Unix" ]; then
|
||||
legacy_unix_menu_func $1 ${chosen_path}
|
||||
else
|
||||
legacy_linux_menu_func $1 ${chosen_path}
|
||||
fi
|
||||
@@ -550,6 +654,9 @@ function legacy_iso_memdisk {
|
||||
}
|
||||
|
||||
function iso_common_menuentry {
|
||||
unset vt_system_id
|
||||
unset vt_volume_id
|
||||
|
||||
if [ "$grub_platform" = "pc" ]; then
|
||||
if vt_check_mode 0; then
|
||||
legacy_iso_memdisk $vtoy_iso_part
|
||||
|
Reference in New Issue
Block a user