Compare commits

..

16 Commits

Author SHA1 Message Date
longpanda
966ed21de7 1.1.01
Some checks are pending
Ventoy CI / build (push) Waiting to run
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Waiting to run
2025-02-10 20:14:46 +08:00
longpanda
ff7ee9c10e 1.1.00 release 2025-01-22 19:32:29 +08:00
Liangbin Lian
f43461a16c loader/linux: Ensure the newc pathname is NULL-terminated (#3082)
Per "man 5 cpio", the namesize in the cpio header includes the trailing
NUL byte of the pathname and the pathname is followed by NUL bytes, but
the current implementation ignores the trailing NUL byte when making
the newc header. Although make_header() tries to pad the pathname string,
the padding won't happen when strlen(name) + sizeof(struct newc_head)
is a multiple of 4, and the non-NULL-terminated pathname may lead to
unexpected results.

Assume that a file is created with 'echo -n aaaa > /boot/test12' and
loaded by grub2:

    linux /boot/vmlinuz
    initrd newc:test12:/boot/test12 /boot/initrd

The initrd command eventually invoked grub_initrd_load() and sent
't''e''s''t''1''2' to make_header() to generate the header:

00000070  30 37 30 37 30 31 33 30  31 43 41 30 44 45 30 30  |070701301CA0DE00|
00000080  30 30 38 31 41 34 30 30  30 30 30 33 45 38 30 30  |0081A4000003E800|
00000090  30 30 30 30 36 34 30 30  30 30 30 30 30 31 36 33  |0000640000000163|
000000a0  37 36 45 34 35 32 30 30  30 30 30 30 30 34 30 30  |76E4520000000400|
000000b0  30 30 30 30 30 38 30 30  30 30 30 30 31 33 30 30  |0000080000001300|
000000c0  30 30 30 30 30 30 30 30  30 30 30 30 30 30 30 30  |0000000000000000|
000000d0  30 30 30 30 30 36 30 30  30 30 30 30 30 30 74 65  |00000600000000te|
                                                                  ^namesize
000000e0  73 74 31 32 61 61 61 61  30 37 30 37 30 31 30 30  |st12aaaa07070100|
                   ^^ end of the pathname

Since strlen("test12") + sizeof(struct newc_head) is 116 = 29 * 4,
make_header() didn't pad the pathname, and the file content followed
"test12" immediately. This violates the cpio format and may trigger such
error during linux boot:

    Initramfs unpacking failed: ZSTD-compressed data is trunc

To avoid the potential problems, this commit counts the trailing NUL byte
in when calling make_header() and adjusts the initrd size accordingly.

Now the header becomes

00000070  30 37 30 37 30 31 33 30  31 43 41 30 44 45 30 30  |070701301CA0DE00|
00000080  30 30 38 31 41 34 30 30  30 30 30 33 45 38 30 30  |0081A4000003E800|
00000090  30 30 30 30 36 34 30 30  30 30 30 30 30 31 36 33  |0000640000000163|
000000a0  37 36 45 34 35 32 30 30  30 30 30 30 30 34 30 30  |76E4520000000400|
000000b0  30 30 30 30 30 38 30 30  30 30 30 30 31 33 30 30  |0000080000001300|
000000c0  30 30 30 30 30 30 30 30  30 30 30 30 30 30 30 30  |0000000000000000|
000000d0  30 30 30 30 30 37 30 30  30 30 30 30 30 30 74 65  |00000700000000te|
                                                                  ^namesize
000000e0  73 74 31 32 00 00 00 00  61 61 61 61 30 37 30 37  |st12....aaaa0707|
                      ^^ end of the pathname

Besides the trailing NUL byte, make_header() pads 3 more NUL bytes, and
the user can safely read the pathname without a further check.

To conform to the cpio format, the headers for "TRAILER!!!" are also
adjusted to include the trailing NUL byte, not ignore it.


Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Signed-off-by: Gary Lin <glin@suse.com>
Co-authored-by: Gary Lin <glin@suse.com>
2025-01-22 19:19:29 +08:00
longpanda
377e3fb7bc Fix the boot issue of SystemRescue 11.02+ (#2958) (#3058) 2025-01-22 19:07:08 +08:00
longpanda
f62bd1be14 support eweOS ISO (#3068) 2025-01-22 18:24:09 +08:00
longpanda
b11c38779d docker file 2024-11-16 17:00:25 +08:00
longpanda
f202542c62 docker compose up 2024-11-16 12:38:43 +08:00
longpanda
279491a36a Update to latest Shim (Fix verifying shim SBAT data failed) #2947 2024-11-16 12:34:39 +08:00
longpanda
cb209f9b9e 1.0.99 2024-06-08 17:26:33 +08:00
Andrei Stepanov
b7b2f6a5c1 Update Russian translation (#2857) 2024-06-08 17:10:31 +08:00
Zohir Tamda
3967fb5fb5 Fix French language (#2850)
Co-authored-by: tamdaz <tamda.zohir.pro@gmail.com>
2024-06-08 17:10:07 +08:00
bovirus
a2ad95792d Fixed Italian language (#2840) 2024-06-08 17:09:53 +08:00
Re*Index. (ot_inc)
791308d2ce Japanese Fix typo. (#2839)
* Japanese translation Fixed.

* Fix typo

Fix Typo.
2024-06-08 17:09:26 +08:00
longpanda
0ffb1b15ef Fix the issue that VTOY_LINUX_REMOUNT option does not take effect in latest openSUSE. (#2551) 2024-05-25 18:13:52 +08:00
longpanda
d6e1730ca0 Fix the install issue for /dev/mdX device. (#2846) 2024-05-23 19:30:11 +08:00
longpanda
4d55f505f9 Fix the UEFI boot issue for some computer. 2024-05-22 22:53:55 +08:00
27 changed files with 256 additions and 398 deletions

View File

@@ -13,8 +13,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Run docker-compose up - name: Run docker compose up
run: docker-compose up run: docker compose up
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: ventoy-windows name: ventoy-windows

View File

@@ -1,6 +1,11 @@
FROM centos:7 FROM centos:7
RUN yum -y -q install \ RUN sed -i \
-e 's/^mirrorlist/#mirrorlist/' \
-e 's/^#baseurl/baseurl/' \
-e 's/mirror\.centos\.org/vault.centos.org/' \
/etc/yum.repos.d/*.repo && \
yum -y -q install \
libXpm net-tools bzip2 wget vim gcc gcc-c++ samba dos2unix glibc-devel glibc.i686 glibc-devel.i686 \ libXpm net-tools bzip2 wget vim gcc gcc-c++ samba dos2unix glibc-devel glibc.i686 glibc-devel.i686 \
mpfr.i686 mpfr-devel.i686 rsync autogen autoconf automake libtool gettext* bison binutils \ mpfr.i686 mpfr-devel.i686 rsync autogen autoconf automake libtool gettext* bison binutils \
flex device-mapper-devel SDL libpciaccess libusb freetype freetype-devel gnu-free-* qemu-* virt-* \ flex device-mapper-devel SDL libpciaccess libusb freetype freetype-devel gnu-free-* qemu-* virt-* \

View File

@@ -128,11 +128,22 @@ insert_dir (const char *name, struct dir **root,
n->name = grub_strndup (cb, ce - cb); n->name = grub_strndup (cb, ce - cb);
if (ptr) if (ptr)
{ {
/*
* Create the substring with the trailing NUL byte
* to be included in the cpio header.
*/
char *tmp_name = grub_strndup (name, ce - name);
if (!tmp_name) {
grub_free (n->name);
grub_free (n);
return grub_errno;
}
grub_dprintf ("linux", "Creating directory %s, %s\n", name, ce); grub_dprintf ("linux", "Creating directory %s, %s\n", name, ce);
ptr = make_header (ptr, name, ce - name, ptr = make_header (ptr, tmp_name, ce - name + 1,
040777, 0); 040777, 0);
grub_free (tmp_name);
} }
size += ALIGN_UP ((ce - (char *) name) size += ALIGN_UP ((ce - (char *) name + 1)
+ sizeof (struct newc_head), 4); + sizeof (struct newc_head), 4);
*head = n; *head = n;
cur = n; cur = n;
@@ -183,7 +194,7 @@ grub_initrd_init (int argc, char *argv[],
} }
initrd_ctx->size initrd_ctx->size
+= ALIGN_UP (sizeof (struct newc_head) += ALIGN_UP (sizeof (struct newc_head)
+ grub_strlen (initrd_ctx->components[i].newc_name), + grub_strlen (initrd_ctx->components[i].newc_name) + 1,
4); 4);
initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name, initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name,
&root, 0); &root, 0);
@@ -194,7 +205,7 @@ grub_initrd_init (int argc, char *argv[],
else if (newc) else if (newc)
{ {
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head) initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
+ sizeof ("TRAILER!!!") - 1, 4); + sizeof ("TRAILER!!!"), 4);
free_dir (root); free_dir (root);
root = 0; root = 0;
newc = 0; newc = 0;
@@ -217,7 +228,7 @@ grub_initrd_init (int argc, char *argv[],
{ {
initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4); initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4);
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head) initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
+ sizeof ("TRAILER!!!") - 1, 4); + sizeof ("TRAILER!!!"), 4);
free_dir (root); free_dir (root);
root = 0; root = 0;
} }
@@ -269,14 +280,14 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
ptr += insert_dir (initrd_ctx->components[i].newc_name, ptr += insert_dir (initrd_ctx->components[i].newc_name,
&root, ptr); &root, ptr);
ptr = make_header (ptr, initrd_ctx->components[i].newc_name, ptr = make_header (ptr, initrd_ctx->components[i].newc_name,
grub_strlen (initrd_ctx->components[i].newc_name), grub_strlen (initrd_ctx->components[i].newc_name) + 1,
0100777, 0100777,
initrd_ctx->components[i].size); initrd_ctx->components[i].size);
newc = 1; newc = 1;
} }
else if (newc) else if (newc)
{ {
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!"),
0, 0); 0, 0);
free_dir (root); free_dir (root);
root = 0; root = 0;
@@ -308,7 +319,7 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
{ {
grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
ptr += ALIGN_UP_OVERHEAD (cursize, 4); ptr += ALIGN_UP_OVERHEAD (cursize, 4);
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0); ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!"), 0, 0);
} }
free_dir (root); free_dir (root);
root = 0; root = 0;

View File

@@ -0,0 +1,75 @@
#!/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 $* ############"
if is_ventoy_hook_finished; then
exit 0
fi
wait_for_usb_disk_ready
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
vtlog "ventoy disk not found"
exit 0
fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
blkdev_num=$($VTOY_PATH/tool/dmsetup ls | $GREP ventoy | $SED 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
vtDM=$(ventoy_find_dm_id ${blkdev_num})
vtlog "blkdev_num=$blkdev_num vtDM=$vtDM ..."
while [ -n "Y" ]; do
if [ -b /dev/$vtDM ]; then
break
else
sleep 0.3
fi
done
if [ -n "$1" ]; then
vtlog "ln -s /dev/$vtDM $1"
if [ -e "$1" ]; then
vtlog "$1 already exist"
else
ln -s /dev/$vtDM "$1"
fi
else
vtLABEL=$($BUSYBOX_PATH/blkid /dev/$vtDM | $SED 's/.*LABEL="\([^"]*\)".*/\1/')
vtlog "vtLABEL is $vtLABEL"
if [ -z "$vtLABEL" ]; then
vtLABEL=$($SED "s/.*label=\([^ ]*\)/\1/" /proc/cmdline)
vtlog "vtLABEL is $vtLABEL from cmdline"
fi
if [ -e "/dev/disk/by-label/$vtLABEL" ]; then
vtlog "$1 already exist"
else
ln -s /dev/$vtDM "/dev/disk/by-label/$vtLABEL"
fi
fi
# OK finish
set_ventoy_hook_finish

View 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/>.
#
#************************************************************************************
. $VTOY_PATH/hook/ventoy-os-lib.sh
echo "hook live.init" >> $VTLOG
$SED "1i $BUSYBOX_PATH/sh $VTOY_PATH/hook/ewe/ventoy-disk.sh" -i /lib/tinyramfs/hook.d/live/live.init

View File

@@ -232,256 +232,6 @@ ventoy_check_dm_module() {
fi fi
} }
ventoy_need_proc_ibt() {
vtKv=$($BUSYBOX_PATH/uname -r)
vtMajor=$(echo $vtKv | $AWK -F. '{print $1}')
vtMinor=$(echo $vtKv | $AWK -F. '{print $2}')
#ibt was supported since linux kernel 5.18
if [ $vtMajor -lt 5 ]; then
$BUSYBOX_PATH/false; return
elif [ $vtMajor -eq 5 ]; then
if [ $vtMajor -lt 18 ]; then
$BUSYBOX_PATH/false; return
fi
fi
if $GREP -q ' ibt=off' /proc/cmdline; then
$BUSYBOX_PATH/false; return
fi
#hardware CPU doesn't support IBT
if $VTOY_PATH/tool/vtoykmod -I; then
:
else
$BUSYBOX_PATH/false; return
fi
#dot.CONFIG not enabled
if $GREP -q ' ibt_restore$' /proc/kallsyms; then
:
else
$BUSYBOX_PATH/false; return
fi
$BUSYBOX_PATH/true
}
ventoy_need_dm_patch() {
if [ "$VTOY_LINUX_REMOUNT" != "01" ]; then
if $GREP -q 'VTOY_LINUX_REMOUNT=1' /proc/cmdline; then
:
else
$BUSYBOX_PATH/false; return
fi
fi
if $GREP -q 'device-mapper' /proc/devices; then
:
else
$BUSYBOX_PATH/false; return
fi
if $GREP -q 'dm_patch' /proc/modules; then
$BUSYBOX_PATH/false; return
fi
vtMajorVer=$($BUSYBOX_PATH/uname -r | $AWK -F. '{print $1}')
vtMinorVer=$($BUSYBOX_PATH/uname -r | $AWK -F. '{print $2}')
if [ $vtMajorVer -lt 3 ]; then
$BUSYBOX_PATH/false; return
elif [ $vtMajorVer -eq 3 -a $vtMinorVer -lt 10 ]; then
$BUSYBOX_PATH/false; return
fi
$BUSYBOX_PATH/true
}
ventoy_dm_patch() {
vtDmPatchDebug=0
vtMType=$($BUSYBOX_PATH/uname -m)
vtlog "######### ventoy_dm_patch ############"
if echo $vtMType | $EGREP -i -q "x86.64|amd64"; then
vtKoName=dm_patch_64.ko
elif echo $vtMType | $EGREP -i -q "i[3-6]86"; then
vtKoName=dm_patch_32.ko
else
vtlog "unsupported machine type $vtMType"
return
fi
if ventoy_need_proc_ibt; then
vtlog "need to proc IBT"
vtKoName=dm_patch_ibt_64.ko
vtIBT='0x8888'
else
vtlog "NO need to proc IBT"
vtIBT='0'
fi
if [ -f $VTOY_PATH/tool/$vtKoName ]; then
vtlog "/ventoy/tool/$vtKoName exist OK"
else
vtlog "/ventoy/tool/$vtKoName NOT exist"
return
fi
$CAT /proc/kallsyms | $BUSYBOX_PATH/sort > $VTOY_PATH/kallsyms
if $GREP -m1 -q 'open_table_device.isra' $VTOY_PATH/kallsyms; then
vtLine=$($VTOY_PATH/tool/vtoyksym open_table_device.isra $VTOY_PATH/kallsyms)
vtlog "get open_table_device.isra address $vtLine"
else
vtLine=$($VTOY_PATH/tool/vtoyksym dm_get_table_device $VTOY_PATH/kallsyms)
vtlog "get dm_get_table_device address $vtLine"
fi
get_addr=$(echo $vtLine | $AWK '{print $1}')
get_size=$(echo $vtLine | $AWK '{print $2}')
vtLine=$($VTOY_PATH/tool/vtoyksym blkdev_get_by_dev $VTOY_PATH/kallsyms)
vtlog "get blkdev_get_by_dev address $vtLine"
blkdev_get_addr=$(echo $vtLine | $AWK '{print $1}')
vtLine=$($VTOY_PATH/tool/vtoyksym blkdev_put $VTOY_PATH/kallsyms)
vtlog "get blkdev_put address $vtLine"
blkdev_put_addr=$(echo $vtLine | $AWK '{print $1}')
vtLine=$($VTOY_PATH/tool/vtoyksym bdev_open_by_dev $VTOY_PATH/kallsyms)
vtlog "get bdev_open_by_dev address $vtLine"
bdev_open_addr=$(echo $vtLine | $AWK '{print $1}')
vtLine=$($VTOY_PATH/tool/vtoyksym bdev_file_open_by_dev $VTOY_PATH/kallsyms)
vtlog "get bdev_file_open_by_dev address $vtLine"
bdev_file_open_addr=$(echo $vtLine | $AWK '{print $1}')
if $GREP -m1 -q 'close_table_device.isra' $VTOY_PATH/kallsyms; then
vtLine=$($VTOY_PATH/tool/vtoyksym close_table_device.isra $VTOY_PATH/kallsyms)
vtlog "get close_table_device.isra address $vtLine"
else
vtLine=$($VTOY_PATH/tool/vtoyksym dm_put_table_device $VTOY_PATH/kallsyms)
vtlog "get dm_put_table_device address $vtLine"
fi
put_addr=$(echo $vtLine | $AWK '{print $1}')
put_size=$(echo $vtLine | $AWK '{print $2}')
ro_addr=$($GREP ' set_memory_ro$' /proc/kallsyms | $AWK '{print $1}')
rw_addr=$($GREP ' set_memory_rw$' /proc/kallsyms | $AWK '{print $1}')
kprobe_reg_addr=$($GREP ' register_kprobe$' /proc/kallsyms | $AWK '{print $1}')
kprobe_unreg_addr=$($GREP ' unregister_kprobe$' /proc/kallsyms | $AWK '{print $1}')
if [ "$VTOY_DEBUG_LEVEL" = "01" ]; then
vtDmPatchDebug=1
fi
if $GREP -q 'dmpatch_debug' /proc/cmdline; then
vtDmPatchDebug=1
fi
if [ $vtDmPatchDebug -eq 1 ]; then
printk_addr=$($GREP ' printk$' /proc/kallsyms | $AWK '{print $1}')
if [ -z "$printk_addr" ]; then
printk_addr=$($GREP ' _printk$' /proc/kallsyms | $AWK '{print $1}')
fi
vtDebug="-v"
else
printk_addr=0
fi
#printk_addr=$($GREP ' printk$' /proc/kallsyms | $AWK '{print $1}')
#vtDebug="-v"
vtlog get_addr=$get_addr get_size=$get_size
vtlog put_addr=$put_addr put_size=$put_size
vtlog blkdev_get_addr=$blkdev_get_addr blkdev_put_addr=$blkdev_put_addr
vtlog kprobe_reg_addr=$kprobe_reg_addr kprobe_unreg_addr=$kprobe_unreg_addr
vtlog ro_addr=$ro_addr rw_addr=$rw_addr printk_addr=$printk_addr bdev_open_addr=$bdev_open_addr bdev_file_open_addr=$bdev_file_open_addr
if [ "$get_addr" = "0" -o "$put_addr" = "0" ]; then
vtlog "Invalid symbol address"
return
fi
if [ "$ro_addr" = "0" -o "$rw_addr" = "0" ]; then
vtlog "Invalid symbol address"
return
fi
vtKv=$($BUSYBOX_PATH/uname -r)
vtKVMajor=$(echo $vtKv | $AWK -F. '{print $1}')
vtKVMinor=$(echo $vtKv | $AWK -F. '{print $2}')
vtKVSubMinor=$(echo $vtKv | $AWK -F. '{print $3}')
if [ ! -d /lib/modules/$vtKv ]; then
vtlog "No modules directory found"
return
elif [ -d /lib/modules/$vtKv/kernel/fs ]; then
vtModPath=$($FIND /lib/modules/$vtKv/kernel/fs/ -name "*.ko*" | $HEAD -n1)
elif [ -d /lib/modules/$vtKv/kernel ]; then
vtModPath=$($FIND /lib/modules/$vtKv/kernel/ -name "xfs.ko*" | $HEAD -n1)
elif [ -d /lib/modules/$vtKv/initrd ]; then
vtModPath=$($FIND /lib/modules/$vtKv/initrd/ -name "xfs.ko*" | $HEAD -n1)
fi
if [ -z "$vtModPath" ]; then
vtModPath=$($FIND /lib/modules/$vtKv/ -name "*.ko*" | $HEAD -n1)
fi
vtModName=$($BUSYBOX_PATH/basename $vtModPath)
vtlog "template module is $vtModPath $vtModName"
if [ -z "$vtModPath" ]; then
vtlog "No template module found"
return
elif echo $vtModPath | $GREP -q "[.]ko$"; then
$BUSYBOX_PATH/cp -a $vtModPath $VTOY_PATH/$vtModName
elif echo $vtModPath | $GREP -q "[.]ko[.]xz$"; then
$BUSYBOX_PATH/xzcat $vtModPath > $VTOY_PATH/$vtModName
elif echo $vtModPath | $GREP -q "[.]ko[.]gz$"; then
$BUSYBOX_PATH/zcat $vtModPath > $VTOY_PATH/$vtModName
elif echo $vtModPath | $GREP -q "[.]ko[.]zst$"; then
$VTOY_PATH/tool/zstdcat $vtModPath > $VTOY_PATH/$vtModName
else
vtlog "unsupport module type"
return
fi
#step1: modify vermagic/mod crc/relocation
vtlog "$VTOY_PATH/tool/vtoykmod -u $vtKVMajor $vtKVMinor $VTOY_PATH/tool/$vtKoName $VTOY_PATH/$vtModName $vtDebug"
$VTOY_PATH/tool/vtoykmod -u $vtKVMajor $vtKVMinor $VTOY_PATH/tool/$vtKoName $VTOY_PATH/$vtModName $vtDebug >>$VTLOG 2>&1
#step2: fill parameters
vtPgsize=$($VTOY_PATH/tool/vtoyksym -p)
vtPrams="$VTOY_PATH/tool/$vtKoName $vtPgsize 0x$printk_addr 0x$ro_addr 0x$rw_addr $get_addr $get_size $put_addr $put_size 0x$kprobe_reg_addr 0x$kprobe_unreg_addr $vtKVMajor $vtIBT $vtKVMinor $blkdev_get_addr $blkdev_put_addr $vtKVSubMinor $bdev_open_addr $bdev_file_open_addr $vtDebug"
vtlog "$VTOY_PATH/tool/vtoykmod -f $vtPrams"
$VTOY_PATH/tool/vtoykmod -f $vtPrams >>$VTLOG 2>&1
vtlog "insmod $VTOY_PATH/tool/$vtKoName"
$BUSYBOX_PATH/insmod $VTOY_PATH/tool/$vtKoName >>$VTLOG 2>&1
if $GREP -q 'dm_patch' /proc/modules; then
vtlog "dm_patch module OK"
echo "done" > $VTOY_PATH/dm_patch_done
else
vtlog "dm_patch module FAILED"
fi
}
create_ventoy_device_mapper() { create_ventoy_device_mapper() {
vtlog "create_ventoy_device_mapper $*" vtlog "create_ventoy_device_mapper $*"
@@ -501,28 +251,16 @@ create_ventoy_device_mapper() {
fi fi
$VTOY_PATH/tool/vtoydm -p -f $VTOY_PATH/ventoy_image_map -d $1 > $VTOY_PATH/ventoy_dm_table $VTOY_PATH/tool/vtoydm -p -f $VTOY_PATH/ventoy_image_map -d $1 > $VTOY_PATH/ventoy_dm_table
$VTOY_PATH/tool/vtoydm -r -f $VTOY_PATH/ventoy_image_map -d $1 > $VTOY_PATH/ventoy_raw_table
vtLevel1=$($CAT /proc/sys/kernel/printk | $AWK '{print $1}')
vtLevel2=$($CAT /proc/sys/kernel/printk | $AWK '{print $2}')
vtLevel3=$($CAT /proc/sys/kernel/printk | $AWK '{print $3}')
vtLevel4=$($CAT /proc/sys/kernel/printk | $AWK '{print $4}')
if ventoy_need_dm_patch; then
ventoy_dm_patch
#suppress printk message
echo 0 $vtLevel2 0 $vtLevel4 > /proc/sys/kernel/printk
fi
if [ -z "$2" ]; then if [ -z "$2" ]; then
$VT_DM_BIN create ventoy $VTOY_PATH/ventoy_dm_table >>$VTLOG 2>&1 $VT_DM_BIN create ventoy $VTOY_PATH/ventoy_dm_table >>$VTLOG 2>&1
else else
$VT_DM_BIN "$2" create ventoy $VTOY_PATH/ventoy_dm_table >>$VTLOG 2>&1 $VT_DM_BIN "$2" create ventoy $VTOY_PATH/ventoy_dm_table >>$VTLOG 2>&1
fi fi
if ventoy_need_dm_patch; then RAWDISKNAME=$($HEAD -n1 $VTOY_PATH/ventoy_raw_table | $AWK '{print $4}')
#recover printk level $VT_DM_BIN create ${RAWDISKNAME#/dev/} $VTOY_PATH/ventoy_raw_table >>$VTLOG 2>&1
echo $vtLevel1 $vtLevel2 $vtLevel3 $vtLevel4 > /proc/sys/kernel/printk
fi
} }
create_persistent_device_mapper() { create_persistent_device_mapper() {
@@ -542,24 +280,8 @@ create_persistent_device_mapper() {
vterr "Error: no dm module avaliable" vterr "Error: no dm module avaliable"
fi fi
$VTOY_PATH/tool/vtoydm -p -f $VTOY_PATH/ventoy_persistent_map -d $1 > $VTOY_PATH/persistent_dm_table $VTOY_PATH/tool/vtoydm -p -f $VTOY_PATH/ventoy_persistent_map -d $1 > $VTOY_PATH/persistent_dm_table
$VT_DM_BIN create vtoy_persistent $VTOY_PATH/persistent_dm_table >>$VTLOG 2>&1
vtLevel1=$($CAT /proc/sys/kernel/printk | $AWK '{print $1}')
vtLevel2=$($CAT /proc/sys/kernel/printk | $AWK '{print $2}')
vtLevel3=$($CAT /proc/sys/kernel/printk | $AWK '{print $3}')
vtLevel4=$($CAT /proc/sys/kernel/printk | $AWK '{print $4}')
if [ -f $VTOY_PATH/dm_patch_done ]; then
#suppress printk message
echo 0 $vtLevel2 0 $vtLevel4 > /proc/sys/kernel/printk
fi
$VT_DM_BIN create vtoy_persistent $VTOY_PATH/persistent_dm_table >>$VTLOG 2>&1
if [ -f $VTOY_PATH/dm_patch_done ]; then
#recover printk level
echo $vtLevel1 $vtLevel2 $vtLevel3 $vtLevel4 > /proc/sys/kernel/printk
fi
} }
@@ -852,12 +574,7 @@ ventoy_udev_disk_common_hook() {
if [ -f $VTOY_PATH/ventoy_persistent_map ]; then if [ -f $VTOY_PATH/ventoy_persistent_map ]; then
create_persistent_device_mapper "/dev/$VTDISK" create_persistent_device_mapper "/dev/$VTDISK"
ventoy_create_persistent_link ventoy_create_persistent_link
fi fi
if $GREP -q 'dm_patch' /proc/modules; then
vtlog "remove dm_patch module."
$BUSYBOX_PATH/rmmod dm_patch
fi
} }
ventoy_create_dev_ventoy_part() { ventoy_create_dev_ventoy_part() {
@@ -865,17 +582,7 @@ ventoy_create_dev_ventoy_part() {
$BUSYBOX_PATH/mknod -m 0666 /dev/ventoy b $blkdev_num $BUSYBOX_PATH/mknod -m 0666 /dev/ventoy b $blkdev_num
if [ -e /vtoy_dm_table ]; then if [ -e /vtoy_dm_table ]; then
vtPartid=1 vtPartid=1
vtLevel1=$($CAT /proc/sys/kernel/printk | $AWK '{print $1}')
vtLevel2=$($CAT /proc/sys/kernel/printk | $AWK '{print $2}')
vtLevel3=$($CAT /proc/sys/kernel/printk | $AWK '{print $3}')
vtLevel4=$($CAT /proc/sys/kernel/printk | $AWK '{print $4}')
if [ -f $VTOY_PATH/dm_patch_done ]; then
#suppress printk message
echo 0 $vtLevel2 0 $vtLevel4 > /proc/sys/kernel/printk
fi
$CAT /vtoy_dm_table | while read vtline; do $CAT /vtoy_dm_table | while read vtline; do
echo $vtline > /ventoy/dm_table_part${vtPartid} echo $vtline > /ventoy/dm_table_part${vtPartid}
$VTOY_PATH/tool/dmsetup create ventoy${vtPartid} /ventoy/dm_table_part${vtPartid} $VTOY_PATH/tool/dmsetup create ventoy${vtPartid} /ventoy/dm_table_part${vtPartid}
@@ -885,11 +592,6 @@ ventoy_create_dev_ventoy_part() {
vtPartid=$(expr $vtPartid + 1) vtPartid=$(expr $vtPartid + 1)
done done
if [ -f $VTOY_PATH/dm_patch_done ]; then
#recover printk level
echo $vtLevel1 $vtLevel2 $vtLevel3 $vtLevel4 > /proc/sys/kernel/printk
fi
fi fi
} }

View File

@@ -72,27 +72,29 @@ ventoy_unpack_initramfs() {
for vtx in '1F8B zcat' '1F9E zcat' '425A bzcat' '5D00 lzcat' 'FD37 xzcat' '894C lzopcat' '0221 lz4cat' '28B5 zstdcat' '3037 cat' '4C5A lunzip -c'; do for vtx in '1F8B zcat' '1F9E zcat' '425A bzcat' '5D00 lzcat' 'FD37 xzcat' '894C lzopcat' '0221 lz4cat' '28B5 zstdcat' '3037 cat' '4C5A lunzip -c'; 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
if [ $vtskip -eq 0 ]; then if [ $vtskip -ne 0 ]; then
if [ "${vtx:5}" = "xzcat" ]; then dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none > ${vtfile}.skip
rm -f $VTOY_PATH/xzlog rm -f $vtfile
${vtx:5} $vtfile 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp) mv ${vtfile}.skip $vtfile
if grep -q 'corrupted data' $VTOY_PATH/xzlog; then fi
echo 'xzcat failed, now try xzminidec...' >> $VTLOG
rm -f $VTOY_PATH/xzlog
cat $vtfile | xzminidec 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
if grep -q 'limit' $VTOY_PATH/xzlog; then if [ "${vtx:5}" = "xzcat" ]; then
echo 'xzminidec failed, now try xzcat_musl ...' >> $VTLOG rm -f $VTOY_PATH/xzlog
xzcat_musl $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp) ${vtx:5} $vtfile 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
fi if grep -q 'corrupted data' $VTOY_PATH/xzlog; then
echo 'xzcat failed, now try xzminidec...' >> $VTLOG
rm -f $VTOY_PATH/xzlog
cat $vtfile | xzminidec 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
if grep -q 'limit' $VTOY_PATH/xzlog; then
echo 'xzminidec failed, now try xzcat_musl ...' >> $VTLOG
xzcat_musl $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
fi fi
else
${vtx:5} $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
fi fi
else else
dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none | ${vtx:5} | (cpio -idmu 2>>$VTLOG; cat > $vttmp) ${vtx:5} $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
fi fi
break break
fi fi
done done

View File

@@ -39,35 +39,6 @@ fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace" ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
ventoy_create_dev_ventoy_part ventoy_create_dev_ventoy_part
if ventoy_need_dm_patch; then
vtlog "extract a ko file"
mkdir -p /ventoy/tmpmnt1 /ventoy/tmpmnt2
mount /dev/ventoy1 /ventoy/tmpmnt1
mount /ventoy/tmpmnt1/boot/batocera /ventoy/tmpmnt2
vtKV=$(uname -r)
mkdir -p /lib/modules/$vtKV/kernel/
vtKO=$(find "/ventoy/tmpmnt2/lib/modules/$vtKV/kernel/fs/" -name "*.ko*" | head -n1)
cp -a $vtKO /lib/modules/$vtKV/kernel/
vtlog "vtKV=$vtKV vtKO=$vtKO"
umount /ventoy/tmpmnt2
umount /ventoy/tmpmnt1
vtPartid=1
cat /vtoy_dm_table | while read vtline; do
dmsetup remove ventoy$vtPartid
vtPartid=$(expr $vtPartid + 1)
done
dmsetup remove ventoy
vtlog "Recreate device-mapper"
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
ventoy_create_dev_ventoy_part
fi
PATH=$VTPATH_OLD PATH=$VTPATH_OLD

View File

@@ -384,6 +384,12 @@ ventoy_get_os_type() {
fi fi
fi fi
if [ -f /etc/tinyramfs/config ]; then
if $GREP -q 'EWE_ISO' /etc/tinyramfs/config; then
echo "ewe"; return
fi
fi
echo "default" echo "default"
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -19,16 +19,7 @@ submenu "$VTLANG_CTRL_TEMP_SET" --class=debug_temp_set --class=F5tool {
else else
set VTOY_WIN11_BYPASS_NRO=0 set VTOY_WIN11_BYPASS_NRO=0
fi fi
} }
menuentry "[ $VTOY_LINUX_REMOUNT ] $VTLANG_LINUX_REMOUNT" --class=debug_temp_linux_remount --class=debug_temp_set --class=F5tool \
VTOY_RUN_SET2 {
if [ "$VTOY_LINUX_REMOUNT" = "0" ]; then
set VTOY_LINUX_REMOUNT=1
else
set VTOY_LINUX_REMOUNT=0
fi
}
menuentry "[ $VTOY_SECONDARY_BOOT_MENU ] $VTLANG_SECONDARY_BOOT_MENU" --class=debug_temp_second_menu --class=debug_temp_set --class=F5tool \ menuentry "[ $VTOY_SECONDARY_BOOT_MENU ] $VTLANG_SECONDARY_BOOT_MENU" --class=debug_temp_second_menu --class=debug_temp_set --class=F5tool \
VTOY_RUN_SET3 { VTOY_RUN_SET3 {

View File

@@ -403,10 +403,12 @@ function distro_specify_initrd_file_phase2 {
vt_linux_specify_initrd_file /images/pxeboot/initrd.img vt_linux_specify_initrd_file /images/pxeboot/initrd.img
elif [ -f (loop)/live/initrd ]; then elif [ -f (loop)/live/initrd ]; then
vt_linux_specify_initrd_file /live/initrd vt_linux_specify_initrd_file /live/initrd
elif [ -f (loop)/initramfs-linux.img ]; then
vt_linux_specify_initrd_file /initramfs-linux.img
fi fi
} }
function ventoy_get_ghostbsd_ver { function ventoy_get_ghostbsd_ver {
# fallback to parse version from elf /boot/kernel/kernel # fallback to parse version from elf /boot/kernel/kernel
set vt_freebsd_ver=xx set vt_freebsd_ver=xx
@@ -2399,7 +2401,7 @@ function mimg_common_menuentry {
############################################################# #############################################################
############################################################# #############################################################
set VENTOY_VERSION="1.0.98" set VENTOY_VERSION="1.1.01"
#ACPI not compatible with Window7/8, so disable by default #ACPI not compatible with Window7/8, so disable by default
set VTOY_PARAM_NO_ACPI=1 set VTOY_PARAM_NO_ACPI=1

View File

@@ -47,7 +47,7 @@
"VTLANG_UTIL_SHOW_EFI_DRV": "Afficher les pilotes EFI", "VTLANG_UTIL_SHOW_EFI_DRV": "Afficher les pilotes EFI",
"VTLANG_UTIL_FIX_BLINIT_FAIL": "Contourner léchec de Windows BlinitializeLibrary", "VTLANG_UTIL_FIX_BLINIT_FAIL": "Contourner léchec de Windows BlinitializeLibrary",
"VTLANG_JSON_CHK_JSON": "Afficher le fichiers de configuration (ventoy.json)", "VTLANG_JSON_CHK_JSON": "Afficher le fichier de configuration (ventoy.json)",
"VTLANG_JSON_CHK_CONTROL": "Afficher la configuration du plugin de contrôle global", "VTLANG_JSON_CHK_CONTROL": "Afficher la configuration du plugin de contrôle global",
"VTLANG_JSON_CHK_THEME": "Afficher la configuration du plugin de thème", "VTLANG_JSON_CHK_THEME": "Afficher la configuration du plugin de thème",
"VTLANG_JSON_CHK_AUTOINS": "Afficher la configuration du plugin dinstallation automatique", "VTLANG_JSON_CHK_AUTOINS": "Afficher la configuration du plugin dinstallation automatique",

View File

@@ -1,8 +1,8 @@
{ {
"VTLANG_LANGUAGE_NAME": "Russian (Русский)", "VTLANG_LANGUAGE_NAME": "Russian (Русский)",
"VTLANG_STR_HOTKEY_LIST": "L:Язык F1:Помощь F2:Просмотр F3:ВидСписком F4:Локальная загрузка F5:Инструменты F6:Выйти из меню", "VTLANG_STR_HOTKEY_LIST": "L:Язык F1:Помощь F2:Обзор F3:ВидСписок F4:ЛокалЗагрузка F5:Сервис F6:РасширМеню",
"VTLANG_STR_HOTKEY_TREE": "L:Язык F1:Помощь F2:Просмотр F3:ВидДревом F4:Локальная загрузка F5:Инструменты F6:Выйти из меню", "VTLANG_STR_HOTKEY_TREE": "L:Язык F1:Помощь F2:Обзор F3:ВидДерево F4:ЛокалЗагрузка F5:Сервис F6:РасширМеню",
"VTLANG_RETURN_PREVIOUS": "Вернуться в предыдущее меню [Esc]", "VTLANG_RETURN_PREVIOUS": "Вернуться в предыдущее меню [Esc]",
"VTLANG_RETURN_PRV_NOESC": "Вернуться в предыдущее меню", "VTLANG_RETURN_PRV_NOESC": "Вернуться в предыдущее меню",
@@ -37,13 +37,13 @@
"VTLANG_HWINFO": "Сведения об оборудовании", "VTLANG_HWINFO": "Сведения об оборудовании",
"VTLANG_RESOLUTION_CFG": "Конфигурация разрешения", "VTLANG_RESOLUTION_CFG": "Конфигурация разрешения",
"VTLANG_SCREEN_MODE": "Режим Screen Display", "VTLANG_SCREEN_MODE": "Режим отображения экрана",
"VTLANG_SCREEN_TEXT_MODE": "Выбрать текстовый режим", "VTLANG_SCREEN_TEXT_MODE": "Выбрать текстовый режим",
"VTLANG_SCREEN_GUI_MODE": "Выбрать графический режим", "VTLANG_SCREEN_GUI_MODE": "Выбрать графический режим",
"VTLANG_THEME_SELECT": "Выбор темы", "VTLANG_THEME_SELECT": "Выбор темы",
"VTLANG_UEFI_UTIL": "UEFI утилиты Ventoy", "VTLANG_UEFI_UTIL": "Утилиты UEFI Ventoy",
"VTLANG_UTIL_SHOW_EFI_DRV": "Показать драйверы EFI", "VTLANG_UTIL_SHOW_EFI_DRV": "Показать драйверы EFI",
"VTLANG_UTIL_FIX_BLINIT_FAIL": "Исправить ошибку Windows «BlinitializeLibrary»", "VTLANG_UTIL_FIX_BLINIT_FAIL": "Исправить ошибку Windows «BlinitializeLibrary»",

View File

@@ -94,6 +94,8 @@ get_disk_part_name() {
echo ${DISK}p${2} echo ${DISK}p${2}
elif echo $DISK | grep -q "/dev/zd[0-9]"; then elif echo $DISK | grep -q "/dev/zd[0-9]"; then
echo ${DISK}p${2} echo ${DISK}p${2}
elif echo $DISK | grep -q "/dev/md[0-9]"; then
echo ${DISK}p${2}
else else
echo ${DISK}${2} echo ${DISK}${2}
fi fi
@@ -211,14 +213,14 @@ get_disk_ventoy_version() {
wait_and_create_part() { wait_and_create_part() {
vPART1=$1 vPART1=$1
vPART2=$2 vPART2=$2
echo 'Wait for partitions ...' echo 'Wait for partitions $vPART1 and $vPART2 ...'
for i in 0 1 2 3 4 5 6 7 8 9; do for i in 0 1 2 3 4 5 6 7 8 9; do
if ls -l $vPART1 2>/dev/null | grep -q '^b'; then if ls -l $vPART1 2>/dev/null | grep -q '^b'; then
if ls -l $vPART2 2>/dev/null | grep -q '^b'; then if ls -l $vPART2 2>/dev/null | grep -q '^b'; then
break break
fi fi
else else
echo "Wait for $vPART1/$vPART2 ..." echo "Wait for $vPART1 and $vPART2 ..."
sleep 1 sleep 1
fi fi
done done

View File

@@ -1539,8 +1539,8 @@
"STR_WEB_TOKEN_MISMATCH":"デーモンのステータスが更新されました。後で再試行してください。", "STR_WEB_TOKEN_MISMATCH":"デーモンのステータスが更新されました。後で再試行してください。",
"STR_WEB_SERVICE_BUSY":"サービスがビジーの状態です。後で再試行してください。", "STR_WEB_SERVICE_BUSY":"サービスがビジーの状態です。後で再試行してください。",
"STR_MENU_VTSI_CREATE":"VTSIファイルを作成する", "STR_MENU_VTSI_CREATE":"VTSIファイルを作成する",
"STR_VTSI_CREATE_TIP":"今回はデバイスへの書き込みを行なわず、VSTIファイルの作成のみを行ないます。#@続行しますか?", "STR_VTSI_CREATE_TIP":"今回はデバイスへの書き込みを行なわず、VTSIファイルの作成のみを行ないます。#@続行しますか?",
"STR_VTSI_CREATE_SUCCESS":"VSTIファイルが正常に作成されました!#@Rufus(3.15以降)を使用してデバイスに書き込むことでVentoyのインストールが完了します。", "STR_VTSI_CREATE_SUCCESS":"VTSIファイルが正常に作成されました!#@Rufus(3.15以降)を使用してデバイスに書き込むことでVentoyのインストールが完了します。",
"STR_VTSI_CREATE_FAILED":"VTSIファイルの作成に失敗しました。", "STR_VTSI_CREATE_FAILED":"VTSIファイルの作成に失敗しました。",
"STR_MENU_PART_RESIZE":"非破壊なインストール", "STR_MENU_PART_RESIZE":"非破壊なインストール",
"STR_PART_RESIZE_TIP":"Ventoyは、可能であれば非破壊なインストールを試みます。#@続行しますか?", "STR_PART_RESIZE_TIP":"Ventoyは、可能であれば非破壊なインストールを試みます。#@続行しますか?",
@@ -1575,13 +1575,13 @@
"STR_STATUS":"Stato - PRONTO", "STR_STATUS":"Stato - PRONTO",
"STR_INSTALL":"Installa", "STR_INSTALL":"Installa",
"STR_UPDATE":"Aggiorna", "STR_UPDATE":"Aggiorna",
"STR_UPDATE_TIP":"L'aggiornamento è sicuro, i file presenti nel dispositivo rimarranno invariati.#@Vuoi continuare?", "STR_UPDATE_TIP":"L'aggiornamento è sicuro, i file presenti nel dispositivo rimarranno invariati.#@#@Vuoi continuare?",
"STR_INSTALL_TIP":"Il dispositivo verrà formattato e tutti i dati saranno persi.#@Vuoi continuare?", "STR_INSTALL_TIP":"Il dispositivo verrà formattato e tutti i dati saranno persi.#@#@Vuoi continuare?",
"STR_INSTALL_TIP2":"Il dispositivo verrà formattato e tutti i dati saranno persi.#@Vuoi continuare (seconda verifica)?", "STR_INSTALL_TIP2":"Il dispositivo verrà formattato e tutti i dati saranno persi.#@#@Vuoi continuare (seconda verifica)?",
"STR_INSTALL_SUCCESS":"Congratulazioni!#@Installazione di Ventoy nel dispositivo completata.", "STR_INSTALL_SUCCESS":"Congratulazioni!#@#@Installazione di Ventoy nel dispositivo completata.",
"STR_INSTALL_FAILED":"Si è verificato un errore durante l'installazione.#@Riconnetti il dispositivo e riprova.#@Controlla il file log.txt per i dettagli.", "STR_INSTALL_FAILED":"Si è verificato un errore durante l'installazione.#@#@Riconnetti il dispositivo e riprova.#@#@Per i dettagli controlla il file log.txt .",
"STR_UPDATE_SUCCESS":"Congratulazioni!#@Aggiornamento di Ventoy nel dispositivo completato", "STR_UPDATE_SUCCESS":"Congratulazioni!#@#@Aggiornamento di Ventoy nel dispositivo completato",
"STR_UPDATE_FAILED":"Si è verificato un errore durante l'aggiornamento.#@È possibile riconnettere il dispositivo USB e riprovare.#@Controlla il file log.txt per i dettagli. Se l'aggiornamento non va a buon fine, consulta le FAQ sul sito ufficiale", "STR_UPDATE_FAILED":"Si è verificato un errore durante l'aggiornamento.#@È possibile riconnettere il dispositivo USB e riprovare.#@Per i dettagli controlla il file log.txt.#@Se l'aggiornamento non va a buon fine, consulta le FAQ sul sito ufficiale",
"STR_WAIT_PROCESS":"Un processo è in esecuzione. Attendi...", "STR_WAIT_PROCESS":"Un processo è in esecuzione. Attendi...",
"STR_MENU_OPTION":"Opzioni", "STR_MENU_OPTION":"Opzioni",
"STR_MENU_SECURE_BOOT":"Avvio protetto (secure boot)", "STR_MENU_SECURE_BOOT":"Avvio protetto (secure boot)",
@@ -1592,28 +1592,28 @@
"STR_SPACE_VAL_INVALID":"Quantità di spazio da riservare non valida", "STR_SPACE_VAL_INVALID":"Quantità di spazio da riservare non valida",
"STR_MENU_CLEAR":"Rimuovi Ventoy dal dispositivo", "STR_MENU_CLEAR":"Rimuovi Ventoy dal dispositivo",
"STR_CLEAR_SUCCESS":"Rimozione di Ventoy dal dispositivo completata.", "STR_CLEAR_SUCCESS":"Rimozione di Ventoy dal dispositivo completata.",
"STR_CLEAR_FAILED":"Si è verificato un errore durante la rimozione di Ventoy dal dispositivo.#@È possibile riconnettere il dispositivo USB e riprovare.#@Controlla il file log.txt per i dettagli", "STR_CLEAR_FAILED":"Si è verificato un errore durante la rimozione di Ventoy dal dispositivo.#@È possibile riconnettere il dispositivo USB e riprovare.#@Per i dettagli controlla il file log.txt ",
"STR_MENU_PART_STYLE":"Stile tabella partizioni", "STR_MENU_PART_STYLE":"Stile tabella partizioni",
"STR_DISK_2TB_MBR_ERROR":"Seleziona GPT per i dispositivi più grandi di 2TB", "STR_DISK_2TB_MBR_ERROR":"Seleziona GPT per i dispositivi più grandi di 2TB",
"STR_SHOW_ALL_DEV":"Visualizza tutti i dispositivi", "STR_SHOW_ALL_DEV":"Visualizza tutti i dispositivi",
"STR_PART_ALIGN_4KB":"Allinea le partizioni con 4KB", "STR_PART_ALIGN_4KB":"Allinea le partizioni con 4KB",
"STR_WEB_COMMUNICATION_ERR":"Errore di comunicazione:", "STR_WEB_COMMUNICATION_ERR":"Errore di comunicazione:",
"STR_WEB_REMOTE_ABNORMAL":"Errore di comunicazione: remoto anormale", "STR_WEB_REMOTE_ABNORMAL":"Errore di comunicazione: remoto non normale",
"STR_WEB_REQUEST_TIMEOUT":"Errore di comunicazione: richiesta scaduta", "STR_WEB_REQUEST_TIMEOUT":"Errore di comunicazione: richiesta scaduta",
"STR_WEB_SERVICE_UNAVAILABLE":"Errore di comunicazione: servizio non disponibile", "STR_WEB_SERVICE_UNAVAILABLE":"Errore di comunicazione: servizio non disponibile",
"STR_WEB_TOKEN_MISMATCH":"Stato del demone aggiornato. Riprova più tardi.", "STR_WEB_TOKEN_MISMATCH":"Stato del demon aggiornato. Riprova più tardi.",
"STR_WEB_SERVICE_BUSY":"Il servizio è occupato. Riprova più tardi.", "STR_WEB_SERVICE_BUSY":"Il servizio è occupato. Riprova più tardi.",
"STR_MENU_VTSI_CREATE":"Genera file VTSI", "STR_MENU_VTSI_CREATE":"Genera file VTSI",
"STR_VTSI_CREATE_TIP":"Questa volta non scriverà sul dispositivo, ma genererà solo un file VTSI#@Vuoi continuare?", "STR_VTSI_CREATE_TIP":"Questa volta non scriverà sul dispositivo, ma genererà solo un file VTSI#@#@Vuoi continuare?",
"STR_VTSI_CREATE_SUCCESS":"Creazione file VTSI completata!#@Per scriverlo nel dispositivo in modo da completare l'installazione di Ventoy puoi usare Rufus (versione 3.15 o successiva).", "STR_VTSI_CREATE_SUCCESS":"Creazione file VTSI completata!#@Per scriverlo nel dispositivo in modo da completare l'installazione di Ventoy puoi usare Rufus (versione 3.15 o successiva).",
"STR_VTSI_CREATE_FAILED":"Creazione file VTSI non riuscita.", "STR_VTSI_CREATE_FAILED":"Creazione file VTSI non riuscita.",
"STR_MENU_PART_RESIZE":"Installazione non distruttiva", "STR_MENU_PART_RESIZE":"Installazione non distruttiva",
"STR_PART_RESIZE_TIP":"Ventoy proverà, se possibile, l'installazione non distruttiva.#@Vuoi continuare?", "STR_PART_RESIZE_TIP":"Ventoy proverà, se possibile, l'installazione non distruttiva.#@#@Vuoi continuare?",
"STR_PART_RESIZE_SUCCESS":"Congratulazioni!#@Installazione non distruttiva di Ventoy completata.", "STR_PART_RESIZE_SUCCESS":"Congratulazioni!#@Installazione non distruttiva di Ventoy completata.",
"STR_PART_RESIZE_FAILED":"Installazione non distruttiva fallita.#@Controlla il file log.txt per i dettagli.", "STR_PART_RESIZE_FAILED":"Installazione non distruttiva fallita.#@Controlla il file log.txt per i dettagli.",
"STR_PART_RESIZE_UNSUPPORTED":"L'installazione non distruttiva di Ventoy è stata interrotta perché alcune condizioni non possono essere soddisfatte.#@Controlla il file log.txt per i dettagli.", "STR_PART_RESIZE_UNSUPPORTED":"L'installazione non distruttiva di Ventoy è stata interrotta perché alcune condizioni non possono essere soddisfatte.#@Controlla il file log.txt per i dettagli.",
"STR_INSTALL_YES_TIP1":"Attenzione: i dati verranno persi!", "STR_INSTALL_YES_TIP1":"Attenzione: i dati verranno persi!",
"STR_INSTALL_YES_TIP2":"Digita YES nella casella di testo qui sotto per confermare che vuoi davvero eseguire un'installazione pulita anziché un aggiornamento.", "STR_INSTALL_YES_TIP2":"Per confermare che vuoi davvero eseguire un'installazione pulita anziché un aggiornamento digita YES nella casella di testo qui sotto .",
"STR_PART_VENTOY_FS":"File system partizione Ventoy", "STR_PART_VENTOY_FS":"File system partizione Ventoy",
"STR_PART_FS":"File system", "STR_PART_FS":"File system",
"STR_PART_CLUSTER":"Dimensione cluster", "STR_PART_CLUSTER":"Dimensione cluster",

View File

@@ -68,6 +68,7 @@ static int verbose = 0;
#define CMD_DUMP_ISO_INFO 3 #define CMD_DUMP_ISO_INFO 3
#define CMD_EXTRACT_ISO_FILE 4 #define CMD_EXTRACT_ISO_FILE 4
#define CMD_PRINT_EXTRACT_ISO_FILE 5 #define CMD_PRINT_EXTRACT_ISO_FILE 5
#define CMD_PRINT_RAW_TABLE 6
static uint64_t g_iso_file_size; static uint64_t g_iso_file_size;
static char g_disk_name[128]; static char g_disk_name[128];
@@ -578,6 +579,45 @@ static uint64_t vtoydm_get_part_start(const char *diskname, int part)
return size; return size;
} }
static uint64_t vtoydm_get_part_secnum(const char *diskname, int part)
{
int fd;
unsigned long long size = 0;
char diskpath[256] = {0};
char sizebuf[64] = {0};
diskname += 5; /* skip /dev/ */
if (strstr(diskname, "nvme") || strstr(diskname, "mmc") || strstr(diskname, "nbd"))
{
snprintf(diskpath, sizeof(diskpath) - 1, "/sys/class/block/%sp%d/size", diskname, part);
}
else
{
snprintf(diskpath, sizeof(diskpath) - 1, "/sys/class/block/%s%d/size", diskname, part);
}
if (access(diskpath, F_OK) >= 0)
{
debug("get part size from sysfs for %s %d\n", diskname, part);
fd = open(diskpath, O_RDONLY | O_BINARY);
if (fd >= 0)
{
read(fd, sizebuf, sizeof(sizebuf));
size = strtoull(sizebuf, NULL, 10);
close(fd);
return size;
}
}
else
{
debug("%s not exist \n", diskpath);
}
return size;
}
static int vtoydm_vlnk_convert(char *disk, int len, int *part, uint64_t *offset) static int vtoydm_vlnk_convert(char *disk, int len, int *part, uint64_t *offset)
{ {
int rc = 1; int rc = 1;
@@ -627,6 +667,24 @@ end:
return rc; return rc;
} }
static int vtoydm_print_raw_linear_table(const char *img_map_file, const char *diskname, int part)
{
uint64_t disk_sector_num;
disk_sector_num = vtoydm_get_part_secnum(diskname, part);
if (strstr(diskname, "nvme") || strstr(diskname, "mmc") || strstr(diskname, "nbd"))
{
printf("0 %lu linear %sp%d 0\n", (unsigned long)disk_sector_num, diskname, part);
}
else
{
printf("0 %lu linear %s%d 0\n", (unsigned long)disk_sector_num, diskname, part);
}
return 0;
}
int vtoydm_main(int argc, char **argv) int vtoydm_main(int argc, char **argv)
{ {
int ch; int ch;
@@ -639,7 +697,7 @@ int vtoydm_main(int argc, char **argv)
char filepath[300] = {0}; char filepath[300] = {0};
char outfile[300] = {0}; char outfile[300] = {0};
while ((ch = getopt(argc, argv, "s:l:o:d:f:v::i::p::c::h::e::E::")) != -1) while ((ch = getopt(argc, argv, "s:l:o:d:f:v::i::p::r::c::h::e::E::")) != -1)
{ {
if (ch == 'd') if (ch == 'd')
{ {
@@ -653,6 +711,10 @@ int vtoydm_main(int argc, char **argv)
{ {
cmd = CMD_PRINT_TABLE; cmd = CMD_PRINT_TABLE;
} }
else if (ch == 'r')
{
cmd = CMD_PRINT_RAW_TABLE;
}
else if (ch == 'c') else if (ch == 'c')
{ {
cmd = CMD_CREATE_DM; cmd = CMD_CREATE_DM;
@@ -713,6 +775,10 @@ int vtoydm_main(int argc, char **argv)
{ {
return vtoydm_print_linear_table(filepath, diskname, part, offset); return vtoydm_print_linear_table(filepath, diskname, part, offset);
} }
case CMD_PRINT_RAW_TABLE:
{
return vtoydm_print_raw_linear_table(filepath, diskname, part);
}
case CMD_CREATE_DM: case CMD_CREATE_DM:
{ {
break; break;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.