]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Auto memdisk plugin support some IMA/IMG files.
authorlongpanda <admin@ventoy.net>
Mon, 5 Dec 2022 02:51:15 +0000 (10:51 +0800)
committerlongpanda <admin@ventoy.net>
Mon, 5 Dec 2022 02:51:15 +0000 (10:51 +0800)
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c
GRUB2/MOD_SRC/grub-2.04/install.sh
INSTALL/grub/grub.cfg

index eab86b1aa13344754f8957d465da57700e7a0081..56accf70e8448b365927668e050f4d1f294d1a89 100644 (file)
@@ -2079,6 +2079,13 @@ static int ventoy_collect_img_files(const char *filename, const struct grub_dirh
                     img->menu_prefix = "miso";
                 }
             }
+            else if (img_type_img == type)
+            {
+                if (ventoy_plugin_check_memdisk(img->path))
+                {
+                    img->menu_prefix = "mimg";
+                }
+            }
 
             debug("Add %s%s to list %d\n", node->dir, filename, g_ventoy_img_count);
         }
index 2f1f83f7a1423b8e3d6b5618481553b1dcfe9998..237eb1beabc6efb44df3c74867a9dcf443bc53bf 100644 (file)
@@ -12,7 +12,7 @@ make install
 PATH=$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/:$PATH
 
 net_modules_legacy="net tftp http"
-all_modules_legacy="file setkey date drivemap blocklist regexp newc vga_text ntldr search at_keyboard usb_keyboard  gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal  linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal  udf gfxmenu gfxterm gfxterm_background gfxterm_menu smbios zfs"
+all_modules_legacy="file date drivemap blocklist newc vga_text ntldr search at_keyboard usb_keyboard  gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe font video gettext extcmd terminal  linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal  udf gfxmenu gfxterm gfxterm_background gfxterm_menu smbios"
 
 net_modules_uefi="efinet net tftp http"
 all_modules_uefi="file setkey blocklist ventoy test true regexp newc 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 mouse fwload smbios zfs"
index 4e980a6da8a8330366dc3ca5534e78890806d3a3..888ed8c22638b60384a0e0dc54d52524895d8831 100644 (file)
 # 
 #************************************************************************************
 
+if [ "$grub_platform" = "pc" ]; then
+    insmod setkey
+    insmod regexp
+    insmod video_fb
+fi
+
 function ventoy_pause {
     echo "press Enter to continue ......"
     read vtTmpPause
@@ -2346,6 +2352,28 @@ function img_unsupport_menuentry {
     common_unsupport_menuentry
 }
 
+function mimg_common_menuentry {
+    vt_chosen_img_path vt_chosen_path vt_chosen_size vt_chosen_name
+
+    if vt_check_password "${vt_chosen_path}"; then
+        return
+    fi
+
+    echo "memdisk mode boot for $vt_chosen_path"
+    echo ""
+    ventoy_debug_pause
+
+    if [ "$grub_platform" = "pc" ]; then
+        legacy_img_memdisk $vtoy_iso_part "$vt_chosen_path"
+    else
+        vt_load_img_memdisk "$vtoy_iso_part$vt_chosen_path" vtoy_img_buf
+        ventoy_cli_console
+        chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi memdisk env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_img_buf_addr}:size:${vtoy_img_buf_size}
+        boot
+        ventoy_gui_console    
+    fi      
+}
+
 #############################################################
 #############################################################
 #############################################################