Compare commits

...

30 Commits

Author SHA1 Message Date
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
72 changed files with 1073 additions and 481 deletions

View File

@ -13,25 +13,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run docker-compose up
run: docker-compose up
- uses: actions/upload-artifact@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@v3
- uses: actions/upload-artifact@v4
with:
name: ventoy-linux
path: INSTALL/ventoy-*linux*
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ventoy-livecd
path: INSTALL/ventoy-*livecd*
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: SHA256SUM
path: INSTALL/sha256.txt
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: xxx-build-log
path: DOC/build.log

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>

View File

@ -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

@ -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))
{
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)
{
grub_free (dirblock);
return 0;
}
entries = (grub_be_to_cpu32 (tail->leaf_count)
- grub_be_to_cpu32 (tail->leaf_stale));
/*
* 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,6 +1016,12 @@ 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';
@ -872,11 +1033,17 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
return 1;
}
/* Check if last direntry in this block is
reached. */
/*
* 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

@ -128,11 +128,22 @@ insert_dir (const char *name, struct dir **root,
n->name = grub_strndup (cb, ce - cb);
if (ptr)
{
grub_dprintf ("linux", "Creating directory %s, %s\n", name, ce);
ptr = make_header (ptr, name, ce - name,
040777, 0);
/*
* 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;
}
size += ALIGN_UP ((ce - (char *) name)
grub_dprintf ("linux", "Creating directory %s, %s\n", name, ce);
ptr = make_header (ptr, tmp_name, ce - name + 1,
040777, 0);
grub_free (tmp_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

@ -862,6 +862,7 @@ typedef struct vhd_footer_t
}vhd_footer_t;
#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)

View File

@ -536,12 +536,25 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
{
grub_file_seek(file, 0);
grub_file_read(file, &vdihdr, sizeof(vdihdr));
if (vdihdr.u32Signature == VDI_IMAGE_SIGNATURE &&
grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO, grub_strlen(VDI_IMAGE_FILE_INFO)) == 0)
if (vdihdr.u32Signature == VDI_IMAGE_SIGNATURE)
{
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;
grub_snprintf(type, sizeof(type), "vdi");
debug("VDI V1\n");
}
else if (grub_strncmp(vdihdr.szFileInfo, VDI_IMAGE_FILE_INFO2, grub_strlen(VDI_IMAGE_FILE_INFO2)) == 0)
{
offset = 2 * 1048576;
g_img_trim_head_secnum = offset / 512;
debug("VDI V2\n");
}
else
{
debug("invalid file info <%s>\n", vdihdr.szFileInfo);
}
}
else
{
@ -568,7 +581,7 @@ grub_err_t ventoy_cmd_get_vtoy_type(grub_extcmd_context_t ctxt, int argc, char *
if (gpt->MBR.Byte55 != 0x55 || gpt->MBR.ByteAA != 0xAA)
{
grub_env_set(args[1], "unknown");
debug("invalid mbr signature: 0x%x 0x%x\n", gpt->MBR.Byte55, gpt->MBR.ByteAA);
debug("invalid mbr signature: 0x%x 0x%x offset=%d\n", gpt->MBR.Byte55, gpt->MBR.ByteAA, offset);
goto end;
}

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
if is_ventoy_hook_finished; then
exit 0
fi
vtlog "####### $0 $* ########"
VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
wait_for_usb_disk_ready
vtdiskname=$(get_ventoy_disk_name)
if [ "$vtdiskname" = "unknown" ]; then
vtlog "ventoy disk not found"
PATH=$VTPATH_OLD
exit 0
fi
ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2"
PATH=$VTPATH_OLD
set_ventoy_hook_finish

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

@ -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

@ -110,6 +110,14 @@ ventoy_get_debian_distro() {
echo 'pyabr'; return
fi
if [ -e /devuan-logo.txt ]; then
echo 'devuan'; return
fi
if $GREP -q 'truenas' /proc/version; then
echo 'truenas'; return
fi
echo 'default'
}

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

@ -26,6 +26,12 @@ if [ -f $VTOY_PATH/autoinstall ]; then
fi
fi
if $GREP -q 'rdinit=/vtoy/vtoy' /proc/cmdline; then
echo "remove rdinit param" >> $VTLOG
echo "ptoptions=+rdinit" >> /linuxrc.config
fi
if $BUSYBOX_PATH/ls $VTOY_PATH | $GREP -q 'ventoy_dud[0-9]'; then
if [ -f /linuxrc.config ]; then
vtKerVer=$($BUSYBOX_PATH/uname -r)

View File

@ -45,6 +45,13 @@ fi
# TinyCore linux distro doesn't contain dmsetup, we use aoe here
sudo modprobe aoe aoe_iflist=lo
if [ -e /sys/module/aoe ]; then
if ! [ -d /lib64 ]; then
vtlog "link lib64"
NEED_UNLIB64=1
ln -s /lib /lib64
fi
VBLADE_BIN=$(ventoy_get_vblade_bin)
sudo nohup $VBLADE_BIN -r -f $VTOY_PATH/ventoy_image_map 9 0 lo "$vtdiskname" > /dev/null &
@ -57,6 +64,11 @@ if [ -e /sys/module/aoe ]; then
sudo cp -a /dev/etherd/e9.0 "$vPart"
if [ -n "$NEED_UNLIB64" ]; then
vtlog "unlink lib64"
unlink /lib64
fi
ventoy_find_bin_run rebuildfstab
else
vterr "aoe driver module load failed..."

View File

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

View File

@ -73,7 +73,12 @@ ventoy_unpack_initramfs() {
for vtx in '1F8B zcat' '1F9E zcat' '425A bzcat' '5D00 lzcat' 'FD37 xzcat' '894C lzopcat' '0221 lz4cat' '28B5 zstdcat' '3037 cat' '4C5A lunzip -c'; do
if [ "${vtx:0:4}" = "${vtmagic:0:4}" ]; then
echo "vtx=$vtx" >> $VTLOG
if [ $vtskip -eq 0 ]; then
if [ $vtskip -ne 0 ]; then
dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none > ${vtfile}.skip
rm -f $vtfile
mv ${vtfile}.skip $vtfile
fi
if [ "${vtx:5}" = "xzcat" ]; then
rm -f $VTOY_PATH/xzlog
${vtx:5} $vtfile 2> $VTOY_PATH/xzlog | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
@ -90,9 +95,6 @@ ventoy_unpack_initramfs() {
else
${vtx:5} $vtfile | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
fi
else
dd if=$vtfile skip=$vtskip iflag=skip_bytes status=none | ${vtx:5} | (cpio -idmu 2>>$VTLOG; cat > $vttmp)
fi
break
fi
done

View File

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

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

@ -33,6 +33,21 @@ function ventoy_debug_pause {
fi
}
function ventoy_max_resolution {
#Skip this for VirtualBox
smbios -t 1 -s 0x05 --set=system_product;
if vt_str_casebegin "$system_product" "VirtualBox"; then
return
fi
vt_enum_video_mode
vt_get_video_mode 0 vtCurMode
terminal_output console
set gfxmode=$vtCurMode
terminal_output gfxterm
}
function ventoy_cli_console {
if [ -z "$vtoy_display_mode" ]; then
terminal_output console
@ -403,10 +418,14 @@ function distro_specify_initrd_file_phase2 {
vt_linux_specify_initrd_file /images/pxeboot/initrd.img
elif [ -f (loop)/live/initrd ]; then
vt_linux_specify_initrd_file /live/initrd
elif [ -f (loop)/initramfs-linux.img ]; then
vt_linux_specify_initrd_file /initramfs-linux.img
elif [ -f (loop)/boot/isolinux/initrd.gz ]; then
vt_linux_specify_initrd_file /boot/isolinux/initrd.gz
fi
}
function ventoy_get_ghostbsd_ver {
# fallback to parse version from elf /boot/kernel/kernel
set vt_freebsd_ver=xx
@ -514,6 +533,13 @@ function ventoy_freebsd_proc {
fi
fi
if [ "$vt_freebsd_ver" = "14.x" ]; then
if [ -e (loop)/boot/lua/brand-pfSense.lua ]; then
set vtFreeBsdDistro=pfSense
fi
fi
if [ -n "${vtdebug_flag}" ]; then
echo "This is $vtFreeBsdDistro $vt_freebsd_ver ${vt_freebsd_bit}bit"
fi
@ -620,7 +646,7 @@ function uefi_windows_menu_func {
if [ -n "$vtoy_chain_mem_addr" ]; then
ventoy_acpi_param ${vtoy_chain_mem_addr} 2048
ventoy_cli_console
ventoy_max_resolution
chainloader ${vtoy_path}/ventoy_${VTOY_EFI_ARCH}.efi env_param=${env_param} isoefi=${LoadIsoEfiDriver} iso_${ventoy_fs_probe} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
boot
else
@ -662,7 +688,7 @@ function uefi_linux_menu_func {
if [ -d (loop)/pmagic ]; then
vt_linux_specify_initrd_file /pmagic/initrd.img
else
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf" "/grub/grub.cfg"; do
for file in "boot/grub/grub.cfg" "EFI/BOOT/grub.cfg" "EFI/boot/grub.cfg" "efi/boot/grub.cfg" "EFI/BOOT/BOOTX64.conf" "/grub/grub.cfg" "EFI/BOOT/grub/grub.cfg"; do
if [ -e (loop)/$file ]; then
vt_linux_parse_initrd_grub file (loop)/$file
fi
@ -2399,7 +2425,7 @@ function mimg_common_menuentry {
#############################################################
#############################################################
set VENTOY_VERSION="1.0.99"
set VENTOY_VERSION="1.1.05"
#ACPI not compatible with Window7/8, so disable by default
set VTOY_PARAM_NO_ACPI=1

View File

@ -626,6 +626,14 @@ else
vtoycli partresize -s $DISK $part2_start
fi
if [ "$PART1_TYPE" = "EE" ]; then
vtinfo "update esp partition attribute"
vtoycli gpt -f $DISK
sync
fi
echo ""
vtinfo "Update Ventoy on $DISK successfully finished."
echo ""

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -19,5 +19,34 @@
"condition": "equal",
"expression": "ukui",
"gui": "gtk3"
},
{
"type": "env",
"name": "DESKTOP_SESSION",
"condition": "equal",
"expression": "cinnamon",
"gui": "gtk3"
},
{
"type": "env",
"name": "DESKTOP_SESSION",
"condition": "equal",
"expression": "gnome",
"gui": "gtk3"
},
{
"type": "env",
"name": "DESKTOP_SESSION",
"condition": "equal",
"expression": "plasma",
"gui": "qt5"
},
{
"type": "env",
"name": "DESKTOP_SESSION",
"condition": "equal",
"expression": "xfce",
"gui": "gtk3"
}
]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -449,7 +449,6 @@ format_ventoy_disk_gpt() {
mkpart Ventoy ntfs $part1_start_sector $part1_end_sector \
mkpart VTOYEFI fat16 $part2_start_sector $part2_end_sector \
$vt_set_efi_type \
set 2 hidden on \
quit
sync

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

8
LZIP/buildlz4.txt Normal file
View File

@ -0,0 +1,8 @@
/opt/diet64/bin/diet -Os gcc -D_FILE_OFFSET_BITS=64 smallz4cat.c -o lz4cat64
aarch64-buildroot-linux-uclibc-gcc -Os -static -D_FILE_OFFSET_BITS=64 smallz4cat.c -o lz4cataa64
mips64el-linux-musl-gcc -mips64r2 -mabi=64 -static -Os -D_FILE_OFFSET_BITS=64 smallz4cat.c -o lz4catm64e

View File

@ -442,7 +442,7 @@ int ventoy_fill_gpt(uint64_t size, uint64_t reserve, int align4k, VTOY_GPT_INFO
ventoy_gen_preudo_uuid(&(Table[1].PartGuid));
Table[1].StartLBA = Table[0].LastLBA + 1;
Table[1].LastLBA = Table[1].StartLBA + VTOYEFI_PART_BYTES / 512 - 1;
Table[1].Attr = 0xC000000000000001ULL;
Table[1].Attr = 0x8000000000000000ULL;
ventoy_fill_gpt_partname(Table[1].Name, "VTOYEFI");
#if 0

View File

@ -727,6 +727,7 @@ static void * ventoy_update_thread(void *data)
MBR_HEAD MBR;
ventoy_disk *disk = NULL;
ventoy_thread_data *thread = (ventoy_thread_data *)data;
VTOY_GPT_INFO *pstGPT = NULL;
vdebug("ventoy_update_thread run ...\n");
@ -790,6 +791,36 @@ static void * ventoy_update_thread(void *data)
vlog("No need to update MBR\n");
}
if (disk->vtoydata.partition_style)
{
pstGPT = (VTOY_GPT_INFO *)malloc(sizeof(VTOY_GPT_INFO));
memset(pstGPT, 0, sizeof(VTOY_GPT_INFO));
offset = lseek(fd, 0, SEEK_SET);
len = read(fd, pstGPT, sizeof(VTOY_GPT_INFO));
vlog("Read GPT table offset:%llu len:%llu ...\n", (_ull)offset, (_ull)len);
if (pstGPT->PartTbl[1].Attr != 0x8000000000000000ULL)
{
vlog("Update EFI part attr from 0x%016llx to 0x%016llx\n",
pstGPT->PartTbl[1].Attr, 0x8000000000000000ULL);
pstGPT->PartTbl[1].Attr = 0x8000000000000000ULL;
pstGPT->Head.PartTblCrc = ventoy_crc32(pstGPT->PartTbl, sizeof(pstGPT->PartTbl));
pstGPT->Head.Crc = 0;
pstGPT->Head.Crc = ventoy_crc32(&(pstGPT->Head), pstGPT->Head.Length);
ventoy_write_gpt_part_table(fd, disk->size_in_byte, pstGPT);
}
else
{
vlog("No need to update EFI part attr\n");
}
free(pstGPT);
}
g_current_progress = PT_SYNC_DATA1;
vlog("fsync data1...\n");

10
Unix/BuildUnixKmod.txt Normal file
View File

@ -0,0 +1,10 @@
ventoy_geom kernel mod is used to boot FreeBSD and other Unix distros.
This kernel mod need to build inside a FreeBSD system.
use VM to install a FreeBSD (e.g. 9.X/10.X/11.X/....), need to install source code.
copy these files for example: Unix/ventoy_unix_src/FreeBSD/geom_ventoy_src/10.x/sys to /sys directory.
cd /sys/modules/geom/geom_ventoy/
make
make install
Other distros are similar.

View File

@ -2520,7 +2520,7 @@ int PartitionResizeForVentoy(PHY_DRIVE_INFO *pPhyDrive)
pGPT->PartTbl[1].StartLBA = pGPT->PartTbl[0].LastLBA + 1;
pGPT->PartTbl[1].LastLBA = pGPT->PartTbl[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1;
pGPT->PartTbl[1].Attr = 0xC000000000000001ULL;
pGPT->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
memcpy(pGPT->PartTbl[1].Name, L"VTOYEFI", 7 * 2);
//Update CRC
@ -2797,6 +2797,7 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int TryId)
BOOL CleanDisk = FALSE;
BOOL DelEFI = FALSE;
BOOL bWriteBack = TRUE;
BOOL bUpdateEFIAttr = FALSE;
HANDLE hVolume;
HANDLE hDrive;
DWORD Status;
@ -2906,6 +2907,12 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int TryId)
Log("TryId=%d EFI GPT partition type is 0x%llx", TryId, pPhyDrive->Part2GPTAttr);
PROGRESS_BAR_SET_POS(PT_DEL_ALL_PART);
if (pGptInfo->PartTbl[1].Attr != VENTOY_EFI_PART_ATTR)
{
bUpdateEFIAttr = TRUE;
}
if (TryId == 1)
{
Log("Change GPT partition type to ESP");
@ -2917,8 +2924,8 @@ int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int TryId)
}
else if (TryId == 2)
{
Log("Change GPT partition attribute");
if (DISK_ChangeVtoyEFIAttr(pPhyDrive->PhyDrive, StartSector * 512ULL, 0x8000000000000001))
Log("Try2 Change GPT partition attribute to 0x%016llx", VENTOY_EFI_PART_ATTR & 0xFFFFFFFFFFFFFFFEULL);
if (DISK_ChangeVtoyEFIAttr(pPhyDrive->PhyDrive, StartSector * 512ULL, VENTOY_EFI_PART_ATTR & 0xFFFFFFFFFFFFFFFEULL))
{
ChangeAttr = TRUE;
Sleep(2000);
@ -3253,15 +3260,16 @@ End:
DISK_ChangeVtoyEFI2Basic(pPhyDrive->PhyDrive, StartSector * 512);
}
if (pPhyDrive->PartStyle == 1)
{
if (ChangeAttr || ((pPhyDrive->Part2GPTAttr >> 56) != 0xC0))
if (ChangeAttr || bUpdateEFIAttr)
{
Log("Change EFI partition attr %u <0x%llx> to <0x%llx>", ChangeAttr, pPhyDrive->Part2GPTAttr, 0xC000000000000001ULL);
if (DISK_ChangeVtoyEFIAttr(pPhyDrive->PhyDrive, StartSector * 512ULL, 0xC000000000000001ULL))
Log("Change EFI partition attr %u <0x%llx> to <0x%llx>", ChangeAttr, pGptInfo->PartTbl[1].Attr, VENTOY_EFI_PART_ATTR);
if (DISK_ChangeVtoyEFIAttr(pPhyDrive->PhyDrive, StartSector * 512ULL, VENTOY_EFI_PART_ATTR))
{
Log("Change EFI partition attr success");
pPhyDrive->Part2GPTAttr = 0xC000000000000001ULL;
pPhyDrive->Part2GPTAttr = VENTOY_EFI_PART_ATTR;
}
else
{

View File

@ -982,7 +982,7 @@ int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)
CoCreateGuid(&(Table[1].PartGuid));
Table[1].StartLBA = Table[0].LastLBA + 1;
Table[1].LastLBA = Table[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1;
Table[1].Attr = 0xC000000000000001ULL;
Table[1].Attr = VENTOY_EFI_PART_ATTR;
memcpy(Table[1].Name, L"VTOYEFI", 7 * 2);
#if 0

View File

@ -34,6 +34,9 @@ typedef enum VTOY_FS
#define FAT32_MAX_LIMIT (32 * 1073741824ULL)
#define VENTOY_EFI_PART_ATTR 0x8000000000000000ULL
#define SIZE_1KB (1024)
#define SIZE_1GB (1024 * 1024 * 1024)
#define SIZE_1TB (1024ULL * 1024ULL * 1024ULL * 1024ULL)

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -599,7 +599,7 @@ static int update_part_table(char *disk, UINT64 part2start)
PartTbl[1].StartLBA = PartTbl[0].LastLBA + 1;
PartTbl[1].LastLBA = PartTbl[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1;
PartTbl[1].Attr = 0xC000000000000001ULL;
PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
PartTbl[1].Name[0] = 'V';
PartTbl[1].Name[1] = 'T';
PartTbl[1].Name[2] = 'O';

View File

@ -21,7 +21,7 @@
#ifndef __VTOYCLI_H__
#define __VTOYCLI_H__
#define VENTOY_EFI_PART_ATTR 0xC000000000000001ULL
#define VENTOY_EFI_PART_ATTR 0x8000000000000000ULL
#define SIZE_1MB (1024 * 1024)
#define VENTOY_EFI_PART_SIZE (32 * SIZE_1MB)

View File

@ -190,6 +190,8 @@ int vtoygpt_main(int argc, char **argv)
Name = pMainGptInfo->PartTbl[1].Name;
if (Name[0] == 'V' && Name[1] == 'T' && Name[2] == 'O' && Name[3] == 'Y')
{
if (pMainGptInfo->PartTbl[1].Attr != VENTOY_EFI_PART_ATTR)
{
pMainGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
pMainGptInfo->Head.PartTblCrc = VtoyCrc32(pMainGptInfo->PartTbl, sizeof(pMainGptInfo->PartTbl));
@ -210,6 +212,7 @@ int vtoygpt_main(int argc, char **argv)
fsync(fd);
}
}
}
free(pMainGptInfo);
free(pBackGptInfo);

View File

@ -244,7 +244,7 @@ int DumpGptInfo(VTOY_GPT_INFO *pGptInfo)
return 0;
}
#define VENTOY_EFI_PART_ATTR 0xC000000000000001ULL
#define VENTOY_EFI_PART_ATTR 0x8000000000000000ULL
int main(int argc, const char **argv)
{
@ -290,6 +290,8 @@ int main(int argc, const char **argv)
Name = pMainGptInfo->PartTbl[1].Name;
if (Name[0] == 'V' && Name[1] == 'T' && Name[2] == 'O' && Name[3] == 'Y')
{
if (pMainGptInfo->PartTbl[1].Attr != VENTOY_EFI_PART_ATTR)
{
pMainGptInfo->PartTbl[1].Attr = VENTOY_EFI_PART_ATTR;
pMainGptInfo->Head.PartTblCrc = VtoyCrc32(pMainGptInfo->PartTbl, sizeof(pMainGptInfo->PartTbl));
@ -310,6 +312,7 @@ int main(int argc, const char **argv)
fsync(fd);
}
}
}
free(pMainGptInfo);
free(pBackGptInfo);