Fix the boot issue for Untangle ISO in legacy bios mode. (#1054)

This commit is contained in:
longpanda 2021-08-11 09:44:09 +08:00
parent d3138479d7
commit bafac7479d
4 changed files with 35 additions and 0 deletions

View File

@ -33,6 +33,7 @@
GRUB_MOD_LICENSE ("GPLv3+");
static int g_ventoy_no_joliet = 0;
static int g_ventoy_cur_joliet = 0;
static grub_uint64_t g_ventoy_last_read_pos = 0;
static grub_uint64_t g_ventoy_last_read_offset = 0;
static grub_uint64_t g_ventoy_last_read_dirent_pos = 0;
@ -451,6 +452,7 @@ grub_iso9660_mount (grub_disk_t disk)
data->disk = disk;
g_ventoy_cur_joliet = 0;
block = 16;
do
{
@ -484,6 +486,7 @@ grub_iso9660_mount (grub_disk_t disk)
if (0 == g_ventoy_no_joliet) {
copy_voldesc = 1;
data->joliet = 1;
g_ventoy_cur_joliet = 1;
}
}
@ -1118,6 +1121,11 @@ void grub_iso9660_set_nojoliet(int nojoliet)
g_ventoy_no_joliet = nojoliet;
}
int grub_iso9660_is_joliet(void)
{
return g_ventoy_cur_joliet;
}
grub_uint64_t grub_iso9660_get_last_read_pos(grub_file_t file)
{
(void)file;

View File

@ -1221,6 +1221,23 @@ static grub_err_t ventoy_cmd_load_img_memdisk(grub_extcmd_context_t ctxt, int ar
return rc;
}
static grub_err_t ventoy_cmd_iso9660_is_joliet(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
(void)argc;
(void)args;
if (grub_iso9660_is_joliet())
{
debug("This time has joliet process\n");
return 0;
}
else
{
return 1;
}
}
static grub_err_t ventoy_cmd_iso9660_nojoliet(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
@ -4736,6 +4753,7 @@ static cmd_para ventoy_cmds[] =
{ "vt_select_conf_replace", ventoy_select_conf_replace, 0, NULL, "", "", NULL },
{ "vt_iso9660_nojoliet", ventoy_cmd_iso9660_nojoliet, 0, NULL, "", "", NULL },
{ "vt_iso9660_isjoliet", ventoy_cmd_iso9660_is_joliet, 0, NULL, "", "", NULL },
{ "vt_is_udf", ventoy_cmd_is_udf, 0, NULL, "", "", NULL },
{ "vt_file_size", ventoy_cmd_file_size, 0, NULL, "", "", NULL },
{ "vt_load_file_to_mem", ventoy_cmd_load_file_to_mem, 0, NULL, "", "", NULL },

View File

@ -267,6 +267,7 @@ typedef struct ventoy_grub_param
int grub_ext_get_file_chunk(grub_uint64_t part_start, grub_file_t file, ventoy_img_chunk_list *chunk_list);
int grub_fat_get_file_chunk(grub_uint64_t part_start, grub_file_t file, ventoy_img_chunk_list *chunk_list);
void grub_iso9660_set_nojoliet(int nojoliet);
int grub_iso9660_is_joliet(void);
grub_uint64_t grub_iso9660_get_last_read_pos(grub_file_t file);
grub_uint64_t grub_iso9660_get_last_file_dirent_pos(grub_file_t file);
grub_uint64_t grub_udf_get_file_offset(grub_file_t file);

View File

@ -961,6 +961,14 @@ function legacy_linux_menu_func {
set ventoy_fs_probe=iso9660
loopback loop "$1$2"
fi
if [ -f (loop)/isolinux/isolinux.cfg ]; then
if vt_iso9660_isjoliet; then
vt_iso9660_nojoliet 1
loopback -d loop
loopback loop "$1$2"
fi
fi
vt_load_cpio $vtoy_path "$2" "$1" "busybox=$ventoy_busybox_ver"