diff --git a/BUSYBOX/build.txt b/BUSYBOX/build.txt index 6578f680..538e7ea9 100644 --- a/BUSYBOX/build.txt +++ b/BUSYBOX/build.txt @@ -1,20 +1,36 @@ -======== Build busybox 1.32 for aarch64 ======== - -ARCH=arm64 CROSS_COMPILE=aarch64-linux- make defconfig -ARCH=arm64 CROSS_COMPILE=aarch64-linux- make menuconfig -----> enable static build -----> enable ar -----> enable inotifyd - +======== How to build ash/hexdump/xzcat for aarch64 ======== +#How to get ash.config/hexdump.cofig/xzcat.config +#ARCH=arm64 CROSS_COMPILE=aarch64-linux- make allnoconfig +#ARCH=arm64 CROSS_COMPILE=aarch64-linux- make menuconfig +#----> enable static build +#----> enable xzcat +#get aarch64_xzcat.config +tar xf busybox-1.32.0.tar.bz2 +cd busybox-1.32.0 +copy aarch64_xzcat.config as .config ARCH=arm64 CROSS_COMPILE=aarch64-linux- make +rename ./busybox to xzcat - -ARCH=arm64 CROSS_COMPILE=aarch64-linux- make allnoconfig +======== How to build ash/hexdump/xzcat for x86_64 ========== +#How to get ash.config/hexdump.cofig/xzcat.config +#make allnoconfig +#make menuconfig +#----> enable static build +#----> enable xzcat +#get x86_64_xzcat.config -======== use mini-native-x86_64 uclibc to build ash/hexdump/busybox for x86_64 ========== +tar xf busybox-1.32.0.tar.bz2 +cd busybox-1.32.0 +copy x86_64_xzcat.config as .config +modify Makefile +CC = gcc -specs "/usr/local/musl/lib/musl-gcc.specs" +MODFLAGS = -DMODULE -specs "/usr/local/musl/lib/musl-gcc.specs" +make +rename ./busybox to xzcat + diff --git a/BUSYBOX/chmod/build.sh b/BUSYBOX/chmod/build.sh index 5b5edebd..0478decc 100644 --- a/BUSYBOX/chmod/build.sh +++ b/BUSYBOX/chmod/build.sh @@ -2,7 +2,7 @@ DSTDIR=../../IMG/cpio/ventoy/busybox -rm -f vtchmod32 vtchmod64 vtchmodaa64 +rm -f vtchmod32 vtchmod64 vtchmod64_musl vtchmodaa64 rm -f $DSTDIR/vtchmod32 $DSTDIR/vtchmod64 $DSTDIR/vtchmodaa64 /opt/diet32/bin/diet gcc -Os -m32 vtchmod.c -o vtchmod32 @@ -10,12 +10,16 @@ rm -f $DSTDIR/vtchmod32 $DSTDIR/vtchmod64 $DSTDIR/vtchmodaa64 aarch64-linux-gcc -Os -static vtchmod.c -o vtchmodaa64 aarch64-linux-strip --strip-all vtchmodaa64 +gcc -specs "/usr/local/musl/lib/musl-gcc.specs" -Os -static vtchmod.c -o vtchmod64_musl +strip --strip-all vtchmod64_musl chmod 777 vtchmod32 chmod 777 vtchmod64 chmod 777 vtchmodaa64 +chmod 777 vtchmod64_musl cp -a vtchmod32 $DSTDIR/ cp -a vtchmod64 $DSTDIR/ cp -a vtchmodaa64 $DSTDIR/ +cp -a vtchmod64_musl $DSTDIR/ diff --git a/BUSYBOX/chmod/vtchmod64_musl b/BUSYBOX/chmod/vtchmod64_musl new file mode 100644 index 00000000..d4cd5c6b Binary files /dev/null and b/BUSYBOX/chmod/vtchmod64_musl differ diff --git a/DMSETUP/build.txt b/DMSETUP/build.txt index 998eff1a..6585e599 100644 --- a/DMSETUP/build.txt +++ b/DMSETUP/build.txt @@ -36,20 +36,16 @@ build for 32bit, static linked with dietlibc ======================== Build for 64bit dmsetup ========================= -https://www.uclibc.org/downloads/binaries/0.9.30.1/mini-native-x86_64.tar.bz2 1. extract device mapper source code -2. extract mini-native-x86_64.tar.bz2 -3. chroot to mini-native-x86_64 -3. ./configure --disable-nls --disable-selinux --disable-shared --enable-static_link +2. ./configure --disable-nls --disable-selinux --disable-shared --enable-static_link CC='gcc -specs /usr/local/musl/lib/musl-gcc.specs' +3. touch include/linux/limits.h include/linux/types.h + echo '#include ' > include/linux/fs.h 4. make -5. strip dmsetup/dmsetup.static +5. strip --strip-all dmsetup/dmsetup.static 6. get dmsetup/dmsetup.static as the dmsetup64 binary file - - ======================== Build for arm64 dmsetup ========================= -https://www.uclibc.org/downloads/binaries/0.9.30.1/mini-native-x86_64.tar.bz2 1. extract device mapper source code 2. ./configure CC=aarch64-linux-gcc --target=arm --host=x86_64-linux-gnu --disable-nls --disable-selinux --disable-shared --enable-static_link 3. modify include/configure.h file diff --git a/DMSETUP/dmsetup64 b/DMSETUP/dmsetup64 index 1da213e2..4d390745 100644 Binary files a/DMSETUP/dmsetup64 and b/DMSETUP/dmsetup64 differ diff --git a/DOC/BuildVentoyFromSource.txt b/DOC/BuildVentoyFromSource.txt index eb04b196..967b809f 100644 --- a/DOC/BuildVentoyFromSource.txt +++ b/DOC/BuildVentoyFromSource.txt @@ -27,6 +27,7 @@ 2.2 Download third-part source code https://www.fefe.de/dietlibc/dietlibc-0.34.tar.xz ===> /home/Ventoy-master/DOC/dietlibc-0.34.tar.xz + https://musl.libc.org/releases/musl-1.2.1.tar.gz ===> /home/Ventoy-master/DOC/musl-1.2.1.tar.gz https://ftp.gnu.org/gnu/grub/grub-2.04.tar.xz ===> /home/Ventoy-master/GRUB2/grub-2.04.tar.xz https://codeload.github.com/tianocore/edk2/zip/edk2-stable201911 ===> /home/Ventoy-master/EDK2/edk2-edk2-stable201911.zip https://codeload.github.com/relan/exfat/zip/v1.3.0 ===> /home/Ventoy-master/ExFAT/exfat-1.3.0.zip @@ -34,6 +35,19 @@ https://releases.linaro.org/components/toolchain/binaries/7.4-2019.02/aarch64-linux-gnu/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz ===> /opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz https://toolchains.bootlin.com/downloads/releases/toolchains/aarch64/tarballs/aarch64--uclibc--stable-2020.08-1.tar.bz2 ===> /opt/aarch64--uclibc--stable-2020.08-1.tar.bz2 +2.3 Prepare third-part tools + cd /home/Ventoy-master/DOC/ + tar xf musl-1.2.1.tar.gz + cd musl-1.2.1 + ./configure && make install + + tar xf /opt/gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu.tar.xz -C /opt + tar xf /opt/aarch64--uclibc--stable-2020.08-1.tar.bz2 -C /opt + +2.4 Set PATH envrioment + 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 + better to add this line to /root/.bashrc and relogin as root + ========================================== 3. All in one script diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c index feacbe0b..5dd57e48 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c @@ -1709,6 +1709,7 @@ int ventoy_check_device_result(int ret) int ventoy_check_device(grub_device_t dev) { + int workaround = 0; grub_file_t file; grub_uint64_t offset; char devname[64]; @@ -1726,11 +1727,29 @@ int ventoy_check_device(grub_device_t dev) 0 == ventoy_check_file_exist("(%s,2)/grub/localboot.cfg", dev->disk->name) || 0 == ventoy_check_file_exist("(%s,2)/tool/mount.exfat-fuse_aarch64", dev->disk->name)) { - return ventoy_check_device_result(2 | 0x1000); + #ifndef GRUB_MACHINE_EFI + if (0 == ventoy_check_file_exist("(ventoydisk)/ventoy/ventoy.cpio", dev->disk->name) || + 0 == ventoy_check_file_exist("(ventoydisk)/grub/localboot.cfg", dev->disk->name) || + 0 == ventoy_check_file_exist("(ventoydisk)/tool/mount.exfat-fuse_aarch64", dev->disk->name)) + { + return ventoy_check_device_result(2 | 0x1000); + } + else + { + workaround = 1; + } + #endif } /* We must have partition 2 */ - file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(%s,2)/ventoy/ventoy.cpio", dev->disk->name); + if (workaround) + { + file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "%s", "(ventoydisk)/ventoy/ventoy.cpio"); + } + else + { + file = ventoy_grub_file_open(VENTOY_FILE_TYPE, "(%s,2)/ventoy/ventoy.cpio", dev->disk->name); + } if (!file) { return ventoy_check_device_result(3 | 0x1000); @@ -1748,37 +1767,55 @@ int ventoy_check_device(grub_device_t dev) return ventoy_check_device_result(5); } - offset = partition->start + partition->len; - partition = file->device->disk->partition; - if ((partition->number != 1) || (partition->len != 65536) || (offset != partition->start)) + if (workaround) { - grub_file_close(file); - return ventoy_check_device_result(6); + ventoy_part_table *PartTbl = g_ventoy_part_info->MBR.PartTbl; + if (PartTbl[1].StartSectorId != PartTbl[0].StartSectorId + PartTbl[0].SectorCount || + PartTbl[1].SectorCount != 65536) + { + grub_file_close(file); + return ventoy_check_device_result(6); + } } + else + { + offset = partition->start + partition->len; + partition = file->device->disk->partition; + if ((partition->number != 1) || (partition->len != 65536) || (offset != partition->start)) + { + grub_file_close(file); + return ventoy_check_device_result(7); + } + } + grub_file_close(file); - grub_snprintf(devname, sizeof(devname), "%s,2", dev->disk->name); - dev2 = grub_device_open(devname); - if (!dev2) + if (workaround == 0) { - return ventoy_check_device_result(7); - } + grub_snprintf(devname, sizeof(devname), "%s,2", dev->disk->name); + dev2 = grub_device_open(devname); + if (!dev2) + { + return ventoy_check_device_result(8); + } - fs = grub_fs_probe(dev2); - if (!fs) - { - grub_device_close(dev2); - return ventoy_check_device_result(8); - } + fs = grub_fs_probe(dev2); + if (!fs) + { + grub_device_close(dev2); + return ventoy_check_device_result(9); + } - fs->fs_label(dev2, &label); - if ((!label) || grub_strncmp("VTOYEFI", label, 7)) - { - grub_device_close(dev2); - return ventoy_check_device_result(9); - } + fs->fs_label(dev2, &label); + if ((!label) || grub_strncmp("VTOYEFI", label, 7)) + { + grub_device_close(dev2); + return ventoy_check_device_result(10); + } - grub_device_close(dev2); + grub_device_close(dev2); + } + return ventoy_check_device_result(0); } diff --git a/IMG/cpio/sbin/init b/IMG/cpio/sbin/init index 65bf10cc..14cf22e6 100644 --- a/IMG/cpio/sbin/init +++ b/IMG/cpio/sbin/init @@ -47,8 +47,8 @@ if [ -e $BUSYBOX_PATH/32h ]; then if [ -s $BUSYBOX_PATH/busybox ]; then $BUSYBOX_PATH/vtchmod64 $BUSYBOX_PATH/busybox else - $BUSYBOX_PATH/xzminidec64_uclibc < $BUSYBOX_PATH/busybox64.xz > $BUSYBOX_PATH/busybox - $BUSYBOX_PATH/vtchmod64_uclibc $BUSYBOX_PATH/busybox + $BUSYBOX_PATH/xzminidec64_musl < $BUSYBOX_PATH/busybox64.xz > $BUSYBOX_PATH/busybox + $BUSYBOX_PATH/vtchmod64_musl $BUSYBOX_PATH/busybox fi fi else diff --git a/IMG/cpio/ventoy/busybox/64h b/IMG/cpio/ventoy/busybox/64h index 32379432..a137ff35 100644 Binary files a/IMG/cpio/ventoy/busybox/64h and b/IMG/cpio/ventoy/busybox/64h differ diff --git a/IMG/cpio/ventoy/busybox/vtchmod64_musl b/IMG/cpio/ventoy/busybox/vtchmod64_musl new file mode 100644 index 00000000..d4cd5c6b Binary files /dev/null and b/IMG/cpio/ventoy/busybox/vtchmod64_musl differ diff --git a/IMG/cpio/ventoy/busybox/vtchmod64_uclibc b/IMG/cpio/ventoy/busybox/vtchmod64_uclibc deleted file mode 100644 index 2e998503..00000000 Binary files a/IMG/cpio/ventoy/busybox/vtchmod64_uclibc and /dev/null differ diff --git a/IMG/cpio/ventoy/busybox/xzminidec64_musl b/IMG/cpio/ventoy/busybox/xzminidec64_musl new file mode 100644 index 00000000..de7fa3d1 Binary files /dev/null and b/IMG/cpio/ventoy/busybox/xzminidec64_musl differ diff --git a/IMG/cpio/ventoy/busybox/xzminidec64_uclibc b/IMG/cpio/ventoy/busybox/xzminidec64_uclibc deleted file mode 100644 index c60663ff..00000000 Binary files a/IMG/cpio/ventoy/busybox/xzminidec64_uclibc and /dev/null differ diff --git a/INSTALL/EFI/BOOT/BOOTAA64.EFI b/INSTALL/EFI/BOOT/BOOTAA64.EFI index 90985238..12bbd7a9 100644 Binary files a/INSTALL/EFI/BOOT/BOOTAA64.EFI and b/INSTALL/EFI/BOOT/BOOTAA64.EFI differ diff --git a/INSTALL/EFI/BOOT/grubia32_real.efi b/INSTALL/EFI/BOOT/grubia32_real.efi index eb989570..23755733 100644 Binary files a/INSTALL/EFI/BOOT/grubia32_real.efi and b/INSTALL/EFI/BOOT/grubia32_real.efi differ diff --git a/INSTALL/EFI/BOOT/grubx64_real.efi b/INSTALL/EFI/BOOT/grubx64_real.efi index 5d533650..cfe495bf 100644 Binary files a/INSTALL/EFI/BOOT/grubx64_real.efi and b/INSTALL/EFI/BOOT/grubx64_real.efi differ diff --git a/INSTALL/grub/i386-pc/core.img b/INSTALL/grub/i386-pc/core.img index f542bded..0a448a34 100644 Binary files a/INSTALL/grub/i386-pc/core.img and b/INSTALL/grub/i386-pc/core.img differ diff --git a/INSTALL/tool/x86_64/ash b/INSTALL/tool/x86_64/ash index 32379432..a137ff35 100644 Binary files a/INSTALL/tool/x86_64/ash and b/INSTALL/tool/x86_64/ash differ diff --git a/INSTALL/tool/x86_64/hexdump b/INSTALL/tool/x86_64/hexdump index 1a3ddc27..c6ce5823 100644 Binary files a/INSTALL/tool/x86_64/hexdump and b/INSTALL/tool/x86_64/hexdump differ diff --git a/INSTALL/tool/x86_64/xzcat b/INSTALL/tool/x86_64/xzcat index 19e0d7b1..210f9609 100644 Binary files a/INSTALL/tool/x86_64/xzcat and b/INSTALL/tool/x86_64/xzcat differ diff --git a/INSTALL/ventoy/ventoy.cpio b/INSTALL/ventoy/ventoy.cpio index 35d8203e..e8ca7fe4 100644 Binary files a/INSTALL/ventoy/ventoy.cpio and b/INSTALL/ventoy/ventoy.cpio differ diff --git a/INSTALL/ventoy/vtloopex.cpio b/INSTALL/ventoy/vtloopex.cpio index cda156ed..40a86b21 100644 Binary files a/INSTALL/ventoy/vtloopex.cpio and b/INSTALL/ventoy/vtloopex.cpio differ diff --git a/LANGUAGES/languages.ini b/LANGUAGES/languages.ini index f74709bc..0af2c4b0 100644 Binary files a/LANGUAGES/languages.ini and b/LANGUAGES/languages.ini differ diff --git a/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace/ventoy_makefile64_musl b/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace/ventoy_makefile64_musl new file mode 100644 index 00000000..b4839ffe --- /dev/null +++ b/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace/ventoy_makefile64_musl @@ -0,0 +1,48 @@ +# +# Makefile +# +# Author: Lasse Collin +# +# This file has been put into the public domain. +# You can do whatever you want with this file. +# + +CC = gcc -specs "/usr/local/musl/lib/musl-gcc.specs" -Os -static -std=gnu89 +BCJ_CPPFLAGS = -DXZ_DEC_X86 -DXZ_DEC_POWERPC -DXZ_DEC_IA64 \ + -DXZ_DEC_ARM -DXZ_DEC_ARMTHUMB -DXZ_DEC_SPARC +CPPFLAGS = -DXZ_USE_CRC64 -DXZ_DEC_ANY_CHECK +CFLAGS = -ggdb3 -O2 -pedantic -Wall -Wextra +RM = rm -f +VPATH = ../linux/include/linux ../linux/lib/xz +COMMON_SRCS = xz_crc32.c xz_crc64.c xz_dec_stream.c xz_dec_lzma2.c xz_dec_bcj.c +COMMON_OBJS = $(COMMON_SRCS:.c=.o) +XZMINIDEC_OBJS = xzminidec.o +BYTETEST_OBJS = bytetest.o +BUFTEST_OBJS = buftest.o +BOOTTEST_OBJS = boottest.o +XZ_HEADERS = xz.h xz_private.h xz_stream.h xz_lzma2.h xz_config.h +PROGRAMS = xzminidec bytetest buftest boottest + +ALL_CPPFLAGS = -I../linux/include/linux -I. $(BCJ_CPPFLAGS) $(CPPFLAGS) + +all: $(PROGRAMS) + +%.o: %.c $(XZ_HEADERS) + $(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c -o $@ $< + +xzminidec: $(COMMON_OBJS) $(XZMINIDEC_OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(XZMINIDEC_OBJS) + +bytetest: $(COMMON_OBJS) $(BYTETEST_OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(BYTETEST_OBJS) + +buftest: $(COMMON_OBJS) $(BUFTEST_OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(BUFTEST_OBJS) + +boottest: $(BOOTTEST_OBJS) $(COMMON_SRCS) + $(CC) $(ALL_CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(BOOTTEST_OBJS) + +.PHONY: clean +clean: + -$(RM) $(COMMON_OBJS) $(XZMINIDEC_OBJS) $(BUFTEST_OBJS) \ + $(BOOTTEST_OBJS) $(PROGRAMS) diff --git a/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace/ventoy_makefileaa64 b/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace/ventoy_makefileaa64 new file mode 100644 index 00000000..710bf82a --- /dev/null +++ b/Ventoy2Disk/Ventoy2Disk/xz-embedded-20130513/userspace/ventoy_makefileaa64 @@ -0,0 +1,48 @@ +# +# Makefile +# +# Author: Lasse Collin +# +# This file has been put into the public domain. +# You can do whatever you want with this file. +# + +CC = /opt/aarch64--uclibc--stable-2020.08-1/bin/aarch64-linux-gcc -Os -static -std=gnu89 +BCJ_CPPFLAGS = -DXZ_DEC_X86 -DXZ_DEC_POWERPC -DXZ_DEC_IA64 \ + -DXZ_DEC_ARM -DXZ_DEC_ARMTHUMB -DXZ_DEC_SPARC +CPPFLAGS = -DXZ_USE_CRC64 -DXZ_DEC_ANY_CHECK +CFLAGS = -ggdb3 -O2 -pedantic -Wall -Wextra +RM = rm -f +VPATH = ../linux/include/linux ../linux/lib/xz +COMMON_SRCS = xz_crc32.c xz_crc64.c xz_dec_stream.c xz_dec_lzma2.c xz_dec_bcj.c +COMMON_OBJS = $(COMMON_SRCS:.c=.o) +XZMINIDEC_OBJS = xzminidec.o +BYTETEST_OBJS = bytetest.o +BUFTEST_OBJS = buftest.o +BOOTTEST_OBJS = boottest.o +XZ_HEADERS = xz.h xz_private.h xz_stream.h xz_lzma2.h xz_config.h +PROGRAMS = xzminidec bytetest buftest boottest + +ALL_CPPFLAGS = -I../linux/include/linux -I. $(BCJ_CPPFLAGS) $(CPPFLAGS) + +all: $(PROGRAMS) + +%.o: %.c $(XZ_HEADERS) + $(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c -o $@ $< + +xzminidec: $(COMMON_OBJS) $(XZMINIDEC_OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(XZMINIDEC_OBJS) + +bytetest: $(COMMON_OBJS) $(BYTETEST_OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(BYTETEST_OBJS) + +buftest: $(COMMON_OBJS) $(BUFTEST_OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(BUFTEST_OBJS) + +boottest: $(BOOTTEST_OBJS) $(COMMON_SRCS) + $(CC) $(ALL_CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(BOOTTEST_OBJS) + +.PHONY: clean +clean: + -$(RM) $(COMMON_OBJS) $(XZMINIDEC_OBJS) $(BUFTEST_OBJS) \ + $(BOOTTEST_OBJS) $(PROGRAMS) diff --git a/VtoyTool/vtoytool/01/vtoytool_64 b/VtoyTool/vtoytool/01/vtoytool_64 deleted file mode 100644 index f11765c6..00000000 Binary files a/VtoyTool/vtoytool/01/vtoytool_64 and /dev/null differ