Commit 45d15a76 authored by longpanda's avatar longpanda
Browse files

1.0.06 release

parent 63e9825d
This diff is collapsed.
/* 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 */
...@@ -19,38 +19,69 @@ ...@@ -19,38 +19,69 @@
. $VTOY_PATH/hook/ventoy-os-lib.sh . $VTOY_PATH/hook/ventoy-os-lib.sh
DISTRO='default' ventoy_get_debian_distro() {
if [ -d /KNOPPIX ]; then
if [ -d /KNOPPIX ]; then echo 'knoppix'; return
DISTRO='knoppix' elif [ -e /etc/initrd-release ]; then
elif [ -e /etc/initrd-release ]; then
if $EGREP -q "ID=.*antix|ID=.*mx" /etc/initrd-release; then if $EGREP -q "ID=.*antix|ID=.*mx" /etc/initrd-release; then
DISTRO='antix' echo 'antix'; return
fi
fi fi
fi
if [ -e /init ]; then if [ -e /init ]; then
if $GREP -q PUPPYSFS /init; then if $GREP -q PUPPYSFS /init; then
if $GREP -q VEKETSFS /init; then if $GREP -q VEKETSFS /init; then
DISTRO='veket' echo 'veket'; return
else else
DISTRO='puppy' echo 'puppy'; return
fi
fi fi
fi fi
fi
if [ -e /etc/os-release ]; then if [ -e /etc/os-release ]; then
if $GREP -q 'Tails' /etc/os-release; then if $GREP -q 'Tails' /etc/os-release; then
DISTRO='tails' echo 'tails'; return
fi
fi fi
fi
if [ "$DISTRO"="default" ]; then
if $GREP -q 'slax/' /proc/cmdline; then if $GREP -q 'slax/' /proc/cmdline; then
DISTRO='slax' echo 'slax'; return
fi fi
fi
if $GREP -q 'PVE ' /proc/version; then
echo 'pve'; return
fi
if $GREP -q '[Dd]eepin' /proc/version; then
echo 'deepin'; return
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 echo "##### distribution = $DISTRO ######" >> $VTLOG
. $VTOY_PATH/hook/debian/${DISTRO}-hook.sh . $VTOY_PATH/hook/debian/${DISTRO}-hook.sh
...@@ -67,6 +67,12 @@ ventoy_unpack_initramfs() { ...@@ -67,6 +67,12 @@ ventoy_unpack_initramfs() {
vtfile=$1; vtskip=$2; vtmagic=$3; vttmp=$4 vtfile=$1; vtskip=$2; vtmagic=$3; vttmp=$4
echo "=====ventoy_unpack_initramfs: #$*#" >> $VTLOG 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 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 if [ "${vtx:0:4}" = "${vtmagic:0:4}" ]; then
echo "vtx=$vtx" >> $VTLOG echo "vtx=$vtx" >> $VTLOG
...@@ -100,12 +106,19 @@ export EXTRACT_UNSAFE_SYMLINKS=1 ...@@ -100,12 +106,19 @@ export EXTRACT_UNSAFE_SYMLINKS=1
# special process # special process
need_xzminidec() { need_xzminidec() {
if [ -e /initrd001 ]; then
testmagic=$(hexdump -n 2 -e '2/1 "%02X"' /initrd001) testmagic=$(hexdump -n 2 -e '2/1 "%02X"' /initrd001)
else
testmagic='xxxx'
fi
if [ "FD37" = "${testmagic:0:4}" ]; then if [ "FD37" = "${testmagic:0:4}" ]; then
if echo $vtkerver | grep -q 'kaspersky'; then if echo $vtkerver | grep -q 'kaspersky'; then
true true
elif echo $vtkerver | grep -q 'kiosk.*Gentoo'; then elif echo $vtkerver | grep -q 'kiosk.*Gentoo'; then
true true
elif echo $vtkerver | grep -q 'porteus '; then
true
else else
false false
fi fi
......
...@@ -148,6 +148,13 @@ ventoy_get_os_type() { ...@@ -148,6 +148,13 @@ ventoy_get_os_type() {
fi fi
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" echo "default"
} }
......
...@@ -74,6 +74,9 @@ function distro_specify_initrd_file { ...@@ -74,6 +74,9 @@ function distro_specify_initrd_file {
vt_linux_specify_initrd_file /pmagic/initrd.img vt_linux_specify_initrd_file /pmagic/initrd.img
elif [ -e (loop)/boot/initrd.xz ]; then elif [ -e (loop)/boot/initrd.xz ]; then
vt_linux_specify_initrd_file /boot/initrd.xz vt_linux_specify_initrd_file /boot/initrd.xz
elif [ -f (loop)/boot/initrd ]; then
vt_linux_specify_initrd_file /boot/initrd
fi fi
} }
...@@ -127,6 +130,11 @@ function uefi_linux_menu_func { ...@@ -127,6 +130,11 @@ function uefi_linux_menu_func {
vt_linux_parse_initrd_grub dir (loop)/boot/grub/ vt_linux_parse_initrd_grub dir (loop)/boot/grub/
fi fi
if [ -e (loop)/syslinux/alt0/full.cz ]; then
set LoadIsoEfiDriver=on
set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
fi
distro_specify_initrd_file distro_specify_initrd_file
locate_initrd locate_initrd
...@@ -136,7 +144,7 @@ function uefi_linux_menu_func { ...@@ -136,7 +144,7 @@ function uefi_linux_menu_func {
if [ -n "$vtoy_chain_mem_addr" ]; then if [ -n "$vtoy_chain_mem_addr" ]; then
terminal_output console 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 boot
else else
echo "chain empty failed" echo "chain empty failed"
...@@ -209,7 +217,6 @@ function uefi_iso_memdisk { ...@@ -209,7 +217,6 @@ function uefi_iso_memdisk {
function legacy_windows_menu_func { function legacy_windows_menu_func {
vt_windows_reset vt_windows_reset
...@@ -348,7 +355,7 @@ function legacy_iso_memdisk { ...@@ -348,7 +355,7 @@ function legacy_iso_memdisk {
############################################################# #############################################################
############################################################# #############################################################
set VENTOY_VERSION="1.0.05" set VENTOY_VERSION="1.0.06"
#disable timeout #disable timeout
unset timeout unset timeout
......
No preview for this file type
...@@ -163,6 +163,7 @@ typedef struct ventoy_sector_flag ...@@ -163,6 +163,7 @@ typedef struct ventoy_sector_flag
#define VENTOY_BIOS_FAKE_DRIVE 0xFE #define VENTOY_BIOS_FAKE_DRIVE 0xFE
extern int g_debug;
extern char *g_cmdline_copy; extern char *g_cmdline_copy;
extern void *g_initrd_addr; extern void *g_initrd_addr;
extern size_t g_initrd_len; extern size_t g_initrd_len;
...@@ -208,6 +209,17 @@ struct smbios3_entry { ...@@ -208,6 +209,17 @@ struct smbios3_entry {
} __attribute__ (( packed )); } __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 //#undef DBGLVL
//#define DBGLVL 7 //#define DBGLVL 7
......
...@@ -389,6 +389,11 @@ static int vtoy_print_os_param(ventoy_os_param *param, char *diskname) ...@@ -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); 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) if (param->vtoy_disk_part_type == 0)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment