Skip to content

Commit

Permalink
1.0.06 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed Apr 18, 2020
1 parent 63e9825 commit 45d15a7
Show file tree
Hide file tree
Showing 13 changed files with 1,193 additions and 28 deletions.
966 changes: 966 additions & 0 deletions GRUB2/grub-2.04/grub-core/kern/efi/efi.c

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions GRUB2/grub-2.04/include/grub/efi/efi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/* efi.h - declare variables and functions for EFI support */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef GRUB_EFI_EFI_HEADER
#define GRUB_EFI_EFI_HEADER 1

#include <grub/types.h>
#include <grub/dl.h>
#include <grub/efi/api.h>

/* Functions. */
void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
void *registration);
grub_efi_handle_t *
EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t search_type,
grub_efi_guid_t *protocol,
void *search_key,
grub_efi_uintn_t *num_handles);
void *EXPORT_FUNC(grub_efi_open_protocol) (grub_efi_handle_t handle,
grub_efi_guid_t *protocol,
grub_efi_uint32_t attributes);
int EXPORT_FUNC(grub_efi_set_text_mode) (int on);
void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
void *
EXPORT_FUNC(grub_efi_allocate_pages_real) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages,
grub_efi_allocate_type_t alloctype,
grub_efi_memory_type_t memtype);
void *
EXPORT_FUNC(grub_efi_allocate_fixed) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
void *
EXPORT_FUNC(grub_efi_allocate_any_pages) (grub_efi_uintn_t pages);
void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
grub_efi_uintn_t pages);
grub_efi_uintn_t EXPORT_FUNC(grub_efi_find_mmap_size) (void);
int
EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
grub_efi_memory_descriptor_t *memory_map,
grub_efi_uintn_t *map_key,
grub_efi_uintn_t *descriptor_size,
grub_efi_uint32_t *descriptor_version);
void grub_efi_memory_fini (void);
grub_efi_loaded_image_t *EXPORT_FUNC(grub_efi_get_loaded_image) (grub_efi_handle_t image_handle);
void EXPORT_FUNC(grub_efi_print_device_path) (grub_efi_device_path_t *dp);
char *EXPORT_FUNC(grub_efi_get_filename) (grub_efi_device_path_t *dp);
grub_efi_device_path_t *
EXPORT_FUNC(grub_efi_get_device_path) (grub_efi_handle_t handle);
grub_efi_device_path_t *
EXPORT_FUNC(grub_efi_find_last_device_path) (const grub_efi_device_path_t *dp);
grub_efi_device_path_t *
EXPORT_FUNC(grub_efi_duplicate_device_path) (const grub_efi_device_path_t *dp);
grub_err_t EXPORT_FUNC (grub_efi_finish_boot_services) (grub_efi_uintn_t *outbuf_size, void *outbuf,
grub_efi_uintn_t *map_key,
grub_efi_uintn_t *efi_desc_size,
grub_efi_uint32_t *efi_desc_version);
grub_err_t EXPORT_FUNC (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memory_map_size,
grub_efi_uintn_t descriptor_size,
grub_efi_uint32_t descriptor_version,
grub_efi_memory_descriptor_t *virtual_map);
void *EXPORT_FUNC (grub_efi_get_variable) (const char *variable,
const grub_efi_guid_t *guid,
grub_size_t *datasize_out);
grub_err_t
EXPORT_FUNC (grub_efi_set_variable) (const char *var,
const grub_efi_guid_t *guid,
void *data,
grub_size_t datasize);
int
EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
const grub_efi_device_path_t *dp2);

void * EXPORT_FUNC (grub_efi_allocate_iso_buf) (grub_uint64_t size);


extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
char **device,
char **path);

#if defined(__arm__) || defined(__aarch64__) || defined(__riscv)
void *EXPORT_FUNC(grub_efi_get_firmware_fdt)(void);
grub_err_t EXPORT_FUNC(grub_efi_get_ram_base)(grub_addr_t *);
#include <grub/cpu/linux.h>
grub_err_t grub_arch_efi_linux_check_image(struct linux_arch_kernel_header *lh);
grub_err_t grub_arch_efi_linux_boot_image(grub_addr_t addr, grub_size_t size,
char *args);
#endif

grub_addr_t grub_efi_modules_addr (void);

void grub_efi_mm_init (void);
void grub_efi_mm_fini (void);
void grub_efi_init (void);
void grub_efi_fini (void);
void grub_efi_set_prefix (void);

/* Variables. */
extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
extern grub_efi_handle_t EXPORT_VAR(grub_efi_image_handle);

extern int EXPORT_VAR(grub_efi_is_finished);

struct grub_net_card;

grub_efi_handle_t
grub_efinet_get_device_handle (struct grub_net_card *card);

#endif /* ! GRUB_EFI_EFI_HEADER */
79 changes: 55 additions & 24 deletions IMG/cpio/ventoy/hook/debian/ventoy-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,69 @@

. $VTOY_PATH/hook/ventoy-os-lib.sh

DISTRO='default'

if [ -d /KNOPPIX ]; then
DISTRO='knoppix'
elif [ -e /etc/initrd-release ]; then
if $EGREP -q "ID=.*antix|ID=.*mx" /etc/initrd-release; then
DISTRO='antix'
fi
fi

if [ -e /init ]; then
if $GREP -q PUPPYSFS /init; then
if $GREP -q VEKETSFS /init; then
DISTRO='veket'
else
DISTRO='puppy'
ventoy_get_debian_distro() {
if [ -d /KNOPPIX ]; then
echo 'knoppix'; return
elif [ -e /etc/initrd-release ]; then
if $EGREP -q "ID=.*antix|ID=.*mx" /etc/initrd-release; then
echo 'antix'; return
fi
fi
if [ -e /init ]; then
if $GREP -q PUPPYSFS /init; then
if $GREP -q VEKETSFS /init; then
echo 'veket'; return
else
echo 'puppy'; return
fi
fi
fi
fi

if [ -e /etc/os-release ]; then
if $GREP -q 'Tails' /etc/os-release; then
DISTRO='tails'
if [ -e /etc/os-release ]; then
if $GREP -q 'Tails' /etc/os-release; then
echo 'tails'; return
fi
fi
fi

if [ "$DISTRO"="default" ]; then
if $GREP -q 'slax/' /proc/cmdline; then
DISTRO='slax'
echo 'slax'; return
fi

if $GREP -q 'PVE ' /proc/version; then
echo 'pve'; return
fi

if $GREP -q '[Dd]eepin' /proc/version; then
echo 'deepin'; return
fi
fi

if $GREP -q '[Uu][Oo][Ss] ' /proc/version; then
echo 'deepin'; return
fi

if [ -d /porteus ]; then
echo 'porteus'; return
fi

if $GREP -q 'porteus' /proc/version; then
echo 'porteus'; return
fi

echo 'default'
}

DISTRO=$(ventoy_get_debian_distro)

echo "##### distribution = $DISTRO ######" >> $VTLOG
. $VTOY_PATH/hook/debian/${DISTRO}-hook.sh










15 changes: 14 additions & 1 deletion IMG/cpio/ventoy/init
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ ventoy_unpack_initramfs() {
vtfile=$1; vtskip=$2; vtmagic=$3; vttmp=$4
echo "=====ventoy_unpack_initramfs: #$*#" >> $VTLOG

#special process
#if [ "${vtmagic:0:4}" = '5678' ]; then
# echo -en '\x1F\x8B' | dd status=none of=$vtfile bs=1 count=2 conv=notrunc
# vtmagic='1F8B'
#fi

for vtx in '1F8B zcat' '1F9E zcat' '425A bzcat' '5D00 lzcat' 'FD37 xzcat' '894C lzopcat' '0221 lz4cat' '28B5 zstdcat' '3037 cat'; do
if [ "${vtx:0:4}" = "${vtmagic:0:4}" ]; then
echo "vtx=$vtx" >> $VTLOG
Expand Down Expand Up @@ -100,12 +106,19 @@ export EXTRACT_UNSAFE_SYMLINKS=1

# special process
need_xzminidec() {
testmagic=$(hexdump -n 2 -e '2/1 "%02X"' /initrd001)
if [ -e /initrd001 ]; then
testmagic=$(hexdump -n 2 -e '2/1 "%02X"' /initrd001)
else
testmagic='xxxx'
fi

if [ "FD37" = "${testmagic:0:4}" ]; then
if echo $vtkerver | grep -q 'kaspersky'; then
true
elif echo $vtkerver | grep -q 'kiosk.*Gentoo'; then
true
elif echo $vtkerver | grep -q 'porteus '; then
true
else
false
fi
Expand Down
7 changes: 7 additions & 0 deletions IMG/cpio/ventoy/ventoy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ ventoy_get_os_type() {
fi
fi

if $EGREP -q 'ALT ' /proc/version; then
echo 'alt'; return
fi

if $EGREP -q 'porteus' /proc/version; then
echo 'debian'; return
fi

echo "default"
}
Expand Down
13 changes: 10 additions & 3 deletions INSTALL/grub/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ function distro_specify_initrd_file {
vt_linux_specify_initrd_file /pmagic/initrd.img
elif [ -e (loop)/boot/initrd.xz ]; then
vt_linux_specify_initrd_file /boot/initrd.xz
elif [ -f (loop)/boot/initrd ]; then
vt_linux_specify_initrd_file /boot/initrd

fi
}

Expand Down Expand Up @@ -127,6 +130,11 @@ function uefi_linux_menu_func {
vt_linux_parse_initrd_grub dir (loop)/boot/grub/
fi

if [ -e (loop)/syslinux/alt0/full.cz ]; then
set LoadIsoEfiDriver=on
set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
fi

distro_specify_initrd_file

locate_initrd
Expand All @@ -136,7 +144,7 @@ function uefi_linux_menu_func {

if [ -n "$vtoy_chain_mem_addr" ]; then
terminal_output console
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
chainloader ${vtoy_path}/ventoy_x64.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
echo "chain empty failed"
Expand Down Expand Up @@ -209,7 +217,6 @@ function uefi_iso_memdisk {




function legacy_windows_menu_func {
vt_windows_reset

Expand Down Expand Up @@ -348,7 +355,7 @@ function legacy_iso_memdisk {
#############################################################
#############################################################

set VENTOY_VERSION="1.0.05"
set VENTOY_VERSION="1.0.06"

#disable timeout
unset timeout
Expand Down
Binary file modified INSTALL/ventoy/ipxe.krn
Binary file not shown.
Binary file modified INSTALL/ventoy/ventoy.cpio
Binary file not shown.
Binary file modified INSTALL/ventoy/ventoy_x64.efi
Binary file not shown.
12 changes: 12 additions & 0 deletions IPXE/ipxe-3fe683e/src/include/ventoy.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ typedef struct ventoy_sector_flag

#define VENTOY_BIOS_FAKE_DRIVE 0xFE

extern int g_debug;
extern char *g_cmdline_copy;
extern void *g_initrd_addr;
extern size_t g_initrd_len;
Expand Down Expand Up @@ -208,6 +209,17 @@ struct smbios3_entry {
} __attribute__ (( packed ));


typedef struct isolinux_boot_info
{
uint32_t isolinux0;
uint32_t isolinux1;
uint32_t PvdLocation;
uint32_t BootFileLocation;
uint32_t BootFileLen;
uint32_t BootFileChecksum;
uint8_t Reserved[40];
}isolinux_boot_info;

//#undef DBGLVL
//#define DBGLVL 7

Expand Down
5 changes: 5 additions & 0 deletions VtoyTool/vtoydump.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
{
cnt = vtoy_find_disk_by_guid(param->vtoy_disk_guid, diskname);
}
else if (cnt == 0)
{
cnt = vtoy_find_disk_by_guid(param->vtoy_disk_guid, diskname);
debug("find 0 disk by size, try with guid cnt=%d...\n", cnt);
}

if (param->vtoy_disk_part_type == 0)
{
Expand Down
Binary file modified VtoyTool/vtoytool/00/vtoytool_32
Binary file not shown.
Binary file modified VtoyTool/vtoytool/00/vtoytool_64
Binary file not shown.

0 comments on commit 45d15a7

Please sign in to comment.