Compare commits

..

459 Commits

Author SHA1 Message Date
longpanda
6482f2e7b3 1.1.07 release
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-08-18 23:20:15 +08:00
longpanda
bd8aebf166 Merge branch 'master' of https://github.com/Ventoy/Ventoy 2025-08-18 23:19:14 +08:00
longpanda
3c05d55b8a Fix the issue (introduced in 1.1.06) that the Ventoy ISO partition cannot be mounted after boot linux distro. 2025-08-18 23:19:00 +08:00
longpanda
92ed0c995e Update README.md
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-08-18 11:59:04 +08:00
longpanda
dc7e310828 Update README.md 2025-08-18 11:56:48 +08:00
longpanda
67d7091255 1.1.06 release
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-08-18 11:16:07 +08:00
longpanda
2ab1474694 Fix the issue that cannot boot Tails 6.13+ (#3171)
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-08-17 23:56:35 +08:00
longpanda
aa7a77df5a Fix the order issue in TreeView mode. (#3218) 2025-08-17 23:08:09 +08:00
longpanda
4790dedbb1 Fix the order issue in TreeView mode. (#3218) 2025-08-17 22:41:16 +08:00
longpanda
de085ba086 Fix the order issue in TreeView mode. (#3218)
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-08-17 17:50:17 +08:00
longpanda
bb94ec6d6f Fix Libreelec 12.2.0 fails to boot #3323
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-08-17 00:05:44 +08:00
fsLeg
b9892660b5 Fix the boot issue for Parted Magic (#3304)
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-08-05 09:10:33 +08:00
A1ive
0e9d34422a Update xfs to latest (#3284)
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
Thanks!
2025-07-07 09:21:53 +08:00
longpanda
c7c9c62ec7 Update BLOB_List.md
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-05-22 12:55:41 +08:00
longpanda
9e13955af1 Add BLOB list file and some missing build desc. 2025-05-14 14:35:44 +08:00
longpanda
2dafe75509 Fix the boot issue for TrueNAS Scale. (#3069)
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-03-03 14:42:44 +08:00
longpanda
6fbc08cfcb Only for VirtualBox.
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-02-28 14:58:36 +08:00
longpanda
6034b25cba Don't force to use max resolution for VMware/VirtualBox. (#3140) 2025-02-28 14:49:40 +08:00
longpanda
c5fd64d21c Support TrueNAS Scale (Linux) distro. (#3069 #3137)
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-02-26 23:25:27 +08:00
longpanda
32fac72b5b 1.1.05
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-02-24 19:29:46 +08:00
longpanda
022322c8fa Fix the resolution issue when boot Windows/WinPE in UEFI mode. 2025-02-24 19:17:19 +08:00
longpanda
96f11252d9 support devuan in Legacy BIOS mode. 2025-02-24 19:16:31 +08:00
longpanda
004ad27e0d 1.1.04 release
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-02-22 11:27:31 +08:00
longpanda
9a8dc42d93 Fix the issue introduced in LinuxGUI version. (#3128) 2025-02-22 11:27:18 +08:00
longpanda
6166a813ea 1.1.03
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-21 18:14:18 +08:00
longpanda
786a9ec678 Update Ventoy2Disk.exe
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-21 13:00:15 +08:00
longpanda
0600576c78 Update Linux GUI type condition 2025-02-21 13:00:01 +08:00
longpanda
72b722c86c Fix the boot issue for latest TinyCore Linux. 2025-02-21 12:59:33 +08:00
longpanda
bea5607ea5 Fix the boot issue for pfSense 2.7.x (#2775)
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-21 00:29:38 +08:00
longpanda
b3c2bcf58f Fix the issue that SLES/OpenSUSE can not boot after install. (#3125) 2025-02-20 22:07:28 +08:00
longpanda
4e8d8b2e19 Fix Windows 11 error 0x80070001. (#3010 #3029 #3105)
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-19 23:49:03 +08:00
longpanda
60d88cb7b1 1.1.02 release
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-02-12 23:01:35 +08:00
longpanda
f7e6bbc70c Fix the "Unsupported vtoy type unknown" error when boot a VDI file created by VirtualBox 7.x 2025-02-12 23:00:27 +08:00
longpanda
ee994a0569 github ai version update
Some checks failed
Ventoy CI / build (push) Has been cancelled
Mirror GitHub to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
2025-02-10 21:46:39 +08:00
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
longpanda
30a61ac5c4 1.0.98 release 2024-05-19 23:14:49 +08:00
Re*Index. (ot_inc)
9b79831516 Japanese translation Fixed. (#2808) 2024-05-19 16:43:20 +08:00
jermanuts
af2d6bc247 Update ar_AR.json (#2755)
* Update ar_AR.json

* Update ar_AR.json
2024-05-19 16:41:51 +08:00
bovirus
d8ae740427 Update Italian help/menu (#2752) 2024-05-19 16:41:37 +08:00
Samuel Johnson
b685157ae3 Minor Update on README.md for Consistency (#2687) 2024-05-19 16:41:12 +08:00
Fabian-Gruenbichler
3f6ddb6fb6 support zvol devices (#2678)
their partitions are exposed as "/dev/zdXXpY", handle accordingly.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-05-19 16:39:34 +08:00
Zhymabek Roman
b8838b305d Adding root user check to ExtendPersistentImg (as in CreatePersistentImg) (#2633)
* Adding root user check & Enhance help info

* Update root user check
2024-05-19 16:35:22 +08:00
Batuhan
00de8b932d Update tr_TR.txt (#2618)
corrected grammar mistakes, fixed typos
2024-05-19 16:29:13 +08:00
WebSnke
1e49dbe957 Update German translation (#2612) 2024-05-19 16:28:35 +08:00
Ida Bagus
580416facc Update languages.json (#2600)
minor update for indonesian language
2024-05-19 16:28:25 +08:00
gcf
75cf728fa9 The gpt pointer is not initialized, and when offset < 0, it may result in freeing unallocated memory. (#2499)
Signed-off-by: yuxiaojun <yuxiaojun1011@outlook.com>
Co-authored-by: yuxiaojun <yuxiaojun1011@outlook.com>
2024-05-19 16:27:19 +08:00
Ikko Eltociear Ashimine
8723aeb4cc fix typo in diskio.h (#2497)
fucntion -> function
2024-05-19 16:25:42 +08:00
SunderB
dc9a99bb20 Correct some spelling and grammar in BuildVentoyFromSource.txt (#2491) 2024-05-19 16:24:41 +08:00
Hoang Nguyen
a40456d9d2 Added Vietnamese language support for GRUB and updated Vietnamese translation of the installer (#2362)
* Updated Vietnamese language

Added new translation for `STR_4KN_UNSUPPORTED` and retouched in some places

* Added Vietnamese language support for GRUB menu

* Removed vi_VN from helplist and menulist
2024-05-19 16:17:54 +08:00
Balázs Úr
bdab55e8aa Updated Hungarian translation (#2836) 2024-05-19 16:11:30 +08:00
longpanda
1b2483ec14 Skip trash directory by default. (#2831) 2024-05-19 16:00:46 +08:00
longpanda
c16e76130b Fix VTOY_LINUX_REMOUNT option for latest CentOS 9 Stream. (#2827) 2024-05-19 15:35:05 +08:00
longpanda
d672af4819 Support ext4 fs with checksum seed feature. 2024-05-19 12:14:02 +08:00
longpanda
712f10e86a Fix VTOY_LINUX_REMOUNT feature in RHEL 9.4+ (#2827) 2024-05-14 14:59:12 +08:00
longpanda
2be340d2e8 update 2024-05-12 14:57:19 +08:00
longpanda
b77ef718b4 bugfix 2024-05-12 12:37:12 +08:00
longpanda
72f5710b88 Fix arch iso boot issue (#2825 #2824) 2024-05-12 12:36:58 +08:00
longpanda
ee7da60d88 Fix the boot issue for latest KAOS. 2024-04-06 23:53:07 +08:00
longpanda
44fb9f4564 Fix the VTOY_LINUX_REMOUNT option on latest linux kernel 2024-04-06 21:22:17 +08:00
longpanda
3f65f0ef03 1.0.97 release 2024-01-24 15:02:32 +08:00
longpanda
4faa5e4344 update tool 2024-01-24 13:35:27 +08:00
longpanda
c7693d4ecd Fix VTOY_LINUX_REMOUNT option does not work with latest linux kernel version. (#2661 #2674) 2024-01-24 12:09:29 +08:00
longpanda
4527e1db79 Add support for FreeBSD 14.0 2024-01-23 09:08:23 +08:00
longpanda
757cacf274 Fix Proxmox 8.1 boot issue. (#2657) 2023-12-04 23:00:31 +08:00
longpanda
39703cabb7 Fix the VentoyPlugson issue that default_file value is wrong for more than 10 theme files. (#2608) 2023-10-14 22:15:24 +08:00
longpanda
854d17a4e9 1.0.96 release 2023-10-06 22:39:39 +08:00
Maicol Battistini
a326b13fc3 Added italian translation (#2580) 2023-10-06 22:33:17 +08:00
longpanda
3ff1867a2a Fix the warning prompt for Ventoy2Disk.sh (#2593) 2023-10-06 22:05:39 +08:00
longpanda
7f63a1c327 Fix the issue that VTOY_LINUX_REMOUNT=1 does not work on some distros (e.g. Pop OS/openSUSE/Ubuntu 23.04) (#2475 #2551) 2023-10-06 21:12:34 +08:00
longpanda
d617985093 Add escaping for path in VentoyPlugson.sh (#2585) 2023-10-06 16:43:26 +08:00
longpanda
605da1ba94 Fix that bootpwd not working for VentoyPlugson. (#2584) 2023-10-03 23:49:22 +08:00
longpanda
c8dc36a5c3 1.0.95 release 2023-08-23 09:26:53 +08:00
I'm an OSK user, are you?
689f7df902 Update Swedish language (#2443) 2023-08-22 11:34:38 +08:00
Sönke Joppien
a9d53e7448 Update German translation (#2500) 2023-08-22 11:33:48 +08:00
Hugo Carvalho
46061bcd41 Update languages.json (#2504)
Update Portuguese (Portugal) translation
2023-08-22 11:33:34 +08:00
Felipe
01b0de7811 Updated brazilian portuguese translation - aside that included 2 missing translations. (#2533)
* Updated brazilian portuguese translation

Translated one string that wasnt translated and fixed the other ones.

* Added a brazilian portuguese file

It was missing one, suggested by https://www.ventoy.net/en/doc_menu_language.html

* Added a brazilian portuguese file

One was missing, again this is also a suggestion of https://www.ventoy.net/en/doc_menu_language.html
2023-08-22 11:23:15 +08:00
longpanda
2fee243a56 Support drag resize dialog window width. 2023-08-22 11:21:17 +08:00
longpanda
d0e10f8e48 Support veket_24 2023-07-31 23:33:25 +08:00
longpanda
7ff243f9bb Fix the media missing issue when boot UOS server ISO file. 2023-07-30 12:58:29 +08:00
longpanda
f8811a4656 1.0.94 release 2023-07-20 11:54:46 +08:00
VenusGirl❤
0ce90ad9b9 Update ko_KR.json (#2483) 2023-07-20 11:00:38 +08:00
Vasilis
5bfddae81d Update languages.json (#2482)
Greek language update
2023-07-20 11:00:21 +08:00
YALdysse
2991f097fb fixed ukrainian translation (#2469)
* Update uk_UA.txt

* fix ukrainian translation
2023-07-20 10:59:48 +08:00
Stanislav
986835338d i18n: Small fix Russian language (#2473)
* i18n: Small fix Russian language

* Update languages.json
2023-07-20 10:59:34 +08:00
bovirus
f2562fecb9 Update italian strings (#2465) 2023-07-20 10:58:08 +08:00
Jianfeng Liu
529541f218 fix Synchronous Exception on some arm cpus (#2488) 2023-07-20 10:56:55 +08:00
longpanda
430f81ac49 cc 2023-06-23 23:07:21 +08:00
longpanda
038c0533d9 1.0.92 release 2023-06-23 21:29:51 +08:00
lollilol
102b179cd9 change password input field to type=password (#2427) 2023-06-23 16:28:38 +08:00
Kosta Stojiljkovic
6785f5d049 Added Serbian translation for STR_4KN_UNSUPPORTED strings for cyrilic and latin scripts. (#2406) 2023-06-23 16:27:11 +08:00
William Poetra Yoga
0c812ed5e9 fix: grep warning (#2398) 2023-06-23 16:26:55 +08:00
Blaž Osredkar
9f2b9b0867 Added Slovenian language (#2378) 2023-06-23 16:26:19 +08:00
wiz64
c79b072680 Update languages.json (viva l' ventoy) (#2372) 2023-06-23 16:25:39 +08:00
Nikolas Garofil
6b4509a550 Environment typos (#2368) 2023-06-23 16:24:36 +08:00
longpanda
feea11e2bb Support unattended auto install for Deepin/UOS 2023-05-29 00:11:21 +08:00
A1ive
35c952d891 Correct EFI chainloader image device path (#2397) 2023-05-19 23:23:14 +08:00
Dolphin Oracle
82053680bf Update ventoy-hook.sh for MX Linux (#2390)
due to a systemd issue, we had to rename initrd-release to initrd_release.
2023-05-15 12:30:03 +08:00
longpanda
6d5de12f52 Merge branch 'master' of https://github.com/ventoy/Ventoy 2023-04-21 20:05:40 +08:00
longpanda
84b2ee7ee3 Fix the boot issue for Fedora/CentOS when file name contains special character (e.g. '(' ) #2360 2023-04-21 20:05:30 +08:00
K.B.Dharun Krishna
da1b306e81 ci.yml: bump actions to v3 to fix node warning (#2341) 2023-04-13 19:25:31 +08:00
longpanda
0961ce5624 1.0.91 release 2023-04-05 20:41:34 +08:00
longpanda
07574f0379 Improve grub2 mode process for legacy BIOS mode. 2023-04-05 20:16:36 +08:00
Steve
142aa47944 fixed german translation (#2318)
* Updated german translation

#2277 has an small issue (misstyping; "nocht" should read "noch")
Changed the translation. It is minimally shorter.

* fixed german translation
2023-04-04 13:54:49 +08:00
longpanda
11739fa9d0 Fix a bug that Fedora boot error if Ventoy partition is NTFS. (#2333) 2023-04-03 21:49:21 +08:00
longpanda
9fc85051a7 Fix the issue for booting Bliss OS 15.x 2023-04-03 09:18:13 +08:00
longpanda
b9e82bcf16 Support FreeBSD 14-CURRENT 2023-04-02 13:17:20 +08:00
longpanda
cff3a01289 Support NTFS with large cluster size (greater than 64KB). 2023-03-28 11:38:46 +08:00
longpanda
0f90149c4e 1.0.90 release 2023-03-26 19:01:13 +08:00
longpanda
8ef9732931 Update vtoytool 2023-03-26 16:03:32 +08:00
longpanda
b32eda4262 Fix the VTOY_LINUX_REMOUNT option for new linux kernel in intel 11th(and later) gen CPU. 2023-03-26 10:45:19 +08:00
longpanda
e743f7c15f Add support for chimera linux. (#2309) 2023-03-24 20:43:47 +08:00
longpanda
652475f1ef Optimization for Fedora boot process 2023-03-24 10:37:24 +08:00
longpanda
abfc2a6343 Add checksum jif 2023-03-21 15:44:54 +08:00
longpanda
e73ac04cb6 update README.md 2023-03-20 17:15:36 +08:00
StoyanDimitrov
8727e63880 Update languages.json (#2299) 2023-03-17 17:39:57 +08:00
VenusGirl❤
2d281d7dee Update ko_KR.json (#2286)
Korean Update
2023-03-17 17:39:21 +08:00
Steve
385c806adf Updated german translation (#2279)
#2277 has an small issue (misstyping; "nocht" should read "noch")
Changed the translation. It is minimally shorter.
2023-03-17 17:39:02 +08:00
longpanda
e869bc2386 Fix the issue that Fedora Rawhide install media not detected. (#2283) 2023-03-10 22:33:53 +08:00
longpanda
b47aa1abc7 Support LibreELEC 11.0+ (#2281) 2023-03-09 23:59:12 +08:00
longpanda
d8698b2194 1.0.89 release 2023-03-07 19:21:15 +08:00
longpanda
7fa4724743 Fix the menu missing issue when there exist an invalid vlnk file. (#2228) 2023-03-07 18:05:33 +08:00
WebSnke
2717405a7a Add German translation for STR_4KN_UNSUPPORTED (#2277) 2023-03-05 20:59:09 +08:00
wiz64
d494007df9 update japanese (#2264) 2023-03-05 20:58:55 +08:00
Tayfun Akkoyun
bc9e3f641b Update tr_TR.txt (#2262)
Long translations edited to be shorter
2023-03-05 20:58:32 +08:00
dmitrygribenchuk
9f02d37001 Update translation (#2261)
* update translation

* update translation
2023-03-05 20:58:16 +08:00
Thunderstrike116
fa1461bac7 Add Greek Language (#2258)
* Added Greek Translation

* Added Greek Translation
2023-03-05 20:57:55 +08:00
marcellogianola
3d56c3fa17 Update languages.json (#2257) 2023-03-05 20:57:29 +08:00
ИEØ_ΙΙØZ
a7e3d78d14 Update zh_TW.json (#2256) 2023-03-05 20:57:05 +08:00
longpanda
879a7592bd Fix dm_patch for new linux kernel. 2023-02-20 11:59:03 +08:00
longpanda
5a433f49f7 Optimization for booting Fedora series. 2023-02-18 21:33:05 +08:00
Ikko Eltociear Ashimine
0cce956c54 Fix typo in EXT/README.txt (#2247)
bellow -> below
2023-02-18 21:31:37 +08:00
Ing. Jan Kaláb
0b6372857c Fix typo in Czech translation (#2252)
Thanks to Jiří Červinka
2023-02-18 21:31:19 +08:00
M
028663de9a Update Polish translation (#2232) 2023-02-18 21:31:09 +08:00
Tyemak
5feb3f7b4b Update languages.json (#2230) 2023-02-18 21:30:48 +08:00
longpanda
7035787f38 update languages.json 2023-02-08 10:42:35 +08:00
ИEØ_ΙΙØZ
7dd0f509f5 Update languages.json (#2207)
Fixed one string for Traditional Chinese,
Sorry, I missed it in my last submission.
2023-02-08 10:37:35 +08:00
andrewczm
15947caea2 Updated Polish translation (#2212)
* Update pl_PL.json

A few corrections to the Polish translation

* Update pl_PL.json

small correction

* Update pl_PL.json

the latest update

* Updated Polish translation

Some cosmetic corrections in the Polish translation
2023-02-08 10:36:39 +08:00
YALdysse
6aeba8f8b4 fix ukrainian language (#2222) 2023-02-08 10:36:16 +08:00
ИEØ_ΙΙØZ
fd46b2c3c3 Update languages.json (#2204)
add & correct some strings
2023-02-02 15:51:28 +08:00
YALdysse
e502f4291e Ukrainian language (#2199) 2023-02-02 15:50:22 +08:00
andrewczm
9c59c27eff Update pl_PL.json (#2191)
* Update pl_PL.json

A few corrections to the Polish translation

* Update pl_PL.json

small correction

* Update pl_PL.json

the latest update
2023-02-02 15:50:02 +08:00
YALdysse
daeb96ce80 fixed russian translation (#2190) 2023-02-02 15:49:42 +08:00
YALdysse
b7e878c466 fixed russian translation (#2189) 2023-02-02 15:49:28 +08:00
VenusGirl❤
b76ebf5b07 Update languages.json (#2186) 2023-02-02 15:49:10 +08:00
VenusGirl❤
9532776f39 Update ko_KR.txt (#2188)
* Update ko_KR.txt

* Update ko_KR.txt
2023-02-02 15:48:43 +08:00
Ing. Jan Kaláb
d8e81d41e4 Czech translation (#2185)
* Czech translation

* Fix missing translations

---------

Co-authored-by: Ing. Jan Kaláb <jan@kalabovi.org>
2023-02-02 15:48:16 +08:00
VenusGirl❤
fa3aa3b36f Update ko_KR.json (#2177)
* Update ko_KR.json

* Update ko_KR.json

* Update ko_KR.json
2023-02-02 15:47:48 +08:00
MELERIX
e717d00d53 Update Spanish Latinoamérica translation (#2179) 2023-02-02 15:47:30 +08:00
wiz64
6bcaf19a1a Update languages.json (#2172) 2023-01-16 15:35:25 +08:00
wiz64
bcbe8835d4 update Russian and Bengali languages.json (#2167) 2023-01-15 21:10:25 +08:00
gidano
ed746ce13e Fixed hungarian text (#2163) 2023-01-15 21:10:11 +08:00
VenusGirl❤
07a790fc6a Update languages.json (#2160)
Korean Update
2023-01-15 21:09:54 +08:00
Tayfun Akkoyun
fd393a02fd Update languages.json (#2159)
"STR_4KN_UNSUPPORTED" line is translated to turkish language
2023-01-15 21:09:37 +08:00
longpanda
0501d03dbb Fix the syntax error in hu_HU.json 2023-01-15 13:15:51 +08:00
longpanda
c9939a8cfc Ignore reserved space when do non-destructive installation via GUI. (#2168) 2023-01-15 09:41:46 +08:00
longpanda
5067020a61 Add tip message when theme file contains non-enclosed literal values. (#2166) 2023-01-14 23:07:08 +08:00
longpanda
4f5334026e 1. Fix the issue that Ventoy2Disk_X64.exe can not run under altexe directory.
2. Fix the issue that VentoyPlugson_X64.exe exit silently.
3. Add missing /FS option for Ventoy2Disk.exe in Windows command line mode.
4. Ventoy2Disk.exe automatically change current directory when started from other directory.
2023-01-14 21:56:19 +08:00
longpanda
3e34dd8514 1.0.88 release 2023-01-13 21:57:44 +08:00
longpanda
4df793e021 1. Add new options for Windows CLI mode.
2. Add tip message for 4k native disk.
2023-01-13 20:55:40 +08:00
longpanda
e0132ac4b5 switch to en_US when use text mode. 2023-01-10 16:17:08 +08:00
VenusGirl❤
2b3192b098 Update ko_KR.json (#2152) 2023-01-10 15:48:22 +08:00
민웅기
7ee3a6d9f8 Update ko_KR (부트 -> 부팅) (#2147)
Changed the word "boot" to be spelled "부팅" rather than "부트" in the general context.

일반적인 맥락에서 단어 "boot"는 부트보다 부팅로 표기되므로 변경하였습니다.
2023-01-10 15:09:29 +08:00
Pierfrancesco Passerini
e1d3ca9fc4 Update italian language (#2141)
Small fix to Italian
2023-01-10 15:09:17 +08:00
Stefan Šućur
8653832551 Fixed and updated Serbian translations (both writing systems) (#2144)
* Update Serbian (both writing systems)

Fixed a stray Cyrillic word in the Latin text.
Translated the untranslated strings in both texts.
Changed a word in both texts.
Added part of a string that was missing in the Cyrillic version.
Fixed spelling mistakes in the Cyrillic text.

* Update languages.json

Added myself to the credits of the Cyrillic text too, as I forgot to do so earlier.
2023-01-10 15:08:54 +08:00
longpanda
c308892db0 Show file checksum menu title according to the existence of checksum value. 2023-01-10 12:23:35 +08:00
longpanda
1300f7f4f1 Fix the VHD(x) boot issue introduced in 1.0.87. 2023-01-10 09:37:05 +08:00
longpanda
d9182dbfa4 Fix the syntax error in F4 localboot 2023-01-10 09:17:18 +08:00
longpanda
e988c0dfe2 Fix that workaround #2 not working for Legacy BIOS access limit. 2023-01-08 21:35:50 +08:00
longpanda
0714971f8c Fix VTOY_WIN11_BYPASS_CHECK/VTOY_WIN11_BYPASS_NRO option web page display issue. 2023-01-07 20:14:38 +08:00
longpanda
3c03df31ce 1.0.87 release 2023-01-07 15:57:53 +08:00
longpanda
e24dacadcd Add /F option for VentoyPlugson.exe to use the system default browser.
By default it will firstly try to use Google Chrome if possible.
2023-01-07 15:35:47 +08:00
longpanda
315cabb945 Fix the file path when file checksum in F2 browse mode. 2023-01-07 11:33:04 +08:00
longpanda
72f25f14fc Merge branch 'master' of https://github.com/ventoy/Ventoy 2023-01-06 21:26:39 +08:00
longpanda
47e1553d23 Optimization for VTOY_WIN11_BYPASS_NRO option process. 2023-01-06 21:26:31 +08:00
MELERIX
9a2a7e83eb Add Spanish Translation (json/txt) grub menu (#2135)
* Add Spanish Tranlsation (json/txt) grub menu

* renamed
2023-01-06 12:23:05 +08:00
K.B.Dharun Krishna
5f747148c6 grub/menu: Update Tamil translation (#2133) 2023-01-06 11:55:40 +08:00
longpanda
686ed11037 Optimization for Lenovo Recovery Image (USB unplug process) 2023-01-05 22:18:39 +08:00
longpanda
7fe4762faa 1. grub2 mode supports Porteus ISO file.
2. Optimization for Lenovo Recovery Image.
2023-01-04 21:46:40 +08:00
longpanda
eac1c35f76 Fix the bug when F2 browse and boot VHD/VHDX files in an extend logic partition. 2023-01-04 19:22:02 +08:00
longpanda
c7dcaa5734 1. Fix the blank item in the last of Language select menu
2. Fix the menu display VTLANG_NO_PERSISTENCE issue when use persistence
2023-01-04 19:19:32 +08:00
longpanda
4b17ee30c4 Add "return to previous menu" in secondary boot menu for convenience. 2023-01-04 15:55:32 +08:00
longpanda
a18aa36c01 Code optimization 2023-01-04 15:39:03 +08:00
Tyemak
1de7489c6d Update ru_RU.txt (#2130) 2023-01-03 20:58:13 +08:00
longpanda
afb3340ce7 Disable Fn/L/Ctrl hotkeys when selecting auto install script or perssitence file. 2023-01-03 19:11:36 +08:00
longpanda
fdce4a756a Add support for Dell PER ISO. (#2113) 2023-01-03 16:43:17 +08:00
longpanda
5a7fa0c565 Support lenovo product recovery iso file. 2023-01-03 11:35:27 +08:00
longpanda
287d77224c Disable Fn/L/Ctrl hotkeys on select WIM menu. 2023-01-03 11:29:50 +08:00
longpanda
c6bd857cbe Support BSD style for .md5/.sha1/.sh256/.sha512 checksum file.
Support VENTOY_CHECKSUM file for checksum file.
(#2112)
2023-01-01 00:31:08 +08:00
wiz64
b4bb6efd3c Update ru_RU.txt (#2120) 2022-12-31 20:59:08 +08:00
Hildo Guillardi Júnior
7386f64ed8 Update pt_PT.json (#2118) 2022-12-31 20:58:50 +08:00
Hildo Guillardi Júnior
044ca8811d PT translate and SI grammar (#2117) 2022-12-31 20:58:38 +08:00
Tyemak
8c6fd872af Update ru_RU.json (#2114) 2022-12-31 20:58:06 +08:00
longpanda
683101ae1a vtoyjump optimization.
Signed-off-by: longpanda <admin@ventoy.net>
2022-12-31 19:41:15 +08:00
longpanda
0e968e266e Update the F1 help text. WIMBOOT mode supports both Windows and WinPE ISO files. 2022-12-29 18:48:06 +08:00
longpanda
d94d59583a Search VTEFI directory for UEFI boot files.
When user install for example Windows in the reserved space of Ventoy USB stick in UEFI mode.
Windows will create part 3 as the EFI partition and when you boot the USB stick, the BIOS may skip Ventoy and directly boot the Windows.
To avoid this, we suggest to rename the directory name from EFI to VTEFI.
2022-12-26 22:08:23 +08:00
gidano
05bbef63c1 Edited! (#2105)
* Hungarian translation

* Hungarian translation

* HU update languages.json

Jól értettem, hogy a *#-t módosítani kell \r\n-re?!

* Edited!
2022-12-26 17:01:43 +08:00
longpanda
8923d4b8f1 Fix the menu title of F5 Tools ---> Power ---> $VTLANG_POWER_REBOOT_EFIFW 2022-12-26 16:56:53 +08:00
longpanda
377cd9e468 Update readme 2022-12-25 17:23:50 +08:00
longpanda
be78728342 1.0.86 release 2022-12-24 21:19:31 +08:00
Tayfun Akkoyun
3938fbb351 Update tr_TR.json (#2101) 2022-12-24 15:59:32 +08:00
longpanda
a2e7afd893 Update menu language translation 2022-12-24 10:16:13 +08:00
wiz64
27bb4a1168 Update bn_BN.json (#2100) 2022-12-24 10:06:41 +08:00
wiz64
b8b8c7bd66 Update hi_HI.json (#2099) 2022-12-24 10:06:29 +08:00
longpanda
12b51bcf09 Change the prompt format when check device failed. (#2094) 2022-12-24 09:39:27 +08:00
longpanda
911d5dcab9 Remove useless BypassStorageCheck registry when VTOY_WIN11_BYPASS_CHECK is set to 1. (#1873) 2022-12-23 23:41:57 +08:00
longpanda
f597497da6 1. Add VTOY_WIN11_BYPASS_NRO option in Global Control Plugin.
2. Change the default value of VTOY_WIN11_BYPASS_CHECK and VTOY_WIN11_BYPASS_NRO options to 1.
2022-12-23 23:17:39 +08:00
Frede H
54bca8c942 Added Danish (Dansk) to languages.json (#2096) 2022-12-23 16:01:45 +08:00
VenusGirl❤
6b422ad9c1 Update ko_KR.json (#2092) 2022-12-23 15:54:27 +08:00
wiz64
925d057883 Update ru_RU.json (#2091) 2022-12-23 15:54:08 +08:00
longpanda
a377dd6172 Support config ventoy_left/ventoy_top/ventoy_color in theme.txt.
The configuration must be the first line in theme.txt and must be in the following format.
ventoy_left_top_color: "@5%@95%@#0000ff@"

The format is very strict:
1. ventoy_left_top_color must start with no space in front of.
2. left/top/color options must be around with 4 @
2022-12-23 15:52:43 +08:00
longpanda
4707022ef9 Add prompt and wait for key when Ventoy check device failed. (#2094) 2022-12-23 11:42:22 +08:00
Tayfun Akkoyun
e03c73978a Update tr_TR.json (#2090)
New Turkish menu interface lines is translated (VTLANG_CTRL_TEMP_SET,VTLANG_WIN11_BYPASS_CHECK,VTLANG_LINUX_REMOUNT,VTLANG_SECONDARY_BOOT_MENU)
2022-12-22 23:13:49 +08:00
longpanda
f434d1f5d0 Add Temporary Control Settings menu.
Refer https://www.ventoy.net/en/doc_ctrl_settings.html for details.
2022-12-22 22:14:51 +08:00
longpanda
23f8bc8aeb Add resolution_fit option in theme plugin. 2022-12-22 18:26:01 +08:00
wiz64
f2016ab899 Update Actions Image route (#2088) 2022-12-22 14:28:52 +08:00
wiz64
7acbf7e819 Update bn_BN.json (#2085) 2022-12-22 14:28:38 +08:00
Ida Bagus
0135bf1934 Update languages.json (#2087) 2022-12-22 10:04:22 +08:00
wiz64
f2c94bd963 Improve grammar (Readme.md) (#2086) 2022-12-22 10:04:01 +08:00
longpanda
676ae725ae Fix the egrep warning. (#2083) 2022-12-21 19:59:16 +08:00
longpanda
54dd35d277 Merge branch 'master' of https://github.com/ventoy/Ventoy 2022-12-21 13:22:11 +08:00
longpanda
3e75b2df3b VentoyPlugson: Add Windows duplicate file path check for different upper/lower case. 2022-12-21 13:21:54 +08:00
wiz64
2d1230cba4 Update hi_HI.json (#2081) 2022-12-20 21:17:49 +08:00
wiz64
309f85fd35 update ru_RU.json (#2080)
* Update ru_RU.json

* Update ru_RU.json
2022-12-20 21:17:41 +08:00
VenusGirl❤
a13d6d9c0e Update ko_KR.json (#2079) 2022-12-20 21:17:24 +08:00
longpanda
9b7d6cbc3d Add theme plugin duplicate file check. (#2078) 2022-12-20 20:02:06 +08:00
longpanda
bf797ceadb Fix the drive letter case check issue for VentoyPlugson in Windows. (#2078) 2022-12-20 18:46:04 +08:00
longpanda
cd0c7ca884 Extend the donate link width. 2022-12-20 14:05:01 +08:00
longpanda
201f7cc13c Change the MBR partition type to 0x0C when select FAT32 for installation. 2022-12-20 00:16:01 +08:00
longpanda
44a3e23740 Optimization for the implement of menu languages. 2022-12-19 23:49:25 +08:00
9c3e1a6880 update Japanese translation (#2077)
* Remove unnecessary space.

* Unify the translation terms into which used in other files
  (language.json, help/ja_JP.txt...)
2022-12-19 22:21:27 +08:00
wiz64
8a664faa04 Update languages.json (#2076) 2022-12-19 22:20:51 +08:00
Hoàng Điềm Tĩnh
398ba9fb56 Update languages.json (#2075)
I update for Vietnamese lang. Please add to your the next release.
2022-12-19 22:20:34 +08:00
Tayfun Akkoyun
e7a0c2d359 Update languages.json (#2074)
hi master
STR_DONATE parameter is translated for turkish users again
2022-12-19 22:20:07 +08:00
longpanda
22ad828df2 1.0.85 release 2022-12-18 22:11:28 +08:00
longpanda
83f22173a5 menu language update 2022-12-18 17:30:29 +08:00
longpanda
2de7d9ffe0 Suppress some prompt window when install Ventoy. 2022-12-17 23:36:59 +08:00
Tyemak
5c174c4521 Update languages.json (russian translation) (#2070)
* Update languages.json

* Update languages.json
2022-12-17 23:34:03 +08:00
longpanda
c76ece4b74 Fix the format failure when install Ventoy. 2022-12-16 17:03:05 +08:00
longpanda
27eda4d1e7 Fix the issue when booting Peux distro iso file. 2022-12-13 12:17:46 +08:00
longpanda
acf5a84467 Add Arabic menu language. 2022-12-12 11:00:57 +08:00
longpanda
c93e406aa5 Add missing file. 2022-12-11 21:59:09 +08:00
longpanda
1b164e74e4 update pl_PL.json 2022-12-11 10:49:02 +08:00
longpanda
308cb86f83 Fix json syntax error. 2022-12-11 10:30:31 +08:00
longpanda
2ec593d355 Add pl_PL language for menu. 2022-12-11 10:22:39 +08:00
longpanda
594e735b91 Merge branch 'master' of https://github.com/ventoy/Ventoy 2022-12-10 19:27:49 +08:00
longpanda
6203366040 grub2 mode support KNOPPIX 2022-12-10 19:27:38 +08:00
Thomas De Rocker
64f4400305 Update languages.json (#2046) 2022-12-10 17:32:03 +08:00
Alexander Dolidze
d00e08e2e1 added Georgian (ka_GE) translation (json/txt) for grub menu (#2044)
Co-authored-by: Alexander Dolidze <alexander.dolidze@azry.com>
2022-12-10 17:31:48 +08:00
Hugo Carvalho
c6008be394 Update Portuguese(Portugal) Translation (#2039)
* Update languages.json

Update Portuguese (Portugal) language

* Update Portuguese(Portugal) Translation

* Update Portuguese(Portugal) Translation
2022-12-10 17:31:31 +08:00
longpanda
a5c6859f5f Add zh_TW menu language. 2022-12-09 21:36:32 +08:00
longpanda
497d4cc991 update grub2 mod file 2022-12-09 21:33:59 +08:00
VenusGirl❤
7e7687afe3 Update ko_KR.txt (#2038) 2022-12-08 21:11:04 +08:00
Ida Bagus
dd3276badf Update id_ID.json (#2034)
first translation, if they find unrelevant translation, i will update it later
2022-12-08 21:10:49 +08:00
Ida Bagus
4a06f4a694 Update id_ID.txt (#2033)
fix little translation
2022-12-08 21:10:34 +08:00
Silejonu
c73bf256be French translation additions & corrections (#2032)
* Update fr_FR.txt

* Update fr_FR.json
2022-12-08 21:10:17 +08:00
longpanda
21851f7e96 Optimization for booting memtest86-usb.img. 2022-12-05 11:19:46 +08:00
longpanda
f222f8cac9 Auto memdisk plugin support some IMA/IMG files. 2022-12-05 10:51:15 +08:00
gidano
40c4825aac Hungarian translation (#2028)
* Hungarian translation

* Hungarian translation
2022-12-04 18:42:53 +08:00
VenusGirl❤
dd906e0b16 Update ko_KR.txt (#2025) 2022-12-04 17:38:48 +08:00
K.B.Dharun Krishna
324f2b927c grub/*: add Tamil translation (#2023)
* grub/menu: Add Tamil translation

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* grub/help: Add Tamil translation

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2022-12-04 17:38:32 +08:00
K.B.Dharun Krishna
5797ca3396 grub/help/en_US: Fix typos (#2024)
* grub/help/en_US: Fix typos

* Apply suggestions from code review

* Fix typo in line 15
2022-12-04 17:37:25 +08:00
longpanda
b36b322c03 Update languages.json 2022-12-04 17:33:46 +08:00
longpanda
fd7e34b632 1.0.84 release 2022-12-04 15:33:16 +08:00
longpanda
e85c02756b 1.0.83 release 2022-12-04 13:15:18 +08:00
wiz64
c1d68bd787 Add Russian Tranlsation (json/txt) grub menu (#2022) 2022-12-04 11:18:33 +08:00
wiz64
a35a822723 add Bengali (bn_BN.json/txt) (#2019) 2022-12-04 09:22:26 +08:00
Tayfun Akkoyun
05137c83e2 Update tr_TR.txt (#2020)
tr_TR.txt Help file is updated.
2022-12-04 09:21:58 +08:00
VenusGirl❤
8058856182 Update ko_KR.json (#2021) 2022-12-04 09:21:36 +08:00
longpanda
33b958e112 Update language json files 2022-12-03 21:37:09 +08:00
Tayfun Akkoyun
9eb50a85e4 Update tr_TR.json (#2018)
Master hi!
I translated lines again. Can you UPDATE this file again?
2022-12-03 20:17:13 +08:00
Steve
3cc7e3772e german translation (grub and related help) (#2016)
* updated german translation

translated the new strings

* german translation updated

* fixed STR_INSTALL_YES_TIP2

* german translation

* fix for F6

* german translation
2022-12-03 20:16:31 +08:00
longpanda
9c8292867f Update menu langauge json file 2022-12-03 17:53:42 +08:00
wiz64
a4053d2d05 add grub/menu hi.json (hindi) (#2014)
* add grub/menu hi.json (hindi)

* Update hi.json

* Update hotkey and rename

* Update and rename hi_HI.json to hi.json

* Rename hi.json to hi_HI.json

* Update hi_HI.json

* add grub/help/hi_HI.txt (hindi)
2022-12-03 17:45:47 +08:00
longpanda
5c14ea0a4a Add some menu language xx.json template. (copy from English) 2022-12-03 16:51:03 +08:00
longpanda
194e948cb6 Remove VTOY_HELP_TXT_LANGUAGE option from Global Control Plugin. 2022-12-03 14:33:52 +08:00
K.B.Dharun Krishna
c896c03efe language.json: Update Tamil translation (#2009) 2022-12-03 13:52:47 +08:00
wiz64
574b4d850c Update French [languages.json] (#2015) 2022-12-03 13:52:23 +08:00
wiz64
68a98325e6 Update German [languages.json] (#2006) 2022-12-03 13:52:08 +08:00
longpanda
25b055bb0f Hotkey change:
1. Change F1 from Memdisk to help
2. Add d/Ctrl+d for Memdisk
3. Add L for Language selection

So update the help txt files and menu json files at the same time.
2022-12-03 13:44:46 +08:00
longpanda
bda74cd89b VentoyPlugson supports multi-language menu option. 2022-12-02 20:46:57 +08:00
longpanda
511b8091eb Add muli-languages support for Ventoy menu.
F5 ---> Menu Language Select
Language files are in INSTALL/grub/menu/ directory.
2022-12-02 20:35:59 +08:00
VenusGirl❤
3be4aacd78 Update languages.json (#2003) 2022-12-02 20:26:34 +08:00
wiz64
2d8b27b172 Update Hindi & Bengali languages (#2002) 2022-12-02 20:26:21 +08:00
wiz64
c174410d35 Update Romanian Translation (#2001)
Co-authored-by: cezarlacatus 42448787+cezarlacatus@users.noreply.github.com
2022-12-02 20:26:06 +08:00
wiz64
f83e84f868 Fixed syntax errors for recent PRs (#1999) 2022-12-02 20:25:50 +08:00
dmitrygribenchuk
a39078b87a add belarussian and update ukranian and russian (#1998) 2022-12-02 11:42:59 +08:00
Tayfun Akkoyun
2576235f97 Turkish update_language.json (#1996)
New Turkish translate rows are completed
2022-12-02 11:42:31 +08:00
longpanda
ee04af5243 Ventoy2Disk update:
1. Add UDF filesytem option.
2. Add Cluster Size option.
3. Support FAT32 for disk bigger than 32GB.
4. Fix the format fail issue.
5. Add a tip bubble with cluster size when mouse hover on the file system type string.
6. The secure boot lock character can not show in early Windows, change it to a yellow icon.
2022-11-30 21:12:43 +08:00
Ida Bagus
118bedd546 Indonesian translation update (#1978)
translating STR_PART_VENTOY_FS row & little change
2022-11-30 20:54:37 +08:00
longpanda
44ff3dd8d4 VentoyPlugson: Fix the garbled preview json for unicode characters. 2022-11-23 14:27:58 +08:00
wiz64
9da5a6ce65 Update Romanian Translation (languages.json) (#1968)
* Updated Romanian (languages.json)

Co-authored-by: cezarlacatus <42448787+cezarlacatus@users.noreply.github.com>

* Updated Romanian (languages.json)

Co-authored-by: cezarlacatus <42448787+cezarlacatus@users.noreply.github.com>

Co-authored-by: cezarlacatus <42448787+cezarlacatus@users.noreply.github.com>
2022-11-19 19:17:38 +08:00
marcellogianola
604b25ec82 Update languages.json (#1965) 2022-11-19 19:17:14 +08:00
Vasilis
0918355035 Update languages.json (#1963)
Updated Greek translation
2022-11-18 15:28:32 +08:00
wiz64
ce76fd5649 Update German, French (#1962)
Co-authored-by: galaxy2211 <56916688+galaxy2211@users.noreply.github.com>

Co-authored-by: galaxy2211 <56916688+galaxy2211@users.noreply.github.com>
2022-11-18 15:28:17 +08:00
MELERIX
42535f35bc Update Spanish (Latinoamérica) translation (#1961)
* Update Spanish (Latinoamérica) translation

* Delete languages.json.bak
2022-11-18 15:25:38 +08:00
longpanda
68a9cebe19 1.0.82 release 2022-11-17 17:56:11 +08:00
wiz64
cc77c74bf4 Update Russian, Hindi, Bengali (languages.json) (#1959) 2022-11-17 17:15:29 +08:00
Tayfun Akkoyun
ee952e3f69 Turkish update.json (#1960) 2022-11-17 17:15:01 +08:00
longpanda
b11a499939 Update BOOT/BOOTX64.EFI and mm efi files from Fedora 37. 2022-11-16 22:34:37 +08:00
longpanda
fdf4693433 Ventoy2Disk.exe update.
1. Add exFAT/NTFS/FAT32 option when install Ventoy
2. Display Ventoy partition file system in physical disk
3. String "Status x%" is missing for translations (#1667)
2022-11-16 20:33:14 +08:00
VenusGirl❤
ac65c0fb24 Update languages.json (#1957) 2022-11-16 19:45:15 +08:00
wiz64
ea0afe7c8b Update Bengali Translation (#1956) 2022-11-16 19:44:58 +08:00
wiz64
f8ca8b13d3 Update Hindi Translation (#1941) 2022-11-16 17:56:04 +08:00
longpanda
678a2abdf1 Fix the disk display error when pCloud virtual disk is installed in Windows OS. 2022-11-13 19:29:49 +08:00
longpanda
e645301713 Optimization for Windows unattended install process. 2022-11-10 10:10:10 +08:00
longpanda
43b415c032 Fix an issue that CGI backup tool can not open in WePE. 2022-11-08 15:27:08 +08:00
longpanda
311d2961ca Fix the issue that help line disappears when auto-going to a submenu. (#1939) 2022-11-02 20:13:12 +08:00
longpanda
1d66584190 Change Ventoy LiveCD GUI default language to English (#1938) 2022-10-31 09:40:10 +08:00
longpanda
553c853865 Fix the issue that Linux WEB/GUI does not restore MBR when updating. (#1935) 2022-10-30 13:39:19 +08:00
longpanda
7d90912a09 Add VTOY_SHOW_PASSWORD_ASTERISK option in global control plugon. (#1931) 2022-10-26 15:27:51 +08:00
longpanda
c2336f555a 1.0.81 release 2022-10-25 19:58:10 +08:00
longpanda
87391e8b32 Update BOOTX64.EFI MMX64.EFI 2022-10-23 21:41:05 +08:00
longpanda
f9c56c6686 update vtoyjump 2022-10-22 19:54:54 +08:00
longpanda
1ab1799b72 Code Optimization 2022-10-22 16:13:03 +08:00
longpanda
4a42bdfce7 Add support for easyOS easy-4.4.2-amd64.img. (#1926) 2022-10-22 15:28:16 +08:00
longpanda
3f09fb9a23 VentoyPlugson Update:
1. Add preview json feature
2. Add reset button
3. Add configuration active identifier for each tab
4. Bug fix
2022-10-21 16:06:13 +08:00
longpanda
c87ad1d734 Fix VentoyPlugson issue when ISO partition has a drive label with a space. (#1901) 2022-10-09 09:24:16 +08:00
longpanda
5590208885 Fix the issue that rockcluster, part of config missing during install. (#1900) 2022-10-08 10:07:39 +08:00
longpanda
09a6d33d62 Add _VTNORMAL identifier. 2022-10-07 17:28:31 +08:00
longpanda
9852252aba Merge branch 'master' of https://github.com/ventoy/Ventoy 2022-10-07 11:18:04 +08:00
longpanda
0585d83a8f Fix the issue that VTOY_LINUX_REMOUNT=1 does not work with Batocera 35 (#1878) 2022-10-07 11:16:45 +08:00
A1ive
ebe0b7d282 show asterisks ('*') when typing password (#1868)
* show asterisks ('*') when typing password

* add function ventoy_password_get
2022-09-25 12:31:32 +08:00
MELERIX
261ddcef45 added Spanish (Latinoamérica) translation (#1865)
* added Spanish (Latinoamérica) translation

* Update languages.json
2022-09-25 10:14:02 +08:00
longpanda
ebc5e2e993 1. Disable Fn hotkey during secondary boot menu.
2. Recover boot mode after boot fail from secondary boot menu.
2022-09-24 21:06:29 +08:00
longpanda
d58bd8c3f7 update README.md 2022-09-23 11:32:39 +08:00
longpanda
17f9e2fd09 1.0.80 release 2022-09-21 19:41:51 +08:00
longpanda
6b22a6200e upate issue template 2022-09-21 11:27:51 +08:00
longpanda
860dce6683 Fix languages.json syntax error 2022-09-19 23:00:57 +08:00
longpanda
7fc72d5ce6 Fix a bug when ISO contains a ks=file:/xxx boot parameter. 2022-09-19 22:35:02 +08:00
K.B.Dharun Krishna
b7c3cbd23b languages.json: Add Tamil Language (#1848)
Adding Tamil Language translation to languages.json.

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2022-09-19 21:40:31 +08:00
K.B.Dharun Krishna
3de97bdf44 Fix typo in GitHub Issue Templates (#1852) 2022-09-19 21:39:32 +08:00
longpanda
e79dc57ebe wimboot mode support Bob.Ombs.Modified.Win10PEx64 (#1842) 2022-09-16 01:05:58 +08:00
longpanda
7bf85a1ef8 Add 'i' 'u' hotkey. 2022-09-14 09:27:17 +08:00
crim50n
a5e0641226 Update to support a future version of MiniOS. (#1841)
* Update minios-hook.sh

* Update minios-disk.sh
2022-09-14 09:25:24 +08:00
longpanda
2c65eec9ec [update] Make injection plugin available in WIMBOOT mode. (#1834) 2022-09-13 22:04:19 +08:00
longpanda
0c310c5bd8 Make injection plugin available in WIMBOOT mode. (#1834) 2022-09-13 21:32:35 +08:00
Kamil Aronowski
c81b49807b Mention EuroLinux support (#1832) 2022-09-12 23:18:55 +08:00
shulkalala
085e20f64d Update languages.json - Spanish (#1827) 2022-09-12 23:18:30 +08:00
Henrique
ff3ce4da66 Fix Issue #1825 (#1826)
the modifications verify user privilege and prevent improper script execution.
2022-09-12 23:18:12 +08:00
longpanda
81d3492a61 Make injection plugin available in WIMBOOT mode. (#1834) 2022-09-12 22:40:00 +08:00
longpanda
635b1a1c6c Fix the 'overflow is detected' error in WIMBOOT mode for large ISO file. 2022-09-12 21:33:47 +08:00
longpanda
10b80f2690 Add w and r hotkey for WIMBOOT and GRUB2 mode. (#1837) 2022-09-12 11:24:57 +08:00
longpanda
36c21a21e4 Always use /bin/bash to launch VentoyPlugson.sh (#1809) 2022-08-23 20:50:18 +08:00
longpanda
13eb9829fa ALT Linux multiple initrd (#1784) 2022-08-14 23:10:46 +08:00
longpanda
88f77c01e4 bug fix 2022-08-13 22:12:00 +08:00
longpanda
11b30dab5f Fix typo in VentoyPlugson web page. (#1782) 2022-08-13 15:03:09 +08:00
longpanda
fb729146de Fix the issue when booting latest Gentoo live. (#1770) 2022-08-11 17:43:15 +08:00
longpanda
92bd6733dd Update MIPS GCC 7.3 download link. (#1757) 2022-07-29 13:50:11 +08:00
longpanda
9e28dd1394 1.0.79 release 2022-07-28 19:53:28 +08:00
longpanda
4100e7a886 Fix the repo missing for Kylin V10 SP2 Server 2022-07-26 23:08:40 +08:00
longpanda
a4f5ce2c9e update languages.json 2022-07-26 11:17:09 +08:00
aligoogo
c7967ea476 add georgian language (#1755) 2022-07-26 11:14:23 +08:00
sehnemvinicius
3e7f1ca764 Update portuguese translation (#1745) 2022-07-26 11:11:48 +08:00
longpanda
1bc18295ae Fix the bug that report 'invalid value for reserved space' in GTK. (#1752) 2022-07-25 10:49:57 +08:00
ShatteredMINT
b4f1f11742 remove '=' from reserved space check (#1753)
removes the (misplaced) '=' in the check of the configured reserved space in the 'on_part_cfg_ok' function.
This caused #1752
2022-07-25 10:46:07 +08:00
Jose Riha
20010c5e88 Fix and update Slovak translation (#1708) 2022-07-16 09:02:09 +08:00
Sopor
1de18e43c5 Update Swedish language (#1706)
* Update Swedish language

* Update Swedish language

Fixed the `YES`
2022-07-16 09:01:52 +08:00
lev741
15299d4d87 Updated Czech translation (#1705)
* Update languages.json

Updated Czech translation

* Update languages.json

Corrected typo
2022-07-16 09:01:30 +08:00
longpanda
5d6d6df39b autosel doesn't work since 1.0.77 (#1716) 2022-07-13 23:40:45 +08:00
longpanda
096cc99c3c Fix a bug that VTOY_LINUX_REMOUNT option doesn't take effect in openSUSE. 2022-07-13 22:40:32 +08:00
longpanda
602e8c7fdf Fix a bug when rhel based distribution has an external kickstart file. (#1717) 2022-07-12 17:13:49 +08:00
longpanda
da35a99f7c Support Fedora CoreOS (#1727) 2022-07-12 12:13:24 +08:00
longpanda
e46e24dde7 1.0.78 release 2022-07-01 19:10:12 +08:00
longpanda
0b81845e42 .ventoyignore also works in F2 browser mode. 2022-06-30 23:28:14 +08:00
longpanda
3c621e4aca Update Super-UEFIinSecureBoot-Disk to v3.4 (#1695) 2022-06-27 22:33:20 +08:00
longpanda
aecc579fcc Fix the bug when booting latest KaOS. (#1696) 2022-06-27 22:19:11 +08:00
longpanda
598af7f45c Auto remove the redundant trailing slash when set directory path on VentoyPlugson page. 2022-06-27 19:42:18 +08:00
longpanda
24b05c0345 Fix the bug when booting latest KaOS. (#1696) 2022-06-27 09:23:34 +08:00
Balázs Meskó
6d72617ef6 Update Hungarian translation (#1693)
* Update Hungarian translation

* Fixed a typo in languages.json
2022-06-24 18:52:25 +08:00
gidano
351f15ff18 Add files via upload (#1681)
Update Hungarian translaton
2022-06-20 16:26:31 +08:00
longpanda
1ee65a60c2 Fix a bug when booting TrueNAS Core 13.0. (#1684) 2022-06-20 15:29:27 +08:00
longpanda
ecbf45defe Fix an issue when booting StorageCraft StorageProtect SPX. (#1683) 2022-06-19 21:31:27 +08:00
longpanda
b976923f00 1.0.77 release 2022-06-19 13:56:49 +08:00
StoyanDimitrov
8db8e07b61 Update Bulgarian translation (#1677) 2022-06-18 16:35:04 +08:00
longpanda
f200c14730 fix build error 2022-06-17 12:25:21 +08:00
longpanda
c090197717 Fix build error 2022-06-17 09:36:01 +08:00
longpanda
3ac17aa825 Fix the issue that install media not recognized when install Clear Linux. (#1674) 2022-06-16 22:49:04 +08:00
longpanda
595b9441e9 Support prameters expansion in auto install script. 2022-06-15 20:53:35 +08:00
longpanda
0f3d48b3d9 Fix the chain load memory alloc failure in UEFI mode. 2022-06-15 20:50:25 +08:00
longpanda
61f289aa8a Fix a bug when booting daphile-21.01 2022-06-14 13:33:59 +08:00
longpanda
b099547af6 1.0.76 release 2022-06-12 17:54:51 +08:00
longpanda
23bd2d24e9 Enable secure boot support option by default. 2022-06-12 17:18:56 +08:00
longpanda
85d1910722 Enable secure boot support option by default. 2022-06-12 12:01:48 +08:00
longpanda
9b2b4aa354 Update UEFIinSecureBoot Disk v3-3. (#1657) 2022-06-12 10:31:06 +08:00
longpanda
45122b59c0 Add support for EasyOS 4.0 2022-06-11 22:47:38 +08:00
longpanda
5e607b7f9f Support EasyOS resize partition at first boot time. 2022-06-11 22:47:16 +08:00
longpanda
1c0b4ee903 Auto use memdisk/grub2/wimboot mode if the ISO file name has _VTMEMDISK/_VTGRUB2/_VTWIMBOOT suffix. (e.g. ubuntu-22.04-desktop-amd64_VTGRUB2.iso) 2022-06-08 10:15:56 +08:00
longpanda
bf2517bb25 Support Stratodesk NoTouch OS (#1652) 2022-06-05 11:32:15 +08:00
longpanda
1065a41992 Merge branch 'master' of https://github.com/ventoy/Ventoy 2022-06-04 11:43:42 +08:00
longpanda
954cb14d87 Support Stratodesk NoTouch OS (#1652) 2022-06-04 11:43:22 +08:00
Omar Namis
4f64aecfa3 Update languages.json (#1650)
- Updated the Arabic language
2022-06-02 16:28:50 +08:00
Steve
8af432b74b updated german translation (#1648)
* updated german translation

translated the new strings

* german translation updated

* fixed STR_INSTALL_YES_TIP2
2022-06-02 16:28:35 +08:00
longpanda
d8bca311b2 Fix a bug when booting linux vdisk (.vtoy) file by F2 browser mode or by ventoy_grub.cfg in Legacy BIOS mode. 2022-06-02 10:18:16 +08:00
longpanda
025425f260 1.0.75 release 2022-05-31 19:22:02 +08:00
longpanda
b4120c4079 Update Super UEFIinSecureBoot Disk v3-2 2022-05-31 18:58:37 +08:00
longpanda
7f2f845a68 Auto use memdisk mode when booting iKuai OS. 2022-05-31 17:39:54 +08:00
longpanda
2cd22da8fb Fix a bug when booting latest Alpine linux. 2022-05-31 16:42:41 +08:00
longpanda
7b70a5278a Support programs loading for DLC Boot PE. (#1647) 2022-05-31 14:11:24 +08:00
M
f8b1f98304 Update Polish translation (#1637)
Fix typos and add new translations
2022-05-29 23:21:42 +08:00
longpanda
ddf0617d83 Fix the bug when booting ALT Linux in UEFI mode. (#1645) 2022-05-28 22:33:36 +08:00
longpanda
9b14b418b4 Fix a bug when UEFI booting KaOS-2022.04-x86_64.iso 2022-05-20 23:22:37 +08:00
longpanda
fe137522ad Fix a bug when boot in F2 browser mode if the computer has more than one disks with same size. 2022-05-08 11:41:12 +08:00
孟武.尼德霍格.龍
121d927367 Update Traditional Chinese Strings (#1615) 2022-05-07 17:35:17 +08:00
longpanda
75f3e4c5ee Add EDK debug info. 2022-05-06 14:44:10 +08:00
longpanda
fcf10deff3 Merge branch 'master' of https://github.com/ventoy/Ventoy 2022-05-05 19:12:15 +08:00
longpanda
4d4f958429 Fix the hardcoded dev/dm-0 2022-05-05 19:11:55 +08:00
e667233994 [l10n/jp] modify jp localization (#1608)
- Corrected no-need spaces (e.g. spaces after punctuation).
- Newly translated untranslated strings.
2022-05-04 16:55:05 +08:00
bovirus
57944520e5 Update italian language (#1598)
@ventoy 

Please check and merge. Thanks.
2022-05-04 16:54:56 +08:00
Urajmal
4544e221d3 Updated Slovenian language (#1597)
I did an update on Slovenian language, you can check out any problems.
2022-05-04 16:54:43 +08:00
longpanda
3263b64b8a Reduce required low memory. 2022-05-03 19:13:29 +08:00
longpanda
69da3a59d8 Reduce the required low memory. 2022-05-03 18:41:16 +08:00
longpanda
75c6c7257f Add debug info fix 2022-05-03 08:54:52 +08:00
longpanda
d4d8736620 Add debug info 2022-05-02 21:05:58 +08:00
longpanda
63f9331c31 Fix the bug when booting ATLAS Windows ISO. 2022-05-02 20:19:54 +08:00
longpanda
e1d161af4f Fix a issue when booting easyos 3.4.3+ 2022-05-02 18:21:30 +08:00
longpanda
9baa95359c Fix a bug in menu tip plugin webpage of VentoyPlugson. (#1602) 2022-04-30 14:52:00 +08:00
longpanda
5f3d7f3823 Fix the bug when booting linx iso (#1600) 2022-04-29 19:57:04 +08:00
longpanda
3d1dc81fda fix lvm issue 2022-04-29 01:13:04 +08:00
longpanda
3ebc610e7d fix the lvm issue 2022-04-29 00:51:56 +08:00
longpanda
60588c8442 1.0.74 release 2022-04-28 22:27:52 +08:00
longpanda
c4c05fc073 Add support for EulerOS 2022-04-28 22:18:02 +08:00
longpanda
0984f5ba58 Fix a bug that Windows ISO in local disk can not install when boot through F2 browser mode in Legacy BIOS mode. 2022-04-28 22:07:30 +08:00
longpanda
fd0d335eb6 Fix a bug when install Ventoy if the USB already mounted at a path that contains space. 2022-04-27 10:25:44 +08:00
Mastiggia
12a284b543 Update French translation (#1589) 2022-04-26 16:25:04 +08:00
longpanda
9e2e4ec0a9 Fix a bug for Linux GUI program when update from old release. (#1590) 2022-04-26 14:49:07 +08:00
longpanda
480afee1a7 Update FUNDING.yml 2022-04-25 22:14:13 +08:00
longpanda
1305945bc0 Update FUNDING.yml 2022-04-25 22:09:28 +08:00
longpanda
2feb148982 --xdg improvement 2022-04-25 10:38:16 +08:00
longpanda
5eec535391 --xdg improvement 2022-04-24 20:14:26 +08:00
longpanda
33a562c273 support inst.ks=cdrom:/xxx for CentOS 7 2022-04-24 15:28:32 +08:00
longpanda
75517039a1 Firstly try to use chainload to boot .efi files. 2022-04-20 12:19:47 +08:00
longpanda
620229508b Show the directory path in the return menu for TreeView mode and Browser mode. 2022-04-19 15:34:31 +08:00
Lyrx997
5553dd4fc4 Updated Italian language (#1574) 2022-04-18 17:53:11 +08:00
longpanda
89addae48f Fix the issue when booting Prime OS 2.1.0 (#1580) 2022-04-18 13:43:38 +08:00
longpanda
682e8cdc42 Fixe the boot issue for Fedora when VTOY_LINUX_REMOUNT=1 2022-04-16 22:17:23 +08:00
Ida Bagus
1882cfcce2 Update indonesian (#1573) 2022-04-12 10:32:52 +08:00
ShalokShalom
b8be46f0dc Update README.md (#1570) 2022-04-11 09:03:40 +08:00
longpanda
07693bf840 cc 2022-04-09 18:07:04 +08:00
longpanda
b4a059dd68 Add missing file 2022-04-08 17:21:36 +08:00
longpanda
858eec99a1 Fix the log/ini owner for VentoyGUI in linux. 2022-04-08 15:35:22 +08:00
VenusGirl❤
8180382fe1 Update languages.json (#1564)
Korean Update
2022-04-07 15:12:09 +08:00
MELERIX
a5d9b1fd43 Update Spanish Translation (#1566) 2022-04-07 09:04:05 +08:00
VenusGirl❤
8b76e06f6d Update languages.json (#1565)
Korean Update
2022-04-07 09:03:23 +08:00
VenusGirl❤
ecb133ed5e Update languages.json (#1563)
Korean Update
2022-04-06 22:06:33 +08:00
427 changed files with 23020 additions and 3604 deletions

2
.github/FUNDING.yml vendored
View File

@@ -2,11 +2,11 @@
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: Ventoy
open_collective: ventoy
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.paypal.me/ventoy', 'https://www.ventoy.net/en/donation.html'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@@ -21,7 +21,7 @@ body:
attributes:
label: Ventoy Version
description: What version of ventoy are you running?
placeholder: 1.0.72
placeholder: 1.0.96
validations:
required: true
- type: dropdown
@@ -34,6 +34,16 @@ body:
- No. I didn't try the latest release.
validations:
required: true
- type: dropdown
id: alternativemode
attributes:
label: Try alternative boot mode
description: Have you tried alternative boot mode? (wimboot mode for Windows/WinPE, grub2 mode for linux)
options:
- Yes. I have tried them, but the bug still exist.
- No. I didn't try these alternative boot modes.
validations:
required: true
- type: dropdown
id: bios
attributes:

View File

@@ -85,7 +85,7 @@ body:
- type: input
id: testenv
attributes:
label: Test envrionment
label: Test environment
description: The manufacturer/model and other details about your computer (or VM).
placeholder: Lenovo Thinkpad T420 laptop
validations:

View File

@@ -12,26 +12,26 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run docker-compose up
run: docker-compose up
- uses: actions/upload-artifact@v2
- uses: actions/checkout@v3
- name: Run docker compose up
run: docker compose up
- uses: actions/upload-artifact@v4
with:
name: ventoy-windows
path: INSTALL/ventoy-*windows*
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ventoy-linux
path: INSTALL/ventoy-*linux*
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ventoy-livecd
path: INSTALL/ventoy-*livecd*
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: SHA256SUM
path: INSTALL/sha256.txt
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: xxx-build-log
path: DOC/build.log

193
BLOB_List.md Normal file
View File

@@ -0,0 +1,193 @@
<table>
<thead>
<tr>
<th>BLOB</th>
<th>File Source</th>
<th>Desc</th>
</tr>
</thead>
<tbody>
<tr> <td>./BUSYBOX/chmod/vtchmod32</td> <td rowspan=5>build</td> <td rowspan=5>Build Instructions:<br/> ./BUSYBOX/chmod/build.sh</td> </tr>
<tr> <td>./BUSYBOX/chmod/vtchmod64</td> </tr>
<tr> <td>./BUSYBOX/chmod/vtchmod64_musl</td> </tr>
<tr> <td>./BUSYBOX/chmod/vtchmodaa64</td> </tr>
<tr> <td>./BUSYBOX/chmod/vtchmodm64e</td> </tr>
<tr> <td>./cryptsetup/veritysetup32</td> <td rowspan=2>build</td> <td rowspan=2>Build Instructions:<br/> ./cryptsetup/cryptsetup-build.txt</td> </tr>
<tr> <td>./cryptsetup/veritysetup64</td> </tr>
<tr> <td>./DMSETUP/dmsetup32</td> <td rowspan=4>build</td> <td rowspan=4>Build Instructions:<br/> ./DMSETUP/build.txt</td> </tr>
<tr> <td>./DMSETUP/dmsetup64</td> </tr>
<tr> <td>./DMSETUP/dmsetupaa64</td> </tr>
<tr> <td>./DMSETUP/dmsetupm64e</td> </tr>
<tr> <td>./FUSEISO/vtoy_fuse_iso_32</td> <td rowspan=3>build</td> <td rowspan=3>Build Instructions:<br/> ./FUSEISO/build.sh<br/>./FUSEISO/build_aarch64.sh<br/>./FUSEISO/build_libfuse.sh<br/>./FUSEISO/build_libfuse_aarch64.sh </td> </tr>
<tr> <td>./FUSEISO/vtoy_fuse_iso_64</td> </tr>
<tr> <td>./FUSEISO/vtoy_fuse_iso_aa64</td> </tr>
<tr> <td>./IMG/cpio_arm64/ventoy/busybox/a64</td> <td>build</td> <td>Build Instructions:<br/>./BUSYBOX/build.txt ash</td> </tr>
<tr> <td>./IMG/cpio_arm64/ventoy/busybox/vtchmodaa64</td> <td>build</td> <td>Same with ./BUSYBOX/chmod/vtchmodaa64<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./IMG/cpio_arm64/ventoy/busybox/xzminidecaa64</td> <td>build</td> <td>Build Instructions:<br/>./DOC/BuildVentoyFromSource.txt 4.17</td> </tr>
<tr> <td>./IMG/cpio_arm64/ventoy/tool/lz4cataa64</td> <td>build</td> <td>Same with ./LZIP/lz4cataa64<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./IMG/cpio_arm64/ventoy/tool/zstdcataa64</td> <td>build</td> <td>Same with ./ZSTD/zstdcataa64<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./IMG/cpio_mips64/ventoy/busybox/m64</td> <td>build</td> <td>Build Instructions:<br/>./BUSYBOX/build.txt ash</td> </tr>
<tr> <td>./IMG/cpio_mips64/ventoy/busybox/vtchmodm64e</td> <td>build</td> <td>Same with ./BUSYBOX/chmod/vtchmodm64e<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./IMG/cpio_mips64/ventoy/busybox/xzminidecm64e</td> <td>build</td> <td>Build Instructions:<br/>./DOC/BuildVentoyFromSource.txt 4.18</td> </tr>
<tr> <td>./IMG/cpio_mips64/ventoy/tool/lz4catm64e</td> <td>build</td> <td>Same with ./LZIP/lz4catm64e<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/64h</td> <td>build</td> <td>Build Instructions:<br/>./BUSYBOX/build.txt ash</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/ash</td> <td>upstream</td> <td>Download from BusyBox website.<br/>URL & File Hash documented in<br/> ./DOC/BuildVentoyFromSource.txt 5.4</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/vtchmod32</td> <td>build</td> <td>Same with ./BUSYBOX/chmod/vtchmod32<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/vtchmod64</td> <td>build</td> <td>Same with ./BUSYBOX/chmod/vtchmod64<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/vtchmod64_musl</td> <td>build</td> <td>Same with ./BUSYBOX/chmod/vtchmod64_musl<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/xzminidec32</td> <td>build</td> <td>Build Instructions:<br/>./DOC/BuildVentoyFromSource.txt 4.15</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/xzminidec64</td> <td>build</td> <td>Build Instructions:<br/>./DOC/BuildVentoyFromSource.txt 4.16</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/xzminidec64_musl</td> <td>build</td> <td>Build Instructions:<br/>./DOC/BuildVentoyFromSource.txt 4.16</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/tool/ar</td> <td>upstream</td> <td>Download from BusyBox website.<br/>URL & File Hash documented in<br/> ./DOC/BuildVentoyFromSource.txt 5.2</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/tool/inotifyd</td> <td>upstream</td> <td>Download from BusyBox website.<br/>URL & File Hash documented in<br/> ./DOC/BuildVentoyFromSource.txt 5.3</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/tool/lz4cat</td> <td>upstream</td> <td>URL & File Hash documented in<br/> ./DOC/BuildVentoyFromSource.txt 5.1</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/tool/lz4cat64</td> <td>build</td> <td>Build Instructions:<br/>./LZIP/buildlz4.txt</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/tool/zstdcat</td> <td>build</td> <td>Same with ./ZSTD/zstdcat<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/tool/zstdcat64</td> <td>build</td> <td>Same with ./ZSTD/zstdcat64<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./INSTALL/EFI/BOOT/BOOTAA64.EFI</td> <td rowspan=4>build</td> <td rowspan=4>Build Instructions:<br/> ./DOC/BuildVentoyFromSource.txt 4.1-Build grub2</td> </tr>
<tr> <td>./INSTALL/EFI/BOOT/BOOTMIPS.EFI</td>
<tr> <td>./INSTALL/EFI/BOOT/grubia32_real.efi</td>
<tr> <td>./INSTALL/EFI/BOOT/grubx64_real.efi</td>
<tr> <td>./INSTALL/EFI/BOOT/grub.efi</td> <td rowspan=6>upstream</td> <td rowspan=6>https://github.com/ValdikSS/Super-UEFIinSecureBoot-Disk </td> </tr>
<tr> <td>./INSTALL/EFI/BOOT/BOOTIA32.EFI</td>
<tr> <td>./INSTALL/EFI/BOOT/BOOTX64.EFI</td>
<tr> <td>./INSTALL/EFI/BOOT/grubia32.efi</td>
<tr> <td>./INSTALL/EFI/BOOT/mmia32.efi</td>
<tr> <td>./INSTALL/EFI/BOOT/MokManager.efi</td>
<tr> <td>./INSTALL/tool/aarch64/ash</td> <td rowspan=12>build</td> <td rowspan=12>Build Instructions:<br/>./DOC/BUSYBOX/build.txt</td> </tr>
<tr> <td>./INSTALL/tool/aarch64/hexdump</td>
<tr> <td>./INSTALL/tool/aarch64/xzcat</td>
<tr> <td>./INSTALL/tool/i386/ash</td>
<tr> <td>./INSTALL/tool/i386/hexdump</td>
<tr> <td>./INSTALL/tool/i386/xzcat</td>
<tr> <td>./INSTALL/tool/mips64el/ash</td>
<tr> <td>./INSTALL/tool/mips64el/hexdump</td>
<tr> <td>./INSTALL/tool/mips64el/xzcat</td>
<tr> <td>./INSTALL/tool/x86_64/ash</td>
<tr> <td>./INSTALL/tool/x86_64/hexdump</td>
<tr> <td>./INSTALL/tool/x86_64/xzcat</td>
<tr> <td>./INSTALL/tool/aarch64/Ventoy2Disk.gtk3</td> <td rowspan=6>build</td> <td rowspan=6>Build Instructions:<br/>./LinuxGUI/build_gtk.sh</td> </tr>
<tr> <td>./INSTALL/tool/i386/Ventoy2Disk.gtk3</td>
<tr> <td>./INSTALL/tool/i386/Ventoy2Disk.gtk2</td>
<tr> <td>./INSTALL/tool/mips64el/Ventoy2Disk.gtk3</td>
<tr> <td>./INSTALL/tool/x86_64/Ventoy2Disk.gtk3</td>
<tr> <td>./INSTALL/tool/x86_64/Ventoy2Disk.gtk2</td>
<tr> <td>./INSTALL/tool/aarch64/Ventoy2Disk.qt5</td> <td rowspan=4>build</td> <td rowspan=4>Build Instructions:<br/>./LinuxGUI/build_qt.sh</td> </tr>
<tr> <td>./INSTALL/tool/i386/Ventoy2Disk.qt5</td>
<tr> <td>./INSTALL/tool/mips64el/Ventoy2Disk.qt5</td>
<tr> <td>./INSTALL/tool/x86_64/Ventoy2Disk.qt5</td>
<tr> <td>./INSTALL/tool/aarch64/Plugson</td> <td rowspan=4>build</td> <td rowspan=4>Build Instructions:<br/>./Plugson/build.sh</td> </tr>
<tr> <td>./INSTALL/tool/i386/Plugson</td>
<tr> <td>./INSTALL/tool/mips64el/Plugson</td>
<tr> <td>./INSTALL/tool/x86_64/Plugson</td>
<tr> <td>./INSTALL/tool/aarch64/V2DServer</td> <td rowspan=4>build</td> <td rowspan=4>Build Instructions:<br/>./LinuxGUI/build.sh</td> </tr>
<tr> <td>./INSTALL/tool/i386/V2DServer</td>
<tr> <td>./INSTALL/tool/mips64el/V2DServer</td>
<tr> <td>./INSTALL/tool/x86_64/V2DServer</td>
<tr> <td>./INSTALL/tool/aarch64/mkexfatfs</td> <td rowspan=8>build</td> <td rowspan=8>Build Instructions:<br/>./DOC/BuildVentoyFromSource.txt 4.9<br/>./ExFAT/buidexfat.sh<br/>./ExFAT/buidexfat_aarch64.sh<br/>./ExFAT/buidlibfuse.sh<br/>./ExFAT/buidlibfuse_aarch64.sh<br/></td> </tr>
<tr> <td>./INSTALL/tool/aarch64/mount.exfat-fuse</td>
<tr> <td>./INSTALL/tool/i386/mkexfatfs</td>
<tr> <td>./INSTALL/tool/i386/mount.exfat-fuse</td>
<tr> <td>./INSTALL/tool/mips64el/mkexfatfs</td>
<tr> <td>./INSTALL/tool/mips64el/mount.exfat-fuse</td>
<tr> <td>./INSTALL/tool/x86_64/mkexfatfs</td>
<tr> <td>./INSTALL/tool/x86_64/mount.exfat-fuse</td>
<tr> <td>./INSTALL/tool/aarch64/vlnk</td> <td rowspan=4>build</td> <td rowspan=4>Build Instructions:<br/>./Vlnk/build.sh</td> </tr>
<tr> <td>./INSTALL/tool/i386/vlnk</td>
<tr> <td>./INSTALL/tool/mips64el/vlnk</td>
<tr> <td>./INSTALL/tool/x86_64/vlnk</td>
<tr> <td>./INSTALL/tool/aarch64/vtoycli</td> <td rowspan=4>build</td> <td rowspan=4>Build Instructions:<br/>./vtoycli/build.sh</td> </tr>
<tr> <td>./INSTALL/tool/i386/vtoycli</td>
<tr> <td>./INSTALL/tool/mips64el/vtoycli</td>
<tr> <td>./INSTALL/tool/x86_64/vtoycli</td>
<tr> <td>./INSTALL/ventoy/imdisk/32/imdisk.cpl</td> <td rowspan=6>upstream</td> <td rowspan=6>Download from imdisk project.<br/>URL & File Hash documented in<br/> ./DOC/BuildVentoyFromSource.txt 5.8</td> </tr>
<tr> <td>./INSTALL/ventoy/imdisk/32/imdisk.exe</td>
<tr> <td>./INSTALL/ventoy/imdisk/32/imdisk.sys</td>
<tr> <td>./INSTALL/ventoy/imdisk/64/imdisk.cpl</td>
<tr> <td>./INSTALL/ventoy/imdisk/64/imdisk.exe</td>
<tr> <td>./INSTALL/ventoy/imdisk/64/imdisk.sys</td>
<tr> <td>./INSTALL/ventoy/iso9660_aa64.efi</td> <td rowspan=6>build</td> <td rowspan=6>Build Instructions:<br/>./DOC/BuildVentoyFromSource.txt 4.17</td> </tr>
<tr> <td>./INSTALL/ventoy/udf_aa64.efi</td>
<tr> <td>./INSTALL/ventoy/iso9660_ia32.efi</td>
<tr> <td>./INSTALL/ventoy/udf_ia32.efi</td>
<tr> <td>./INSTALL/ventoy/iso9660_x64.efi</td>
<tr> <td>./INSTALL/ventoy/udf_x64.efi</td>
<tr> <td>./INSTALL/VentoyGUI.aarch64</td> <td rowspan=4>build</td> <td rowspan=4>Build Instructions:<br/>./LinuxGUI/build_gtk.sh</td> </tr>
<tr> <td>./INSTALL/VentoyGUI.i386</td>
<tr> <td>./INSTALL/VentoyGUI.mips64el</td>
<tr> <td>./INSTALL/VentoyGUI.x86_64</td>
<tr> <td>./INSTALL/Ventoy2Disk.exe</td> <td rowspan=4>build</td> <td rowspan=4>Build Instructions:<br/>./Ventoy2Disk/Ventoy2Disk.sln</td> </tr>
<tr> <td>./INSTALL/Ventoy2Disk_ARM.exe</td>
<tr> <td>./INSTALL/Ventoy2Disk_ARM64.exe</td>
<tr> <td>./INSTALL/Ventoy2Disk_X64.exe</td>
<tr> <td>./INSTALL/ventoy/vtoyjump32.exe</td> <td rowspan=2>build</td> <td rowspan=2>Build Instructions:<br/>./vtoyjump/vtoyjump.sln</td> </tr>
<tr> <td>./INSTALL/ventoy/vtoyjump64.exe</td>
<tr> <td>./INSTALL/ventoy/ventoy_aa64.efi</td> <td rowspan=6>build</td> <td rowspan=6>Build Instructions:<br/>./EDK2/buildedk.sh</td> </tr>
<tr> <td>./INSTALL/ventoy/ventoy_ia32.efi</td>
<tr> <td>./INSTALL/ventoy/ventoy_x64.efi</td>
<tr> <td>./INSTALL/ventoy/vtoyutil_aa64.efi</td>
<tr> <td>./INSTALL/ventoy/vtoyutil_ia32.efi</td>
<tr> <td>./INSTALL/ventoy/vtoyutil_x64.efi</td>
<tr> <td>./INSTALL/ventoy/ipxe.krn</td> <td>build</td> <td>Build Instructions:<br/>./IPXE/buildipxe.sh</td> </tr>
<tr> <td>./INSTALL/ventoy/memdisk</td> <td>upstream</td> <td>Download from syslinux project.<br/>URL & File Hash documented in<br/> ./DOC/BuildVentoyFromSource.txt 5.9</td> </tr>
<tr> <td>./LiveCD/ISO/EFI/boot/vmlinuz64</td> <td>upstream</td> <td>Download from TinyLinux website.<br/>URL & File Hash documented in<br/> ./DOC/BuildVentoyFromSource.txt 5.14</td> </tr>
<tr> <td>./LiveCDGUI/EXT/busybox-x86_64</td> <td>build</td> <td>Same with ./IMG/cpio_x86/ventoy/busybox/busybox64<br/>Check the file hash to confirm</td> </tr>
<tr> <td>./LiveCDGUI/GRUB/bootx64.efi</td> <td rowspan=2>build</td> <td rowspan=2>./DOC/BuildVentoyFromSource.txt 4.1-Build grub2</td> </tr>
<tr> <td>./LiveCD/GRUB/bootx64.efi</td>
<tr> <td>./LZIP/lunzip32</td> <td rowspan=3>build</td> <td rowspan=3>Build Instructions:<br/>./DOC/BuildVentoyFromSource.txt 4.19</td> </tr>
<tr> <td>./LZIP/lunzip64</td>
<tr> <td>./LZIP/lunzipaa64</td>
<tr> <td>./LZIP/lz4cat64</td> <td rowspan=3>build</td> <td rowspan=3>Build Instructions:<br/>./LZIP/buildlz4.txt</td> </tr>
<tr> <td>./LZIP/lz4cataa64</td>
<tr> <td>./LZIP/lz4catm64e</td>
<tr> <td>./Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe</td> <td rowspan=2>build</td> <td rowspan=2>Build Instructions:<br/>./Plugson/vs/VentoyPlugson/VentoyPlugson.sln</td> </tr>
<tr> <td>./Plugson/vs/VentoyPlugson/x64/Release/VentoyPlugson_X64.exe</td>
<tr> <td>./SQUASHFS/unsquashfs_32</td> <td rowspan=3>build</td> <td rowspan=3>Build Instructions:<br/>./SQUASHFS/build.sh</td> </tr>
<tr> <td>./SQUASHFS/unsquashfs_64</td>
<tr> <td>./SQUASHFS/unsquashfs_aa64</td>
<tr> <td>./Unix/ventoy_unix/DragonFly/sbin/dmsetup</td> <td>upstream</td> <td>Get from DragonFly ISO.<br/>URL & File Hash documented in<br/> ./DOC/BuildVentoyFromSource.txt 5.13</td> </tr>
<tr> <td>./Unix/ventoy_unix/DragonFly/sbin/init</td> <td>build</td> <td>Build Instructions:<br/>./Unix/ventoy_unix_src/DragonFly/build.sh</td> </tr>
<tr> <td>./VBLADE/vblade-master/vblade_32</td> <td rowspan=3>build</td> <td rowspan=3>Build Instructions:<br/>./VBLADE/vblade-master/build.sh</td> </tr>
<tr> <td>./VBLADE/vblade-master/vblade_64</td>
<tr> <td>./VBLADE/vblade-master/vblade_aa64</td>
<tr> <td>./Vlnk/vs/VentoyVlnk/Release/VentoyVlnk.exe</td> <td>build</td> <td>Build Instructions:<br/>./Vlnk/vs/VentoyVlnk/VentoyVlnk.sln</td> </tr>
<tr> <td>./VtoyTool/vtoytool/00/vtoytool_32</td> <td rowspan=6>build</td> <td rowspan=6>Build Instructions:<br/>./VtoyTool/build.sh</td> </tr>
<tr> <td>./VtoyTool/vtoytool/00/vtoytool_64</td>
<tr> <td>./VtoyTool/vtoytool/00/vtoytool_aa64</td>
<tr> <td>./VtoyTool/vtoytool/00/vtoytool_m64e</td>
<tr> <td>./VtoyTool/vtoytool/01/vtoytool_64</td>
<tr> <td>./VtoyTool/vtoytool/02/vtoytool_64</td>
<tr> <td>./ZSTD/zstdcat</td> <td rowspan=3>build</td> <td rowspan=3>Build Instructions:<br/>./ZSTD/build.txt</td> </tr>
<tr> <td>./ZSTD/zstdcat64</td>
<tr> <td>./ZSTD/zstdcataa64</td>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/busybox32</td> <td rowspan=6>build</td> <td rowspan=6>Build Instructions:<br/>./BUSYBOX/build.txt full busybox</td> </tr>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/busybox64</td>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/xzcat32_musl</td>
<tr> <td>./IMG/cpio_x86/ventoy/busybox/xzcat64_musl</td>
<tr> <td>./IMG/cpio_arm64/ventoy/busybox/busyboxaa64</td>
<tr> <td>./IMG/cpio_mips64/ventoy/busybox/busyboxm64e</td>
<tr> <td>ISNTALL/ventoy/7z/64/7za.exe</td> <td rowspan=2>upstream</td> <td>Download from 7z project.<br/>URL & File Hash documented in<br/> ./DOC/BuildVentoyFromSource.txt 5.12</td> </tr>
<tr> <td>ISNTALL/ventoy/7z/32/7za.exe</td>
<tr> <td>./INSTALL/ventoy/wimboot.i386.efi</td> <td rowspan=2>build</td> <td rowspan=2>Build Instructions:<br/>./wimboot/build.sh</td> </tr>
<tr> <td>./INSTALL/ventoy/wimboot.x86_64</td>
<tr> <td> ./Unix/ventoy_unix/ClonOS/geom_ventoy_ko/13.x/64/geom_ventoy.ko</td> <td rowspan=18>build</td> <td rowspan=18>Build Instructions:<br/>./Unix/BuildUnixKmod.txt</td> </tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/10.x/32/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/10.x/64/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/11.x/32/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/11.x/64/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/12.x/32/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/12.x/64/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/13.x/32/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/13.x/64/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/14.x/32/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/14.x/64/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/9.x/32/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/FreeBSD/geom_ventoy_ko/9.x/64/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/32/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/64/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/2.x/32/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/2.x/64/geom_ventoy.ko</td></tr>
<tr> <td> ./Unix/ventoy_unix/pfSense/geom_ventoy_ko/14.x/64/geom_ventoy.ko</td></tr>
</tbody>
</table>

7
DMPATCH/Makefile_IBT Normal file
View File

@@ -0,0 +1,7 @@
obj-m += dm_patch_ibt.o
EXTRA_CFLAGS := -Wall -DVTOY_IBT -fcf-protection=branch -mindirect-branch-register
dm_patch_ibt-objs := dmpatch.o

View File

@@ -51,7 +51,15 @@ typedef struct ko_param
unsigned long sym_get_size;
unsigned long sym_put_addr;
unsigned long sym_put_size;
unsigned long padding[3];
unsigned long kv_major;
unsigned long ibt;
unsigned long kv_minor;
unsigned long blkdev_get_addr;
unsigned long blkdev_put_addr;
unsigned long bdev_open_addr;
unsigned long kv_subminor;
unsigned long bdev_file_open_addr;
unsigned long padding[1];
}ko_param;
#pragma pack()
@@ -69,38 +77,178 @@ static volatile ko_param g_ko_param =
};
#if defined(CONFIG_X86_64)
#define PATCH_OP_POS 3
#define CODE_MATCH(code, i) \
#define PATCH_OP_POS1 3
#define CODE_MATCH1(code, i) \
(code[i] == 0x40 && code[i + 1] == 0x80 && code[i + 2] == 0xce && code[i + 3] == 0x80)
#define PATCH_OP_POS2 1
#define CODE_MATCH2(code, i) \
(code[i] == 0x0C && code[i + 1] == 0x80 && code[i + 2] == 0x89 && code[i + 3] == 0xC6)
#define PATCH_OP_POS3 4
#define CODE_MATCH3(code, i) \
(code[i] == 0x44 && code[i + 1] == 0x89 && code[i + 2] == 0xe8 && code[i + 3] == 0x0c && code[i + 4] == 0x80)
#elif defined(CONFIG_X86_32)
#define PATCH_OP_POS 2
#define CODE_MATCH(code, i) \
#define PATCH_OP_POS1 2
#define CODE_MATCH1(code, i) \
(code[i] == 0x80 && code[i + 1] == 0xca && code[i + 2] == 0x80 && code[i + 3] == 0xe8)
#define PATCH_OP_POS2 PATCH_OP_POS1
#define CODE_MATCH2 CODE_MATCH1
#define PATCH_OP_POS3 PATCH_OP_POS1
#define CODE_MATCH3 CODE_MATCH1
#else
#error "unsupported arch"
#endif
#ifdef VTOY_IBT
#ifdef CONFIG_X86_64
/* Using 64-bit values saves one instruction clearing the high half of low */
#define DECLARE_ARGS(val, low, high) unsigned long low, high
#define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32)
#define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high)
#else
#define DECLARE_ARGS(val, low, high) unsigned long long val
#define EAX_EDX_VAL(val, low, high) (val)
#define EAX_EDX_RET(val, low, high) "=A" (val)
#endif
#define EX_TYPE_WRMSR 8
#define EX_TYPE_RDMSR 9
#define MSR_IA32_S_CET 0x000006a2 /* kernel mode cet */
#define CET_ENDBR_EN (1ULL << 2)
/* Exception table entry */
#ifdef __ASSEMBLY__
#define _ASM_EXTABLE_TYPE(from, to, type) \
.pushsection "__ex_table","a" ; \
.balign 4 ; \
.long (from) - . ; \
.long (to) - . ; \
.long type ; \
.popsection
#else /* ! __ASSEMBLY__ */
#define _ASM_EXTABLE_TYPE(from, to, type) \
" .pushsection \"__ex_table\",\"a\"\n" \
" .balign 4\n" \
" .long (" #from ") - .\n" \
" .long (" #to ") - .\n" \
" .long " __stringify(type) " \n" \
" .popsection\n"
#endif /* __ASSEMBLY__ */
#endif /* VTOY_IBT */
#define vdebug(fmt, args...) if(kprintf) kprintf(KERN_ERR fmt, ##args)
static int notrace dmpatch_replace_code(unsigned long addr, unsigned long size, int expect, const char *desc)
static unsigned int g_claim_ptr = 0;
static unsigned char *g_get_patch[MAX_PATCH] = { NULL };
static unsigned char *g_put_patch[MAX_PATCH] = { NULL };
static int notrace dmpatch_kv_above(unsigned long Major, unsigned long Minor, unsigned long SubMinor)
{
if (g_ko_param.kv_major != Major)
{
return (g_ko_param.kv_major > Major) ? 1 : 0;
}
if (g_ko_param.kv_minor != Minor)
{
return (g_ko_param.kv_minor > Minor) ? 1 : 0;
}
if (g_ko_param.kv_subminor != SubMinor)
{
return (g_ko_param.kv_subminor > SubMinor) ? 1 : 0;
}
return 1;
}
static void notrace dmpatch_restore_code(int bytes, unsigned char *opCode, unsigned int code)
{
unsigned long align;
if (opCode)
{
align = (unsigned long)opCode / g_ko_param.pgsize * g_ko_param.pgsize;
set_mem_rw(align, 1);
if (bytes == 1)
{
*opCode = (unsigned char)code;
}
else
{
*(unsigned int *)opCode = code;
}
set_mem_ro(align, 1);
}
}
static int notrace dmpatch_replace_code
(
int style,
unsigned long addr,
unsigned long size,
int expect,
const char *desc,
unsigned char **patch
)
{
int i = 0;
int cnt = 0;
unsigned long align;
unsigned char *patch[MAX_PATCH];
unsigned char *opCode = (unsigned char *)addr;
vdebug("patch for %s 0x%lx %d\n", desc, addr, (int)size);
vdebug("patch for %s style[%d] 0x%lx %d\n", desc, style, addr, (int)size);
for (i = 0; i < (int)size - 4; i++)
for (i = 0; i < (int)size - 8; i++)
{
if (CODE_MATCH(opCode, i) && cnt < MAX_PATCH)
if (style == 1)
{
patch[cnt] = opCode + i + PATCH_OP_POS;
cnt++;
if (CODE_MATCH1(opCode, i) && cnt < MAX_PATCH)
{
patch[cnt] = opCode + i + PATCH_OP_POS1;
cnt++;
}
}
else if (style == 2)
{
if (CODE_MATCH2(opCode, i) && cnt < MAX_PATCH)
{
patch[cnt] = opCode + i + PATCH_OP_POS2;
cnt++;
}
}
else if (style == 3)
{
if (CODE_MATCH3(opCode, i) && cnt < MAX_PATCH)
{
patch[cnt] = opCode + i + PATCH_OP_POS3;
cnt++;
}
}
}
if (cnt != expect || cnt >= MAX_PATCH)
{
vdebug("patch error: cnt=%d expect=%d\n", cnt, expect);
@@ -121,14 +269,285 @@ static int notrace dmpatch_replace_code(unsigned long addr, unsigned long size,
return 0;
}
static int notrace dmpatch_init(void)
static unsigned long notrace dmpatch_find_call_offset(unsigned long addr, unsigned long size, unsigned long func)
{
unsigned long i = 0;
unsigned long dest;
unsigned char *opCode = NULL;
unsigned char aucOffset[8] = { 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF };
opCode = (unsigned char *)addr;
for (i = 0; i + 4 < size; i++)
{
if (opCode[i] == 0xE8)
{
aucOffset[0] = opCode[i + 1];
aucOffset[1] = opCode[i + 2];
aucOffset[2] = opCode[i + 3];
aucOffset[3] = opCode[i + 4];
dest = addr + i + 5 + *(unsigned long *)aucOffset;
if (dest == func)
{
return i;
}
}
}
return 0;
}
static unsigned int notrace dmpatch_patch_claim_ptr(void)
{
unsigned long i = 0;
unsigned long t = 0;
unsigned long offset1 = 0;
unsigned long offset2 = 0;
unsigned long align = 0;
unsigned char *opCode = NULL;
opCode = (unsigned char *)g_ko_param.sym_get_addr;
for (i = 0; i < 4; i++)
{
vdebug("%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",
opCode[i + 0], opCode[i + 1], opCode[i + 2], opCode[i + 3],
opCode[i + 4], opCode[i + 5], opCode[i + 6], opCode[i + 7],
opCode[i + 8], opCode[i + 9], opCode[i + 10], opCode[i + 11],
opCode[i + 12], opCode[i + 13], opCode[i + 14], opCode[i + 15]);
}
if (dmpatch_kv_above(6, 7, 0)) /* >= 6.7 kernel */
{
vdebug("Get addr: 0x%lx %lu open 0x%lx\n", g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.bdev_open_addr);
offset1 = dmpatch_find_call_offset(g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.bdev_open_addr);
if (offset1 == 0)
{
vdebug("call bdev_open_addr Not found\n");
vdebug("Get addr: 0x%lx %lu file_open 0x%lx\n", g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.bdev_file_open_addr);
offset1 = dmpatch_find_call_offset(g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.bdev_file_open_addr);
if (offset1 == 0)
{
vdebug("call bdev_file_open_addr Not found\n");
return 1;
}
}
}
else
{
vdebug("Get addr: 0x%lx %lu 0x%lx\n", g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.blkdev_get_addr);
vdebug("Put addr: 0x%lx %lu 0x%lx\n", g_ko_param.sym_put_addr, g_ko_param.sym_put_size, g_ko_param.blkdev_put_addr);
offset1 = dmpatch_find_call_offset(g_ko_param.sym_get_addr, g_ko_param.sym_get_size, g_ko_param.blkdev_get_addr);
offset2 = dmpatch_find_call_offset(g_ko_param.sym_put_addr, g_ko_param.sym_put_size, g_ko_param.blkdev_put_addr);
if (offset1 == 0 || offset2 == 0)
{
vdebug("call blkdev_get or blkdev_put Not found, %lu %lu\n", offset1, offset2);
return 1;
}
}
vdebug("call addr1:0x%lx call addr2:0x%lx\n",
g_ko_param.sym_get_addr + offset1,
g_ko_param.sym_put_addr + offset2);
opCode = (unsigned char *)g_ko_param.sym_get_addr;
for (i = offset1 - 1, t = 0; (i > 0) && (t < 24); i--, t++)
{
/* rdx */
if (opCode[i] == 0x48 && opCode[i + 1] == 0xc7 && opCode[i + 2] == 0xc2)
{
g_claim_ptr = *(unsigned int *)(opCode + i + 3);
g_get_patch[0] = opCode + i + 3;
vdebug("claim_ptr(%08X) found at get addr 0x%lx\n", g_claim_ptr, g_ko_param.sym_get_addr + i + 3);
break;
}
}
if (g_claim_ptr == 0)
{
vdebug("Claim_ptr not found in get\n");
return 1;
}
align = (unsigned long)g_get_patch[0] / g_ko_param.pgsize * g_ko_param.pgsize;
set_mem_rw(align, 1);
*(unsigned int *)(g_get_patch[0]) = 0;
set_mem_ro(align, 1);
if (offset2 > 0)
{
opCode = (unsigned char *)g_ko_param.sym_put_addr;
for (i = offset2 - 1, t = 0; (i > 0) && (t < 24); i--, t++)
{
/* rsi */
if (opCode[i] == 0x48 && opCode[i + 1] == 0xc7 && opCode[i + 2] == 0xc6)
{
if (*(unsigned int *)(opCode + i + 3) == g_claim_ptr)
{
vdebug("claim_ptr found at put addr 0x%lx\n", g_ko_param.sym_put_addr + i + 3);
g_put_patch[0] = opCode + i + 3;
break;
}
}
}
if (g_put_patch[0] == 0)
{
vdebug("Claim_ptr not found in put\n");
return 1;
}
align = (unsigned long)g_put_patch[0] / g_ko_param.pgsize * g_ko_param.pgsize;
set_mem_rw(align, 1);
*(unsigned int *)(g_put_patch[0]) = 0;
set_mem_ro(align, 1);
}
return 0;
}
#ifdef VTOY_IBT
static __always_inline unsigned long long dmpatch_rdmsr(unsigned int msr)
{
DECLARE_ARGS(val, low, high);
asm volatile("1: rdmsr\n"
"2:\n"
_ASM_EXTABLE_TYPE(1b, 2b, EX_TYPE_RDMSR)
: EAX_EDX_RET(val, low, high) : "c" (msr));
return EAX_EDX_VAL(val, low, high);
}
static __always_inline void dmpatch_wrmsr(unsigned int msr, u32 low, u32 high)
{
asm volatile("1: wrmsr\n"
"2:\n"
_ASM_EXTABLE_TYPE(1b, 2b, EX_TYPE_WRMSR)
: : "c" (msr), "a"(low), "d" (high) : "memory");
}
static u64 notrace dmpatch_ibt_save(void)
{
u64 msr = 0;
u64 val = 0;
msr = dmpatch_rdmsr(MSR_IA32_S_CET);
val = msr & ~CET_ENDBR_EN;
dmpatch_wrmsr(MSR_IA32_S_CET, (u32)(val & 0xffffffffULL), (u32)(val >> 32));
return msr;
}
static void notrace dmpatch_ibt_restore(u64 save)
{
u64 msr;
msr = dmpatch_rdmsr(MSR_IA32_S_CET);
msr &= ~CET_ENDBR_EN;
msr |= (save & CET_ENDBR_EN);
dmpatch_wrmsr(MSR_IA32_S_CET, (u32)(msr & 0xffffffffULL), (u32)(msr >> 32));
}
#else
static u64 notrace dmpatch_ibt_save(void) { return 0; }
static void notrace dmpatch_ibt_restore(u64 save) { (void)save; }
#endif
static int notrace dmpatch_process(unsigned long a, unsigned long b, unsigned long c)
{
int r = 0;
int rc = 0;
unsigned long kv_major = 0;
unsigned long kv_minor = 0;
unsigned long kv_subminor = 0;
vdebug("dmpatch_process as KV %d.%d.%d ...\n", (int)a, (int)b, (int)c);
kv_major = g_ko_param.kv_major;
kv_minor = g_ko_param.kv_minor;
kv_subminor = g_ko_param.kv_subminor;
g_ko_param.kv_major = a;
g_ko_param.kv_minor = b;
g_ko_param.kv_subminor = c;
if (dmpatch_kv_above(6, 5, 0)) /* >= kernel 6.5 */
{
vdebug("new interface patch dm_get_table_device...\n");
r = dmpatch_patch_claim_ptr();
}
else
{
r = dmpatch_replace_code(1, g_ko_param.sym_get_addr, g_ko_param.sym_get_size, 2, "dm_get_table_device", g_get_patch);
if (r && g_ko_param.kv_major >= 5)
{
vdebug("new2 patch dm_get_table_device...\n");
r = dmpatch_replace_code(2, g_ko_param.sym_get_addr, g_ko_param.sym_get_size, 1, "dm_get_table_device", g_get_patch);
}
if (r && g_ko_param.kv_major >= 5)
{
vdebug("new3 patch dm_get_table_device...\n");
r = dmpatch_replace_code(3, g_ko_param.sym_get_addr, g_ko_param.sym_get_size, 1, "dm_get_table_device", g_get_patch);
}
}
if (r)
{
rc = -EFAULT;
goto out;
}
vdebug("patch dm_get_table_device success\n");
if (dmpatch_kv_above(6, 5, 0))
{
r = 0;
}
else
{
r = dmpatch_replace_code(1, g_ko_param.sym_put_addr, g_ko_param.sym_put_size, 1, "dm_put_table_device", g_put_patch);
if (r)
{
rc = -EFAULT;
goto out;
}
vdebug("patch dm_put_table_device success\n");
}
vdebug("#####################################\n");
vdebug("######## dm patch success ###########\n");
vdebug("#####################################\n");
out:
g_ko_param.kv_major = kv_major;
g_ko_param.kv_minor = kv_minor;
g_ko_param.kv_subminor = kv_subminor;
return rc;
}
static int notrace dmpatch_init(void)
{
int rc = 0;
u64 msr = 0;
if (g_ko_param.ibt == 0x8888)
{
msr = dmpatch_ibt_save();
}
kprintf = (printk_pf)(g_ko_param.printk_addr);
vdebug("dmpatch_init start pagesize=%lu ...\n", g_ko_param.pgsize);
vdebug("dmpatch_init start pagesize=%lu kernel=%lu.%lu.%lu ...\n",
g_ko_param.pgsize, g_ko_param.kv_major, g_ko_param.kv_minor, g_ko_param.kv_subminor);
if (g_ko_param.struct_size != sizeof(ko_param))
{
@@ -147,34 +566,60 @@ static int notrace dmpatch_init(void)
reg_kprobe = (kprobe_reg_pf)g_ko_param.reg_kprobe_addr;
unreg_kprobe = (kprobe_unreg_pf)g_ko_param.unreg_kprobe_addr;
r = dmpatch_replace_code(g_ko_param.sym_get_addr, g_ko_param.sym_get_size, 2, "dm_get_table_device");
if (r)
rc = dmpatch_process(g_ko_param.kv_major, g_ko_param.kv_minor, g_ko_param.kv_subminor);
if (rc)
{
rc = -EINVAL;
goto out;
if (g_ko_param.kv_major >= 5)
{
rc = dmpatch_process(6, 5, 0);
if (rc)
{
rc = dmpatch_process(6, 7, 0);
}
}
}
vdebug("patch dm_get_table_device success\n");
r = dmpatch_replace_code(g_ko_param.sym_put_addr, g_ko_param.sym_put_size, 1, "dm_put_table_device");
if (r)
if (g_ko_param.ibt == 0x8888)
{
rc = -EINVAL;
goto out;
dmpatch_ibt_restore(msr);
}
vdebug("patch dm_put_table_device success\n");
vdebug("#####################################\n");
vdebug("######## dm patch success ###########\n");
vdebug("#####################################\n");
out:
return rc;
return rc;
}
static void notrace dmpatch_exit(void)
{
int i = 0;
u64 msr;
if (g_ko_param.ibt == 0x8888)
{
msr = dmpatch_ibt_save();
}
if (g_claim_ptr)
{
dmpatch_restore_code(4, g_get_patch[0], g_claim_ptr);
if (g_put_patch[0])
{
dmpatch_restore_code(4, g_put_patch[0], g_claim_ptr);
}
}
else
{
for (i = 0; i < MAX_PATCH; i++)
{
dmpatch_restore_code(1, g_get_patch[i], 0x80);
dmpatch_restore_code(1, g_put_patch[i], 0x80);
}
}
vdebug("dmpatch_exit success\n");
if (g_ko_param.ibt == 0x8888)
{
dmpatch_ibt_restore(msr);
}
}
module_init(dmpatch_init);

View File

@@ -1,10 +1,12 @@
1. install ubuntu 21.10
2. apt-get install build-essential flex libncurses-dev linux-headers-generic linux-source libssl-dev ...... and so on
3. cp /lib/modules/5.13.0-23-generic/build/Module.symvers ./
4. /boot/config-5.13.0-23-generic as .config make oldconfig
1. install ubuntu 22.04 5.15.0-25
2. apt-get install build-essential flex libncurses-dev linux-headers-generic linux-source libssl-dev bison yacc vim libelf-dev ...... and so on
3. cp /lib/modules/5.15.0-25-generic/build/Module.symvers ./
4. /boot/config-5.15.0-25-generic as .config make oldconfig
5. make menuconfig
1. close CONFIG_STACKPROTECTOR
2. close CONFIG_RETPOLINE
3. close CONFIG_UBSAN_BOUNDS
4. close CONFIG_UBSAN_ENUM
6. modify ./scripts/mod/modpost.c
1. skip add_srcversion (just return)

65
DMPATCH/ubuntu_build.sh Normal file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
FTPIP=192.168.44.1
FTPUSR='a:a'
rm -f dmpatch.c Makefile Makefile_IBT
for f in dmpatch.c Makefile Makefile_IBT; do
curl -s -u $FTPUSR ftp://$FTPIP/$f -o $f
if [ -f $f ]; then
echo "download $f OK ..."
else
echo "download $f FAILED ..."
exit 1
fi
done
rm -f *.ko
echo "build dm_patch.ko ..."
rm -rf ./aa
mkdir ./aa
cp -a *.c aa/
cp -a Makefile aa/
cd /home/panda/linux-source-5.15.0
make modules M=/home/panda/build/aa/
strip --strip-debug /home/panda/build/aa/dm_patch.ko
cd -
cp -a aa/dm_patch.ko ./
echo "build dm_patch_ibt.ko ..."
rm -rf ./aa
mkdir ./aa
cp -a *.c aa/
cp -a Makefile_IBT aa/Makefile
cd /home/panda/linux-source-5.15.0
make modules M=/home/panda/build/aa/
strip --strip-debug /home/panda/build/aa/dm_patch_ibt.ko
cd -
cp -a aa/dm_patch_ibt.ko ./
rm -rf ./aa
curl -s -T dm_patch.ko -u $FTPUSR ftp://$FTPIP/dm_patch_64.ko || exit 1
curl -s -T dm_patch_ibt.ko -u $FTPUSR ftp://$FTPIP/dm_patch_ibt_64.ko || exit 1
if [ -f ./dm_patch.ko -a -f ./dm_patch_ibt.ko ]; then
echo -e "\n\n=============== SUCCESS =============\n\n"
else
echo -e "\n\n=============== FAILED ==============\n\n"
fi

View File

@@ -5,7 +5,7 @@ use an old version of dmsetup
http://vault.centos.org/5.3/os/SRPMS/device-mapper-1.02.28-2.el5.src.rpm
https://www.fefe.de/dietlibc/dietlibc-0.34.tar.xz
======== Build Envrioment ========
======== Build Environment ========
build for 32bit, static linked with dietlibc
1. install centos 6.10 i386 with CentOS-6.10-i386-bin-DVD1.iso
2. yum install gcc kernel-devel package

View File

@@ -1,9 +1,9 @@
==========================================
1. Compile Enviroment
1. Compile Environment
==========================================
My build envrioment is CentOS 7.8 x86_64. So here I first explain how to create the build environment from scratch.
Because Ventoy is based on many open source projects, so the environment is important. I suggest you test it on a virtual machine firstly.
My build environment is CentOS 7.8 x86_64. So here I first explain how to create the build environment from scratch.
Ventoy is based on many open source projects, so the build environment is important. I suggest you first test it on a virtual machine.
1.1 Install CentOS 7.8
I use CentOS-7-x86_64-Everything-2003.iso and select Minimal install
@@ -21,10 +21,10 @@
==========================================
2. Download Source Code
==========================================
2.1 Download Ventoy source code from github and decompress it.
2.1 Download Ventoy source code from GitHub and decompress it.
Next I assume that you have unzipped the code into the /home directory (check /home/Ventoy-master/README.md file for the directory layout).
2.2 Download third-part source code and tool
2.2 Download third-party source code and tool
https://www.fefe.de/dietlibc/dietlibc-0.34.tar.xz ===> /home/Ventoy-master/DOC/dietlibc-0.34.tar.xz
https://musl.libc.org/releases/musl-1.2.1.tar.gz ===> /home/Ventoy-master/DOC/musl-1.2.1.tar.gz
@@ -34,7 +34,7 @@
https://codeload.github.com/libfuse/libfuse/zip/fuse-2.9.9 ===> /home/Ventoy-master/ExFAT/libfuse-fuse-2.9.9.zip
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 ===> /opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--uclibc--stable-2020.08-1.tar.bz2 ===> /opt/aarch64--uclibc--stable-2020.08-1.tar.bz2
http://ftp.loongnix.org/toolchain/gcc/release/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz ===> /opt/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz
https://github.com/ventoy/vtoytoolchain/releases/download/1.0/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz ===> /opt/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz
https://github.com/ventoy/musl-cross-make/releases/download/latest/output.tar.bz2 ===> /opt/output.tar.bz2
@@ -42,7 +42,7 @@
http://www.tinycorelinux.net/11.x/x86_64/release/distribution_files/corepure64.gz ===> /home/Ventoy-master/LiveCD/ISO/EFI/boot/corepure64.gz
http://www.tinycorelinux.net/11.x/x86_64/release/distribution_files/modules64.gz ===> /home/Ventoy-master/LiveCD/ISO/EFI/boot/modules64.gz
2.3 Prepare third-part tools
2.3 Prepare third-party tools
cd /home/Ventoy-master/DOC/
tar xf musl-1.2.1.tar.gz
cd musl-1.2.1
@@ -54,7 +54,7 @@
mv /opt/output /opt/mips64el-linux-musl-gcc730
2.4 Set PATH envrioment
2.4 Set PATH environment
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/mips64el-linux-musl-gcc730/bin
better to add this line to /root/.bashrc and relogin as root
@@ -62,21 +62,21 @@
==========================================
3. All in one script
==========================================
I have made a all_in_one.sh, you can run this script to build and pack ventoy.
I have made an all-in-one script `all_in_one.sh`. You can run this script to build and pack ventoy.
If you want to compile a certain part separately, you can continue to refer to the later chapters of this text.
cd /home/Ventoy-master/INSTALL
sh all_in_one.sh
It should be noted that:
1. Only grub2/EDK2/IPXE will be recompiled in all_in_one.sh. Other part contains the binaries and are few modified, so will no be recompiled everytime.
1. Only grub2/EDK2/IPXE will be recompiled in all_in_one.sh. Other parts contain binaries and are rarely modified, so will not be recompiled everytime.
You can rebuild these parts separately if you want.
2. some part of Ventoy has 32bit&64bit version (like 4.9 4.10 4.11 follows)
all_in_one.sh only build 64bit version of them, if you want to rebuild the 32bit verison. You should create a 32bit CentOS environment and build them.
Fortunately these parts are few modified, you only need to build once or you can directly use the binary I have built.
2. Some parts of Ventoy have a 32-bit and 64-bit version (like 4.9, 4.10, 4.11 follows)
all_in_one.sh only builds the 64bit version of them. If you want to rebuild the 32bit verison, you should create a 32-bit CentOS environment and build them.
Fortunately these parts are rarely modified, so you only need to build once or you can directly use the binaries I have built.
Besides, after a fully compile and pack, you can only build the part you modified (for example grub2) and run ventoy_pack.sh to generate the package.
Besides, after a full compile and packaging, you can only build the part you modified (for example grub2) and run ventoy_pack.sh to generate the package.
==========================================
4. Build every part of Ventoy
@@ -122,14 +122,14 @@
After that, copy EXFAT/shared/mkexfatfs ===> /home/Ventoy-master/INSTALL/tool/mkexfatfs_64
After that, copy EXFAT/shared/mount.exfat-fuse ===> /home/Ventoy-master/INSTALL/tool/mount.exfat-fuse_64
Use the same build step to build exfat-util 32bit in a 32bit CentOS system and get mkexfatfs_32 and mount.exfat-fuse_32
Use the same build step to build exfat-util 32-bit in a 32-bit CentOS system and get mkexfatfs_32 and mount.exfat-fuse_32
4.10 == Build vtoy_fuse_iso_64/vtoy_fuse_iso_32 ==
cd /home/Ventoy-master/FUSEISO
sh build_libfuse.sh
sh build.sh
Use the same build step to build in a 32bit CentOS system and get vtoy_fuse_iso_32
Use the same build step to build in a 32-bit CentOS system and get vtoy_fuse_iso_32
4.11 == Build unsquashfs_64/unsquashfs_32 ==
cd /home/Ventoy-master/SQUASHFS/SRC
@@ -141,7 +141,7 @@
cd /home/Ventoy-master/SQUASHFS/squashfs-tools-4.4/squashfs-tools
sh build.sh
Use the same build step to build in a 32bit CentOS system and get unsquashfs_32
Use the same build step to build in a 32-bit CentOS system and get unsquashfs_32
4.12 == Build vblade_64/vblade_32 ==
cd /home/Ventoy-master/VBLADE/vblade-master
@@ -159,12 +159,12 @@
make -f ventoy_makefile
strip --strip-all xzminidec
4.16 == Build xzminidec64 ==
4.16 == Build xzminidec64/xzminidec64_musl ==
cd /home/Ventoy-master/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace
make -f ventoy_makefile64
make -f ventoy_makefile64 or make -f ventoy_makefile64_musl
strip --strip-all xzminidec
4.17 == Build iso9660_x64.efi ==
4.17 == Build iso9660_x64.efi/udf_x64.efi/iso9660_ia32.efi/udf_ia32.efi/iso9660_aa64.efi/udf_aa64.efi/ ==
This efi driver is from https://github.com/pbatard/efifs
Follow all the build instructions in this project. I modified 3 files (the original and modified source are at /home/Ventoy-master/EDK2/efiffs)
@@ -185,6 +185,16 @@
make
aarch64-buildroot-linux-uclibc-strip --strip-all lunzip
4.17 == Build xzminidecaa64 ==
cd /home/Ventoy-master/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace
make -f ventoy_makefileaa64
strip --strip-all xzminidec
4.18 == Build xzminidecm64e ==
cd /home/Ventoy-master/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace
make -f ventoy_makefilem64e
strip --strip-all xzminidec
==========================================
@@ -256,5 +266,11 @@
ISNTALL/ventoy/7z/64/7za.exe SHA-256: 8117e40ee7f824f63373a4f5625bb62749f69159d0c449b3ce2f35aad3b83549
ISNTALL/ventoy/7z/32/7za.exe SHA-256: ea308c76a2f927b160a143d94072b0dce232e04b751f0c6432a94e05164e716d
5.13 ./Ventoy/Unix/ventoy_unix/DragonFly/sbin/dmsetup
download from https://cdimage.debian.org/mirror/dragonflybsd.org/iso-images/dfly-x86_64-5.8.3_REL.iso.bz2
extract from the ISO file sbin/dmsetup
dmsetup SHA-256: bedcf26650e87edfe961e33bae20d832bce73efd4b6239f9a6a5785661e4e698
5.14 ./LiveCD/ISO/EFI/boot/vmlinuz64
download from http://www.tinycorelinux.net/11.x/x86_64/archive/11.0/distribution_files/vmlinuz64
vmlinuz64 SHA-256: 641077fc1f9914af244c248453005f56536ba9e7f54ba3e52402f26709ddb8a5

View File

@@ -1,6 +1,11 @@
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 \
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-* \

View File

@@ -60,7 +60,7 @@ ventoy_grub_param_file_replace *g_file_replace_list = NULL;
ventoy_efi_file_replace g_efi_file_replace;
ventoy_grub_param_file_replace *g_img_replace_list = NULL;
ventoy_efi_file_replace g_img_file_replace;
ventoy_efi_file_replace g_img_file_replace[VTOY_MAX_CONF_REPLACE];
CONST CHAR16 gIso9660EfiDriverPath[] = ISO9660_EFI_DRIVER_PATH;
CONST CHAR16 gUdfEfiDriverPath[] = UDF_EFI_DRIVER_PATH;
@@ -577,7 +577,8 @@ STATIC EFI_STATUS EFIAPI ventoy_find_iso_disk(IN EFI_HANDLE ImageHandle)
continue;
}
if (CompareMem(g_chain->os_param.vtoy_disk_guid, pBuffer + 0x180, 16) == 0)
if (CompareMem(g_chain->os_param.vtoy_disk_guid, pBuffer + 0x180, 16) == 0 &&
CompareMem(g_chain->os_param.vtoy_disk_signature, pBuffer + 0x1b8, 4) == 0)
{
pMBR = (MBR_HEAD *)pBuffer;
if (g_os_param_reserved[6] == 0 && pMBR->PartTbl[0].FsFlag != 0xEE)
@@ -599,7 +600,7 @@ STATIC EFI_STATUS EFIAPI ventoy_find_iso_disk(IN EFI_HANDLE ImageHandle)
Handles[i],
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
debug("Find Ventoy Disk Handle:%p DP:%s", Handles[i],
debug("Find Ventoy Disk Sig Handle:%p DP:%s", Handles[i],
ConvertDevicePathToText(gBlockData.pDiskDevPath, FALSE, FALSE));
break;
}
@@ -828,6 +829,7 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
ventoy_grub_param *pGrubParam = NULL;
EFI_LOADED_IMAGE_PROTOCOL *pImageInfo = NULL;
ventoy_chain_head *chain = NULL;
ventoy_grub_param_file_replace *replace = NULL;
Status = gBS->HandleProtocol(ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&pImageInfo);
if (EFI_ERROR(Status))
@@ -925,18 +927,27 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
old_cnt > 3 ? g_file_replace_list->old_file_name[3] : ""
);
g_img_replace_list = &pGrubParam->img_replace;
ventoy_proc_img_replace_name(g_img_replace_list);
old_cnt = g_img_replace_list->old_file_cnt;
debug("img replace: magic:0x%x virtid:%u name count:%u <%a> <%a> <%a> <%a>",
g_img_replace_list->magic,
g_img_replace_list->new_file_virtual_id,
old_cnt,
old_cnt > 0 ? g_img_replace_list->old_file_name[0] : "",
old_cnt > 1 ? g_img_replace_list->old_file_name[1] : "",
old_cnt > 2 ? g_img_replace_list->old_file_name[2] : "",
old_cnt > 3 ? g_img_replace_list->old_file_name[3] : ""
);
for (i = 0; i < VTOY_MAX_CONF_REPLACE; i++)
{
replace = pGrubParam->img_replace + i;
if (replace->magic == GRUB_IMG_REPLACE_MAGIC)
{
ventoy_proc_img_replace_name(replace);
old_cnt = replace->old_file_cnt;
debug("img replace[%d]: magic:0x%x virtid:%u name count:%u <%a> <%a> <%a> <%a>",
i, replace->magic,
replace->new_file_virtual_id,
old_cnt,
old_cnt > 0 ? replace->old_file_name[0] : "",
old_cnt > 1 ? replace->old_file_name[1] : "",
old_cnt > 2 ? replace->old_file_name[2] : "",
old_cnt > 3 ? replace->old_file_name[3] : ""
);
g_img_replace_list = pGrubParam->img_replace;
}
}
pPos = StrStr(pCmdLine, L"mem:");
chain = (ventoy_chain_head *)StrHexToUintn(pPos + 4);
@@ -1177,8 +1188,7 @@ EFI_STATUS EFIAPI ventoy_boot(IN EFI_HANDLE ImageHandle)
gST->ConIn->Reset(gST->ConIn, FALSE);
}
if ((g_file_replace_list && g_file_replace_list->magic == GRUB_FILE_REPLACE_MAGIC) ||
(g_img_replace_list && g_img_replace_list->magic == GRUB_IMG_REPLACE_MAGIC))
if ((g_file_replace_list && g_file_replace_list->magic == GRUB_FILE_REPLACE_MAGIC) || g_img_replace_list)
{
ventoy_wrapper_push_openvolume(pFile->OpenVolume);
pFile->OpenVolume = ventoy_wrapper_open_volume;

View File

@@ -98,7 +98,9 @@ typedef struct ventoy_os_param
UINT64 vtoy_reserved[4]; // Internal use by ventoy
UINT8 reserved[31];
UINT8 vtoy_disk_signature[4];
UINT8 reserved[27];
}ventoy_os_param;
#pragma pack()
@@ -242,6 +244,7 @@ typedef int (*grub_env_printf_pf)(const char *fmt, ...);
#pragma pack(1)
#define VTOY_MAX_CONF_REPLACE 2
#define GRUB_FILE_REPLACE_MAGIC 0x1258BEEF
#define GRUB_IMG_REPLACE_MAGIC 0x1259BEEF
@@ -268,7 +271,7 @@ typedef struct ventoy_grub_param
grub_env_get_pf grub_env_get;
grub_env_set_pf grub_env_set;
ventoy_grub_param_file_replace file_replace;
ventoy_grub_param_file_replace img_replace;
ventoy_grub_param_file_replace img_replace[VTOY_MAX_CONF_REPLACE];
grub_env_printf_pf grub_env_printf;
}ventoy_grub_param;
@@ -398,7 +401,7 @@ extern ventoy_virt_chunk *g_virt_chunk;
extern UINT32 g_virt_chunk_num;
extern vtoy_block_data gBlockData;
extern ventoy_efi_file_replace g_efi_file_replace;
extern ventoy_efi_file_replace g_img_file_replace;
extern ventoy_efi_file_replace g_img_file_replace[VTOY_MAX_CONF_REPLACE];
extern ventoy_sector_flag *g_sector_flag;
extern UINT32 g_sector_flag_num;
extern BOOLEAN gMemdiskMode;

View File

@@ -37,9 +37,6 @@
#include <Protocol/DriverBinding.h>
#include <Ventoy.h>
#define ASSIGN_REPLACE(This, replace) \
replace = (This->FlushEx == ventoy_wrapper_file_flush_ex) ? &g_efi_file_replace : &g_img_file_replace
UINT8 *g_iso_data_buf = NULL;
UINTN g_iso_buf_size = 0;
BOOLEAN gMemdiskMode = FALSE;
@@ -155,7 +152,8 @@ STATIC EFI_STATUS EFIAPI ventoy_read_iso_sector
ventoy_override_chunk *pOverride = g_override_chunk;
EFI_BLOCK_IO_PROTOCOL *pRawBlockIo = gBlockData.pRawBlockIo;
debug("read iso sector %lu count %u Buffer:%p Align:%u", Sector, Count, Buffer, pRawBlockIo->Media->IoAlign);
debug("read iso sector %lu count %u Buffer:%p Align:%u blk:%u",
Sector, Count, Buffer, pRawBlockIo->Media->IoAlign, pRawBlockIo->Media->BlockSize);
ReadStart = Sector * 2048;
ReadEnd = (Sector + Count) * 2048;
@@ -1250,13 +1248,96 @@ ventoy_wrapper_file_flush_ex(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
/* Ex version */
STATIC EFI_STATUS EFIAPI
ventoy_wrapper_file_flush_ex_img(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
ventoy_wrapper_file_flush_ex_img0(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
{
(VOID)This;
(VOID)Token;
return EFI_SUCCESS;
}
/* Ex version */
STATIC EFI_STATUS EFIAPI
ventoy_wrapper_file_flush_ex_img1(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token)
{
(VOID)This;
(VOID)Token;
return EFI_SUCCESS;
}
#define DEF_WRAP_FUNC(n) \
STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_flush_ex_img#n(EFI_FILE_HANDLE This, EFI_FILE_IO_TOKEN *Token) \
{\
(VOID)This;\
(VOID)Token;\
return EFI_SUCCESS;\
}
#define ITEM_WRAP_FUNC(n) ventoy_wrapper_file_flush_ex_img#n
#if (VTOY_MAX_CONF_REPLACE > 2)
DEF_WRAP_FUNC(2);
#endif
#if (VTOY_MAX_CONF_REPLACE > 3)
DEF_WRAP_FUNC(3);
#endif
#if (VTOY_MAX_CONF_REPLACE > 4)
DEF_WRAP_FUNC(4);
#endif
#if (VTOY_MAX_CONF_REPLACE > 5)
DEF_WRAP_FUNC(5);
#endif
#if (VTOY_MAX_CONF_REPLACE > 6)
DEF_WRAP_FUNC(6);
#endif
#if (VTOY_MAX_CONF_REPLACE > 7)
DEF_WRAP_FUNC(7);
#endif
#if (VTOY_MAX_CONF_REPLACE > 8)
#error "VTOY_MAX_CONF_REPLACE overflow"
#endif
static EFI_FILE_FLUSH_EX g_img_flush_func[VTOY_MAX_CONF_REPLACE] =
{
ventoy_wrapper_file_flush_ex_img0,
ventoy_wrapper_file_flush_ex_img1,
#if (VTOY_MAX_CONF_REPLACE > 2)
ITEM_WRAP_FUNC(2),
#endif
#if (VTOY_MAX_CONF_REPLACE > 3)
ITEM_WRAP_FUNC(3),
#endif
#if (VTOY_MAX_CONF_REPLACE > 4)
ITEM_WRAP_FUNC(4),
#endif
#if (VTOY_MAX_CONF_REPLACE > 5)
ITEM_WRAP_FUNC(5),
#endif
#if (VTOY_MAX_CONF_REPLACE > 6)
ITEM_WRAP_FUNC(6),
#endif
#if (VTOY_MAX_CONF_REPLACE > 7)
ITEM_WRAP_FUNC(7),
#endif
};
STATIC ventoy_efi_file_replace *ventoy_wrapper_get_replace(EFI_FILE_HANDLE This)
{
UINTN i;
if (This->FlushEx == ventoy_wrapper_file_flush_ex)
{
return &g_efi_file_replace;
}
for (i = 0; i < VTOY_MAX_CONF_REPLACE; i++)
{
if (This->FlushEx == g_img_flush_func[i])
{
return g_img_file_replace + i;
}
}
return NULL;
}
STATIC EFI_STATUS EFIAPI
ventoy_wrapper_file_write(EFI_FILE_HANDLE This, UINTN *Len, VOID *Data)
@@ -1287,7 +1368,7 @@ ventoy_wrapper_file_set_pos(EFI_FILE_HANDLE This, UINT64 Position)
{
ventoy_efi_file_replace *replace = NULL;
ASSIGN_REPLACE(This, replace);
replace = ventoy_wrapper_get_replace(This);
if (Position <= replace->FileSizeBytes)
{
@@ -1306,7 +1387,7 @@ ventoy_wrapper_file_get_pos(EFI_FILE_HANDLE This, UINT64 *Position)
{
ventoy_efi_file_replace *replace = NULL;
ASSIGN_REPLACE(This, replace);
replace = ventoy_wrapper_get_replace(This);
*Position = replace->CurPos;
@@ -1320,7 +1401,7 @@ ventoy_wrapper_file_get_info(EFI_FILE_HANDLE This, EFI_GUID *Type, UINTN *Len, V
EFI_FILE_INFO *Info = (EFI_FILE_INFO *) Data;
ventoy_efi_file_replace *replace = NULL;
ASSIGN_REPLACE(This, replace);
replace = ventoy_wrapper_get_replace(This);
debug("ventoy_wrapper_file_get_info ... %u", *Len);
@@ -1355,7 +1436,7 @@ ventoy_wrapper_file_read(EFI_FILE_HANDLE This, UINTN *Len, VOID *Data)
UINTN ReadLen = *Len;
ventoy_efi_file_replace *replace = NULL;
ASSIGN_REPLACE(This, replace);
replace = ventoy_wrapper_get_replace(This);
debug("ventoy_wrapper_file_read ... %u", *Len);
@@ -1381,7 +1462,7 @@ ventoy_wrapper_file_read_ex(IN EFI_FILE_PROTOCOL *This, IN OUT EFI_FILE_IO_TOKEN
return ventoy_wrapper_file_read(This, &(Token->BufferSize), Token->Buffer);
}
STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_procotol(EFI_FILE_PROTOCOL *File, BOOLEAN Img)
STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_procotol(EFI_FILE_PROTOCOL *File, BOOLEAN Img, UINTN Index)
{
File->Revision = EFI_FILE_PROTOCOL_REVISION2;
File->Open = ventoy_wrapper_fs_open;
@@ -1397,11 +1478,47 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_procotol(EFI_FILE_PROTOCOL *File, B
File->OpenEx = ventoy_wrapper_file_open_ex;
File->ReadEx = ventoy_wrapper_file_read_ex;
File->WriteEx = ventoy_wrapper_file_write_ex;
File->FlushEx = Img ? ventoy_wrapper_file_flush_ex_img : ventoy_wrapper_file_flush_ex;
if (Img)
{
File->FlushEx = g_img_flush_func[Index];
}
else
{
File->FlushEx = ventoy_wrapper_file_flush_ex;
}
return EFI_SUCCESS;
}
STATIC BOOLEAN EFIAPI ventoy_replace_name_match(CHAR8 *pReplace, CHAR8 *pName)
{
UINTN Len1, Len2;
Len1 = AsciiStrLen(pReplace);
Len2 = AsciiStrLen(pName);
if (Len1 == 0 || Len2 == 0)
{
return FALSE;
}
if (0 == AsciiStriCmp(pReplace, pName))
{
return TRUE;
}
if (Len1 > 2 && Len2 > 2)
{
if ((pReplace[0] != '\\') && (pName[0] == '\\') && (0 == AsciiStriCmp(pReplace, pName + 1)))
{
return TRUE;
}
}
return FALSE;
}
STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
(
EFI_FILE_HANDLE This,
@@ -1418,6 +1535,7 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
CHAR8 TmpName[256];
CHAR8 OldName[256];
ventoy_virt_chunk *virt = NULL;
ventoy_grub_param_file_replace *replace = NULL;
debug("## ventoy_wrapper_file_open <%s> ", Name);
@@ -1444,11 +1562,11 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
AsciiSPrint(TmpName, sizeof(TmpName), "%s", Name);
for (j = 0; j < 4; j++)
{
if (0 == AsciiStrCmp(g_file_replace_list[i].old_file_name[j], TmpName))
if (ventoy_replace_name_match(g_file_replace_list[i].old_file_name[j], TmpName))
{
g_original_fclose(*New);
*New = &g_efi_file_replace.WrapperHandle;
ventoy_wrapper_file_procotol(*New, FALSE);
ventoy_wrapper_file_procotol(*New, FALSE, 0);
virt = g_virt_chunk + g_file_replace_list->new_file_virtual_id;
@@ -1474,15 +1592,18 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
}
}
if (g_img_replace_list && g_img_replace_list->magic == GRUB_IMG_REPLACE_MAGIC &&
g_img_replace_list->new_file_virtual_id < g_virt_chunk_num)
for (i = 0; g_img_replace_list && i < VTOY_MAX_CONF_REPLACE; i++)
{
AsciiSPrint(TmpName, sizeof(TmpName), "%s", Name);
for (j = 0; j < g_img_replace_list->old_file_cnt; j++)
replace = g_img_replace_list + i;
if (replace->magic != GRUB_IMG_REPLACE_MAGIC || replace->new_file_virtual_id >= g_virt_chunk_num)
{
AsciiStrCpyS(OldName, sizeof(OldName), g_img_replace_list[i].old_file_name[j]);
continue;
}
AsciiSPrint(TmpName, sizeof(TmpName), "%s", Name);
for (j = 0; j < replace->old_file_cnt; j++)
{
AsciiStrCpyS(OldName, sizeof(OldName), replace->old_file_name[j]);
if ((0 == AsciiStrCmp(OldName, TmpName)) ||
(AsciiStrnCmp(OldName, "\\loader\\entries\\", 16) == 0 &&
AsciiStrCmp(OldName + 16, TmpName) == 0
@@ -1490,31 +1611,31 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open
)
{
g_original_fclose(*New);
*New = &g_img_file_replace.WrapperHandle;
ventoy_wrapper_file_procotol(*New, TRUE);
*New = &(g_img_file_replace[i].WrapperHandle);
ventoy_wrapper_file_procotol(*New, TRUE, i);
virt = g_virt_chunk + g_img_replace_list->new_file_virtual_id;
virt = g_virt_chunk + replace->new_file_virtual_id;
Sectors = (virt->mem_sector_end - virt->mem_sector_start) + (virt->remap_sector_end - virt->remap_sector_start);
g_img_file_replace.BlockIoSectorStart = virt->mem_sector_start;
g_img_file_replace.FileSizeBytes = Sectors * 2048;
g_img_file_replace[i].BlockIoSectorStart = virt->mem_sector_start;
g_img_file_replace[i].FileSizeBytes = Sectors * 2048;
if (gDebugPrint)
{
debug("## ventoy_wrapper_file_open2 <%s> BlockStart:%lu Sectors:%lu Bytes:%lu", Name,
g_img_file_replace.BlockIoSectorStart, Sectors, Sectors * 2048);
g_img_file_replace[i].BlockIoSectorStart, Sectors, Sectors * 2048);
sleep(3);
}
return Status;
}
}
}
if (StrCmp(Name, L"\\loader\\entries") == 0)
{
(*New)->Open = ventoy_wrapper_file_open;
}
if (g_img_replace_list && StrCmp(Name, L"\\loader\\entries") == 0)
{
(*New)->Open = ventoy_wrapper_file_open;
}
return Status;

View File

@@ -28,6 +28,8 @@ typedef int (*grub_env_set_pf)(const char *name, const char *val);
typedef const char * (*grub_env_get_pf)(const char *name);
typedef int (*grub_env_printf_pf)(const char *fmt, ...);
#define VTOY_MAX_CONF_REPLACE 2
typedef struct ventoy_grub_param_file_replace
{
UINT32 magic;
@@ -41,7 +43,7 @@ typedef struct ventoy_grub_param
grub_env_get_pf grub_env_get;
grub_env_set_pf grub_env_set;
ventoy_grub_param_file_replace file_replace;
ventoy_grub_param_file_replace img_replace;
ventoy_grub_param_file_replace img_replace[VTOY_MAX_CONF_REPLACE];
grub_env_printf_pf grub_env_printf;
}ventoy_grub_param;
#pragma pack()

View File

@@ -1533,7 +1533,7 @@ module = {
name = squash4;
common = fs/squash4.c;
cflags = '$(CFLAGS_POSIX) -Wno-undef';
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -I$(srcdir)/lib/minilzo -DMINILZO_HAVE_CONFIG_H';
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -I$(srcdir)/lib/minilzo -I$(srcdir)/lib/zstd -DMINILZO_HAVE_CONFIG_H';
};
module = {

View File

@@ -260,6 +260,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
grub_file_t file;
grub_err_t err;
unsigned j;
int vlnk = 0;
file = grub_file_open (args[i], GRUB_FILE_TYPE_TO_HASH
| (!uncompress ? GRUB_FILE_TYPE_NO_DECOMPRESS
: GRUB_FILE_TYPE_NONE));
@@ -272,6 +273,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
unread++;
continue;
}
vlnk = file->vlnk;
err = hash_file (file, hash, result);
grub_file_close (file);
if (err)
@@ -288,7 +290,7 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
grub_printf ("%02x", ((grub_uint8_t *) result)[j]);
len += grub_snprintf(hashsum + len, sizeof(hashsum) - len, "%02x", ((grub_uint8_t *) result)[j]);
}
grub_printf (" %s\n", args[i]);
grub_printf (" %s\n", vlnk ? grub_file_get_vlnk(args[i], NULL) : args[i]);
grub_env_set("VT_LAST_CHECK_SUM", hashsum);
}

View File

@@ -229,6 +229,13 @@ test_parse (char **args, int *argn, int argc)
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-EQ") == 0)
{
update_val (grub_strtoull (args[*argn], 0, 0)
== grub_strtoull (args[*argn + 2], 0, 0), &ctx);
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-ge") == 0)
{
@@ -237,6 +244,13 @@ test_parse (char **args, int *argn, int argc)
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-GE") == 0)
{
update_val (grub_strtoull (args[*argn], 0, 0)
>= grub_strtoull (args[*argn + 2], 0, 0), &ctx);
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-gt") == 0)
{
@@ -245,6 +259,13 @@ test_parse (char **args, int *argn, int argc)
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-GT") == 0)
{
update_val (grub_strtoull (args[*argn], 0, 0)
> grub_strtoull (args[*argn + 2], 0, 0), &ctx);
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-le") == 0)
{
@@ -253,6 +274,13 @@ test_parse (char **args, int *argn, int argc)
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-LE") == 0)
{
update_val (grub_strtoull (args[*argn], 0, 0)
<= grub_strtoull (args[*argn + 2], 0, 0), &ctx);
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-lt") == 0)
{
@@ -261,6 +289,13 @@ test_parse (char **args, int *argn, int argc)
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-LT") == 0)
{
update_val (grub_strtoull (args[*argn], 0, 0)
< grub_strtoull (args[*argn + 2], 0, 0), &ctx);
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-ne") == 0)
{
@@ -269,6 +304,13 @@ test_parse (char **args, int *argn, int argc)
(*argn) += 3;
continue;
}
if (grub_strcmp (args[*argn + 1], "-NE") == 0)
{
update_val (grub_strtoull (args[*argn], 0, 0)
!= grub_strtoull (args[*argn + 2], 0, 0), &ctx);
(*argn) += 3;
continue;
}
/* GRUB extension: compare numbers skipping prefixes.
Useful for comparing versions. E.g. vmlinuz-2 -plt vmlinuz-11. */

View File

@@ -103,6 +103,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000
#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000
/* The set of back-incompatible features this driver DOES support. Add (OR)
@@ -123,9 +124,16 @@ GRUB_MOD_LICENSE ("GPLv3+");
* mmp: Not really back-incompatible - was added as such to
* avoid multiple read-write mounts. Safe to ignore for this
* RO driver.
* checksum seed: Not really back-incompatible - was added to allow tools
* such as tune2fs to change the UUID on a mounted metadata
* checksummed filesystem. Safe to ignore for now since the
* driver doesn't support checksum verification. But it must
* be removed from this list if that support is added later.
*
*/
#define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER \
| EXT4_FEATURE_INCOMPAT_MMP)
| EXT4_FEATURE_INCOMPAT_MMP \
| EXT4_FEATURE_INCOMPAT_CSUM_SEED)
#define EXT3_JOURNAL_MAGIC_NUMBER 0xc03b3998U
@@ -723,10 +731,11 @@ grub_ext2_read_symlink (grub_fshelp_node_t node)
if (! symlink)
return 0;
/* If the filesize of the symlink is bigger than
60 the symlink is stored in a separate block,
otherwise it is stored in the inode. */
if (grub_le_to_cpu32 (diro->inode.size) <= sizeof (diro->inode.symlink))
/*
* If the filesize of the symlink is equal to or bigger than 60 the symlink
* is stored in a separate block, otherwise it is stored in the inode.
*/
if (grub_le_to_cpu32 (diro->inode.size) < sizeof (diro->inode.symlink))
grub_memcpy (symlink,
diro->inode.symlink,
grub_le_to_cpu32 (diro->inode.size));

View File

@@ -889,6 +889,7 @@ grub_ntfs_mount (grub_disk_t disk)
struct grub_ntfs_bpb bpb;
struct grub_ntfs_data *data = 0;
grub_uint32_t spc;
grub_uint32_t sectors_per_cluster;
if (!disk)
goto fail;
@@ -903,14 +904,18 @@ grub_ntfs_mount (grub_disk_t disk)
if (grub_disk_read (disk, 0, 0, sizeof (bpb), &bpb))
goto fail;
sectors_per_cluster = bpb.sectors_per_cluster;
if (sectors_per_cluster > 0x80)
sectors_per_cluster = 1U << (256U - bpb.sectors_per_cluster);
if (grub_memcmp ((char *) &bpb.oem_name, "NTFS", 4) != 0
|| bpb.sectors_per_cluster == 0
|| (bpb.sectors_per_cluster & (bpb.sectors_per_cluster - 1)) != 0
|| sectors_per_cluster == 0
|| (sectors_per_cluster & (sectors_per_cluster - 1)) != 0
|| bpb.bytes_per_sector == 0
|| (bpb.bytes_per_sector & (bpb.bytes_per_sector - 1)) != 0)
goto fail;
spc = (((grub_uint32_t) bpb.sectors_per_cluster
spc = (((grub_uint32_t) sectors_per_cluster
* (grub_uint32_t) grub_le_to_cpu16 (bpb.bytes_per_sector))
>> GRUB_NTFS_BLK_SHR);
if (spc == 0)

File diff suppressed because it is too large Load Diff

View File

@@ -23,11 +23,25 @@
#include <grub/misc.h>
#include <grub/disk.h>
#include <grub/dl.h>
#include <grub/time.h>
#include <grub/types.h>
#include <grub/fshelp.h>
GRUB_MOD_LICENSE ("GPLv3+");
#define NSEC_PER_SEC ((grub_int64_t) 1000000000)
// GRUB 2.04 doesn't have safemath.h
// #include <grub/safemath.h>
// gcc < 5.1 doesn't support __builtin_add_overflow and __builtin_mul_overflow
// #define grub_add(a, b, res) __builtin_add_overflow(a, b, res)
// #define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res)
// Warning: This is unsafe!
#define grub_add(a, b, res) ({ *(res) = (a) + (b); 0; })
#define grub_mul(a, b, res) ({ *(res) = (a) * (b); 0; })
#define XFS_INODE_EXTENTS 9
#define XFS_INODE_FORMAT_INO 1
@@ -74,10 +88,22 @@ GRUB_MOD_LICENSE ("GPLv3+");
XFS_SB_VERSION2_PROJID32BIT | \
XFS_SB_VERSION2_FTYPE)
/* Inode flags2 flags */
#define XFS_DIFLAG2_BIGTIME_BIT 3
#define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT)
#define XFS_DIFLAG2_NREXT64_BIT 4
#define XFS_DIFLAG2_NREXT64 (1 << XFS_DIFLAG2_NREXT64_BIT)
/* incompat feature flags */
#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */
#define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */
#define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */
#define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */
#define XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR (1 << 4) /* needs xfs_repair */
#define XFS_SB_FEAT_INCOMPAT_NREXT64 (1 << 5) /* large extent counters */
#define XFS_SB_FEAT_INCOMPAT_EXCHRANGE (1 << 6) /* exchangerange supported */
#define XFS_SB_FEAT_INCOMPAT_PARENT (1 << 7) /* parent pointers */
#define XFS_SB_FEAT_INCOMPAT_METADIR (1 << 8) /* metadata dir tree */
/*
* Directory entries with ftype are explicitly handled by GRUB code.
@@ -87,11 +113,26 @@ GRUB_MOD_LICENSE ("GPLv3+");
*
* We do not currently verify metadata UUID, so it is safe to read filesystems
* with the XFS_SB_FEAT_INCOMPAT_META_UUID feature.
*
* We do not currently replay the log, so it is safe to read filesystems
* with the XFS_SB_FEAT_INCOMPAT_EXCHRANGE feature.
*
* We do not currently read directory parent pointers, so it is safe to read
* filesystems with the XFS_SB_FEAT_INCOMPAT_PARENT feature.
*
* We do not currently look at realtime or quota metadata, so it is safe to
* read filesystems with the XFS_SB_FEAT_INCOMPAT_METADIR feature.
*/
#define XFS_SB_FEAT_INCOMPAT_SUPPORTED \
(XFS_SB_FEAT_INCOMPAT_FTYPE | \
XFS_SB_FEAT_INCOMPAT_SPINODES | \
XFS_SB_FEAT_INCOMPAT_META_UUID)
XFS_SB_FEAT_INCOMPAT_META_UUID | \
XFS_SB_FEAT_INCOMPAT_BIGTIME | \
XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR | \
XFS_SB_FEAT_INCOMPAT_NREXT64 | \
XFS_SB_FEAT_INCOMPAT_EXCHRANGE | \
XFS_SB_FEAT_INCOMPAT_PARENT | \
XFS_SB_FEAT_INCOMPAT_METADIR)
struct grub_xfs_sblock
{
@@ -176,33 +217,49 @@ struct grub_xfs_btree_root
grub_uint64_t keys[1];
} GRUB_PACKED;
struct grub_xfs_time
struct grub_xfs_time_legacy
{
grub_uint32_t sec;
grub_uint32_t nanosec;
} GRUB_PACKED;
/*
* The struct grub_xfs_inode layout was taken from the
* struct xfs_dinode_core which is described here:
* https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf
*/
struct grub_xfs_inode
{
grub_uint8_t magic[2];
grub_uint16_t mode;
grub_uint8_t version;
grub_uint8_t format;
grub_uint8_t unused2[26];
struct grub_xfs_time atime;
struct grub_xfs_time mtime;
struct grub_xfs_time ctime;
grub_uint8_t unused2[18];
grub_uint64_t nextents_big;
grub_uint64_t atime;
grub_uint64_t mtime;
grub_uint64_t ctime;
grub_uint64_t size;
grub_uint64_t nblocks;
grub_uint32_t extsize;
grub_uint32_t nextents;
grub_uint16_t unused3;
grub_uint8_t fork_offset;
grub_uint8_t unused4[17];
grub_uint8_t unused4[17]; /* Last member of inode v2. */
grub_uint8_t unused5[20]; /* First member of inode v3. */
grub_uint64_t flags2;
grub_uint8_t unused6[48]; /* Last member of inode v3. */
} GRUB_PACKED;
#define XFS_V2_INODE_SIZE sizeof(struct grub_xfs_inode)
#define XFS_V3_INODE_SIZE (XFS_V2_INODE_SIZE + 76)
#define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode)
/* Size of struct grub_xfs_inode v2, up to unused4 member included. */
#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76)
struct grub_xfs_dir_leaf_entry
{
grub_uint32_t hashval;
grub_uint32_t address;
} GRUB_PACKED;
struct grub_xfs_dirblock_tail
{
@@ -220,6 +277,7 @@ struct grub_fshelp_node
struct grub_xfs_data
{
grub_size_t data_size;
struct grub_xfs_sblock sblock;
grub_disk_t disk;
int pos;
@@ -232,8 +290,6 @@ struct grub_xfs_data
static grub_dl_t my_mod;
static int grub_xfs_sb_hascrc(struct grub_xfs_data *data)
{
return (data->sblock.version & grub_cpu_to_be16_compile_time(XFS_SB_VERSION_NUMBITS)) ==
@@ -296,9 +352,21 @@ static int grub_xfs_sb_valid(struct grub_xfs_data *data)
}
return 1;
}
grub_error (GRUB_ERR_BAD_FS, "unsupported XFS filesystem version");
return 0;
}
static int
grub_xfs_sb_needs_repair (struct grub_xfs_data *data)
{
return ((data->sblock.version &
grub_cpu_to_be16_compile_time (XFS_SB_VERSION_NUMBITS)) ==
grub_cpu_to_be16_compile_time (XFS_SB_VERSION_5) &&
(data->sblock.sb_features_incompat &
grub_cpu_to_be32_compile_time (XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR)));
}
/* Filetype information as used in inodes. */
#define FILETYPE_INO_MASK 0170000
#define FILETYPE_INO_REG 0100000
@@ -354,7 +422,6 @@ GRUB_XFS_EXTENT_SIZE (struct grub_xfs_extent *exts, int ex)
return (grub_be_to_cpu32 (exts[ex].raw[3]) & ((1 << 21) - 1));
}
static inline grub_uint64_t
grub_xfs_inode_block (struct grub_xfs_data *data,
grub_uint64_t ino)
@@ -489,7 +556,7 @@ grub_xfs_read_inode (struct grub_xfs_data *data, grub_uint64_t ino,
grub_uint64_t block = grub_xfs_inode_block (data, ino);
int offset = grub_xfs_inode_offset (data, ino);
grub_dprintf("xfs", "Reading inode (%"PRIuGRUB_UINT64_T") - %"PRIuGRUB_UINT64_T", %d\n",
grub_dprintf("xfs", "Reading inode (%" PRIuGRUB_UINT64_T ") - %" PRIuGRUB_UINT64_T ", %d\n",
ino, block, offset);
/* Read the inode. */
if (grub_disk_read (data->disk, block, offset, grub_xfs_inode_size(data),
@@ -509,11 +576,26 @@ get_fsb (const void *keys, int idx)
return grub_be_to_cpu64 (grub_get_unaligned64 (p));
}
static int
grub_xfs_inode_has_large_extent_counts (const struct grub_xfs_inode *inode)
{
return inode->version >= 3 &&
(inode->flags2 & grub_cpu_to_be64_compile_time (XFS_DIFLAG2_NREXT64));
}
static grub_uint64_t
grub_xfs_get_inode_nextents (struct grub_xfs_inode *inode)
{
return (grub_xfs_inode_has_large_extent_counts (inode)) ?
grub_be_to_cpu64 (inode->nextents_big) :
grub_be_to_cpu32 (inode->nextents);
}
static grub_disk_addr_t
grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
{
struct grub_xfs_btree_node *leaf = 0;
int ex, nrec;
grub_uint64_t ex, nrec;
struct grub_xfs_extent *exts;
grub_uint64_t ret = 0;
@@ -538,7 +620,18 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
/ (2 * sizeof (grub_uint64_t));
do
{
int i;
grub_uint64_t i;
grub_addr_t keys_end, data_end;
if (grub_mul (sizeof (grub_uint64_t), nrec, &keys_end) ||
grub_add ((grub_addr_t) keys, keys_end, &keys_end) ||
grub_add ((grub_addr_t) node->data, node->data->data_size, &data_end) ||
keys_end > data_end)
{
grub_error (GRUB_ERR_BAD_FS, "invalid number of XFS root keys");
grub_free (leaf);
return 0;
}
for (i = 0; i < nrec; i++)
{
@@ -556,7 +649,10 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
if (grub_disk_read (node->data->disk,
GRUB_XFS_FSB_TO_BLOCK (node->data, get_fsb (keys, i - 1 + recoffset)) << (node->data->sblock.log2_bsize - GRUB_DISK_SECTOR_BITS),
0, node->data->bsize, leaf))
return 0;
{
grub_free (leaf);
return 0;
}
if ((!node->data->hascrc &&
grub_strncmp ((char *) leaf->magic, "BMAP", 4)) ||
@@ -579,8 +675,20 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
}
else if (node->inode.format == XFS_INODE_FORMAT_EXT)
{
nrec = grub_be_to_cpu32 (node->inode.nextents);
grub_addr_t exts_end = 0;
grub_addr_t data_end = 0;
nrec = grub_xfs_get_inode_nextents (&node->inode);
exts = (struct grub_xfs_extent *) grub_xfs_inode_data(&node->inode);
if (grub_mul (sizeof (struct grub_xfs_extent), nrec, &exts_end) ||
grub_add ((grub_addr_t) node->data, exts_end, &exts_end) ||
grub_add ((grub_addr_t) node->data, node->data->data_size, &data_end) ||
exts_end > data_end)
{
grub_error (GRUB_ERR_BAD_FS, "invalid number of XFS extents");
return 0;
}
}
else
{
@@ -634,6 +742,7 @@ static char *
grub_xfs_read_symlink (grub_fshelp_node_t node)
{
grub_ssize_t size = grub_be_to_cpu64 (node->inode.size);
grub_size_t sz;
if (size < 0)
{
@@ -655,7 +764,12 @@ grub_xfs_read_symlink (grub_fshelp_node_t node)
if (node->data->hascrc)
off = 56;
symlink = grub_malloc (size + 1);
if (grub_add (size, 1, &sz))
{
grub_error (GRUB_ERR_OUT_OF_RANGE, N_("symlink size overflow"));
return 0;
}
symlink = grub_malloc (sz);
if (!symlink)
return 0;
@@ -705,8 +819,15 @@ static int iterate_dir_call_hook (grub_uint64_t ino, const char *filename,
{
struct grub_fshelp_node *fdiro;
grub_err_t err;
grub_size_t sz;
fdiro = grub_malloc (grub_xfs_fshelp_size(ctx->diro->data) + 1);
if (grub_add (grub_xfs_fshelp_size(ctx->diro->data), 1, &sz))
{
grub_error (GRUB_ERR_OUT_OF_RANGE, N_("directory data size overflow"));
grub_print_error ();
return 0;
}
fdiro = grub_malloc (sz);
if (!fdiro)
{
grub_print_error ();
@@ -722,6 +843,7 @@ static int iterate_dir_call_hook (grub_uint64_t ino, const char *filename,
if (err)
{
grub_print_error ();
grub_free (fdiro);
return 0;
}
@@ -764,12 +886,20 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
if (iterate_dir_call_hook (parent, "..", &ctx))
return 1;
for (i = 0; i < head->count; i++)
for (i = 0; i < head->count &&
(grub_uint8_t *) de < ((grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)); i++)
{
grub_uint64_t ino;
grub_uint8_t *inopos = grub_xfs_inline_de_inopos(dir->data, de);
grub_uint8_t c;
if ((inopos + (smallino ? 4 : 8)) > (grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data))
{
grub_error (GRUB_ERR_BAD_FS, "invalid XFS inode");
return 0;
}
/* inopos might be unaligned. */
if (smallino)
ino = (((grub_uint32_t) inopos[0]) << 24)
@@ -824,24 +954,49 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
{
struct grub_xfs_dir2_entry *direntry =
grub_xfs_first_de(dir->data, dirblock);
int entries;
struct grub_xfs_dirblock_tail *tail =
grub_xfs_dir_tail(dir->data, dirblock);
int entries = -1;
char *end = dirblock + dirblk_size;
grub_uint32_t magic;
numread = grub_xfs_read_file (dir, 0, 0,
blk << dirblk_log2,
dirblk_size, dirblock, 0);
if (numread != dirblk_size)
return 0;
{
grub_free (dirblock);
return 0;
}
entries = (grub_be_to_cpu32 (tail->leaf_count)
- grub_be_to_cpu32 (tail->leaf_stale));
if (!entries)
/*
* If this data block isn't actually part of the extent list then
* grub_xfs_read_file() returns a block of zeros. So, if the magic
* number field is all zeros then this block should be skipped.
*/
magic = *(grub_uint32_t *)(void *) dirblock;
if (!magic)
continue;
/*
* Leaf and tail information are only in the data block if the number
* of extents is 1.
*/
if (grub_xfs_get_inode_nextents (&dir->inode) == 1)
{
struct grub_xfs_dirblock_tail *tail = grub_xfs_dir_tail (dir->data, dirblock);
end = (char *) tail;
/* Subtract the space used by leaf nodes. */
end -= grub_be_to_cpu32 (tail->leaf_count) * sizeof (struct grub_xfs_dir_leaf_entry);
entries = grub_be_to_cpu32 (tail->leaf_count) - grub_be_to_cpu32 (tail->leaf_stale);
if (!entries)
continue;
}
/* Iterate over all entries within this block. */
while ((char *)direntry < (char *)tail)
while ((char *) direntry < (char *) end)
{
grub_uint8_t *freetag;
char *filename;
@@ -861,22 +1016,34 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
}
filename = (char *)(direntry + 1);
if (filename + direntry->len + 1 > (char *) end)
{
grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry");
return 0;
}
/* The byte after the filename is for the filetype, padding, or
tag, which is not used by GRUB. So it can be overwritten. */
filename[direntry->len] = '\0';
if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode),
if (iterate_dir_call_hook (grub_be_to_cpu64(direntry->inode),
filename, &ctx))
{
grub_free (dirblock);
return 1;
}
/* Check if last direntry in this block is
reached. */
entries--;
if (!entries)
break;
/*
* The expected number of directory entries is only tracked for the
* single extent case.
*/
if (grub_xfs_get_inode_nextents (&dir->inode) == 1)
{
/* Check if last direntry in this block is reached. */
entries--;
if (!entries)
break;
}
/* Select the next directory entry. */
direntry = grub_xfs_next_de(dir->data, direntry);
@@ -899,11 +1066,14 @@ static struct grub_xfs_data *
grub_xfs_mount (grub_disk_t disk)
{
struct grub_xfs_data *data = 0;
grub_size_t sz;
data = grub_zalloc (sizeof (struct grub_xfs_data));
if (!data)
return 0;
data->data_size = sizeof (struct grub_xfs_data);
grub_dprintf("xfs", "Reading sb\n");
/* Read the superblock. */
if (grub_disk_read (disk, 0, 0,
@@ -913,14 +1083,19 @@ grub_xfs_mount (grub_disk_t disk)
if (!grub_xfs_sb_valid(data))
goto fail;
data = grub_realloc (data,
sizeof (struct grub_xfs_data)
- sizeof (struct grub_xfs_inode)
+ grub_xfs_inode_size(data) + 1);
if (grub_xfs_sb_needs_repair (data))
grub_dprintf ("xfs", "XFS filesystem needs repair, boot may fail\n");
if (grub_add (grub_xfs_inode_size (data),
sizeof (struct grub_xfs_data) - sizeof (struct grub_xfs_inode) + 1, &sz))
goto fail;
data = grub_realloc (data, sz);
if (! data)
goto fail;
data->data_size = sz;
data->diropen.data = data;
data->diropen.ino = grub_be_to_cpu64(data->sblock.rootino);
data->diropen.inode_read = 1;
@@ -931,7 +1106,7 @@ grub_xfs_mount (grub_disk_t disk)
data->disk = disk;
data->pos = 0;
grub_dprintf("xfs", "Reading root ino %"PRIuGRUB_UINT64_T"\n",
grub_dprintf("xfs", "Reading root ino %" PRIuGRUB_UINT64_T "\n",
grub_cpu_to_be64(data->sblock.rootino));
grub_xfs_read_inode (data, data->diropen.ino, &data->diropen.inode);
@@ -939,7 +1114,7 @@ grub_xfs_mount (grub_disk_t disk)
return data;
fail:
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
if (grub_errno == GRUB_ERR_OUT_OF_RANGE || grub_errno == GRUB_ERR_NONE)
grub_error (GRUB_ERR_BAD_FS, "not an XFS filesystem");
grub_free (data);
@@ -947,7 +1122,6 @@ grub_xfs_mount (grub_disk_t disk)
return 0;
}
/* Context for grub_xfs_dir. */
struct grub_xfs_dir_ctx
{
@@ -955,6 +1129,27 @@ struct grub_xfs_dir_ctx
void *hook_data;
};
/* Bigtime inodes helpers. */
#define XFS_BIGTIME_EPOCH_OFFSET (-(grub_int64_t) GRUB_INT32_MIN)
static int grub_xfs_inode_has_bigtime (const struct grub_xfs_inode *inode)
{
return inode->version >= 3 &&
(inode->flags2 & grub_cpu_to_be64_compile_time (XFS_DIFLAG2_BIGTIME));
}
static grub_int64_t
grub_xfs_get_inode_time (struct grub_xfs_inode *inode)
{
struct grub_xfs_time_legacy *lts;
if (grub_xfs_inode_has_bigtime (inode))
return grub_divmod64 (grub_be_to_cpu64 (inode->mtime), NSEC_PER_SEC, NULL) - XFS_BIGTIME_EPOCH_OFFSET;
lts = (struct grub_xfs_time_legacy *) &inode->mtime;
return grub_be_to_cpu32 (lts->sec);
}
/* Helper for grub_xfs_dir. */
static int
grub_xfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
@@ -967,7 +1162,7 @@ grub_xfs_dir_iter (const char *filename, enum grub_fshelp_filetype filetype,
if (node->inode_read)
{
info.mtimeset = 1;
info.mtime = grub_be_to_cpu32 (node->inode.mtime.sec);
info.mtime = grub_xfs_get_inode_time (&node->inode);
}
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
grub_free (node);
@@ -1132,8 +1327,6 @@ grub_xfs_uuid (grub_device_t device, char **uuid)
return grub_errno;
}
static struct grub_fs grub_xfs_fs =
{
.name = "xfs",
@@ -1152,6 +1345,7 @@ static struct grub_fs grub_xfs_fs =
GRUB_MOD_INIT(xfs)
{
//grub_xfs_fs.mod = mod;
grub_fs_register (&grub_xfs_fs);
my_mod = mod;
}

View File

@@ -0,0 +1,285 @@
/*
* LZ4 - Fast LZ compression algorithm
* Header File
* Copyright (C) 2011-2013, Yann Collet.
* BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You can contact the author at :
* - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
* - LZ4 source repository : http://code.google.com/p/lz4/
*/
#include <grub/err.h>
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/types.h>
int LZ4_uncompress_unknownOutputSize(const char *source, char *dest,
int isize, int maxOutputSize);
/*
* CPU Feature Detection
*/
/* 32 or 64 bits ? */
#if (GRUB_CPU_SIZEOF_VOID_P == 8)
#define LZ4_ARCH64 1
#else
#define LZ4_ARCH64 0
#endif
/*
* Compiler Options
*/
#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
#if (GCC_VERSION >= 302) || (defined (__INTEL_COMPILER) && __INTEL_COMPILER >= 800) || defined(__clang__)
#define expect(expr, value) (__builtin_expect((expr), (value)))
#else
#define expect(expr, value) (expr)
#endif
#define likely(expr) expect((expr) != 0, 1)
#define unlikely(expr) expect((expr) != 0, 0)
/* Basic types */
#define BYTE grub_uint8_t
#define U16 grub_uint16_t
#define U32 grub_uint32_t
#define S32 grub_int32_t
#define U64 grub_uint64_t
typedef struct _U16_S {
U16 v;
} GRUB_PACKED U16_S;
typedef struct _U32_S {
U32 v;
} GRUB_PACKED U32_S;
typedef struct _U64_S {
U64 v;
} GRUB_PACKED U64_S;
#define A64(x) (((U64_S *)(x))->v)
#define A32(x) (((U32_S *)(x))->v)
#define A16(x) (((U16_S *)(x))->v)
/*
* Constants
*/
#define MINMATCH 4
#define COPYLENGTH 8
#define LASTLITERALS 5
#define ML_BITS 4
#define ML_MASK ((1U<<ML_BITS)-1)
#define RUN_BITS (8-ML_BITS)
#define RUN_MASK ((1U<<RUN_BITS)-1)
/*
* Architecture-specific macros
*/
#if LZ4_ARCH64
#define STEPSIZE 8
#define UARCH U64
#define AARCH A64
#define LZ4_COPYSTEP(s, d) A64(d) = A64(s); d += 8; s += 8;
#define LZ4_COPYPACKET(s, d) LZ4_COPYSTEP(s, d)
#define LZ4_SECURECOPY(s, d, e) if (d < e) LZ4_WILDCOPY(s, d, e)
#define HTYPE U32
#define INITBASE(base) const BYTE* const base = ip
#else
#define STEPSIZE 4
#define UARCH U32
#define AARCH A32
#define LZ4_COPYSTEP(s, d) A32(d) = A32(s); d += 4; s += 4;
#define LZ4_COPYPACKET(s, d) LZ4_COPYSTEP(s, d); LZ4_COPYSTEP(s, d);
#define LZ4_SECURECOPY LZ4_WILDCOPY
#define HTYPE const BYTE*
#define INITBASE(base) const int base = 0
#endif
#define LZ4_READ_LITTLEENDIAN_16(d, s, p) { d = (s) - grub_le_to_cpu16 (A16 (p)); }
#define LZ4_WRITE_LITTLEENDIAN_16(p, v) { A16(p) = grub_cpu_to_le16 (v); p += 2; }
/* Macros */
#define LZ4_WILDCOPY(s, d, e) do { LZ4_COPYPACKET(s, d) } while (d < e);
/* Decompression functions */
grub_err_t
lz4_decompress(void *s_start, void *d_start, grub_size_t s_len, grub_size_t d_len);
grub_err_t
lz4_decompress(void *s_start, void *d_start, grub_size_t s_len, grub_size_t d_len)
{
const BYTE *src = s_start;
U32 bufsiz = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) |
src[3];
/* invalid compressed buffer size encoded at start */
if (bufsiz + 4 > s_len)
return grub_error(GRUB_ERR_BAD_FS,"lz4 decompression failed.");
/*
* Returns 0 on success (decompression function returned non-negative)
* and appropriate error on failure (decompression function returned negative).
*/
return (LZ4_uncompress_unknownOutputSize((char*)s_start + 4, d_start, bufsiz,
d_len) < 0)?grub_error(GRUB_ERR_BAD_FS,"lz4 decompression failed."):0;
}
int
LZ4_uncompress_unknownOutputSize(const char *source,
char *dest, int isize, int maxOutputSize)
{
/* Local Variables */
const BYTE * ip = (const BYTE *) source;
const BYTE *const iend = ip + isize;
const BYTE * ref;
BYTE * op = (BYTE *) dest;
BYTE *const oend = op + maxOutputSize;
BYTE *cpy;
grub_size_t dec[] = { 0, 3, 2, 3, 0, 0, 0, 0 };
/* Main Loop */
while (ip < iend) {
BYTE token;
int length;
/* get runlength */
token = *ip++;
if ((length = (token >> ML_BITS)) == RUN_MASK) {
int s = 255;
while ((ip < iend) && (s == 255)) {
s = *ip++;
length += s;
}
}
/* copy literals */
if ((grub_addr_t) length > ~(grub_addr_t)op)
goto _output_error;
cpy = op + length;
if ((cpy > oend - COPYLENGTH) ||
(ip + length > iend - COPYLENGTH)) {
if (cpy > oend)
/*
* Error: request to write beyond destination
* buffer.
*/
goto _output_error;
if (ip + length > iend)
/*
* Error : request to read beyond source
* buffer.
*/
goto _output_error;
grub_memcpy(op, ip, length);
op += length;
ip += length;
if (ip < iend)
/* Error : LZ4 format violation */
goto _output_error;
/* Necessarily EOF, due to parsing restrictions. */
break;
}
LZ4_WILDCOPY(ip, op, cpy);
ip -= (op - cpy);
op = cpy;
/* get offset */
LZ4_READ_LITTLEENDIAN_16(ref, cpy, ip);
ip += 2;
if (ref < (BYTE * const) dest)
/*
* Error: offset creates reference outside of
* destination buffer.
*/
goto _output_error;
/* get matchlength */
if ((length = (token & ML_MASK)) == ML_MASK) {
while (ip < iend) {
int s = *ip++;
length += s;
if (s == 255)
continue;
break;
}
}
/* copy repeated sequence */
if unlikely(op - ref < STEPSIZE) {
#if LZ4_ARCH64
grub_size_t dec2table[] = { 0, 0, 0, -1, 0, 1, 2, 3 };
grub_size_t dec2 = dec2table[op - ref];
#else
const int dec2 = 0;
#endif
*op++ = *ref++;
*op++ = *ref++;
*op++ = *ref++;
*op++ = *ref++;
ref -= dec[op - ref];
A32(op) = A32(ref);
op += STEPSIZE - 4;
ref -= dec2;
} else {
LZ4_COPYSTEP(ref, op);
}
cpy = op + length - (STEPSIZE - 4);
if (cpy > oend - COPYLENGTH) {
if (cpy > oend)
/*
* Error: request to write outside of
* destination buffer.
*/
goto _output_error;
LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
while (op < cpy)
*op++ = *ref++;
op = cpy;
if (op == oend)
/*
* Check EOF (should never happen, since last
* 5 bytes are supposed to be literals).
*/
break;
continue;
}
LZ4_SECURECOPY(ref, op, cpy);
op = cpy; /* correction */
}
/* end of decoding */
return (int)(((char *)op) - dest);
/* write overflow error detected */
_output_error:
return (int)(-(((char *)ip) - source));
}

View File

@@ -31,6 +31,7 @@ extern int g_ventoy_iso_raw;
extern int g_ventoy_grub2_mode;
extern int g_ventoy_wimboot_mode;
extern int g_ventoy_iso_uefi_drv;
extern char g_ventoy_hotkey_tip[256];
static const char *align_options[] =
{
@@ -230,10 +231,11 @@ label_set_property (void *vself, const char *name, const char *value)
value = g_ventoy_iso_uefi_drv ? grub_env_get("VTOY_ISO_UEFI_DRV_STR") : " ";
}
else if (grub_strcmp (value, "@VTOY_HOTKEY_TIP@") == 0) {
value = grub_env_get("VTOY_HOTKEY_TIP");
if (value == NULL) {
value = _(" ");
}
value = g_ventoy_hotkey_tip;
} else if (value[0] == '@' && value[1] == '@' && value[2]) {
value = grub_env_get(value + 2);
if (!value)
value = " ";
}
self->template = grub_strdup (value);

View File

@@ -295,6 +295,8 @@ theme_set_string (grub_gfxmenu_view_t view,
if (! view->title_text)
return grub_errno;
}
else if (! grub_strcmp ("ventoy_left_top_color", name))
return grub_errno;
else
{
return grub_error (GRUB_ERR_BAD_ARGUMENT,
@@ -732,6 +734,11 @@ read_property (struct parsebuf *p)
"%s:%d:%d property value invalid; "
"enclose literal values in quotes (\")",
p->filename, p->line_num, p->col_num);
grub_printf("File: %s\nLine:%d Column:%d\n"
"property value invalid; enclose literal values in quotes (\")\n\n",
p->filename, p->line_num, p->col_num);
goto done;
}

View File

@@ -49,6 +49,12 @@ static grub_efi_uintn_t finish_desc_size;
static grub_efi_uint32_t finish_desc_version;
int grub_efi_is_finished = 0;
/* 160MB 160 * 1024 * 1024 / 4096 */
#define VTOY_CHAIN_MIN_PAGES (160 * 256)
static grub_efi_uint64_t g_total_pages;
static grub_efi_uint64_t g_org_required_pages;
static grub_efi_uint64_t g_new_required_pages;
/*
* We need to roll back EFI allocations on exit. Remember allocations that
* we'll free on exit.
@@ -614,6 +620,22 @@ grub_efi_mm_init (void)
else if (required_pages > BYTES_TO_PAGES (MAX_HEAP_SIZE))
required_pages = BYTES_TO_PAGES (MAX_HEAP_SIZE);
g_org_required_pages = required_pages;
if (((total_pages - required_pages) >> 2) < VTOY_CHAIN_MIN_PAGES)
{
if (total_pages > (VTOY_CHAIN_MIN_PAGES << 2))
{
g_new_required_pages = total_pages - (VTOY_CHAIN_MIN_PAGES << 2);
if (g_new_required_pages >= 8192)
{
required_pages = g_new_required_pages;
}
}
}
g_total_pages = total_pages;
g_new_required_pages = required_pages;
/* Sort the filtered descriptors, so that GRUB can allocate pages
from smaller regions. */
sort_memory_map (filtered_memory_map, desc_size, filtered_memory_map_end);
@@ -670,3 +692,11 @@ grub_efi_get_ram_base(grub_addr_t *base_addr)
return GRUB_ERR_NONE;
}
#endif
void grub_efi_get_reserved_page_num(grub_uint64_t *total, grub_uint64_t *org_required, grub_uint64_t *new_required)
{
*total = g_total_pages;
*org_required = g_org_required_pages;
*new_required = g_new_required_pages;
}

View File

@@ -0,0 +1,250 @@
/* env.c - Environment variables */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2005,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/>.
*/
#include <grub/env.h>
#include <grub/env_private.h>
#include <grub/misc.h>
#include <grub/mm.h>
/* The initial context. */
static struct grub_env_context initial_context;
/* The current context. */
struct grub_env_context *grub_current_context = &initial_context;
static grub_env_read_hook_t vtoy_menu_lang_read_hook;
/* Return the hash representation of the string S. */
static unsigned int
grub_env_hashval (const char *s)
{
unsigned int i = 0;
/* XXX: This can be done much more efficiently. */
while (*s)
i += 5 * *(s++);
return i % HASHSZ;
}
static struct grub_env_var *
grub_env_find (const char *name)
{
struct grub_env_var *var;
int idx = grub_env_hashval (name);
/* Look for the variable in the current context. */
for (var = grub_current_context->vars[idx]; var; var = var->next)
if (grub_strcmp (var->name, name) == 0)
return var;
return 0;
}
static void
grub_env_insert (struct grub_env_context *context,
struct grub_env_var *var)
{
int idx = grub_env_hashval (var->name);
/* Insert the variable into the hashtable. */
var->prevp = &context->vars[idx];
var->next = context->vars[idx];
if (var->next)
var->next->prevp = &(var->next);
context->vars[idx] = var;
}
static void
grub_env_remove (struct grub_env_var *var)
{
/* Remove the entry from the variable table. */
*var->prevp = var->next;
if (var->next)
var->next->prevp = var->prevp;
}
grub_err_t
grub_env_set (const char *name, const char *val)
{
struct grub_env_var *var;
/* If the variable does already exist, just update the variable. */
var = grub_env_find (name);
if (var)
{
char *old = var->value;
if (var->write_hook)
var->value = var->write_hook (var, val);
else
var->value = grub_strdup (val);
if (! var->value)
{
var->value = old;
return grub_errno;
}
grub_free (old);
return GRUB_ERR_NONE;
}
/* The variable does not exist, so create a new one. */
var = grub_zalloc (sizeof (*var));
if (! var)
return grub_errno;
var->name = grub_strdup (name);
if (! var->name)
goto fail;
var->value = grub_strdup (val);
if (! var->value)
goto fail;
grub_env_insert (grub_current_context, var);
return GRUB_ERR_NONE;
fail:
grub_free (var->name);
grub_free (var->value);
grub_free (var);
return grub_errno;
}
const char *
grub_env_get (const char *name)
{
struct grub_env_var *var;
if (name && vtoy_menu_lang_read_hook && grub_strncmp(name, "VTLANG_", 7) == 0)
return vtoy_menu_lang_read_hook(NULL, name);
var = grub_env_find (name);
if (! var)
return 0;
if (var->read_hook)
return var->read_hook (var, var->value);
return var->value;
}
void
grub_env_unset (const char *name)
{
struct grub_env_var *var;
var = grub_env_find (name);
if (! var)
return;
if (var->read_hook || var->write_hook)
{
grub_env_set (name, "");
return;
}
grub_env_remove (var);
grub_free (var->name);
grub_free (var->value);
grub_free (var);
}
struct grub_env_var *
grub_env_update_get_sorted (void)
{
struct grub_env_var *sorted_list = 0;
int i;
/* Add variables associated with this context into a sorted list. */
for (i = 0; i < HASHSZ; i++)
{
struct grub_env_var *var;
for (var = grub_current_context->vars[i]; var; var = var->next)
{
struct grub_env_var *p, **q;
for (q = &sorted_list, p = *q; p; q = &((*q)->sorted_next), p = *q)
{
if (grub_strcmp (p->name, var->name) > 0)
break;
}
var->sorted_next = *q;
*q = var;
}
}
return sorted_list;
}
grub_err_t
grub_register_variable_hook (const char *name,
grub_env_read_hook_t read_hook,
grub_env_write_hook_t write_hook)
{
struct grub_env_var *var = grub_env_find (name);
if (! var)
{
if (grub_env_set (name, "") != GRUB_ERR_NONE)
return grub_errno;
var = grub_env_find (name);
/* XXX Insert an assertion? */
}
var->read_hook = read_hook;
var->write_hook = write_hook;
return GRUB_ERR_NONE;
}
grub_err_t
grub_register_vtoy_menu_lang_hook(grub_env_read_hook_t read_hook)
{
vtoy_menu_lang_read_hook = read_hook;
return GRUB_ERR_NONE;
}
grub_err_t
grub_env_export (const char *name)
{
struct grub_env_var *var;
var = grub_env_find (name);
if (! var)
{
grub_err_t err;
err = grub_env_set (name, "");
if (err)
return err;
var = grub_env_find (name);
}
var->global = 1;
return GRUB_ERR_NONE;
}

View File

@@ -200,7 +200,8 @@ const char *grub_file_get_vlnk(const char *name, int *vlnk)
if (len == g_vtoy_vlnk.srclen && grub_strcmp(name, g_vtoy_vlnk.src) == 0)
{
*vlnk = 1;
if (vlnk)
*vlnk = 1;
return g_vtoy_vlnk.dst;
}
@@ -208,7 +209,8 @@ const char *grub_file_get_vlnk(const char *name, int *vlnk)
{
if (node->srclen == len && grub_strcmp(name, node->src) == 0)
{
*vlnk = 1;
if (vlnk)
*vlnk = 1;
return node->dst;
}
node = node->next;
@@ -340,10 +342,12 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
if (len == 0)
return 0;
if (grub_strncmp(file->name, GRUB_MEMFILE_MEM, grub_strlen(GRUB_MEMFILE_MEM)) == 0) {
if (file->name) {
if (grub_strncmp(file->name, GRUB_MEMFILE_MEM, grub_strlen(GRUB_MEMFILE_MEM)) == 0) {
grub_memcpy(buf, (grub_uint8_t *)(file->data) + file->offset, len);
file->offset += len;
return len;
}
}
read_hook = file->read_hook;

View File

@@ -362,7 +362,8 @@ static grub_err_t
cmd_append (const char *line, struct syslinux_menu *menu)
{
if (!menu->entries)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "kernel without label");
return GRUB_ERR_NONE;
//return grub_error (GRUB_ERR_BAD_ARGUMENT, "kernel without label");
menu->entries->append = grub_strdup (line);
if (!menu->entries->append)

View File

@@ -229,10 +229,7 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
if (! file)
goto fail;
/* Get the root device's device path. */
dev = grub_device_open (0);
if (! dev)
goto fail;
dev = file->device;
if (dev->disk)
dev_handle = grub_efidisk_get_device_handle (dev->disk);
@@ -257,16 +254,13 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
if (dev_handle)
dp = grub_efi_get_device_path (dev_handle);
if (! dp)
if (dp != NULL)
{
grub_error (GRUB_ERR_BAD_DEVICE, "not a valid root device");
goto fail;
file_path = make_file_path (dp, filename);
if (! file_path)
goto fail;
}
file_path = make_file_path (dp, filename);
if (! file_path)
goto fail;
//grub_printf ("file path: ");
//grub_efi_print_device_path (file_path);
@@ -390,16 +384,12 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
}
grub_file_close (file);
grub_device_close (dev);
grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0);
return 0;
fail:
if (dev)
grub_device_close (dev);
if (file)
grub_file_close (file);

View File

@@ -88,6 +88,8 @@ static int ventoy_linux_argc = 0;
static char **ventoy_linux_args = NULL;
static int ventoy_extra_initrd_num = 0;
static char *ventoy_extra_initrd_list[256];
static grub_command_func_t ventoy_linux16_func = NULL;
static grub_command_func_t ventoy_initrd16_func = NULL;
static grub_err_t
grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]);
@@ -667,54 +669,6 @@ static int ventoy_bootopt_hook(int argc, char *argv[])
return 0;
}
static grub_err_t
grub_cmd_set_boot_opt (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
int i;
const char *vtdebug;
for (i = 0; i < argc; i++)
{
ventoy_linux_args[ventoy_linux_argc + (LINUX_MAX_ARGC / 2) ] = grub_strdup(argv[i]);
ventoy_linux_argc++;
}
vtdebug = grub_env_get("vtdebug_flag");
if (vtdebug && vtdebug[0])
{
ventoy_debug = 1;
}
if (ventoy_debug) grub_printf("ventoy set boot opt %d\n", ventoy_linux_argc);
return 0;
}
static grub_err_t
grub_cmd_unset_boot_opt (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
int i;
(void)argc;
(void)argv;
for (i = 0; i < LINUX_MAX_ARGC; i++)
{
if (ventoy_linux_args[i])
{
grub_free(ventoy_linux_args[i]);
}
}
ventoy_debug = 0;
ventoy_linux_argc = 0;
ventoy_initrd_called = 0;
grub_memset(ventoy_linux_args, 0, sizeof(char *) * LINUX_MAX_ARGC);
return 0;
}
static grub_err_t
grub_cmd_extra_initrd_append (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
@@ -1576,6 +1530,92 @@ ventoy_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
return grub_cmd_initrd(cmd, ventoy_extra_initrd_num, ventoy_extra_initrd_list);
}
static grub_err_t
grub_cmd_set_boot_opt (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
int i;
const char *vtdebug;
grub_command_t regcmd;
for (i = 0; i < argc; i++)
{
ventoy_linux_args[ventoy_linux_argc + (LINUX_MAX_ARGC / 2) ] = grub_strdup(argv[i]);
ventoy_linux_argc++;
}
vtdebug = grub_env_get("vtdebug_flag");
if (vtdebug && vtdebug[0])
{
ventoy_debug = 1;
}
if (ventoy_debug) grub_printf("ventoy set boot opt %d\n", ventoy_linux_argc);
ventoy_linux16_func = ventoy_initrd16_func = NULL;
regcmd = grub_command_find("linux16");
if (regcmd)
{
ventoy_linux16_func = regcmd->func;
regcmd->func = grub_cmd_linux;
}
regcmd = grub_command_find("initrd16");
if (regcmd)
{
ventoy_initrd16_func = regcmd->func;
regcmd->func = ventoy_cmd_initrd;
}
return 0;
}
static grub_err_t
grub_cmd_unset_boot_opt (grub_command_t cmd __attribute__ ((unused)),
int argc, char *argv[])
{
int i;
grub_command_t regcmd;
(void)argc;
(void)argv;
for (i = 0; i < LINUX_MAX_ARGC; i++)
{
if (ventoy_linux_args[i])
{
grub_free(ventoy_linux_args[i]);
}
}
ventoy_debug = 0;
ventoy_linux_argc = 0;
ventoy_initrd_called = 0;
grub_memset(ventoy_linux_args, 0, sizeof(char *) * LINUX_MAX_ARGC);
if (ventoy_linux16_func)
{
regcmd = grub_command_find("linux16");
if (regcmd)
{
regcmd->func = ventoy_linux16_func;
}
ventoy_linux16_func = NULL;
}
if (ventoy_initrd16_func)
{
regcmd = grub_command_find("initrd16");
if (regcmd)
{
regcmd->func = ventoy_initrd16_func;
}
ventoy_initrd16_func = NULL;
}
return 0;
}
static grub_command_t cmd_linux, cmd_initrd, cmd_linuxefi, cmd_initrdefi;
static grub_command_t cmd_set_bootopt, cmd_unset_bootopt, cmd_extra_initrd_append, cmd_extra_initrd_reset;

View File

@@ -128,11 +128,22 @@ insert_dir (const char *name, struct dir **root,
n->name = grub_strndup (cb, ce - cb);
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);
ptr = make_header (ptr, name, ce - name,
ptr = make_header (ptr, tmp_name, ce - name + 1,
040777, 0);
grub_free (tmp_name);
}
size += ALIGN_UP ((ce - (char *) name)
size += ALIGN_UP ((ce - (char *) name + 1)
+ sizeof (struct newc_head), 4);
*head = n;
cur = n;
@@ -183,7 +194,7 @@ grub_initrd_init (int argc, char *argv[],
}
initrd_ctx->size
+= ALIGN_UP (sizeof (struct newc_head)
+ grub_strlen (initrd_ctx->components[i].newc_name),
+ grub_strlen (initrd_ctx->components[i].newc_name) + 1,
4);
initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name,
&root, 0);
@@ -194,7 +205,7 @@ grub_initrd_init (int argc, char *argv[],
else if (newc)
{
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
+ sizeof ("TRAILER!!!") - 1, 4);
+ sizeof ("TRAILER!!!"), 4);
free_dir (root);
root = 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 (sizeof (struct newc_head)
+ sizeof ("TRAILER!!!") - 1, 4);
+ sizeof ("TRAILER!!!"), 4);
free_dir (root);
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,
&root, ptr);
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,
initrd_ctx->components[i].size);
newc = 1;
}
else if (newc)
{
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1,
ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!"),
0, 0);
free_dir (root);
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));
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);
root = 0;

View File

@@ -48,10 +48,35 @@ int g_ventoy_suppress_esc = 0;
int g_ventoy_suppress_esc_default = 1;
int g_ventoy_menu_esc = 0;
int g_ventoy_fn_mutex = 0;
int g_ventoy_secondary_menu_on = 0;
int g_ventoy_terminal_output = 0;
char g_ventoy_hotkey_tip[256];
static int g_vt_key_num = 0;
static int g_vt_key_code[128];
static int ventoy_menu_pop_key(void)
{
if (g_vt_key_num > 0 && g_vt_key_num < (int)(sizeof(g_vt_key_code) / sizeof(g_vt_key_code[0])))
{
g_vt_key_num--;
return g_vt_key_code[g_vt_key_num];
}
return -1;
}
int ventoy_menu_push_key(int code)
{
if (g_vt_key_num >= 0 && g_vt_key_num < (int)(sizeof(g_vt_key_code) / sizeof(g_vt_key_code[0])))
{
g_vt_key_code[g_vt_key_num++] = code;
return 0;
}
return -1;
}
#define VTOY_COMM_HOTKEY(cmdkey) \
if (0 == g_ventoy_fn_mutex) { \
if (0 == g_ventoy_fn_mutex && 0 == g_ventoy_secondary_menu_on) { \
cmdstr = grub_env_get(cmdkey); \
if (cmdstr) \
{ \
@@ -795,7 +820,11 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
return default_entry;
}
c = grub_getkey_noblock ();
if (g_vt_key_num > 0) {
c = ventoy_menu_pop_key();
} else {
c = grub_getkey_noblock ();
}
/* Negative values are returned on error. */
if ((c != GRUB_TERM_NO_KEY) && (c > 0))
@@ -922,77 +951,110 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
menu_fini ();
if (g_ventoy_terminal_output == 0)
{
grub_script_execute_sourcecode("terminal_output console");
grub_script_execute_sourcecode("vt_push_menu_lang en_US\nterminal_output console");
g_ventoy_terminal_output = 1;
}
else
{
grub_script_execute_sourcecode("terminal_output gfxterm");
grub_script_execute_sourcecode("terminal_output gfxterm\nvt_pop_menu_lang");
g_ventoy_terminal_output = 0;
}
goto refresh;
case GRUB_TERM_KEY_F1:
case '1':
menu_fini ();
g_ventoy_memdisk_mode = 1 - g_ventoy_memdisk_mode;
g_ventoy_menu_refresh = 1;
goto refresh;
case (GRUB_TERM_CTRL | 'i'):
menu_fini ();
g_ventoy_iso_raw = 1 - g_ventoy_iso_raw;
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 | 'w'):
menu_fini ();
g_ventoy_wimboot_mode = 1 - g_ventoy_wimboot_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;
g_ventoy_menu_refresh = 1;
goto refresh;
case (GRUB_TERM_CTRL | 'h'):
case 'h':
{
cmdstr = grub_env_get("VTOY_HELP_CMD");
if (cmdstr)
if (0 == g_ventoy_secondary_menu_on)
{
cmdstr = grub_env_get("VTOY_HELP_CMD");
if (cmdstr)
{
grub_script_execute_sourcecode(cmdstr);
while (grub_getkey() != GRUB_TERM_ESC)
;
menu_fini ();
goto refresh;
}
}
break;
case (GRUB_TERM_CTRL | 'd'):
case 'd':
if (0 == g_ventoy_secondary_menu_on)
{
grub_script_execute_sourcecode(cmdstr);
while (grub_getkey() != GRUB_TERM_ESC)
;
menu_fini ();
g_ventoy_memdisk_mode = 1 - g_ventoy_memdisk_mode;
g_ventoy_menu_refresh = 1;
goto refresh;
}
break;
case (GRUB_TERM_CTRL | 'i'):
case 'i':
if (0 == g_ventoy_secondary_menu_on)
{
menu_fini ();
g_ventoy_iso_raw = 1 - g_ventoy_iso_raw;
g_ventoy_menu_refresh = 1;
goto refresh;
}
break;
case (GRUB_TERM_CTRL | 'r'):
case 'r':
if (0 == g_ventoy_secondary_menu_on)
{
menu_fini ();
g_ventoy_grub2_mode = 1 - g_ventoy_grub2_mode;
g_ventoy_menu_refresh = 1;
goto refresh;
}
break;
case (GRUB_TERM_CTRL | 'w'):
case 'w':
if (0 == g_ventoy_secondary_menu_on)
{
menu_fini ();
g_ventoy_wimboot_mode = 1 - g_ventoy_wimboot_mode;
g_ventoy_menu_refresh = 1;
goto refresh;
}
break;
case (GRUB_TERM_CTRL | 'u'):
case 'u':
if (0 == g_ventoy_secondary_menu_on)
{
menu_fini ();
g_ventoy_iso_uefi_drv = 1 - g_ventoy_iso_uefi_drv;
g_ventoy_menu_refresh = 1;
goto refresh;
}
break;
case (GRUB_TERM_CTRL | 'l'):
case (GRUB_TERM_CTRL | 'L'):
case (GRUB_TERM_SHIFT | 'l'):
case (GRUB_TERM_SHIFT | 'L'):
case 'l':
case 'L':
{
VTOY_COMM_HOTKEY("VTOY_LANG_CMD");
break;
}
case (GRUB_TERM_CTRL | 'm'):
case 'm':
{
if (g_ventoy_cur_img_path)
{
grub_env_set("VTOY_CHKSUM_FILE_PATH", g_ventoy_cur_img_path);
cmdstr = grub_env_get("VTOY_CHKSUM_CMD");
if (cmdstr)
if (0 == g_ventoy_secondary_menu_on)
{
if (g_ventoy_cur_img_path)
{
menu_fini();
grub_script_execute_sourcecode(cmdstr);
goto refresh;
grub_env_set("VTOY_CHKSUM_FILE_PATH", g_ventoy_cur_img_path);
cmdstr = grub_env_get("VTOY_CHKSUM_CMD");
if (cmdstr)
{
menu_fini();
grub_script_execute_sourcecode(cmdstr);
goto refresh;
}
}
else
{
grub_env_set("VTOY_CHKSUM_FILE_PATH", "X");
}
}
else
{
grub_env_set("VTOY_CHKSUM_FILE_PATH", "X");
}
break;
}
@@ -1071,6 +1133,7 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
while (1)
{
int ndown;
int boot_entry;
grub_menu_entry_t e;
int auto_boot;
@@ -1113,6 +1176,16 @@ show_menu (grub_menu_t menu, int nested, int autobooted)
if (2 == e->argc && e->args && e->args[1] && grub_strncmp(e->args[1], "VTOY_RUN_RET", 12) == 0)
break;
else if (2 == e->argc && e->args && e->args[1] && grub_strncmp(e->args[1], "VTOY_RUN_SET", 12) == 0) {
ndown = (int)grub_strtol(e->args[1] + 12, NULL, 10);
while (ndown > 0)
{
ventoy_menu_push_key(GRUB_TERM_KEY_DOWN);
ndown--;
}
ventoy_menu_push_key('\n');
break;
}
}
return GRUB_ERR_NONE;

View File

@@ -31,6 +31,8 @@
static grub_uint8_t grub_color_menu_normal;
static grub_uint8_t grub_color_menu_highlight;
extern char g_ventoy_hotkey_tip[256];
struct menu_viewer_data
{
int first, offset;
@@ -204,7 +206,7 @@ command-line or ESC to discard edits and return to the GRUB menu."),
ret += grub_print_message_indented_real(szLine, STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
ret += grub_print_message_indented_real("\n", STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
ret += grub_print_message_indented_real(grub_env_get("VTOY_HOTKEY_TIP"),
ret += grub_print_message_indented_real(g_ventoy_hotkey_tip,
3, 6, term, dry_run);
}
}

View File

@@ -38,6 +38,7 @@
#include <grub/memory.h>
#ifdef GRUB_MACHINE_EFI
#include <grub/efi/efi.h>
#include <grub/efi/memory.h>
#endif
#include <grub/ventoy.h>
#include "ventoy_def.h"
@@ -75,7 +76,130 @@ void ventoy_str_toupper(char *str)
}
}
char *ventoy_str_last(char *str, char ch)
{
char *pos = NULL;
char *last = NULL;
if (!str)
{
return NULL;
}
for (pos = str; *pos; pos++)
{
if (*pos == ch)
{
last = pos;
}
}
return last;
}
int ventoy_str_all_digit(const char *str)
{
if (NULL == str || 0 == *str)
{
return 0;
}
while (*str)
{
if (*str < '0' || *str > '9')
{
return 0;
}
}
return 1;
}
int ventoy_str_all_alnum(const char *str)
{
if (NULL == str || 0 == *str)
{
return 0;
}
while (*str)
{
if (!grub_isalnum(*str))
{
return 0;
}
}
return 1;
}
int ventoy_str_len_alnum(const char *str, int len)
{
int i;
int slen;
if (NULL == str || 0 == *str)
{
return 0;
}
slen = grub_strlen(str);
if (slen <= len)
{
return 0;
}
for (i = 0; i < len; i++)
{
if (!grub_isalnum(str[i]))
{
return 0;
}
}
if (str[len] == 0 || grub_isspace(str[len]))
{
return 1;
}
return 0;
}
char * ventoy_str_basename(char *path)
{
char *pos = NULL;
pos = grub_strrchr(path, '/');
if (pos)
{
pos++;
}
else
{
pos = path;
}
return pos;
}
int ventoy_str_chrcnt(const char *str, char c)
{
int n = 0;
if (str)
{
while (*str)
{
if (*str == c)
{
n++;
}
str++;
}
}
return n;
}
int ventoy_strcmp(const char *pattern, const char *str)
{
@@ -108,6 +232,14 @@ int ventoy_strncmp (const char *pattern, const char *str, grub_size_t n)
return (int)(grub_uint8_t)*pattern - (int)(grub_uint8_t)*str;
}
grub_err_t ventoy_env_int_set(const char *name, int value)
{
char buf[16];
grub_snprintf(buf, sizeof(buf), "%d", value);
return grub_env_set(name, buf);
}
void ventoy_debug_dump_guid(const char *prefix, grub_uint8_t *guid)
{
int i;
@@ -135,6 +267,37 @@ int ventoy_is_efi_os(void)
return g_efi_os;
}
void * ventoy_alloc_chain(grub_size_t size)
{
void *p = NULL;
p = grub_malloc(size);
#ifdef GRUB_MACHINE_EFI
if (!p)
{
p = grub_efi_allocate_any_pages(GRUB_EFI_BYTES_TO_PAGES(size));
}
#endif
return p;
}
void ventoy_memfile_env_set(const char *prefix, const void *buf, unsigned long long len)
{
char name[128];
char val[64];
grub_snprintf(name, sizeof(name), "%s_addr", prefix);
grub_snprintf(val, sizeof(val), "0x%llx", (ulonglong)(ulong)buf);
grub_env_set(name, val);
grub_snprintf(name, sizeof(name), "%s_size", prefix);
grub_snprintf(val, sizeof(val), "%llu", len);
grub_env_set(name, val);
return;
}
static int ventoy_arch_mode_init(void)
{
#ifdef GRUB_MACHINE_EFI
@@ -200,12 +363,130 @@ static int ventoy_hwinfo_init(void)
grub_snprintf(str, sizeof(str), "%ld", (long)(total_mem / VTOY_SIZE_1MB));
ventoy_env_export("grub_total_ram", str);
#ifdef GRUB_MACHINE_EFI
ventoy_get_uefi_version(str, sizeof(str));
ventoy_env_export("grub_uefi_version", str);
#else
ventoy_env_export("grub_uefi_version", "NA");
#endif
return 0;
}
static global_var_cfg g_global_vars[] =
{
{ "gfxmode", "1024x768", NULL },
{ ventoy_left_key, "5%", NULL },
{ ventoy_top_key, "95%", NULL },
{ ventoy_color_key, "#0000ff", NULL },
{ NULL, NULL, NULL }
};
static const char * ventoy_global_var_read_hook(struct grub_env_var *var, const char *val)
{
int i;
for (i = 0; g_global_vars[i].name; i++)
{
if (grub_strcmp(g_global_vars[i].name, var->name) == 0)
{
return g_global_vars[i].value;
}
}
return val;
}
static char * ventoy_global_var_write_hook(struct grub_env_var *var, const char *val)
{
int i;
for (i = 0; g_global_vars[i].name; i++)
{
if (grub_strcmp(g_global_vars[i].name, var->name) == 0)
{
grub_check_free(g_global_vars[i].value);
g_global_vars[i].value = grub_strdup(val);
break;
}
}
return grub_strdup(val);
}
int ventoy_global_var_init(void)
{
int i;
for (i = 0; g_global_vars[i].name; i++)
{
g_global_vars[i].value = grub_strdup(g_global_vars[i].defval);
ventoy_env_export(g_global_vars[i].name, g_global_vars[i].defval);
grub_register_variable_hook(g_global_vars[i].name, ventoy_global_var_read_hook, ventoy_global_var_write_hook);
}
return 0;
}
static ctrl_var_cfg g_ctrl_vars[] =
{
{ "VTOY_WIN11_BYPASS_CHECK", 1 },
{ "VTOY_WIN11_BYPASS_NRO", 1 },
{ "VTOY_LINUX_REMOUNT", 0 },
{ "VTOY_SECONDARY_BOOT_MENU", 1 },
{ NULL, 0 }
};
static const char * ventoy_ctrl_var_read_hook(struct grub_env_var *var, const char *val)
{
int i;
for (i = 0; g_ctrl_vars[i].name; i++)
{
if (grub_strcmp(g_ctrl_vars[i].name, var->name) == 0)
{
return g_ctrl_vars[i].value ? "1" : "0";
}
}
return val;
}
static char * ventoy_ctrl_var_write_hook(struct grub_env_var *var, const char *val)
{
int i;
for (i = 0; g_ctrl_vars[i].name; i++)
{
if (grub_strcmp(g_ctrl_vars[i].name, var->name) == 0)
{
if (val && val[0] == '1' && val[1] == 0)
{
g_ctrl_vars[i].value = 1;
return grub_strdup("1");
}
else
{
g_ctrl_vars[i].value = 0;
return grub_strdup("0");
}
}
}
return grub_strdup(val);
}
int ventoy_ctrl_var_init(void)
{
int i;
for (i = 0; g_ctrl_vars[i].name; i++)
{
ventoy_env_export(g_ctrl_vars[i].name, g_ctrl_vars[i].value ? "1" : "0");
grub_register_variable_hook(g_ctrl_vars[i].name, ventoy_ctrl_var_read_hook, ventoy_ctrl_var_write_hook);
}
return 0;
}

View File

@@ -171,6 +171,11 @@ static int ventoy_browser_iterate_partition(struct grub_disk *disk, const grub_p
fs->fs_label(dev, &Label);
if (ventoy_check_file_exist("(%s)/.ventoyignore", partname))
{
return 0;
}
if (g_tree_view_menu_style == 0)
{
grub_snprintf(title, sizeof(title), "%-10s (%s,%s%d) [%s] %s %s",
@@ -239,6 +244,15 @@ static int ventoy_browser_valid_dirname(const char *name, int len)
return 0;
}
if (g_filt_trash_dir)
{
if (0 == grub_strncmp(name, ".trash-", 7) ||
0 == grub_strcmp(name, ".Trashes"))
{
return 0;
}
}
if (name[0] == '$')
{
if (0 == grub_strncmp(name, "$RECYCLE.BIN", 12) ||
@@ -311,6 +325,25 @@ static int ventoy_browser_valid_filename(const char *filename, int len, int *typ
return 1;
}
static int ventoy_browser_check_ignore(const char *device, const char *root, const char *dir)
{
grub_file_t file;
char fullpath[1024] = {0};
grub_snprintf(fullpath, 1023, "(%s)%s/%s/.ventoyignore", device, root, dir);
file = grub_file_open(fullpath, GRUB_FILE_TYPE_NONE);
if (!file)
{
grub_errno = 0;
return 0;
}
else
{
grub_file_close(file);
return 1;
}
}
static int ventoy_browser_iterate_dir(const char *filename, const struct grub_dirhook_info *info, void *data)
{
int type;
@@ -328,6 +361,11 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
return 0;
}
if (ventoy_browser_check_ignore(g_menu_device, g_menu_path_buf, filename))
{
return 0;
}
node = grub_zalloc(sizeof(browser_node));
if (!node)
{
@@ -363,6 +401,11 @@ static int ventoy_browser_iterate_dir(const char *filename, const struct grub_di
return 0;
}
if (grub_file_is_vlnk_suffix(filename, len))
{
return 0;
}
node = grub_zalloc(sizeof(browser_node));
if (!node)
{
@@ -520,13 +563,13 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
if (g_tree_view_menu_style == 0)
{
browser_ssprintf(&mbuf, "menuentry \"%-10s [../]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n}\n", "<--");
browser_ssprintf(&mbuf, "menuentry \"%-10s [(%s)%s/..]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n}\n", "<--", args[0], g_menu_path_buf);
}
else
{
browser_ssprintf(&mbuf, "menuentry \"[../]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n}\n");
browser_ssprintf(&mbuf, "menuentry \"[(%s)%s/..]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n}\n", args[0], g_menu_path_buf);
}
for (i = 1; i >= 0; i--)
@@ -587,13 +630,15 @@ grub_err_t ventoy_cmd_browser_disk(grub_extcmd_context_t ctxt, int argc, char **
if (g_tree_view_menu_style == 0)
{
browser_ssprintf(&mbuf, "menuentry \"%-10s [Return]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n}\n", "<--");
browser_ssprintf(&mbuf, "menuentry \"%-10s [%s]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n}\n", "<--",
ventoy_get_vmenu_title("VTLANG_BROWER_RETURN"));
}
else
{
browser_ssprintf(&mbuf, "menuentry \"[Return]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n}\n");
browser_ssprintf(&mbuf, "menuentry \"[%s]\" --class=\"vtoyret\" VTOY_RET {\n "
" echo 'return ...' \n}\n",
ventoy_get_vmenu_title("VTLANG_BROWER_RETURN"));
}
grub_disk_dev_iterate(ventoy_browser_iterate_disk, &mbuf);

File diff suppressed because it is too large Load Diff

View File

@@ -29,6 +29,8 @@
#define VTOY_FILT_MIN_FILE_SIZE 32768
#define VTOY_LINUX_SYSTEMD_MENU_MAX_BUF 16384
#define VTOY_SIZE_1GB 1073741824
#define VTOY_SIZE_1MB (1024 * 1024)
#define VTOY_SIZE_2MB (2 * 1024 * 1024)
@@ -36,11 +38,14 @@
#define VTOY_SIZE_512KB (512 * 1024)
#define VTOY_SIZE_1KB 1024
#define VTOY_SIZE_32KB (32 * 1024)
#define VTOY_SIZE_128KB (128 * 1024)
#define JSON_SUCCESS 0
#define JSON_FAILED 1
#define JSON_NOT_FOUND 2
#define WINDATA_FLAG_TEMPLATE 1
#define ulong unsigned long
#define ulonglong unsigned long long
@@ -57,6 +62,8 @@
#define VTOY_WARNING "!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!"
#define VTOY_CHKSUM_NUM 4
#define VTOY_PLAT_I386_UEFI 0x49413332
#define VTOY_PLAT_ARM64_UEFI 0x41413634
#define VTOY_PLAT_X86_64_UEFI 0x55454649
@@ -72,6 +79,10 @@
#define VTOY_ARCH_CPIO "ventoy_x86.cpio"
#endif
#define ventoy_left_key "VTLE_LFT"
#define ventoy_top_key "VTLE_TOP"
#define ventoy_color_key "VTLE_CLR"
#define ventoy_varg_4(arg) arg[0], arg[1], arg[2], arg[3]
#define ventoy_varg_8(arg) arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7]
@@ -84,6 +95,38 @@
return (err);\
}
#define VTOY_APPEND_NEWBUF(buf) \
{\
char *__c = buf;\
while (*__c)\
{\
newbuf[pos++] = *__c;\
__c++;\
}\
}
#define VTOY_SKIP_SPACE(s) \
while (ventoy_isspace(*s)) \
{\
s++;\
}
#define VTOY_SKIP_SPACE_NEXT(s, initial) \
s += initial;\
while (ventoy_isspace(*s)) \
{\
s++;\
}
#define VTOY_SKIP_SPACE_NEXT_EX(s, base, initial) \
s = base + initial;\
while (ventoy_isspace(*s)) \
{\
s++;\
}
#define VTOY_GOTO_END(v) ret = v; goto end
typedef enum VTOY_FILE_FLT
{
VTOY_FILE_FLT_ISO = 0, /* .iso */
@@ -313,12 +356,19 @@ extern int g_ventoy_debug;
void ventoy_debug(const char *fmt, ...);
#define debug(fmt, args...) if (g_ventoy_debug) ventoy_debug("[VTOY]: "fmt, ##args)
#define vtoy_ssprintf(buf, pos, fmt, ...) \
pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, __VA_ARGS__)
#define vtoy_ssprintf(buf, pos, fmt, args...) \
pos += grub_snprintf(buf + pos, VTOY_MAX_SCRIPT_BUF - pos, fmt, ##args)
#define vtoy_len_ssprintf(buf, pos, len, fmt, args...) \
pos += grub_snprintf(buf + pos, len - pos, fmt, ##args)
#define browser_ssprintf(mbuf, fmt, args...) \
(mbuf)->pos += grub_snprintf((mbuf)->buf + (mbuf)->pos, (mbuf)->max - (mbuf)->pos, fmt, ##args)
#define vtoy_dummy_menuentry(buf, pos, len, title, class) \
vtoy_len_ssprintf(buf, pos, len, "menuentry \"%s\" --class=\"%s\" {\n echo \"\"\n}\n", title, class)
#define FLAG_HEADER_RESERVED 0x00000001
#define FLAG_HEADER_COMPRESSION 0x00000002
#define FLAG_HEADER_READONLY 0x00000004
@@ -488,6 +538,7 @@ typedef struct wim_tail
grub_uint8_t *jump_bin_data;
grub_uint32_t bin_raw_len;
grub_uint32_t bin_align_len;
grub_uint32_t windata_flag;
grub_uint8_t *new_meta_data;
grub_uint32_t new_meta_len;
@@ -587,6 +638,12 @@ typedef struct chk_case_fs_dir
grub_fs_t fs;
}chk_case_fs_dir;
int ventoy_str_all_digit(const char *str);
int ventoy_str_all_alnum(const char *str);
int ventoy_str_len_alnum(const char *str, int len);
char * ventoy_str_basename(char *path);
grub_err_t ventoy_env_int_set(const char *name, int value);
int ventoy_str_chrcnt(const char *str, char c);
int ventoy_strcmp(const char *pattern, const char *str);
int ventoy_strncmp (const char *pattern, const char *str, grub_size_t n);
void ventoy_fill_os_param(grub_file_t file, ventoy_os_param *param);
@@ -598,6 +655,8 @@ grub_err_t ventoy_cmd_clear_initrd_list(grub_extcmd_context_t ctxt, int argc, ch
grub_uint32_t ventoy_get_iso_boot_catlog(grub_file_t file);
int ventoy_has_efi_eltorito(grub_file_t file, grub_uint32_t sector);
grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_linux_limine_menu(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
@@ -618,6 +677,7 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_wim_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_wim_check_bootable(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_is_standard_winiso(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_dump_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_sel_wimboot(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_set_wim_prompt(grub_extcmd_context_t ctxt, int argc, char **args);
@@ -801,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)
@@ -853,6 +914,9 @@ typedef struct install_template
int templatenum;
file_fullpath *templatepath;
char *filebuf;
int filelen;
struct install_template *next;
}install_template;
@@ -942,7 +1006,7 @@ typedef struct custom_boot
struct custom_boot *next;
}custom_boot;
#define vtoy_max_replace_file_size (2 * 1024 * 1024)
#define vtoy_max_replace_file_size (1024 * 1024)
typedef struct conf_replace
{
int pathlen;
@@ -1010,6 +1074,7 @@ typedef struct menu_password
}menu_password;
extern int g_ventoy_menu_esc;
extern int g_ventoy_secondary_menu_on;
extern int g_ventoy_suppress_esc;
extern int g_ventoy_suppress_esc_default;
extern int g_ventoy_last_entry;
@@ -1022,18 +1087,23 @@ extern int g_ventoy_case_insensitive;
extern int g_ventoy_fn_mutex;
extern grub_uint8_t g_ventoy_chain_type;
extern int g_vhdboot_enable;
extern int g_default_menu_mode;
extern char g_ventoy_hotkey_tip[256];
extern int g_ventoy_menu_refresh;
#define VENTOY_IMG_WHITE_LIST 1
#define VENTOY_IMG_BLACK_LIST 2
extern int g_plugin_image_list;
extern ventoy_gpt_info *g_ventoy_part_info;
extern grub_uint64_t g_conf_replace_offset;
extern int g_conf_replace_count;
extern grub_uint64_t g_conf_replace_offset[VTOY_MAX_CONF_REPLACE];
extern grub_uint64_t g_svd_replace_offset;
extern conf_replace *g_conf_replace_node;
extern grub_uint8_t *g_conf_replace_new_buf;
extern int g_conf_replace_new_len;
extern int g_conf_replace_new_len_align;
extern conf_replace *g_conf_replace_node[VTOY_MAX_CONF_REPLACE];
extern grub_uint8_t *g_conf_replace_new_buf[VTOY_MAX_CONF_REPLACE];
extern int g_conf_replace_new_len[VTOY_MAX_CONF_REPLACE];
extern int g_conf_replace_new_len_align[VTOY_MAX_CONF_REPLACE];
extern int g_ventoy_disk_bios_id;
extern grub_uint64_t g_ventoy_disk_size;
extern grub_uint64_t g_ventoy_disk_part_size[2];
extern grub_uint32_t g_ventoy_plat_data;
@@ -1060,15 +1130,15 @@ extern grub_uint32_t g_ventoy_plat_data;
void ventoy_str_tolower(char *str);
void ventoy_str_toupper(char *str);
char * ventoy_get_line(char *start);
char *ventoy_str_last(char *str, char ch);
int ventoy_cmp_img(img_info *img1, img_info *img2);
void ventoy_swap_img(img_info *img1, img_info *img2);
char * ventoy_plugin_get_cur_install_template(const char *isopath);
char * ventoy_plugin_get_cur_install_template(const char *isopath, install_template **cur);
install_template * ventoy_plugin_find_install_template(const char *isopath);
persistence_config * ventoy_plugin_find_persistent(const char *isopath);
grub_uint64_t ventoy_get_vtoy_partsize(int part);
void ventoy_plugin_dump_injection(void);
void ventoy_plugin_dump_auto_install(void);
int ventoy_fill_windows_rtdata(void *buf, char *isopath);
int ventoy_plugin_get_persistent_chunklist(const char *isopath, int index, ventoy_img_chunk_list *chunk_list);
const char * ventoy_plugin_get_injection(const char *isopath);
const char * ventoy_plugin_get_menu_alias(int type, const char *isopath);
@@ -1076,7 +1146,7 @@ const menu_tip * ventoy_plugin_get_menu_tip(int type, const char *isopath);
const char * ventoy_plugin_get_menu_class(int type, const char *name, const char *path);
int ventoy_plugin_check_memdisk(const char *isopath);
int ventoy_plugin_get_image_list_index(int type, const char *name);
conf_replace * ventoy_plugin_find_conf_replace(const char *iso);
int ventoy_plugin_find_conf_replace(const char *iso, conf_replace *nodes[VTOY_MAX_CONF_REPLACE]);
dud * ventoy_plugin_find_dud(const char *iso);
int ventoy_plugin_load_dud(dud *node, const char *isopart);
int ventoy_get_block_list(grub_file_t file, ventoy_img_chunk_list *chunklist, grub_disk_addr_t start);
@@ -1091,6 +1161,7 @@ grub_err_t ventoy_cmd_linux_get_main_initrd_index(grub_extcmd_context_t ctxt, in
grub_err_t ventoy_cmd_collect_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_wim_patch_count(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_sel_winpe_wim(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char **args);
int ventoy_get_disk_guid(const char *filename, grub_uint8_t *guid, grub_uint8_t *signature);
grub_err_t ventoy_cmd_unix_reset(grub_extcmd_context_t ctxt, int argc, char **args);
@@ -1190,6 +1261,37 @@ typedef struct browser_node
struct browser_node *next;
}browser_node;
typedef struct var_node
{
char var[128];
char val[256];
struct var_node *next;
}var_node;
typedef struct systemd_menu_ctx
{
char *dev;
char *buf;
int pos;
int len;
}systemd_menu_ctx;
typedef struct global_var_cfg
{
const char *name;
const char *defval;
char *value;
}global_var_cfg;
typedef struct ctrl_var_cfg
{
const char *name;
int value;
}ctrl_var_cfg;
#define vtoy_check_goto_out(p) if (!p) goto out
extern char *g_tree_script_buf;
extern int g_tree_script_pos;
extern int g_tree_script_pre;
@@ -1197,6 +1299,7 @@ extern int g_tree_view_menu_style;
extern int g_sort_case_sensitive;
extern int g_wimboot_enable;
extern int g_filt_dot_underscore_file;
extern int g_filt_trash_dir;
extern int g_vtoy_file_flt[VTOY_FILE_FLT_BUTT];
extern const char *g_menu_class[img_type_max];
extern char g_iso_path[256];
@@ -1205,6 +1308,15 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
grub_err_t ventoy_cmd_browser_disk(grub_extcmd_context_t ctxt, int argc, char **args);
int ventoy_get_fs_type(const char *fs);
int ventoy_img_name_valid(const char *filename, grub_size_t namelen);
void * ventoy_alloc_chain(grub_size_t size);
int ventoy_plugin_load_menu_lang(int init, const char *lang);
const char *ventoy_get_vmenu_title(const char *vMenu);
grub_err_t ventoy_cmd_cur_menu_lang(grub_extcmd_context_t ctxt, int argc, char **args);
extern int ventoy_menu_push_key(int code);
int ventoy_ctrl_var_init(void);
int ventoy_global_var_init(void);
grub_err_t ventoy_cmd_push_menulang(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_pop_menulang(grub_extcmd_context_t ctxt, int argc, char **args);
#endif /* __VENTOY_DEF_H__ */

View File

@@ -177,10 +177,7 @@ static grub_err_t ventoy_isolinux_initrd_collect(grub_file_t file, const char *p
{
nextline = ventoy_get_line(start);
while (ventoy_isspace(*start))
{
start++;
}
VTOY_SKIP_SPACE(start);
offset = 7; // strlen("initrd=") or "INITRD " or "initrd "
pos = grub_strstr(start, "initrd=");
@@ -333,12 +330,84 @@ end:
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
static int ventoy_linux_initrd_collect_hook(const char *filename, const struct grub_dirhook_info *info, void *data)
{
int len;
initrd_info *img = NULL;
(void)data;
if (0 == info->dir)
{
if (grub_strncmp(filename, "initrd", 6) == 0)
{
len = (int)grub_strlen(filename);
if (grub_strcmp(filename + len - 4, ".img") == 0)
{
img = grub_zalloc(sizeof(initrd_info));
if (img)
{
grub_snprintf(img->name, sizeof(img->name), "/boot/%s", filename);
if (ventoy_find_initrd_by_name(g_initrd_img_list, img->name))
{
grub_free(img);
}
else
{
if (g_initrd_img_list)
{
img->prev = g_initrd_img_tail;
g_initrd_img_tail->next = img;
}
else
{
g_initrd_img_list = img;
}
g_initrd_img_tail = img;
g_initrd_img_count++;
}
}
}
}
}
return 0;
}
static int ventoy_linux_collect_boot_initrds(void)
{
grub_fs_t fs;
grub_device_t dev = NULL;
dev = grub_device_open("loop");
if (!dev)
{
debug("failed to open device loop\n");
goto end;
}
fs = grub_fs_probe(dev);
if (!fs)
{
debug("failed to probe fs %d\n", grub_errno);
goto end;
}
fs->fs_dir(dev, "/boot", ventoy_linux_initrd_collect_hook, NULL);
end:
return 0;
}
static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName)
{
int i = 0;
int len = 0;
int dollar = 0;
int quotation = 0;
int initrd_dollar = 0;
grub_file_t file = NULL;
char *buf = NULL;
char *start = NULL;
@@ -366,10 +435,7 @@ static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName)
{
nextline = ventoy_get_line(start);
while (ventoy_isspace(*start))
{
start++;
}
VTOY_SKIP_SPACE(start);
if (grub_strncmp(start, "initrd", 6) != 0)
{
@@ -382,10 +448,7 @@ static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName)
start++;
}
while (ventoy_isspace(*start))
{
start++;
}
VTOY_SKIP_SPACE(start);
if (*start == '"')
{
@@ -421,6 +484,19 @@ static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName)
debug("Remove quotation <%s>\n", img->name);
}
/* special process for /boot/initrd$XXX.img */
if (dollar == 1)
{
if (grub_strncmp(img->name, "/boot/initrd$", 13) == 0)
{
len = (int)grub_strlen(img->name);
if (grub_strcmp(img->name + len - 4, ".img") == 0)
{
initrd_dollar++;
}
}
}
if (dollar == 1 || ventoy_find_initrd_by_name(g_initrd_img_list, img->name))
{
grub_free(img);
@@ -443,10 +519,7 @@ static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName)
if (*start == ' ' || *start == '\t')
{
while (ventoy_isspace(*start))
{
start++;
}
VTOY_SKIP_SPACE(start);
}
else
{
@@ -458,6 +531,12 @@ static grub_err_t ventoy_grub_cfg_initrd_collect(const char *fileName)
grub_free(buf);
grub_file_close(file);
if (initrd_dollar > 0 && grub_strncmp(fileName, "(loop)/", 7) == 0)
{
debug("collect initrd variable %d\n", initrd_dollar);
ventoy_linux_collect_boot_initrds();
}
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
@@ -654,11 +733,18 @@ int ventoy_cpio_newc_fill_head(void *buf, int filesize, const void *filedata, co
static grub_uint32_t ventoy_linux_get_virt_chunk_count(void)
{
int i;
grub_uint32_t count = g_valid_initrd_count;
if (g_conf_replace_offset > 0)
if (g_conf_replace_count > 0)
{
count++;
for (i = 0; i < g_conf_replace_count; i++)
{
if (g_conf_replace_offset[i] > 0)
{
count++;
}
}
}
if (g_append_ext_sector > 0)
@@ -671,13 +757,20 @@ static grub_uint32_t ventoy_linux_get_virt_chunk_count(void)
static grub_uint32_t ventoy_linux_get_virt_chunk_size(void)
{
int i;
grub_uint32_t size;
size = (sizeof(ventoy_virt_chunk) + g_ventoy_cpio_size) * g_valid_initrd_count;
if (g_conf_replace_offset > 0)
if (g_conf_replace_count > 0)
{
size += sizeof(ventoy_virt_chunk) + g_conf_replace_new_len_align;
for (i = 0; i < g_conf_replace_count; i++)
{
if (g_conf_replace_offset[i] > 0)
{
size += sizeof(ventoy_virt_chunk) + g_conf_replace_new_len_align[i];
}
}
}
if (g_append_ext_sector > 0)
@@ -690,6 +783,7 @@ static grub_uint32_t ventoy_linux_get_virt_chunk_size(void)
static void ventoy_linux_fill_virt_data( grub_uint64_t isosize, ventoy_chain_head *chain)
{
int i = 0;
int id = 0;
int virtid = 0;
initrd_info *node;
@@ -699,6 +793,7 @@ static void ventoy_linux_fill_virt_data( grub_uint64_t isosize, ventoy_chain_
grub_uint32_t initrd_secs;
char *override;
ventoy_virt_chunk *cur;
ventoy_grub_param_file_replace *replace = NULL;
char name[32];
override = (char *)chain + chain->virt_chunk_offset;
@@ -764,30 +859,37 @@ static void ventoy_linux_fill_virt_data( grub_uint64_t isosize, ventoy_chain_
virtid++;
}
if (g_conf_replace_offset > 0)
if (g_conf_replace_count > 0)
{
cpio_secs = g_conf_replace_new_len_align / 2048;
cur->mem_sector_start = sector;
cur->mem_sector_end = cur->mem_sector_start + cpio_secs;
cur->mem_sector_offset = offset;
cur->remap_sector_start = 0;
cur->remap_sector_end = 0;
cur->org_sector_start = 0;
grub_memcpy(override + offset, g_conf_replace_new_buf, g_conf_replace_new_len);
chain->virt_img_size_in_bytes += g_conf_replace_new_len_align;
if (g_grub_param->img_replace.magic == GRUB_IMG_REPLACE_MAGIC)
for (i = 0; i < g_conf_replace_count; i++)
{
g_grub_param->img_replace.new_file_virtual_id = virtid;
}
if (g_conf_replace_offset[i] > 0)
{
cpio_secs = g_conf_replace_new_len_align[i] / 2048;
cur->mem_sector_start = sector;
cur->mem_sector_end = cur->mem_sector_start + cpio_secs;
cur->mem_sector_offset = offset;
cur->remap_sector_start = 0;
cur->remap_sector_end = 0;
cur->org_sector_start = 0;
offset += g_conf_replace_new_len_align;
sector += cpio_secs;
cur++;
virtid++;
grub_memcpy(override + offset, g_conf_replace_new_buf[i], g_conf_replace_new_len[i]);
chain->virt_img_size_in_bytes += g_conf_replace_new_len_align[i];
replace = g_grub_param->img_replace + i;
if (replace->magic == GRUB_IMG_REPLACE_MAGIC)
{
replace->new_file_virtual_id = virtid;
}
offset += g_conf_replace_new_len_align[i];
sector += cpio_secs;
cur++;
virtid++;
}
}
}
return;
@@ -795,11 +897,18 @@ static void ventoy_linux_fill_virt_data( grub_uint64_t isosize, ventoy_chain_
static grub_uint32_t ventoy_linux_get_override_chunk_count(void)
{
int i;
grub_uint32_t count = g_valid_initrd_count;
if (g_conf_replace_offset > 0)
if (g_conf_replace_count > 0)
{
count++;
for (i = 0; i < g_conf_replace_count; i++)
{
if (g_conf_replace_offset[i] > 0)
{
count++;
}
}
}
if (g_svd_replace_offset > 0)
@@ -812,11 +921,18 @@ static grub_uint32_t ventoy_linux_get_override_chunk_count(void)
static grub_uint32_t ventoy_linux_get_override_chunk_size(void)
{
int i;
int count = g_valid_initrd_count;
if (g_conf_replace_offset > 0)
if (g_conf_replace_count > 0)
{
count++;
for (i = 0; i < g_conf_replace_count; i++)
{
if (g_conf_replace_offset[i] > 0)
{
count++;
}
}
}
if (g_svd_replace_offset > 0)
@@ -829,6 +945,7 @@ static grub_uint32_t ventoy_linux_get_override_chunk_size(void)
static void ventoy_linux_fill_override_data( grub_uint64_t isosize, void *override)
{
int i;
initrd_info *node;
grub_uint32_t mod;
grub_uint32_t newlen;
@@ -883,23 +1000,29 @@ static void ventoy_linux_fill_override_data( grub_uint64_t isosize, void *ove
cur++;
}
if (g_conf_replace_offset > 0)
{
cur->img_offset = g_conf_replace_offset;
cur->override_size = sizeof(ventoy_iso9660_override);
if (g_conf_replace_count > 0)
{
for (i = 0; i < g_conf_replace_count; i++)
{
if (g_conf_replace_offset[i] > 0)
{
cur->img_offset = g_conf_replace_offset[i];
cur->override_size = sizeof(ventoy_iso9660_override);
newlen = (grub_uint32_t)(g_conf_replace_new_len);
newlen = (grub_uint32_t)(g_conf_replace_new_len[i]);
dirent = (ventoy_iso9660_override *)cur->override_data;
dirent->first_sector = (grub_uint32_t)sector;
dirent->size = newlen;
dirent->first_sector_be = grub_swap_bytes32(dirent->first_sector);
dirent->size_be = grub_swap_bytes32(dirent->size);
dirent = (ventoy_iso9660_override *)cur->override_data;
dirent->first_sector = (grub_uint32_t)sector;
dirent->size = newlen;
dirent->first_sector_be = grub_swap_bytes32(dirent->first_sector);
dirent->size_be = grub_swap_bytes32(dirent->size);
sector += (dirent->size + 2047) / 2048;
cur++;
sector += (dirent->size + 2047) / 2048;
cur++;
}
}
}
if (g_svd_replace_offset > 0)
{
cur->img_offset = g_svd_replace_offset;
@@ -976,6 +1099,7 @@ static grub_err_t ventoy_linux_locate_initrd(int filt, int *filtcnt)
if (filtbysize
&& (NULL == grub_strstr(node->name, "minirt.gz"))
&& (NULL == grub_strstr(node->name, "initrd.xz"))
&& (NULL == grub_strstr(node->name, "initrd.gz"))
)
{
if (filt > 0 && file->size <= g_ventoy_cpio_size + 2048)
@@ -1211,6 +1335,7 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
grub_file_t file;
grub_file_t archfile;
grub_file_t tmpfile;
install_template *template_node = NULL;
ventoy_img_chunk_list chunk_list;
(void)ctxt;
@@ -1257,26 +1382,17 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
persistent_buf = (char *)(chunk_list.chunk);
}
template_file = ventoy_plugin_get_cur_install_template(args[1]);
template_file = ventoy_plugin_get_cur_install_template(args[1], &template_node);
if (template_file)
{
debug("auto install template: <%s>\n", template_file);
tmpfile = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", args[2], template_file);
if (tmpfile)
debug("auto install template: <%s> <addr:%p> <len:%d>\n",
template_file, template_node->filebuf, template_node->filelen);
template_size = template_node->filelen;
template_buf = grub_malloc(template_size);
if (template_buf)
{
debug("auto install script size %d\n", (int)tmpfile->size);
template_size = tmpfile->size;
template_buf = grub_malloc(template_size);
if (template_buf)
{
grub_file_read(tmpfile, template_buf, template_size);
}
grub_file_close(tmpfile);
}
else
{
debug("Failed to open install script %s%s\n", args[2], template_file);
grub_memcpy(template_buf, template_node->filebuf, template_size);
}
}
else
@@ -1363,15 +1479,14 @@ grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **arg
{
headlen = ventoy_cpio_newc_fill_head(buf, template_size, template_buf, "ventoy/autoinstall");
buf += headlen + ventoy_align(template_size, 4);
grub_check_free(template_buf);
}
if (persistent_size > 0 && persistent_buf)
{
headlen = ventoy_cpio_newc_fill_head(buf, persistent_size, persistent_buf, "ventoy/ventoy_persistent_map");
buf += headlen + ventoy_align(persistent_size, 4);
grub_free(persistent_buf);
persistent_buf = NULL;
grub_check_free(persistent_buf);
}
if (injection_size > 0 && injection_buf)
@@ -1446,7 +1561,6 @@ grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **
grub_uint8_t *bufend;
cpio_newc_header *head;
grub_file_t file;
char value[64];
const grub_uint8_t trailler[124] = {
0x30, 0x37, 0x30, 0x37, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
@@ -1517,11 +1631,8 @@ grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **
name = (char *)(head + 1);
}
}
grub_snprintf(value, sizeof(value), "0x%llx", (ulonglong)(ulong)g_ventoy_cpio_buf);
ventoy_set_env("ventoy_cpio_addr", value);
grub_snprintf(value, sizeof(value), "%d", bufsize);
ventoy_set_env("ventoy_cpio_size", value);
ventoy_memfile_env_set("ventoy_cpio", g_ventoy_cpio_buf, (ulonglong)bufsize);
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
@@ -1543,7 +1654,6 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
const char *pLastChain = NULL;
const char *compatible;
ventoy_chain_head *chain;
char envbuf[64];
(void)ctxt;
(void)argc;
@@ -1623,18 +1733,15 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
}
}
chain = grub_malloc(size);
chain = ventoy_alloc_chain(size);
if (!chain)
{
grub_printf("Failed to alloc chain memory size %u\n", size);
grub_printf("Failed to alloc chain linux memory size %u\n", size);
grub_file_close(file);
return 1;
}
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
grub_env_set("vtoy_chain_mem_addr", envbuf);
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
grub_env_set("vtoy_chain_mem_size", envbuf);
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
grub_memset(chain, 0, sizeof(ventoy_chain_head));
@@ -1685,3 +1792,300 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
static char *ventoy_systemd_conf_tag(char *buf, const char *tag, int optional)
{
int taglen = 0;
char *start = NULL;
char *nextline = NULL;
taglen = grub_strlen(tag);
for (start = buf; start; start = nextline)
{
nextline = ventoy_get_line(start);
VTOY_SKIP_SPACE(start);
if (grub_strncmp(start, tag, taglen) == 0 && (start[taglen] == ' ' || start[taglen] == '\t'))
{
start += taglen;
VTOY_SKIP_SPACE(start);
return start;
}
}
if (optional == 0)
{
debug("tag<%s> NOT found\n", tag);
}
return NULL;
}
static int ventoy_systemd_conf_hook(const char *filename, const struct grub_dirhook_info *info, void *data)
{
int oldpos = 0;
char *tag = NULL;
char *bkbuf = NULL;
char *filebuf = NULL;
grub_file_t file = NULL;
systemd_menu_ctx *ctx = (systemd_menu_ctx *)data;
debug("ventoy_systemd_conf_hook %s\n", filename);
if (info->dir || NULL == grub_strstr(filename, ".conf"))
{
return 0;
}
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s/loader/entries/%s", ctx->dev, filename);
if (!file)
{
return 0;
}
filebuf = grub_zalloc(2 * file->size + 8);
if (!filebuf)
{
goto out;
}
bkbuf = filebuf + file->size + 4;
grub_file_read(file, bkbuf, file->size);
oldpos = ctx->pos;
/* title --> menuentry */
grub_memcpy(filebuf, bkbuf, file->size);
tag = ventoy_systemd_conf_tag(filebuf, "title", 0);
vtoy_check_goto_out(tag);
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, "menuentry \"%s\" {\n", tag);
/* linux xxx */
grub_memcpy(filebuf, bkbuf, file->size);
tag = ventoy_systemd_conf_tag(filebuf, "linux", 0);
if (!tag)
{
ctx->pos = oldpos;
goto out;
}
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, " echo \"Downloading kernel ...\"\n linux %s ", tag);
/* kernel options */
grub_memcpy(filebuf, bkbuf, file->size);
tag = ventoy_systemd_conf_tag(filebuf, "options", 0);
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, "%s \n", tag ? tag : "");
/* initrd xxx xxx xxx */
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, " echo \"Downloading initrd ...\"\n initrd ");
grub_memcpy(filebuf, bkbuf, file->size);
tag = ventoy_systemd_conf_tag(filebuf, "initrd", 1);
while (tag)
{
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, "%s ", tag);
tag = ventoy_systemd_conf_tag(tag + grub_strlen(tag) + 1, "initrd", 1);
}
vtoy_len_ssprintf(ctx->buf, ctx->pos, ctx->len, "\n boot\n}\n");
out:
grub_check_free(filebuf);
grub_file_close(file);
return 0;
}
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args)
{
static char *buf = NULL;
grub_fs_t fs;
char *device_name = NULL;
grub_device_t dev = NULL;
systemd_menu_ctx ctx;
(void)ctxt;
(void)argc;
if (!buf)
{
buf = grub_malloc(VTOY_LINUX_SYSTEMD_MENU_MAX_BUF);
if (!buf)
{
goto end;
}
}
device_name = grub_file_get_device_name(args[0]);
if (!device_name)
{
debug("failed to get device name %s\n", args[0]);
goto end;
}
dev = grub_device_open(device_name);
if (!dev)
{
debug("failed to open device %s\n", device_name);
goto end;
}
fs = grub_fs_probe(dev);
if (!fs)
{
debug("failed to probe fs %d\n", grub_errno);
goto end;
}
ctx.dev = args[0];
ctx.buf = buf;
ctx.pos = 0;
ctx.len = VTOY_LINUX_SYSTEMD_MENU_MAX_BUF;
fs->fs_dir(dev, "/loader/entries", ventoy_systemd_conf_hook, &ctx);
ventoy_memfile_env_set(args[1], buf, (ulonglong)(ctx.pos));
end:
grub_check_free(device_name);
check_free(dev, grub_device_close);
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
static int ventoy_limine_path_convert(char *path)
{
char newpath[256] = {0};
if (grub_strncmp(path, "boot://2/", 9) == 0)
{
grub_snprintf(newpath, sizeof(newpath), "(vtimghd,2)/%s", path + 9);
}
else if (grub_strncmp(path, "boot://1/", 9) == 0)
{
grub_snprintf(newpath, sizeof(newpath), "(vtimghd,1)/%s", path + 9);
}
if (newpath[0])
{
grub_snprintf(path, 1024, "%s", newpath);
}
return 0;
}
grub_err_t ventoy_cmd_linux_limine_menu(grub_extcmd_context_t ctxt, int argc, char **args)
{
int pos = 0;
int sub = 0;
int len = VTOY_LINUX_SYSTEMD_MENU_MAX_BUF;
char *filebuf = NULL;
char *start = NULL;
char *nextline = NULL;
grub_file_t file = NULL;
char *title = NULL;
char *kernel = NULL;
char *initrd = NULL;
char *param = NULL;
static char *buf = NULL;
(void)ctxt;
(void)argc;
if (!buf)
{
buf = grub_malloc(len + 4 * 1024);
if (!buf)
{
goto end;
}
}
title = buf + len;
kernel = title + 1024;
initrd = kernel + 1024;
param = initrd + 1024;
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, args[0]);
if (!file)
{
return 0;
}
filebuf = grub_zalloc(file->size + 8);
if (!filebuf)
{
goto end;
}
grub_file_read(file, filebuf, file->size);
grub_file_close(file);
title[0] = kernel[0] = initrd[0] = param[0] = 0;
for (start = filebuf; start; start = nextline)
{
nextline = ventoy_get_line(start);
VTOY_SKIP_SPACE(start);
if (start[0] == ':')
{
if (start[1] == ':')
{
grub_snprintf(title, 1024, "%s", start + 2);
}
else
{
if (sub)
{
vtoy_len_ssprintf(buf, pos, len, "}\n");
sub = 0;
}
if (nextline && nextline[0] == ':' && nextline[1] == ':')
{
vtoy_len_ssprintf(buf, pos, len, "submenu \"[+] %s\" {\n", start + 2);
sub = 1;
title[0] = 0;
}
else
{
grub_snprintf(title, 1024, "%s", start + 1);
}
}
}
else if (grub_strncmp(start, "KERNEL_PATH=", 12) == 0)
{
grub_snprintf(kernel, 1024, "%s", start + 12);
}
else if (grub_strncmp(start, "MODULE_PATH=", 12) == 0)
{
grub_snprintf(initrd, 1024, "%s", start + 12);
}
else if (grub_strncmp(start, "KERNEL_CMDLINE=", 15) == 0)
{
grub_snprintf(param, 1024, "%s", start + 15);
}
if (title[0] && kernel[0] && initrd[0] && param[0])
{
ventoy_limine_path_convert(kernel);
ventoy_limine_path_convert(initrd);
vtoy_len_ssprintf(buf, pos, len, "menuentry \"%s\" {\n", title);
vtoy_len_ssprintf(buf, pos, len, " echo \"Downloading kernel ...\"\n linux %s %s\n", kernel, param);
vtoy_len_ssprintf(buf, pos, len, " echo \"Downloading initrd ...\"\n initrd %s\n", initrd);
vtoy_len_ssprintf(buf, pos, len, "}\n");
title[0] = kernel[0] = initrd[0] = param[0] = 0;
}
}
if (sub)
{
vtoy_len_ssprintf(buf, pos, len, "}\n");
sub = 0;
}
ventoy_memfile_env_set(args[1], buf, (ulonglong)pos);
end:
grub_check_free(filebuf);
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}

View File

@@ -35,6 +35,7 @@
#include <grub/crypto.h>
#include <grub/time.h>
#include <grub/font.h>
#include <grub/video.h>
#include <grub/ventoy.h>
#include "ventoy_def.h"
@@ -56,12 +57,16 @@ static injection_config *g_injection_head = NULL;
static auto_memdisk *g_auto_memdisk_head = NULL;
static image_list *g_image_list_head = NULL;
static conf_replace *g_conf_replace_head = NULL;
static VTOY_JSON *g_menu_lang_json = NULL;
static int g_theme_id = 0;
static int g_theme_res_fit = 0;
static int g_theme_num = 0;
static theme_list *g_theme_head = NULL;
static int g_theme_random = vtoy_theme_random_boot_second;
static char g_theme_single_file[256];
static char g_cur_menu_language[32] = {0};
static char g_push_menu_language[32] = {0};
static int ventoy_plugin_is_parent(const char *pat, int patlen, const char *isopath)
{
@@ -375,6 +380,18 @@ static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk)
if (g_theme_num > 0)
{
vtoy_json_get_int(json->pstChild, "default_file", &g_theme_id);
if (g_theme_id == 0)
{
vtoy_json_get_int(json->pstChild, "resolution_fit", &g_theme_res_fit);
if (g_theme_res_fit != 1)
{
g_theme_res_fit = 0;
}
grub_snprintf(val, sizeof(val), "%d", g_theme_res_fit);
ventoy_env_export("vtoy_res_fit", val);
}
if (g_theme_id > g_theme_num || g_theme_id < 0)
{
g_theme_id = 0;
@@ -405,19 +422,19 @@ static int ventoy_plugin_theme_entry(VTOY_JSON *json, const char *isodisk)
value = vtoy_json_get_string_ex(json->pstChild, "ventoy_left");
if (value)
{
ventoy_env_export("VTLE_LFT", value);
ventoy_env_export(ventoy_left_key, value);
}
value = vtoy_json_get_string_ex(json->pstChild, "ventoy_top");
if (value)
{
ventoy_env_export("VTLE_TOP", value);
ventoy_env_export(ventoy_top_key, value);
}
value = vtoy_json_get_string_ex(json->pstChild, "ventoy_color");
if (value)
{
ventoy_env_export("VTLE_CLR", value);
ventoy_env_export(ventoy_color_key, value);
}
node = vtoy_json_find_item(json->pstChild, JSON_TYPE_ARRAY, "fonts");
@@ -2641,10 +2658,15 @@ install_template * ventoy_plugin_find_install_template(const char *isopath)
return NULL;
}
char * ventoy_plugin_get_cur_install_template(const char *isopath)
char * ventoy_plugin_get_cur_install_template(const char *isopath, install_template **cur)
{
install_template *node = NULL;
if (cur)
{
*cur = NULL;
}
node = ventoy_plugin_find_install_template(isopath);
if ((!node) || (!node->templatepath))
{
@@ -2656,6 +2678,11 @@ char * ventoy_plugin_get_cur_install_template(const char *isopath)
return NULL;
}
if (cur)
{
*cur = node;
}
return node->templatepath[node->cursel].path;
}
@@ -3044,14 +3071,15 @@ int ventoy_plugin_get_image_list_index(int type, const char *name)
return 0;
}
conf_replace * ventoy_plugin_find_conf_replace(const char *iso)
int ventoy_plugin_find_conf_replace(const char *iso, conf_replace *nodes[VTOY_MAX_CONF_REPLACE])
{
int n = 0;
int len;
conf_replace *node;
if (!g_conf_replace_head)
{
return NULL;
return 0;
}
len = (int)grub_strlen(iso);
@@ -3060,11 +3088,15 @@ conf_replace * ventoy_plugin_find_conf_replace(const char *iso)
{
if (node->pathlen == len && ventoy_strncmp(node->isopath, iso, len) == 0)
{
return node;
nodes[n++] = node;
if (n >= VTOY_MAX_CONF_REPLACE)
{
return n;
}
}
}
return NULL;
return n;
}
dud * ventoy_plugin_find_dud(const char *iso)
@@ -3354,7 +3386,7 @@ grub_err_t ventoy_cmd_select_theme_cfg(grub_extcmd_context_t ctxt, int argc, cha
}
pos += grub_snprintf(buf + pos, bufsize - pos,
"menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {\n"
"menuentry \"$VTLANG_RETURN_PREVIOUS\" --class=vtoyret VTOY_RET {\n"
"echo 'Return ...'\n"
"}\n");
@@ -3364,13 +3396,19 @@ grub_err_t ventoy_cmd_select_theme_cfg(grub_extcmd_context_t ctxt, int argc, cha
return 0;
}
extern char g_ventoy_theme_path[256];
grub_err_t ventoy_cmd_set_theme(grub_extcmd_context_t ctxt, int argc, char **args)
{
grub_uint32_t i = 0;
grub_uint32_t mod = 0;
grub_uint32_t theme_num = 0;
theme_list *node = g_theme_head;
struct grub_datetime datetime;
struct grub_video_mode_info info;
char buf[64];
char **pThemePath = NULL;
(void)argc;
(void)args;
(void)ctxt;
@@ -3400,41 +3438,82 @@ grub_err_t ventoy_cmd_set_theme(grub_extcmd_context_t ctxt, int argc, char **arg
goto end;
}
grub_memset(&datetime, 0, sizeof(datetime));
grub_get_datetime(&datetime);
if (g_theme_random == vtoy_theme_random_boot_second)
pThemePath = (char **)grub_zalloc(sizeof(char *) * g_theme_num);
if (!pThemePath)
{
grub_divmod32((grub_uint32_t)datetime.second, (grub_uint32_t)g_theme_num, &mod);
}
else if (g_theme_random == vtoy_theme_random_boot_day)
{
grub_divmod32((grub_uint32_t)datetime.day, (grub_uint32_t)g_theme_num, &mod);
}
else if (g_theme_random == vtoy_theme_random_boot_month)
{
grub_divmod32((grub_uint32_t)datetime.month, (grub_uint32_t)g_theme_num, &mod);
goto end;
}
debug("%04d/%02d/%02d %02d:%02d:%02d radom:%d mod:%d\n",
datetime.year, datetime.month, datetime.day,
datetime.hour, datetime.minute, datetime.second,
g_theme_random, mod);
for (i = 0; i < mod && node; i++)
if (g_theme_res_fit)
{
node = node->next;
if (grub_video_get_info(&info) == GRUB_ERR_NONE)
{
debug("get video info success %ux%u\n", info.width, info.height);
grub_snprintf(buf, sizeof(buf), "%ux%u", info.width, info.height);
for (node = g_theme_head; node; node = node->next)
{
if (grub_strstr(node->theme.path, buf))
{
pThemePath[theme_num++] = node->theme.path;
}
}
}
}
debug("random theme %s\n", node->theme.path);
grub_env_set("theme", node->theme.path);
if (theme_num == 0)
{
for (node = g_theme_head; node; node = node->next)
{
pThemePath[theme_num++] = node->theme.path;
}
}
if (theme_num == 1)
{
mod = 0;
debug("Only 1 theme match, no need to random.\n");
}
else
{
grub_memset(&datetime, 0, sizeof(datetime));
grub_get_datetime(&datetime);
if (g_theme_random == vtoy_theme_random_boot_second)
{
grub_divmod32((grub_uint32_t)datetime.second, theme_num, &mod);
}
else if (g_theme_random == vtoy_theme_random_boot_day)
{
grub_divmod32((grub_uint32_t)datetime.day, theme_num, &mod);
}
else if (g_theme_random == vtoy_theme_random_boot_month)
{
grub_divmod32((grub_uint32_t)datetime.month, theme_num, &mod);
}
debug("%04d/%02d/%02d %02d:%02d:%02d theme_num:%d mod:%d\n",
datetime.year, datetime.month, datetime.day,
datetime.hour, datetime.minute, datetime.second,
theme_num, mod);
}
if (argc > 0 && grub_strcmp(args[0], "switch") == 0)
{
grub_snprintf(g_ventoy_theme_path, sizeof(g_ventoy_theme_path), "%s", pThemePath[mod]);
}
else
{
debug("random theme %s\n", pThemePath[mod]);
grub_env_set("theme", pThemePath[mod]);
}
g_ventoy_menu_refresh = 1;
end:
grub_check_free(pThemePath);
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
extern char g_ventoy_theme_path[256];
grub_err_t ventoy_cmd_set_theme_path(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)argc;
@@ -3452,3 +3531,127 @@ grub_err_t ventoy_cmd_set_theme_path(grub_extcmd_context_t ctxt, int argc, char
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
const char *ventoy_get_vmenu_title(const char *vMenu)
{
return vtoy_json_get_string_ex(g_menu_lang_json->pstChild, vMenu);
}
int ventoy_plugin_load_menu_lang(int init, const char *lang)
{
int ret = 1;
grub_file_t file = NULL;
char *buf = NULL;
if (grub_strcmp(lang, g_cur_menu_language) == 0)
{
debug("Same menu lang %s\n", lang);
return 0;
}
grub_snprintf(g_cur_menu_language, sizeof(g_cur_menu_language), "%s", lang);
debug("Load menu lang %s\n", g_cur_menu_language);
if (g_menu_lang_json)
{
vtoy_json_destroy(g_menu_lang_json);
g_menu_lang_json = NULL;
}
g_menu_lang_json = vtoy_json_create();
if (!g_menu_lang_json)
{
goto end;
}
file = ventoy_grub_file_open(GRUB_FILE_TYPE_LINUX_INITRD, "(vt_menu_tarfs)/menu/%s.json", lang);
if (!file)
{
goto end;
}
buf = grub_malloc(file->size + 1);
if (!buf)
{
grub_printf("Failed to malloc memory %lu.\n", (ulong)(file->size + 1));
goto end;
}
buf[file->size] = 0;
grub_file_read(file, buf, file->size);
vtoy_json_parse(g_menu_lang_json, buf);
if (g_default_menu_mode == 0)
{
grub_snprintf(g_ventoy_hotkey_tip, sizeof(g_ventoy_hotkey_tip), "%s", ventoy_get_vmenu_title("VTLANG_STR_HOTKEY_TREE"));
}
else
{
grub_snprintf(g_ventoy_hotkey_tip, sizeof(g_ventoy_hotkey_tip), "%s", ventoy_get_vmenu_title("VTLANG_STR_HOTKEY_LIST"));
}
if (init == 0)
{
ventoy_menu_push_key(GRUB_TERM_ESC);
ventoy_menu_push_key(GRUB_TERM_ESC);
g_ventoy_menu_refresh = 1;
}
ret = 0;
end:
check_free(file, grub_file_close);
grub_check_free(buf);
return ret;
}
grub_err_t ventoy_cmd_cur_menu_lang(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)ctxt;
(void)argc;
if (argc > 0)
{
grub_env_set(args[0], g_cur_menu_language);
}
else
{
grub_printf("%s\n", g_cur_menu_language);
grub_printf("%s\n", g_ventoy_hotkey_tip);
grub_refresh();
}
VENTOY_CMD_RETURN(0);
}
grub_err_t ventoy_cmd_push_menulang(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)argc;
(void)ctxt;
if (g_push_menu_language[0] == 0)
{
grub_memcpy(g_push_menu_language, g_cur_menu_language, sizeof(g_push_menu_language));
ventoy_plugin_load_menu_lang(0, args[0]);
}
VENTOY_CMD_RETURN(0);
}
grub_err_t ventoy_cmd_pop_menulang(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)argc;
(void)ctxt;
(void)args;
if (g_push_menu_language[0])
{
ventoy_plugin_load_menu_lang(0, g_push_menu_language);
g_push_menu_language[0] = 0;
}
VENTOY_CMD_RETURN(0);
}

View File

@@ -445,12 +445,16 @@ grub_err_t ventoy_cmd_parse_freenas_ver(grub_extcmd_context_t ctxt, int argc, ch
ver = vtoy_json_get_string_ex(json->pstChild, "Version");
if (ver)
{
debug("freenas version:<%s>\n", ver);
debug("NAS version:<%s>\n", ver);
if (grub_strncmp(ver, "TrueNAS-", 8) == 0)
{
ver += 8;
}
ventoy_set_env(args[1], ver);
}
else
{
debug("freenas version:<%s>\n", "NOT FOUND");
debug("NAS version:<%s>\n", "NOT FOUND");
grub_env_unset(args[1]);
}
@@ -1114,7 +1118,6 @@ grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char
const char *pLastChain = NULL;
const char *compatible;
ventoy_chain_head *chain;
char envbuf[64];
(void)ctxt;
(void)argc;
@@ -1185,18 +1188,15 @@ grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char
}
}
chain = grub_malloc(size);
chain = ventoy_alloc_chain(size);
if (!chain)
{
grub_printf("Failed to alloc chain memory size %u\n", size);
grub_printf("Failed to alloc chain unix memory size %u\n", size);
grub_file_close(file);
return 1;
}
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
grub_env_set("vtoy_chain_mem_addr", envbuf);
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
grub_env_set("vtoy_chain_mem_size", envbuf);
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
grub_memset(chain, 0, sizeof(ventoy_chain_head));

View File

@@ -148,9 +148,10 @@ static int ventoy_vhd_patch_path(char *vhdpath, ventoy_patch_vhd *patch1, ventoy
return 0;
}
static int ventoy_vhd_read_parttbl(const char *filename, ventoy_gpt_info *gpt, int *index)
static int ventoy_vhd_read_parttbl(const char *filename, ventoy_gpt_info *gpt, int *index, grub_uint64_t *poffset)
{
int i;
int find = 0;
int ret = 1;
grub_uint64_t start;
grub_file_t file = NULL;
@@ -183,6 +184,7 @@ static int ventoy_vhd_read_parttbl(const char *filename, ventoy_gpt_info *gpt, i
if (start == gpt->PartTbl[i].StartLBA)
{
*index = i;
find = 1;
break;
}
}
@@ -196,11 +198,22 @@ static int ventoy_vhd_read_parttbl(const char *filename, ventoy_gpt_info *gpt, i
if ((grub_uint32_t)start == gpt->MBR.PartTbl[i].StartSectorId)
{
*index = i;
find = 1;
break;
}
}
}
if (find == 0) // MBR Logical partition
{
if (file->device->disk->partition->number > 0)
{
*index = file->device->disk->partition->number;
debug("Fall back part number: %d\n", *index);
}
}
*poffset = start;
ret = 0;
end:
@@ -226,7 +239,7 @@ static int ventoy_vhd_patch_disk(const char *vhdpath, ventoy_patch_vhd *patch1,
else
{
gpt = grub_zalloc(sizeof(ventoy_gpt_info));
ventoy_vhd_read_parttbl(vhdpath, gpt, &partIndex);
ventoy_vhd_read_parttbl(vhdpath, gpt, &partIndex, &offset);
debug("This is HDD partIndex %d %s\n", partIndex, vhdpath);
}
@@ -249,9 +262,11 @@ static int ventoy_vhd_patch_disk(const char *vhdpath, ventoy_patch_vhd *patch1,
}
else
{
offset = gpt->MBR.PartTbl[partIndex].StartSectorId;
if (offset == 0)
{
offset = gpt->MBR.PartTbl[partIndex].StartSectorId;
}
offset *= 512;
debug("MBR disk signature: %02x%02x%02x%02x Part(%d) offset:%llu\n",
gpt->MBR.BootCode[0x1b8 + 0], gpt->MBR.BootCode[0x1b8 + 1],
gpt->MBR.BootCode[0x1b8 + 2], gpt->MBR.BootCode[0x1b8 + 3],
@@ -305,7 +320,6 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
int patchoffset[2];
ventoy_patch_vhd *patch1;
ventoy_patch_vhd *patch2;
char envbuf[64];
(void)ctxt;
(void)argc;
@@ -356,15 +370,9 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
/* set buffer and size */
#ifdef GRUB_MACHINE_EFI
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (ulong)g_vhdboot_totbuf);
grub_env_set("vtoy_vhd_buf_addr", envbuf);
grub_snprintf(envbuf, sizeof(envbuf), "%d", (int)(g_vhdboot_isolen + sizeof(ventoy_chain_head)));
grub_env_set("vtoy_vhd_buf_size", envbuf);
ventoy_memfile_env_set("vtoy_vhd_buf", g_vhdboot_totbuf, (ulonglong)(g_vhdboot_isolen + sizeof(ventoy_chain_head)));
#else
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (ulong)g_vhdboot_isobuf);
grub_env_set("vtoy_vhd_buf_addr", envbuf);
grub_snprintf(envbuf, sizeof(envbuf), "%d", g_vhdboot_isolen);
grub_env_set("vtoy_vhd_buf_size", envbuf);
ventoy_memfile_env_set("vtoy_vhd_buf", g_vhdboot_isobuf, (ulonglong)g_vhdboot_isolen);
#endif
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
@@ -496,7 +504,7 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
vhd_footer_t vhdfoot;
VDIPREHEADER vdihdr;
char type[16] = {0};
ventoy_gpt_info *gpt;
ventoy_gpt_info *gpt = NULL;
(void)ctxt;
@@ -528,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
{
@@ -560,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;
}
@@ -645,7 +666,6 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
grub_disk_t disk;
const char *pLastChain = NULL;
ventoy_chain_head *chain;
char envbuf[64];
(void)ctxt;
(void)argc;
@@ -687,18 +707,15 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
}
}
chain = grub_malloc(size);
chain = ventoy_alloc_chain(size);
if (!chain)
{
grub_printf("Failed to alloc chain memory size %u\n", size);
grub_printf("Failed to alloc chain raw memory size %u\n", size);
grub_file_close(file);
return 1;
}
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
grub_env_set("vtoy_chain_mem_addr", envbuf);
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
grub_env_set("vtoy_chain_mem_size", envbuf);
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
grub_env_export("vtoy_chain_mem_addr");
grub_env_export("vtoy_chain_mem_size");

View File

@@ -1015,7 +1015,7 @@ static int ventoy_update_all_hash(wim_patch *patch, void *meta_data, wim_directo
return 0;
}
static int ventoy_cat_exe_file_data(wim_tail *wim_data, grub_uint32_t exe_len, grub_uint8_t *exe_data)
static int ventoy_cat_exe_file_data(wim_tail *wim_data, grub_uint32_t exe_len, grub_uint8_t *exe_data, int windatalen)
{
int pe64 = 0;
char file[256];
@@ -1030,14 +1030,14 @@ static int ventoy_cat_exe_file_data(wim_tail *wim_data, grub_uint32_t exe_len, g
jump_align = ventoy_align(jump_len, 16);
wim_data->jump_exe_len = jump_len;
wim_data->bin_raw_len = jump_align + sizeof(ventoy_os_param) + sizeof(ventoy_windows_data) + exe_len;
wim_data->bin_raw_len = jump_align + sizeof(ventoy_os_param) + windatalen + exe_len;
wim_data->bin_align_len = ventoy_align(wim_data->bin_raw_len, 2048);
wim_data->jump_bin_data = grub_malloc(wim_data->bin_align_len);
if (wim_data->jump_bin_data)
{
grub_memcpy(wim_data->jump_bin_data, jump_data, jump_len);
grub_memcpy(wim_data->jump_bin_data + jump_align + sizeof(ventoy_os_param) + sizeof(ventoy_windows_data), exe_data, exe_len);
grub_memcpy(wim_data->jump_bin_data + jump_align + sizeof(ventoy_os_param) + windatalen, exe_data, exe_len);
}
debug("jump_exe_len:%u bin_raw_len:%u bin_align_len:%u\n",
@@ -1046,26 +1046,74 @@ static int ventoy_cat_exe_file_data(wim_tail *wim_data, grub_uint32_t exe_len, g
return 0;
}
int ventoy_fill_windows_rtdata(void *buf, char *isopath)
static int ventoy_get_windows_rtdata_len(const char *iso, int *flag)
{
int size = 0;
int template_file_len = 0;
char *pos = NULL;
char *script = NULL;
install_template *template_node = NULL;
*flag = 0;
size = (int)sizeof(ventoy_windows_data);
pos = grub_strstr(iso, "/");
if (!pos)
{
return size;
}
script = ventoy_plugin_get_cur_install_template(pos, &template_node);
if (script)
{
(*flag) |= WINDATA_FLAG_TEMPLATE;
template_file_len = template_node->filelen;
}
return size + template_file_len;
}
static int ventoy_fill_windows_rtdata(void *buf, char *isopath, int dataflag)
{
int template_len = 0;
char *pos = NULL;
char *end = NULL;
char *script = NULL;
const char *env = NULL;
install_template *template_node = NULL;
ventoy_windows_data *data = (ventoy_windows_data *)buf;
grub_memset(data, 0, sizeof(ventoy_windows_data));
env = grub_env_get("VTOY_WIN11_BYPASS_CHECK");
if (env && env[0] == '1' && env[1] == 0)
{
data->windows11_bypass_check = 1;
}
env = grub_env_get("VTOY_WIN11_BYPASS_NRO");
if (env && env[0] == '1' && env[1] == 0)
{
data->windows11_bypass_nro = 1;
}
pos = grub_strstr(isopath, "/");
if (!pos)
{
return 1;
}
script = ventoy_plugin_get_cur_install_template(pos);
if (script)
if (dataflag & WINDATA_FLAG_TEMPLATE)
{
debug("auto install script <%s>\n", script);
grub_snprintf(data->auto_install_script, sizeof(data->auto_install_script) - 1, "%s", script);
script = ventoy_plugin_get_cur_install_template(pos, &template_node);
if (script)
{
data->auto_install_len = template_len = template_node->filelen;
debug("auto install script OK <%s> <len:%d>\n", script, template_len);
end = ventoy_str_last(script, '/');
grub_snprintf(data->auto_install_script, sizeof(data->auto_install_script) - 1, "%s", end ? end + 1 : script);
grub_memcpy(data + 1, template_node->filebuf, template_len);
}
}
else
{
@@ -1090,12 +1138,6 @@ int ventoy_fill_windows_rtdata(void *buf, char *isopath)
debug("injection archive not configed %s\n", pos);
}
env = grub_env_get("VTOY_WIN11_BYPASS_CHECK");
if (env && env[0] == '1' && env[1] == 0)
{
data->windows11_bypass_check = 1;
}
return 0;
}
@@ -1125,7 +1167,7 @@ static int ventoy_update_before_chain(ventoy_os_param *param, char *isopath)
if (wim_data->jump_bin_data)
{
grub_memcpy(wim_data->jump_bin_data + jump_align, param, sizeof(ventoy_os_param));
ventoy_fill_windows_rtdata(wim_data->jump_bin_data + jump_align + sizeof(ventoy_os_param), isopath);
ventoy_fill_windows_rtdata(wim_data->jump_bin_data + jump_align + sizeof(ventoy_os_param), isopath, wim_data->windata_flag);
}
grub_crypto_hash(GRUB_MD_SHA1, wim_data->bin_hash.sha1, wim_data->jump_bin_data, wim_data->bin_raw_len);
@@ -1168,7 +1210,7 @@ static int ventoy_update_before_chain(ventoy_os_param *param, char *isopath)
return 0;
}
static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch, int windatalen)
{
int rc;
grub_uint16_t i;
@@ -1285,7 +1327,7 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
if (0 == ventoy_read_resource(file, head, &(patch->replace_look->resource), (void **)&(exe_data)))
{
ventoy_cat_exe_file_data(wim_data, exe_len, exe_data);
ventoy_cat_exe_file_data(wim_data, exe_len, exe_data, windatalen);
grub_free(exe_data);
}
else
@@ -1328,17 +1370,128 @@ static int ventoy_wimdows_locate_wim(const char *disk, wim_patch *patch)
return 0;
}
grub_err_t ventoy_cmd_sel_winpe_wim(grub_extcmd_context_t ctxt, int argc, char **args)
{
int i = 0;
int pos = 0;
int len = 0;
int find = 0;
char *cmd = NULL;
wim_patch *node = NULL;
wim_patch *tmp = NULL;
grub_file_t file = NULL;
wim_header *head = NULL;
char cfgfile[128];
(void)ctxt;
(void)argc;
len = 8 * VTOY_SIZE_1KB;
cmd = (char *)grub_malloc(len + sizeof(wim_header));
if (!cmd)
{
return 1;
}
head = (wim_header *)(cmd + len);
grub_env_unset("vtoy_pe_wim_path");
for (node = g_wim_patch_head; node; node = node->next)
{
find = 0;
for (tmp = g_wim_patch_head; tmp != node; tmp = tmp->next)
{
if (tmp->valid && grub_strcasecmp(tmp->path, node->path) == 0)
{
find = 1;
break;
}
}
if (find)
{
continue;
}
g_ventoy_case_insensitive = 1;
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s%s", args[0], node->path);
g_ventoy_case_insensitive = 0;
if (!file)
{
debug("File %s%s NOT exist\n", args[0], node->path);
continue;
}
grub_file_read(file, head, sizeof(wim_header));
if (grub_memcmp(head->signature, WIM_HEAD_SIGNATURE, sizeof(head->signature)))
{
debug("Not a valid wim file %s\n", (char *)head->signature);
grub_file_close(file);
continue;
}
if (head->flags & FLAG_HEADER_COMPRESS_LZMS)
{
debug("LZMS compress is not supported 0x%x\n", head->flags);
grub_file_close(file);
continue;
}
grub_file_close(file);
node->valid = 1;
vtoy_len_ssprintf(cmd, pos, len, "menuentry \"%s\" --class=\"sel_wim\" {\n echo \"\"\n}\n", node->path);
}
if (pos > 0)
{
g_ventoy_menu_esc = 1;
g_ventoy_suppress_esc = 1;
g_ventoy_suppress_esc_default = 0;
g_ventoy_secondary_menu_on = 1;
grub_snprintf(cfgfile, sizeof(cfgfile), "configfile mem:0x%llx:size:%d", (ulonglong)(ulong)cmd, pos);
grub_script_execute_sourcecode(cfgfile);
g_ventoy_menu_esc = 0;
g_ventoy_suppress_esc = 0;
g_ventoy_suppress_esc_default = 1;
g_ventoy_secondary_menu_on = 0;
for (node = g_wim_patch_head; node; node = node->next)
{
if (node->valid)
{
if (i == g_ventoy_last_entry)
{
grub_env_set("vtoy_pe_wim_path", node->path);
break;
}
i++;
}
}
}
grub_free(cmd);
return 0;
}
grub_err_t ventoy_cmd_locate_wim_patch(grub_extcmd_context_t ctxt, int argc, char **args)
{
int datalen = 0;
int dataflag = 0;
wim_patch *node = g_wim_patch_head;
(void)ctxt;
(void)argc;
(void)args;
datalen = ventoy_get_windows_rtdata_len(args[1], &dataflag);
while (node)
{
if (0 == ventoy_wimdows_locate_wim(args[0], node))
node->wim_data.windata_flag = dataflag;
if (0 == ventoy_wimdows_locate_wim(args[0], node, datalen))
{
node->valid = 1;
g_wim_valid_patch_count++;
@@ -1651,24 +1804,39 @@ static void ventoy_windows_fill_virt_data( grub_uint64_t isosize, ventoy_chai
return;
}
static int ventoy_windows_drive_map(ventoy_chain_head *chain)
static int ventoy_windows_drive_map(ventoy_chain_head *chain, int vlnk)
{
int hd1 = 0;
grub_disk_t disk;
debug("drive map begin <%p> ...\n", chain);
debug("drive map begin <%p> <%d> ...\n", chain, vlnk);
if (chain->disk_drive == 0x80)
disk = grub_disk_open("hd1");
if (disk)
{
disk = grub_disk_open("hd1");
if (disk)
grub_disk_close(disk);
hd1 = 1;
debug("BIOS hd1 exist\n");
}
else
{
debug("failed to open disk %s\n", "hd1");
}
if (vlnk)
{
if (g_ventoy_disk_bios_id == 0x80 && hd1)
{
grub_disk_close(disk);
debug("drive map needed %p\n", disk);
debug("drive map needed vlnk %p\n", disk);
chain->drive_map = 0x81;
}
else
}
else if (chain->disk_drive == 0x80)
{
if (hd1)
{
debug("failed to open disk %s\n", "hd1");
debug("drive map needed normal %p\n", disk);
chain->drive_map = 0x81;
}
}
else
@@ -1734,17 +1902,150 @@ end:
return rc;
}
static int ventoy_extract_init_exe(char *wimfile, grub_uint8_t **pexe_data, grub_uint32_t *pexe_len, char *exe_name)
{
int rc;
int ret = 1;
grub_uint16_t i;
grub_file_t file = NULL;
grub_uint32_t exe_len = 0;
wim_header *head = NULL;
grub_uint16_t *uname = NULL;
grub_uint8_t *exe_data = NULL;
grub_uint8_t *decompress_data = NULL;
wim_lookup_entry *lookup = NULL;
wim_security_header *security = NULL;
wim_directory_entry *rootdir = NULL;
wim_directory_entry *search = NULL;
wim_stream_entry *stream = NULL;
wim_lookup_entry *replace_look = NULL;
wim_header wimhdr;
wim_hash hashdata;
head = &wimhdr;
file = grub_file_open(wimfile, VENTOY_FILE_TYPE);
if (!file)
{
goto out;
}
grub_file_read(file, head, sizeof(wim_header));
rc = ventoy_read_resource(file, head, &head->metadata, (void **)&decompress_data);
if (rc)
{
grub_printf("failed to read meta data %d\n", rc);
goto out;
}
security = (wim_security_header *)decompress_data;
if (security->len > 0)
{
rootdir = (wim_directory_entry *)(decompress_data + ((security->len + 7) & 0xFFFFFFF8U));
}
else
{
rootdir = (wim_directory_entry *)(decompress_data + 8);
}
debug("read lookup offset:%llu size:%llu\n", (ulonglong)head->lookup.offset, (ulonglong)head->lookup.raw_size);
lookup = grub_malloc(head->lookup.raw_size);
grub_file_seek(file, head->lookup.offset);
grub_file_read(file, lookup, head->lookup.raw_size);
/* search winpeshl.exe dirent entry */
search = search_replace_wim_dirent(file, head, lookup, decompress_data, rootdir);
if (!search)
{
debug("Failed to find replace file %p\n", search);
goto out;
}
uname = (grub_uint16_t *)(search + 1);
for (i = 0; i < search->name_len / 2 && i < 200; i++)
{
exe_name[i] = (char)uname[i];
}
exe_name[i] = 0;
debug("find replace file at %p <%s>\n", search, exe_name);
grub_memset(&hashdata, 0, sizeof(wim_hash));
if (grub_memcmp(&hashdata, search->hash.sha1, sizeof(wim_hash)) == 0)
{
debug("search hash all 0, now do deep search\n");
stream = (wim_stream_entry *)((char *)search + search->len);
for (i = 0; i < search->streams; i++)
{
if (stream->name_len == 0)
{
grub_memcpy(&hashdata, stream->hash.sha1, sizeof(wim_hash));
debug("new search hash: %02x %02x %02x %02x %02x %02x %02x %02x\n",
ventoy_varg_8(hashdata.sha1));
break;
}
stream = (wim_stream_entry *)((char *)stream + stream->len);
}
}
else
{
grub_memcpy(&hashdata, search->hash.sha1, sizeof(wim_hash));
}
/* find and extact winpeshl.exe */
replace_look = ventoy_find_look_entry(head, lookup, &hashdata);
if (replace_look)
{
exe_len = (grub_uint32_t)replace_look->resource.raw_size;
debug("find replace lookup entry_id:%ld raw_size:%u\n",
((long)replace_look - (long)lookup) / sizeof(wim_lookup_entry), exe_len);
if (0 != ventoy_read_resource(file, head, &(replace_look->resource), (void **)&(exe_data)))
{
exe_len = 0;
exe_data = NULL;
debug("failed to read replace file meta data %u\n", exe_len);
}
}
else
{
debug("failed to find lookup entry for replace file %02x %02x %02x %02x\n",
ventoy_varg_4(hashdata.sha1));
}
if (exe_data)
{
ret = 0;
*pexe_data = exe_data;
*pexe_len = exe_len;
}
out:
grub_check_free(lookup);
grub_check_free(decompress_data);
check_free(file, grub_file_close);
return ret;
}
grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc, char **args)
{
grub_uint32_t size = 0;
int rc = 0;
int wim64 = 0;
int datalen = 0;
int dataflag = 0;
grub_uint32_t exe_len = 0;
grub_uint32_t jump_align = 0;
const char *addr = NULL;
ventoy_chain_head *chain = NULL;
ventoy_os_param *param = NULL;
char envbuf[64];
grub_uint8_t *param = NULL;
grub_uint8_t *exe_data = NULL;
ventoy_windows_data *rtdata = NULL;
char exename[128] = {0};
wim_tail wim_data;
(void)ctxt;
(void)argc;
(void)args;
addr = grub_env_get("vtoy_chain_mem_addr");
if (!addr)
@@ -1761,24 +2062,32 @@ grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc,
return 1;
}
size = sizeof(ventoy_os_param) + sizeof(ventoy_windows_data);
param = (ventoy_os_param *)grub_zalloc(size);
if (!param)
datalen = ventoy_get_windows_rtdata_len(chain->os_param.vtoy_img_path, &dataflag);
rc = ventoy_extract_init_exe(args[0], &exe_data, &exe_len, exename);
if (rc)
{
return 1;
}
wim64 = ventoy_is_pe64(exe_data);
grub_memcpy(param, &chain->os_param, sizeof(ventoy_os_param));
ventoy_fill_windows_rtdata(param + 1, param->vtoy_img_path);
grub_memset(&wim_data, 0, sizeof(wim_data));
ventoy_cat_exe_file_data(&wim_data, exe_len, exe_data, datalen);
grub_check_free(exe_data);
jump_align = ventoy_align(wim_data.jump_exe_len, 16);
param = wim_data.jump_bin_data;
grub_memcpy(param + jump_align, &chain->os_param, sizeof(ventoy_os_param));
rtdata = (ventoy_windows_data *)(param + jump_align + sizeof(ventoy_os_param));
ventoy_fill_windows_rtdata(rtdata, chain->os_param.vtoy_img_path, dataflag);
ventoy_memfile_env_set("vtoy_wimboot_mem", param, (ulonglong)(wim_data.bin_align_len));
grub_env_set(args[1], exename);
grub_env_set(args[2], wim64 ? "64" : "32");
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)param);
grub_env_set("vtoy_wimboot_mem_addr", envbuf);
debug("vtoy_wimboot_mem_addr: %s\n", envbuf);
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
grub_env_set("vtoy_wimboot_mem_size", envbuf);
debug("vtoy_wimboot_mem_size: %s\n", envbuf);
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
}
@@ -1797,7 +2106,6 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
const char *pLastChain = NULL;
const char *compatible;
ventoy_chain_head *chain;
char envbuf[64];
(void)ctxt;
(void)argc;
@@ -1819,7 +2127,10 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
if (0 == ventoy_compatible && g_wim_valid_patch_count == 0)
{
unknown_image = 1;
debug("Warning: %s was not recognized by Ventoy\n", args[0]);
if (!g_ventoy_wimboot_mode)
{
debug("Warning: %s was not recognized by Ventoy\n", args[0]);
}
}
file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", args[0]);
@@ -1881,18 +2192,15 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
}
}
chain = grub_malloc(size);
chain = ventoy_alloc_chain(size);
if (!chain)
{
grub_printf("Failed to alloc chain memory size %u\n", size);
grub_printf("Failed to alloc chain win1 memory size %u\n", size);
grub_file_close(file);
return 1;
}
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
grub_env_set("vtoy_chain_mem_addr", envbuf);
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
grub_env_set("vtoy_chain_mem_size", envbuf);
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
grub_memset(chain, 0, sizeof(ventoy_chain_head));
@@ -1961,7 +2269,7 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
if (ventoy_is_efi_os() == 0)
{
ventoy_windows_drive_map(chain);
ventoy_windows_drive_map(chain, file->vlnk);
}
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
@@ -2011,6 +2319,67 @@ static int ventoy_get_wim_chunklist(grub_file_t wimfile, ventoy_img_chunk_list *
return 0;
}
grub_err_t ventoy_cmd_is_standard_winiso(grub_extcmd_context_t ctxt, int argc, char **args)
{
int i;
int ret = 1;
char prefix[32] = {0};
const char *chkfile[] =
{
"boot/bcd", "boot/boot.sdi", NULL
};
(void)ctxt;
(void)argc;
if (ventoy_check_file_exist("%s/sources/boot.wim", args[0]))
{
prefix[0] = 0;
}
else if (ventoy_check_file_exist("%s/x86/sources/boot.wim", args[0]))
{
grub_snprintf(prefix, sizeof(prefix), "/x86");
}
else if (ventoy_check_file_exist("%s/x64/sources/boot.wim", args[0]))
{
grub_snprintf(prefix, sizeof(prefix), "/x64");
}
else
{
debug("No boot.wim found.\n");
goto out;
}
for (i = 0; chkfile[i]; i++)
{
if (!ventoy_check_file_exist("%s%s/%s", args[0], prefix, chkfile[i]))
{
debug("%s not found.\n", chkfile[i]);
goto out;
}
}
if ((!ventoy_check_file_exist("%s%s/sources/install.wim", args[0], prefix)) &&
(!ventoy_check_file_exist("%s%s/sources/install.esd", args[0], prefix)))
{
debug("No install.wim(esd) found.\n");
goto out;
}
if (!ventoy_check_file_exist("%s/setup.exe", args[0]))
{
debug("No setup.exe found.\n");
goto out;
}
ret = 0;
debug("This is standard Windows ISO.\n");
out:
return ret;
}
grub_err_t ventoy_cmd_wim_check_bootable(grub_extcmd_context_t ctxt, int argc, char **args)
{
grub_uint32_t boot_index;
@@ -2065,7 +2434,6 @@ static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
ventoy_img_chunk *chunknode;
ventoy_override_chunk *override;
ventoy_img_chunk_list wimchunk;
char envbuf[128];
debug("vlnk wim chain data begin <%s> ...\n", wimfile->name);
@@ -2114,18 +2482,15 @@ static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
}
}
chain = grub_malloc(size);
chain = ventoy_alloc_chain(size);
if (!chain)
{
grub_printf("Failed to alloc chain memory size %u\n", size);
grub_printf("Failed to alloc chain win2 memory size %u\n", size);
grub_file_close(file);
return 1;
}
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
grub_env_set("vtoy_chain_mem_addr", envbuf);
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
grub_env_set("vtoy_chain_mem_size", envbuf);
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
grub_memset(chain, 0, sizeof(ventoy_chain_head));
@@ -2203,7 +2568,7 @@ static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
if (ventoy_is_efi_os() == 0)
{
ventoy_windows_drive_map(chain);
ventoy_windows_drive_map(chain, 0);
}
grub_file_close(file);
@@ -2230,7 +2595,6 @@ static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
ventoy_img_chunk *chunknode;
ventoy_override_chunk *override;
ventoy_img_chunk_list wimchunk;
char envbuf[128];
debug("normal wim chain data begin <%s> ...\n", wimfile->name);
@@ -2279,18 +2643,15 @@ static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
}
}
chain = grub_malloc(size);
chain = ventoy_alloc_chain(size);
if (!chain)
{
grub_printf("Failed to alloc chain memory size %u\n", size);
grub_printf("Failed to alloc chain win3 memory size %u\n", size);
grub_file_close(file);
return 1;
}
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
grub_env_set("vtoy_chain_mem_addr", envbuf);
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
grub_env_set("vtoy_chain_mem_size", envbuf);
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
grub_memset(chain, 0, sizeof(ventoy_chain_head));
@@ -2357,7 +2718,7 @@ static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
if (ventoy_is_efi_os() == 0)
{
ventoy_windows_drive_map(chain);
ventoy_windows_drive_map(chain, 0);
}
grub_file_close(file);

View File

@@ -88,7 +88,7 @@ EXPORT_FUNC (grub_efi_compare_device_paths) (const grub_efi_device_path_t *dp1,
void * EXPORT_FUNC (grub_efi_allocate_iso_buf) (grub_uint64_t size);
void * EXPORT_FUNC (grub_efi_allocate_chain_buf) (grub_uint64_t size);
void EXPORT_FUNC (grub_efi_get_reserved_page_num) (grub_uint64_t *total, grub_uint64_t *org_required, grub_uint64_t *new_required);
extern void (*EXPORT_VAR(grub_efi_net_config)) (grub_efi_handle_t hnd,
char **device,

View File

@@ -0,0 +1,73 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2006,2007,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_ENV_HEADER
#define GRUB_ENV_HEADER 1
#include <grub/symbol.h>
#include <grub/err.h>
#include <grub/types.h>
#include <grub/menu.h>
struct grub_env_var;
typedef const char *(*grub_env_read_hook_t) (struct grub_env_var *var,
const char *val);
typedef char *(*grub_env_write_hook_t) (struct grub_env_var *var,
const char *val);
struct grub_env_var
{
char *name;
char *value;
grub_env_read_hook_t read_hook;
grub_env_write_hook_t write_hook;
struct grub_env_var *next;
struct grub_env_var **prevp;
struct grub_env_var *sorted_next;
int global;
};
grub_err_t EXPORT_FUNC(grub_env_set) (const char *name, const char *val);
const char *EXPORT_FUNC(grub_env_get) (const char *name);
void EXPORT_FUNC(grub_env_unset) (const char *name);
struct grub_env_var *EXPORT_FUNC(grub_env_update_get_sorted) (void);
#define FOR_SORTED_ENV(var) for (var = grub_env_update_get_sorted (); var; var = var->sorted_next)
grub_err_t EXPORT_FUNC(grub_register_variable_hook) (const char *name,
grub_env_read_hook_t read_hook,
grub_env_write_hook_t write_hook);
grub_err_t EXPORT_FUNC(grub_register_vtoy_menu_lang_hook) (grub_env_read_hook_t read_hook);
grub_err_t grub_env_context_open (void);
grub_err_t grub_env_context_close (void);
grub_err_t EXPORT_FUNC(grub_env_export) (const char *name);
void grub_env_unset_menu (void);
grub_menu_t grub_env_get_menu (void);
void grub_env_set_menu (grub_menu_t nmenu);
grub_err_t
grub_env_extractor_open (int source);
grub_err_t
grub_env_extractor_close (int source);
#endif /* ! GRUB_ENV_HEADER */

View File

@@ -0,0 +1,69 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2019 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_SMBIOS_HEADER
#define GRUB_SMBIOS_HEADER 1
#include <grub/symbol.h>
#include <grub/types.h>
#define GRUB_SMBIOS_TYPE_END_OF_TABLE ((grub_uint8_t)127)
struct grub_smbios_ieps
{
grub_uint8_t anchor[5]; /* "_DMI_" */
grub_uint8_t checksum;
grub_uint16_t table_length;
grub_uint32_t table_address;
grub_uint16_t structures;
grub_uint8_t revision;
} GRUB_PACKED;
struct grub_smbios_eps
{
grub_uint8_t anchor[4]; /* "_SM_" */
grub_uint8_t checksum;
grub_uint8_t length; /* 0x1f */
grub_uint8_t version_major;
grub_uint8_t version_minor;
grub_uint16_t maximum_structure_size;
grub_uint8_t revision;
grub_uint8_t formatted[5];
struct grub_smbios_ieps intermediate;
} GRUB_PACKED;
struct grub_smbios_eps3
{
grub_uint8_t anchor[5]; /* "_SM3_" */
grub_uint8_t checksum;
grub_uint8_t length; /* 0x18 */
grub_uint8_t version_major;
grub_uint8_t version_minor;
grub_uint8_t docrev;
grub_uint8_t revision;
grub_uint8_t reserved;
grub_uint32_t maximum_table_length;
grub_uint64_t table_address;
} GRUB_PACKED;
extern struct grub_smbios_eps *grub_machine_smbios_get_eps (void);
extern struct grub_smbios_eps3 *grub_machine_smbios_get_eps3 (void);
extern struct grub_smbios_eps *EXPORT_FUNC (grub_smbios_get_eps) (void);
#endif /* ! GRUB_SMBIOS_HEADER */

View File

@@ -139,7 +139,15 @@ typedef struct ventoy_windows_data
char auto_install_script[384];
char injection_archive[384];
grub_uint8_t windows11_bypass_check;
grub_uint8_t reserved[255];
grub_uint32_t auto_install_len;
grub_uint8_t windows11_bypass_nro;
grub_uint8_t reserved[255 - 5];
/* auto_intall file buf */
/* ...... + auto_install_len */
}ventoy_windows_data;
@@ -256,6 +264,7 @@ typedef struct ventoy_img_chunk_list
#pragma pack(1)
#define VTOY_MAX_CONF_REPLACE 2
#define GRUB_FILE_REPLACE_MAGIC 0x1258BEEF
#define GRUB_IMG_REPLACE_MAGIC 0x1259BEEF
@@ -276,7 +285,7 @@ typedef struct ventoy_grub_param
grub_env_get_pf grub_env_get;
grub_env_set_pf grub_env_set;
ventoy_grub_param_file_replace file_replace;
ventoy_grub_param_file_replace img_replace;
ventoy_grub_param_file_replace img_replace[VTOY_MAX_CONF_REPLACE];
grub_env_printf_pf grub_env_printf;
}ventoy_grub_param;
@@ -297,6 +306,7 @@ grub_uint64_t grub_udf_get_last_file_attr_offset
grub_uint64_t *fe_entry_size_offset
);
int ventoy_is_efi_os(void);
void ventoy_memfile_env_set(const char *prefix, const void *buf, unsigned long long len);
#endif /* __VENTOY_H__ */

View File

@@ -9,17 +9,17 @@ mkdir -p $VT_DIR/GRUB2/PXE
make install
PATH=$PATH:$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/
PATH=$VT_DIR/GRUB2/INSTALL/bin/:$VT_DIR/GRUB2/INSTALL/sbin/:$PATH
net_modules_legacy="net tftp http"
all_modules_legacy="file setkey date drivemap blocklist regexp newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe video_fb font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal udf gfxmenu gfxterm gfxterm_background gfxterm_menu smbios"
all_modules_legacy="file date drivemap blocklist newc vga_text ntldr search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio lspci pci ext2 xfs ventoy chain read halt iso9660 linux16 test true sleep reboot echo videotest videoinfo videotest_checksum video_colors video_cirrus video_bochs vga vbe font video gettext extcmd terminal linux minicmd help configfile tr trig boot biosdisk disk ls tar squash4 password_pbkdf2 all_video png jpeg part_gpt part_msdos fat exfat ntfs loopback gzio normal video_fb udf gfxmenu gfxterm gfxterm_background gfxterm_menu smbios"
net_modules_uefi="efinet net tftp http"
all_modules_uefi="file setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu mouse fwload smbios"
all_modules_uefi="file setkey blocklist ventoy test true regexp newc search at_keyboard usb_keyboard gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux relocator jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop efi_uga video_bochs video_cirrus video video_fb gfxterm_background gfxterm_menu mouse fwload smbios zfs"
all_modules_arm64_uefi="file setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
all_modules_arm64_uefi="file setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu zfs"
all_modules_mips64el_uefi="file setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu"
all_modules_mips64el_uefi="file setkey blocklist ventoy test true regexp newc search gcry_md5 hashsum gzio xzio lzopio ext2 xfs read halt sleep serial terminfo png password_pbkdf2 gcry_sha512 pbkdf2 part_gpt part_msdos ls tar squash4 loopback part_apple minicmd diskfilter linux jpeg iso9660 udf hfsplus halt acpi mmap gfxmenu video_colors trig bitmap_scale gfxterm bitmap font fat exfat ntfs fshelp efifwsetup reboot echo configfile normal terminal gettext chain priority_queue bufio datetime cat extcmd crypto gzio boot all_video efi_gop video video_fb gfxterm_background gfxterm_menu zfs"
if [ "$1" = "uefi" ]; then

BIN
ICON/filechecksum.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

View File

@@ -0,0 +1,4 @@
for i in 1 2; do
if [ $i -eq 2 ]; then
/ventoy/busybox/sh /ventoy/hook/alpine/udev_disk_hook.sh
fi

View File

@@ -19,22 +19,17 @@
. /ventoy/hook/ventoy-hook-lib.sh
if [ "$SUBSYSTEM" != "block" ] || [ "$DEVTYPE" != "partition" ]; then
exit 0
fi
if [ -b /dev/${MDEV:0:-1} ]; then
vtlog "/dev/${MDEV:0:-1} exist"
else
$SLEEP 2
fi
if is_ventoy_hook_finished || not_ventoy_disk "${MDEV:0:-1}"; then
exit 0
fi
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
#
# longpanda:
# Alpine initramfs doesn't contain dm-mod or fuse module,
@@ -47,13 +42,17 @@ PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
# 3. unmount and delete the squashfs file
#
MDEV="${vtdiskname#/dev/}2"
vtoydm -i -f $VTOY_PATH/ventoy_image_map -d /dev/${MDEV:0:-1} > $VTOY_PATH/iso_file_list
vtLine=$(grep '[-][-] modloop-lts ' $VTOY_PATH/iso_file_list)
sector=$(echo $vtLine | awk '{print $(NF-1)}')
length=$(echo $vtLine | awk '{print $NF}')
echo -n "Mounting boot media, please wait ......"
vtoydm -e -f $VTOY_PATH/ventoy_image_map -d /dev/${MDEV:0:-1} -s $sector -l $length -o /vt_modloop
echo "done"
mkdir -p $VTOY_PATH/mnt
mount /vt_modloop $VTOY_PATH/mnt

View File

@@ -19,6 +19,17 @@
. $VTOY_PATH/hook/ventoy-os-lib.sh
echo "-[-a-z0-9]*2 root:root 0666 @$BUSYBOX_PATH/sh $VTOY_PATH/hook/alpine/udev_disk_hook.sh" >> /mdev.conf
$CAT /etc/mdev.conf >> /mdev.conf
$BUSYBOX_PATH/mv /mdev.conf /etc/mdev.conf
PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
LineBegin=$(grep -n "ebegin.*Mounting boot media" /init | awk -F: '{print $1}')
grep -n "^eend" /init > /t.list
while read line; do
LineEnd=$(echo $line | awk -F: '{print $1}')
if [ $LineEnd -gt $LineBegin ]; then
sed "${LineEnd}i\done" -i /init
sed "${LineBegin}r /ventoy/hook/alpine/insert.sh" -i /init
break
fi
done < /t.list
rm -f /t.list

View File

@@ -48,3 +48,6 @@ else
fi
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -49,3 +49,6 @@ else
fi
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -20,7 +20,7 @@
. $VTOY_PATH/hook/ventoy-os-lib.sh
$BUSYBOX_PATH/mkdir /dev
$BUSYBOX_PATH/mknod -m 660 /dev/console b 5 1
$BUSYBOX_PATH/mknod -m 660 /dev/console c 5 1
$SED "/for device in/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/aryalinux/disk_hook.sh" -i /init
#$SED "/for device in/i exec $BUSYBOX_PATH/sh" -i /init

View File

@@ -52,3 +52,6 @@ ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
# fi
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -36,3 +36,6 @@ ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -22,4 +22,4 @@
ventoy_set_inotify_script blackPanther/ventoy-inotifyd-hook.sh
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/blackPanther/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/00-ventoy-inotifyd-start.sh
$SED "s#printf\(.*\)\$CMDLINE#printf\1 root=/dev/dm-0 \$CMDLINE root=/dev/dm-0#" -i /lib/dracut-lib.sh
$SED "s#printf\(.*\)\$CMDLINE#printf\1 root=/dev/ventoy \$CMDLINE root=/dev/ventoy#" -i /lib/dracut-lib.sh

View File

@@ -33,10 +33,8 @@ if is_inotify_ventoy_part $3; then
$BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 noreplace
blkdev_num_dev=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
if ! [ -e /dev/dm-0 ]; then
mknod -m 660 /dev/dm-0 b $blkdev_num_dev
fi
blackPanther-root /dev/dm-0
mknod -m 660 /dev/ventoy b $blkdev_num_dev
blackPanther-root /dev/ventoy
set_ventoy_hook_finish
else

View File

@@ -0,0 +1,35 @@
#!/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
for i in 0 1 2 3 4 5 6 7 8 9; do
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
vtlog "wait for disk ..."
$SLEEP 3
else
break
fi
done
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
set_ventoy_hook_finish

View File

@@ -0,0 +1,22 @@
#!/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
$SED "/maybe_break *premount/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/chimera/disk_hook.sh" -i /init

View 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
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
NEWROOT=$(grep switch_root /init | awk '{print $3}')
for i in 'usr/bin' 'usr/sbin'; do
if [ -f $NEWROOT/$i/udevadm ]; then
UPATH=$i
break
fi
done
blkdev_num=$(dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
vtDM=$(ventoy_find_dm_id ${blkdev_num})
sed "s#UPATH=.*#UPATH=/$UPATH#" -i /ventoy/hook/clear/udevadm
sed "s#DM=.*#DM=$vtDM#" -i /ventoy/hook/clear/udevadm
mv $NEWROOT/$UPATH/udevadm $NEWROOT/$UPATH/udevadm_bk
cp -a /ventoy/hook/clear/udevadm $NEWROOT/$UPATH/udevadm
chmod 777 $NEWROOT/$UPATH/udevadm

View File

@@ -0,0 +1,12 @@
#!/bin/bash
UPATH=/usr/bin
DM=dm-0
rm -f $UPATH/udevadm
mv $UPATH/udevadm_bk $UPATH/udevadm
echo 1 > /tmp/vthidden
mount --bind /tmp/vthidden /sys/block/$DM/hidden
exec $UPATH/udevadm "$@"

View File

@@ -26,3 +26,6 @@ else
echo "find_installer" >> $VTLOG
$SED "/\$.*find_installer/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/clear/disk-hook.sh" -i /init
fi
#issue 1674
$SED "/switch_root/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/clear/hidden-hook.sh" -i /init

View File

@@ -47,3 +47,6 @@ else
fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
set_ventoy_hook_finish

View File

@@ -19,6 +19,8 @@
. /ventoy/hook/ventoy-hook-lib.sh
/sbin/mdev -s
# Just for KVM test environment
$BUSYBOX_PATH/modprobe virtio_blk 2>/dev/null
$BUSYBOX_PATH/modprobe virtio_pci 2>/dev/null
@@ -34,3 +36,9 @@ for i in 0 1 2 3 4 5 6 7 8 9; do
done
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
$BUSYBOX_PATH/rm -f /dev/dm-*
set_ventoy_hook_finish

View File

@@ -19,6 +19,6 @@
. $VTOY_PATH/hook/ventoy-os-lib.sh
$SED "/mount_boot /i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/gentoo/disk_hook.sh" -i /init
$SED "/mount_boot[^(]*$/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/daphile/disk_hook.sh" -i /init
$SED "s#'\.\*/block/mmcblk[^ ]*'#'\.\*/block/dm-[0-9]*'#" -i /init

View File

@@ -40,13 +40,13 @@ ventoy_os_install_dmsetup_by_unsquashfs() {
dmModPath="/usr/lib/modules/$vtKerVer/kernel/drivers/md/dm-mod.$vtKoPo"
echo $dmModPath > $VTOY_PATH/fsextract
vtoy_unsquashfs -d $VTOY_PATH/sqfs -n -q -e $VTOY_PATH/fsextract $VTOY_PATH/fsdisk
vtoy_unsquashfs -d $VTOY_PATH/sqfs -n -q -e $VTOY_PATH/fsextract $VTOY_PATH/fsdisk 2>>$VTLOG
if ! [ -e $VTOY_PATH/sqfs${dmModPath} ]; then
rm -rf $VTOY_PATH/sqfs
dmModPath="/lib/modules/$vtKerVer/kernel/drivers/md/dm-mod.$vtKoPo"
echo $dmModPath > $VTOY_PATH/fsextract
vtoy_unsquashfs -d $VTOY_PATH/sqfs -n -q -e $VTOY_PATH/fsextract $VTOY_PATH/fsdisk
vtoy_unsquashfs -d $VTOY_PATH/sqfs -n -q -e $VTOY_PATH/fsextract $VTOY_PATH/fsdisk 2>>$VTLOG
fi
if [ -e $VTOY_PATH/sqfs${dmModPath} ]; then
@@ -119,3 +119,6 @@ fi
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -64,6 +64,10 @@ if [ -f $VTOY_PATH/autoinstall ]; then
$SED "/^mount \/proc/a export file=$VTOY_PATH/autoinstall; export auto='true'; export priority='critical'" -i /init
fi
fi
# if [ -e /bin/check-missing-firmware ]; then
# $SED "/^#!/a\exit 0" -i /bin/check-missing-firmware
# fi
fi
#for ARMA aka Omoikane

View File

@@ -19,21 +19,25 @@
. /ventoy/hook/ventoy-hook-lib.sh
if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
if is_ventoy_hook_finished; then
exit 0
fi
vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
modprobe fuse
mkdir -p $VTOY_PATH/mnt/fuse $VTOY_PATH/mnt/iso
wait_for_usb_disk_ready
vtoydm -p -f $VTOY_PATH/ventoy_image_map -d "/dev/${1:0:-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
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
vtlog "ventoy disk not found"
PATH=$VTPATH_OLD
exit 0
fi
# OK finish
set_ventoy_hook_finish
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View 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

View File

@@ -34,3 +34,7 @@ fi
vtlog "${vtdiskname#/dev/}2 found..."
$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/udev_disk_hook.sh "${vtdiskname#/dev/}2"
if [ -f /ventoy/autoinstall ]; then
sh /ventoy/hook/default/auto_install_varexp.sh /ventoy/autoinstall
fi

View File

@@ -41,3 +41,6 @@ fi
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -33,7 +33,7 @@ ventoy_os_install_dmsetup_by_fuse() {
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
mount -t squashfs $VTOY_PATH/mnt/iso/minios/01-core*.sb $VTOY_PATH/mnt/squashfs
mount -t squashfs $VTOY_PATH/mnt/iso/minios/0*-core*.sb $VTOY_PATH/mnt/squashfs
KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$2/kernel/drivers/md/dm-mod.ko*)
vtlog "insmod $KoName"
@@ -80,3 +80,6 @@ ventoy_os_install_dmsetup $vtdiskname
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -20,5 +20,5 @@
if [ -f /lib/livekitlib ] && $GREP -q 'debug_log.*find_data_try' /lib/livekitlib; then
$SED "/debug_log.*find_data_try/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/minios-disk.sh" -i /lib/livekitlib
else
$SED "/find_data/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/minios-disk.sh" -i /init
$SED "/find_data/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/minios-disk.sh" -i /init
fi

View File

@@ -75,3 +75,6 @@ ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -37,12 +37,20 @@ ventoy_os_install_dmsetup_by_fuse() {
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso $VTOY_PATH/mnt/iso
sfsfile=$(ls $VTOY_PATH/mnt/iso/*.sfs)
if ls $VTOY_PATH/mnt/iso/zdrv_*.sfs 2>/dev/null; then
sfsfile=$(ls $VTOY_PATH/mnt/iso/zdrv_*.sfs)
else
sfsfile=$(ls $VTOY_PATH/mnt/iso/*.sfs)
fi
mount -t squashfs $sfsfile $VTOY_PATH/mnt/squashfs
kVer=$(uname -r)
KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$kVer/kernel/drivers/md/dm-mod.ko*)
if [ -z "$KoName" ]; then
KoName=$(ls $VTOY_PATH/mnt/squashfs/usr/lib/modules/$kVer/kernel/drivers/md/dm-mod.ko*)
fi
vtlog "insmod $KoName"
insmod $KoName

View File

@@ -81,3 +81,6 @@ ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -0,0 +1,46 @@
#!/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"
mkdir /root
chmod -R 0755 /root
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -0,0 +1,20 @@
#!/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 "/maybe_break *post_modules/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/stratodesk-disk.sh" -i /init

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/>.
#
#************************************************************************************
. /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

View 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

View 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

View File

@@ -138,6 +138,14 @@ else
fi
fi
#special process for Linx
if $BUSYBOX_PATH/uname -r | $GREP -q "^2\.6"; then
if $GREP -q "linx" /proc/version; then
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})
echo "/dev/$vtDM" > /ventoy/list-devices-usb-part
fi
fi
# OK finish
set_ventoy_hook_finish

View File

@@ -28,6 +28,7 @@ vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
ventoy_os_install_dmsetup_by_fuse() {
local drvdir=""
vtlog "ventoy_os_install_dmsetup_by_fuse $*"
mkdir -p $VTOY_PATH/mnt/fuse $VTOY_PATH/mnt/iso $VTOY_PATH/mnt/squashfs
@@ -37,11 +38,13 @@ ventoy_os_install_dmsetup_by_fuse() {
mount -t iso9660 $VTOY_PATH/mnt/fuse/ventoy.iso $VTOY_PATH/mnt/iso
for sfsfile in $(ls $VTOY_PATH/mnt/iso/*drv_veket*.sfs); do
mount -t squashfs $sfsfile $VTOY_PATH/mnt/squashfs
if [ -d $VTOY_PATH/mnt/squashfs/lib/modules ]; then
KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$2/kernel/drivers/md/dm-mod.ko*)
if [ -n "$KoName" -a -f $KoName ]; then
drvdir=$VTOY_PATH/mnt/squashfs/lib/modules/$2
break
fi
fi
@@ -49,11 +52,29 @@ ventoy_os_install_dmsetup_by_fuse() {
umount $VTOY_PATH/mnt/squashfs
done
KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$2/kernel/drivers/dax/dax.ko*)
if [ -z "$drvdir" ]; then
vtlog "retry for usr/lib dir"
for sfsfile in $(ls $VTOY_PATH/mnt/iso/*drv_veket*.sfs); do
mount -t squashfs $sfsfile $VTOY_PATH/mnt/squashfs
if [ -d $VTOY_PATH/mnt/squashfs/usr/lib/modules ]; then
KoName=$(ls $VTOY_PATH/mnt/squashfs/usr/lib/modules/$2/kernel/drivers/md/dm-mod.ko*)
if [ -n "$KoName" -a -f $KoName ]; then
drvdir=$VTOY_PATH/mnt/squashfs/usr/lib/modules/$2
break
fi
fi
umount $VTOY_PATH/mnt/squashfs
done
fi
KoName=$(ls $drvdir/kernel/drivers/dax/dax.ko*)
vtlog "insmod $KoName"
insmod $KoName
KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$2/kernel/drivers/md/dm-mod.ko*)
KoName=$(ls $drvdir/kernel/drivers/md/dm-mod.ko*)
vtlog "insmod $KoName"
insmod $KoName

View File

@@ -44,10 +44,15 @@ if [ $vtSplit -eq 1 ]; then
vtlog "Line number: $vtLine $vtLine1 $vtLine2"
sed -n "1,${vtLine1}p" $VTOY_PATH/autoinstall >/tmpcidata/user-data
sed -n "${vtLine2},\$p" $VTOY_PATH/autoinstall >/tmpcidata/meta-data
sh /ventoy/hook/default/auto_install_varexp.sh /tmpcidata/user-data
sh /ventoy/hook/default/auto_install_varexp.sh /tmpcidata/meta-data
else
vtlog "only user-data avaliable"
cp -a $VTOY_PATH/autoinstall /tmpcidata/user-data
touch /tmpcidata/meta-data
sh /ventoy/hook/default/auto_install_varexp.sh /tmpcidata/user-data
fi

View File

@@ -26,6 +26,10 @@ ventoy_get_debian_distro() {
if $EGREP -q "ID=.*antix|ID=.*mx" /etc/initrd-release; then
echo 'antix'; return
fi
elif [ -e /etc/initrd_release ]; then
if $EGREP -q "ID=.*antix|ID=.*mx" /etc/initrd_release; then
echo 'antix'; return
fi
fi
if [ -e /DISTRO_SPECS ]; then
@@ -43,6 +47,10 @@ ventoy_get_debian_distro() {
fi
elif $GREP -m1 -q 'Minimal.*Linux.*Live' /init; then
echo 'mll'; return
elif $GREP -m1 -q 'stratodesk.com' /init; then
echo 'stratodesk'; return
elif $GREP -q "\bPVE\b" /init; then
echo 'pve'; return
fi
fi
@@ -102,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'
}

View File

@@ -0,0 +1,40 @@
#!/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
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
vtlog "${vtdiskname#/dev/}2 found..."
$BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/udev_disk_hook.sh "${vtdiskname#/dev/}2"
if [ -f /ventoy/autoinstall ]; then
sh /ventoy/hook/default/auto_install_varexp.sh /ventoy/autoinstall
fi

View File

@@ -0,0 +1,151 @@
#!/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
ventoy_os_install_dmsetup() {
vtlog "ventoy_os_install_dmsetup $1 ..."
vt_usb_disk=$1
# dump iso file location
$VTOY_PATH/tool/vtoydm -i -f $VTOY_PATH/ventoy_image_map -d ${vt_usb_disk} > $VTOY_PATH/iso_file_list
# install dmsetup
LINE=$($GREP ' dmsetup.*\.udeb' $VTOY_PATH/iso_file_list)
if [ $? -eq 0 ]; then
install_udeb_from_line "$LINE" ${vt_usb_disk}
fi
# install libdevmapper
LINE=$($GREP ' libdevmapper.*\.udeb' $VTOY_PATH/iso_file_list)
if [ $? -eq 0 ]; then
install_udeb_from_line "$LINE" ${vt_usb_disk}
fi
# install md-modules
LINE=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list)
if [ $? -eq 0 ]; then
LINTCNT=$($GREP -i -c ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list)
if [ $LINTCNT -gt 1 ]; then
vtlog "more than one pkgs, need to filter..."
VER=$($BUSYBOX_PATH/uname -r)
LINE=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -i $VER)
LINTCNT=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -i -c $VER)
if [ $LINTCNT -gt 1 ]; then
vtlog "Still more than one pkgs, use the first one..."
LINE=$($GREP -i ' md-modules.*\.udeb' $VTOY_PATH/iso_file_list | $GREP -i -m1 $VER)
fi
fi
install_udeb_from_line "$LINE" ${vt_usb_disk}
fi
# insmod md-mod if needed
if $GREP -q 'device-mapper' /proc/devices; then
vtlog "device mapper module is loaded"
else
vtlog "device mapper module is NOT loaded, now load it..."
VER=$($BUSYBOX_PATH/uname -r)
KO=$($FIND /lib/modules/$VER/kernel/drivers/md -name "dm-mod*")
vtlog "KO=$KO"
insmod $KO
fi
vtlog "dmsetup install finish, now check it..."
if dmsetup info >> $VTLOG 2>&1; then
vtlog "dmsetup work ok"
else
vtlog "dmsetup not work, now try to load eglibc ..."
# install eglibc (some ubuntu 32 bit version need it)
LINE=$($GREP 'libc6-.*\.udeb' $VTOY_PATH/iso_file_list)
if [ $? -eq 0 ]; then
install_udeb_from_line "$LINE" ${vt_usb_disk}
fi
if dmsetup info >> $VTLOG 2>&1; then
vtlog "dmsetup work ok after retry"
else
vtlog "dmsetup still not work after retry"
fi
fi
}
if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
exit 0
fi
vtlog "==== $0 $* ===="
dmsetup_path=$(ventoy_find_bin_path dmsetup)
if [ -z "$dmsetup_path" ]; then
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
fi
if ! $GREP -q 'device-mapper' /proc/devices; then
ventoy_os_install_dmsetup "/dev/${1:0:-1}"
fi
ventoy_udev_disk_common_hook $*
#
# Some distro default only accept usb partitions as install medium.
# So if ventoy is installed on a non-USB device, we just mount /cdrom here except
# for these has boot=live or boot=casper parameter in cmdline
#
VT_BUS_USB=""
if [ -n "$ID_BUS" ]; then
if echo $ID_BUS | $GREP -q -i usb; then
VT_BUS_USB="YES"
fi
else
if $BUSYBOX_PATH/ls -l /sys/class/block/${1:0:-1} | $GREP -q -i usb; then
VT_BUS_USB="YES"
fi
fi
if [ -n "$VT_BUS_USB" ]; then
vtlog "$1 is USB device"
echo /dev/$1 > /ventoy/list-devices-usb-part
else
vtlog "$1 is NOT USB device (bus $ID_BUS)"
if $EGREP -q 'boot=|casper' /proc/cmdline; then
vtlog "boot=, or casper, don't mount"
else
vtlog "No boot param, need to mount"
echo /dev/$1 > /ventoy/list-devices-usb-part
fi
fi
#special process for Linx
if $BUSYBOX_PATH/uname -r | $GREP -q "^2\.6"; then
if $GREP -q "linx" /proc/version; then
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})
echo "/dev/$vtDM" > /ventoy/list-devices-usb-part
fi
fi
# OK finish
set_ventoy_hook_finish

View File

@@ -0,0 +1,42 @@
#!/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/deepin/disk_mount_hook.sh" -i /init
$SED "/^mountroot$/i\\export LIVEMEDIA=/dev/mapper/ventoy" -i /init
$SED "/^mountroot$/i\\export LIVE_MEDIA=/dev/mapper/ventoy" -i /init
if $GREP -q 'live-media=' /proc/cmdline; then
if [ -f /scripts/casper ] && $GREP -q '^ *LIVEMEDIA=' /scripts/casper; then
$SED "s#^ *LIVEMEDIA=.*#LIVEMEDIA=/dev/mapper/ventoy#" -i /scripts/casper
fi
fi
else
echo "Here use udev hook ..." >> $VTLOG
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule "$VTOY_PATH/hook/deepin/udev_disk_hook.sh %k"
fi
if [ -f $VTOY_PATH/autoinstall ]; then
echo "Do auto install ..." >> $VTLOG
$SED '/maybe_break[[:space:]]*init/i\/ventoy/busybox/sh /ventoy/hook/deepin/ventoy_autoinstall.sh >>/ventoy/autoinstall.log 2>&1' -i /init
fi

View File

@@ -0,0 +1,122 @@
#!/ventoy/busybox/sh
. /ventoy/hook/ventoy_hook_lib.sh
change_var_value() {
local vfile=$1
local vkey=$2
local vVal=$3
local quote=$4
local vline
if [ $quote -eq 0 ]; then
vline="$vkey = $vVal"
else
vline="$vkey = \"$vVal\""
fi
if grep -q -m1 "^$vkey[[:space:]]*=" $vfile; then
sed "s#^$vkey[[:space:]]*=.*#$vline#g" -i $vfile
else
echo "$vline" >> $vfile
fi
}
setting_script_process() {
local sfile=$1
local vItem
local vB64Item
vItem=$(grep '^language[[:space:]]*=' /ventoy/autoinstall | awk '{print $3}')
if [ -n "$vItem" ]; then
change_var_value $sfile 'select_language_default_locale' "$vItem" 0
fi
vItem=$(grep '^timezone[[:space:]]*=' /ventoy/autoinstall | awk '{print $3}')
if [ -n "$vItem" ]; then
change_var_value $sfile 'timezone_default' "$vItem" 0
fi
vItem=$(grep '^hostname[[:space:]]*=' /ventoy/autoinstall | awk '{print $3}')
if [ -n "$vItem" ]; then
change_var_value $sfile 'system_info_default_hostname' "$vItem" 1
change_var_value $sfile 'DI_HOSTNAME' "$vItem" 1
fi
vItem=$(grep '^root_password[[:space:]]*=' /ventoy/autoinstall | awk '{print $3}')
if [ -n "$vItem" ]; then
vB64Item=$(echo -n "$vItem" | base64)
change_var_value $sfile 'system_info_default_root_password' "$vB64Item" 1
change_var_value $sfile 'DI_ROOTPASSWORD' "$vB64Item" 1
fi
vItem=$(grep '^default_username[[:space:]]*=' /ventoy/autoinstall | awk '{print $3}')
if [ -n "$vItem" ]; then
change_var_value $sfile 'system_info_default_username' "$vItem" 1
change_var_value $sfile 'DI_USERNAME' "$vItem" 1
fi
vItem=$(grep '^default_password[[:space:]]*=' /ventoy/autoinstall | awk '{print $3}')
if [ -n "$vItem" ]; then
change_var_value $sfile 'system_info_default_password' "$vItem" 1
change_var_value $sfile 'DI_PASSWORD' "$vItem" 1
fi
vItem=$(grep '^install_disk[[:space:]]*=' /ventoy/autoinstall | awk '{print $3}')
if [ -n "$vItem" ]; then
echo "DI_FULLDISK_MULTIDISK_DEVICE = $vItem" >> $sfile
echo "DI_ROOTDISK = $vItem" >> $sfile
echo "DI_BOOTLOADER = $vItem" >> $sfile
fi
change_var_value $sfile 'skip_virtual_machine_page' 'true' 0
change_var_value $sfile 'skip_select_language_page' 'true' 0
change_var_value $sfile 'skip_select_language_page_on_first_boot' 'true' 0
change_var_value $sfile 'skip_system_keyboard_page' 'true' 0
change_var_value $sfile 'skip_system_info_page' 'true' 0
change_var_value $sfile 'skip_qr_code_system_info_page' 'true' 0
change_var_value $sfile 'skip_timezone_page' 'true' 0
change_var_value $sfile 'skip_partition_page' 'true' 0
change_var_value $sfile 'system_info_password_validate_required' '0' 0
change_var_value $sfile 'system_info_password_strong_check' 'false' 0
change_var_value $sfile 'partition_do_auto_part' 'true' 0
change_var_value $sfile 'system_info_disable_license' 'true' 0
change_var_value $sfile 'system_info_disable_experience' 'true' 0
change_var_value $sfile 'system_info_disable_privacy_license' 'true' 0
#filesystem.squashfs search ini
#first_page_state=0表示不跳过首页展示首页让用户自己选择
#first_page_state=1表示跳过首页并且自动点击一键安装
#first_page_state=2表示跳过首页并且自动点击自定义安装
#first_page_state=3表示跳过首页并且直接以全盘安装方式自动安装
change_var_value $sfile 'first_page_state' '3' 0
}
update_settings() {
local script=$1
local newscript
echo "update_settings for $script ..."
newscript=$(basename $script)
cp -a $script /ventoy/vini_${newscript}
setting_script_process /ventoy/vini_${newscript}
rm -f $script
cp -a /ventoy/vini_${newscript} $script
}
sh /ventoy/hook/common/auto_install_varexp.sh /ventoy/autoinstall
update_settings /root/usr/share/deepin-installer/resources/default_settings.ini
ls -1 /root/usr/share/deepin-installer/resources/override/ | while read line; do
update_settings /root/usr/share/deepin-installer/resources/override/$line
done
ls -1 /root/usr/share/deepin-installer/resources/oem/ | while read line; do
update_settings /root/usr/share/deepin-installer/resources/oem/$line
done

View File

@@ -0,0 +1,53 @@
#!/bin/sh
#************************************************************************************
# Copyright (c) 2022, 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/>.
#
#************************************************************************************
PATH=$PATH:/ventoy/busybox:/ventoy/tool
vlog() {
echo "$@" >> /ventoy/autoinstall.log
}
if grep -q '\$\$VT_' /ventoy/autoinstall; then
vlog "======== auto install variables expansion ======="
else
vlog "======== auto install variables expansion no need ======="
exit 0
fi
if [ -f /ventoy/ventoy_os_param ]; then
VTOYDISK=$(vtoydump -f /ventoy/ventoy_os_param | awk -F'#' '{print $1}')
vlog VTOYDISK=$VTOYDISK
if [ -b "$VTOYDISK" ]; then
vlog "$VTOYDISK exist OK"
else
vlog "$VTOYDISK does NOT exist"
exit 0
fi
if [ -n "$1" -a -f "$1" ]; then
vtoyexpand "$1" "$VTOYDISK"
else
vlog "File $1 not exist"
fi
else
vlog "os param file not exist"
exit 0
fi

View File

@@ -39,3 +39,6 @@ $BUSYBOX_PATH/insmod $vtLoopExDir/dm-mod/$(uname -r)/64/dm-mod.ko
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -78,6 +78,12 @@ fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
ln -s /dev/dm-0 /dev/root
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})
cp -a /dev/$vtDM /dev/ventoy
ln -s /dev/$vtDM /dev/root
PATH=$VTPATH_OLD
set_ventoy_hook_finish

View File

@@ -19,5 +19,5 @@
. $VTOY_PATH/hook/ventoy-os-lib.sh
$SED "s#^CDROM=.*#CDROM=/dev/dm-0#" -i /init
$SED "s#^CDROM=.*#CDROM=/dev/ventoy#" -i /init
$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/easystartup/ventoy-initqueue.sh /initqueue/ventoy.sh

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

@@ -34,3 +34,6 @@ for i in 0 1 2 3 4 5 6 7 8 9; do
done
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
set_ventoy_hook_finish

View File

@@ -24,6 +24,9 @@ if $GREP -q kaspersky /proc/version; then
if [ -f /ventoy/ventoy_persistent_map ]; then
$SED "/sysresccd_parsecmdline[^(]*$/a\ BACKSTORE_CMD='LABEL=casper-rw,noloop'" -i /init
fi
elif $GREP -q 'setting up the root filesystem' /init; then
$SED "/setting up the root filesystem/a\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/gentoo/disk_hook.sh" -i /init
$SED "/setting up the root filesystem/a\ export CDROOT_DEV=/dev/mapper/ventoy" -i /init
elif [ -d /etc/udev/rules.d ] || [ -d /lib/udev/rules.d ]; then
ventoy_systemd_udevd_work_around
ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k noreplace"

Some files were not shown because too many files have changed in this diff Show More