]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
update for new release
authorlongpanda <admin@ventoy.net>
Sat, 29 Aug 2020 05:12:36 +0000 (13:12 +0800)
committerlongpanda <admin@ventoy.net>
Sat, 29 Aug 2020 05:12:46 +0000 (13:12 +0800)
110 files changed:
DOC/BuildVentoyFromSource.txt
DOC/LoopExBuild.txt [new file with mode: 0644]
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.c
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/Ventoy.h
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c
EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/VtoyUtil/VtoyUtil.h
EfiISO/ISO/EFI/BOOT/BOOTX64.EFI [new file with mode: 0644]
EfiISO/mkefiiso.sh [new file with mode: 0644]
GRUB2/MOD_SRC/grub-2.04/grub-core/loader/i386/linux.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
GRUB2/MOD_SRC/grub-2.04/include/grub/ventoy.h
IMG/cpio/sbin/init
IMG/cpio/ventoy/busybox/vtchmod64_uclibc [new file with mode: 0644]
IMG/cpio/ventoy/busybox/xzminidec64_uclibc [new file with mode: 0644]
IMG/cpio/ventoy/hook/alpine/udev_disk_hook.sh
IMG/cpio/ventoy/hook/arch/ventoy-hook.sh
IMG/cpio/ventoy/hook/aryalinux/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/aryalinux/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/crux/disk_hook.sh
IMG/cpio/ventoy/hook/debian/default-hook.sh
IMG/cpio/ventoy/hook/debian/mll-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/debian/mll-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
IMG/cpio/ventoy/hook/debian/ventoy-hook.sh
IMG/cpio/ventoy/hook/default/ventoy-hook.sh
IMG/cpio/ventoy/hook/dragora/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/dragora/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/lunar/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/lunar/ventoy-inotifyd-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/lunar/ventoy-inotifyd-start.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/photon/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/photon/ventoy-inotifyd-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/photon/ventoy-inotifyd-start.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/pisilinux/ventoy-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/pisilinux/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/ploplinux/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/ploplinux/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/rancher/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/rancher/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/slackware/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/slackware/ventoy-hook.sh
IMG/cpio/ventoy/hook/smgl/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/smgl/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/smoothwall/cd_list.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/smoothwall/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/smoothwall/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/suse/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/suse/ventoy-hook.sh
IMG/cpio/ventoy/hook/t2/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/t2/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/ventoy-hook-lib.sh
IMG/cpio/ventoy/hook/vine/dev-listen.sh
IMG/cpio/ventoy/hook/vine/udev_disk_hook.sh
IMG/cpio/ventoy/hook/vine/ventoy-hook.sh
IMG/cpio/ventoy/hook/wifislax/disk_hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/hook/wifislax/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/init_chain
IMG/cpio/ventoy/loop/LibreELEC/ventoy-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/LibreELEC/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/batocera/ventoy-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/batocera/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/freedombox/ventoy-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/freedombox/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/lakka/ventoy-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/lakka/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/paldo/ventoy-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/paldo/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/recalbox/ventoy-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/recalbox/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/ubos/newroot-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/ubos/ventoy-disk.sh [new file with mode: 0644]
IMG/cpio/ventoy/loop/ubos/ventoy-hook.sh [new file with mode: 0644]
IMG/cpio/ventoy/tool/vtoytool_install.sh
IMG/cpio/ventoy/ventoy_chain.sh
IMG/cpio/ventoy/ventoy_loop.sh
IMG/mkcpio.sh
IMG/vtloopex/LibreELEC/vtloopex/dm-mod/5.1.16/64/dm-mod.ko.xz [new file with mode: 0644]
IMG/vtloopex/dragora/vtloopex/dm-mod/4.19.79-gnu/64/dm-mod.ko.xz [new file with mode: 0644]
IMG/vtloopex/lakka/vtloopex/dm-mod/4.11.12-rt14/64/dm-mod.ko.xz [new file with mode: 0644]
IMG/vtloopex/vine/vtloopex/dm-mod/4.4.52-2vl6/64/dm-mod.ko.xz [new file with mode: 0644]
INSTALL/EFI/BOOT/grubx64_real.efi
INSTALL/README
INSTALL/grub/grub.cfg
INSTALL/grub/i386-pc/core.img
INSTALL/ventoy/ventoy.cpio
INSTALL/ventoy/ventoy_unix.cpio
INSTALL/ventoy/ventoy_x64.efi
INSTALL/ventoy/vtloopex.cpio
INSTALL/ventoy/vtoyutil_x64.efi
INSTALL/ventoy_pack.sh
LZIP/lunzip-1.11.tar.gz [new file with mode: 0644]
LZIP/lunzip32 [new file with mode: 0644]
LZIP/lunzip64 [new file with mode: 0644]
License/license-lunzip.txt [new file with mode: 0644]
Unix/FreeBsdKernelVerMagic.txt [new file with mode: 0644]
Unix/ventoy_unix.cpio
Unix/ventoy_unix/ClonOS/geom_ventoy_ko/13.x/64/geom_ventoy.ko.xz [new file with mode: 0644]
Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/32/geom_ventoy.ko.xz [new file with mode: 0644]
Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/64/geom_ventoy.ko.xz [new file with mode: 0644]
Unix/ventoy_unix_src/ClonOS/geom_ventoy_src/13.x/SameAsFreeBSD13.x.txt [new file with mode: 0644]
Unix/ventoy_unix_src/MidnightBSD/geom_ventoy_src/1.2/SameAsFreeBSD11.x.txt [new file with mode: 0644]
VtoyTool/vtoydump.c
VtoyTool/vtoytool.c
VtoyTool/vtoytool/00/vtoytool_32
VtoyTool/vtoytool/00/vtoytool_64
VtoyTool/vtoytool/01/vtoytool_64
VtoyTool/vtoytool/02/vtoytool_64 [new file with mode: 0644]
VtoyTool/vtoyvine.c [new file with mode: 0644]

index c67aced8e87551e7cf37c15504bc5e1444f1206a..a4fe564ab5c3b282818cd48302366c9d9422577a 100644 (file)
   https://busybox.net/downloads/busybox-1.32.0.tar.bz2
   use BUSYBOX/64h.config and uclibc to build busybox-1.32
 
+4.19 == Build lunzip32/lunzip64 ==
+  http://mirror.yongbok.net/nongnu/lzip/lunzip/lunzip-1.11.tar.gz
+  PATH=$PATH:/opt/diet/bin
+  ./configure --disable-nls CC='diet gcc -nostdinc'
+  make
+  strip --strip-all lunzip
+
+
 
 ==========================================
 5. Binaries
diff --git a/DOC/LoopExBuild.txt b/DOC/LoopExBuild.txt
new file mode 100644 (file)
index 0000000..2f5a39e
--- /dev/null
@@ -0,0 +1,29 @@
+\r
+1. LAKKA dm-mod.ko \r
+   LaKKa config \r
+   https://github.com/libretro/Lakka-LibreELEC/releases download source code\r
+   \projects\Generic\linux\linux.x86_64.conf\r
+   \r
+   Linux Kernel\r
+   linux-4.11.12.tar.xz & patch-4.11.12-rt14.patch.xz\r
+   patch -p1 < ../patch-4.11.12-rt14\r
+   \r
+   make menuconfig\r
+   select device mapper as module\r
+   make -j 16\r
+   get drivers\md\dm-mod.ko\r
+\r
+2. LibreELEC dm-mod.ko\r
+   LibreELEC config \r
+   https://github.com/LibreELEC/LibreELEC.tv/releases download source code\r
+   \projects\Generic\linux\linux.x86_64.conf\r
+   \r
+   Linux Kernel\r
+   linux-5.1.6.tar.xz\r
+   make menuconfig\r
+   select device mapper as module\r
+   make -j 16\r
+   get drivers\md\dm-mod.ko\r
+   \r
+   \r
+   
\ No newline at end of file
index 6cd64636e3230036826179259103f462c5dfa999..0d67b31ef1df9e3f9eb2d1a4e89725c911d1071e 100644 (file)
@@ -37,6 +37,7 @@
 #include <Ventoy.h>
 
 BOOLEAN gDebugPrint = FALSE;
+BOOLEAN gDotEfiBoot = FALSE;
 BOOLEAN gLoadIsoEfi = FALSE;
 ventoy_ram_disk g_ramdisk_param;
 ventoy_chain_head *g_chain;
@@ -49,6 +50,7 @@ ventoy_virt_chunk *g_virt_chunk;
 UINT32 g_virt_chunk_num;
 vtoy_block_data gBlockData;
 static grub_env_get_pf grub_env_get = NULL;
+static grub_env_set_pf grub_env_set = NULL;
 
 ventoy_grub_param_file_replace *g_file_replace_list = NULL;
 ventoy_efi_file_replace g_efi_file_replace;
@@ -602,6 +604,11 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
     {
         gDebugPrint = TRUE;
     }
+    
+    if (StrStr(pCmdLine, L"dotefi"))
+    {
+        gDotEfiBoot = TRUE;
+    }
 
     if (StrStr(pCmdLine, L"isoefi=on"))
     {
@@ -643,6 +650,7 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
     
     pGrubParam = (ventoy_grub_param *)StrHexToUintn(pPos + StrLen(L"env_param="));
     grub_env_get = pGrubParam->grub_env_get;
+    grub_env_set = pGrubParam->grub_env_set;
 
     g_file_replace_list = &pGrubParam->file_replace;
     old_cnt = g_file_replace_list->old_file_cnt;
@@ -664,6 +672,11 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
 
     debug("memory addr:%p size:%lu", chain, size);
 
+    if (StrStr(pCmdLine, L"sector512"))
+    {
+        gSector512Mode = TRUE;
+    }
+
     if (StrStr(pCmdLine, L"memdisk"))
     {
         g_iso_data_buf = (UINT8 *)chain + sizeof(ventoy_chain_head);
@@ -906,6 +919,11 @@ EFI_STATUS EFIAPI ventoy_boot(IN EFI_HANDLE ImageHandle)
 
         if (Find == 0)
         {
+            if (gDotEfiBoot)
+            {
+                break;
+            }
+        
             debug("Fs not found, now wait and retry...");
             sleep(2);
         }
@@ -972,6 +990,12 @@ EFI_STATUS EFIAPI VentoyEfiMain
         {
             gBS->UnloadImage(gBlockData.IsoDriverImage);
         }
+
+        gBS->DisconnectController(gBlockData.Handle, NULL, NULL);
+        gBS->UninstallMultipleProtocolInterfaces(gBlockData.Handle,
+                &gEfiBlockIoProtocolGuid, &gBlockData.BlockIo,
+                &gEfiDevicePathProtocolGuid, gBlockData.Path,
+                NULL);
     }
     else
     {
@@ -995,16 +1019,24 @@ EFI_STATUS EFIAPI VentoyEfiMain
         ventoy_clean_env();
     }
 
-    if (EFI_NOT_FOUND == Status)
+    if (FALSE == gDotEfiBoot)
     {
-        gST->ConOut->OutputString(gST->ConOut, L"No bootfile found for UEFI!\r\n");
-        gST->ConOut->OutputString(gST->ConOut, L"Maybe the image does not support " VENTOY_UEFI_DESC  L"!\r\n");
-        sleep(30);
+        if (EFI_NOT_FOUND == Status)
+        {
+            gST->ConOut->OutputString(gST->ConOut, L"No bootfile found for UEFI!\r\n");
+            gST->ConOut->OutputString(gST->ConOut, L"Maybe the image does not support " VENTOY_UEFI_DESC  L"!\r\n");
+            sleep(30);
+        }
     }
-
+    
     ventoy_clear_input();
     gST->ConOut->ClearScreen(gST->ConOut);
 
+    if (gDotEfiBoot && (EFI_NOT_FOUND == Status))
+    {
+        grub_env_set("vtoy_dotefi_retry", "YES");            
+    }
+
     return EFI_SUCCESS;
 }
 
index 250da0edd8d12abb23b128bbca0a499fecb4216c..e7df612e73acf87245b2397baf057a3f38f5a470 100644 (file)
@@ -227,6 +227,7 @@ if (gDebugPrint) \
     gBS->WaitForEvent(1, &gST->ConIn->WaitForKey, &__Index);\
 }
 
+typedef int (*grub_env_set_pf)(const char *name, const char *val);
 typedef const char * (*grub_env_get_pf)(const char *name);
 typedef int (*grub_env_printf_pf)(const char *fmt, ...);
 
@@ -255,6 +256,7 @@ typedef struct ventoy_grub_param_file_replace
 typedef struct ventoy_grub_param
 {
     grub_env_get_pf grub_env_get;
+    grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
     grub_env_printf_pf grub_env_printf;    
 }ventoy_grub_param;
@@ -338,6 +340,7 @@ extern ventoy_efi_file_replace g_efi_file_replace;
 extern ventoy_sector_flag *g_sector_flag;
 extern UINT32 g_sector_flag_num;
 extern BOOLEAN gMemdiskMode;
+extern BOOLEAN gSector512Mode;
 extern UINTN g_iso_buf_size;
 extern UINT8 *g_iso_data_buf;
 extern ventoy_grub_param_file_replace *g_file_replace_list;
index bb0e95e191c46df7c296f9d758c6337a1e1cf60f..cdc75ab4c3e5c476a3131a3ae04ce82e116306fc 100644 (file)
@@ -39,6 +39,7 @@
 UINT8 *g_iso_data_buf = NULL;
 UINTN g_iso_buf_size = 0;
 BOOLEAN gMemdiskMode = FALSE;
+BOOLEAN gSector512Mode = FALSE;
 
 ventoy_sector_flag *g_sector_flag = NULL;
 UINT32 g_sector_flag_num = 0;
@@ -68,6 +69,9 @@ STATIC EFI_INPUT_READ_KEY g_org_read_key = NULL;
 
 STATIC EFI_LOCATE_HANDLE g_org_locate_handle = NULL;
 
+STATIC UINT8 g_sector_buf[2048];
+STATIC EFI_BLOCK_READ g_sector_2048_read = NULL;
+
 BOOLEAN ventoy_is_cdrom_dp_exist(VOID)
 {
     UINTN i = 0;
@@ -571,6 +575,64 @@ end:
     return Status;
 }
 
+EFI_STATUS EFIAPI ventoy_block_io_read_512
+(
+    IN EFI_BLOCK_IO_PROTOCOL          *This,
+    IN UINT32                          MediaId,
+    IN EFI_LBA                         Lba,
+    IN UINTN                           BufferSize,
+    OUT VOID                          *Buffer
+)
+{
+    EFI_LBA Mod;
+    UINTN ReadSize;
+    UINT8 *CurBuf = NULL;
+    EFI_STATUS Status = EFI_SUCCESS;
+
+    debug("ventoy_block_io_read_512 %lu %lu\n", Lba, BufferSize / 512);
+
+    CurBuf = (UINT8 *)Buffer;
+
+    Mod = Lba % 4;
+    if (Mod > 0)
+    {
+        Status |= g_sector_2048_read(This, MediaId, Lba / 4, 2048, g_sector_buf);
+
+        if (BufferSize <= (4 - Mod) * 512)
+        {
+            CopyMem(CurBuf, g_sector_buf + Mod * 512, BufferSize);
+            return EFI_SUCCESS;
+        }
+        else
+        {
+            ReadSize = (4 - Mod) * 512;
+            CopyMem(CurBuf, g_sector_buf + Mod * 512, ReadSize);
+            CurBuf += ReadSize;
+            Lba += (4 - Mod);
+            BufferSize -= ReadSize;
+        }
+    }
+
+    if (BufferSize >= 2048)
+    {
+        ReadSize = BufferSize / 2048 * 2048;
+            
+        Status |= g_sector_2048_read(This, MediaId, Lba / 4, ReadSize, CurBuf);
+        CurBuf += ReadSize;
+        
+        Lba += ReadSize / 512;
+        BufferSize -= ReadSize;
+    }
+
+    if (BufferSize > 0)
+    {
+        Status |= g_sector_2048_read(This, MediaId, Lba / 4, 2048, g_sector_buf);
+        CopyMem(CurBuf, g_sector_buf, BufferSize);
+    }
+
+    return Status;
+}
+
 EFI_STATUS EFIAPI ventoy_install_blockio(IN EFI_HANDLE ImageHandle, IN UINT64 ImgSize)
 {   
     EFI_STATUS Status = EFI_SUCCESS;
@@ -580,9 +642,18 @@ EFI_STATUS EFIAPI ventoy_install_blockio(IN EFI_HANDLE ImageHandle, IN UINT64 Im
 
     debug("install block io protocol %p", ImageHandle);
     ventoy_debug_pause();
+
+    if (gSector512Mode)
+    {
+        gBlockData.Media.BlockSize = 512;
+        gBlockData.Media.LastBlock = ImgSize / 512 - 1;
+    }
+    else
+    {
+        gBlockData.Media.BlockSize = 2048;
+        gBlockData.Media.LastBlock = ImgSize / 2048 - 1;        
+    }
     
-    gBlockData.Media.BlockSize = 2048;
-    gBlockData.Media.LastBlock = ImgSize / 2048 - 1;
     gBlockData.Media.ReadOnly = TRUE;
     gBlockData.Media.MediaPresent = 1;
     gBlockData.Media.LogicalBlocksPerPhysicalBlock = 1;
@@ -590,7 +661,17 @@ EFI_STATUS EFIAPI ventoy_install_blockio(IN EFI_HANDLE ImageHandle, IN UINT64 Im
        pBlockIo->Revision = EFI_BLOCK_IO_PROTOCOL_REVISION3;
        pBlockIo->Media = &(gBlockData.Media);
        pBlockIo->Reset = ventoy_block_io_reset;
-    pBlockIo->ReadBlocks = gMemdiskMode ? ventoy_block_io_ramdisk_read : ventoy_block_io_read;
+
+    if (gSector512Mode)
+    {
+        g_sector_2048_read = gMemdiskMode ? ventoy_block_io_ramdisk_read : ventoy_block_io_read;
+        pBlockIo->ReadBlocks = ventoy_block_io_read_512;
+    }
+    else
+    {
+        pBlockIo->ReadBlocks = gMemdiskMode ? ventoy_block_io_ramdisk_read : ventoy_block_io_read;        
+    }
+        
        pBlockIo->WriteBlocks = ventoy_block_io_write;
        pBlockIo->FlushBlocks = ventoy_block_io_flush;
 
@@ -603,10 +684,10 @@ EFI_STATUS EFIAPI ventoy_install_blockio(IN EFI_HANDLE ImageHandle, IN UINT64 Im
     {
         return Status;
     }
-    
+
     Status = ventoy_connect_driver(gBlockData.Handle, L"Disk I/O Driver");
     debug("Connect disk IO driver %r", Status);
-    
+
     Status = ventoy_connect_driver(gBlockData.Handle, L"Partition Driver");
     debug("Connect partition driver %r", Status);
     if (EFI_ERROR(Status))
index 9adf6c7066626bc0abdec1abe847276f1ad2a593..2ff64e6ffeb139d4198e7a464753ea8f23929e67 100644 (file)
@@ -24,6 +24,7 @@
 #pragma pack(1)
 
 typedef EFI_STATUS (*VTOY_UTIL_PROC_PF)(IN EFI_HANDLE ImageHandle, IN CONST CHAR16 *CmdLine);
+typedef int (*grub_env_set_pf)(const char *name, const char *val);
 typedef const char * (*grub_env_get_pf)(const char *name);
 typedef int (*grub_env_printf_pf)(const char *fmt, ...);
 
@@ -38,6 +39,7 @@ typedef struct ventoy_grub_param_file_replace
 typedef struct ventoy_grub_param
 {
     grub_env_get_pf grub_env_get;
+    grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
     grub_env_printf_pf grub_env_printf;    
 }ventoy_grub_param;
diff --git a/EfiISO/ISO/EFI/BOOT/BOOTX64.EFI b/EfiISO/ISO/EFI/BOOT/BOOTX64.EFI
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/EfiISO/mkefiiso.sh b/EfiISO/mkefiiso.sh
new file mode 100644 (file)
index 0000000..b5abaa6
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+rm -f ventoy_efiboot.img.*
+
+cd ISO
+mkisofs -R -D -sysid VENTOY -V VENTOY -P "longpanda admin@ventoy.net" -p 'https://www.ventoy.net' -o ../ventoy_efiboot.img ./ 
+cd ..
+
+xz --check=crc32 ventoy_efiboot.img
+
+rm -f ../INSTALL/ventoy/ventoy_efiboot.img.xz
+cp -a ventoy_efiboot.img.xz ../INSTALL/ventoy/
+
index d17eeba174a6bf193c840681f3df6f5c764c07b6..74734f2ab469aa31425d41a601468d0d1bc71559 100644 (file)
@@ -485,6 +485,11 @@ static int ventoy_boot_opt_filter(char *opt)
         return 1;
     }
 
+    if (grub_strcmp(opt, "vga=current") == 0)
+    {
+        return 1;
+    }
+
     if (grub_strncmp(opt, "rdinit=", 7) == 0)
     {
         if (grub_strcmp(opt, "rdinit=/vtoy/vtoy") != 0)
@@ -1224,7 +1229,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   linux_mem_size = 0;
   for (i = 1; i < argc; i++)
 #ifdef GRUB_MACHINE_PCBIOS
-    if (grub_memcmp (argv[i], "vga=", 4) == 0)
+    if (grub_memcmp (argv[i], "vga=", 4) == 0 && (grub_memcmp (argv[i], "vga=current", 11) != 0))
       {
        /* Video mode selection support.  */
        char *val = argv[i] + 4;
index 14915ccd509f493b6f49e614228174e54ee67421..cb2dc6d3fc96761346e6326b22ae70f228e170d7 100644 (file)
@@ -2883,6 +2883,109 @@ end:
     return rc;
 }
 
+static int ventoy_fs_enum_1st_file(const char *filename, const struct grub_dirhook_info *info, void *data)
+{
+    if (!info->dir)
+    {
+        grub_snprintf((char *)data, 256, "%s", filename);
+        return 1;
+    }
+
+    return 0;
+}
+
+
+static grub_err_t ventoy_cmd_fs_enum_1st_file(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+    int rc = 1;
+    char *device_name = NULL;
+    grub_device_t dev = NULL;
+    grub_fs_t fs = NULL;
+    char name[256] ={0};
+    
+    (void)ctxt;
+
+    if (argc != 3)
+    {
+        debug("ventoy_cmd_fs_enum_1st_file, invalid param num %d\n", argc);
+        return 1;
+    }
+
+    device_name = grub_file_get_device_name(args[0]);
+    if (!device_name)
+    {
+        debug("grub_file_get_device_name failed, %s\n", args[0]);
+        goto end;
+    }
+
+    dev = grub_device_open(device_name);
+    if (!dev)
+    {
+        debug("grub_device_open failed, %s\n", device_name);
+        goto end;        
+    }
+
+    fs = grub_fs_probe(dev);
+    if (!fs)
+    {
+        debug("grub_fs_probe failed, %s\n", device_name);
+        goto end;
+    }
+
+    fs->fs_dir(dev, args[1], ventoy_fs_enum_1st_file, name);
+    if (name[0])
+    {
+        ventoy_set_env(args[2], name);
+    }
+    
+    rc = 0;
+    
+end:
+
+    check_free(device_name, grub_free);
+    check_free(dev, grub_device_close);
+    
+    return rc;
+}
+
+static grub_err_t ventoy_cmd_basename(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+    char c;
+    char *pos = NULL;
+    char *end = NULL;
+    
+    (void)ctxt;
+
+    if (argc != 2)
+    {
+        debug("ventoy_cmd_basename, invalid param num %d\n", argc);
+        return 1;
+    }
+
+    for (pos = args[0]; *pos; pos++)
+    {
+        if (*pos == '.')
+        {
+            end = pos;
+        }
+    }
+
+    if (end)
+    {
+        c = *end;
+        *end = 0;
+    }
+
+    grub_env_set(args[1], args[0]);
+
+    if (end)
+    {
+        *end = c;
+    }
+
+    return 0;
+}
+
 grub_uint64_t ventoy_grub_get_file_size(const char *fmt, ...)
 {
     grub_uint64_t size = 0;
@@ -2920,7 +3023,7 @@ grub_file_t ventoy_grub_file_open(enum grub_file_type type, const char *fmt, ...
     file = grub_file_open(fullpath, type);
     if (!file)
     {
-        debug("grub_file_open failed <%s>\n", fullpath);
+        debug("grub_file_open failed <%s> %d\n", fullpath, grub_errno);
         grub_errno = 0;
     }
 
@@ -2995,6 +3098,7 @@ static int ventoy_env_init(void)
     if (g_grub_param)
     {
         g_grub_param->grub_env_get = grub_env_get;
+        g_grub_param->grub_env_set = (grub_env_set_pf)grub_env_set;
         g_grub_param->grub_env_printf = (grub_env_printf_pf)grub_printf;
         grub_snprintf(buf, sizeof(buf), "%p", g_grub_param);
         grub_env_set("env_param", buf);
@@ -3022,12 +3126,18 @@ static cmd_para ventoy_cmds[] =
     { "vt_dump_img_sector", ventoy_cmd_dump_img_sector, 0, NULL, "", "", NULL },
     { "vt_load_wimboot", ventoy_cmd_load_wimboot, 0, NULL, "", "", NULL },
 
+    { "vt_cpio_busybox64", ventoy_cmd_cpio_busybox_64, 0, NULL, "", "", NULL },
     { "vt_load_cpio", ventoy_cmd_load_cpio, 0, NULL, "", "", NULL },
     { "vt_trailer_cpio", ventoy_cmd_trailer_cpio, 0, NULL, "", "", NULL },
     { "vt_push_last_entry", ventoy_cmd_push_last_entry, 0, NULL, "", "", NULL },
     { "vt_pop_last_entry", ventoy_cmd_pop_last_entry, 0, NULL, "", "", NULL },
     { "vt_get_lib_module_ver", ventoy_cmd_lib_module_ver, 0, NULL, "", "", NULL },
+
     { "vt_get_fs_label", ventoy_cmd_get_fs_label, 0, NULL, "", "", NULL },
+    { "vt_fs_enum_1st_file", ventoy_cmd_fs_enum_1st_file, 0, NULL, "", "", NULL },
+    { "vt_file_basename", ventoy_cmd_basename, 0, NULL, "", "", NULL },
+    
+
     
     { "vt_find_first_bootable_hd", ventoy_cmd_find_bootable_hdd, 0, NULL, "", "", NULL },
     { "vt_dump_menu", ventoy_cmd_dump_menu, 0, NULL, "", "", NULL },
index 79706e22fd4d7547839f125d2ecbc7dbe98766fd..e686d934b6da0b3e0114f93a96f58abf378d8ab6 100644 (file)
@@ -469,6 +469,7 @@ grub_err_t ventoy_cmd_linux_locate_initrd(grub_extcmd_context_t ctxt, int argc,
 grub_err_t ventoy_cmd_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
 grub_err_t ventoy_cmd_valid_initrd_count(grub_extcmd_context_t ctxt, int argc, char **args);
 grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **args);
+grub_err_t ventoy_cmd_cpio_busybox_64(grub_extcmd_context_t ctxt, int argc, char **args);
 grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **args);
 int ventoy_cpio_newc_fill_head(void *buf, int filesize, const void *filedata, const char *name);
 grub_file_t ventoy_grub_file_open(enum grub_file_type type, const char *fmt, ...);
index 25ce82cdac6b6fdd705c16d77e78895392f731c5..29c368bb10aef07eb9ade53687944fb203e13106 100644 (file)
@@ -944,6 +944,19 @@ static int ventoy_cpio_busybox64(cpio_newc_header *head)
     return 0;
 }
 
+
+grub_err_t ventoy_cmd_cpio_busybox_64(grub_extcmd_context_t ctxt, int argc, char **args)
+{
+    (void)ctxt;
+    (void)argc;
+    (void)args;
+
+    debug("ventoy_cmd_busybox_64 %d\n", argc);
+    ventoy_cpio_busybox64((cpio_newc_header *)g_ventoy_cpio_buf);
+    return 0;
+}
+
+
 grub_err_t ventoy_cmd_load_cpio(grub_extcmd_context_t ctxt, int argc, char **args)
 {
     int rc;
index 029aec4e542038c0536487e82889cfbc6eaf5e6b..1cf4661eb692c294786cc1e33b1dcce2cd840c7e 100644 (file)
@@ -219,6 +219,7 @@ typedef struct ventoy_img_chunk_list
 #define GRUB_FILE_REPLACE_MAGIC  0x1258BEEF
 
 typedef const char * (*grub_env_get_pf)(const char *name);
+typedef int (*grub_env_set_pf)(const char *name, const char *val);
 typedef int (*grub_env_printf_pf)(const char *fmt, ...);
 
 typedef struct ventoy_grub_param_file_replace
@@ -232,6 +233,7 @@ typedef struct ventoy_grub_param_file_replace
 typedef struct ventoy_grub_param
 {
     grub_env_get_pf grub_env_get;
+    grub_env_set_pf grub_env_set;
     ventoy_grub_param_file_replace file_replace;
     grub_env_printf_pf grub_env_printf;
 }ventoy_grub_param;
index 2fbf7f527a84c336c8fae19f93f64741d154f625..8eea0ad1fa7bd2c8c9e1aabbb059f48c6317d30c 100644 (file)
@@ -40,11 +40,21 @@ if [ -e $BUSYBOX_PATH/64h ]; then
     $BUSYBOX_PATH/xzminidec32 < $BUSYBOX_PATH/busybox32.xz > $BUSYBOX_PATH/busybox
     $BUSYBOX_PATH/vtchmod32 $BUSYBOX_PATH/busybox
 else
-    $BUSYBOX_PATH/xzminidec64 < $BUSYBOX_PATH/busybox64.xz > $BUSYBOX_PATH/busybox 
-    $BUSYBOX_PATH/vtchmod64 $BUSYBOX_PATH/busybox
+    $BUSYBOX_PATH/xzminidec64 < $BUSYBOX_PATH/busybox64.xz > $BUSYBOX_PATH/busybox
+    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
+    fi
 fi
 
-$BUSYBOX_PATH/busybox --install $BUSYBOX_PATH
+if [ -e $BUSYBOX_PATH/busybox ]; then
+    $BUSYBOX_PATH/busybox --install $BUSYBOX_PATH
+else
+    $BUSYBOX_PATH/tmpxz -d $BUSYBOX_PATH/busybox32.xz
+    $BUSYBOX_PATH/busybox32 --install $BUSYBOX_PATH
+fi
 
 export PATH=$BUSYBOX_PATH/:$VTOY_PATH/tool
 
@@ -78,10 +88,12 @@ if [ -e $BUSYBOX_PATH/64h ]; then
     echo "Use busybox32 toolkit ..." >>$VTLOG
     ln -s $BUSYBOX_PATH/xzminidec32 $BUSYBOX_PATH/xzminidec
     ln -s $VTOY_PATH/tool/dmsetup32 $VTOY_PATH/tool/dmsetup
+    ln -s $VTOY_PATH/tool/lunzip32 $VTOY_PATH/tool/lunzip
 else
     echo "Use busybox64 toolkit ..." >>$VTLOG
     ln -s $BUSYBOX_PATH/xzminidec64 $BUSYBOX_PATH/xzminidec
     ln -s $VTOY_PATH/tool/dmsetup64 $VTOY_PATH/tool/dmsetup
+    ln -s $VTOY_PATH/tool/lunzip64 $VTOY_PATH/tool/lunzip
 fi
 
 rm -f *.xz
diff --git a/IMG/cpio/ventoy/busybox/vtchmod64_uclibc b/IMG/cpio/ventoy/busybox/vtchmod64_uclibc
new file mode 100644 (file)
index 0000000..2e99850
Binary files /dev/null and b/IMG/cpio/ventoy/busybox/vtchmod64_uclibc differ
diff --git a/IMG/cpio/ventoy/busybox/xzminidec64_uclibc b/IMG/cpio/ventoy/busybox/xzminidec64_uclibc
new file mode 100644 (file)
index 0000000..c60663f
Binary files /dev/null and b/IMG/cpio/ventoy/busybox/xzminidec64_uclibc differ
index 930009bc0ab27c44a3c11a35983951df392373cf..91391cca10393bd85ffecbbf93d99d3262e6b7b1 100644 (file)
@@ -59,7 +59,15 @@ mkdir -p $VTOY_PATH/mnt
 mount /vt_modloop $VTOY_PATH/mnt
 
 KoModPath=$(find $VTOY_PATH/mnt/ -name 'dm-mod.ko*')
-vtlog "insmod $KoModPath"
+vtlog "KoModPath=$KoModPath"
+
+if modinfo $KoModPath | grep -q 'depend.*dax'; then
+    vtlog "First install dax mod ..."
+    DaxModPath=$(echo $KoModPath | sed 's#md/dm-mod#dax/dax#')
+    vtlog "insmod $DaxModPath"
+    insmod $DaxModPath
+fi
+
 insmod $KoModPath
 
 umount $VTOY_PATH/mnt
index 7c99f77e4b0e54a078964841d4c5acfc8415c55c..19d59c4516f5ab71a523716a60219db3f7095777 100644 (file)
 
 if $GREP -q '^"$mount_handler"' /init; then
     echo 'use mount_handler ...' >> $VTLOG
-    $SED "/^\"\$mount_handler\"/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/arch/ventoy-disk.sh \"\$archisodevice\"" -i /init
     
-    if [ -f /hooks/archiso ]; then
-        $SED  '/while ! poll_device "${dev}"/a\    if /ventoy/busybox/sh /ventoy/hook/arch/ventoy-timeout.sh ${dev}; then break; fi'   -i /hooks/archiso
+    vthookfile=/hooks/archiso
+    
+    if [ -e /hook/miso ]; then
+        vthookfile=/hooks/miso
+        $SED "/^\"\$mount_handler\"/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/arch/ventoy-disk.sh \"\$misodevice\"" -i /init
+    else
+        $SED "/^\"\$mount_handler\"/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/arch/ventoy-disk.sh \"\$archisodevice\"" -i /init
     fi
+    
+    if [ -f $vthookfile ]; then
+        $SED  '/while ! poll_device "${dev}"/a\    if /ventoy/busybox/sh /ventoy/hook/arch/ventoy-timeout.sh ${dev}; then break; fi'   -i $vthookfile
+    fi
+    
 elif $GREP -q '^KEEP_SEARCHING' /init; then
     echo 'KEEP_SEARCHING found ...' >> $VTLOG
     $SED "/^KEEP_SEARCHING/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/arch/ovios-disk.sh " -i /init
diff --git a/IMG/cpio/ventoy/hook/aryalinux/disk_hook.sh b/IMG/cpio/ventoy/hook/aryalinux/disk_hook.sh
new file mode 100644 (file)
index 0000000..4b625c5
--- /dev/null
@@ -0,0 +1,51 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+mkdir /sys
+mount -t sysfs sys /sys
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
+blkdev_num_mknod=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+vtDM=$(ventoy_find_dm_id ${blkdev_num})
+
+vtlog "blkdev_num=$blkdev_num blkdev_num_mknod=$blkdev_num_mknod vtDM=$vtDM"
+
+if [ -b /dev/$vtDM ]; then
+    vtlog "dev already exist ..."
+else
+    vtlog "mknode dev ..."
+    mknod -m 660 /dev/$vtDM  b  $blkdev_num_mknod
+fi
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/aryalinux/ventoy-hook.sh b/IMG/cpio/ventoy/hook/aryalinux/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..557566f
--- /dev/null
@@ -0,0 +1,26 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$BUSYBOX_PATH/mkdir /dev
+$BUSYBOX_PATH/mknod -m 660 /dev/console b 5 1
+
+$SED "/for device in/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/aryalinux/disk_hook.sh" -i /init
+#$SED "/for device in/i exec $BUSYBOX_PATH/sh" -i /init
index e03374e636a6cef7730a08d492221464adab4540..eae7bc04e572c98efb3764798e96fbad1c061f0e 100644 (file)
@@ -29,7 +29,7 @@ for i in 0 1 2 3 4 5 6 7 8 9; do
     fi
 done
 
-ventoy_extract_vtloopex /dev/${vtdiskname#/dev/}2  crux
+ventoy_extract_vtloopex ${vtdiskname}2  crux
 
 vtLoopExDir=$VTOY_PATH/vtloopex/crux/vtloopex
 $BUSYBOX_PATH/xz -d  $vtLoopExDir/dm-mod/$(uname -r)/64/dax.ko.xz
index 234c67665b6906cb52a131516ca4544a3ce27619..4ec2261e0dc0d610a39048357ff61b085afd3848 100644 (file)
@@ -60,3 +60,18 @@ if [ -f $VTOY_PATH/autoinstall ]; then
     fi
 fi
 
+#for ARMA aka Omoikane
+if [ -f /mod.img ] && [ -f /mod/fs/cramfs.ko ]; then
+    echo "mount mod.img and install dm-mod.ko" >> $VTLOG
+    $BUSYBOX_PATH/insmod /mod/fs/cramfs.ko
+    
+    $BUSYBOX_PATH/mkdir $VTOY_PATH/modmnt
+    $BUSYBOX_PATH/mount /mod.img $VTOY_PATH/modmnt
+    $BUSYBOX_PATH/insmod $VTOY_PATH/modmnt/md/dm-mod.ko
+    $BUSYBOX_PATH/umount $VTOY_PATH/modmnt
+    
+    $BUSYBOX_PATH/rmmod cramfs
+fi
+
+
+
diff --git a/IMG/cpio/ventoy/hook/debian/mll-disk.sh b/IMG/cpio/ventoy/hook/debian/mll-disk.sh
new file mode 100644 (file)
index 0000000..8ee0579
--- /dev/null
@@ -0,0 +1,43 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+vtlog "####### $0 $* ########"
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/hook/debian/mll-hook.sh b/IMG/cpio/ventoy/hook/debian/mll-hook.sh
new file mode 100644 (file)
index 0000000..5186f02
--- /dev/null
@@ -0,0 +1,21 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+$SED "/^for DEVICE in/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/debian/mll-disk.sh"  -i /etc/02_overlay.sh
+
index 77ccfba6dc743e9d88062e3cc4567e9f3c365afb..a0f88b1518c661c4edb36ab40d743cabb2d410fd 100644 (file)
@@ -47,7 +47,13 @@ ventoy_os_install_dmsetup() {
         if [ $LINTCNT -gt 1 ]; then
             vtlog "more than one pkgs, need to filter..."
             VER=$($BUSYBOX_PATH/uname -r)
+            
             LINE=$($GREP ' md-modules.*\.udeb'  $VTOY_PATH/iso_file_list | $GREP $VER)
+            LINTCNT=$($GREP ' md-modules.*\.udeb'  $VTOY_PATH/iso_file_list | $GREP -c $VER)
+            if [ $LINTCNT -gt 1 ]; then
+                vtlog "Still more than one pkgs, use the first one..."
+                LINE=$($GREP ' md-modules.*\.udeb'  $VTOY_PATH/iso_file_list | $GREP  -m1 $VER)
+            fi
         fi
         install_udeb_from_line "$LINE" ${vt_usb_disk} 
     fi
index 2186f3c801b9280fc16c978fbf258283cda84251..161d19b7ce073d249db842e733884447ce9adb29 100644 (file)
@@ -35,6 +35,8 @@ ventoy_get_debian_distro() {
             else
                 echo 'puppy'; return
             fi
+        elif $GREP -m1 -q 'Minimal.*Linux.*Live' /init; then
+            echo 'mll'; return
         fi
     fi
 
index 152dd06b698f71007879f382cbe17315bce3f937..56e0e35e3f01cf8084559c0f19386c8d7d7e4cbe 100644 (file)
 ventoy_systemd_udevd_work_around
 
 ventoy_add_udev_rule "$VTOY_PATH/hook/default/udev_disk_hook.sh %k"
+
+if [ -f /init ]; then
+    vtSize=$($BUSYBOX_PATH/stat -c '%s' /init)
+    if ! [ -L /init ]; then
+        if [ $vtSize -eq 0 ]; then
+            rm -f /init
+        fi
+    fi
+fi
diff --git a/IMG/cpio/ventoy/hook/dragora/disk_hook.sh b/IMG/cpio/ventoy/hook/dragora/disk_hook.sh
new file mode 100644 (file)
index 0000000..600bfc0
--- /dev/null
@@ -0,0 +1,41 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_extract_vtloopex ${vtdiskname}2  dragora
+vtLoopExDir=$VTOY_PATH/vtloopex/dragora/vtloopex
+$BUSYBOX_PATH/xz -d  $vtLoopExDir/dm-mod/$(uname -r)/64/dm-mod.ko.xz
+$BUSYBOX_PATH/insmod $vtLoopExDir/dm-mod/$(uname -r)/64/dm-mod.ko
+
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/dragora/ventoy-hook.sh b/IMG/cpio/ventoy/hook/dragora/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..a0a2c19
--- /dev/null
@@ -0,0 +1,22 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "/iso9660/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/dragora/disk_hook.sh" -i /init
diff --git a/IMG/cpio/ventoy/hook/lunar/ventoy-hook.sh b/IMG/cpio/ventoy/hook/lunar/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..08e32d4
--- /dev/null
@@ -0,0 +1,27 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "s#printf\(.*\)\$CMDLINE#printf\1\$CMDLINE root=/dev/dm-0#" -i /lib/dracut-lib.sh
+
+$BUSYBOX_PATH/rm -f /usr/lib/systemd/system-generators/systemd-fstab-generator /lib/systemd/system-generators/systemd-fstab-generator
+
+ventoy_set_inotify_script  lunar/ventoy-inotifyd-hook.sh
+$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/lunar/ventoy-inotifyd-start.sh /lib/dracut/hooks/pre-udev/01-ventoy-inotifyd-start.sh
diff --git a/IMG/cpio/ventoy/hook/lunar/ventoy-inotifyd-hook.sh b/IMG/cpio/ventoy/hook/lunar/ventoy-inotifyd-hook.sh
new file mode 100644 (file)
index 0000000..da31013
--- /dev/null
@@ -0,0 +1,45 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+if is_inotify_ventoy_part $3; then
+
+    vtlog "##### INOTIFYD: $2/$3 is created (YES) ..."
+
+    vtlog "find ventoy partition ..."
+    $BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 noreplace
+    
+    blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
+    vtDM=$(ventoy_find_dm_id ${blkdev_num})
+
+    mount -t iso9660 /dev/$vtDM /sysroot
+    
+    set_ventoy_hook_finish
+else
+    vtlog "##### INOTIFYD: $2/$3 is created (NO) ..."
+fi
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/lunar/ventoy-inotifyd-start.sh b/IMG/cpio/ventoy/hook/lunar/ventoy-inotifyd-start.sh
new file mode 100644 (file)
index 0000000..6be8155
--- /dev/null
@@ -0,0 +1,31 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+vtHook=$($CAT $VTOY_PATH/inotifyd-hook-script.txt)
+
+vtdisk=$(get_ventoy_disk_name)
+if [ "$vtdisk" = "unknown" ]; then
+    vtlog "... start inotifyd listen $vtHook ..."
+    $BUSYBOX_PATH/nohup $VTOY_PATH/tool/inotifyd $vtHook  /dev:n  2>&-  & 
+else
+    vtlog "... $vtdisk already exist ..."
+    $BUSYBOX_PATH/sh $vtHook n /dev "${vtdisk#/dev/}2"
+fi
diff --git a/IMG/cpio/ventoy/hook/photon/ventoy-hook.sh b/IMG/cpio/ventoy/hook/photon/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..9a29807
--- /dev/null
@@ -0,0 +1,34 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED 's#/dev/cdrom#/dev/ventoy#' -i /installer/isoInstaller.py
+
+ventoy_set_inotify_script  photon/ventoy-inotifyd-hook.sh
+
+[ -d /dev ] || $BUSYBOX_PATH/mkdir /dev
+[ -d /sys ] || $BUSYBOX_PATH/mkdir /sys
+
+$BUSYBOX_PATH/mount -t devtmpfs -o mode=0755,noexec,nosuid,strictatime devtmpfs /dev
+$BUSYBOX_PATH/mount -t sysfs sys /sys
+
+$BUSYBOX_PATH/rm -f /init
+$BUSYBOX_PATH/sh $VTOY_PATH/hook/photon/ventoy-inotifyd-start.sh
+
diff --git a/IMG/cpio/ventoy/hook/photon/ventoy-inotifyd-hook.sh b/IMG/cpio/ventoy/hook/photon/ventoy-inotifyd-hook.sh
new file mode 100644 (file)
index 0000000..424d84e
--- /dev/null
@@ -0,0 +1,43 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+if is_inotify_ventoy_part $3; then
+
+    vtlog "##### INOTIFYD: $2/$3 is created (YES) ..."
+
+    vtlog "find ventoy partition ..."
+    $BUSYBOX_PATH/sh $VTOY_PATH/hook/default/udev_disk_hook.sh $3 noreplace
+    
+    blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+    mknod -m 0660 /dev/ventoy b $blkdev_num
+    
+    set_ventoy_hook_finish
+else
+    vtlog "##### INOTIFYD: $2/$3 is created (NO) ..."
+fi
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/photon/ventoy-inotifyd-start.sh b/IMG/cpio/ventoy/hook/photon/ventoy-inotifyd-start.sh
new file mode 100644 (file)
index 0000000..6be8155
--- /dev/null
@@ -0,0 +1,31 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+vtHook=$($CAT $VTOY_PATH/inotifyd-hook-script.txt)
+
+vtdisk=$(get_ventoy_disk_name)
+if [ "$vtdisk" = "unknown" ]; then
+    vtlog "... start inotifyd listen $vtHook ..."
+    $BUSYBOX_PATH/nohup $VTOY_PATH/tool/inotifyd $vtHook  /dev:n  2>&-  & 
+else
+    vtlog "... $vtdisk already exist ..."
+    $BUSYBOX_PATH/sh $vtHook n /dev "${vtdisk#/dev/}2"
+fi
diff --git a/IMG/cpio/ventoy/hook/pisilinux/ventoy-disk.sh b/IMG/cpio/ventoy/hook/pisilinux/ventoy-disk.sh
new file mode 100644 (file)
index 0000000..891cd90
--- /dev/null
@@ -0,0 +1,47 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+vtlog "####### $0 $* ########"
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+blkdev_num=$(dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+mknod -m 660 /dev/ventoy b $blkdev_num
+
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/hook/pisilinux/ventoy-hook.sh b/IMG/cpio/ventoy/hook/pisilinux/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..9fc1fc5
--- /dev/null
@@ -0,0 +1,24 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "/^\"\$mount_handler\"/i\ $BUSYBOX_PATH/sh $VTOY_PATH/hook/pisilinux/ventoy-disk.sh" -i /init
+$SED "/^\"\$mount_handler\"/i\ export root=/dev/ventoy" -i /init
+
diff --git a/IMG/cpio/ventoy/hook/ploplinux/disk_hook.sh b/IMG/cpio/ventoy/hook/ploplinux/disk_hook.sh
new file mode 100644 (file)
index 0000000..336b7bb
--- /dev/null
@@ -0,0 +1,38 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+mknod -m 0660 /dev/ventoy b $blkdev_num
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/ploplinux/ventoy-hook.sh b/IMG/cpio/ventoy/hook/ploplinux/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..8eaef67
--- /dev/null
@@ -0,0 +1,24 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "/export *CMDLINE/i CMDLINE=\"root=/dev/ventoy \${CMDLINE}\"" -i /etc/rc.d/init.d/rc.S
+$SED "1a $BUSYBOX_PATH/sh $VTOY_PATH/hook/ploplinux/disk_hook.sh" -i /etc/rc.d/init.d/rootmount
+
diff --git a/IMG/cpio/ventoy/hook/rancher/disk_hook.sh b/IMG/cpio/ventoy/hook/rancher/disk_hook.sh
new file mode 100644 (file)
index 0000000..336b7bb
--- /dev/null
@@ -0,0 +1,38 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+mknod -m 0660 /dev/ventoy b $blkdev_num
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/rancher/ventoy-hook.sh b/IMG/cpio/ventoy/hook/rancher/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..e2f27fa
--- /dev/null
@@ -0,0 +1,21 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
diff --git a/IMG/cpio/ventoy/hook/slackware/disk_hook.sh b/IMG/cpio/ventoy/hook/slackware/disk_hook.sh
new file mode 100644 (file)
index 0000000..03bc90a
--- /dev/null
@@ -0,0 +1,35 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+PATH=$VTPATH_OLD
index 570e909891be0f6138727c100bfa5156dc956a9f..1b3f0483348ca4c14c685f4bf709ffaa49bf80d1 100644 (file)
@@ -2,7 +2,11 @@
 
 . $VTOY_PATH/hook/ventoy-os-lib.sh
 
-ventoy_systemd_udevd_work_around
+if $GREP '^mediadetected=' /init; then
+    $SED "/^mediadetected=/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/slackware/disk_hook.sh" -i /init
+else
+    ventoy_systemd_udevd_work_around
+    ventoy_add_udev_rule "$VTOY_PATH/hook/slackware/udev_disk_hook.sh %k noreplace"
+fi
 
-ventoy_add_udev_rule "$VTOY_PATH/hook/slackware/udev_disk_hook.sh %k noreplace"
 
diff --git a/IMG/cpio/ventoy/hook/smgl/disk_hook.sh b/IMG/cpio/ventoy/hook/smgl/disk_hook.sh
new file mode 100644 (file)
index 0000000..bc135d3
--- /dev/null
@@ -0,0 +1,42 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+#exec /ventoy/busybox/sh
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+mknod -m 660 /dev/ventoy b $blkdev_num
+
+echo "/dev/ventoy" > cdrom.hint
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/smgl/ventoy-hook.sh b/IMG/cpio/ventoy/hook/smgl/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..9eb20d5
--- /dev/null
@@ -0,0 +1,45 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+PATH=$PATH:$VTOY_PATH/busybox
+
+mkdir /ventoy_rdroot
+
+mknod -m 660 /ram0 b 1 0
+
+dd if=/initrd001 of=/ram0
+rm -f /initrd001
+
+mount /ram0 /ventoy_rdroot
+
+vtSize=$(du -m -s $VTOY_PATH | awk '{print $1}')
+let vtSize=vtSize+4
+
+mkdir -p /ventoy_rdroot/ventoy
+mount -t tmpfs -o size=${vtSize}m tmpfs /ventoy_rdroot/ventoy
+cp -a /ventoy/* /ventoy_rdroot/ventoy/
+
+
+cd /ventoy_rdroot
+
+sed "/scan_cdroms *$/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/smgl/disk_hook.sh" -i sbin/smgl.init
+
+
diff --git a/IMG/cpio/ventoy/hook/smoothwall/cd_list.sh b/IMG/cpio/ventoy/hook/smoothwall/cd_list.sh
new file mode 100644 (file)
index 0000000..5e7cbab
--- /dev/null
@@ -0,0 +1,33 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
+vtDM=$(ventoy_find_dm_id ${blkdev_num})
+vtSize=$(cat /sys/block/$vtDM/size)
+
+cp -a /tmp/cd.list /tmp/cd_new.list
+echo "$vtDM $vtSize UNK_MODEL " > /tmp/cd.list
+cat /tmp/cd_new.list >> /tmp/cd.list
+rm -f /tmp/cd_new.list
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/smoothwall/disk_hook.sh b/IMG/cpio/ventoy/hook/smoothwall/disk_hook.sh
new file mode 100644 (file)
index 0000000..94827cd
--- /dev/null
@@ -0,0 +1,52 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
+vtDM=$(ventoy_find_dm_id ${blkdev_num})
+
+if [ "$1" = "fakecdrom" ]; then
+    if [ -e /dev/sr0 ]; then
+        for i in 0 1 2 3 4 5 6 7 8; do
+            if ! [ -e /dev/sr$i ]; then
+                mv /dev/sr0 /dev/sr$i
+                cp -a /dev/$vtDM /dev/sr0
+                break
+            fi
+        done
+    else
+        cp -a /dev/$vtDM /dev/sr0
+    fi
+fi
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/smoothwall/ventoy-hook.sh b/IMG/cpio/ventoy/hook/smoothwall/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..c2dd611
--- /dev/null
@@ -0,0 +1,25 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "/Running installer/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/smoothwall/disk_hook.sh fakecdrom" -i /etc/install.rc
+
+$SED "/cd \/sys\/block/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/smoothwall/disk_hook.sh" -i /etc/config-install.rc
+$SED "/wc *-l *\/tmp\/cd.list/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/smoothwall/cd_list.sh" -i /etc/config-install.rc
diff --git a/IMG/cpio/ventoy/hook/suse/disk_hook.sh b/IMG/cpio/ventoy/hook/suse/disk_hook.sh
new file mode 100644 (file)
index 0000000..d736cb8
--- /dev/null
@@ -0,0 +1,64 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+
+ventoy_os_install_dmsetup_by_fuse() {
+    vtlog "ventoy_os_install_dmsetup_by_fuse $*"
+
+    mkdir -p $VTOY_PATH/mnt/fuse $VTOY_PATH/mnt/iso $VTOY_PATH/mnt/squashfs
+
+    vtoydm -p -f $VTOY_PATH/ventoy_image_map -d $1 > $VTOY_PATH/ventoy_dm_table
+    vtoy_fuse_iso -f $VTOY_PATH/ventoy_dm_table -m $VTOY_PATH/mnt/fuse
+
+    mount -t iso9660  $VTOY_PATH/mnt/fuse/ventoy.iso    $VTOY_PATH/mnt/iso
+    
+    mount -t squashfs $VTOY_PATH/mnt/iso/system/squashfs_sys.img  $VTOY_PATH/mnt/squashfs
+
+    KoName=$(ls $VTOY_PATH/mnt/squashfs/lib/modules/$2/kernel/drivers/md/dm-mod.ko*)
+    vtlog "insmod $KoName"
+    insmod $KoName
+
+    umount $VTOY_PATH/mnt/squashfs   2>>$VTLOG
+    umount $VTOY_PATH/mnt/iso        2>>$VTLOG
+    umount $VTOY_PATH/mnt/fuse       2>>$VTLOG
+}
+
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+modprobe fuse
+ventoy_os_install_dmsetup_by_fuse $vtdiskname $(uname -r)
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+mknod -m 0660 /dev/ventoy b $blkdev_num
+
+PATH=$VTPATH_OLD
index 19b90687886ee7a926a79083d4c698829abdfa83..9574efe57f4909e99361f70f720fd8767c337450 100644 (file)
@@ -31,5 +31,14 @@ fi
 #echo "install: hd:/?device=/dev/mapper/ventoy" >> /info-ventoy
 #$SED "1 iinfo: file:/info-ventoy" -i /linuxrc.config
 
-ventoy_systemd_udevd_work_around
-ventoy_add_udev_rule "$VTOY_PATH/hook/suse/udev_disk_hook.sh %k"
+if [ -e /etc/initrd.functions ] && $GREP -q 'HPIP' /etc/initrd.functions; then
+    echo "HPIP" >> $VTLOG    
+    $BUSYBOX_PATH/mkdir /dev
+    $BUSYBOX_PATH/mknod -m 660 /dev/console b 5 1
+    $SED "/CD_DEVICES=/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/suse/disk_hook.sh" -i /etc/initrd.functions
+    $SED "/CD_DEVICES=/a CD_DEVICES=\"/dev/ventoy \$CD_DEVICES\"" -i /etc/initrd.functions
+else
+    echo "SUSE" >> $VTLOG
+    ventoy_systemd_udevd_work_around
+    ventoy_add_udev_rule "$VTOY_PATH/hook/suse/udev_disk_hook.sh %k"
+fi
diff --git a/IMG/cpio/ventoy/hook/t2/disk_hook.sh b/IMG/cpio/ventoy/hook/t2/disk_hook.sh
new file mode 100644 (file)
index 0000000..d3b79a4
--- /dev/null
@@ -0,0 +1,47 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+modprobe dm-mod
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | grep ventoy | sed 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+mknod -m 0660 /dev/ventoy b $blkdev_num
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
+
diff --git a/IMG/cpio/ventoy/hook/t2/ventoy-hook.sh b/IMG/cpio/ventoy/hook/t2/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..2329265
--- /dev/null
@@ -0,0 +1,24 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED  "/getdevice *devicefile/i $BUSYBOX_PATH/sh $VTOY_PATH/hook/t2/disk_hook.sh"  -i /init
+$SED  "/getdevice *devicefile/a devicefile=/dev/ventoy"  -i /init
+
index bb1cb31586c452f59b86ecc734090b378c9baa02..0f9c74ff888754a4ed19e748a5590a21def7bac1 100644 (file)
@@ -343,6 +343,37 @@ extract_file_from_line() {
     fi
 }
 
+extract_rpm_from_line() {
+    vtlog "extract_rpm_from_line $1 disk=#$2#"
+
+    if ! [ -b "$2" ]; then
+        vterr "disk #$2# not exist"
+        return 
+    fi
+
+    sector=$(echo $1 | $AWK '{print $(NF-1)}')
+    length=$(echo $1 | $AWK '{print $NF}')
+    vtlog "sector=$sector  length=$length"
+    
+    $VTOY_PATH/tool/vtoydm -e -f $VTOY_PATH/ventoy_image_map -d ${2} -s $sector -l $length -o /tmp/xxx.rpm
+    if [ -e /tmp/xxx.rpm ]; then
+        vtlog "extract rpm file from iso success"
+    else
+        vterr "extract rpm file from iso fail"
+        return
+    fi
+    
+    CURPWD=$($BUSYBOX_PATH/pwd)
+    
+    $BUSYBOX_PATH/mkdir -p $VTOY_PATH/rpm
+    cd $VTOY_PATH/rpm
+    vtlog "extract rpm..."
+    $BUSYBOX_PATH/rpm2cpio /tmp/xxx.rpm | $BUSYBOX_PATH/cpio -idm 2>>$VTLOG
+    cd $CURPWD
+    
+    $BUSYBOX_PATH/rm -f /tmp/xxx.rpm 
+}
+
 install_rpm_from_line() {
     vtlog "install_rpm_from_line $1 disk=#$2#"
 
@@ -535,9 +566,9 @@ ventoy_swap_device() {
 ventoy_extract_vtloopex() {
     vtCurPwd=$PWD
     $BUSYBOX_PATH/mkdir -p $VTOY_PATH/partmnt $VTOY_PATH/vtloopex
-    $BUSYBOX_PATH/mount -o ro -t vfat /dev/${vtdiskname#/dev/}2  $VTOY_PATH/partmnt
+    $BUSYBOX_PATH/mount -o ro -t vfat $1  $VTOY_PATH/partmnt
     cd $VTOY_PATH/vtloopex
-    $CAT $VTOY_PATH/partmnt/ventoy/vtloopex.cpio | $BUSYBOX_PATH/cpio -idm
+    $CAT $VTOY_PATH/partmnt/ventoy/vtloopex.cpio | $BUSYBOX_PATH/cpio -idm >> $VTLOG 2>&1
     $BUSYBOX_PATH/umount $VTOY_PATH/partmnt
     $BUSYBOX_PATH/rm -rf $VTOY_PATH/partmnt    
 
index 97cddd60f1d308f126fc3ea0353a4a2b19e877cd..a358fc11393d21719f47852ae68f668cd50c1618 100644 (file)
 
 . /ventoy/hook/ventoy-hook-lib.sh
 
-while [ -n "1" ]; do
-    if [ -e /dev/null ]; then
-        break
-    else
-        $SLEEP 0.5
-    fi
-done
+vine_wait_for_exist() {
+    while [ -n "1" ]; do
+        if [ -e $1 ]; then
+            break
+        else
+            $SLEEP 0.5
+        fi
+    done
+}
+
+vine_wait_for_exist /dev/null
+vine_wait_for_exist /sys/block
+vine_wait_for_exist /proc/ide
 
-while [ -n "1" ]; do
-    if [ -e /sys/block ]; then
-        break
-    else
-        $SLEEP 0.5
-    fi
-done
 
 while [ -n "Y" ]; do
     vtdiskname=$(get_ventoy_disk_name)
@@ -51,13 +50,14 @@ if ! [ -b $vtdiskname ]; then
     $BUSYBOX_PATH/mknod -m 0660 $vtdiskname b $blkdev
 fi
 
+if ! [ -b "${vtdiskname}1" ]; then
+    blkdev=$($CAT /sys/class/block/${vtshortdev}1/dev | $SED 's/:/ /g')
+    $BUSYBOX_PATH/mknod -m 0660 "${vtdiskname}1" b $blkdev
+fi
+
 if ! [ -b "${vtdiskname}2" ]; then
     blkdev=$($CAT /sys/class/block/${vtshortdev}2/dev | $SED 's/:/ /g')
     $BUSYBOX_PATH/mknod -m 0660 "${vtdiskname}2" b $blkdev
 fi
 
-$BUSYBOX_PATH/ls /dev/ > /dev/console
-
 $BUSYBOX_PATH/sh $VTOY_PATH/hook/vine/udev_disk_hook.sh "${vtdiskname#/dev/}2"
-
-
index 8209095a3f5a8f7e15a421a0e24cacc642fa77ff..1ea6d671ec8c5829709262a9b6a5f28ce31d58fe 100644 (file)
 
 . /ventoy/hook/ventoy-hook-lib.sh
 
-vtCheatLoop=loop6
+ventoy_os_install_dmsetup_by_ko() {
+    vtlog "ventoy_os_install_dmsetup_by_ko $1"
+    
+    vtVer=$($BUSYBOX_PATH/uname -r)
+    if $BUSYBOX_PATH/uname -m | $GREP -q 64; then
+        vtBit=64
+    else
+        vtBit=32
+    fi
+    
+    ventoy_extract_vtloopex $1  vine
+    vtLoopExDir=$VTOY_PATH/vtloopex/vine/vtloopex
+    
+    if [ -e $vtLoopExDir/dm-mod/$vtVer/$vtBit/dm-mod.ko.xz ]; then
+        $BUSYBOX_PATH/xz -d $vtLoopExDir/dm-mod/$vtVer/$vtBit/dm-mod.ko.xz
+        insmod $vtLoopExDir/dm-mod/$vtVer/$vtBit/dm-mod.ko
+    fi
+}
 
-ventoy_os_install_dmsetup() {
-    vtlog "ventoy_os_install_dmsetup $1"
+ventoy_os_install_dmsetup_by_rpm() {
+    vtlog "ventoy_os_install_dmsetup_by_rpm $1"
     
     vt_usb_disk=$1
 
@@ -32,48 +49,47 @@ ventoy_os_install_dmsetup() {
     # install dmsetup 
     LINE=$($GREP 'kernel-[0-9].*\.rpm'  $VTOY_PATH/iso_file_list)
     if [ $? -eq 0 ]; then
-        install_rpm_from_line "$LINE" ${vt_usb_disk}
+        extract_rpm_from_line "$LINE" ${vt_usb_disk}
     fi
 
-    $BUSYBOX_PATH/modprobe dm-mod
+    vtKoName=$($BUSYBOX_PATH/find $VTOY_PATH/rpm/ -name dm-mod.ko*)
+    vtlog "vtKoName=$vtKoName"
 
-    vtlog "dmsetup install finish, now check it..."
+    insmod $vtKoName
     
-    dmsetup_path=/ventoy/tool/dmsetup
-    if [ -z "$dmsetup_path" ]; then
-        vterr "dmsetup still not found after install"
-    elif $dmsetup_path info >> $VTLOG 2>&1; then
-        vtlog "$dmsetup_path work ok"
-    else
-        vterr "$dmsetup_path not work"
-    fi
+    $BUSYBOX_PATH/rm -rf $VTOY_PATH/rpm/
 }
 
-
-if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then
-    # /dev/vtCheatLoop come first
-    if [ "$1" = "$vtCheatLoop" ] && [ -b $VTOY_DM_PATH ]; then
-        ventoy_copy_device_mapper  /dev/$vtCheatLoop
-    fi
+if is_ventoy_hook_finished || not_ventoy_disk "${1:0:-1}"; then    
     exit 0
 fi
 
-ventoy_os_install_dmsetup "/dev/${1:0:-1}"
+ventoy_os_install_dmsetup_by_ko "/dev/$1"
+if $GREP -q 'device.mapper' /proc/devices; then
+    vtlog "device-mapper module install OK"
+else
+    ventoy_os_install_dmsetup_by_rpm "/dev/${1:0:-1}"
+fi
+
+ventoy_udev_disk_common_hook $*
 
-ventoy_udev_disk_common_hook $* "noreplace"
+blkdev_num=$($VTOY_PATH/tool/dmsetup ls | $GREP ventoy | $SED 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1:\2/')
+blkdev_num_dev=$($VTOY_PATH/tool/dmsetup ls | $GREP ventoy | $SED 's/.*(\([0-9][0-9]*\),.*\([0-9][0-9]*\).*/\1 \2/')
+vtDM=$(ventoy_find_dm_id ${blkdev_num})
 
-$BUSYBOX_PATH/mount $VTOY_DM_PATH /mnt/ventoy
+[ -b /dev/$vtDM ] || $BUSYBOX_PATH/mknod -m 0660 /dev/$vtDM b $blkdev_num_dev
+$BUSYBOX_PATH/rm -rf /dev/mapper
 
-# 
-# We do a trick for rhel6 series here.
-# Use /dev/$vtCheatLoop and wapper it as a removable cdrom with bind mount.
-# Then the anaconda installer will accept /dev/$vtCheatLoop as the install medium.
-#
-ventoy_copy_device_mapper  /dev/$vtCheatLoop
+#Create a fake IDE-CDROM driver can't be ide-scsi   /proc has been patched to /vtoy
+$BUSYBOX_PATH/mkdir -p /vtoy
+$BUSYBOX_PATH/cp -a /proc/ide /vtoy/
+$BUSYBOX_PATH/mkdir -p /vtoy/ide/aztcd
+
+echo 'ide' > /vtoy/ide/aztcd/driver
+echo 'cdrom' > /vtoy/ide/aztcd/media
 
-$BUSYBOX_PATH/cp -a /sys/devices/virtual/block/$vtCheatLoop /tmp/ >> $VTLOG 2>&1
-echo 19 > /tmp/$vtCheatLoop/capability
-$BUSYBOX_PATH/mount --bind /tmp/$vtCheatLoop /sys/block/$vtCheatLoop >> $VTLOG 2>&1
 
 # OK finish
 set_ventoy_hook_finish
+
+exit 0
index a9deb4089fe53e129d17e83e770e73c001c3a308..d10c2ea130a5819ac50c64c6b4a83db4a59eeea4 100644 (file)
 
 . $VTOY_PATH/hook/ventoy-os-lib.sh
 
-$BUSYBOX_PATH/mkdir -p /etc/anaconda.repos.d  /mnt/ventoy
-ventoy_print_yum_repo "ventoy" "file:///mnt/ventoy" > /etc/anaconda.repos.d/ventoy.repo
-
+$BUSYBOX_PATH/cp -a /sbin/loader /sbin/loader_bk
+$VTOY_PATH/tool/vine_patch_loader /sbin/loader 253 -v >> $VTLOG
 
 $BUSYBOX_PATH/mknod -m 0660 /dev/null c 1 3
 $VTOY_PATH/hook/vine/dev-listen.sh  &  
-
diff --git a/IMG/cpio/ventoy/hook/wifislax/disk_hook.sh b/IMG/cpio/ventoy/hook/wifislax/disk_hook.sh
new file mode 100644 (file)
index 0000000..aff0f98
--- /dev/null
@@ -0,0 +1,48 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+vtlog "##### $0 $* #####"
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+while true; do
+    if blkid | grep -q '/dev/dm'; then
+        vtlog 'Find /dev/dm ...'
+        break
+    else
+        vtlog 'Wait /dev/dm ...'
+        sleep 0.3
+    fi
+done
+
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/hook/wifislax/ventoy-hook.sh b/IMG/cpio/ventoy/hook/wifislax/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..f2073b9
--- /dev/null
@@ -0,0 +1,26 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "/mount.*devtmpfs/a $BUSYBOX_PATH/sh $VTOY_PATH/hook/wifislax/disk_hook.sh" -i /linuxrc
+
+#replace original blkid
+$BUSYBOX_PATH/rm -f /usr/bin/blkid
+$BUSYBOX_PATH/cp -a $BUSYBOX_PATH/blkid /usr/bin/blkid
index 7a102265a5357f87074a1d3c37daf988a6dc4849..666068f4e58d1f5e808585ee3ee3eeb0cd7743ba 100644 (file)
@@ -37,9 +37,11 @@ else
 fi
 
 ventoy_is_initrd_ramdisk() {
-    #As I known, PCLinuxOS use ramdisk
+    #As I known, PCLinuxOS/smgl use ramdisk
     if echo $vtkerver | grep -i -q 'PCLinuxOS'; then
         true
+    elif echo $vtkerver | grep -i -q 'SMGL-'; then
+        true
     else
         false
     fi
@@ -68,7 +70,7 @@ ventoy_unpack_initramfs() {
         return
     fi
     
-    for vtx in '1F8B zcat' '1F9E zcat' '425A bzcat' '5D00 lzcat' 'FD37 xzcat' '894C lzopcat' '0221 lz4cat' '28B5 zstdcat' '3037 cat'; do
+    for vtx in '1F8B zcat' '1F9E zcat' '425A bzcat' '5D00 lzcat' 'FD37 xzcat' '894C lzopcat' '0221 lz4cat' '28B5 zstdcat' '3037 cat' '4C5A lunzip -c'; do
         if [ "${vtx:0:4}" = "${vtmagic:0:4}" ]; then
             echo "vtx=$vtx" >> $VTLOG            
             if [ $vtskip -eq 0 ]; then            
diff --git a/IMG/cpio/ventoy/loop/LibreELEC/ventoy-disk.sh b/IMG/cpio/ventoy/loop/LibreELEC/ventoy-disk.sh
new file mode 100644 (file)
index 0000000..027a4c6
--- /dev/null
@@ -0,0 +1,62 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+vtlog "####### $0 $* ########"
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+vtKerVer=$(uname -r)
+if uname -m | grep -q 64; then
+    vtBit=64
+else
+    vtBit=32
+fi
+
+xz -d $VTOY_PATH/vtloopex/dm-mod/$vtKerVer/$vtBit/dm-mod.ko.xz
+insmod $VTOY_PATH/vtloopex/dm-mod/$vtKerVer/$vtBit/dm-mod.ko
+
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+ventoy_create_dev_ventoy_part
+
+mkdir /ventoy/mnt
+mount /dev/ventoy2 /ventoy/mnt
+rm -f /ventoy/mnt/.please_resize_me
+sync
+umount /ventoy/mnt
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/loop/LibreELEC/ventoy-hook.sh b/IMG/cpio/ventoy/loop/LibreELEC/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..1636632
--- /dev/null
@@ -0,0 +1,23 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "/mount_flash.*{/a\ $BUSYBOX_PATH/sh $VTOY_PATH/loop/LibreELEC/ventoy-disk.sh" -i /init
+
diff --git a/IMG/cpio/ventoy/loop/batocera/ventoy-disk.sh b/IMG/cpio/ventoy/loop/batocera/ventoy-disk.sh
new file mode 100644 (file)
index 0000000..08c9d73
--- /dev/null
@@ -0,0 +1,45 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+vtlog "####### $0 $* ########"
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+ventoy_create_dev_ventoy_part
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/loop/batocera/ventoy-hook.sh b/IMG/cpio/ventoy/loop/batocera/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..2bb7c8e
--- /dev/null
@@ -0,0 +1,23 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "/mount.*devtmpfs/a\ $BUSYBOX_PATH/sh $VTOY_PATH/loop/batocera/ventoy-disk.sh" -i /init
+
diff --git a/IMG/cpio/ventoy/loop/freedombox/ventoy-disk.sh b/IMG/cpio/ventoy/loop/freedombox/ventoy-disk.sh
new file mode 100644 (file)
index 0000000..5ebc7f9
--- /dev/null
@@ -0,0 +1,47 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+vtlog "####### $0 $* ########"
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+insmod $VTOY_PATH/modules/dm-mod.ko
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+ventoy_create_dev_ventoy_part
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/loop/freedombox/ventoy-hook.sh b/IMG/cpio/ventoy/loop/freedombox/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..2585391
--- /dev/null
@@ -0,0 +1,22 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED  "/local_mount_root *$/i $BUSYBOX_PATH/sh $VTOY_PATH/loop/freedombox/ventoy-disk.sh"  -i /scripts/local
diff --git a/IMG/cpio/ventoy/loop/lakka/ventoy-disk.sh b/IMG/cpio/ventoy/loop/lakka/ventoy-disk.sh
new file mode 100644 (file)
index 0000000..027a4c6
--- /dev/null
@@ -0,0 +1,62 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+vtlog "####### $0 $* ########"
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+vtKerVer=$(uname -r)
+if uname -m | grep -q 64; then
+    vtBit=64
+else
+    vtBit=32
+fi
+
+xz -d $VTOY_PATH/vtloopex/dm-mod/$vtKerVer/$vtBit/dm-mod.ko.xz
+insmod $VTOY_PATH/vtloopex/dm-mod/$vtKerVer/$vtBit/dm-mod.ko
+
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+ventoy_create_dev_ventoy_part
+
+mkdir /ventoy/mnt
+mount /dev/ventoy2 /ventoy/mnt
+rm -f /ventoy/mnt/.please_resize_me
+sync
+umount /ventoy/mnt
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/loop/lakka/ventoy-hook.sh b/IMG/cpio/ventoy/loop/lakka/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..0fd0180
--- /dev/null
@@ -0,0 +1,23 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "/mount_flash.*{/a\ $BUSYBOX_PATH/sh $VTOY_PATH/loop/lakka/ventoy-disk.sh" -i /init
+
diff --git a/IMG/cpio/ventoy/loop/paldo/ventoy-disk.sh b/IMG/cpio/ventoy/loop/paldo/ventoy-disk.sh
new file mode 100644 (file)
index 0000000..ef45f04
--- /dev/null
@@ -0,0 +1,47 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+vtlog "####### $0 $* ########"
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+modprobe dm-mod
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+ventoy_create_dev_ventoy_part
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/loop/paldo/ventoy-hook.sh b/IMG/cpio/ventoy/loop/paldo/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..efdff62
--- /dev/null
@@ -0,0 +1,22 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED  "/for *dev *in .*root/i $BUSYBOX_PATH/sh $VTOY_PATH/loop/paldo/ventoy-disk.sh"  -i /init
diff --git a/IMG/cpio/ventoy/loop/recalbox/ventoy-disk.sh b/IMG/cpio/ventoy/loop/recalbox/ventoy-disk.sh
new file mode 100644 (file)
index 0000000..08c9d73
--- /dev/null
@@ -0,0 +1,45 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+vtlog "####### $0 $* ########"
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+ventoy_create_dev_ventoy_part
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/loop/recalbox/ventoy-hook.sh b/IMG/cpio/ventoy/loop/recalbox/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..b1a6ed3
--- /dev/null
@@ -0,0 +1,23 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$SED "/mount.*devtmpfs/a\ $BUSYBOX_PATH/sh $VTOY_PATH/loop/recalbox/ventoy-disk.sh" -i /init
+
diff --git a/IMG/cpio/ventoy/loop/ubos/newroot-hook.sh b/IMG/cpio/ventoy/loop/ubos/newroot-hook.sh
new file mode 100644 (file)
index 0000000..ecc0f18
--- /dev/null
@@ -0,0 +1,26 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+sed "/.* \/boot /d"  -i /new_root/etc/fstab
+
+PATH=$VTPATH_OLD
diff --git a/IMG/cpio/ventoy/loop/ubos/ventoy-disk.sh b/IMG/cpio/ventoy/loop/ubos/ventoy-disk.sh
new file mode 100644 (file)
index 0000000..a095067
--- /dev/null
@@ -0,0 +1,48 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. /ventoy/hook/ventoy-hook-lib.sh
+
+if is_ventoy_hook_finished; then
+    exit 0
+fi
+
+vtlog "####### $0 $* ########"
+
+VTPATH_OLD=$PATH; PATH=$BUSYBOX_PATH:$VTOY_PATH/tool:$PATH
+
+xz -d $VTOY_PATH/modules/dm-mod.ko.xz
+insmod $VTOY_PATH/modules/dm-mod.ko
+
+wait_for_usb_disk_ready
+
+vtdiskname=$(get_ventoy_disk_name)
+if [ "$vtdiskname" = "unknown" ]; then
+    vtlog "ventoy disk not found"
+    PATH=$VTPATH_OLD
+    exit 0
+fi
+
+ventoy_udev_disk_common_hook "${vtdiskname#/dev/}2" "noreplace"
+
+ventoy_create_dev_ventoy_part
+
+PATH=$VTPATH_OLD
+
+set_ventoy_hook_finish
diff --git a/IMG/cpio/ventoy/loop/ubos/ventoy-hook.sh b/IMG/cpio/ventoy/loop/ubos/ventoy-hook.sh
new file mode 100644 (file)
index 0000000..ef79b2a
--- /dev/null
@@ -0,0 +1,30 @@
+#!/ventoy/busybox/sh
+#************************************************************************************
+# Copyright (c) 2020, longpanda <admin@ventoy.net>
+# 
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# 
+#************************************************************************************
+
+. $VTOY_PATH/hook/ventoy-os-lib.sh
+
+$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/default/10-dm.rules        /lib/udev/rules.d/
+$BUSYBOX_PATH/cp -a $VTOY_PATH/hook/default/13-dm-disk.rules   /lib/udev/rules.d/
+
+$SED "/^\"\$mount_handler\"/i\ $BUSYBOX_PATH/sh $VTOY_PATH/loop/ubos/ventoy-disk.sh" -i /init
+
+$SED "/^\"\$mount_handler\"/a\ $BUSYBOX_PATH/sh $VTOY_PATH/loop/ubos/newroot-hook.sh" -i /init
+
+$SED "/^\"\$mount_handler\"/a\ init=/usr/lib/systemd/systemd" -i /init
+
index 5a643b683a2e36b0d32658559ff066195c0912a8..d07821b97b9f7174404d4acecbcf99b58303915e 100644 (file)
@@ -53,6 +53,7 @@ else
 fi
 
 
+
 if $VTOY_PATH/tool/unsquashfs_64 -t 2>>$VTLOG; then
     echo "use unsquashfs_64" >>$VTLOG
     $BUSYBOX_PATH/cp -a $VTOY_PATH/tool/unsquashfs_64  $VTOY_PATH/tool/vtoy_unsquashfs
index f8f0f5dfdf4d16565c9748add5b3330b26911427..613069945a5b220ca072d31f37dadd13fae37a7d 100644 (file)
@@ -249,6 +249,58 @@ ventoy_get_os_type() {
         echo 'crux'; return
     fi
     
+    if [ -f /init ]; then
+        if $GREP -q 'AryaLinux' /init; then
+            echo 'aryalinux'; return
+        elif $GREP -q 'Dragora' /init; then
+            echo 'dragora'; return
+            
+        fi
+    fi
+    
+    if $GREP -q 'slackware' /proc/version; then
+        echo 'slackware'; return
+    fi
+    
+    if $BUSYBOX_PATH/hostname | $GREP -q 'smoothwall'; then
+        echo 'smoothwall'; return
+    fi 
+    
+    if $GREP -q 'photon' /proc/version; then
+        echo 'photon'; return
+    fi
+    
+    if $GREP -q 'ploplinux' /proc/version; then
+        echo 'ploplinux'; return
+    fi
+    
+    if $GREP -q 'lunar' /proc/version; then
+        echo 'lunar'; return
+    fi
+    
+    if $GREP -q 'SMGL-' /proc/version; then
+        echo 'smgl'; return
+    fi
+    
+    if $GREP -q 'rancher' /proc/version; then
+        echo 'rancher'; return
+    fi
+    
+    
+    if [ -e /init ]; then
+        if $GREP -q -m1 'T2 SDE' /init; then
+            echo 't2'; return
+        fi
+    fi
+    
+    if $GREP -q 'wifislax' /proc/version; then
+        echo 'wifislax'; return
+    fi
+    
+    if $GREP -q 'pisilinux' /proc/version; then
+        echo 'pisilinux'; return
+    fi
+    
     echo "default"
 }
 
index a1be76dcccfe57e9b4ddc459ef98314169cd0f89..c6f12dfca59d9d71b179603445e08c9137bfa52d 100644 (file)
@@ -92,6 +92,10 @@ ventoy_get_os_type() {
         fi
     fi
     
+    if $GREP -q 'ventoyos=' /proc/cmdline; then
+        $SED "s/.*ventoyos=\([a-zA-Z0-9_-]*\).*/\1/" /proc/cmdline; return 
+    fi    
+    
     echo "default"
 }
 
index adbe1753715f6ff9562eae874d1aeb09e8b8591a..853e26205c7b59951dac2cab8ff7ae9a379b6f23 100644 (file)
@@ -21,6 +21,9 @@ cp -a $VENTOY_PATH/SQUASHFS/unsquashfs_* tool/
 cp -a $VENTOY_PATH/FUSEISO/vtoy_fuse_iso_* tool/
 cp -a $VENTOY_PATH/VtoyTool/vtoytool tool/
 cp -a $VENTOY_PATH/VBLADE/vblade-master/vblade_* tool/
+cp -a $VENTOY_PATH/LZIP/lunzip32 tool/
+cp -a $VENTOY_PATH/LZIP/lunzip64 tool/
+
 
 chmod -R 777 ./tool
 
diff --git a/IMG/vtloopex/LibreELEC/vtloopex/dm-mod/5.1.16/64/dm-mod.ko.xz b/IMG/vtloopex/LibreELEC/vtloopex/dm-mod/5.1.16/64/dm-mod.ko.xz
new file mode 100644 (file)
index 0000000..e4a5d79
Binary files /dev/null and b/IMG/vtloopex/LibreELEC/vtloopex/dm-mod/5.1.16/64/dm-mod.ko.xz differ
diff --git a/IMG/vtloopex/dragora/vtloopex/dm-mod/4.19.79-gnu/64/dm-mod.ko.xz b/IMG/vtloopex/dragora/vtloopex/dm-mod/4.19.79-gnu/64/dm-mod.ko.xz
new file mode 100644 (file)
index 0000000..14ff12f
Binary files /dev/null and b/IMG/vtloopex/dragora/vtloopex/dm-mod/4.19.79-gnu/64/dm-mod.ko.xz differ
diff --git a/IMG/vtloopex/lakka/vtloopex/dm-mod/4.11.12-rt14/64/dm-mod.ko.xz b/IMG/vtloopex/lakka/vtloopex/dm-mod/4.11.12-rt14/64/dm-mod.ko.xz
new file mode 100644 (file)
index 0000000..20a1a7f
Binary files /dev/null and b/IMG/vtloopex/lakka/vtloopex/dm-mod/4.11.12-rt14/64/dm-mod.ko.xz differ
diff --git a/IMG/vtloopex/vine/vtloopex/dm-mod/4.4.52-2vl6/64/dm-mod.ko.xz b/IMG/vtloopex/vine/vtloopex/dm-mod/4.4.52-2vl6/64/dm-mod.ko.xz
new file mode 100644 (file)
index 0000000..84084f6
Binary files /dev/null and b/IMG/vtloopex/vine/vtloopex/dm-mod/4.4.52-2vl6/64/dm-mod.ko.xz differ
index a20cb6955f68c2889643e9ffe079aa3576f190e0..2bdce8e18546907841aa436e03101b5d8e90bfc1 100644 (file)
Binary files a/INSTALL/EFI/BOOT/grubx64_real.efi and b/INSTALL/EFI/BOOT/grubx64_real.efi differ
index fad0c0bcadce7e897356ad1d375597eb38c25f4e..61f28d565a39ed1b4a412258363414d31ad51821 100644 (file)
@@ -1,7 +1,7 @@
 
 ========== Ventoy2Disk.sh ===============
 
-sudo sh Ventoy2Disk.sh { -i | -I | -u } /dev/XXX   XXX is the USB device, for example /dev/sdb.
+sudo sh Ventoy2Disk.sh { -i | -I | -u } /dev/sdX   sdX is the USB device, for example /dev/sdb.
 
 Ventoy2Disk.sh CMD [ OPTION ] /dev/sdX
   CMD:
@@ -13,16 +13,25 @@ Ventoy2Disk.sh CMD [ OPTION ] /dev/sdX
    -r SIZE_MB  preserve some space at the bottom of the disk (only for install)
    -s          enable secure boot support (default is disabled)
    -g          use GPT partition style, default is MBR style (only for install)
-   
+
+Please refer https://www.ventoy.net/en/doc_start.html for details.   
+
+
+
+
 
 ========== CreatePersistentImg.sh ===============
 
-sudo sh CreatePersistentImg.sh
+sudo sh CreatePersistentImg.sh  [ -s SIZE_IN_MB ] [ -t FSTYPE ] [ -l LABEL ]   for example:
+
+sh CreatePersistentImg.sh                 ---->  persistence.dat in 1GB size and ext4 filesystem and casper-rw label
+sh CreatePersistentImg.sh -l MX-Persist   ---->  persistence.dat in 1GB size and ext4 filesystem and MX-Persist label
+sh CreatePersistentImg.sh -s 2048         ---->  persistence.dat in 2GB size and ext4 filesystem and casper-rw label
+sh CreatePersistentImg.sh -s 4096 -t xfs  ---->  persistence.dat in 4GB size and xfs  filesystem  (ext2/3/4 xfs are supported)  and casper-rw label
+
+Please refer https://www.ventoy.net/en/plugin_persistence.html for details.
+
+
 
-sh CreatePersistentImg.sh  [ -s SIZE_IN_MB ] [ -t FSTYPE ] [ -l LABEL ]   for example:
 
-sh CreatePersistentImg.sh                 ---->  persistence.img in 1GB size and ext4 filesystem and casper-rw label
-sh CreatePersistentImg.sh -l MX-Persist   ---->  persistence.img in 1GB size and ext4 filesystem and MX-Persist label
-sh CreatePersistentImg.sh -s 2048         ---->  persistence.img in 2GB size and ext4 filesystem and casper-rw label
-sh CreatePersistentImg.sh -s 4096 -t xfs  ---->  persistence.img in 4GB size and xfs  filesystem  (ext2/3/4 xfs are supported)  and casper-rw label
 
index 33789ac9b5433911948a64a1346290ce70d5e1d8..a4e81ce8d77d7a6bc247265a0bb88c6364a68bb4 100644 (file)
@@ -173,14 +173,28 @@ function distro_specify_initrd_file {
         vt_linux_specify_initrd_file /pmagic/initrd.img
     elif [ -e (loop)/boot/initrd.xz ]; then
         vt_linux_specify_initrd_file /boot/initrd.xz
+    elif [ -e (loop)/boot/initrd.gz ]; then
+        vt_linux_specify_initrd_file /boot/initrd.gz
     elif [ -f (loop)/boot/initrd ]; then
         vt_linux_specify_initrd_file /boot/initrd
     elif [ -f (loop)/boot/x86_64/loader/initrd ]; then
         vt_linux_specify_initrd_file /boot/x86_64/loader/initrd
     elif [ -f (loop)/boot/initramfs-x86_64.img ]; then
         vt_linux_specify_initrd_file /boot/initramfs-x86_64.img
-        
+    elif [ -f (loop)/boot/isolinux/initramfs_data64.cpio.gz ]; then 
+        vt_linux_specify_initrd_file /boot/isolinux/initramfs_data64.cpio.gz
 
+        
+    fi
+    
+    if [ -f (loop)/isolinux/initrd.gz ]; then 
+        vt_linux_specify_initrd_file /isolinux/initrd.gz
+    fi
+    
+    if [ "$vt_chosen_size" = "1133375488" ]; then
+        if [ -d (loop)/boot/grub/x86_64-efi ]; then
+            vt_cpio_busybox64
+        fi
     fi
 }
 
@@ -224,8 +238,19 @@ function distro_specify_initrd_file_phase2 {
         vt_linux_specify_initrd_file /initrd
     elif [ -f (loop)/live/initrd1 ]; then 
         vt_linux_specify_initrd_file /live/initrd1
+    elif [ -f (loop)/isolinux/initrd.img ]; then 
+        vt_linux_specify_initrd_file /isolinux/initrd.img
+    elif [ -f (loop)/isolinux/initrd.gz ]; then 
+        vt_linux_specify_initrd_file /isolinux/initrd.gz
+    elif [ -f (loop)/syslinux/kernel/initramfs.gz ]; then 
+        vt_linux_specify_initrd_file /syslinux/kernel/initramfs.gz    
     elif vt_strstr $vt_volume_id "Daphile"; then
         vt_linux_parse_initrd_isolinux   (loop)/isolinux/
+    elif [ -f (loop)/boot/rootfs.xz ]; then 
+        vt_linux_specify_initrd_file /boot/rootfs.xz
+        if [ "$grub_platform" != "pc" ]; then
+            vt_add_replace_file 0 "minimal\\x86_64\\rootfs.xz"
+        fi
         
     fi
 }
@@ -263,7 +288,13 @@ function ventoy_get_freenas_ver {
     fi
 }
 
+function ventoy_get_midnightbsd_ver {   
+    set vt_freebsd_ver=11.x
+}
+
 function ventoy_freebsd_proc {
+    set vtFreeBsdDistro=FreeBSD
+
     if vt_strstr "$vt_volume_id" "GHOSTBSD"; then
         ventoy_get_ghostbsd_ver $1 ${chosen_path}
     elif vt_strstr "$vt_volume_id" "FREENAS"; then
@@ -280,6 +311,9 @@ function ventoy_freebsd_proc {
         set vt_freebsd_ver=10.x
     elif regexp "^9_[0-9]" "$vt_volume_id"; then
         set vt_freebsd_ver=9.x
+    elif [ -d (loop)/usr/midnightbsd-dist ]; then
+        ventoy_get_midnightbsd_ver $1 ${chosen_path}
+        set vtFreeBsdDistro=MidnightBSD
     elif [ -e (loop)/bin/freebsd-version ]; then
         vt_unix_parse_freebsd_ver (loop)/bin/freebsd-version vt_userland_ver
         if regexp "\"13\.[0-9]-" "$vt_userland_ver"; then
@@ -334,7 +368,11 @@ function ventoy_freebsd_proc {
         fi
     done
     
-    vt_unix_replace_ko $vt_unix_mod_path (vtunix)/ventoy_unix/FreeBSD/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
+    if [ -e (loop)/usr/freebsd-dist/cloninst.sh ]; then
+        set vtFreeBsdDistro=ClonOS
+    fi
+    
+    vt_unix_replace_ko $vt_unix_mod_path (vtunix)/ventoy_unix/$vtFreeBsdDistro/geom_ventoy_ko/$vt_freebsd_ver/$vt_freebsd_bit/geom_ventoy.ko.xz
     vt_unix_replace_conf FreeBSD ${1}${chosen_path} 
 }
 
@@ -458,6 +496,8 @@ function uefi_linux_menu_func {
                 vt_add_replace_file $vtindex "EFI\\BOOT\\initrd.gz"
             elif [ -f (loop)/loader/entries/thinstation.conf ]; then
                 vt_add_replace_file $vtindex "boot\\initrd"
+            elif [ -f (loop)/loader/entries/pisi-efi-x86_64.conf ]; then
+                vt_add_replace_file $vtindex "EFI\\pisi\\initrd.img"
             fi
         elif [ -d (loop)/EFI/boot/entries ]; then
             if [ -f (loop)/parabola/boot/x86_64/parabolaiso.img ]; then
@@ -468,6 +508,8 @@ function uefi_linux_menu_func {
         elif [ -e (loop)/syslinux/alt0/full.cz ]; then
             vt_add_replace_file 0 "EFI\\BOOT\\full.cz"            
             set FirstTryBootFile='@EFI@BOOT@grubx64.efi'
+
+
         fi
         
     fi
@@ -649,6 +691,10 @@ function legacy_linux_menu_func {
         
         vt_linux_initrd_count vtcount
         if [ $vtcount -eq 0 ]; then
+            if [ -d (loop)/rancheros ]; then
+                vt_linux_parse_initrd_isolinux   (loop)/boot/  /boot/isolinux/
+            fi
+
             distro_specify_initrd_file_phase2
         fi
         
@@ -770,6 +816,11 @@ function ventoy_iso_busybox_ver {
         if vt_str_begin $vt_chosen_path "/deepin-live"; then
             set ventoy_busybox_ver=64
         fi
+    elif vt_str_begin $vt_volume_id "PHOTON_"; then
+        set ventoy_busybox_ver=64
+    elif vt_str_begin $vt_volume_id "smgl-test-quinq-x86_64"; then
+        set ventoy_busybox_ver=64
+        
     fi
 }
 
@@ -785,6 +836,8 @@ function iso_common_menuentry {
     #special process for Endless OS
     if vt_str_begin $vt_volume_id "Endless-OS"; then
         iso_endless_os_proc $vtoy_iso_part $vt_chosen_path
+    elif vt_str_begin $vt_volume_id "TENS-Public"; then
+        set vtcompat=1
     fi
 
     if [ "$grub_platform" = "pc" ]; then
@@ -845,9 +898,18 @@ function efi_common_menuentry {
     
     ventoy_debug_pause
     
-    ventoy_cli_console    
-    chainloader ${vtoy_path}/ventoy_x64.efi memdisk env_param=${env_param} isoefi=on ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
+    ventoy_cli_console
+
+    unset vtoy_dotefi_retry
+    chainloader ${vtoy_path}/ventoy_x64.efi memdisk env_param=${env_param} dotefi isoefi=on ${vtdebug_flag} mem:${vtoy_iso_buf_addr}:size:${vtoy_iso_buf_size}
     boot
+    
+    if [ -n "$vtoy_dotefi_retry" ]; then
+        unset vtoy_dotefi_retry
+        chainloader ${vtoy_iso_part}${vt_chosen_path}
+        boot
+    fi
+    
     ventoy_gui_console
 }
 
@@ -904,10 +966,147 @@ function ventoy_img_volumio {
     vt_unset_boot_opt
 }
 
+function ventoy_img_openelec {
+    elec_ver=$1
+    
+    vt_load_cpio  $vtoy_path/ventoy.cpio  ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
+    vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
+
+    loopback vtloopex $vtoy_efi_part/ventoy/vtloopex.cpio    
+    vt_img_extra_initrd_append  (vtloopex)/$elec_ver/vtloopex.tar.xz
+
+    ventoy_debug_pause
+
+    #boot image file
+    vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=$elec_ver
+    vt_img_hook_root
+    
+    set root=(vtimghd,1)
+    syslinux_configfile (vtimghd,1)/syslinux.cfg
+    
+    vt_img_unhook_root
+    vt_unset_boot_opt
+    loopback -d vtloopex
+}
+
+
+function ventoy_img_freedombox {
+    vt_load_cpio  $vtoy_path/ventoy.cpio  ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
+    vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
+
+    vt_get_lib_module_ver (vtimghd,1) /lib/modules/ vt_module_ver
+    if [ -n "$vt_module_ver" ]; then        
+        vt_img_extra_initrd_append  (vtimghd,1)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko
+    fi
+
+    ventoy_debug_pause
+
+    #boot image file
+    vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=freedombox
+    vt_img_hook_root
+    
+    configfile (vtimghd,1)/boot/grub/grub.cfg
+    
+    vt_img_unhook_root
+    vt_unset_boot_opt
+}
+
+function ventoy_img_paldo {
+    vt_load_cpio  $vtoy_path/ventoy.cpio  ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
+    vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
+
+    ventoy_debug_pause
+
+    #boot image file
+    vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=paldo
+    vt_img_hook_root
+    
+    vt_fs_enum_1st_file (vtimghd,1) /loader/entries/ vt_paldo_entry_conf
+    vt_file_basename $vt_paldo_entry_conf vtPaldoVer
+    
+    echo loading file...
+    linux (vtimghd,1)/linux-${vtPaldoVer} root=/dev/ventoy1 rootfstype=vfat
+    initrd (vtimghd,1)/initramfs-${vtPaldoVer}
+    boot
+    
+    vt_img_unhook_root
+    vt_unset_boot_opt
+}
+
+function ventoy_img_ubos {
+    vt_load_cpio  $vtoy_path/ventoy.cpio  ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
+    vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
+
+    vt_get_lib_module_ver (vtimghd,3) /lib/modules/ vt_module_ver
+    if [ -n "$vt_module_ver" ]; then        
+        vt_img_extra_initrd_append  (vtimghd,3)/lib/modules/$vt_module_ver/kernel/drivers/md/dm-mod.ko.xz
+    fi
+
+    ventoy_debug_pause
+
+    #boot image file
+    vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=ubos
+    vt_img_hook_root
+    
+    echo loading file...
+    linux (vtimghd,2)/vmlinuz-linux root=/dev/ventoy3 rw
+    initrd (vtimghd,2)/initramfs-linux.img
+    boot
+
+    vt_img_unhook_root
+    vt_unset_boot_opt
+}
+
+function ventoy_img_recalbox {
+    vt_load_cpio  $vtoy_path/ventoy.cpio  ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
+    vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
+
+    ventoy_debug_pause
+
+    #boot image file
+    vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=recalbox
+    vt_img_hook_root
+    
+    set root=(vtimghd,1)
+    configfile (vtimghd,1)/boot/grub/grub.cfg
+
+    vt_img_unhook_root
+    vt_unset_boot_opt
+}
+
+function ventoy_img_batocera {
+    vt_load_cpio  $vtoy_path/ventoy.cpio  ${vt_chosen_path} ${vtoy_iso_part} "busybox=$ventoy_busybox_ver"
+    vt_trailer_cpio ${vtoy_iso_part} ${vt_chosen_path} noinit
+
+    ventoy_debug_pause
+
+    #boot image file
+    vt_set_boot_opt rdinit=/vtoy/vtoy ventoyos=batocera
+    vt_img_hook_root
+    
+    set root=(vtimghd,1)
+    syslinux_configfile (vtimghd,1)/boot/syslinux/syslinux.cfg
+
+    vt_img_unhook_root
+    vt_unset_boot_opt
+}
+
+function ventoy_img_memtest86 {      
+    chainloader (vtimghd,1)/efi/boot/BOOTX64.efi
+    boot
+}
+
+function img_unsupport_tip {
+    echo -e "\n This IMG file is NOT supported now. \n"
+    echo -e " 当前不支持启动此 IMG 文件 \n"    
+    echo -e "\npress ENTER to exit (请按 回车 键返回) ..."    
+    read vtInputKey 
+}
 
 function img_common_menuentry {
+    set ventoy_compatible=YES
     set ventoy_busybox_ver=32
-    
+
     vt_chosen_img_path vt_chosen_path vt_chosen_size
 
     if [ -d (vtimghd)/ ]; then
@@ -925,24 +1124,53 @@ function img_common_menuentry {
 
     vt_img_extra_initrd_reset
 
-    #vt_get_fs_label (vtimghd,1) vtImgHd1Label
+    vt_get_fs_label (vtimghd,1) vtImgHd1Label
+    if [ -d (vtimghd,2)/lib ]; then
+        vt_get_fs_label (vtimghd,2) vtImgHd2Label
+    fi
+    
+    if [ -e (vtimghd,1)/etc/hostname ]; then
+        vt_1st_line (vtimghd,1)/etc/hostname vtImgHostname
+    fi
     
     if [ -e (vtimghd,1)/easy.sfs ]; then
         ventoy_img_easyos
     elif [ -e (vtimghd,1)/volumio.initrd ]; then
         ventoy_img_volumio
-    
-
+    elif vt_str_begin $vtImgHd1Label "LAKKA"; then
+        ventoy_img_openelec lakka
+    elif vt_str_begin $vtImgHd1Label "LIBREELEC"; then
+        ventoy_img_openelec LibreELEC
+    elif vt_str_begin $vtImgHd1Label "paldo-live"; then
+        ventoy_img_paldo
+    elif vt_str_begin $vtImgHostname "freedombox"; then
+        ventoy_img_freedombox
+    elif vt_str_begin $vtImgHd1Label "BATOCERA"; then
+        ventoy_img_batocera
+    elif [ "$vtImgHd2Label" = "RECALBOX" ]; then
+        ventoy_img_recalbox
+    elif [ -f (vtimghd,2)/loader/entries/ubos.conf ]; then
+        ventoy_img_ubos
+    elif [ -f (vtimghd,1)/efi/boot/mt86.png ]; then 
+        if [ "$grub_platform" = "pc" ]; then
+            img_unsupport_tip
+        else
+            ventoy_img_memtest86            
+        fi
     else
-        echo -e "\n This IMG file is NOT supported now. \n"
-        echo -e " 当前不支持启动此 IMG 文件 \n"    
-        echo -e "\npress ENTER to exit (请按 回车 键返回) ..."    
-        read vtInputKey        
+        if [ "$grub_platform" = "pc" ]; then 
+            img_unsupport_tip
+        else
+            vt_linux_chain_data ${vtoy_iso_part}${vt_chosen_path}
+            chainloader ${vtoy_path}/ventoy_x64.efi sector512 env_param=${env_param} isoefi=${LoadIsoEfiDriver} FirstTry=${FirstTryBootFile} ${vtdebug_flag} mem:${vtoy_chain_mem_addr}:size:${vtoy_chain_mem_size}
+            boot
+        fi
     fi
 
     set root=$vtback_root
     vt_pop_last_entry
     ventoy_gui_console
+    set ventoy_compatible=NO
 }
 
 function img_unsupport_menuentry {
@@ -957,7 +1185,7 @@ function img_unsupport_menuentry {
 #############################################################
 #############################################################
 
-set VENTOY_VERSION="1.0.19"
+set VENTOY_VERSION="1.0.20"
 
 # Default menu display mode, you can change it as you want.
 #    0: List mode   
index 60b90322f1e1f2a8c67b83bcca34436a2fc3d48f..1ed2226cf79b0f6f9e5a75a249c7bd7a43eb012b 100644 (file)
Binary files a/INSTALL/grub/i386-pc/core.img and b/INSTALL/grub/i386-pc/core.img differ
index bd1241f21f286473cd8c07aa70e29c848a165a59..1df9426622039e579f2f77aaa0a1e22b7774db29 100644 (file)
Binary files a/INSTALL/ventoy/ventoy.cpio and b/INSTALL/ventoy/ventoy.cpio differ
index 0e65ebab3bb889a4d499b8c035e4c1b2f63f993a..f4cf2e1d8b30fe61f54063ff53c7ca7949a749c8 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_unix.cpio and b/INSTALL/ventoy/ventoy_unix.cpio differ
index ff342b6c40c205eac23fefd004099aeed9994853..4175ec9cf8b4585916013a0cbd4800dbded779f4 100644 (file)
Binary files a/INSTALL/ventoy/ventoy_x64.efi and b/INSTALL/ventoy/ventoy_x64.efi differ
index 763a0374f8f3431a47477ccb6c1a30de8f106727..c58349400b64134c981af31346f4de4692bfd520 100644 (file)
Binary files a/INSTALL/ventoy/vtloopex.cpio and b/INSTALL/ventoy/vtloopex.cpio differ
index 06bdae5716dcbef8a80f56202d7e267ed0a2bf0c..83fd47524536e141b58bf76e9be2cc49f78856da 100644 (file)
Binary files a/INSTALL/ventoy/vtoyutil_x64.efi and b/INSTALL/ventoy/vtoyutil_x64.efi differ
index 73eb819c5da32c375921ec7257904b314ff5255b..6dd16b273fc4edefbcb91739ddb0d2112b7fae3b 100644 (file)
@@ -16,6 +16,7 @@ fi
 
 cd ../IMG
 sh mkcpio.sh
+sh mkloopex.sh
 cd -
 
 
@@ -103,9 +104,17 @@ for file in $(ls); do
     fi
 done
 
+#chmod 
 cd $CurDir
+find $tmpdir/ -type d -exec chmod 755 "{}" +
+find $tmpdir/ -type f -exec chmod 644 "{}" +
+chmod +x $tmpdir/Ventoy2Disk.sh
+chmod +x $tmpdir/CreatePersistentImg.sh
+
 tar -czvf ventoy-${curver}-linux.tar.gz $tmpdir
 
+
+
 rm -f ventoy-${curver}-windows.zip
 cp -a Ventoy2Disk*.exe $tmpdir/
 cp -a $LANG_DIR/languages.ini $tmpdir/ventoy/
diff --git a/LZIP/lunzip-1.11.tar.gz b/LZIP/lunzip-1.11.tar.gz
new file mode 100644 (file)
index 0000000..3ef326f
Binary files /dev/null and b/LZIP/lunzip-1.11.tar.gz differ
diff --git a/LZIP/lunzip32 b/LZIP/lunzip32
new file mode 100644 (file)
index 0000000..a422baf
Binary files /dev/null and b/LZIP/lunzip32 differ
diff --git a/LZIP/lunzip64 b/LZIP/lunzip64
new file mode 100644 (file)
index 0000000..f5ab4df
Binary files /dev/null and b/LZIP/lunzip64 differ
diff --git a/License/license-lunzip.txt b/License/license-lunzip.txt
new file mode 100644 (file)
index 0000000..8b4f5d0
--- /dev/null
@@ -0,0 +1,3 @@
+lunzip follows GPLv2+ license (see gpl-2.0.txt)\r
+\r
+Ventoy does not modify its source code, only its binary is used.\r
diff --git a/Unix/FreeBsdKernelVerMagic.txt b/Unix/FreeBsdKernelVerMagic.txt
new file mode 100644 (file)
index 0000000..cc2e830
--- /dev/null
@@ -0,0 +1,8 @@
+https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html#versions-13\r
+\r
+sysctl kern.osreldate\r
+/usr/src/sys/sys/param.h\r
+#define __FreeBSD_version 1300102\r
+\r
+Modify the /usr/src/sys/sys/param.h  __FreeBSD_version to the value get by sysctl kern.osreldate in the OS.\r
+\r
index 0e65ebab3bb889a4d499b8c035e4c1b2f63f993a..f4cf2e1d8b30fe61f54063ff53c7ca7949a749c8 100644 (file)
Binary files a/Unix/ventoy_unix.cpio and b/Unix/ventoy_unix.cpio differ
diff --git a/Unix/ventoy_unix/ClonOS/geom_ventoy_ko/13.x/64/geom_ventoy.ko.xz b/Unix/ventoy_unix/ClonOS/geom_ventoy_ko/13.x/64/geom_ventoy.ko.xz
new file mode 100644 (file)
index 0000000..4bef666
Binary files /dev/null and b/Unix/ventoy_unix/ClonOS/geom_ventoy_ko/13.x/64/geom_ventoy.ko.xz differ
diff --git a/Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/32/geom_ventoy.ko.xz b/Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/32/geom_ventoy.ko.xz
new file mode 100644 (file)
index 0000000..f3e1a97
Binary files /dev/null and b/Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/32/geom_ventoy.ko.xz differ
diff --git a/Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/64/geom_ventoy.ko.xz b/Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/64/geom_ventoy.ko.xz
new file mode 100644 (file)
index 0000000..61a9ac8
Binary files /dev/null and b/Unix/ventoy_unix/MidnightBSD/geom_ventoy_ko/11.x/64/geom_ventoy.ko.xz differ
diff --git a/Unix/ventoy_unix_src/ClonOS/geom_ventoy_src/13.x/SameAsFreeBSD13.x.txt b/Unix/ventoy_unix_src/ClonOS/geom_ventoy_src/13.x/SameAsFreeBSD13.x.txt
new file mode 100644 (file)
index 0000000..1f2b79f
--- /dev/null
@@ -0,0 +1 @@
+SameAsFreeBSD13.x
\ No newline at end of file
diff --git a/Unix/ventoy_unix_src/MidnightBSD/geom_ventoy_src/1.2/SameAsFreeBSD11.x.txt b/Unix/ventoy_unix_src/MidnightBSD/geom_ventoy_src/1.2/SameAsFreeBSD11.x.txt
new file mode 100644 (file)
index 0000000..d763fc0
--- /dev/null
@@ -0,0 +1 @@
+SameAsFreeBSD11.x
\ No newline at end of file
index 1c620d3cc264de32e6ea09eb072dfa8c20296436..5c3c39c0447afaecf447de9052eaa5566d6d15b4 100644 (file)
@@ -155,6 +155,16 @@ static int vtoy_check_os_param(ventoy_os_param *param)
     
     if (memcmp(&param->guid, &vtoy_guid, sizeof(ventoy_guid)))
     {
+        uint8_t *data1 = (uint8_t *)(&param->guid);
+        uint8_t *data2 = (uint8_t *)(&vtoy_guid);
+        
+        for (i = 0; i < 16; i++)
+        {
+            if (data1[i] != data2[i])
+            {
+                debug("guid not equal i = %u, 0x%02x, 0x%02x\n", i, data1[i], data2[i]);
+            }
+        }
         return 1;
     }
 
index f4237f55cbb29414bfe5df10af27519cf25d46d2..454063d2675ac318814af819a926c967e835f0bf 100644 (file)
@@ -35,10 +35,12 @@ int vtoydump_main(int argc, char **argv);
 int vtoydm_main(int argc, char **argv);
 int vtoytool_install(int argc, char **argv);
 int vtoyloader_main(int argc, char **argv);
+int vtoyvine_main(int argc, char **argv);
 
 static char *g_vtoytool_name = NULL;
 static cmd_def g_cmd_list[] = 
 {
+    { "vine_patch_loader",  vtoyvine_main  },
     { "vtoydump",    vtoydump_main    },
     { "vtoydm",      vtoydm_main      },
     { "loader",      vtoyloader_main  },
index b923b8b13a7faebabc2b5a03c8e695080405b1e0..07fc351415f4e1f0601e4b91a1916d66db6b97c0 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_32 and b/VtoyTool/vtoytool/00/vtoytool_32 differ
index bffcf2ec4cfdcc900f1af01f20e268bbaa050402..4bb15ec69962404cfb08533111e06d12ffa42ce6 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_64 and b/VtoyTool/vtoytool/00/vtoytool_64 differ
index 7628e2c2bec603a150217defdca8d8ff4754af25..185bb7900c524259b99b9c0ee331ac2f1fcb7675 100644 (file)
Binary files a/VtoyTool/vtoytool/01/vtoytool_64 and b/VtoyTool/vtoytool/01/vtoytool_64 differ
diff --git a/VtoyTool/vtoytool/02/vtoytool_64 b/VtoyTool/vtoytool/02/vtoytool_64
new file mode 100644 (file)
index 0000000..7628e2c
Binary files /dev/null and b/VtoyTool/vtoytool/02/vtoytool_64 differ
diff --git a/VtoyTool/vtoyvine.c b/VtoyTool/vtoyvine.c
new file mode 100644 (file)
index 0000000..33e299c
--- /dev/null
@@ -0,0 +1,159 @@
+/******************************************************************************
+ * vtoyloader.c  ---- ventoy loader (wapper for binary loader)
+ *
+ * Copyright (c) 2020, longpanda <admin@ventoy.net>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+static int verbose = 0;
+#define debug(fmt, ...) if(verbose) printf(fmt, ##__VA_ARGS__)
+
+static int vine_patch_loader(unsigned char *buf, int len, int major)
+{
+    int i;
+    int ptrlen;
+    unsigned int *data1;
+    unsigned int *data2;
+
+    /*
+     * http://vinelinux.ime.cmc.osaka-u.ac.jp/Vine-6.5/SRPMS/SRPMS.main/anaconda-vine-11.0.2.1-1vl7.src.rpm
+     * http://vinelinux.ime.cmc.osaka-u.ac.jp/Vine-6.5/SRPMS/SRPMS.main/kudzu-1.2.86-3vl6.src.rpm
+     * anaconda-vine-11.0.2.1
+     * isys/devnodes.c
+     * static struct devnum devices[] = {
+     *     { "aztcd",   29,    0,      0 },
+     *     { "pcd",            46,     0,      0 },
+     *
+     * Patch 29 ---> 253
+     */
+
+    ptrlen = (buf[4] == 1) ? 4 : 8;
+    debug("ELF %d bit major:%d ptrlen:%d\n", (buf[4] == 1) ? 32 : 64, major, ptrlen);    
+
+    for (i = 0; i < len - 8 - 8 - ptrlen; i++)
+    {
+        data1 = (unsigned int *)(buf + i);
+        data2 = (unsigned int *)(buf + i + 8 + ptrlen);
+
+        if (data1[0] == 0x1D && data1[1] == 0x00 && data2[0] == 0x2E && data2[1] == 0x00)
+        {
+            debug("Find aztcd patch point at %d\n", i);
+            data1[0] = major;
+            break;
+        }
+    }
+
+    for (i = 0; i < len; i++)
+    {
+        if (buf[i] != '/')
+        {
+            continue;
+        }
+
+        data1 = (unsigned int *)(buf + i + 1);
+
+        /* /proc/ide */
+        if (data1[0] == 0x636F7270 && data1[1] == 0x6564692F)
+        {
+            debug("patch string %s\n", (char *)(buf + i));
+            buf[i + 1] = 'v';
+            buf[i + 2] = 't';
+            buf[i + 3] = 'o';
+            buf[i + 4] = 'y';
+        }
+    }
+
+    return 0;
+}
+
+int vtoyvine_main(int argc, char **argv)
+{
+    int i;
+    int len;
+    unsigned char *buf;
+    FILE *fp;
+
+    for (i = 0; i < argc; i++)
+    {
+        if (argv[i][0] == '-' && argv[i][1] == 'v')
+        {
+            verbose = 1;
+            break;
+        }
+    }
+
+    fp = fopen(argv[1], "rb");
+    if (!fp)
+    {
+        fprintf(stderr, "Failed to open file %s err:%d\n", argv[1], errno);
+        return 1;
+    }
+
+    fseek(fp, 0, SEEK_END);
+    len = (int)ftell(fp);
+    debug("file length:%d\n", len);
+
+    fseek(fp, 0, SEEK_SET);
+
+    buf = (unsigned char *)malloc(len);
+    if (!buf)
+    {
+        fclose(fp);
+        return 1;
+    }
+
+    fread(buf, 1, len, fp);
+    fclose(fp);
+
+    vine_patch_loader(buf, len, (int)strtoul(argv[2], NULL, 10));
+
+    fp = fopen(argv[1], "wb+");
+    if (!fp)
+    {
+        fprintf(stderr, "Failed to open file %s err:%d\n", argv[1], errno);
+        free(buf);
+        return 1;
+    }
+
+    debug("write new data length:%d\n", len);
+    fwrite(buf, 1, len, fp);
+    fclose(fp);
+
+    free(buf);
+    
+    return 0;
+}
+
+// wrapper main
+#ifndef BUILD_VTOY_TOOL
+int main(int argc, char **argv)
+{
+    return vtoyvine_main(argc, argv);
+}
+#endif
+