mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-09-17 09:21:15 +00:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
65a2cb1685 | ||
|
e23e76f54e | ||
|
8ded032c92 | ||
|
fc5cd0a00a | ||
|
6cc400b8d4 | ||
|
ffc915ca53 | ||
|
8ebe972f6e | ||
|
39975dd1c3 | ||
|
1a648d8689 | ||
|
8234961228 | ||
|
e1ffbad431 | ||
|
4a66104c6e | ||
|
32bcd8f87b | ||
|
26c1756e8d |
@@ -28,6 +28,7 @@
|
||||
|
||||
extern int g_ventoy_memdisk_mode;
|
||||
extern int g_ventoy_iso_raw;
|
||||
extern int g_ventoy_grub2_mode;
|
||||
extern int g_ventoy_iso_uefi_drv;
|
||||
|
||||
static const char *align_options[] =
|
||||
@@ -205,6 +206,9 @@ label_set_property (void *vself, const char *name, const char *value)
|
||||
else if (grub_strcmp (value, "@VTOY_ISO_RAW@") == 0) {
|
||||
value = g_ventoy_iso_raw ? grub_env_get("VTOY_ISO_RAW_STR") : " ";
|
||||
}
|
||||
else if (grub_strcmp (value, "@VTOY_GRUB2_MODE@") == 0) {
|
||||
value = g_ventoy_grub2_mode ? grub_env_get("VTOY_GRUB2_MODE_STR") : " ";
|
||||
}
|
||||
else if (grub_strcmp (value, "@VTOY_ISO_UEFI_DRV@") == 0) {
|
||||
value = g_ventoy_iso_uefi_drv ? grub_env_get("VTOY_ISO_UEFI_DRV_STR") : " ";
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@
|
||||
int g_ventoy_menu_refresh = 0;
|
||||
int g_ventoy_memdisk_mode = 0;
|
||||
int g_ventoy_iso_raw = 0;
|
||||
int g_ventoy_grub2_mode = 0;
|
||||
int g_ventoy_iso_uefi_drv = 0;
|
||||
int g_ventoy_last_entry = -1;
|
||||
int g_ventoy_suppress_esc = 0;
|
||||
@@ -897,6 +898,12 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
|
||||
case (GRUB_TERM_CTRL | 'r'):
|
||||
menu_fini ();
|
||||
g_ventoy_grub2_mode = 1 - g_ventoy_grub2_mode;
|
||||
g_ventoy_menu_refresh = 1;
|
||||
goto refresh;
|
||||
|
||||
case (GRUB_TERM_CTRL | 'u'):
|
||||
menu_fini ();
|
||||
g_ventoy_iso_uefi_drv = 1 - g_ventoy_iso_uefi_drv;
|
||||
|
@@ -3023,6 +3023,10 @@ static grub_err_t ventoy_cmd_check_mode(grub_extcmd_context_t ctxt, int argc, ch
|
||||
{
|
||||
return g_ventoy_iso_uefi_drv ? 0 : 1;
|
||||
}
|
||||
else if (args[0][0] == '3')
|
||||
{
|
||||
return g_ventoy_grub2_mode ? 0 : 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -3461,6 +3465,35 @@ static grub_err_t ventoy_cmd_check_secureboot_var(grub_extcmd_context_t ctxt, in
|
||||
}
|
||||
#endif
|
||||
|
||||
static grub_err_t ventoy_cmd_clear_key(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
(void)ctxt;
|
||||
(void)argc;
|
||||
(void)args;
|
||||
|
||||
for (i = 0; i < 500; i++)
|
||||
{
|
||||
ret = grub_getkey_noblock();
|
||||
if (ret == GRUB_TERM_NO_KEY)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= 500)
|
||||
{
|
||||
grub_cls();
|
||||
grub_printf("\n\n Still have key input after clear.\n");
|
||||
grub_refresh();
|
||||
grub_sleep(5);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t ventoy_cmd_acpi_param(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
int i;
|
||||
@@ -4341,6 +4374,7 @@ static cmd_para ventoy_cmds[] =
|
||||
{ "vt_img_unhook_root", ventoy_cmd_img_unhook_root, 0, NULL, "", "", NULL },
|
||||
{ "vt_acpi_param", ventoy_cmd_acpi_param, 0, NULL, "", "", NULL },
|
||||
{ "vt_check_secureboot_var", ventoy_cmd_check_secureboot_var, 0, NULL, "", "", NULL },
|
||||
{ "vt_clear_key", ventoy_cmd_clear_key, 0, NULL, "", "", NULL },
|
||||
|
||||
};
|
||||
|
||||
|
@@ -390,6 +390,15 @@ typedef struct wim_security_header
|
||||
grub_uint32_t count; /* Number of entries */
|
||||
}wim_security_header;
|
||||
|
||||
typedef struct wim_stream_entry
|
||||
{
|
||||
grub_uint64_t len;
|
||||
grub_uint64_t unused1;
|
||||
wim_hash hash;
|
||||
grub_uint16_t name_len;
|
||||
/* name */
|
||||
}wim_stream_entry;
|
||||
|
||||
/* Directory entry */
|
||||
typedef struct wim_directory_entry
|
||||
{
|
||||
@@ -903,6 +912,7 @@ extern int g_ventoy_suppress_esc;
|
||||
extern int g_ventoy_last_entry;
|
||||
extern int g_ventoy_memdisk_mode;
|
||||
extern int g_ventoy_iso_raw;
|
||||
extern int g_ventoy_grub2_mode;
|
||||
extern int g_ventoy_iso_uefi_drv;
|
||||
extern int g_ventoy_case_insensitive;
|
||||
extern grub_uint8_t g_ventoy_chain_type;
|
||||
|
@@ -636,6 +636,21 @@ static wim_lookup_entry * ventoy_find_meta_entry(wim_header *header, wim_lookup_
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static grub_uint64_t ventoy_get_stream_len(wim_directory_entry *dir)
|
||||
{
|
||||
grub_uint16_t i;
|
||||
grub_uint64_t offset = 0;
|
||||
wim_stream_entry *stream = (wim_stream_entry *)((char *)dir + dir->len);
|
||||
|
||||
for (i = 0; i < dir->streams; i++)
|
||||
{
|
||||
offset += stream->len;
|
||||
stream = (wim_stream_entry *)((char *)stream + stream->len);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static int ventoy_update_all_hash(wim_patch *patch, void *meta_data, wim_directory_entry *dir)
|
||||
{
|
||||
if ((meta_data == NULL) || (dir == NULL))
|
||||
@@ -660,8 +675,15 @@ static int ventoy_update_all_hash(wim_patch *patch, void *meta_data, wim_directo
|
||||
{
|
||||
ventoy_update_all_hash(patch, meta_data, (wim_directory_entry *)((char *)meta_data + dir->subdir));
|
||||
}
|
||||
|
||||
dir = (wim_directory_entry *)((char *)dir + dir->len);
|
||||
|
||||
if (dir->streams)
|
||||
{
|
||||
dir = (wim_directory_entry *)((char *)dir + dir->len + ventoy_get_stream_len(dir));
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = (wim_directory_entry *)((char *)dir + dir->len);
|
||||
}
|
||||
} while (dir->len >= sizeof(wim_directory_entry));
|
||||
|
||||
return 0;
|
||||
@@ -860,7 +882,14 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
|
||||
}
|
||||
|
||||
security = (wim_security_header *)decompress_data;
|
||||
rootdir = (wim_directory_entry *)(decompress_data + ((security->len + 7) & 0xFFFFFFF8U));
|
||||
if (security->len > 0)
|
||||
{
|
||||
rootdir = (wim_directory_entry *)(decompress_data + ((security->len + 7) & 0xFFFFFFF8U));
|
||||
}
|
||||
else
|
||||
{
|
||||
rootdir = (wim_directory_entry *)(decompress_data + 8);
|
||||
}
|
||||
|
||||
/* search winpeshl.exe dirent entry */
|
||||
search = search_replace_wim_dirent(decompress_data, rootdir);
|
||||
|
@@ -61,3 +61,7 @@ else
|
||||
|
||||
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k"
|
||||
fi
|
||||
|
||||
if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
|
||||
$SED "1 aexport cow_label=vtoycow" -i /init
|
||||
fi
|
||||
|
@@ -26,3 +26,13 @@ ventoy_add_udev_rule "$VTOY_PATH/hook/rhel6/udev_disk_hook.sh %k"
|
||||
|
||||
#loop7 was used by loader
|
||||
ventoy_add_kernel_udev_rule "loop6" "$VTOY_PATH/hook/rhel6/udev_disk_hook.sh %k"
|
||||
|
||||
if [ -f $VTOY_PATH/autoinstall ]; then
|
||||
$BUSYBOX_PATH/mv /sbin/loader /sbin/loader_bk
|
||||
$BUSYBOX_PATH/mv $VTOY_PATH/tool/loader /sbin/loader
|
||||
|
||||
RawCmdLine=$($BUSYBOX_PATH/cat /proc/cmdline)
|
||||
echo -n "/sbin/loader_bk" > "/ventoy/loader_exec_file"
|
||||
echo -n "--cmdline=$RawCmdLine ks=file:$VTOY_PATH/autoinstall" > "/ventoy/loader_exec_cmdline"
|
||||
#echo 111 > "/ventoy/loader_debug"
|
||||
fi
|
||||
|
@@ -40,7 +40,25 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
echo "VTKS=$VTKS" >> $VTLOG
|
||||
if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
|
||||
VTOVERLAY="rd.live.overlay=/dev/dm-1:/vtoyoverlayfs/overlayfs"
|
||||
|
||||
if [ -e /sbin/dmsquash-live-root ]; then
|
||||
echo "patch /sbin/dmsquash-live-root for persistent ..." >> $VTLOG
|
||||
$SED "/mount.*devspec.*\/run\/initramfs\/overlayfs/a . /ventoy/hook/rhel7/ventoy-overlay.sh" -i /sbin/dmsquash-live-root
|
||||
fi
|
||||
|
||||
#close selinux
|
||||
$BUSYBOX_PATH/mkdir -p $VTOY_PATH/selinuxfs
|
||||
if $BUSYBOX_PATH/mount -t selinuxfs selinuxfs $VTOY_PATH/selinuxfs; then
|
||||
echo 1 > $VTOY_PATH/selinuxfs/disable
|
||||
$BUSYBOX_PATH/umount $VTOY_PATH/selinuxfs
|
||||
fi
|
||||
$BUSYBOX_PATH/rm -rf $VTOY_PATH/selinuxfs
|
||||
fi
|
||||
|
||||
|
||||
echo "VTKS=$VTKS VTOVERLAY=$VTOVERLAY" >> $VTLOG
|
||||
|
||||
if ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
|
||||
for vtDud in $(ls $VTOY_PATH/ventoy_dud*); do
|
||||
@@ -50,9 +68,9 @@ fi
|
||||
echo "vtInstDD=$vtInstDD" >> $VTLOG
|
||||
|
||||
if $GREP -q 'root=live' /proc/cmdline; then
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=live:/dev/dm-0 $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
else
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE inst.stage2=hd:/dev/dm-0 $VTKS $VTOVERLAY $vtInstDD#" -i /lib/dracut-lib.sh
|
||||
fi
|
||||
|
||||
ventoy_set_inotify_script rhel7/ventoy-inotifyd-hook.sh
|
||||
|
21
IMG/cpio/ventoy/hook/rhel7/ventoy-overlay.sh
Normal file
21
IMG/cpio/ventoy/hook/rhel7/ventoy-overlay.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
#************************************************************************************
|
||||
# Copyright (c) 2020, longpanda <admin@ventoy.net>
|
||||
#
|
||||
# This program 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.
|
||||
#
|
||||
# This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
[ -d /run/initramfs/overlayfs$pathspec ] || mkdir -p /run/initramfs/overlayfs$pathspec
|
||||
[ -d /run/initramfs/overlayfs$pathspec/../ovlwork ] || mkdir -p /run/initramfs/overlayfs$pathspec/../ovlwork
|
@@ -2,25 +2,29 @@
|
||||
|
||||
VTOY_PATH=$PWD/..
|
||||
|
||||
cilog() {
|
||||
datestr=$(date +"%Y/%m/%d %H:%M:%S")
|
||||
echo "$datestr $*"
|
||||
}
|
||||
|
||||
LOG=$VTOY_PATH/DOC/build.log
|
||||
[ -f $LOG ] && rm -f $LOG
|
||||
|
||||
cd $VTOY_PATH/DOC
|
||||
echo "prepare_env ..."
|
||||
cilog "prepare_env ..."
|
||||
sh prepare_env.sh
|
||||
|
||||
export PATH=$PATH:/opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin:/opt/aarch64--uclibc--stable-2020.08-1/bin:/opt/mips-loongson-gcc7.3-linux-gnu/2019.06-29/bin/:/opt/mips64el-linux-musl-gcc730/bin/
|
||||
|
||||
|
||||
echo "build grub2 ..."
|
||||
cilog "build grub2 ..."
|
||||
cd $VTOY_PATH/GRUB2
|
||||
sh buildgrub.sh >> $LOG 2>&1 || exit 1
|
||||
|
||||
echo "build ipxe ..."
|
||||
cilog "build ipxe ..."
|
||||
cd $VTOY_PATH/IPXE
|
||||
sh buildipxe.sh >> $LOG 2>&1 || exit 1
|
||||
|
||||
echo "build edk2 ..."
|
||||
cilog "build edk2 ..."
|
||||
cd $VTOY_PATH/EDK2
|
||||
sh buildedk.sh >> $LOG 2>&1 || exit 1
|
||||
|
||||
@@ -74,7 +78,7 @@ if [ "$1" = "CI" ]; then
|
||||
sed "s/VENTOY_VERSION=.*/VENTOY_VERSION=\"$Ver\"/" -i ./grub/grub.cfg
|
||||
fi
|
||||
|
||||
echo "packing ventoy-$Ver ..."
|
||||
cilog "packing ventoy-$Ver ..."
|
||||
sh ventoy_pack.sh $1 >> $LOG 2>&1 || exit 1
|
||||
|
||||
echo -e '\n============== SUCCESS ==================\n'
|
||||
|
@@ -2,12 +2,18 @@
|
||||
|
||||
VTOY_PATH=$PWD/..
|
||||
|
||||
wget -q -P $VTOY_PATH/DOC/ https://www.fefe.de/dietlibc/dietlibc-0.34.tar.xz
|
||||
wget -q -P $VTOY_PATH/DOC/ https://musl.libc.org/releases/musl-1.2.1.tar.gz
|
||||
wget -q -P $VTOY_PATH/GRUB2/ https://ftp.gnu.org/gnu/grub/grub-2.04.tar.xz
|
||||
date +"%Y/%m/%d %H:%M:%S"
|
||||
echo downloading envrionment ...
|
||||
|
||||
wget -q -P $VTOY_PATH/DOC/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/dietlibc-0.34.tar.xz
|
||||
wget -q -P $VTOY_PATH/DOC/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/musl-1.2.1.tar.gz
|
||||
wget -q -P $VTOY_PATH/GRUB2/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/grub-2.04.tar.xz
|
||||
wget -q -O $VTOY_PATH/EDK2/edk2-edk2-stable201911.zip https://codeload.github.com/tianocore/edk2/zip/edk2-stable201911
|
||||
wget -q -P /opt/ https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
|
||||
wget -q -P /opt/ https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--uclibc--stable-2020.08-1.tar.bz2
|
||||
wget -q -P /opt/ http://ftp.loongnix.org/toolchain/gcc/release/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz
|
||||
wget -q -P /opt/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
|
||||
wget -q -P /opt/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/aarch64--uclibc--stable-2020.08-1.tar.bz2
|
||||
wget -q -P /opt/ https://github.com/ventoy/vtoytoolchain/releases/download/1.0/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz
|
||||
|
||||
date +"%Y/%m/%d %H:%M:%S"
|
||||
echo downloading envrionment finish...
|
||||
|
||||
sh all_in_one.sh CI
|
||||
|
@@ -648,10 +648,14 @@ function uefi_linux_menu_func {
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
ventoy_cli_console
|
||||
|
||||
if [ "$VTOY_EFI_ARCH" != "mips" ]; then
|
||||
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi fallback env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
|
||||
if vt_check_mode 3; then
|
||||
ventoy_debug_pause
|
||||
else
|
||||
if [ "$VTOY_EFI_ARCH" != "mips" ]; then
|
||||
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi fallback env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
fi
|
||||
fi
|
||||
|
||||
# fallback
|
||||
@@ -1608,7 +1612,7 @@ function img_unsupport_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.0.39"
|
||||
set VENTOY_VERSION="1.0.40"
|
||||
|
||||
#ACPI not compatible with Window7/8, so disable by default
|
||||
set VTOY_PARAM_NO_ACPI=1
|
||||
@@ -1620,6 +1624,7 @@ set VTOY_DEFAULT_MENU_MODE=0
|
||||
|
||||
set VTOY_MEM_DISK_STR="[Memdisk]"
|
||||
set VTOY_ISO_RAW_STR="Compatible Mode"
|
||||
set VTOY_GRUB2_MODE_STR="GRUB2 Mode"
|
||||
set VTOY_ISO_UEFI_DRV_STR="UEFI FS"
|
||||
|
||||
set VTOY_F2_CMD="ventoy_power"
|
||||
@@ -1771,6 +1776,8 @@ for vtTFile in ventoy.json ventoy_grub.cfg; do
|
||||
fi
|
||||
done
|
||||
|
||||
#clear all input key before show main menu
|
||||
vt_clear_key
|
||||
|
||||
#export necessary variable
|
||||
export theme
|
||||
|
@@ -70,6 +70,14 @@ terminal-box: "terminal_box_*.png"
|
||||
}
|
||||
|
||||
|
||||
+ hbox{
|
||||
left = 30%+200
|
||||
top = 95%-50
|
||||
width = 10%
|
||||
height = 25
|
||||
+ label {text = "@VTOY_GRUB2_MODE@" color = "red" align = "left"}
|
||||
}
|
||||
|
||||
+ hbox{
|
||||
left = 90%
|
||||
top = 55
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user