mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-04-19 08:55:16 +00:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2dafe75509 | ||
|
6fbc08cfcb | ||
|
6034b25cba | ||
|
c5fd64d21c | ||
|
32fac72b5b | ||
|
022322c8fa | ||
|
96f11252d9 | ||
|
004ad27e0d | ||
|
9a8dc42d93 | ||
|
6166a813ea | ||
|
786a9ec678 | ||
|
0600576c78 | ||
|
72b722c86c | ||
|
bea5607ea5 | ||
|
b3c2bcf58f | ||
|
4e8d8b2e19 | ||
|
60d88cb7b1 | ||
|
f7e6bbc70c | ||
|
ee994a0569 |
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@ -15,23 +15,23 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Run docker compose up
|
||||
run: docker compose up
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ventoy-windows
|
||||
path: INSTALL/ventoy-*windows*
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ventoy-linux
|
||||
path: INSTALL/ventoy-*linux*
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ventoy-livecd
|
||||
path: INSTALL/ventoy-*livecd*
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: SHA256SUM
|
||||
path: INSTALL/sha256.txt
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: xxx-build-log
|
||||
path: DOC/build.log
|
||||
|
@ -861,7 +861,8 @@ typedef struct vhd_footer_t
|
||||
grub_uint8_t savedst; // Saved state
|
||||
}vhd_footer_t;
|
||||
|
||||
#define VDI_IMAGE_FILE_INFO "<<< Oracle VM VirtualBox Disk Image >>>\n"
|
||||
#define VDI_IMAGE_FILE_INFO "<<< Oracle VM VirtualBox Disk Image >>>\n"
|
||||
#define VDI_IMAGE_FILE_INFO2 "<<< Oracle VirtualBox Disk Image >>>\n"
|
||||
|
||||
/** Image signature. */
|
||||
#define VDI_IMAGE_SIGNATURE (0xbeda107f)
|
||||
|
@ -536,12 +536,25 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
|
||||
{
|
||||
grub_file_seek(file, 0);
|
||||
grub_file_read(file, &vdihdr, sizeof(vdihdr));
|
||||
if (vdihdr.u32Signature == VDI_IMAGE_SIGNATURE &&
|
||||
grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO, grub_strlen(VDI_IMAGE_FILE_INFO)) == 0)
|
||||
if (vdihdr.u32Signature == VDI_IMAGE_SIGNATURE)
|
||||
{
|
||||
offset = 2 * 1048576;
|
||||
g_img_trim_head_secnum = offset / 512;
|
||||
grub_snprintf(type, sizeof(type), "vdi");
|
||||
if (grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO, grub_strlen(VDI_IMAGE_FILE_INFO)) == 0)
|
||||
{
|
||||
offset = 2 * 1048576;
|
||||
g_img_trim_head_secnum = offset / 512;
|
||||
debug("VDI V1\n");
|
||||
}
|
||||
else if (grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO2, grub_strlen(VDI_IMAGE_FILE_INFO2)) == 0)
|
||||
{
|
||||
offset = 2 * 1048576;
|
||||
g_img_trim_head_secnum = offset / 512;
|
||||
debug("VDI V2\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
debug("invalid file info <%s>\n", vdihdr.szFileInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -568,7 +581,7 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
|
||||
if (gpt->MBR.Byte55 != 0x55 || gpt->MBR.ByteAA != 0xAA)
|
||||
{
|
||||
grub_env_set(args[1], "unknown");
|
||||
debug("invalid mbr signature: 0x%x 0x%x\n", gpt->MBR.Byte55, gpt->MBR.ByteAA);
|
||||
debug("invalid mbr signature: 0x%x 0x%x offset=%d\n", gpt->MBR.Byte55, gpt->MBR.ByteAA, offset);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
43
IMG/cpio/ventoy/hook/debian/devuan-disk.sh
Normal file
43
IMG/cpio/ventoy/hook/debian/devuan-disk.sh
Normal file
@ -0,0 +1,43 @@
|
||||
#!/ventoy/busybox/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
if is_ventoy_hook_finished; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
PATH=$VTPATH_OLD
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
|
||||
|
||||
PATH=$VTPATH_OLD
|
||||
|
||||
set_ventoy_hook_finish
|
21
IMG/cpio/ventoy/hook/debian/devuan-hook.sh
Normal file
21
IMG/cpio/ventoy/hook/debian/devuan-hook.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/ventoy/busybox/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
$SED "/Mount.*cdrom/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/devuan-disk.sh" -i /init
|
||||
|
25
IMG/cpio/ventoy/hook/debian/truenas-bottom.sh
Normal file
25
IMG/cpio/ventoy/hook/debian/truenas-bottom.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/ventoy/busybox/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
vtlog "mount ventoy.iso"
|
||||
mkdir -p /root/cdrom >>$VTLOG 2>&1
|
||||
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso /root/cdrom >>$VTLOG 2>&1
|
||||
|
52
IMG/cpio/ventoy/hook/debian/truenas-disk.sh
Normal file
52
IMG/cpio/ventoy/hook/debian/truenas-disk.sh
Normal file
@ -0,0 +1,52 @@
|
||||
#!/ventoy/busybox/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
. /ventoy/hook/ventoy-hook-lib.sh
|
||||
|
||||
vtlog "####### $0 $* ########"
|
||||
|
||||
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
|
||||
|
||||
|
||||
ventoy_run_fuse() {
|
||||
vtlog "ventoy_run_fuse $*"
|
||||
|
||||
mkdir -p $VTOY_PATH/mnt/fuse $VTOY_PATH/mnt/iso
|
||||
|
||||
vtoydm -p -f $VTOY_PATH/ventoy_image_map -d $1 > $VTOY_PATH/ventoy_dm_table
|
||||
vtoy_fuse_iso -f $VTOY_PATH/ventoy_dm_table -m $VTOY_PATH/mnt/fuse
|
||||
|
||||
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso $VTOY_PATH/mnt/iso
|
||||
}
|
||||
|
||||
|
||||
wait_for_usb_disk_ready
|
||||
|
||||
vtdiskname=$(get_ventoy_disk_name)
|
||||
if [ "$vtdiskname" = "unknown" ]; then
|
||||
vtlog "ventoy disk not found"
|
||||
PATH=$VTPATH_OLD
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ventoy_run_fuse $vtdiskname
|
||||
|
||||
if [ -f /ventoy/autoinstall ]; then
|
||||
sh /ventoy/hook/default/auto_install_varexp.sh /ventoy/autoinstall
|
||||
fi
|
27
IMG/cpio/ventoy/hook/debian/truenas-hook.sh
Normal file
27
IMG/cpio/ventoy/hook/debian/truenas-hook.sh
Normal file
@ -0,0 +1,27 @@
|
||||
#!/ventoy/busybox/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/>.
|
||||
#
|
||||
#************************************************************************************
|
||||
|
||||
if [ -e /init ] && $GREP -q '^mountroot$' /init; then
|
||||
echo "Here before mountroot ..." >> $VTLOG
|
||||
$SED "/^mountroot$/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/truenas-disk.sh" -i /init
|
||||
$SED "/^mountroot$/i\\export LIVEMEDIA=/dev/mapper/ventoy" -i /init
|
||||
$SED "/^mountroot$/i\\export LIVE_MEDIA=/dev/mapper/ventoy" -i /init
|
||||
$SED "/^mountroot$/i\\export FROMISO=$VTOY_PATH/mnt/fuse/ventoy.iso" -i /init
|
||||
$SED "/exec *run-init/i\\$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/truenas-bottom.sh" -i /init
|
||||
fi
|
@ -110,6 +110,14 @@ ventoy_get_debian_distro() {
|
||||
echo 'pyabr'; return
|
||||
fi
|
||||
|
||||
if [ -e /devuan-logo.txt ]; then
|
||||
echo 'devuan'; return
|
||||
fi
|
||||
|
||||
if $GREP -q 'truenas' /proc/version; then
|
||||
echo 'truenas'; return
|
||||
fi
|
||||
|
||||
echo 'default'
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,12 @@ if [ -f $VTOY_PATH/autoinstall ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if $GREP -q 'rdinit=/vtoy/vtoy' /proc/cmdline; then
|
||||
echo "remove rdinit param" >> $VTLOG
|
||||
echo "ptoptions=+rdinit" >> /linuxrc.config
|
||||
fi
|
||||
|
||||
|
||||
if $BUSYBOX_PATH/ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
|
||||
if [ -f /linuxrc.config ]; then
|
||||
vtKerVer=$($BUSYBOX_PATH/uname -r)
|
||||
|
@ -45,8 +45,15 @@ fi
|
||||
# TinyCore linux distro doesn't contain dmsetup, we use aoe here
|
||||
sudo modprobe aoe aoe_iflist=lo
|
||||
if [ -e /sys/module/aoe ]; then
|
||||
VBLADE_BIN=$(ventoy_get_vblade_bin)
|
||||
|
||||
if ! [ -d /lib64 ]; then
|
||||
vtlog "link lib64"
|
||||
NEED_UNLIB64=1
|
||||
ln -s /lib /lib64
|
||||
fi
|
||||
|
||||
VBLADE_BIN=$(ventoy_get_vblade_bin)
|
||||
|
||||
sudo nohup $VBLADE_BIN -r -f $VTOY_PATH/ventoy_image_map 9 0 lo "$vtdiskname" > /dev/null &
|
||||
sleep 2
|
||||
|
||||
@ -54,9 +61,14 @@ if [ -e /sys/module/aoe ]; then
|
||||
vtlog 'Wait for /dev/etherd/e9.0 ....'
|
||||
sleep 2
|
||||
done
|
||||
|
||||
|
||||
sudo cp -a /dev/etherd/e9.0 "$vPart"
|
||||
|
||||
if [ -n "$NEED_UNLIB64" ]; then
|
||||
vtlog "unlink lib64"
|
||||
unlink /lib64
|
||||
fi
|
||||
|
||||
ventoy_find_bin_run rebuildfstab
|
||||
else
|
||||
vterr "aoe driver module load failed..."
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -33,6 +33,21 @@ function ventoy_debug_pause {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function ventoy_max_resolution {
|
||||
#Skip this for VirtualBox
|
||||
smbios -t 1 -s 0x05 --set=system_product;
|
||||
if vt_str_casebegin "$system_product" "VirtualBox"; then
|
||||
return
|
||||
fi
|
||||
|
||||
vt_enum_video_mode
|
||||
vt_get_video_mode 0 vtCurMode
|
||||
terminal_output console
|
||||
set gfxmode=$vtCurMode
|
||||
terminal_output gfxterm
|
||||
}
|
||||
|
||||
function ventoy_cli_console {
|
||||
if [ -z "$vtoy_display_mode" ]; then
|
||||
terminal_output console
|
||||
@ -405,6 +420,8 @@ function distro_specify_initrd_file_phase2 {
|
||||
vt_linux_specify_initrd_file /live/initrd
|
||||
elif [ -f (loop)/initramfs-linux.img ]; then
|
||||
vt_linux_specify_initrd_file /initramfs-linux.img
|
||||
elif [ -f (loop)/boot/isolinux/initrd.gz ]; then
|
||||
vt_linux_specify_initrd_file /boot/isolinux/initrd.gz
|
||||
fi
|
||||
}
|
||||
|
||||
@ -516,6 +533,13 @@ function ventoy_freebsd_proc {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$vt_freebsd_ver" = "14.x" ]; then
|
||||
if [ -e (loop)/boot/lua/brand-pfSense.lua ]; then
|
||||
set vtFreeBsdDistro=pfSense
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "${vtdebug_flag}" ]; then
|
||||
echo "This is $vtFreeBsdDistro $vt_freebsd_ver ${vt_freebsd_bit}bit"
|
||||
fi
|
||||
@ -622,7 +646,7 @@ function uefi_windows_menu_func {
|
||||
|
||||
if [ -n "$vtoy_chain_mem_addr" ]; then
|
||||
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
|
||||
ventoy_cli_console
|
||||
ventoy_max_resolution
|
||||
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} iso_${ventoy_fs_probe} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
|
||||
boot
|
||||
else
|
||||
@ -664,7 +688,7 @@ function uefi_linux_menu_func {
|
||||
if [ -d (loop)/pmagic ]; then
|
||||
vt_linux_specify_initrd_file /pmagic/initrd.img
|
||||
else
|
||||
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf" "/grub/grub.cfg"; do
|
||||
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf" "/grub/grub.cfg" "EFI/BOOT/grub/grub.cfg"; do
|
||||
if [ -e (loop)/$file ]; then
|
||||
vt_linux_parse_initrd_grub file (loop)/$file
|
||||
fi
|
||||
@ -2401,7 +2425,7 @@ function mimg_common_menuentry {
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
set VENTOY_VERSION="1.1.01"
|
||||
set VENTOY_VERSION="1.1.05"
|
||||
|
||||
#ACPI not compatible with Window7/8, so disable by default
|
||||
set VTOY_PARAM_NO_ACPI=1
|
||||
|
@ -626,6 +626,14 @@ else
|
||||
vtoycli partresize -s $DISK $part2_start
|
||||
fi
|
||||
|
||||
|
||||
if [ "$PART1_TYPE" = "EE" ]; then
|
||||
vtinfo "update esp partition attribute"
|
||||
vtoycli gpt -f $DISK
|
||||
sync
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
vtinfo "Update Ventoy on $DISK successfully finished."
|
||||
echo ""
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -19,5 +19,34 @@
|
||||
"condition": "equal",
|
||||
"expression": "ukui",
|
||||
"gui": "gtk3"
|
||||
},
|
||||
{
|
||||
"type": "env",
|
||||
"name": "DESKTOP_SESSION",
|
||||
"condition": "equal",
|
||||
"expression": "cinnamon",
|
||||
"gui": "gtk3"
|
||||
},
|
||||
{
|
||||
"type": "env",
|
||||
"name": "DESKTOP_SESSION",
|
||||
"condition": "equal",
|
||||
"expression": "gnome",
|
||||
"gui": "gtk3"
|
||||
},
|
||||
{
|
||||
"type": "env",
|
||||
"name": "DESKTOP_SESSION",
|
||||
"condition": "equal",
|
||||
"expression": "plasma",
|
||||
"gui": "qt5"
|
||||
},
|
||||
{
|
||||
"type": "env",
|
||||
"name": "DESKTOP_SESSION",
|
||||
"condition": "equal",
|
||||
"expression": "xfce",
|
||||
"gui": "gtk3"
|
||||
}
|
||||
|
||||
]
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -449,7 +449,6 @@ format_ventoy_disk_gpt() {
|
||||
mkpart Ventoy ntfs $part1_start_sector $part1_end_sector \
|
||||
mkpart VTOYEFI fat16 $part2_start_sector $part2_end_sector \
|
||||
$vt_set_efi_type \
|
||||
set 2 hidden on \
|
||||
quit
|
||||
|
||||
sync
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -442,7 +442,7 @@ int ventoy_fill_gpt(uint64_t size, uint64_t reserve, int align4k, VTOY_GPT_INFO
|
||||
ventoy_gen_preudo_uuid(&(Table[1].PartGuid));
|
||||
Table[1].StartLBA = Table[0].LastLBA + 1;
|
||||
Table[1].LastLBA = Table[1].StartLBA + VTOYEFI_PART_BYTES / 512 - 1;
|
||||
Table[1].Attr = 0xC000000000000001ULL;
|
||||
Table[1].Attr = 0x8000000000000000ULL;
|
||||
ventoy_fill_gpt_partname(Table[1].Name, "VTOYEFI");
|
||||
|
||||
#if 0
|
||||
|
@ -727,6 +727,7 @@ static void * ventoy_update_thread(void *data)
|
||||
MBR_HEAD MBR;
|
||||
ventoy_disk *disk = NULL;
|
||||
ventoy_thread_data *thread = (ventoy_thread_data *)data;
|
||||
VTOY_GPT_INFO *pstGPT = NULL;
|
||||
|
||||
vdebug("ventoy_update_thread run ...\n");
|
||||
|
||||
@ -790,6 +791,36 @@ static void * ventoy_update_thread(void *data)
|
||||
vlog("No need to update MBR\n");
|
||||
}
|
||||
|
||||
|
||||
if (disk->vtoydata.partition_style)
|
||||
{
|
||||
pstGPT = (VTOY_GPT_INFO *)malloc(sizeof(VTOY_GPT_INFO));
|
||||
memset(pstGPT, 0, sizeof(VTOY_GPT_INFO));
|
||||
|
||||
offset = lseek(fd, 0, SEEK_SET);
|
||||
len = read(fd, pstGPT, sizeof(VTOY_GPT_INFO));
|
||||
vlog("Read GPT table offset:%llu len:%llu ...\n", (_ull)offset, (_ull)len);
|
||||
|
||||
if (pstGPT->PartTbl[1].Attr != 0x8000000000000000ULL)
|
||||
{
|
||||
vlog("Update EFI part attr from 0x%016llx to 0x%016llx\n",
|
||||
pstGPT->PartTbl[1].Attr, 0x8000000000000000ULL);
|
||||
|
||||
pstGPT->PartTbl[1].Attr = 0x8000000000000000ULL;
|
||||
|
||||
pstGPT->Head.PartTblCrc = ventoy_crc32(pstGPT->PartTbl, sizeof(pstGPT->PartTbl));
|
||||
pstGPT->Head.Crc = 0;
|
||||
pstGPT->Head.Crc = ventoy_crc32(&(pstGPT->Head), pstGPT->Head.Length);
|
||||
ventoy_write_gpt_part_table(fd, disk->size_in_byte, pstGPT);
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog("No need to update EFI part attr\n");
|
||||
}
|
||||
free(pstGPT);
|
||||
}
|
||||
|
||||
|
||||
g_current_progress = PT_SYNC_DATA1;
|
||||
|
||||
vlog("fsync data1...\n");
|
||||
|
Binary file not shown.
@ -2520,7 +2520,7 @@ int PartitionResizeForVentoy(PHY_DRIVE_INFO *pPhyDrive)
|
||||
|
||||
pGPT->PartTbl[1].StartLBA = pGPT->PartTbl[0].LastLBA + 1;
|
||||
pGPT->PartTbl[1].LastLBA = pGPT->PartTbl[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1;
|
||||
pGPT->PartTbl[1].Attr = 0xC000000000000001ULL;
|
||||
pGPT->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
memcpy(pGPT->PartTbl[1].Name, L"VTOYEFI", 7 * 2);
|
||||
|
||||
//Update CRC
|
||||
@ -2797,6 +2797,7 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int TryId)
|
||||
BOOL CleanDisk = FALSE;
|
||||
BOOL DelEFI = FALSE;
|
||||
BOOL bWriteBack = TRUE;
|
||||
BOOL bUpdateEFIAttr = FALSE;
|
||||
HANDLE hVolume;
|
||||
HANDLE hDrive;
|
||||
DWORD Status;
|
||||
@ -2904,7 +2905,13 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int TryId)
|
||||
if (pPhyDrive->PartStyle == 1)
|
||||
{
|
||||
Log("TryId=%d EFI GPT partition type is 0x%llx", TryId, pPhyDrive->Part2GPTAttr);
|
||||
PROGRESS_BAR_SET_POS(PT_DEL_ALL_PART);
|
||||
PROGRESS_BAR_SET_POS(PT_DEL_ALL_PART);
|
||||
|
||||
if (pGptInfo->PartTbl[1].Attr != VENTOY_EFI_PART_ATTR)
|
||||
{
|
||||
bUpdateEFIAttr = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (TryId == 1)
|
||||
{
|
||||
@ -2917,8 +2924,8 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int TryId)
|
||||
}
|
||||
else if (TryId == 2)
|
||||
{
|
||||
Log("Change GPT partition attribute");
|
||||
if (DISK_ChangeVtoyEFIAttr(pPhyDrive->PhyDrive, StartSector * 512ULL, 0x8000000000000001))
|
||||
Log("Try2 Change GPT partition attribute to 0x%016llx", VENTOY_EFI_PART_ATTR & 0xFFFFFFFFFFFFFFFEULL);
|
||||
if (DISK_ChangeVtoyEFIAttr(pPhyDrive->PhyDrive, StartSector * 512ULL, VENTOY_EFI_PART_ATTR & 0xFFFFFFFFFFFFFFFEULL))
|
||||
{
|
||||
ChangeAttr = TRUE;
|
||||
Sleep(2000);
|
||||
@ -3253,15 +3260,16 @@ End:
|
||||
DISK_ChangeVtoyEFI2Basic(pPhyDrive->PhyDrive, StartSector * 512);
|
||||
}
|
||||
|
||||
|
||||
if (pPhyDrive->PartStyle == 1)
|
||||
{
|
||||
if (ChangeAttr || ((pPhyDrive->Part2GPTAttr >> 56) != 0xC0))
|
||||
if (ChangeAttr || bUpdateEFIAttr)
|
||||
{
|
||||
Log("Change EFI partition attr %u <0x%llx> to <0x%llx>", ChangeAttr, pPhyDrive->Part2GPTAttr, 0xC000000000000001ULL);
|
||||
if (DISK_ChangeVtoyEFIAttr(pPhyDrive->PhyDrive, StartSector * 512ULL, 0xC000000000000001ULL))
|
||||
Log("Change EFI partition attr %u <0x%llx> to <0x%llx>", ChangeAttr, pGptInfo->PartTbl[1].Attr, VENTOY_EFI_PART_ATTR);
|
||||
if (DISK_ChangeVtoyEFIAttr(pPhyDrive->PhyDrive, StartSector * 512ULL, VENTOY_EFI_PART_ATTR))
|
||||
{
|
||||
Log("Change EFI partition attr success");
|
||||
pPhyDrive->Part2GPTAttr = 0xC000000000000001ULL;
|
||||
pPhyDrive->Part2GPTAttr = VENTOY_EFI_PART_ATTR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -982,7 +982,7 @@ int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)
|
||||
CoCreateGuid(&(Table[1].PartGuid));
|
||||
Table[1].StartLBA = Table[0].LastLBA + 1;
|
||||
Table[1].LastLBA = Table[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1;
|
||||
Table[1].Attr = 0xC000000000000001ULL;
|
||||
Table[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
memcpy(Table[1].Name, L"VTOYEFI", 7 * 2);
|
||||
|
||||
#if 0
|
||||
|
@ -34,6 +34,9 @@ typedef enum VTOY_FS
|
||||
|
||||
#define FAT32_MAX_LIMIT (32 * 1073741824ULL)
|
||||
|
||||
#define VENTOY_EFI_PART_ATTR 0x8000000000000000ULL
|
||||
|
||||
|
||||
#define SIZE_1KB (1024)
|
||||
#define SIZE_1GB (1024 * 1024 * 1024)
|
||||
#define SIZE_1TB (1024ULL * 1024ULL * 1024ULL * 1024ULL)
|
||||
|
@ -599,7 +599,7 @@ static int update_part_table(char *disk, UINT64 part2start)
|
||||
|
||||
PartTbl[1].StartLBA = PartTbl[0].LastLBA + 1;
|
||||
PartTbl[1].LastLBA = PartTbl[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1;
|
||||
PartTbl[1].Attr = 0xC000000000000001ULL;
|
||||
PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
PartTbl[1].Name[0] = 'V';
|
||||
PartTbl[1].Name[1] = 'T';
|
||||
PartTbl[1].Name[2] = 'O';
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef __VTOYCLI_H__
|
||||
#define __VTOYCLI_H__
|
||||
|
||||
#define VENTOY_EFI_PART_ATTR 0xC000000000000001ULL
|
||||
#define VENTOY_EFI_PART_ATTR 0x8000000000000000ULL
|
||||
|
||||
#define SIZE_1MB (1024 * 1024)
|
||||
#define VENTOY_EFI_PART_SIZE (32 * SIZE_1MB)
|
||||
|
@ -191,23 +191,26 @@ int vtoygpt_main(int argc, char **argv)
|
||||
Name = pMainGptInfo->PartTbl[1].Name;
|
||||
if (Name[0] == 'V' && Name[1] == 'T' && Name[2] == 'O' && Name[3] == 'Y')
|
||||
{
|
||||
pMainGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
pMainGptInfo->Head.PartTblCrc = VtoyCrc32(pMainGptInfo->PartTbl, sizeof(pMainGptInfo->PartTbl));
|
||||
pMainGptInfo->Head.Crc = 0;
|
||||
pMainGptInfo->Head.Crc = VtoyCrc32(&pMainGptInfo->Head, pMainGptInfo->Head.Length);
|
||||
if (pMainGptInfo->PartTbl[1].Attr != VENTOY_EFI_PART_ATTR)
|
||||
{
|
||||
pMainGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
pMainGptInfo->Head.PartTblCrc = VtoyCrc32(pMainGptInfo->PartTbl, sizeof(pMainGptInfo->PartTbl));
|
||||
pMainGptInfo->Head.Crc = 0;
|
||||
pMainGptInfo->Head.Crc = VtoyCrc32(&pMainGptInfo->Head, pMainGptInfo->Head.Length);
|
||||
|
||||
pBackGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
pBackGptInfo->Head.PartTblCrc = VtoyCrc32(pBackGptInfo->PartTbl, sizeof(pBackGptInfo->PartTbl));
|
||||
pBackGptInfo->Head.Crc = 0;
|
||||
pBackGptInfo->Head.Crc = VtoyCrc32(&pBackGptInfo->Head, pBackGptInfo->Head.Length);
|
||||
pBackGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
pBackGptInfo->Head.PartTblCrc = VtoyCrc32(pBackGptInfo->PartTbl, sizeof(pBackGptInfo->PartTbl));
|
||||
pBackGptInfo->Head.Crc = 0;
|
||||
pBackGptInfo->Head.Crc = VtoyCrc32(&pBackGptInfo->Head, pBackGptInfo->Head.Length);
|
||||
|
||||
lseek(fd, 512, SEEK_SET);
|
||||
write(fd, (UINT8 *)pMainGptInfo + 512, sizeof(VTOY_GPT_INFO) - 512);
|
||||
lseek(fd, 512, SEEK_SET);
|
||||
write(fd, (UINT8 *)pMainGptInfo + 512, sizeof(VTOY_GPT_INFO) - 512);
|
||||
|
||||
lseek(fd, DiskSize - 33 * 512, SEEK_SET);
|
||||
write(fd, pBackGptInfo, sizeof(VTOY_BK_GPT_INFO));
|
||||
lseek(fd, DiskSize - 33 * 512, SEEK_SET);
|
||||
write(fd, pBackGptInfo, sizeof(VTOY_BK_GPT_INFO));
|
||||
|
||||
fsync(fd);
|
||||
fsync(fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ int DumpGptInfo(VTOY_GPT_INFO *pGptInfo)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define VENTOY_EFI_PART_ATTR 0xC000000000000001ULL
|
||||
#define VENTOY_EFI_PART_ATTR 0x8000000000000000ULL
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
@ -291,23 +291,26 @@ int main(int argc, const char **argv)
|
||||
Name = pMainGptInfo->PartTbl[1].Name;
|
||||
if (Name[0] == 'V' && Name[1] == 'T' && Name[2] == 'O' && Name[3] == 'Y')
|
||||
{
|
||||
pMainGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
pMainGptInfo->Head.PartTblCrc = VtoyCrc32(pMainGptInfo->PartTbl, sizeof(pMainGptInfo->PartTbl));
|
||||
pMainGptInfo->Head.Crc = 0;
|
||||
pMainGptInfo->Head.Crc = VtoyCrc32(&pMainGptInfo->Head, pMainGptInfo->Head.Length);
|
||||
if (pMainGptInfo->PartTbl[1].Attr != VENTOY_EFI_PART_ATTR)
|
||||
{
|
||||
pMainGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
pMainGptInfo->Head.PartTblCrc = VtoyCrc32(pMainGptInfo->PartTbl, sizeof(pMainGptInfo->PartTbl));
|
||||
pMainGptInfo->Head.Crc = 0;
|
||||
pMainGptInfo->Head.Crc = VtoyCrc32(&pMainGptInfo->Head, pMainGptInfo->Head.Length);
|
||||
|
||||
pBackGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
pBackGptInfo->Head.PartTblCrc = VtoyCrc32(pBackGptInfo->PartTbl, sizeof(pBackGptInfo->PartTbl));
|
||||
pBackGptInfo->Head.Crc = 0;
|
||||
pBackGptInfo->Head.Crc = VtoyCrc32(&pBackGptInfo->Head, pBackGptInfo->Head.Length);
|
||||
pBackGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
|
||||
pBackGptInfo->Head.PartTblCrc = VtoyCrc32(pBackGptInfo->PartTbl, sizeof(pBackGptInfo->PartTbl));
|
||||
pBackGptInfo->Head.Crc = 0;
|
||||
pBackGptInfo->Head.Crc = VtoyCrc32(&pBackGptInfo->Head, pBackGptInfo->Head.Length);
|
||||
|
||||
lseek(fd, 512, SEEK_SET);
|
||||
write(fd, (UINT8 *)pMainGptInfo + 512, sizeof(VTOY_GPT_INFO) - 512);
|
||||
lseek(fd, 512, SEEK_SET);
|
||||
write(fd, (UINT8 *)pMainGptInfo + 512, sizeof(VTOY_GPT_INFO) - 512);
|
||||
|
||||
lseek(fd, DiskSize - 33 * 512, SEEK_SET);
|
||||
write(fd, pBackGptInfo, sizeof(VTOY_BK_GPT_INFO));
|
||||
lseek(fd, DiskSize - 33 * 512, SEEK_SET);
|
||||
write(fd, pBackGptInfo, sizeof(VTOY_BK_GPT_INFO));
|
||||
|
||||
fsync(fd);
|
||||
fsync(fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user