]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - DOC/BuildVentoyFromSource.txt
1.1.06 release
[Ventoy.git] / DOC / BuildVentoyFromSource.txt
1
2 ==========================================
3 1. Compile Environment
4 ==========================================
5 My build environment is CentOS 7.8 x86_64. So here I first explain how to create the build environment from scratch.
6 Ventoy is based on many open source projects, so the build environment is important. I suggest you first test it on a virtual machine.
7
8 1.1 Install CentOS 7.8
9 I use CentOS-7-x86_64-Everything-2003.iso and select Minimal install
10
11 1.2 Install Packages
12 yum install \
13 libXpm net-tools bzip2 wget vim gcc gcc-c++ samba dos2unix glibc-devel glibc.i686 glibc-devel.i686 \
14 mpfr.i686 mpfr-devel.i686 zlib.i686 rsync autogen autoconf automake libtool gettext* bison binutils \
15 flex device-mapper-devel SDL libpciaccess libusb freetype freetype-devel gnu-free-* qemu-* virt-* \
16 libvirt* vte* NetworkManager-bluetooth brlapi fuse-devel dejavu* gnu-efi* pesign shim \
17 iscsi-initiator-utils grub2-tools zip nasm acpica-tools glibc-static zlib-static xorriso
18
19
20
21 ==========================================
22 2. Download Source Code
23 ==========================================
24 2.1 Download Ventoy source code from GitHub and decompress it.
25 Next I assume that you have unzipped the code into the /home directory (check /home/Ventoy-master/README.md file for the directory layout).
26
27 2.2 Download third-party source code and tool
28
29 https://www.fefe.de/dietlibc/dietlibc-0.34.tar.xz ===> /home/Ventoy-master/DOC/dietlibc-0.34.tar.xz
30 https://musl.libc.org/releases/musl-1.2.1.tar.gz ===> /home/Ventoy-master/DOC/musl-1.2.1.tar.gz
31 https://ftp.gnu.org/gnu/grub/grub-2.04.tar.xz ===> /home/Ventoy-master/GRUB2/grub-2.04.tar.xz
32 https://codeload.github.com/tianocore/edk2/zip/edk2-stable201911 ===> /home/Ventoy-master/EDK2/edk2-edk2-stable201911.zip
33 https://codeload.github.com/relan/exfat/zip/v1.3.0 ===> /home/Ventoy-master/ExFAT/exfat-1.3.0.zip
34 https://codeload.github.com/libfuse/libfuse/zip/fuse-2.9.9 ===> /home/Ventoy-master/ExFAT/libfuse-fuse-2.9.9.zip
35 https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz ===> /opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz
36 https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--uclibc--stable-2020.08-1.tar.bz2 ===> /opt/aarch64--uclibc--stable-2020.08-1.tar.bz2
37 https://github.com/ventoy/vtoytoolchain/releases/download/1.0/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz ===> /opt/mips-loongson-gcc7.3-2019.06-29-linux-gnu.tar.gz
38 https://github.com/ventoy/musl-cross-make/releases/download/latest/output.tar.bz2 ===> /opt/output.tar.bz2
39
40
41 http://www.tinycorelinux.net/11.x/x86_64/release/distribution_files/vmlinuz64 ===> /home/Ventoy-master/LiveCD/ISO/EFI/boot/vmlinuz64
42 http://www.tinycorelinux.net/11.x/x86_64/release/distribution_files/corepure64.gz ===> /home/Ventoy-master/LiveCD/ISO/EFI/boot/corepure64.gz
43 http://www.tinycorelinux.net/11.x/x86_64/release/distribution_files/modules64.gz ===> /home/Ventoy-master/LiveCD/ISO/EFI/boot/modules64.gz
44
45 2.3 Prepare third-party tools
46 cd /home/Ventoy-master/DOC/
47 tar xf musl-1.2.1.tar.gz
48 cd musl-1.2.1
49 ./configure && make install
50
51 tar xf /opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz -C /opt
52 tar xf /opt/aarch64--uclibc--stable-2020.08-1.tar.bz2 -C /opt
53 tar xf /opt/output.tar.bz2 -C /opt
54 mv /opt/output /opt/mips64el-linux-musl-gcc730
55
56
57 2.4 Set PATH environment
58 export PATH=$PATH:/opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu/bin:/opt/aarch64--uclibc--stable-2020.08-1/bin:/opt/mips64el-linux-musl-gcc730/bin
59 better to add this line to /root/.bashrc and relogin as root
60
61
62 ==========================================
63 3. All in one script
64 ==========================================
65 I have made an all-in-one script `all_in_one.sh`. You can run this script to build and pack ventoy.
66 If you want to compile a certain part separately, you can continue to refer to the later chapters of this text.
67
68 cd /home/Ventoy-master/INSTALL
69 sh all_in_one.sh
70
71 It should be noted that:
72 1. Only grub2/EDK2/IPXE will be recompiled in all_in_one.sh. Other parts contain binaries and are rarely modified, so will not be recompiled everytime.
73 You can rebuild these parts separately if you want.
74
75 2. Some parts of Ventoy have a 32-bit and 64-bit version (like 4.9, 4.10, 4.11 follows)
76 all_in_one.sh only builds the 64bit version of them. If you want to rebuild the 32bit verison, you should create a 32-bit CentOS environment and build them.
77 Fortunately these parts are rarely modified, so you only need to build once or you can directly use the binaries I have built.
78
79 Besides, after a full compile and packaging, you can only build the part you modified (for example grub2) and run ventoy_pack.sh to generate the package.
80
81 ==========================================
82 4. Build every part of Ventoy
83 ==========================================
84 4.1 == Build grub2 ==
85 cd /home/Ventoy-master/GRUB2
86 sh buildgrub.sh
87
88 4.2 == Build ipxe.krn ==
89 cd /home/Ventoy-master/IPXE
90 sh buildipxe.sh
91
92 4.3 == Build Ventoy2Disk.exe ==
93 Ventoy2Disk.exe is the installer in Windows platform. And it must be built in Windows with Microsoft Visual Studio (2013+).
94 Open /home/Ventoy-master/Ventoy2Disk/Ventoy2Disk.sln with Visual Studio and build it.
95
96 4.4 == Build vtoyjump64.exe/vtoyjump32.exe ==
97 vtoyjump64.exe/vtoyjump32.exe is used to mount iso file in windows PE. You should install Microsoft Visual Studio (2013+) to build it.
98 Open /home/Ventoy-master/vtoyjump/vtoyjump.sln with Visual Studio and build it (64&32).
99
100 4.5 == Build dmsetup ==
101 Please refer to DMSETUP/build.txt
102
103 4.6 == Build ventoy_x64.efi ==
104 cd /home/Ventoy-master/EDK2
105 sh buildedk.sh
106
107 4.7 == Build VtoyTool ==
108 cd /home/Ventoy-master/VtoyTool
109 sh build.sh
110
111 4.8 == Build vtoycli ==
112 cd /home/Ventoy-master/vtoycli/fat_io_lib
113 sh buildlib.sh
114 cd /home/Ventoy-master/vtoycli
115 sh build.sh
116
117 4.9 == Build exfat-util ==
118 cd /home/Ventoy-master/ExFAT
119 sh buidlibfuse.sh
120 sh buidexfat.sh
121
122 After that, copy EXFAT/shared/mkexfatfs ===> /home/Ventoy-master/INSTALL/tool/mkexfatfs_64
123 After that, copy EXFAT/shared/mount.exfat-fuse ===> /home/Ventoy-master/INSTALL/tool/mount.exfat-fuse_64
124
125 Use the same build step to build exfat-util 32-bit in a 32-bit CentOS system and get mkexfatfs_32 and mount.exfat-fuse_32
126
127 4.10 == Build vtoy_fuse_iso_64/vtoy_fuse_iso_32 ==
128 cd /home/Ventoy-master/FUSEISO
129 sh build_libfuse.sh
130 sh build.sh
131
132 Use the same build step to build in a 32-bit CentOS system and get vtoy_fuse_iso_32
133
134 4.11 == Build unsquashfs_64/unsquashfs_32 ==
135 cd /home/Ventoy-master/SQUASHFS/SRC
136 sh build_lz4.sh
137 sh build_lzma.sh
138 sh build_lzo.sh
139 sh build_zstd.sh
140
141 cd /home/Ventoy-master/SQUASHFS/squashfs-tools-4.4/squashfs-tools
142 sh build.sh
143
144 Use the same build step to build in a 32-bit CentOS system and get unsquashfs_32
145
146 4.12 == Build vblade_64/vblade_32 ==
147 cd /home/Ventoy-master/VBLADE/vblade-master
148 sh build.sh
149
150 4.13 == Build zstdcat ==
151 Please refer to ZSTD/build.txt
152
153 4.14 == Build vtoy_gen_uuid ==
154 cd /home/Ventoy-master/GenUUID
155 sh build.sh
156
157 4.15 == Build xzminidec32 ==
158 cd /home/Ventoy-master/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace
159 make -f ventoy_makefile
160 strip --strip-all xzminidec
161
162 4.16 == Build xzminidec64/xzminidec64_musl ==
163 cd /home/Ventoy-master/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace
164 make -f ventoy_makefile64 or make -f ventoy_makefile64_musl
165 strip --strip-all xzminidec
166
167 4.17 == Build iso9660_x64.efi/udf_x64.efi/iso9660_ia32.efi/udf_ia32.efi/iso9660_aa64.efi/udf_aa64.efi/ ==
168 This efi driver is from https://github.com/pbatard/efifs
169 Follow all the build instructions in this project. I modified 3 files (the original and modified source are at /home/Ventoy-master/EDK2/efiffs)
170
171 4.18 IMG/cpio/ventoy/busybox/64h
172 https://www.uclibc.org/downloads/binaries/0.9.30.1/mini-native-x86_64.tar.bz2
173 https://busybox.net/downloads/busybox-1.32.0.tar.bz2
174 use BUSYBOX/x86_64_ash.config and uclibc to build busybox-1.32
175
176 4.19 == Build lunzip32/lunzip64 ==
177 http://mirror.yongbok.net/nongnu/lzip/lunzip/lunzip-1.11.tar.gz
178 PATH=$PATH:/opt/diet/bin
179 ./configure --disable-nls CC='diet gcc -nostdinc'
180 make
181 strip --strip-all lunzip
182
183 #aarch64
184 ./configure --disable-nls CC='aarch64-buildroot-linux-uclibc-gcc -static'
185 make
186 aarch64-buildroot-linux-uclibc-strip --strip-all lunzip
187
188 4.17 == Build xzminidecaa64 ==
189 cd /home/Ventoy-master/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace
190 make -f ventoy_makefileaa64
191 strip --strip-all xzminidec
192
193 4.18 == Build xzminidecm64e ==
194 cd /home/Ventoy-master/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace
195 make -f ventoy_makefilem64e
196 strip --strip-all xzminidec
197
198
199
200 ==========================================
201 5. Binaries
202 ==========================================
203 There some binaries in Ventoy install package. These files are downloaded from other open source project's website, such as busybox.
204 Here is the list of the binaries, their SHA-256 and the download urls:
205
206 5.1 IMG/cpio/ventoy/tool/lz4cat
207 https://create.stephan-brumme.com/smallz4 smallz4cat-x32-v1.4
208 SHA-256: 13d293ddeedb469f51da41167f79b2cbdb904e681716f6e6191b233dbb162438
209
210 5.2 IMG/cpio/ventoy/tool/ar
211 https://busybox.net/downloads/binaries/1.30.0-i686 busybox_AR
212 SHA-256: f29b7d81a983c0c85d22496f4a833c18f2528a1b666eb7d47c93084c1ed66ae0
213
214 5.3 IMG/cpio/ventoy/tool/inotifyd
215 https://busybox.net/downloads/binaries/1.30.0-i686 busybox_INOTIFYD
216 SHA-256: 3532162a8695e91a1ed9ddea28b2cb22259a90e93d5d9c4a517b6c36842c686f
217
218 5.4 IMG/cpio/ventoy/busybox/ash
219 https://busybox.net/downloads/binaries/1.27.1-i686 busybox_ASH
220 SHA-256: 44a6274bca580c2758ffc173fc76d18bb855b1fe8dcf70efd9ee75cbd57dee97
221
222 5.5 IMG/cpio/ventoy/busybox/tmpxz
223 https://busybox.net/downloads/binaries/1.27.1-i686 busybox_XZ
224 SHA-256: f6cdb6293680424c29b89bde0685ca27f455166c9b302cd6082ef90681456291
225
226 5.6 INSTALL/tool/i386/xzcat
227 https://busybox.net/downloads/binaries/1.30.0-i686/ busybox_XZCAT
228 SHA-256: 7399db642c2beaf52a16ab5264ffc55cfd1ff5699a524f63e5d48edf84e20f44
229
230 5.7 INSTALL/tool/i386/hexdump
231 https://busybox.net/downloads/binaries/1.30.0-i686/ busybox_HEXDUMP
232 SHA-256: cde08b6a2cf5ad914f05203e18e3f7c2ed6060a63604e3d75536f19b55e8e0af
233
234 5.8 imdisk
235 download http://www.ltr-data.se/files/imdiskinst.exe and extract it by 7zip.
236
237 INSTALL/ventoy/imdisk/64/imdisk.sys --> sys/amd64/imdisk.sys SHA-256: 6702202220268787e361f5a82dae53362c8e6c6dcd240bb01b44dd77ae0788da
238 INSTALL/ventoy/imdisk/64/imdisk.exe --> cli/amd64/imdisk.exe SHA-256: 9759175380af836869443e5f21ce2e33022125d154bc6b3d1c04dc36b190de04
239 INSTALL/ventoy/imdisk/64/imdisk.cpl --> cpl/amd64/imdisk.cpl SHA-256: aea2ebbea2b073c947263744962af8a3eab025ff4c9d825c543e380e738a4c99
240
241 INSTALL/ventoy/imdisk/32/imdisk.sys --> sys/i386/imdisk.sys SHA-256: a94caec2f71a924d6a914c093ad4b905d7cfdea3f515ed48aaa8c3950b2dc191
242 INSTALL/ventoy/imdisk/32/imdisk.exe --> cli/i386/imdisk.exe SHA-256: 33b53858e2139704cf603b115a3e5e1dfd4daeaaed4d3e03c633f2df3b55dbaa
243 INSTALL/ventoy/imdisk/32/imdisk.cpl --> cpl/i386/imdisk.cpl SHA-256: b781d3e2d286ac8bf548f44e50cbbb3fe78203296e41e4d2e73b407668f88f2d
244
245 5.9 INSTALL/ventoy/memdisk
246 https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.gz
247 decompress it and memdisk is at syslinux-6.03/bios/memdisk/memdisk
248 SHA-256: 3f6cd656b8a14109cd3f906fee2dd2e75418f983a5e1bfdb64f44f7765588cbb
249
250
251 5.10 UEFIinSecureBoot
252 https://github.com/ValdikSS/Super-UEFIinSecureBoot-Disk/releases Super-UEFIinSecureBoot-Disk_minimal_v3.zip
253 unzip it and get Super-UEFIinSecureBoot-Disk_minimal.img, extract the img by 7zip.
254
255 INSTALL/EFI/BOOT/BOOTX64.EFI --> EFI/BOOT/BOOTX64.EFI SHA-256: 475552c7476ad45e42344eee8b30d44c264d200ac2468428aa86fc8795fb6e34
256 INSTALL/EFI/BOOT/grubx64.efi --> EFI/BOOT/grubx64.efi SHA-256: 25d858157349dc52fa70f3cdf5c62fe1e0bae37ddfc3a6b6528af9a3c745775f
257 INSTALL/EFI/BOOT/MokManager.efi --> EFI/BOOT/MokManager.efi SHA-256: 3bf1f46cee0832355c7dd1dba880dea9bcaa78cc44375a1559d43bc9db18933b
258
259
260 5.11 INSTALL/tool/ash
261 https://busybox.net/downloads/binaries/1.31.0-i686-uclibc/ busybox_ASH
262 SHA-256: 2943f02f85fee0c9551aec47110a558a73f919c032b3c51e56d6f197b5ec4d7b
263
264 5.12 7za.exe
265 download from https://www.7-zip.org/a/7z1900-extra.7z
266 ISNTALL/ventoy/7z/64/7za.exe SHA-256: 8117e40ee7f824f63373a4f5625bb62749f69159d0c449b3ce2f35aad3b83549
267 ISNTALL/ventoy/7z/32/7za.exe SHA-256: ea308c76a2f927b160a143d94072b0dce232e04b751f0c6432a94e05164e716d
268
269 5.13 ./Ventoy/Unix/ventoy_unix/DragonFly/sbin/dmsetup
270 download from https://cdimage.debian.org/mirror/dragonflybsd.org/iso-images/dfly-x86_64-5.8.3_REL.iso.bz2
271 extract from the ISO file sbin/dmsetup
272 dmsetup SHA-256: bedcf26650e87edfe961e33bae20d832bce73efd4b6239f9a6a5785661e4e698
273
274 5.14 ./LiveCD/ISO/EFI/boot/vmlinuz64
275 download from http://www.tinycorelinux.net/11.x/x86_64/archive/11.0/distribution_files/vmlinuz64
276 vmlinuz64 SHA-256: 641077fc1f9914af244c248453005f56536ba9e7f54ba3e52402f26709ddb8a5