]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Fix the boot issue for Untangle ISO in legacy bios mode. (#1054)
authorlongpanda <admin@ventoy.net>
Wed, 11 Aug 2021 01:44:09 +0000 (09:44 +0800)
committerlongpanda <admin@ventoy.net>
Wed, 11 Aug 2021 01:44:09 +0000 (09:44 +0800)
GRUB2/MOD_SRC/grub-2.04/grub-core/fs/iso9660.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
INSTALL/grub/grub.cfg

index bd3575647c051d29d43695c054d6f4cadd9ad92c..9a26bb21ab50ce55fdea0d9c71677f5d97fd8b8b 100644 (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;
index 97f4ee1682caad9bbf5bfc2253bc8a5343ab45d0..48ed7ed361df14ea36c1d1c5d078de904236e1e1 100644 (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 },
index 56f357db471b15ce8dbc52abdbaf778e7e956e79..11384b259f6aad867de5229dc119d6b4155ded80 100644 (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);
index 284cce0807df47ac755811dafb8682c0c7f9c82d..b5354c8cf635a4ab478c3806206ded444556f3d4 100644 (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"