Commit ebaa4d95 authored by longpanda's avatar longpanda
Browse files

IA32 ARM64 support

parent 2936666a
This diff is collapsed.
This diff is collapsed.
======== 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
ARCH=arm64 CROSS_COMPILE=aarch64-linux- make
ARCH=arm64 CROSS_COMPILE=aarch64-linux- make allnoconfig
======== use mini-native-x86_64 uclibc to build ash/hexdump/busybox for x86_64 ==========
...@@ -2,17 +2,20 @@ ...@@ -2,17 +2,20 @@
DSTDIR=../../IMG/cpio/ventoy/busybox DSTDIR=../../IMG/cpio/ventoy/busybox
rm -f vtchmod32 vtchmod64 rm -f vtchmod32 vtchmod64 vtchmodaa64
rm -f $DSTDIR/vtchmod32 $DSTDIR/vtchmod64 rm -f $DSTDIR/vtchmod32 $DSTDIR/vtchmod64 $DSTDIR/vtchmodaa64
/opt/diet32/bin/diet gcc -Os -m32 vtchmod.c -o vtchmod32 /opt/diet32/bin/diet gcc -Os -m32 vtchmod.c -o vtchmod32
/opt/diet64/bin/diet gcc -Os vtchmod.c -o vtchmod64 /opt/diet64/bin/diet gcc -Os vtchmod.c -o vtchmod64
aarch64-linux-gcc -Os -static vtchmod.c -o vtchmodaa64
aarch64-linux-strip --strip-all vtchmodaa64
chmod 777 vtchmod32 chmod 777 vtchmod32
chmod 777 vtchmod64 chmod 777 vtchmod64
chmod 777 vtchmodaa64
cp -a vtchmod32 $DSTDIR/ cp -a vtchmod32 $DSTDIR/
cp -a vtchmod64 $DSTDIR/ cp -a vtchmod64 $DSTDIR/
cp -a vtchmodaa64 $DSTDIR/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Build a static linked, small dmsetup tool Build a static linked, small dmsetup tool
======== Source Code ======== ======== Source Code ========
use an old version of dmsetup use an old version of dmsetup
http://vault.centos.org/5.3/os/SRPMS/device-mapper-1.02.28-2.el5.src.rpm http://vault.centos.org/5.3/os/SRPMS/device-mapper-1.02.28-2.el5.src.rpm
https://www.fefe.de/dietlibc/dietlibc-0.34.tar.xz https://www.fefe.de/dietlibc/dietlibc-0.34.tar.xz
======== Build Envrioment ======== ======== Build Envrioment ========
build for 32bit, static linked with dietlibc build for 32bit, static linked with dietlibc
1. install centos 6.10 i386 with CentOS-6.10-i386-bin-DVD1.iso 1. install centos 6.10 i386 with CentOS-6.10-i386-bin-DVD1.iso
2. yum install gcc kernel-devel package 2. yum install gcc kernel-devel package
3. install dietc libc (just make && make install) 3. install dietc libc (just make && make install)
4. export PATH=$PATH:/opt/diet/bin 4. export PATH=$PATH:/opt/diet/bin
======== Build Step ======== ======== Build Step ========
1. extract device mapper source code 1. extract device mapper source code
2. CC="diet gcc" ./configure --disable-nls --disable-selinux --disable-shared 2. CC="diet gcc" ./configure --disable-nls --disable-selinux --disable-shared
3. modify include/configure.h file 3. modify include/configure.h file
--- delete the line with "#define malloc rpl_malloc" --- delete the line with "#define malloc rpl_malloc"
--- add 2 defines as follow: --- add 2 defines as follow:
#ifndef UINT32_MAX #ifndef UINT32_MAX
#define UINT32_MAX (4294967295U) #define UINT32_MAX (4294967295U)
#endif #endif
#ifndef UINT64_C #ifndef UINT64_C
#define UINT64_C(c) c ## ULL #define UINT64_C(c) c ## ULL
#endif #endif
4. make 4. make
5. strip dmsetup/dmsetup 5. strip dmsetup/dmsetup
6. get dmsetup/dmsetup as the dmsetup32 binary file 6. get dmsetup/dmsetup as the dmsetup32 binary file
======================== Build for 64bit dmsetup ========================= ======================== Build for 64bit dmsetup =========================
https://www.uclibc.org/downloads/binaries/0.9.30.1/mini-native-x86_64.tar.bz2 https://www.uclibc.org/downloads/binaries/0.9.30.1/mini-native-x86_64.tar.bz2
1. extract device mapper source code 1. extract device mapper source code
2. extract mini-native-x86_64.tar.bz2 2. extract mini-native-x86_64.tar.bz2
3. chroot to mini-native-x86_64 3. chroot to mini-native-x86_64
3. ./configure --disable-nls --disable-selinux --disable-shared --enable-static_link 3. ./configure --disable-nls --disable-selinux --disable-shared --enable-static_link
4. make 4. make
5. strip dmsetup/dmsetup.static 5. strip dmsetup/dmsetup.static
6. get dmsetup/dmsetup.static as the dmsetup64 binary file 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
--- delete the line with "#define malloc rpl_malloc"
4. make
5. aarch64-linux-strip dmsetup/dmsetup.static
6. get dmsetup/dmsetup.static as the dmsetupaa64 binary file
This diff is collapsed.
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
BOOLEAN gDebugPrint = FALSE; BOOLEAN gDebugPrint = FALSE;
BOOLEAN gDotEfiBoot = FALSE; BOOLEAN gDotEfiBoot = FALSE;
BOOLEAN gLoadIsoEfi = FALSE; BOOLEAN gLoadIsoEfi = FALSE;
BOOLEAN gIsoUdf = FALSE;
ventoy_ram_disk g_ramdisk_param; ventoy_ram_disk g_ramdisk_param;
ventoy_chain_head *g_chain; ventoy_chain_head *g_chain;
ventoy_img_chunk *g_chunk; ventoy_img_chunk *g_chunk;
...@@ -56,6 +57,7 @@ ventoy_grub_param_file_replace *g_file_replace_list = NULL; ...@@ -56,6 +57,7 @@ ventoy_grub_param_file_replace *g_file_replace_list = NULL;
ventoy_efi_file_replace g_efi_file_replace; ventoy_efi_file_replace g_efi_file_replace;
CONST CHAR16 gIso9660EfiDriverPath[] = ISO9660_EFI_DRIVER_PATH; CONST CHAR16 gIso9660EfiDriverPath[] = ISO9660_EFI_DRIVER_PATH;
CONST CHAR16 gUdfEfiDriverPath[] = UDF_EFI_DRIVER_PATH;
BOOLEAN g_fix_windows_1st_cdrom_issue = FALSE; BOOLEAN g_fix_windows_1st_cdrom_issue = FALSE;
...@@ -69,10 +71,28 @@ CONST CHAR16 *gEfiBootFileName[] = ...@@ -69,10 +71,28 @@ CONST CHAR16 *gEfiBootFileName[] =
{ {
L"@", L"@",
EFI_REMOVABLE_MEDIA_FILE_NAME, EFI_REMOVABLE_MEDIA_FILE_NAME,
#if defined (MDE_CPU_IA32)
L"\\EFI\\BOOT\\GRUBIA32.EFI",
L"\\EFI\\BOOT\\BOOTia32.EFI",
L"\\EFI\\BOOT\\bootia32.efi",
L"\\efi\\boot\\bootia32.efi",
#elif defined (MDE_CPU_X64)
L"\\EFI\\BOOT\\GRUBX64.EFI", L"\\EFI\\BOOT\\GRUBX64.EFI",
L"\\EFI\\BOOT\\BOOTx64.EFI", L"\\EFI\\BOOT\\BOOTx64.EFI",
L"\\EFI\\BOOT\\bootx64.efi", L"\\EFI\\BOOT\\bootx64.efi",
L"\\efi\\boot\\bootx64.efi", L"\\efi\\boot\\bootx64.efi",
#elif defined (MDE_CPU_ARM)
L"\\EFI\\BOOT\\GRUBARM.EFI",
L"\\EFI\\BOOT\\BOOTarm.EFI",
L"\\EFI\\BOOT\\bootarm.efi",
L"\\efi\\boot\\bootarm.efi",
#elif defined (MDE_CPU_AARCH64)
L"\\EFI\\BOOT\\GRUBAA64.EFI",
L"\\EFI\\BOOT\\BOOTaa64.EFI",
L"\\EFI\\BOOT\\bootaa64.efi",
L"\\efi\\boot\\bootaa64.efi",
#endif
}; };
VOID EFIAPI VtoyDebug(IN CONST CHAR8 *Format, ...) VOID EFIAPI VtoyDebug(IN CONST CHAR8 *Format, ...)
...@@ -608,12 +628,23 @@ STATIC EFI_STATUS EFIAPI ventoy_load_isoefi_driver(IN EFI_HANDLE ImageHandle) ...@@ -608,12 +628,23 @@ STATIC EFI_STATUS EFIAPI ventoy_load_isoefi_driver(IN EFI_HANDLE ImageHandle)
EFI_HANDLE Image = NULL; EFI_HANDLE Image = NULL;
EFI_STATUS Status = EFI_SUCCESS; EFI_STATUS Status = EFI_SUCCESS;
CHAR16 LogVar[4] = L"5"; CHAR16 LogVar[4] = L"5";
Status = ventoy_load_image(ImageHandle, gBlockData.pDiskFsDevPath, if (gIsoUdf)
gIso9660EfiDriverPath, {
sizeof(gIso9660EfiDriverPath), Status = ventoy_load_image(ImageHandle, gBlockData.pDiskFsDevPath,
&Image); gUdfEfiDriverPath,
debug("load iso efi driver status:%r", Status); sizeof(gUdfEfiDriverPath),
&Image);
debug("load iso UDF efi driver status:%r", Status);
}
else
{
Status = ventoy_load_image(ImageHandle, gBlockData.pDiskFsDevPath,
gIso9660EfiDriverPath,
sizeof(gIso9660EfiDriverPath),
&Image);
debug("load iso 9660 efi driver status:%r", Status);
}
if (gDebugPrint) if (gDebugPrint)
{ {
...@@ -672,6 +703,11 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle) ...@@ -672,6 +703,11 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
{ {
gLoadIsoEfi = TRUE; gLoadIsoEfi = TRUE;
} }
if (StrStr(pCmdLine, L"iso_udf"))
{
gIsoUdf = TRUE;
}
pPos = StrStr(pCmdLine, L"FirstTry=@"); pPos = StrStr(pCmdLine, L"FirstTry=@");
if (pPos) if (pPos)
......
...@@ -168,19 +168,26 @@ typedef struct ventoy_virt_chunk ...@@ -168,19 +168,26 @@ typedef struct ventoy_virt_chunk
#define VTOY_BLOCK_DEVICE_PATH_GUID \ #define VTOY_BLOCK_DEVICE_PATH_GUID \
{ 0x37b87ac6, 0xc180, 0x4583, { 0xa7, 0x05, 0x41, 0x4d, 0xa8, 0xf7, 0x7e, 0xd2 }} { 0x37b87ac6, 0xc180, 0x4583, { 0xa7, 0x05, 0x41, 0x4d, 0xa8, 0xf7, 0x7e, 0xd2 }}
#define ISO9660_EFI_DRIVER_PATH L"\\ventoy\\iso9660_x64.efi"
#define VTOY_BLOCK_DEVICE_PATH_NAME L"ventoy" #define VTOY_BLOCK_DEVICE_PATH_NAME L"ventoy"
#if defined (MDE_CPU_IA32) #if defined (MDE_CPU_IA32)
#define VENTOY_UEFI_DESC L"IA32 UEFI" #define VENTOY_UEFI_DESC L"IA32 UEFI"
#define ISO9660_EFI_DRIVER_PATH L"\\ventoy\\iso9660_ia32.efi"
#define UDF_EFI_DRIVER_PATH L"\\ventoy\\udf_ia32.efi"
#elif defined (MDE_CPU_X64) #elif defined (MDE_CPU_X64)
#define VENTOY_UEFI_DESC L"X64 UEFI" #define VENTOY_UEFI_DESC L"X64 UEFI"
#define ISO9660_EFI_DRIVER_PATH L"\\ventoy\\iso9660_x64.efi"
#define UDF_EFI_DRIVER_PATH L"\\ventoy\\udf_x64.efi"
#elif defined (MDE_CPU_EBC) #elif defined (MDE_CPU_EBC)
#elif defined (MDE_CPU_ARM) #elif defined (MDE_CPU_ARM)
#define VENTOY_UEFI_DESC L"ARM UEFI" #define VENTOY_UEFI_DESC L"ARM UEFI"
#define ISO9660_EFI_DRIVER_PATH L"\\ventoy\\iso9660_arm.efi"
#define UDF_EFI_DRIVER_PATH L"\\ventoy\\udf_arm.efi"
#elif defined (MDE_CPU_AARCH64) #elif defined (MDE_CPU_AARCH64)
#define VENTOY_UEFI_DESC L"ARM64 UEFI" #define VENTOY_UEFI_DESC L"ARM64 UEFI"
#define ISO9660_EFI_DRIVER_PATH L"\\ventoy\\iso9660_aa64.efi"
#define UDF_EFI_DRIVER_PATH L"\\ventoy\\udf_aa64.efi"
#else #else
#error Unknown Processor Type #error Unknown Processor Type
#endif #endif
......
...@@ -161,10 +161,19 @@ STATIC EFI_STATUS EFIAPI ventoy_read_iso_sector ...@@ -161,10 +161,19 @@ STATIC EFI_STATUS EFIAPI ventoy_read_iso_sector
{ {
MapLba = (Sector - pchunk->img_start_sector) * 4 + pchunk->disk_start_sector; MapLba = (Sector - pchunk->img_start_sector) * 4 + pchunk->disk_start_sector;
} }
else else if (g_chain->disk_sector_size == 1024)
{
MapLba = (Sector - pchunk->img_start_sector) * 2 + pchunk->disk_start_sector;
}
else if (g_chain->disk_sector_size == 2048)
{ {
MapLba = (Sector - pchunk->img_start_sector) * 2048 / g_chain->disk_sector_size + pchunk->disk_start_sector; MapLba = (Sector - pchunk->img_start_sector) + pchunk->disk_start_sector;
} }
else if (g_chain->disk_sector_size == 4096)
{
MapLba = ((Sector - pchunk->img_start_sector) >> 1) + pchunk->disk_start_sector;
}
secLeft = pchunk->img_end_sector + 1 - Sector; secLeft = pchunk->img_end_sector + 1 - Sector;
secRead = (Count < secLeft) ? Count : secLeft; secRead = (Count < secLeft) ? Count : secLeft;
...@@ -277,10 +286,19 @@ STATIC EFI_STATUS EFIAPI ventoy_write_iso_sector ...@@ -277,10 +286,19 @@ STATIC EFI_STATUS EFIAPI ventoy_write_iso_sector
{ {
MapLba = (Sector - pchunk->img_start_sector) * 4 + pchunk->disk_start_sector; MapLba = (Sector - pchunk->img_start_sector) * 4 + pchunk->disk_start_sector;
} }
else else if (g_chain->disk_sector_size == 1024)
{
MapLba = (Sector - pchunk->img_start_sector) * 2 + pchunk->disk_start_sector;
}
else if (g_chain->disk_sector_size == 2048)
{ {
MapLba = (Sector - pchunk->img_start_sector) * 2048 / g_chain->disk_sector_size + pchunk->disk_start_sector; MapLba = (Sector - pchunk->img_start_sector) + pchunk->disk_start_sector;
} }
else if (g_chain->disk_sector_size == 4096)
{
MapLba = ((Sector - pchunk->img_start_sector) >> 1) + pchunk->disk_start_sector;
}
secLeft = pchunk->img_end_sector + 1 - Sector; secLeft = pchunk->img_end_sector + 1 - Sector;
secRead = (Count < secLeft) ? Count : secLeft; secRead = (Count < secLeft) ? Count : secLeft;
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment