ventoy

maintainer Toolybird · 56 votes · scanned 2026-08-03 00:08:14.047287
LOW
View on AUR ↗
Why flagged The package builds from source using upstream project code and common open-source components, with downloads from official project hosts (GitHub, GNU, kernel.org, etc.); the non-standard hosts (like vault.centos.org) are used for old, publicly available source tarballs, not prebuilt binaries, and all sources are checksummed except one patch from Savannah which is marked SKIP for practical reasons, not security evasion.

Triggered rules

LOW AI review downgraded a static finding llm_review

The static rules flagged this MEDIUM, but an AI model (qwen/qwen3-235b-a22b-2507) reviewed the full PKGBUILD and judged it LOW (confidence 95%): The package builds from source using upstream project code and common open-source components, with downloads from official project hosts (GitHub, GNU, kernel.org, etc.); the non-standard hosts (like vault.centos.org) are used for old, publicly available source tarballs, not prebuilt binaries, and all sources are checksummed except one patch from Savannah which is marked SKIP for practical reasons, not security evasion.

1 higher static finding superseded - not the current verdict (shown for transparency)
MEDIUM source=() URL on a non-standard host source_untrusted_domain

One or more source=() URLs point to a host outside the trusted allowlist (github.com, gitlab.com, codeberg.org, pypi.org, …).

  • PKGBUILD:106 https://musl.libc.org/releases/musl-"$_musl_ver".tar.gz
  • PKGBUILD:114 https://tukaani.org/xz/xz-embedded-"$_xz_embed_ver".tar.gz
  • PKGBUILD:115 https://busybox.net/downloads/busybox-"$_busybox_ver".tar.bz2

PKGBUILD

3 offending line(s) highlighted
1# Maintainer: Toolybird <toolybird at tuta dot io>
2#
3# WORK IN PROGRESS
4#
5# <rant>This thing is a packaging nightmare!! The upstream build system is
6# *especially* distro unfriendly (build on Centos 7...WTF?). Building from
7# source to proper Arch standards is "interesting" to say the least.</rant>
8#
9# NOTE: upstream uses losetup (root) for disk image preparation and GRUB
10# installation. Solved by utilizing libguestfs/QEMU.
11#
12# NOT INCLUDED (compared to upstream): ARM64, MIPS64, LiveCD.
13#
14# PROBLEMS: FIXME
15#
16# - ancient pkg versions used in the build
17# - includes bundled / vendored sources
18# - some third party / pre-compiled / downloaded binaries are used
19#
20# This PKGBUILD is based on "INSTALL/all_in_one.sh". The upstream build
21# environment is Centos 7 (as root!). See "DOC/BuildVentoyFromSource.txt" and
22# GitHub CI/docker files. The Ventoy code is unfortunately built upon very old
23# and outdated pkgs. In order to achieve an initial working build, I've simply
24# tried to replicate upstream procedures as much as possible. Some patches are
25# required to successfully build on a modern Arch system. The main components of
26# Ventoy are heavily modified versions of:
27#
28# - grub (Jul 2019) (2.04)
29# - ipxe (Sep 2019) (3fe683e)
30# - edk2 (Dec 2019) (201911)
31#
32# Please see the "License" folder for full details of various other bits that
33# have been modified.
34
35# shellcheck disable=SC1003,SC2034,SC2154,SC2164
36
37pkgname=ventoy
38pkgver=1.1.17
39_grub_ver=2.04 # (Jul 2019)
40#_unifont_ver=15.0.01 # FIXME see NOTE below
41_ipxe_ver=3fe683e # (Sep 29 2019)
42_edk2_ver=stable201911 # (Dec 2019)
43_diet_ver=0.34 # FIXME AUR pkg needs a patch, see below, build our own (64/32)
44_musl_ver=1.2.6 # upstream uses 1.2.1, use repo for 64-bit, build our own 32-bit
45_kern_hdrs_musl_ver=6.12.77 # for busybox
46_fuse_ver=2.9.9 # need a static lib built against musl, build our own (64/32)
47_exfat_ver=1.3.0 # (Sep 2018) old! FIXME see comments below for why we build our own
48_lz4_ver=1.8.1.2 # (Jan 2018) old! FIXME statically linked into unsquashfs
49_xz_ver=5.0.4 # (Jun 2012) old! FIXME statically linked into unsquashfs
50_lzo_ver=2.08 # (Jun 2014) old! FIXME statically linked into unsquashfs
51_zstd_ver=1.4.4 # (Nov 2019) old! FIXME statically linked into unsquashfs
52_zlib_ver=1.3.2 # need a static lib for unsquashfs, build our own
53_squash_ver=4.4 # (Aug 2019) old! FIXME for unsquashfs
54_dm_ver=1.02.28 # (Sep 2008) old! FIXME for dmsetup
55_zstd1_ver=1.0.0 # (Sep 2016) old! FIXME for standalone zstdcat
56_xz_embed_ver=20130513 # (May 2013) old! FIXME for xzminidec
57_busybox_ver=1.32.0 # (Jun 2020) old! FIXME
58_crypt_ver=1.7.5 # (Apr 2017) old! FIXME for veritysetup
59_lunzip_ver=1.11 # (Jan 2019) old! FIXME
60_wimboot_ver=2.7.3 # (Apr 2021) old! FIXME
61pkgrel=1
62pkgdesc="A new bootable USB solution"
63arch=(x86_64)
64url="https://www.ventoy.net/"
65license=(GPL-3.0-or-later)
66depends=(bash dosfstools)
67makedepends=(
68 acpica # edk2
69 cdrtools # EfiISO
70 cpio # IMG/USB prep
71 device-mapper # grub2
72 freetype2 # grub2
73 fuse2 # grub2 exfat
74 git # ipxe
75 gtk3 # GUI
76 kernel-headers-musl # busybox
77 lib32-gcc-libs # 32-bit squashfs-tools lz4 xz lzo zstd vblade
78 lib32-glibc # 32-bit dietlibc vtoytool dmsetup zstdcat xzminidec busybox lunzip
79 libguestfs # IMG/USB prep
80 linux # libguestfs
81 musl # vtoycli fuse fuseiso xzminidec busybox
82 nasm # edk2
83 python # grub2 edk2
84 python-setuptools # edk2 (python-3.12+)
85 qt5-base # GUI
86 ttf-dejavu # grub2
87)
88optdepends=(
89 'gtk3: for GTK GUI'
90 'parted: for preferred CLI partitioner'
91 'polkit: for GUI privilege escalation'
92 'qt5-base: for Qt GUI'
93)
94options=(!buildflags)
95source=(
96 "$pkgname-$pkgver.tar.gz::https://github.com/ventoy/Ventoy/archive/refs/tags/v$pkgver.tar.gz"
97 https://ftp.gnu.org/gnu/grub/grub-"$_grub_ver".tar.xz
98 ventoy-grub-fix-build-with-binutils-2.36.patch::https://git.savannah.gnu.org/cgit/grub.git/patch/configure.ac?id=b9827513
99 # https://ftp.gnu.org/gnu/unifont/unifont-"$_unifont_ver/unifont-$_unifont_ver".bdf.gz
100 git+https://github.com/ipxe/ipxe.git#commit="$_ipxe_ver"
101 https://github.com/tianocore/edk2/archive/refs/tags/edk2-"$_edk2_ver".zip
102 ventoy-fix-ucs-2-lookup-on-python-3.9.patch::https://github.com/tianocore/edk2/commit/5d864834.patch?full_index=1
103 ventoy-fix-array.array.tostring-removal-in-python-3.9.patch::https://github.com/tianocore/edk2/commit/43bec9ea.patch?full_index=1
104 https://github.com/ventoy/vtoytoolchain/releases/download/1.0/dietlibc-"$_diet_ver".tar.xz
105 dietlibc-headers-fix.patch::https://salsa.debian.org/debian/dietlibc/-/raw/master/debian/patches/bugfixes/newer-linux-headers.diff
106 https://musl.libc.org/releases/musl-"$_musl_ver".tar.gz
107 kernel-headers-musl-"$_kern_hdrs_musl_ver".tar.gz::https://github.com/sabotage-linux/kernel-headers/archive/v"$_kern_hdrs_musl_ver".tar.gz
108 https://github.com/libfuse/libfuse/releases/download/fuse-"$_fuse_ver/fuse-$_fuse_ver".tar.gz
109 exfat-"$_exfat_ver".tar.gz::https://github.com/relan/exfat/archive/refs/tags/v"$_exfat_ver".tar.gz
110 https://github.com/madler/zlib/releases/download/v"$_zlib_ver/zlib-$_zlib_ver".tar.xz
111 squashfs-tools-"$_squash_ver".tar.gz::https://github.com/plougher/squashfs-tools/archive/refs/tags/"$_squash_ver".tar.gz
112 http://vault.centos.org/5.3/os/SRPMS/device-mapper-"$_dm_ver"-2.el5.src.rpm
113 zstd-"$_zstd1_ver".tar.gz::https://github.com/facebook/zstd/archive/refs/tags/v"$_zstd1_ver".tar.gz
114 https://tukaani.org/xz/xz-embedded-"$_xz_embed_ver".tar.gz
115 https://busybox.net/downloads/busybox-"$_busybox_ver".tar.bz2
116 https://mirrors.edge.kernel.org/pub/linux/utils/cryptsetup/v"${_crypt_ver%.*}"/cryptsetup-"$_crypt_ver".tar.xz
117 wimboot-"$_wimboot_ver".tar.gz::https://github.com/ipxe/wimboot/archive/v"$_wimboot_ver".tar.gz
118 wimboot-binutils-2.42-fix.patch
119)
120noextract=(
121 grub-"$_grub_ver".tar.xz
122 edk2-"$_edk2_ver".zip
123 fuse-"$_fuse_ver".tar.gz
124 exfat-"$_exfat_ver".tar.gz
125 zlib-"$_zlib_ver".tar.xz
126 squashfs-tools-"$_squash_ver".tar.gz
127 device-mapper-"$_dm_ver"-2.el5.src.rpm
128 zstd-"$_zstd1_ver".tar.gz
129 xz-embedded-"$_xz_embed_ver".tar.gz
130 busybox-"$_busybox_ver".tar.bz2
131 cryptsetup-"$_crypt_ver".tar.xz
132 wimboot-"$_wimboot_ver".tar.gz
133)
134sha256sums=('f8826dd29afc93ad599cc4840dcac6fa17b60d1ce3e9448dab7c4f4ac693d69c'
135 'e5292496995ad42dabe843a0192cf2a2c502e7ffcc7479398232b10a472df77d'
136 'e6cccc4a958a9fafbb11b05c9bc98612d75b293035d7c47d52588590103a40a0'
137 '5ee49d23d376aeea24269f7605fcaa7fbd326c04cda4e31b8eb7fa15a540ef44'
138 'c6f691aa91afbaab811a369fe729f61d8e5b58bb5ad79a45446c9ee849c1a60b'
139 '032d770f17a92b19e484ef43302cd8eb020d2148c797a65c7e63261960858fa3'
140 'a8d6d84deafb3f9ab95620985556e0ba267481732db8ed66cfadad569512a31c'
141 '7994ad5a63d00446da2e95da1f3f03355b272f096d7eb9830417ab14393b3ace'
142 '313aa962c7f80a02f41758d90d6f67687c77c74a6126b060337f248bc1b637f6'
143 'd585fd3b613c66151fc3249e8ed44f77020cb5e6c1e635a616d3f9f82460512a'
144 'cd70720ccdae889ffb4c4e7764f11b8c26add20d6bde78c0012225d52d38d3cb'
145 'd0e69d5d608cc22ff4843791ad097f554dd32540ddc9bed7638cc6fea7c1b4b5'
146 '689bcb4a639acd2d45e6fa0ff455f7f18edb2421d4f4f42909943775adc0e375'
147 'd7a0654783a4da529d1bb793b7ad9c3318020af77667bcae35f95d0e42a792f3'
148 'a7fa4845e9908523c38d4acf92f8a41fdfcd19def41bd5090d7ad767a6dc75c3'
149 '599a630fdf020282e27c66aa2b4f3d624d731bd150749a8d7b74f544be03b2bb'
150 '197e6ef74da878cbf72844f38461bb18129d144fd5221b3598e973ecda6f5963'
151 '19577e9f68a2d4e08bb5564e3946e35c6323276cb6749c101c86e26505e3bf0e'
152 'c35d87f1d04b2b153d33c275c2632e40d388a88f19a9e71727e0bbbff51fe689'
153 '2b30cd1d0dd606a53ac77b406e1d37798d4b0762fa89de6ea546201906a251bd'
154 '3cf04ca4a5b4466e624570d980638f8ab72feaed9b94106dd6ed2bed674a4cdf'
155 '8121a64145ff317693de80148fbdca6cb73d3f2ed92f66b946949750ab71afe9')
156
157 # Cannot depend on Savannah (cgit) to maintain a stable patch checksum
158 sha256sums[2]='SKIP'
159
160# Some components below are notated as follows:
161#
162# 'HOST' -> a tool that runs on Arch itself. e.g. it might be part of the
163# install routine to set up (install) a Ventoy USB drive. Usually a "normal"
164# x86_64 binary.
165#
166# 'IMG/USB' -> a tool that is "embedded" into a Ventoy USB drive. The tool is
167# stored inside a cpio archive on the ESP and is typically involved in the
168# process of booting ISO's. There will usually be an additional 32-bit binary.
169# These tools are meant to be small and self-contained and are often statically
170# linked against dietlibc or musl.
171
172prepare() {
173 cd Ventoy-$pkgver
174 : "${_DIFF:=0}" # "1" to generate diffs for easier inspection of Ventoy mod's.
175
176 # Create our own INSTALL trees
177 mv -v INSTALL{,.upstream}
178 mv -v IMG/cpio_x86{,.upstream}
179
180 (
181 # Refer "GRUB2/buildgrub.sh"
182 cd GRUB2
183 mkdir -v SRC NBP PXE
184 tar -xf "$srcdir"/grub-$_grub_ver.tar.xz -C SRC
185 cp -av MOD_SRC/grub-$_grub_ver SRC
186
187 if ((_DIFF)); then
188 tar -xf "$srcdir"/grub-$_grub_ver.tar.xz -C SRC --xform "s|\(grub-$_grub_ver\)|\1.orig|"
189 diff -urN SRC/grub-$_grub_ver{.orig,} > ventoy-$pkgver-grub-$_grub_ver.patch || :
190 fi
191
192 # Fix build for newer toolchain.
193 patch -d SRC/grub-$_grub_ver -Np1 -i "$srcdir"/ventoy-grub-fix-build-with-binutils-2.36.patch
194
195 # Tweak font path.
196 sed -i 's|\(/usr/share/fonts/dejavu\)|\1 /usr/share/fonts/TTF|g' SRC/grub-$_grub_ver/configure.ac
197
198 # NOTE: Upstream builds don't include this. Yet they ship their own
199 # {ascii,unicode}.pf2 font files...how are they derived? FIXME
200 # gzip -cd "$srcdir"/unifont-$_unifont_ver.bdf.gz > SRC/grub-$_grub_ver/unifont.bdf
201 )
202
203 (
204 # Refer "IPXE/buildipxe.sh"
205 cd IPXE
206 tar -xf ipxe_org_code/ipxe-$_ipxe_ver.tar.bz2
207 cp -av ipxe_mod_code/ipxe-$_ipxe_ver .
208
209 if ((_DIFF)); then
210 # The bundled tarball has been independently verified as being identical
211 # to a git checkout. But might as well use the git version for comparison.
212 diff -urN -x .git "$srcdir"/ipxe ipxe-$_ipxe_ver > ventoy-$pkgver-ipxe-$_ipxe_ver.patch || :
213 fi
214
215 rm -rfv ipxe-$_ipxe_ver/src/{bin,drivers}
216 )
217
218 (
219 # Refer "EDK2/buildedk.sh"
220 cd EDK2
221 bsdtar -xf "$srcdir"/edk2-$_edk2_ver.zip
222 cp -av edk2_mod/edk2-edk2-$_edk2_ver .
223
224 if ((_DIFF)); then
225 bsdtar -xf "$srcdir"/edk2-$_edk2_ver.zip -s "|edk2-edk2-$_edk2_ver|~.orig|"
226 diff -urN edk2-edk2-$_edk2_ver{.orig,} > ventoy-$pkgver-edk2-$_edk2_ver.patch || :
227 fi
228
229 cd edk2-edk2-$_edk2_ver
230
231 # Remove -Werror for successful build (as per main Arch repo).
232 sed -i 's/ -Werror//g' BaseTools/Conf/*.template BaseTools/Source/C/Makefiles/*.makefile
233
234 # Fix build with newer toolchain.
235 sed -i 's/GCC48/GCC5/' ../build.sh ../build_shim.sh
236 sed -i '/set-section/a \ --set-section-flags .reloc=alloc,load,readonly,data \\' ../build_shim.sh
237 sed -i '/^BUILD_CFLAGS/s/\r$/ -std=gnu11\r/' BaseTools/Source/C/VfrCompile/Pccts/{antlr,dlg}/makefile
238 sed -i -e '/RELEASE_GCC5_IA32_CC_FLAGS/s/\r$/ -std=gnu11\r/' \
239 -e '/RELEASE_GCC5_X64_CC_FLAGS/s/\r$/ -std=gnu11\r/' BaseTools/Conf/tools_def.template
240
241 # Fix build against recent python.
242 patch -Np1 -i "$srcdir"/ventoy-fix-ucs-2-lookup-on-python-3.9.patch
243 patch -Np1 -i "$srcdir"/ventoy-fix-array.array.tostring-removal-in-python-3.9.patch
244 )
245
246 (
247 cd "$srcdir"/dietlibc-$_diet_ver
248
249 # Fix from Debian. Avoid errors when compiling apps against recent kernel headers. FIXME
250 patch -Np1 -i "$srcdir"/dietlibc-headers-fix.patch
251
252 # <cpuid.h> compile fix
253 sed -i 's/__leaf/__LEAF/' include/sys/cdefs.h
254 )
255
256 (
257 cd SQUASHFS
258 if ((_DIFF)); then
259 tar -xf "$srcdir"/squashfs-tools-$_squash_ver.tar.gz --xform "s|\(squashfs-tools-$_squash_ver\)|\1.orig|"
260 diff -urN squashfs-tools-$_squash_ver{.orig,} > ventoy-$pkgver-squashfs-tools-$_squash_ver.patch || :
261 fi
262 )
263
264 (
265 cd Ventoy2Disk
266 if ((_DIFF)); then
267 tar -xf "$srcdir"/xz-embedded-$_xz_embed_ver.tar.gz -C Ventoy2Disk --xform "s|\(xz-embedded-$_xz_embed_ver\)|\1.orig|"
268 diff -urN Ventoy2Disk/xz-embedded-$_xz_embed_ver{.orig,} > ventoy-$pkgver-xz-embedded-$_xz_embed_ver.patch || :
269 fi
270 )
271
272 (
273 cd wimboot
274 # Some *.S files are missing from the bundled source. We will grab them from the tarball.
275 tar -xf "$srcdir"/wimboot-$_wimboot_ver.tar.gz --xform "s|\(wimboot-$_wimboot_ver\)|\1.orig|"
276
277 if ((_DIFF)); then
278 diff -ur wimboot-$_wimboot_ver{.orig,}/src > ventoy-$pkgver-wimboot-$_wimboot_ver.patch || :
279 fi
280
281 # Fix build with recent binutils.
282 cd wimboot-$_wimboot_ver.orig
283 patch -Np1 -i "$srcdir"/wimboot-binutils-2.42-fix.patch
284 )
285}
286
287_build_grub() (
288 echo ":: grub"
289 # Refer "GRUB2/buildgrub.sh"
290 cd Ventoy-$pkgver/GRUB2
291 local _VT_GRUB_DIR=$PWD
292
293 (
294 cd SRC/grub-$_grub_ver
295 ./autogen.sh
296 )
297
298 cp -a SRC/grub-$_grub_ver SRC/grub-x86_64-efi
299 cp -a SRC/grub-$_grub_ver SRC/grub-i386-efi
300 cp -a SRC/grub-$_grub_ver SRC/grub-i386-pc
301
302 mkdir -pv ../INSTALL/{EFI/BOOT,grub/i386-pc}
303 local _conf_args=(--prefix="$_VT_GRUB_DIR"/INSTALL --disable-werror ac_cv_prog_cc_c23=no)
304
305 _build_grub-x86_64-efi() (
306 cd SRC/grub-x86_64-efi
307 CC="gcc -std=gnu11" \
308 ./configure --with-platform=efi "${_conf_args[@]}"
309 make
310 sh install.sh uefi
311 )
312
313 _build_grub-i386-efi() (
314 cd SRC/grub-i386-efi
315 CC="gcc -std=gnu11" TARGET_CC="gcc -std=gnu11" \
316 ./configure --target=i386 --with-platform=efi "${_conf_args[@]}"
317 make
318 sh install.sh i386efi
319 )
320
321 _build_grub-i386-pc() (
322 cd SRC/grub-i386-pc
323 CC="gcc -std=gnu11" TARGET_CC="gcc -std=gnu11" \
324 ./configure --target=i386 --with-platform=pc "${_conf_args[@]}"
325 make
326 sh install.sh
327 )
328
329 _build_grub-x86_64-efi
330 _build_grub-i386-efi
331 _build_grub-i386-pc
332
333 # Copy over the ancillary stuff.
334 local _d
335 for _d in distro fonts help menu themes; do
336 cp -av ../INSTALL.upstream/grub/$_d ../INSTALL/grub
337 done
338 cp -av ../INSTALL.upstream/grub/*.cfg ../INSTALL/grub
339)
340
341_build_ipxe() (
342 echo ":: ipxe"
343 # Refer "IPXE/buildipxe.sh"
344 cd Ventoy-$pkgver/IPXE/ipxe-$_ipxe_ver/src
345
346 make bin/ipxe.lkrn NO_WERROR=1 V=1 CC="gcc -std=gnu11"
347 install -Dv bin/ipxe.lkrn "$srcdir"/Ventoy-$pkgver/INSTALL/ventoy/ipxe.krn
348)
349
350_build_edk2() (
351 echo ":: edk2"
352 # Refer "EDK2/buildedk.sh"
353 cd Ventoy-$pkgver/EDK2
354
355 (
356 cd edk2-edk2-$_edk2_ver
357 make -C BaseTools
358 )
359
360 mkdir -pv ../INSTALL/{ventoy,EFI/BOOT}
361 sh ./build.sh ia32
362 sh ./build.sh
363 sh ./build_shim.sh
364)
365
366_build_dietlibc() (
367 echo ":: dietlibc"
368 # Refer "DOC/installdietlibc.sh"
369 cd dietlibc-$_diet_ver
370 make CC="gcc -std=gnu11"
371 make i386 CC="gcc -std=gnu11"
372)
373
374_build_musl32() (
375 echo ":: musl32"
376 # Refer "DOC/BuildVentoyFromSource.txt" Section 2.3
377 (
378 cd musl-$_musl_ver
379
380 CFLAGS=-m32 \
381 ./configure --prefix="$srcdir"/musl32 --syslibdir="$srcdir"/musl32/lib \
382 --target=i386 --build=i386
383 make
384 make install
385 )
386
387 cd kernel-headers-$_kern_hdrs_musl_ver
388 make ARCH=x86 prefix="$srcdir"/musl32 install
389)
390
391# IMG/USB
392_build_vtoytool() (
393 echo ":: vtoytool"
394 # Refer "VtoyTool/build.sh"
395 cd Ventoy-$pkgver/VtoyTool
396
397 "$srcdir"/dietlibc-$_diet_ver/bin-x86_64/diet -Os gcc -DVTOY_X86_64 -D_FILE_OFFSET_BITS=64 ./*.c BabyISO/*.c \
398 -IBabyISO -Wall -DBUILD_VTOY_TOOL -DUSE_DIET_C -o vtoytool_64
399
400 "$srcdir"/dietlibc-$_diet_ver/bin-i386/diet -Os gcc -DVTOY_I386 -D_FILE_OFFSET_BITS=64 -m32 ./*.c BabyISO/*.c \
401 -IBabyISO -Wall -DBUILD_VTOY_TOOL -DUSE_DIET_C -o vtoytool_32
402
403 strip --strip-all vtoytool_{64,32}
404 rm -rfv vtoytool
405 install -Dvt vtoytool/00 vtoytool_{64,32}
406)
407
408# HOST
409_build_vtoycli() (
410 echo ":: vtoycli"
411 # Refer "vtoycli/fat_io_lib/buildlib.sh" and "vtoycli/build.sh"
412 #
413 # Upstream builds small and static here, but this is a "host" binary so we
414 # don't really need that, nor do we need a 32-bit binary. A "normal" GCC
415 # binary would do. FIXME
416
417 cd Ventoy-$pkgver/vtoycli
418
419 (
420 cd fat_io_lib/release
421 rm -rfv ../{include,lib}
422
423 # GCC-14 build fix
424 sed -i '/fat_cache.h/a #include "fat_format.h"' fat_filelib.c
425
426 musl-gcc -O2 -D_FILE_OFFSET_BITS=64 fat*.c -c
427 ar -rc libfat_io_64.a ./*.o
428 rm -fv ./*.o
429
430 # gcc -m32 -O2 -D_FILE_OFFSET_BITS=64 fat*.c -c
431 # ar -rc libfat_io_32.a ./*.o
432 # rm -fv ./*.o
433
434 mkdir -v ../{include,lib}
435 mv -v ./*.a ../lib/
436 cp -av ./*.h ../include/
437 )
438
439 local _SRCS=(vtoycli.c vtoyfat.c vtoygpt.c crc32.c partresize.c)
440
441 musl-gcc -Os -static -D_FILE_OFFSET_BITS=64 \
442 "${_SRCS[@]}" -Ifat_io_lib/include fat_io_lib/lib/libfat_io_64.a -o vtoycli_64
443
444 # "$srcdir"/dietlibc-$_diet_ver/bin-i386/diet -Os gcc -D_FILE_OFFSET_BITS=64 -m32 \
445 # "${_SRCS[@]}" -Ifat_io_lib/include fat_io_lib/lib/libfat_io_32.a -o vtoycli_32
446
447 strip --strip-all vtoycli_64
448 # strip --strip-all vtoycli_32
449 install -Dv vtoycli_64 ../INSTALL/tool/x86_64/vtoycli
450 # install -Dv vtoycli_32 ../INSTALL/tool/i386/vtoycli
451)
452
453# IMG/USB
454_build_fuseiso() (
455 echo ":: fuseiso"
456 # Refer "FUSEISO/build.sh"
457 cd Ventoy-$pkgver/FUSEISO
458
459 __build_libfuse_static() (
460 # Refer "FUSEISO/build_libfuse.sh"
461 tar -xf "$srcdir"/fuse-$_fuse_ver.tar.gz
462 cd fuse-$_fuse_ver
463 mkdir -v build{64,32}
464
465 local _conf_args=(
466 --disable-shared
467 --disable-util
468 --disable-example
469 CFLAGS=-Os
470 )
471
472 (
473 cd build64
474 CC=musl-gcc \
475 ../configure "${_conf_args[@]}"
476 make V=1
477 )
478
479 (
480 cd build32
481 CC="$srcdir/musl32/bin/musl-gcc -m32" \
482 LDFLAGS="-Wl,-melf_i386" \
483 ../configure "${_conf_args[@]}"
484 make V=1
485 )
486 )
487
488 __build_libfuse_static
489
490 rm -fv vtoy_fuse_iso_*
491
492 musl-gcc -static -O2 -D_FILE_OFFSET_BITS=64 vtoy_fuse_iso.c -Ifuse-$_fuse_ver/include \
493 fuse-$_fuse_ver/build64/lib/.libs/libfuse.a -o vtoy_fuse_iso_64
494
495 "$srcdir"/musl32/bin/musl-gcc -m32 -static -O2 -D_FILE_OFFSET_BITS=64 \
496 vtoy_fuse_iso.c -Ifuse-$_fuse_ver/include -Wl,-melf_i386 \
497 fuse-$_fuse_ver/build32/lib/.libs/libfuse.a -o vtoy_fuse_iso_32
498
499 strip --strip-all vtoy_fuse_iso_{64,32}
500)
501
502# HOST
503_build_exfat() (
504 echo ":: exfat"
505 # Refer "ExFAT/buidexfat.sh"
506 #
507 # This is the FUSE based pkg. The version in the repo "exfat-utils" is going
508 # away in favor of the kernel based "exfatprogs" [1]. Ventoy is apparently not
509 # yet ready for the newer "exfatprogs" tools. Upstream builds want to link
510 # "libfuse.a" statically, however this is a "host" binary so there's no need.
511 # Additionally, Ventoy modifies it slightly with the sed below. Although, it
512 # appears the mod is only applicable to "mount.exfat-fuse" which we don't need
513 # (see below). FIXME
514 #
515 # [1] https://bugs.archlinux.org/task/72629
516
517 cd Ventoy-$pkgver/ExFAT
518
519 tar -xf "$srcdir"/exfat-$_exfat_ver.tar.gz
520 cd exfat-$_exfat_ver
521
522 sed "/printf.*VERSION/a\\\tif (access(\"/etc/initrd-release\", F_OK) >= 0) argv[0][0] = '@';" \
523 -i fuse/main.c
524 autoreconf -i
525 ./configure
526 make
527
528 # NOTE: AFAICT "mount.exfat-fuse" is used only in the LiveCD which is of no use to us.
529 # If it turns out that it is required, a runtime dep on "fuse2" will be needed.
530
531 # strip --strip-all fuse/mount.exfat-fuse
532 strip --strip-all mkfs/mkexfatfs
533
534 # install -Dvt ../../INSTALL/tool/x86_64 fuse/mount.exfat-fuse
535 install -Dvt ../../INSTALL/tool/x86_64 mkfs/mkexfatfs
536)
537
538# IMG/USB
539_build_unsquashfs() (
540 echo ":: unsquashfs"
541 # Refer "SQUASHFS/build.txt"
542 cd Ventoy-$pkgver/SQUASHFS/SRC
543 CFLAGS=-Os
544 local _libdir="$srcdir"/Ventoy-$pkgver/SQUASHFS/LIB
545
546 __build_lz4_static() (
547 # Refer "SQUASHFS/SRC/build_lz4.sh"
548 # The bundled lz4 tarball (ver 1.8.1.2 Jan 2018) has been independently
549 # verified as being identical to the one available on GitHub.
550
551 tar -xf lz4-$_lz4_ver.tar.gz
552 sed -i "s/@\$(CC)/\$(CC)/" lz4-$_lz4_ver/lib/Makefile
553 cp -a lz4-$_lz4_ver{,-32}
554
555 (
556 cd lz4-$_lz4_ver
557 make -C lib
558 make -C lib install PREFIX="$_libdir"/LZ4
559 )
560
561 (
562 cd lz4-$_lz4_ver-32
563 CC="gcc -m32" \
564 make -C lib
565 make -C lib install PREFIX="$_libdir"32/LZ4
566 )
567 )
568
569 __build_xz_static() (
570 # Refer "SQUASHFS/SRC/build_lzma.sh"
571 # The bundled liblzma/xz zip file contents have been independently verified
572 # as being identical to (ver 5.0.4 Jun 2012) available on [1], apart from
573 # the addition of a single file "liblzma-builder.sh".
574 #
575 # [1] https://tukaani.org/xz/old.html
576
577 bsdtar -xf liblzma-master.zip
578 cp -a liblzma-master{,-32}
579
580 local _conf_args=(
581 --disable-shared
582 --disable-xz
583 --disable-xzdec
584 --disable-lzmadec
585 --disable-lzmainfo
586 --enable-small
587 )
588
589 (
590 cd liblzma-master
591 ./configure --prefix="$_libdir"/LZMA "${_conf_args[@]}"
592 make
593 make install
594 )
595
596 (
597 cd liblzma-master-32
598 CC="gcc -m32" \
599 ./configure --prefix="$_libdir"32/LZMA "${_conf_args[@]}"
600 make
601 make install
602 )
603 )
604
605 __build_lzo_static() (
606 # Refer "SQUASHFS/SRC/build_lzo.sh"
607 # The bundled lzo tarball (ver 2.08 Jun 2014) contents have been
608 # independently verified as being identical to the 2.08 tarball available
609 # on [1], apart from a 1 line change in "configure{,.ac}" and a minor change
610 # in "include/lzo/lzodefs.h" but these appear to be tweaks by lzo upstream.
611 #
612 # [1] https://www.oberhumer.com/opensource/lzo/download/lzo-2.08.tar.gz
613
614 tar -xf lzo-$_lzo_ver.tar.gz
615 cp -a lzo-$_lzo_ver{,-32}
616
617 (
618 cd lzo-$_lzo_ver
619 ./configure --prefix="$_libdir"/LZO
620 make V=1
621 make install
622 )
623
624 (
625 cd lzo-$_lzo_ver-32
626 CC="gcc -m32" \
627 ./configure --prefix="$_libdir"32/LZO
628 make V=1
629 make install
630 )
631 )
632
633 __build_zstd_static() (
634 # Refer "SQUASHFS/SRC/build_zstd.sh"
635 # The bundled zstd tarball (ver 1.4.4 Nov 2019) has been independently
636 # verified as being identical to the one available on GitHub.
637
638 tar -xf zstd-$_zstd_ver.tar.gz
639 cp -a zstd-$_zstd_ver{,-32}
640
641 (
642 cd zstd-$_zstd_ver
643 ZSTD_LIB_COMPRESSION=0 make -C lib
644 make -C lib install PREFIX="$_libdir"/ZSTD
645 )
646
647 (
648 cd zstd-$_zstd_ver-32
649 export CC="gcc -m32"
650 ZSTD_LIB_COMPRESSION=0 make -C lib
651 make -C lib install PREFIX="$_libdir"32/ZSTD
652 )
653 )
654
655 __build_zlib_static() (
656 tar -xf "$srcdir"/zlib-$_zlib_ver.tar.xz
657 cp -a zlib-$_zlib_ver{,-32}
658
659 (
660 cd zlib-$_zlib_ver
661 ./configure --static
662 make
663 )
664
665 (
666 cd zlib-$_zlib_ver-32
667 CC="gcc -m32" \
668 ./configure --static
669 make
670 )
671 )
672
673 __build_lz4_static
674 __build_xz_static
675 __build_lzo_static
676 __build_zstd_static
677 __build_zlib_static
678
679 cd "$srcdir"/Ventoy-$pkgver/SQUASHFS
680 unset CFLAGS
681 cp -a squashfs-tools-4.4/squashfs-tools{,-32}
682 rm -fv unsquashfs_*
683
684 (
685 cd squashfs-tools-4.4/squashfs-tools
686 sed -i "s|LIBS) -o|LIBS) ../../SRC/zlib-$_zlib_ver/libz.a -o|" Makefile
687 CC="gcc -std=gnu11" \
688 make unsquashfs LZ4_LIBDIR="$_libdir"/LZ4 LZMA_LIBDIR="$_libdir"/LZMA \
689 LZO_LIBDIR="$_libdir"/LZO ZSTD_LIBDIR="$_libdir"/ZSTD
690
691 strip --strip-all unsquashfs
692 cp -av unsquashfs ../../unsquashfs_64
693 )
694
695 (
696 cd squashfs-tools-4.4/squashfs-tools-32
697 sed -i "s|LIBS) -o|LIBS) ../../SRC/zlib-$_zlib_ver-32/libz.a -o|" Makefile
698 CC="gcc -std=gnu11 -m32" \
699 make unsquashfs LZ4_LIBDIR="$_libdir"32/LZ4 LZMA_LIBDIR="$_libdir"32/LZMA \
700 LZO_LIBDIR="$_libdir"32/LZO ZSTD_LIBDIR="$_libdir"32/ZSTD
701
702 strip --strip-all unsquashfs
703 cp -av unsquashfs ../../unsquashfs_32
704 )
705)
706
707# IMG/USB
708_build_vblade() (
709 echo ":: vblade"
710 # Refer "VBLADE/vblade-master/build.sh"
711 cd Ventoy-$pkgver/VBLADE/vblade-master
712 rm -fv vblade_*
713
714 # Need -fcommon for build to succeed FIXME
715 gcc linux.c aoe.c ata.c bpf.c -Os -o vblade_64 -fcommon
716 gcc linux.c aoe.c ata.c bpf.c -Os -m32 -o vblade_32 -fcommon
717
718 strip --strip-all vblade_{64,32}
719)
720
721# IMG/USB
722_build_dmsetup() (
723 echo ":: dmsetup"
724 # Refer "DMSETUP/build.txt"
725 cd Ventoy-$pkgver/DMSETUP
726 rm -fv dmsetup*
727 bsdtar -O -xvf "$srcdir"/device-mapper*.rpm device-mapper*.tgz | tar -xzf -
728
729 tee -a device-mapper.$_dm_ver/include/configure.h.in > /dev/null << _EOF_
730#ifndef UINT32_MAX
731#define UINT32_MAX (4294967295U)
732#endif
733
734#ifndef UINT64_C
735#define UINT64_C(c) c ## ULL
736#endif
737_EOF_
738
739 # GCC-14 build fixes
740 sed -i '/ctype.h/a #include <strings.h>' device-mapper.$_dm_ver/lib/libdm-report.c
741 sed -i '/langinfo.h/a #include <strings.h>' device-mapper.$_dm_ver/dmsetup/dmsetup.c
742
743 cp -a device-mapper.$_dm_ver{,-32}
744
745 (
746 cd device-mapper.$_dm_ver
747 CC="$srcdir/dietlibc-$_diet_ver/bin-x86_64/diet gcc" \
748 ./configure
749 sed -i '/rpl_malloc/d' include/configure.h
750 make
751 strip --strip-all dmsetup/dmsetup
752 cp -av dmsetup/dmsetup ../dmsetup64
753 )
754
755 (
756 cd device-mapper.$_dm_ver-32
757 CC="$srcdir/dietlibc-$_diet_ver/bin-i386/diet gcc -m32" \
758 ./configure
759 sed -i '/rpl_malloc/d' include/configure.h
760 make
761 strip --strip-all dmsetup/dmsetup
762 cp -av dmsetup/dmsetup ../dmsetup32
763 )
764)
765
766# IMG/USB
767_build_zstdcat() (
768 echo ":: zstdcat"
769 # Refer "ZSTD/build.txt"
770 cd Ventoy-$pkgver/ZSTD
771 rm -fv zstdcat*
772 tar -xf "$srcdir"/zstd-$_zstd1_ver.tar.gz
773 cp -a zstd-$_zstd1_ver{,-32}
774
775 local _compile_opts1=(
776 -I../lib -I../lib/common -I../lib/dictBuilder -I../lib/legacy -Wall -DZSTD_LEGACY_SUPPORT=1
777 ../lib/decompress/zstd_decompress.c -c -o ../lib/decompress/zstd_decompress.o
778 )
779
780 local _compile_opts2=(
781 -I../lib -I../lib/common -I../lib/dictBuilder -I../lib/legacy -Wall -DZSTD_LEGACY_SUPPORT=1
782 ../lib/decompress/zstd_decompress.o ../lib/decompress/huf_decompress.c ../lib/common/entropy_common.c
783 ../lib/common/fse_decompress.c ../lib/common/xxhash.c ../lib/common/zstd_common.c
784 ../lib/compress/zstd_compress.c ../lib/compress/fse_compress.c ../lib/compress/huf_compress.c
785 ../lib/legacy/zstd_v01.c ../lib/legacy/zstd_v02.c ../lib/legacy/zstd_v03.c ../lib/legacy/zstd_v04.c
786 ../lib/legacy/zstd_v05.c ../lib/legacy/zstd_v06.c ../lib/legacy/zstd_v07.c ../lib/dictBuilder/divsufsort.c
787 ../lib/dictBuilder/zdict.c zstdcli.c fileio.c bench.c datagen.c dibio.c -o zstd
788 )
789
790 (
791 cd zstd-$_zstd1_ver/programs
792 "$srcdir"/dietlibc-$_diet_ver/bin-x86_64/diet -Os gcc -pipe -nostdinc -falign-loops=32 "${_compile_opts1[@]}"
793 "$srcdir"/dietlibc-$_diet_ver/bin-x86_64/diet -Os gcc -pipe -nostdinc "${_compile_opts2[@]}"
794 strip --strip-all zstd
795 cp -av zstd ../../zstdcat64
796 )
797
798 (
799 cd zstd-$_zstd1_ver-32/programs
800 "$srcdir"/dietlibc-$_diet_ver/bin-i386/diet -Os gcc -m32 -pipe -nostdinc -falign-loops=32 "${_compile_opts1[@]}"
801 "$srcdir"/dietlibc-$_diet_ver/bin-i386/diet -Os gcc -m32 -pipe -nostdinc "${_compile_opts2[@]}"
802 strip --strip-all zstd
803 cp -av zstd ../../zstdcat
804 )
805
806 install -Dvt ../IMG/cpio_x86/ventoy/tool zstdcat{,64}
807)
808
809# IMG/USB
810_build_xzminidec() (
811 echo ":: xzminidec"
812 # Refer "DOC/BuildVentoyFromSource.txt" Section(s) 4.15 and 4.16
813 cd Ventoy-$pkgver/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace
814
815 make -f ventoy_makefile CC="$srcdir/dietlibc-$_diet_ver/bin-i386/diet gcc -Os -m32 -std=gnu89"
816 mv -v xzminidec{,32}
817 make clean
818 rm -v bytetest.o
819
820 make -f ventoy_makefile CC="$srcdir/dietlibc-$_diet_ver/bin-x86_64/diet gcc -Os -std=gnu89"
821 mv -v xzminidec{,64}
822 make clean
823 rm -v bytetest.o
824
825 make -f ventoy_makefile CC="musl-gcc -Os -static -std=gnu89"
826 mv -v xzminidec{,64_musl}
827 make clean
828 rm -v bytetest.o
829
830 strip --strip-all xzminidec{32,64}*
831 install -Dvt ../../../../IMG/cpio_x86/ventoy/busybox xzminidec{32,64}*
832)
833
834# IMG/USB
835_build_busybox() (
836 echo ":: busybox"
837 # Refer "BUSYBOX/build.txt"
838 cd Ventoy-$pkgver/BUSYBOX
839 mkdir -pv ../IMG/cpio_x86/ventoy/busybox
840
841 (
842 # Refer "BUSYBOX/chmod/build.sh"
843 cd chmod
844 rm -vf vtchmod*{32,64}*
845
846 "$srcdir"/dietlibc-$_diet_ver/bin-x86_64/diet gcc -Os vtchmod.c -o vtchmod64
847 "$srcdir"/dietlibc-$_diet_ver/bin-i386/diet gcc -Os -m32 vtchmod.c -o vtchmod32
848 musl-gcc -Os -static vtchmod.c -o vtchmod64_musl
849 strip --strip-all vtchmod{64,32} vtchmod64_musl
850 cp -avt ../../IMG/cpio_x86/ventoy/busybox vtchmod{64,32} vtchmod64_musl
851 )
852
853 tar -xf "$srcdir"/busybox-$_busybox_ver.tar.bz2
854
855 cp -a busybox-$_busybox_ver{,-xzcat64}
856 cp -a busybox-$_busybox_ver{,-xzcat32}
857 cp -a busybox-$_busybox_ver{,-32}
858
859 (
860 cd busybox-$_busybox_ver-xzcat64
861 cp -av ../x86_64_xzcat.config .config
862 make CC=musl-gcc V=1
863 mv -v busybox xzcat64_musl
864 xz xzcat64_musl
865 cp -avt ../../IMG/cpio_x86/ventoy/busybox xzcat64_musl.xz
866 )
867
868 (
869 cd busybox-$_busybox_ver-xzcat32
870 sed 's/# CONFIG_LFS is not set/CONFIG_LFS=y/' ../x86_64_xzcat.config > .config
871 make CC="$srcdir/musl32/bin/musl-gcc -m32 -Wl,-melf_i386" V=1
872 mv -v busybox xzcat32_musl
873 xz xzcat32_musl
874 cp -avt ../../IMG/cpio_x86/ventoy/busybox xzcat32_musl.xz
875 )
876
877 (
878 cd busybox-$_busybox_ver
879 make defconfig
880 sed -e 's/# CONFIG_STATIC is not set/CONFIG_STATIC=y/' \
881 -e 's/CONFIG_TC=y/# CONFIG_TC is not set/' -i .config
882 make CC=musl-gcc V=1
883 mv -v busybox busybox64
884 xz busybox64
885 cp -avt ../../IMG/cpio_x86/ventoy/busybox busybox64.xz
886 )
887
888 (
889 cd busybox-$_busybox_ver-32
890 make defconfig
891 sed -e 's/# CONFIG_STATIC is not set/CONFIG_STATIC=y/' \
892 -e 's/CONFIG_TC=y/# CONFIG_TC is not set/' -i .config
893 make CC="$srcdir/musl32/bin/musl-gcc -m32 -Wl,-melf_i386" V=1
894 mv -v busybox busybox32
895 xz busybox32
896 cp -avt ../../IMG/cpio_x86/ventoy/busybox busybox32.xz
897 )
898)
899
900# IMG/USB
901_build_lunzip() (
902 echo ":: lunzip"
903 # Refer "DOC/BuildVentoyFromSource.txt" Section 4.19
904 # The bundled lunzip tarball (ver 1.11 Jan 2019) has been independently
905 # verified as being identical to the one available on [1].
906 #
907 # [1] http://download.savannah.gnu.org/releases/lzip/lunzip/
908
909 cd Ventoy-$pkgver/LZIP
910 rm -fv lunzip*{32,64}
911 tar -xf lunzip-$_lunzip_ver.tar.gz
912 cp -a lunzip-$_lunzip_ver{,-32}
913
914 (
915 cd lunzip-$_lunzip_ver
916 ./configure CC="$srcdir/dietlibc-$_diet_ver/bin-x86_64/diet gcc" CFLAGS=-Os
917 make
918 strip --strip-all lunzip
919 cp -av lunzip ../lunzip64
920 )
921
922 (
923 cd lunzip-$_lunzip_ver-32
924 ./configure CC="$srcdir/dietlibc-$_diet_ver/bin-i386/diet gcc -m32" CFLAGS=-Os
925 make
926 strip --strip-all lunzip
927 cp -av lunzip ../lunzip32
928 )
929
930 # Refer "LZIP/buildlz4.txt"
931 rm -fv lz4cat*
932 "$srcdir"/dietlibc-$_diet_ver/bin-x86_64/diet -Os gcc -D_FILE_OFFSET_BITS=64 smallz4cat.c -o lz4cat64
933 strip --strip-all lz4cat64
934 install -Dvt ../IMG/cpio_x86/ventoy/tool lz4cat64
935)
936
937# IMG/USB
938_build_verity() (
939 echo ":: verity"
940 # Refer "cryptsetup/cryptsetup-build.txt"
941 # Needed for *experimental* FydeOS/CloudReady (ChromeOS) support.
942
943 cd Ventoy-$pkgver/cryptsetup
944 tar -xf "$srcdir"/cryptsetup-$_crypt_ver.tar.xz
945 cp -a cryptsetup-$_crypt_ver{,-32}
946
947 # 30 Jun 2024. Ugh, this now fails to build because latest libgcrypt-1.11.0
948 # has removed libgcrypt-config. Just use the upstream provided 64-bit binary
949 # for now. The ChromeOS support is experimental anyway. FIXME
950
951 # (
952 # rm -v veritysetup64
953 # cd cryptsetup-$_crypt_ver
954 # ./configure --enable-static --host=x86_64-pc-linux-gnu
955 # make
956 # cd src
957 # gcc -Wall -O2 -o veritysetup veritysetup-utils_crypt.o veritysetup-utils_loop.o veritysetup-utils_tools.o \
958 # veritysetup-veritysetup.o -lpopt -ldevmapper -lgcrypt -luuid .././lib/.libs/libcryptsetup.a
959 # strip --strip-all veritysetup
960 # cp -av veritysetup ../../veritysetup64
961 # )
962
963 # Ugh, this needs multilib (lib32-e2fsprogs lib32-popt lib32-libgcrypt) and
964 # a 32-bit libdevmapper which doesn't actually exist in the repo. Just use the
965 # upstream provided 32-bit binary for now. FIXME
966
967 # rm -v veritysetup32
968 # cd cryptsetup-$_crypt_ver-32
969 # CC="gcc -m32" \
970 # ./configure --enable-static --host=x86_64-pc-linux-gnu
971 # make
972 # cd src
973 # gcc -m32 -Wall -O2 -o veritysetup veritysetup-utils_crypt.o veritysetup-utils_loop.o veritysetup-utils_tools.o \
974 # veritysetup-veritysetup.o -lpopt -ldevmapper -lgcrypt -luuid .././lib/.libs/libcryptsetup.a
975 # strip --strip-all veritysetup
976 # cp -av veritysetup ../../veritysetup32
977)
978
979# IMG/USB
980_build_wimboot() (
981 echo ":: wimboot"
982 # Refer "wimboot/build.sh"
983 cd Ventoy-$pkgver/wimboot/wimboot-$_wimboot_ver/src
984
985 # Grab the missing *.S files
986 cp -av ../../wimboot-$_wimboot_ver.orig/src/*.S .
987 sed -i '/^CFLAGS/s/ -Werror//' Makefile
988
989 # pesign (if installed) appears to make no difference, ignore.
990 make wimboot.x86_64 wimboot.i386.efi
991 xz wimboot.{x86_64,i386.efi}
992 install -Dvt "$srcdir"/Ventoy-$pkgver/INSTALL/ventoy wimboot.{x86_64,i386.efi}.xz
993)
994
995_pack_ventoy() (
996 echo ":: pack"
997 # Refer "INSTALL/ventoy_pack.sh"
998 # 3RD PARTY BINARIES ALERT! FIXME
999
1000 cd Ventoy-$pkgver
1001 local _LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now,-z,pack-relative-relocs"
1002
1003 (
1004 cd IMG
1005 sed -i '/arm64 #/i exit 0' mkcpio.sh
1006 install -dv cpio_x86/ventoy/{busybox,tool}
1007 cp -avt cpio_x86/ventoy/tool cpio_x86.upstream/ventoy/tool/*.sh
1008
1009 # 32-bit tiny lz4cat binary FIXME
1010 # Refer "DOC/BuildVentoyFromSource.txt" Section 5.1
1011 cp -avt cpio_x86/ventoy/tool cpio_x86.upstream/ventoy/tool/lz4cat
1012
1013 # 32-bit busybox ar binary FIXME
1014 # Refer "DOC/BuildVentoyFromSource.txt" Section 5.2
1015 cp -avt cpio_x86/ventoy/tool cpio_x86.upstream/ventoy/tool/ar
1016
1017 # 32-bit busybox inotifyd binary FIXME
1018 # Refer "DOC/BuildVentoyFromSource.txt" Section 5.3
1019 cp -avt cpio_x86/ventoy/tool cpio_x86.upstream/ventoy/tool/inotifyd
1020
1021 # 32-bit busybox ash binary FIXME
1022 # Refer "DOC/BuildVentoyFromSource.txt" Section 5.4
1023 cp -avt cpio_x86/ventoy/busybox cpio_x86.upstream/ventoy/busybox/ash
1024
1025 # 64-bit busybox ash binary FIXME
1026 # Refer "DOC/BuildVentoyFromSource.txt" Section 4.18
1027 # For some unknown reason this is the only binary built with uclibc.
1028 # Please see: https://github.com/ventoy/Ventoy/issues/2183
1029 cp -avt cpio_x86/ventoy/busybox cpio_x86.upstream/ventoy/busybox/64h
1030
1031 sh mkcpio.sh
1032 install -Dvm 644 -t ../INSTALL/ventoy ventoy.cpio ventoy_x86.cpio
1033
1034 # "IMG/vtloopex" contains pre-compiled binary kernel modules (dm-mod) for
1035 # stuff like LibreELEC, openwrt, etc. FIXME
1036 sh mkloopex.sh
1037 )
1038
1039 (
1040 # "IMG/Unix" contains pre-compiled binary kernel modules (geom_ventoy) for
1041 # various BSD's, FreeBSD, etc. FIXME
1042 cd Unix
1043 sh pack_unix.sh
1044 )
1045
1046 (
1047 # HOST
1048 cd LinuxGUI
1049 sed -i '/dos2unix/d' language.sh
1050 sh language.sh
1051
1052 mkdir -pv ../INSTALL/tool/x86_64
1053
1054 sed -e '/^build.*i386/d;/^build.*aarch64/d;/^build.*mips/d;/^build.*gtk2/d;/^export/d' \
1055 -e "/\$XXLIB/a \ $_LDFLAGS \\\\" \
1056 -e "/VTOY_GUI/s/$/ $_LDFLAGS/" -i.bak build.sh build_gtk.sh
1057 sh build.sh
1058 sh build_gtk.sh
1059
1060 sed -e '/^if.*CentOS8/,+6d;/^build.*aarch64$/d;/^build.*mips64el$/d' \
1061 -e '/QT_INC.*gcc_64/a \ QT_INC_PATH="/usr/include/qt"' \
1062 -e '/QT_LIB.*gcc_64/a \ QT_LIB_PATH="/usr/lib"' \
1063 -e "/LFLAGS.*PATH\"/a \ LFLAGS+=\" $_LDFLAGS\"" -i.bak build_qt.sh
1064 sh build_qt.sh
1065 )
1066
1067 (
1068 # HOST
1069 cd Plugson
1070 sed -e '/^build.*i386/d;/^build.*aarch64/d;/^build.*mips/d' \
1071 -e "/\$XXLIB/a \ $_LDFLAGS \\\\" -i.bak build.sh
1072 sh build.sh
1073 sh pack.sh
1074 )
1075
1076 (
1077 # HOST
1078 # Upstream builds small and static here, but this is a "host" binary so we
1079 # don't really need that. A "normal" GCC binary would do. FIXME
1080 cd Vlnk
1081 local _SRCS=(src/crc32.c src/main_linux.c src/vlnk.c)
1082
1083 musl-gcc -Os -static -D_FILE_OFFSET_BITS=64 "${_SRCS[@]}" -Isrc -o vlnk
1084 strip --strip-all vlnk
1085 install -Dvt ../INSTALL/tool/x86_64 vlnk
1086
1087 sh pack.sh
1088 )
1089
1090 (
1091 cd EfiISO
1092 sed -i 's/-P/-publisher/' mkefiiso.sh
1093 sh mkefiiso.sh
1094 )
1095
1096 # Binary EFI Secure Boot stuff FIXME
1097 # These files are taken from various projects. "?" denotes unverified/unknown origin
1098
1099 local _efi_files=(
1100 BOOTIA32.EFI # shim 32-bit ver 15.6 # SUISBD [1] based on Fedora
1101 BOOTX64.EFI # shim 64-bit ver 16.1 # ? Rocky Linux ?
1102 grubia32.efi # preloader 32-bit # SUISBD [2]
1103 mmia32.efi # MokManager 32-bit ver 15.6 # same length as SUISBD [1] (but 261 bytes differ) based on Fedora
1104 mmx64.efi # MokManager 64-bit ver 16.1 # ? Rocky Linux ?
1105 )
1106
1107 # This file used to be from SUISBD. Since Ventoy 1.1.13+, it is apparently from the Ventoy developer FIXME
1108 install -vm 644 INSTALL.upstream/tool/ENROLL_THIS_KEY_IN_MOKMANAGER.cer INSTALL/tool
1109 (
1110 cd INSTALL.upstream/EFI/BOOT
1111 install -Dvt "$srcdir"/Ventoy-$pkgver/INSTALL/EFI/BOOT "${_efi_files[@]}"
1112 )
1113 # [1] https://github.com/ValdikSS/Super-UEFIinSecureBoot-Disk/releases/download/3-4/Super-UEFIinSecureBoot-Disk_minimal_v3-4.zip
1114 # [2] https://github.com/ValdikSS/Super-UEFIinSecureBoot-Disk/releases/download/3-3/Super-UEFIinSecureBoot-Disk_minimal_v3-3.zip
1115
1116 # Helper script
1117 cp -avt INSTALL/tool INSTALL.upstream/tool/create_ventoy_iso_part_dm.sh
1118
1119 # More EFI stuff. Should be buildable with EDK2 FIXME
1120 # Refer "DOC/BuildVentoyFromSource.txt" Section 4.17
1121 cp -avt INSTALL/ventoy INSTALL.upstream/ventoy/iso9660_{x64,ia32}.efi
1122 cp -avt INSTALL/ventoy INSTALL.upstream/ventoy/udf_{x64,ia32}.efi
1123
1124 # Windows stuff. Apparently buildable with Microsoft Visual Studio FIXME
1125 # Refer "DOC/BuildVentoyFromSource.txt" Section 4.4
1126 cp -avt INSTALL/ventoy INSTALL.upstream/ventoy/vtoyjump{64,32}.exe
1127
1128 # 3rd party Windows stuff FIXME
1129 # Refer "DOC/BuildVentoyFromSource.txt" Section(s) 5.12 and 5.8
1130 cp -avt INSTALL/ventoy INSTALL.upstream/ventoy/7z
1131 cp -avt INSTALL/ventoy INSTALL.upstream/ventoy/imdisk
1132
1133 # Unknown Windows crap. Config data for Windows Boot Manager? Where from? FIXME
1134 cp -avt INSTALL/ventoy INSTALL.upstream/ventoy/common_{bcd,bootmgr}.xz
1135
1136 # From syslinux. Could we use our own repo version? FIXME
1137 # Refer "DOC/BuildVentoyFromSource.txt" Section 5.9
1138 cp -avt INSTALL/ventoy INSTALL.upstream/ventoy/memdisk
1139
1140 # DragonFly BSD stuff FIXME
1141 # Refer "Unix/ventoy_unix/DragonFly/mkinitrd.sh"
1142 cp -avt INSTALL/ventoy INSTALL.upstream/ventoy/dragonfly.mfs.xz
1143)
1144
1145_create_img() (
1146 echo ":: image"
1147 # Refer "INSTALL/ventoy_pack.sh"
1148 mkdir -pv Ventoy-$pkgver/INSTALL
1149 cd Ventoy-$pkgver/INSTALL
1150
1151 # Create a 256M Ventoy disk image, partition/format a 32M ESP
1152 dd if=/dev/zero of=img.bin bs=1M count=256 status=none
1153 echo -e 'size=223M, type=7, bootable\n size=32M, type=U\n' | sfdisk img.bin
1154 guestfish add img.bin : run : mkfs vfat /dev/sda2 label:VTOYEFI
1155
1156 # Create a 64M "scratch" disk image / ext4 partition
1157 dd if=/dev/zero of=scratch.bin bs=1M count=64 status=none
1158 echo -e 'size=+\n' | sfdisk scratch.bin
1159 guestfish add scratch.bin : run : mkfs ext4 /dev/sda1 label:SCRATCH
1160
1161 # Copy our GRUB stuff into the scratch disk
1162 tar -czvf - -C "$srcdir"/Ventoy-$pkgver/INSTALL grub/i386-pc |
1163 guestfish add scratch.bin : run : mount /dev/sda1 / : tar-in - / compress:gzip
1164 tar -czvf - -C "$srcdir"/Ventoy-$pkgver/GRUB2 INSTALL |
1165 guestfish add scratch.bin : run : mount /dev/sda1 / : tar-in - / compress:gzip
1166
1167 # Do the GRUB install business
1168 #
1169 # XXX (ab)using `guestfish debug sh "args ..."' like this is a dirty hack. FIXME. Pls see:
1170 # https://www.libguestfs.org/guestfs-faq.1.html#whats-the-difference-between-guestfish-and-virt-rescue
1171 #
1172 # We should be using `guestfish sh command' or maybe `guestfish command "args ..."' but we
1173 # cannot do so because we don't have a proper guest filesystem.
1174 # https://www.libguestfs.org/guestfish.1.html#sh
1175 # https://www.libguestfs.org/guestfish.1.html#command
1176 #
1177 # Possible alternative for a guest image -> Arch Boxes basic qcow2...or maybe we just don't
1178 # use guestfish here at all and instead use something like [1] with an Arch ISO.
1179 #
1180 # [1] https://gitlab.archlinux.org/archlinux/ci-scripts/-/blob/master/scripts/build_in_archiso_vm.sh
1181
1182 guestfish add img.bin : add scratch.bin : run : mount /dev/sdb1 / : debug sh \
1183 "/sysroot/INSTALL/sbin/grub-bios-setup --skip-fs-probe --directory=/sysroot/grub/i386-pc /dev/sda"
1184
1185 (
1186 cd grub
1187 tar -czf help.tar.gz help
1188 rm -rf help
1189
1190 vtlangtitle=$(grep VTLANG_LANGUAGE_NAME menu/zh_CN.json | awk -F\" '{print $4}')
1191 {
1192 echo "menuentry \"zh_CN - $vtlangtitle\" --class=menu_lang_item --class=debug_menu_lang --class=F5tool {"
1193 echo " vt_load_menu_lang zh_CN"
1194 echo "}"
1195 } >> menulang.cfg
1196
1197 # shellcheck disable=SC2010 # FIXME
1198 ls -1 menu | grep -v 'zh_CN' | sort | while read -r vtlang; do
1199 vtlangname=${vtlang%.*}
1200 vtlangtitle=$(grep VTLANG_LANGUAGE_NAME menu/"$vtlang" | awk -F\" '{print $4}')
1201 {
1202 echo "menuentry \"$vtlangname - $vtlangtitle\" --class=menu_lang_item --class=debug_menu_lang --class=F5tool {"
1203 echo " vt_load_menu_lang $vtlangname"
1204 echo "}"
1205 } >> menulang.cfg
1206 done
1207
1208 {
1209 echo "menuentry \"\$VTLANG_RETURN_PREVIOUS\" --class=vtoyret VTOY_RET {"
1210 echo " echo \"Return ...\""
1211 echo "}"
1212 } >> menulang.cfg
1213
1214 tar -czf menu.tar.gz menu
1215 rm -rf menu
1216
1217 rm -fv i386-pc/*.img
1218 )
1219
1220 # Apparently grub.cfg needs to be located at the front of the partition, copy it first..
1221 guestfish add img.bin : run : mount /dev/sda2 / : mkdir /grub : copy-in grub/grub.cfg /grub
1222
1223 # ..and now the rest
1224 tar -czvf - --exclude=grub.cfg -C grub . |
1225 guestfish add img.bin : run : mount /dev/sda2 / : tar-in - /grub compress:gzip
1226 tar -czvf - ventoy EFI |
1227 guestfish add img.bin : run : mount /dev/sda2 / : tar-in - / compress:gzip
1228 guestfish add img.bin : run : mount /dev/sda2 / : copy-in tool/ENROLL_THIS_KEY_IN_MOKMANAGER.cer / : \
1229 mkdir /tool : copy-in tool/create_ventoy_iso_part_dm.sh /tool
1230
1231 # Just *WTF* is going on here? FIXME
1232 dd status=none bs=1024 count=16 if=/dev/zero of=/tmp/mount.exfat-fuse_aarch64
1233 guestfish add img.bin : run : mount /dev/sda2 / : copy-in /tmp/mount.exfat-fuse_aarch64 /tool
1234
1235 # Prepare the final "payload" dir
1236 curver=$(grep 'set.*VENTOY_VERSION=' ./grub/grub.cfg | awk -F'"' '{print $2}')
1237 tmpdir=ventoy-$curver
1238
1239 mkdir -pv "$tmpdir"/{boot,ventoy}
1240 echo "$curver" > "$tmpdir"/ventoy/version
1241 dd if=img.bin of="$tmpdir"/boot/boot.img bs=1 count=512 status=none
1242 dd if=img.bin of="$tmpdir"/boot/core.img bs=512 count=2047 skip=1 status=none
1243 xz --check=crc32 "$tmpdir"/boot/core.img
1244
1245 cp -avt "$tmpdir" tool ../INSTALL.upstream/plugin ../LinuxGUI/WebUI
1246 sed -i 's/.*SCRIPT_DEL_THIS \(.*\)/\1/g' "$tmpdir"/WebUI/index.html
1247
1248 cp -avt "$tmpdir"/tool \
1249 ../INSTALL.upstream/tool/{distro_gui_type.json,VentoyGTK.glade,ventoy_lib.sh,VentoyWorker.sh}
1250
1251 cp -avt "$tmpdir" VentoyGUI.x86_64 VentoyVlnk.sh \
1252 ../INSTALL.upstream/{Ventoy2Disk,VentoyWeb,VentoyPlugson,CreatePersistentImg,ExtendPersistentImg}.sh
1253
1254 # 32MB ESP image
1255 dd status=none if=img.bin of="$tmpdir"/ventoy/ventoy.disk.img bs=512 count=65536 skip=458752
1256 xz --check=crc32 "$tmpdir"/ventoy/ventoy.disk.img
1257
1258 chmod -v +x "$tmpdir"{,/tool}/*.sh
1259 cp -avt "$tmpdir"/tool ../LANGUAGES/languages.json
1260
1261 # Fix ups
1262 sed -e 's|./log.txt|/var/log/ventoy.log|' \
1263 -e "/^vtdebug()/a \ test -w /var/log && \\\\" -i "$tmpdir"/{Ventoy2Disk,tool/ventoy_lib}.sh
1264
1265 sed -i 's|log.txt|/var/log/ventoy.log|' "$tmpdir/"WebUI/static/js/languages.js \
1266 "$tmpdir"/tool/{languages.json,VentoyWorker.sh} "$tmpdir"/VentoyWeb.sh
1267
1268 sed -e '/^chmod/d' -e '/^echo.*decompress/d' \
1269 -e '/^echo.*2D/s|^|test -w /var/log \&\& |' \
1270 -e '/^date/s|^|test -w /var/log \&\& |' -i "$tmpdir"/Ventoy2Disk.sh
1271
1272 sed -e 's|#!/bin/sh|#!/usr/bin/env bash|' -i "$tmpdir"/tool/{VentoyWorker.sh,ventoy_lib.sh}
1273)
1274
1275build() {
1276 _build_grub
1277 _build_ipxe
1278 _build_edk2
1279 _build_dietlibc
1280 _build_musl32
1281 _build_vtoytool
1282 _build_vtoycli
1283 _build_fuseiso
1284 _build_exfat
1285 _build_unsquashfs
1286 _build_vblade
1287 _build_dmsetup
1288 _build_zstdcat
1289 _build_xzminidec
1290 _build_busybox
1291 _build_lunzip
1292 _build_verity
1293 _build_wimboot
1294 _pack_ventoy
1295 _create_img
1296}
1297
1298package() {
1299 mkdir -pv "$pkgdir"/{opt,usr/{bin,share/{applications,pixmaps}}}
1300
1301 cp -arv Ventoy-$pkgver/INSTALL/ventoy-$pkgver "$pkgdir"/opt/ventoy
1302
1303 # Everything below this line -> Credits: https://aur.archlinux.org/packages/ventoy-bin
1304 tee "$pkgdir"/usr/bin/ventoy > /dev/null << _EOF_
1305#!/bin/sh
1306
1307cd /opt/ventoy || exit 1
1308exec ./Ventoy2Disk.sh "\$@"
1309_EOF_
1310
1311 tee "$pkgdir"/usr/bin/ventoygui > /dev/null << _EOF_
1312#!/bin/sh
1313
1314cd /opt/ventoy || exit 1
1315./VentoyGUI.x86_64 "\$@"
1316_EOF_
1317
1318 tee "$pkgdir"/usr/bin/ventoyplugson > /dev/null << _EOF_
1319#!/bin/sh
1320
1321cd /opt/ventoy || exit 1
1322exec ./VentoyPlugson.sh "\$@"
1323_EOF_
1324
1325 tee "$pkgdir"/usr/bin/ventoyweb > /dev/null << _EOF_
1326#!/bin/sh
1327
1328cd /opt/ventoy || exit 1
1329exec ./VentoyWeb.sh "\$@"
1330_EOF_
1331
1332 tee "$pkgdir"/usr/bin/ventoy-persistent > /dev/null << _EOF_
1333#!/bin/sh
1334
1335exec /opt/ventoy/CreatePersistentImg.sh "\$@"
1336_EOF_
1337
1338 tee "$pkgdir"/usr/bin/ventoy-extend-persistent > /dev/null << _EOF_
1339#!/bin/sh
1340
1341exec /opt/ventoy/ExtendPersistentImg.sh "\$@"
1342_EOF_
1343
1344 tee "$pkgdir"/usr/share/applications/ventoy.desktop > /dev/null << _EOF_
1345[Desktop Entry]
1346Type=Application
1347Icon=ventoy
1348Name=Ventoy
1349Exec=ventoygui --xdg
1350Terminal=false
1351Hidden=false
1352Categories=Utility
1353Comment=Ventoy2Disk GUI
1354_EOF_
1355
1356 chmod -v 755 "$pkgdir"/usr/bin/*
1357 cp -av Ventoy-$pkgver/LinuxGUI/WebUI/static/img/VentoyLogo.png "$pkgdir"/usr/share/pixmaps/ventoy.png
1358}
1359

Changes since previous scan

--- PKGBUILD @ 2026-07-26 00:07
+++ PKGBUILD @ 2026-08-03 00:08
@@ -35,7 +35,7 @@
# shellcheck disable=SC1003,SC2034,SC2154,SC2164
pkgname=ventoy
-pkgver=1.1.16
+pkgver=1.1.17
_grub_ver=2.04 # (Jul 2019)
#_unifont_ver=15.0.01 # FIXME see NOTE below
_ipxe_ver=3fe683e # (Sep 29 2019)
@@ -131,7 +131,7 @@
cryptsetup-"$_crypt_ver".tar.xz
wimboot-"$_wimboot_ver".tar.gz
)
-sha256sums=('6f82ce5c9c2a8d51cb6fc65714c4e8c9c271826fae7246a7b0cbf783d92c383a'
+sha256sums=('f8826dd29afc93ad599cc4840dcac6fa17b60d1ce3e9448dab7c4f4ac693d69c'
'e5292496995ad42dabe843a0192cf2a2c502e7ffcc7479398232b10a472df77d'
'e6cccc4a958a9fafbb11b05c9bc98612d75b293035d7c47d52588590103a40a0'
'5ee49d23d376aeea24269f7605fcaa7fbd326c04cda4e31b8eb7fa15a540ef44'

Scan history

Scanned at (UTC)SeverityRules
2026-08-03 00:08:14 LOW 2
2026-08-02 00:16:08 LOW 2
2026-08-01 00:11:18 LOW 2
2026-07-31 00:14:10 LOW 2
2026-07-30 00:17:23 LOW 2
2026-07-29 00:25:53 LOW 2
2026-07-28 00:07:28 LOW 2
2026-07-27 00:24:32 LOW 2
2026-07-26 01:31:24 MEDIUM 1
2026-07-26 00:07:32 LOW 2
2026-07-25 00:13:44 LOW 2
2026-07-24 00:02:28 LOW 2
2026-07-23 00:14:47 LOW 2
2026-07-22 00:29:32 LOW 2
2026-07-21 00:24:15 LOW 2
2026-07-20 00:19:49 LOW 2
2026-07-19 00:17:08 LOW 2
2026-07-18 00:14:48 LOW 2
2026-07-17 00:06:16 LOW 2
2026-07-16 00:05:41 LOW 2

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion