Skip to content

Commit

Permalink
1. Boot menu over serial supported
Browse files Browse the repository at this point in the history
2. Optimization for booting Solus
3. Optimization for booting .efi file
4. support deepin-live iso
5. support Endless OS
6. framework for booting .img file
  • Loading branch information
ventoy committed Aug 7, 2020
1 parent 433d854 commit be50ea6
Show file tree
Hide file tree
Showing 54 changed files with 7,364 additions and 255 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ EFI_STATUS EFIAPI ventoy_save_ramdisk_param(VOID)
Status = gRT->SetVariable(L"VentoyRamDisk", &VarGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(g_ramdisk_param), &(g_ramdisk_param));
debug("set efi variable %r", Status);
debug("set ramdisk variable %r", Status);

return Status;
}
Expand Down Expand Up @@ -663,17 +663,22 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
size = StrDecimalToUintn(pPos + 5);

debug("memory addr:%p size:%lu", chain, size);

g_chain = AllocatePool(size);
CopyMem(g_chain, chain, size);

if (StrStr(pCmdLine, L"memdisk"))
{
g_iso_buf_size = size;
g_iso_data_buf = (UINT8 *)chain + sizeof(ventoy_chain_head);
g_iso_buf_size = size - sizeof(ventoy_chain_head);
debug("memdisk mode iso_buf_size:%u", g_iso_buf_size);

g_chain = chain;
gMemdiskMode = TRUE;
}
else
{
debug("This is normal mode");
g_chain = AllocatePool(size);
CopyMem(g_chain, chain, size);

g_chunk = (ventoy_img_chunk *)((char *)g_chain + g_chain->img_chunk_offset);
g_img_chunk_num = g_chain->img_chunk_num;
g_override_chunk = (ventoy_override_chunk *)((char *)g_chain + g_chain->override_chunk_offset);
Expand Down Expand Up @@ -725,6 +730,8 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
}
}

ventoy_debug_pause();

FreePool(pCmdLine);
return EFI_SUCCESS;
}
Expand Down Expand Up @@ -942,15 +949,29 @@ EFI_STATUS EFIAPI VentoyEfiMain

if (gMemdiskMode)
{
g_ramdisk_param.PhyAddr = (UINT64)(UINTN)g_chain;
g_ramdisk_param.PhyAddr = (UINT64)(UINTN)g_iso_data_buf;
g_ramdisk_param.DiskSize = (UINT64)g_iso_buf_size;

ventoy_save_ramdisk_param();

if (gLoadIsoEfi)
{
ventoy_find_iso_disk(ImageHandle);
ventoy_find_iso_disk_fs(ImageHandle);
ventoy_load_isoefi_driver(ImageHandle);
}

ventoy_install_blockio(ImageHandle, g_iso_buf_size);
ventoy_debug_pause();

Status = ventoy_boot(ImageHandle);

ventoy_delete_ramdisk_param();

if (gLoadIsoEfi && gBlockData.IsoDriverImage)
{
gBS->UnloadImage(gBlockData.IsoDriverImage);
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ extern ventoy_sector_flag *g_sector_flag;
extern UINT32 g_sector_flag_num;
extern BOOLEAN gMemdiskMode;
extern UINTN g_iso_buf_size;
extern UINT8 *g_iso_data_buf;
extern ventoy_grub_param_file_replace *g_file_replace_list;
extern BOOLEAN g_fixup_iso9660_secover_enable;
extern EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *g_con_simple_input_ex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <Protocol/SimpleFileSystem.h>
#include <Ventoy.h>

UINT8 *g_iso_data_buf = NULL;
UINTN g_iso_buf_size = 0;
BOOLEAN gMemdiskMode = FALSE;

Expand Down Expand Up @@ -254,7 +255,7 @@ EFI_STATUS EFIAPI ventoy_block_io_ramdisk_read
(VOID)This;
(VOID)MediaId;

CopyMem(Buffer, (char *)g_chain + (Lba * 2048), BufferSize);
CopyMem(Buffer, g_iso_data_buf + (Lba * 2048), BufferSize);

if (g_blockio_start_record_bcd && FALSE == g_blockio_bcd_read_done)
{
Expand Down
11 changes: 11 additions & 0 deletions GRUB2/MOD_SRC/grub-2.04/grub-core/Makefile.core.def
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,16 @@ module = {
common = commands/blocklist.c;
};

module = {
name = blscfg;
common = commands/blscfg.c;
common = commands/loadenv.h;
enable = powerpc_ieee1275;
enable = efi;
enable = i386_pc;
enable = emu;
};

module = {
name = boot;
common = commands/boot.c;
Expand Down Expand Up @@ -986,6 +996,7 @@ module = {
module = {
name = loadenv;
common = commands/loadenv.c;
common = commands/loadenv.h;
common = lib/envblk.c;
};

Expand Down
Loading

0 comments on commit be50ea6

Please sign in to comment.