From 315cabb945149e28a1e5a3a74cb9e92dd1aeda21 Mon Sep 17 00:00:00 2001 From: longpanda Date: Sat, 7 Jan 2023 11:33:04 +0800 Subject: [PATCH] Fix the file path when file checksum in F2 browse mode. --- GRUB2/MOD_SRC/grub-2.04/grub-core/commands/hashsum.c | 4 +++- GRUB2/MOD_SRC/grub-2.04/grub-core/kern/file.c | 6 ++++-- GRUB2/MOD_SRC/grub-2.04/install.sh | 2 +- INSTALL/grub/grub.cfg | 1 - 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/hashsum.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/hashsum.c index 7dc63f18..f38c18c2 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/hashsum.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/hashsum.c @@ -260,6 +260,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt, grub_file_t file; grub_err_t err; unsigned j; + int vlnk = 0; file = grub_file_open (args[i], GRUB_FILE_TYPE_TO_HASH | (!uncompress ? GRUB_FILE_TYPE_NO_DECOMPRESS : GRUB_FILE_TYPE_NONE)); @@ -272,6 +273,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt, unread++; continue; } + vlnk = file->vlnk; err = hash_file (file, hash, result); grub_file_close (file); if (err) @@ -288,7 +290,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt, grub_printf ("%02x", ((grub_uint8_t *) result)[j]); len += grub_snprintf(hashsum + len, sizeof(hashsum) - len, "%02x", ((grub_uint8_t *) result)[j]); } - grub_printf (" %s\n", args[i]); + grub_printf (" %s\n", vlnk ? grub_file_get_vlnk(args[i], NULL) : args[i]); grub_env_set("VT_LAST_CHECK_SUM", hashsum); } diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/kern/file.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/kern/file.c index 22a74414..f8c182f8 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/kern/file.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/kern/file.c @@ -200,7 +200,8 @@ const char *grub_file_get_vlnk(const char *name, int *vlnk) if (len == g_vtoy_vlnk.srclen && grub_strcmp(name, g_vtoy_vlnk.src) == 0) { - *vlnk = 1; + if (vlnk) + *vlnk = 1; return g_vtoy_vlnk.dst; } @@ -208,7 +209,8 @@ const char *grub_file_get_vlnk(const char *name, int *vlnk) { if (node->srclen == len && grub_strcmp(name, node->src) == 0) { - *vlnk = 1; + if (vlnk) + *vlnk = 1; return node->dst; } node = node->next; diff --git a/GRUB2/MOD_SRC/grub-2.04/install.sh b/GRUB2/MOD_SRC/grub-2.04/install.sh index 237eb1be..45c7cb7c 100644 --- a/GRUB2/MOD_SRC/grub-2.04/install.sh +++ b/GRUB2/MOD_SRC/grub-2.04/install.sh @@ -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 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" +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 video_fb 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" diff --git a/INSTALL/grub/grub.cfg b/INSTALL/grub/grub.cfg index c198879d..0534cabe 100644 --- a/INSTALL/grub/grub.cfg +++ b/INSTALL/grub/grub.cfg @@ -19,7 +19,6 @@ if [ "$grub_platform" = "pc" ]; then insmod setkey insmod regexp - insmod video_fb fi function ventoy_pause {