From 40fdfa66b93c3b065b2af50aac5bd67d35693912 Mon Sep 17 00:00:00 2001 From: longpanda Date: Wed, 21 Oct 2020 17:45:44 +0800 Subject: [PATCH] Optimization for Linux vDisk boot in Legacy BIOS mode --- INSTALL/grub/grub.cfg | 2 +- .../ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c | 6 ++++++ .../src/arch/x86/interface/pcbios/ventoy_int13.c | 2 +- IPXE/ipxe_mod_code/ipxe-3fe683e/src/include/ventoy.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/INSTALL/grub/grub.cfg b/INSTALL/grub/grub.cfg index 51a2ee65..4025f35d 100644 --- a/INSTALL/grub/grub.cfg +++ b/INSTALL/grub/grub.cfg @@ -1046,7 +1046,7 @@ function vtoyboot_common_func { if [ -n "$vtoy_chain_mem_addr" ]; then if [ "$grub_platform" = "pc" ]; then vt_acpi_param ${vtoy_chain_mem_addr} 512 - linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} + linux16 $vtoy_path/ipxe.krn ${vtdebug_flag} bios80 sector512 mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size} boot else ventoy_acpi_param ${vtoy_chain_mem_addr} 512 diff --git a/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c b/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c index 14c6cb06..0224b8ab 100644 --- a/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c +++ b/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c @@ -26,6 +26,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); int g_debug = 0; int g_hddmode = 0; +int g_bios_disk80 = 0; char *g_cmdline_copy; void *g_initrd_addr; size_t g_initrd_len; @@ -697,6 +698,11 @@ int ventoy_boot_vdisk(void *data) { g_hddmode = 1; } + + if (strstr(g_cmdline_copy, "bios80")) + { + g_bios_disk80 = 1; + } g_chain = (ventoy_chain_head *)g_initrd_addr; g_chunk = (ventoy_img_chunk *)((char *)g_chain + g_chain->img_chunk_offset); diff --git a/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/interface/pcbios/ventoy_int13.c b/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/interface/pcbios/ventoy_int13.c index cf6fc95b..75960c2b 100644 --- a/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/interface/pcbios/ventoy_int13.c +++ b/IPXE/ipxe_mod_code/ipxe-3fe683e/src/arch/x86/interface/pcbios/ventoy_int13.c @@ -1425,7 +1425,7 @@ unsigned int ventoy_int13_hook (ventoy_chain_head *chain) if (g_hddmode) { - natural_drive = num_drives | 0x80; + natural_drive = g_bios_disk80 ? 0x80 : (num_drives | 0x80); } else { diff --git a/IPXE/ipxe_mod_code/ipxe-3fe683e/src/include/ventoy.h b/IPXE/ipxe_mod_code/ipxe-3fe683e/src/include/ventoy.h index 9bb1b3fa..b10534d4 100644 --- a/IPXE/ipxe_mod_code/ipxe-3fe683e/src/include/ventoy.h +++ b/IPXE/ipxe_mod_code/ipxe-3fe683e/src/include/ventoy.h @@ -187,6 +187,7 @@ typedef struct ventoy_sector_flag extern int g_debug; extern int g_hddmode; +extern int g_bios_disk80; extern char *g_cmdline_copy; extern void *g_initrd_addr; extern size_t g_initrd_len;