mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-09-16 09:01:15 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
433d854aab | ||
|
4cb9134e5c | ||
|
faceaf4267 | ||
|
37edd5a349 | ||
|
ed0f8721d7 | ||
|
d80a008c04 | ||
|
036e9cc167 | ||
|
26258653b7 |
@@ -1578,6 +1578,7 @@ module = {
|
||||
name = ventoy;
|
||||
common = ventoy/ventoy.c;
|
||||
common = ventoy/ventoy_linux.c;
|
||||
common = ventoy/ventoy_unix.c;
|
||||
common = ventoy/ventoy_windows.c;
|
||||
common = ventoy/ventoy_plugin.c;
|
||||
common = ventoy/ventoy_json.c;
|
||||
|
@@ -305,6 +305,18 @@ static grub_err_t ventoy_cmd_break(grub_extcmd_context_t ctxt, int argc, char **
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_strstr(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
(void)ctxt;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (grub_strstr(args[0], args[1])) ? 0 : 1;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_incr(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
long value_long = 0;
|
||||
@@ -1389,7 +1401,7 @@ static grub_err_t ventoy_cmd_chosen_img_path(grub_extcmd_context_t ctxt, int arg
|
||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||
}
|
||||
|
||||
static int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid)
|
||||
int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid)
|
||||
{
|
||||
grub_disk_t disk;
|
||||
char *device_name;
|
||||
@@ -1484,7 +1496,7 @@ int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (buf[i] == 0x91 && buf[i + 1] == 0x00 && x86count == 1)
|
||||
if ((buf[i] == 0x90 || buf[i] == 0x91) && buf[i + 1] == 0x00 && x86count == 1)
|
||||
{
|
||||
debug("0x9100 assume %s efi eltorito offset %d 0x%02x\n", file->name, i, buf[i]);
|
||||
return 1;
|
||||
@@ -2231,6 +2243,129 @@ static grub_err_t ventoy_cmd_find_bootable_hdd(grub_extcmd_context_t ctxt, int a
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_read_1st_line(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len = 1024;
|
||||
grub_file_t file;
|
||||
char *buf = NULL;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s file var \n", cmd_raw_name);
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
|
||||
if (!file)
|
||||
{
|
||||
debug("failed to open file %s\n", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
buf = grub_malloc(len);
|
||||
if (!buf)
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
|
||||
buf[len - 1] = 0;
|
||||
grub_file_read(file, buf, len - 1);
|
||||
|
||||
ventoy_get_line(buf);
|
||||
ventoy_set_env(args[1], buf);
|
||||
|
||||
end:
|
||||
|
||||
grub_check_free(buf);
|
||||
grub_file_close(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_parse_volume(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len;
|
||||
grub_file_t file;
|
||||
char buf[64];
|
||||
ventoy_iso9660_vd pvd;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (argc != 3)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s sysid volid \n", cmd_raw_name);
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
|
||||
if (!file)
|
||||
{
|
||||
debug("failed to open file %s\n", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_file_seek(file, 16 * 2048);
|
||||
len = (int)grub_file_read(file, &pvd, sizeof(pvd));
|
||||
if (len != sizeof(pvd))
|
||||
{
|
||||
debug("failed to read pvd %d\n", len);
|
||||
goto end;
|
||||
}
|
||||
|
||||
grub_memset(buf, 0, sizeof(buf));
|
||||
grub_memcpy(buf, pvd.sys, sizeof(pvd.sys));
|
||||
ventoy_set_env(args[1], buf);
|
||||
|
||||
grub_memset(buf, 0, sizeof(buf));
|
||||
grub_memcpy(buf, pvd.vol, sizeof(pvd.vol));
|
||||
ventoy_set_env(args[2], buf);
|
||||
|
||||
end:
|
||||
grub_file_close(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_parse_create_date(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int len;
|
||||
grub_file_t file;
|
||||
char buf[64];
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
return grub_error(GRUB_ERR_BAD_ARGUMENT, "Usage: %s var \n", cmd_raw_name);
|
||||
}
|
||||
|
||||
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
|
||||
if (!file)
|
||||
{
|
||||
debug("failed to open file %s\n", args[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_memset(buf, 0, sizeof(buf));
|
||||
grub_file_seek(file, 16 * 2048 + 813);
|
||||
len = (int)grub_file_read(file, buf, 17);
|
||||
if (len != 17)
|
||||
{
|
||||
debug("failed to read create date %d\n", len);
|
||||
goto end;
|
||||
}
|
||||
|
||||
ventoy_set_env(args[1], buf);
|
||||
|
||||
end:
|
||||
grub_file_close(file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_uint64_t ventoy_grub_get_file_size(const char *fmt, ...)
|
||||
{
|
||||
grub_uint64_t size = 0;
|
||||
@@ -2353,6 +2488,7 @@ static int ventoy_env_init(void)
|
||||
static cmd_para ventoy_cmds[] =
|
||||
{
|
||||
{ "vt_incr", ventoy_cmd_incr, 0, NULL, "{Var} {INT}", "Increase integer variable", NULL },
|
||||
{ "vt_strstr", ventoy_cmd_strstr, 0, NULL, "", "", NULL },
|
||||
{ "vt_debug", ventoy_cmd_debug, 0, NULL, "{on|off}", "turn debug on/off", NULL },
|
||||
{ "vtdebug", ventoy_cmd_debug, 0, NULL, "{on|off}", "turn debug on/off", NULL },
|
||||
{ "vtbreak", ventoy_cmd_break, 0, NULL, "{level}", "set debug break", NULL },
|
||||
@@ -2410,6 +2546,16 @@ static cmd_para ventoy_cmds[] =
|
||||
|
||||
{ "vt_load_plugin", ventoy_cmd_load_plugin, 0, NULL, "", "", NULL },
|
||||
{ "vt_check_plugin_json", ventoy_cmd_plugin_check_json, 0, NULL, "", "", NULL },
|
||||
|
||||
{ "vt_1st_line", ventoy_cmd_read_1st_line, 0, NULL, "", "", NULL },
|
||||
{ "vt_parse_iso_volume", ventoy_cmd_parse_volume, 0, NULL, "", "", NULL },
|
||||
{ "vt_parse_iso_create_date", ventoy_cmd_parse_create_date, 0, NULL, "", "", NULL },
|
||||
{ "vt_parse_freenas_ver", ventoy_cmd_parse_freenas_ver, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_parse_freebsd_ver", ventoy_cmd_unix_freebsd_ver, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_reset", ventoy_cmd_unix_reset, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_replace_conf", ventoy_cmd_unix_replace_conf, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_replace_ko", ventoy_cmd_unix_replace_ko, 0, NULL, "", "", NULL },
|
||||
{ "vt_unix_chain_data", ventoy_cmd_unix_chain_data, 0, NULL, "", "", NULL },
|
||||
|
||||
};
|
||||
|
||||
|
@@ -123,6 +123,16 @@ typedef struct ventoy_udf_override
|
||||
grub_uint32_t position;
|
||||
}ventoy_udf_override;
|
||||
|
||||
typedef struct ventoy_iso9660_vd
|
||||
{
|
||||
grub_uint8_t type;
|
||||
grub_uint8_t id[5];
|
||||
grub_uint8_t ver;
|
||||
grub_uint8_t res;
|
||||
char sys[32];
|
||||
char vol[32];
|
||||
}ventoy_iso9660_vd;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#define img_type_iso 0
|
||||
@@ -667,6 +677,24 @@ extern int g_ventoy_iso_uefi_drv;
|
||||
extern int g_ventoy_case_insensitive;
|
||||
extern grub_uint8_t g_ventoy_chain_type;
|
||||
|
||||
|
||||
#define ventoy_unix_fill_virt(new_data, new_len) \
|
||||
{ \
|
||||
data_secs = (new_len + 2047) / 2048; \
|
||||
cur->mem_sector_start = sector; \
|
||||
cur->mem_sector_end = cur->mem_sector_start + data_secs; \
|
||||
cur->mem_sector_offset = offset; \
|
||||
cur->remap_sector_start = 0; \
|
||||
cur->remap_sector_end = 0; \
|
||||
cur->org_sector_start = 0; \
|
||||
grub_memcpy(override + offset, new_data, new_len); \
|
||||
cur++; \
|
||||
sector += data_secs; \
|
||||
offset += new_len; \
|
||||
chain->virt_img_size_in_bytes += data_secs * 2048; \
|
||||
}
|
||||
|
||||
char * ventoy_get_line(char *start);
|
||||
int ventoy_cmp_img(img_info *img1, img_info *img2);
|
||||
void ventoy_swap_img(img_info *img1, img_info *img2);
|
||||
char * ventoy_plugin_get_cur_install_template(const char *isopath);
|
||||
@@ -687,6 +715,13 @@ grub_err_t ventoy_cmd_linux_get_main_initrd_index(grub_extcmd_context_t ctxt, in
|
||||
grub_err_t ventoy_cmd_collect_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_wim_patch_count(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid);
|
||||
grub_err_t ventoy_cmd_unix_reset(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_replace_conf(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_replace_ko(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_unix_freebsd_ver(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
grub_err_t ventoy_cmd_parse_freenas_ver(grub_extcmd_context_t ctxt, int argc, char **args);
|
||||
|
||||
#endif /* __VENTOY_DEF_H__ */
|
||||
|
||||
|
@@ -38,8 +38,7 @@
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
||||
static char * ventoy_get_line(char *start)
|
||||
char * ventoy_get_line(char *start)
|
||||
{
|
||||
if (start == NULL)
|
||||
{
|
||||
|
@@ -17,10 +17,8 @@ all_modules_legacy="date drivemap blocklist vga_text ntldr search at_keyboard us
|
||||
net_modules_uefi="efinet net tftp http"
|
||||
all_modules_uefi="blocklist ventoy test search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu"
|
||||
|
||||
all_extra_modules="elf macho offsetio regexp file"
|
||||
|
||||
if [ "$1" = "uefi" ]; then
|
||||
all_modules="$net_modules_uefi $all_modules_uefi $all_extra_modules "
|
||||
all_modules="$net_modules_uefi $all_modules_uefi "
|
||||
grub-mkimage -v --directory "$VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi" --prefix '(,2)/grub' --output "$VT_DIR/INSTALL/EFI/BOOT/grubx64_real.efi" --format 'x86_64-efi' --compression 'auto' $all_modules_uefi 'fat' 'part_msdos'
|
||||
else
|
||||
all_modules="$net_modules_legacy $all_modules_legacy "
|
||||
@@ -38,7 +36,7 @@ if [ "$1" = "uefi" ]; then
|
||||
|
||||
#copy other modules
|
||||
ls -1 $VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi/ | egrep '\.(lst|mod)$' | while read line; do
|
||||
if ! echo $all_modules | grep -q "${line%.mod} "; then
|
||||
if ! echo $all_modules | grep -q " ${line%.mod} "; then
|
||||
echo "Copy $line ..."
|
||||
rm -f $VT_DIR/INSTALL/grub/x86_64-efi/$line
|
||||
cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/x86_64-efi/$line $VT_DIR/INSTALL/grub/x86_64-efi/
|
||||
@@ -53,7 +51,7 @@ else
|
||||
|
||||
#copy other modules
|
||||
ls -1 $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/ | egrep '\.(lst|mod)$' | while read line; do
|
||||
if ! echo $all_modules | grep -q "${line%.mod} "; then
|
||||
if ! echo $all_modules | grep -q " ${line%.mod} "; then
|
||||
echo "Copy $line ..."
|
||||
rm -f $VT_DIR/INSTALL/grub/i386-pc/$line
|
||||
cp -a $VT_DIR/GRUB2/INSTALL/lib/grub/i386-pc/$line $VT_DIR/INSTALL/grub/i386-pc/
|
||||
|
@@ -20,5 +20,11 @@
|
||||
$SED "s#.*livefs_root=.*find_livefs.*#$BUSYBOX_PATH/mount -t iso9660 /dev/mapper/ventoy \$mountpoint; livefs_root=\$mountpoint#" -i /usr/lib/live/boot/9990-main.sh
|
||||
$SED "s#.*livefs_root=.*find_livefs.*#$BUSYBOX_PATH/mount -t iso9660 /dev/mapper/ventoy \$mountpoint; livefs_root=\$mountpoint#" -i /usr/bin/boot/9990-main.sh
|
||||
|
||||
ventoy_systemd_udevd_work_around
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/debian/udev_disk_hook.sh %k"
|
||||
if [ -e /init ] && $GREP -q '^mountroot$' /init; then
|
||||
echo "Here before mountroot ..." >> $VTLOG
|
||||
$SED "/^mountroot$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/disk_mount_hook.sh" -i /init
|
||||
else
|
||||
echo "Use default hook ..." >> $VTLOG
|
||||
ventoy_systemd_udevd_work_around
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/debian/udev_disk_hook.sh %k"
|
||||
fi
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -39,12 +39,17 @@ if ! [ -f ./tool/ash ]; then
|
||||
|
||||
if ! [ -f ./tool/ash ]; then
|
||||
echo 'Failed to decompress tools ...'
|
||||
cd $OLDDIR
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
cd $OLDDIR
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
./tool/ash ./tool/VentoyWorker.sh $*
|
||||
|
||||
cd $OLDDIR
|
||||
if [ -n "$OLDDIR" ]; then
|
||||
cd $OLDDIR
|
||||
fi
|
||||
|
||||
|
||||
|
@@ -89,6 +89,26 @@ function get_os_type {
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$vtoy_os" = "Linux" ]; then
|
||||
if vt_strstr "$vt_system_id" "FreeBSD"; then
|
||||
set vtoy_os=Unix
|
||||
set vt_unix_type=FreeBSD
|
||||
elif [ -e (loop)/bin/freebsd-version ]; then
|
||||
set vtoy_os=Unix
|
||||
set vt_unix_type=FreeBSD
|
||||
|
||||
|
||||
elif [ -e (loop)/boot/kernel/kernel ]; then
|
||||
if file --is-x86-kfreebsd (loop)/boot/kernel/kernel; then
|
||||
set vtoy_os=Unix
|
||||
set vt_unix_type=FreeBSD
|
||||
elif file --is-x86-knetbsd (loop)/boot/kernel/kernel; then
|
||||
set vtoy_os=Unix
|
||||
set vt_unix_type=NetBSD
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo ISO is $vtoy_os
|
||||
fi
|
||||
@@ -211,6 +231,129 @@ function distro_specify_initrd_file_phase2 {
|
||||
fi
|
||||
}
|
||||
|
||||
function ventoy_get_ghostbsd_ver {
|
||||
|
||||
# vt_parse_iso_create_date $1/${chosen_path} vt_create_date
|
||||
# if regexp "^202005" "$vt_create_date"; then
|
||||
# set vt_freebsd_ver=12.x
|
||||
# fi
|
||||
|
||||
set vt_freebsd_ver=12.x
|
||||
}
|
||||
|
||||
function ventoy_get_freenas_ver {
|
||||
set vt_freebsd_ver=11.x
|
||||
|
||||
if [ -e (loop)/FreeNAS-MANIFEST ]; then
|
||||
vt_parse_freenas_ver (loop)/FreeNAS-MANIFEST vt_freenas_ver
|
||||
if regexp "^13\.[0-9]" "$vt_freenas_ver"; then
|
||||
set vt_freebsd_ver=13.x
|
||||
elif regexp "^12\.[0-9]" "$vt_freenas_ver"; then
|
||||
set vt_freebsd_ver=12.x
|
||||
elif regexp "^11\.[0-9]" "$vt_freenas_ver"; then
|
||||
set vt_freebsd_ver=11.x
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function ventoy_freebsd_proc {
|
||||
if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
|
||||
ventoy_get_ghostbsd_ver $1 ${chosen_path}
|
||||
elif vt_strstr "$vt_volume_id" "FREENAS"; then
|
||||
ventoy_get_freenas_ver $1 ${chosen_path}
|
||||
elif regexp "^13_[0-9]" "$vt_volume_id"; then
|
||||
set vt_freebsd_ver=13.x
|
||||
elif 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 regexp "^9_[0-9]" "$vt_volume_id"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
elif [ -e (loop)/bin/freebsd-version ]; then
|
||||
vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver
|
||||
if regexp "\"13\.[0-9]-" "$vt_userland_ver"; then
|
||||
set vt_freebsd_ver=13.x
|
||||
elif 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
|
||||
elif regexp "\"9\.[0-9]-" "$vt_userland_ver"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
fi
|
||||
elif [ -e (loop)/README.TXT ]; then
|
||||
vt_1st_line (loop)/README.TXT vt_freebsd_line1
|
||||
if regexp "FreeBSD 13\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=13.x
|
||||
elif regexp "FreeBSD 12\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=12.x
|
||||
elif regexp "FreeBSD 11\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=11.x
|
||||
elif regexp "FreeBSD 10\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=10.x
|
||||
elif regexp "FreeBSD 9\.[0-9]-" "$vt_freebsd_line1"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
fi
|
||||
elif vt_strstr "${chosen_path}" "MidnightBSD"; then
|
||||
set vt_freebsd_ver=9.x
|
||||
else
|
||||
set vt_freebsd_ver=12.x
|
||||
fi
|
||||
|
||||
set vt_freebsd_bit=64
|
||||
for file in "/boot/kernel/kernel" "/boot/kernel/kernel.gz"; do
|
||||
if [ -e (loop)/$file ]; then
|
||||
if file --is-i386-kfreebsd (loop)/$file; then
|
||||
set vt_freebsd_bit=32
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo "This is FreeBSD $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
fi
|
||||
|
||||
unset vt_unix_mod_path
|
||||
for file in "/COPYRIGHT" "/FreeNAS-MANIFEST" "/version"; do
|
||||
if [ -e (loop)${file} ]; then
|
||||
set vt_unix_mod_path=${file}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
vt_unix_replace_ko $vt_unix_mod_path (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
|
||||
|
||||
if [ "$vt_unix_type" = "FreeBSD" ]; then
|
||||
ventoy_freebsd_proc $1 ${chosen_path}
|
||||
elif [ "$vt_unix_type" = "NetBSD" ]; then
|
||||
echo "NetBSD not supported"
|
||||
|
||||
|
||||
|
||||
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 +473,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 +513,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 +538,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 +659,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 +691,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 +708,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 +725,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
|
||||
@@ -624,7 +802,7 @@ function efi_unsupport_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.0.17"
|
||||
set VENTOY_VERSION="1.0.18"
|
||||
|
||||
# Default menu display mode, you can change it as you want.
|
||||
# 0: List mode
|
||||
|
Binary file not shown.
BIN
INSTALL/grub/x86_64-efi/elf.mod
Normal file
BIN
INSTALL/grub/x86_64-efi/elf.mod
Normal file
Binary file not shown.
BIN
INSTALL/grub/x86_64-efi/gfxterm_menu.mod
Normal file
BIN
INSTALL/grub/x86_64-efi/gfxterm_menu.mod
Normal file
Binary file not shown.
BIN
INSTALL/grub/x86_64-efi/macho.mod
Normal file
BIN
INSTALL/grub/x86_64-efi/macho.mod
Normal file
Binary file not shown.
@@ -118,7 +118,7 @@ ehci: cs5536 usb boot
|
||||
crypto:
|
||||
part_bsd: part_msdos
|
||||
cs5536:
|
||||
ventoy: ext2 fshelp font crypto exfat udf extcmd normal gcry_sha1 iso9660
|
||||
ventoy: ext2 fshelp crypto font exfat udf extcmd normal gcry_sha1 iso9660
|
||||
gcry_sha512: crypto
|
||||
password: crypto normal
|
||||
fshelp:
|
||||
|
BIN
INSTALL/grub/x86_64-efi/offsetio.mod
Normal file
BIN
INSTALL/grub/x86_64-efi/offsetio.mod
Normal file
Binary file not shown.
BIN
INSTALL/grub/x86_64-efi/regexp.mod
Normal file
BIN
INSTALL/grub/x86_64-efi/regexp.mod
Normal file
Binary file not shown.
@@ -222,7 +222,9 @@ if [ "$MODE" = "install" ]; then
|
||||
cmd=./tool/mkexfatfs_32
|
||||
fi
|
||||
|
||||
chmod +x ./tool/*
|
||||
if [ -d ./tool/ ]; then
|
||||
chmod +x -R ./tool/
|
||||
fi
|
||||
|
||||
# DiskSize > 32GB Cluster Size use 128KB
|
||||
# DiskSize < 32GB Cluster Size use 32KB
|
||||
@@ -234,8 +236,6 @@ if [ "$MODE" = "install" ]; then
|
||||
|
||||
$cmd -n ventoy -s $cluster_sectors ${DISK}1
|
||||
|
||||
chmod +x ./tool/vtoy_gen_uuid
|
||||
|
||||
vtinfo "writing data to disk ..."
|
||||
|
||||
dd status=none conv=fsync if=./boot/boot.img of=$DISK bs=1 count=446
|
||||
|
@@ -129,13 +129,13 @@ is_disk_contains_ventoy() {
|
||||
PART1_TYPE=$(dd if=$DISK bs=1 count=1 skip=450 status=none | ./tool/hexdump -n1 -e '1/1 "%02X"')
|
||||
PART2_TYPE=$(dd if=$DISK bs=1 count=1 skip=466 status=none | ./tool/hexdump -n1 -e '1/1 "%02X"')
|
||||
|
||||
if [ "$PART1_TYPE" != "EE" ]; then
|
||||
if [ "$PART2_TYPE" != "EF" ]; then
|
||||
vtdebug "part2 type is $PART2_TYPE not EF"
|
||||
ventoy_false
|
||||
return
|
||||
fi
|
||||
fi
|
||||
# if [ "$PART1_TYPE" != "EE" ]; then
|
||||
# if [ "$PART2_TYPE" != "EF" ]; then
|
||||
# vtdebug "part2 type is $PART2_TYPE not EF"
|
||||
# ventoy_false
|
||||
# return
|
||||
# fi
|
||||
# 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
|
||||
|
Binary file not shown.
BIN
INSTALL/ventoy/ventoy_unix.cpio
Normal file
BIN
INSTALL/ventoy/ventoy_unix.cpio
Normal file
Binary file not shown.
Binary file not shown.
12
README.md
12
README.md
@@ -1,8 +1,8 @@
|
||||
# Ventoy
|
||||
# Ventoy [https://www.ventoy.net](https://www.ventoy.net)
|
||||
Ventoy is an open source tool to create bootable USB drive for ISO files.
|
||||
With ventoy, you don't need to format the disk over and over, you just need to copy the iso file to the USB drive and boot it.
|
||||
You can copy many iso files at a time and ventoy will give you a boot menu to select them.
|
||||
Both Legacy BIOS and UEFI are supported in the same way. 200+ ISO files are tested.
|
||||
Both Legacy BIOS and UEFI are supported in the same way. 420+ ISO files are tested.
|
||||
A "Ventoy Compatible" concept is introduced by ventoy, which can help to support any ISO file.
|
||||
|
||||
See https://www.ventoy.net for detail.
|
||||
@@ -15,16 +15,17 @@ See https://www.ventoy.net for detail.
|
||||
* Legacy + UEFI supported in the same way
|
||||
* UEFI Secure Boot supported (since 1.0.07+)
|
||||
* Persistence supported (since 1.0.11+)
|
||||
* MBR and GPT partition style supported (1.0.15+)
|
||||
* WIM files boot supported (Legacy + UEFI) (1.0.12+)
|
||||
* Auto installation supported (1.0.09+)
|
||||
* ISO files larger than 4GB supported
|
||||
* Native boot menu style for Legacy & UEFI
|
||||
* Most type of OS supported, 200+ iso files tested
|
||||
* Most type of OS supported, 420+ iso files tested
|
||||
* Not only boot but also complete installation process
|
||||
* ISO files can be listed in List mode/TreeView mode
|
||||
* "Ventoy Compatible" concept
|
||||
* Plugin Framework
|
||||
* Readonly to USB drive during boot
|
||||
* USB drive write-protected support
|
||||
* USB normal use unaffected
|
||||
* Data nondestructive during version upgrade
|
||||
* No need to update Ventoy when a new distro is released
|
||||
@@ -43,11 +44,14 @@ Title | Link
|
||||
-|-
|
||||
**Install & Update** | [https://www.ventoy.net/en/doc_start.html](https://www.ventoy.net/en/doc_start.html)
|
||||
**Customize Theme** | [https://www.ventoy.net/en/plugin_theme.html](https://www.ventoy.net/en/plugin_theme.html)
|
||||
**Global Control** | [https://www.ventoy.net/en/plugin_control.html](https://www.ventoy.net/en/plugin_control.html)
|
||||
**Auto Installation** | [https://www.ventoy.net/en/plugin_autoinstall.html](https://www.ventoy.net/en/plugin_autoinstall.html)
|
||||
**Injection Plugin** | [https://www.ventoy.net/en/plugin_injection.html](https://www.ventoy.net/en/plugin_injection.html)
|
||||
**Persistence Support** | [https://www.ventoy.net/en/plugin_persistence.html](https://www.ventoy.net/en/plugin_persistence.html)
|
||||
**Boot WIM file** | [https://www.ventoy.net/en/plugin_wimboot.html](https://www.ventoy.net/en/plugin_wimboot.html)
|
||||
**Menu Class** | [https://www.ventoy.net/en/plugin_menuclass.html](https://www.ventoy.net/en/plugin_menuclass.html)
|
||||
**Menu Alias** | [https://www.ventoy.net/en/plugin_menualias.html](https://www.ventoy.net/en/plugin_menualias.html)
|
||||
**Menu Extension** | [https://www.ventoy.net/en/plugin_grubmenu.html](https://www.ventoy.net/en/plugin_grubmenu.html)
|
||||
**Memdisk Mode** | [https://www.ventoy.net/en/doc_memdisk.html](https://www.ventoy.net/en/doc_memdisk.html)
|
||||
**TreeView Mode** | [https://www.ventoy.net/en/doc_treeview.html](https://www.ventoy.net/en/doc_treeview.html)
|
||||
**Disk Layout MBR** | [https://www.ventoy.net/en/doc_disk_layout.html](https://www.ventoy.net/en/doc_disk_layout.html)
|
||||
|
13
Unix/pack_unix.sh
Normal file
13
Unix/pack_unix.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
VENTOY_PATH=$PWD/../
|
||||
|
||||
rm -f ventoy_unix.cpio
|
||||
|
||||
find ./ventoy_unix | cpio -o -H newc>ventoy_unix.cpio
|
||||
|
||||
echo '======== SUCCESS ============='
|
||||
|
||||
rm -f $VENTOY_PATH/INSTALL/ventoy/ventoy_unix.cpio
|
||||
cp -a ventoy_unix.cpio $VENTOY_PATH/INSTALL/ventoy/
|
||||
|
BIN
Unix/ventoy_unix.cpio
Normal file
BIN
Unix/ventoy_unix.cpio
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.
Binary file not shown.
Binary file not shown.
BIN
Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/9.x/32/geom_ventoy.ko.xz
Normal file
BIN
Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/9.x/32/geom_ventoy.ko.xz
Normal file
Binary file not shown.
BIN
Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/9.x/64/geom_ventoy.ko.xz
Normal file
BIN
Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/9.x/64/geom_ventoy.ko.xz
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2020 longpanda <admin@ventoy.net>
|
||||
* Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _G_VENTOY_H_
|
||||
#define _G_VENTOY_H_
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#define G_VENTOY_CLASS_NAME "VENTOY"
|
||||
|
||||
#define G_VENTOY_MAGIC "GEOM::VENTOY"
|
||||
/*
|
||||
* Version history:
|
||||
* 1 - Initial version number.
|
||||
* 2 - Added 'stop' command to gconcat(8).
|
||||
* 3 - Added md_provider field to metadata and '-h' option to gconcat(8).
|
||||
* 4 - Added md_provsize field to metadata.
|
||||
*/
|
||||
#define G_VENTOY_VERSION 4
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define G_VENTOY_TYPE_MANUAL 0
|
||||
#define G_VENTOY_TYPE_AUTOMATIC 1
|
||||
|
||||
#define G_DEBUG(...) if (bootverbose) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_DEBUG(lvl, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_LOGREQ(bp, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
|
||||
struct g_ventoy_disk {
|
||||
struct g_consumer *d_consumer;
|
||||
struct g_ventoy_softc *d_softc;
|
||||
off_t d_start;
|
||||
off_t d_end;
|
||||
off_t d_map_start;
|
||||
off_t d_map_end;
|
||||
int d_candelete;
|
||||
int d_removed;
|
||||
};
|
||||
|
||||
struct g_ventoy_softc {
|
||||
u_int sc_type; /* provider type */
|
||||
struct g_geom *sc_geom;
|
||||
struct g_provider *sc_provider;
|
||||
uint32_t sc_id; /* concat unique ID */
|
||||
|
||||
struct g_ventoy_disk *sc_disks;
|
||||
uint16_t sc_ndisks;
|
||||
struct mtx sc_lock;
|
||||
};
|
||||
#define sc_name sc_geom->name
|
||||
#endif /* _KERNEL */
|
||||
|
||||
struct g_ventoy_metadata {
|
||||
char md_magic[16]; /* Magic value. */
|
||||
uint32_t md_version; /* Version number. */
|
||||
char md_name[16]; /* Concat name. */
|
||||
uint32_t md_id; /* Unique ID. */
|
||||
uint16_t md_no; /* Disk number. */
|
||||
uint16_t md_all; /* Number of all disks. */
|
||||
char md_provider[16]; /* Hardcoded provider. */
|
||||
uint64_t md_provsize; /* Provider's size. */
|
||||
};
|
||||
static __inline void
|
||||
ventoy_metadata_encode(const struct g_ventoy_metadata *md, u_char *data)
|
||||
{
|
||||
|
||||
bcopy(md->md_magic, data, sizeof(md->md_magic));
|
||||
le32enc(data + 16, md->md_version);
|
||||
bcopy(md->md_name, data + 20, sizeof(md->md_name));
|
||||
le32enc(data + 36, md->md_id);
|
||||
le16enc(data + 40, md->md_no);
|
||||
le16enc(data + 42, md->md_all);
|
||||
bcopy(md->md_provider, data + 44, sizeof(md->md_provider));
|
||||
le64enc(data + 60, md->md_provsize);
|
||||
}
|
||||
static __inline void
|
||||
ventoy_metadata_decode(const u_char *data, struct g_ventoy_metadata *md)
|
||||
{
|
||||
|
||||
bcopy(data, md->md_magic, sizeof(md->md_magic));
|
||||
md->md_version = le32dec(data + 16);
|
||||
bcopy(data + 20, md->md_name, sizeof(md->md_name));
|
||||
md->md_id = le32dec(data + 36);
|
||||
md->md_no = le16dec(data + 40);
|
||||
md->md_all = le16dec(data + 42);
|
||||
bcopy(data + 44, md->md_provider, sizeof(md->md_provider));
|
||||
md->md_provsize = le64dec(data + 60);
|
||||
}
|
||||
#endif /* _G_VENTOY_H_ */
|
@@ -0,0 +1,8 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${SRCTOP}/sys/geom/ventoy
|
||||
|
||||
KMOD= geom_ventoy
|
||||
SRCS= g_ventoy.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2020 longpanda <admin@ventoy.net>
|
||||
* Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _G_VENTOY_H_
|
||||
#define _G_VENTOY_H_
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#define G_VENTOY_CLASS_NAME "VENTOY"
|
||||
|
||||
#define G_VENTOY_MAGIC "GEOM::VENTOY"
|
||||
/*
|
||||
* Version history:
|
||||
* 1 - Initial version number.
|
||||
* 2 - Added 'stop' command to gconcat(8).
|
||||
* 3 - Added md_provider field to metadata and '-h' option to gconcat(8).
|
||||
* 4 - Added md_provsize field to metadata.
|
||||
*/
|
||||
#define G_VENTOY_VERSION 4
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define G_VENTOY_TYPE_MANUAL 0
|
||||
#define G_VENTOY_TYPE_AUTOMATIC 1
|
||||
|
||||
#define G_DEBUG(...) if (bootverbose) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_DEBUG(lvl, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_LOGREQ(bp, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
|
||||
struct g_ventoy_disk {
|
||||
struct g_consumer *d_consumer;
|
||||
struct g_ventoy_softc *d_softc;
|
||||
off_t d_start;
|
||||
off_t d_end;
|
||||
off_t d_map_start;
|
||||
off_t d_map_end;
|
||||
int d_candelete;
|
||||
int d_removed;
|
||||
};
|
||||
|
||||
struct g_ventoy_softc {
|
||||
u_int sc_type; /* provider type */
|
||||
struct g_geom *sc_geom;
|
||||
struct g_provider *sc_provider;
|
||||
uint32_t sc_id; /* concat unique ID */
|
||||
|
||||
struct g_ventoy_disk *sc_disks;
|
||||
uint16_t sc_ndisks;
|
||||
struct mtx sc_lock;
|
||||
};
|
||||
#define sc_name sc_geom->name
|
||||
#endif /* _KERNEL */
|
||||
|
||||
struct g_ventoy_metadata {
|
||||
char md_magic[16]; /* Magic value. */
|
||||
uint32_t md_version; /* Version number. */
|
||||
char md_name[16]; /* Concat name. */
|
||||
uint32_t md_id; /* Unique ID. */
|
||||
uint16_t md_no; /* Disk number. */
|
||||
uint16_t md_all; /* Number of all disks. */
|
||||
char md_provider[16]; /* Hardcoded provider. */
|
||||
uint64_t md_provsize; /* Provider's size. */
|
||||
};
|
||||
static __inline void
|
||||
ventoy_metadata_encode(const struct g_ventoy_metadata *md, u_char *data)
|
||||
{
|
||||
|
||||
bcopy(md->md_magic, data, sizeof(md->md_magic));
|
||||
le32enc(data + 16, md->md_version);
|
||||
bcopy(md->md_name, data + 20, sizeof(md->md_name));
|
||||
le32enc(data + 36, md->md_id);
|
||||
le16enc(data + 40, md->md_no);
|
||||
le16enc(data + 42, md->md_all);
|
||||
bcopy(md->md_provider, data + 44, sizeof(md->md_provider));
|
||||
le64enc(data + 60, md->md_provsize);
|
||||
}
|
||||
static __inline void
|
||||
ventoy_metadata_decode(const u_char *data, struct g_ventoy_metadata *md)
|
||||
{
|
||||
|
||||
bcopy(data, md->md_magic, sizeof(md->md_magic));
|
||||
md->md_version = le32dec(data + 16);
|
||||
bcopy(data + 20, md->md_name, sizeof(md->md_name));
|
||||
md->md_id = le32dec(data + 36);
|
||||
md->md_no = le16dec(data + 40);
|
||||
md->md_all = le16dec(data + 42);
|
||||
bcopy(data + 44, md->md_provider, sizeof(md->md_provider));
|
||||
md->md_provsize = le64dec(data + 60);
|
||||
}
|
||||
#endif /* _G_VENTOY_H_ */
|
@@ -0,0 +1,8 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${SRCTOP}/sys/geom/ventoy
|
||||
|
||||
KMOD= geom_ventoy
|
||||
SRCS= g_ventoy.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2020 longpanda <admin@ventoy.net>
|
||||
* Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _G_VENTOY_H_
|
||||
#define _G_VENTOY_H_
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#define G_VENTOY_CLASS_NAME "VENTOY"
|
||||
|
||||
#define G_VENTOY_MAGIC "GEOM::VENTOY"
|
||||
/*
|
||||
* Version history:
|
||||
* 1 - Initial version number.
|
||||
* 2 - Added 'stop' command to gconcat(8).
|
||||
* 3 - Added md_provider field to metadata and '-h' option to gconcat(8).
|
||||
* 4 - Added md_provsize field to metadata.
|
||||
*/
|
||||
#define G_VENTOY_VERSION 4
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define G_VENTOY_TYPE_MANUAL 0
|
||||
#define G_VENTOY_TYPE_AUTOMATIC 1
|
||||
|
||||
#define G_DEBUG(...) if (bootverbose) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_DEBUG(lvl, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_LOGREQ(bp, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
|
||||
struct g_ventoy_disk {
|
||||
struct g_consumer *d_consumer;
|
||||
struct g_ventoy_softc *d_softc;
|
||||
off_t d_start;
|
||||
off_t d_end;
|
||||
off_t d_map_start;
|
||||
off_t d_map_end;
|
||||
int d_candelete;
|
||||
int d_removed;
|
||||
};
|
||||
|
||||
struct g_ventoy_softc {
|
||||
u_int sc_type; /* provider type */
|
||||
struct g_geom *sc_geom;
|
||||
struct g_provider *sc_provider;
|
||||
uint32_t sc_id; /* concat unique ID */
|
||||
|
||||
struct g_ventoy_disk *sc_disks;
|
||||
uint16_t sc_ndisks;
|
||||
struct mtx sc_lock;
|
||||
};
|
||||
#define sc_name sc_geom->name
|
||||
#endif /* _KERNEL */
|
||||
|
||||
struct g_ventoy_metadata {
|
||||
char md_magic[16]; /* Magic value. */
|
||||
uint32_t md_version; /* Version number. */
|
||||
char md_name[16]; /* Concat name. */
|
||||
uint32_t md_id; /* Unique ID. */
|
||||
uint16_t md_no; /* Disk number. */
|
||||
uint16_t md_all; /* Number of all disks. */
|
||||
char md_provider[16]; /* Hardcoded provider. */
|
||||
uint64_t md_provsize; /* Provider's size. */
|
||||
};
|
||||
static __inline void
|
||||
ventoy_metadata_encode(const struct g_ventoy_metadata *md, u_char *data)
|
||||
{
|
||||
|
||||
bcopy(md->md_magic, data, sizeof(md->md_magic));
|
||||
le32enc(data + 16, md->md_version);
|
||||
bcopy(md->md_name, data + 20, sizeof(md->md_name));
|
||||
le32enc(data + 36, md->md_id);
|
||||
le16enc(data + 40, md->md_no);
|
||||
le16enc(data + 42, md->md_all);
|
||||
bcopy(md->md_provider, data + 44, sizeof(md->md_provider));
|
||||
le64enc(data + 60, md->md_provsize);
|
||||
}
|
||||
static __inline void
|
||||
ventoy_metadata_decode(const u_char *data, struct g_ventoy_metadata *md)
|
||||
{
|
||||
|
||||
bcopy(data, md->md_magic, sizeof(md->md_magic));
|
||||
md->md_version = le32dec(data + 16);
|
||||
bcopy(data + 20, md->md_name, sizeof(md->md_name));
|
||||
md->md_id = le32dec(data + 36);
|
||||
md->md_no = le16dec(data + 40);
|
||||
md->md_all = le16dec(data + 42);
|
||||
bcopy(data + 44, md->md_provider, sizeof(md->md_provider));
|
||||
md->md_provsize = le64dec(data + 60);
|
||||
}
|
||||
#endif /* _G_VENTOY_H_ */
|
@@ -0,0 +1,8 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${SRCTOP}/sys/geom/ventoy
|
||||
|
||||
KMOD= geom_ventoy
|
||||
SRCS= g_ventoy.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2020 longpanda <admin@ventoy.net>
|
||||
* Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _G_VENTOY_H_
|
||||
#define _G_VENTOY_H_
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#define G_VENTOY_CLASS_NAME "VENTOY"
|
||||
|
||||
#define G_VENTOY_MAGIC "GEOM::VENTOY"
|
||||
/*
|
||||
* Version history:
|
||||
* 1 - Initial version number.
|
||||
* 2 - Added 'stop' command to gconcat(8).
|
||||
* 3 - Added md_provider field to metadata and '-h' option to gconcat(8).
|
||||
* 4 - Added md_provsize field to metadata.
|
||||
*/
|
||||
#define G_VENTOY_VERSION 4
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define G_VENTOY_TYPE_MANUAL 0
|
||||
#define G_VENTOY_TYPE_AUTOMATIC 1
|
||||
|
||||
#define G_DEBUG(...) if (bootverbose) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_DEBUG(lvl, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_LOGREQ(bp, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
|
||||
struct g_ventoy_disk {
|
||||
struct g_consumer *d_consumer;
|
||||
struct g_ventoy_softc *d_softc;
|
||||
off_t d_start;
|
||||
off_t d_end;
|
||||
off_t d_map_start;
|
||||
off_t d_map_end;
|
||||
int d_candelete;
|
||||
int d_removed;
|
||||
};
|
||||
|
||||
struct g_ventoy_softc {
|
||||
u_int sc_type; /* provider type */
|
||||
struct g_geom *sc_geom;
|
||||
struct g_provider *sc_provider;
|
||||
uint32_t sc_id; /* concat unique ID */
|
||||
|
||||
struct g_ventoy_disk *sc_disks;
|
||||
uint16_t sc_ndisks;
|
||||
struct mtx sc_lock;
|
||||
};
|
||||
#define sc_name sc_geom->name
|
||||
#endif /* _KERNEL */
|
||||
|
||||
struct g_ventoy_metadata {
|
||||
char md_magic[16]; /* Magic value. */
|
||||
uint32_t md_version; /* Version number. */
|
||||
char md_name[16]; /* Concat name. */
|
||||
uint32_t md_id; /* Unique ID. */
|
||||
uint16_t md_no; /* Disk number. */
|
||||
uint16_t md_all; /* Number of all disks. */
|
||||
char md_provider[16]; /* Hardcoded provider. */
|
||||
uint64_t md_provsize; /* Provider's size. */
|
||||
};
|
||||
static __inline void
|
||||
ventoy_metadata_encode(const struct g_ventoy_metadata *md, u_char *data)
|
||||
{
|
||||
|
||||
bcopy(md->md_magic, data, sizeof(md->md_magic));
|
||||
le32enc(data + 16, md->md_version);
|
||||
bcopy(md->md_name, data + 20, sizeof(md->md_name));
|
||||
le32enc(data + 36, md->md_id);
|
||||
le16enc(data + 40, md->md_no);
|
||||
le16enc(data + 42, md->md_all);
|
||||
bcopy(md->md_provider, data + 44, sizeof(md->md_provider));
|
||||
le64enc(data + 60, md->md_provsize);
|
||||
}
|
||||
static __inline void
|
||||
ventoy_metadata_decode(const u_char *data, struct g_ventoy_metadata *md)
|
||||
{
|
||||
|
||||
bcopy(data, md->md_magic, sizeof(md->md_magic));
|
||||
md->md_version = le32dec(data + 16);
|
||||
bcopy(data + 20, md->md_name, sizeof(md->md_name));
|
||||
md->md_id = le32dec(data + 36);
|
||||
md->md_no = le16dec(data + 40);
|
||||
md->md_all = le16dec(data + 42);
|
||||
bcopy(data + 44, md->md_provider, sizeof(md->md_provider));
|
||||
md->md_provsize = le64dec(data + 60);
|
||||
}
|
||||
#endif /* _G_VENTOY_H_ */
|
@@ -0,0 +1,8 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${SRCTOP}/sys/geom/ventoy
|
||||
|
||||
KMOD= geom_ventoy
|
||||
SRCS= g_ventoy.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,117 @@
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
*
|
||||
* Copyright (c) 2020 longpanda <admin@ventoy.net>
|
||||
* Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _G_VENTOY_H_
|
||||
#define _G_VENTOY_H_
|
||||
|
||||
#include <sys/endian.h>
|
||||
|
||||
#define G_VENTOY_CLASS_NAME "VENTOY"
|
||||
|
||||
#define G_VENTOY_MAGIC "GEOM::VENTOY"
|
||||
/*
|
||||
* Version history:
|
||||
* 1 - Initial version number.
|
||||
* 2 - Added 'stop' command to gconcat(8).
|
||||
* 3 - Added md_provider field to metadata and '-h' option to gconcat(8).
|
||||
* 4 - Added md_provsize field to metadata.
|
||||
*/
|
||||
#define G_VENTOY_VERSION 4
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define G_VENTOY_TYPE_MANUAL 0
|
||||
#define G_VENTOY_TYPE_AUTOMATIC 1
|
||||
|
||||
#define G_DEBUG(...) if (bootverbose) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_DEBUG(lvl, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
#define G_VENTOY_LOGREQ(bp, ...) if (g_ventoy_debug) printf(__VA_ARGS__)
|
||||
|
||||
struct g_ventoy_disk {
|
||||
struct g_consumer *d_consumer;
|
||||
struct g_ventoy_softc *d_softc;
|
||||
off_t d_start;
|
||||
off_t d_end;
|
||||
off_t d_map_start;
|
||||
off_t d_map_end;
|
||||
int d_candelete;
|
||||
int d_removed;
|
||||
};
|
||||
|
||||
struct g_ventoy_softc {
|
||||
u_int sc_type; /* provider type */
|
||||
struct g_geom *sc_geom;
|
||||
struct g_provider *sc_provider;
|
||||
uint32_t sc_id; /* concat unique ID */
|
||||
|
||||
struct g_ventoy_disk *sc_disks;
|
||||
uint16_t sc_ndisks;
|
||||
struct mtx sc_lock;
|
||||
};
|
||||
#define sc_name sc_geom->name
|
||||
#endif /* _KERNEL */
|
||||
|
||||
struct g_ventoy_metadata {
|
||||
char md_magic[16]; /* Magic value. */
|
||||
uint32_t md_version; /* Version number. */
|
||||
char md_name[16]; /* Concat name. */
|
||||
uint32_t md_id; /* Unique ID. */
|
||||
uint16_t md_no; /* Disk number. */
|
||||
uint16_t md_all; /* Number of all disks. */
|
||||
char md_provider[16]; /* Hardcoded provider. */
|
||||
uint64_t md_provsize; /* Provider's size. */
|
||||
};
|
||||
static __inline void
|
||||
ventoy_metadata_encode(const struct g_ventoy_metadata *md, u_char *data)
|
||||
{
|
||||
|
||||
bcopy(md->md_magic, data, sizeof(md->md_magic));
|
||||
le32enc(data + 16, md->md_version);
|
||||
bcopy(md->md_name, data + 20, sizeof(md->md_name));
|
||||
le32enc(data + 36, md->md_id);
|
||||
le16enc(data + 40, md->md_no);
|
||||
le16enc(data + 42, md->md_all);
|
||||
bcopy(md->md_provider, data + 44, sizeof(md->md_provider));
|
||||
le64enc(data + 60, md->md_provsize);
|
||||
}
|
||||
static __inline void
|
||||
ventoy_metadata_decode(const u_char *data, struct g_ventoy_metadata *md)
|
||||
{
|
||||
|
||||
bcopy(data, md->md_magic, sizeof(md->md_magic));
|
||||
md->md_version = le32dec(data + 16);
|
||||
bcopy(data + 20, md->md_name, sizeof(md->md_name));
|
||||
md->md_id = le32dec(data + 36);
|
||||
md->md_no = le16dec(data + 40);
|
||||
md->md_all = le16dec(data + 42);
|
||||
bcopy(data + 44, md->md_provider, sizeof(md->md_provider));
|
||||
md->md_provsize = le64dec(data + 60);
|
||||
}
|
||||
#endif /* _G_VENTOY_H_ */
|
@@ -0,0 +1,8 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${SRCTOP}/sys/geom/ventoy
|
||||
|
||||
KMOD= geom_ventoy
|
||||
SRCS= g_ventoy.c
|
||||
|
||||
.include <bsd.kmod.mk>
|
@@ -167,8 +167,7 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes, MBR_HEAD *pMBR, UIN
|
||||
PartStartSector = MBR.PartTbl[0].StartSectorId + MBR.PartTbl[0].SectorCount;
|
||||
PartSectorCount = VENTOY_EFI_PART_SIZE / 512;
|
||||
|
||||
if (MBR.PartTbl[1].FsFlag != 0xEF ||
|
||||
MBR.PartTbl[1].StartSectorId != PartStartSector ||
|
||||
if (MBR.PartTbl[1].StartSectorId != PartStartSector ||
|
||||
MBR.PartTbl[1].SectorCount != PartSectorCount)
|
||||
{
|
||||
Log("Part2 not match [0x%x 0x%x] [%u %u] [%u %u]",
|
||||
|
Reference in New Issue
Block a user