mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-06-04 00:48:48 -04:00
IA32 ARM64 support
This commit is contained in:
parent
2936666a78
commit
ebaa4d954a
478 changed files with 10301 additions and 748 deletions
|
@ -2,13 +2,22 @@
|
|||
|
||||
rm -f vtoyfat_64
|
||||
rm -f vtoyfat_32
|
||||
rm -f vtoyfat_aa64
|
||||
|
||||
gcc -O2 -D_FILE_OFFSET_BITS=64 vtoyfat_linux.c -Ifat_io_lib/include fat_io_lib/lib/libfat_io_64.a -o vtoyfat_64
|
||||
gcc -m32 -O2 -D_FILE_OFFSET_BITS=64 vtoyfat_linux.c -Ifat_io_lib/include fat_io_lib/lib/libfat_io_32.a -o vtoyfat_32
|
||||
aarch64-buildroot-linux-uclibc-gcc -static -O2 -D_FILE_OFFSET_BITS=64 vtoyfat_linux.c -Ifat_io_lib/include fat_io_lib/lib/libfat_io_aa64.a -o vtoyfat_aa64
|
||||
|
||||
if [ -e vtoyfat_64 ] && [ -e vtoyfat_32 ]; then
|
||||
if [ -e vtoyfat_64 ] && [ -e vtoyfat_32 ] && [ -e vtoyfat_aa64 ]; then
|
||||
echo -e "\n===== success $name =======\n"
|
||||
[ -d ../INSTALL/tool/ ] && mv vtoyfat_32 ../INSTALL/tool/ && mv vtoyfat_64 ../INSTALL/tool/
|
||||
|
||||
strip --strip-all vtoyfat_32
|
||||
strip --strip-all vtoyfat_64
|
||||
aarch64-buildroot-linux-uclibc-strip --strip-all vtoyfat_aa64
|
||||
|
||||
[ -d ../INSTALL/tool/i386/ ] && mv vtoyfat_32 ../INSTALL/tool/i386/vtoyfat
|
||||
[ -d ../INSTALL/tool/x86_64/ ] && mv vtoyfat_64 ../INSTALL/tool/x86_64/vtoyfat
|
||||
[ -d ../INSTALL/tool/aarch64/ ] && mv vtoyfat_aa64 ../INSTALL/tool/aarch64/vtoyfat
|
||||
else
|
||||
echo -e "\n===== failed =======\n"
|
||||
exit 1
|
||||
|
|
|
@ -22,8 +22,14 @@ ar -rc libfat_io_32.a *.o
|
|||
rm -f *.o
|
||||
|
||||
|
||||
aarch64-linux-gnu-gcc -O2 -D_FILE_OFFSET_BITS=64 fat*.c -c
|
||||
ar -rc libfat_io_aa64.a *.o
|
||||
rm -f *.o
|
||||
|
||||
|
||||
cd -
|
||||
|
||||
|
||||
mkdir lib
|
||||
mkdir include
|
||||
|
||||
|
|
|
@ -37,6 +37,20 @@ static int vtoy_disk_read(uint32 sector, uint8 *buffer, uint32 sector_count)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int check_secure_boot(void)
|
||||
{
|
||||
void *flfile = NULL;
|
||||
|
||||
flfile = fl_fopen("/EFI/BOOT/grubx64_real.efi", "rb");
|
||||
if (flfile)
|
||||
{
|
||||
fl_fclose(flfile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int get_ventoy_version(void)
|
||||
{
|
||||
int rc = 1;
|
||||
|
@ -91,11 +105,14 @@ static int get_ventoy_version(void)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int op = 0;
|
||||
int rc = 1;
|
||||
char *disk;
|
||||
|
||||
if (argc != 2)
|
||||
if (argc != 2 && argc != 3)
|
||||
{
|
||||
printf("Usage: vtoyfat /dev/sdb \n");
|
||||
printf("Usage: vtoyfat /dev/sdbs \n");
|
||||
printf("Usage: vtoyfat -s /dev/sdbs \n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -104,10 +121,17 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
g_disk_fd = open(argv[1], O_RDONLY);
|
||||
disk = argv[1];
|
||||
if (argv[1][0] == '-' && argv[1][1] == 's')
|
||||
{
|
||||
op = 1;
|
||||
disk = argv[2];
|
||||
}
|
||||
|
||||
g_disk_fd = open(disk, O_RDONLY);
|
||||
if (g_disk_fd < 0)
|
||||
{
|
||||
printf("Failed to open %s\n", argv[1]);
|
||||
printf("Failed to open %s\n", disk);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -115,7 +139,14 @@ int main(int argc, char **argv)
|
|||
|
||||
if (0 == fl_attach_media(vtoy_disk_read, NULL))
|
||||
{
|
||||
rc = get_ventoy_version();
|
||||
if (op == 0)
|
||||
{
|
||||
rc = get_ventoy_version();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = check_secure_boot();
|
||||
}
|
||||
}
|
||||
|
||||
fl_shutdown();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue