]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
update
authorlongpanda <admin@ventoy.net>
Sun, 5 Jul 2020 14:12:58 +0000 (22:12 +0800)
committerlongpanda <admin@ventoy.net>
Sun, 5 Jul 2020 14:13:01 +0000 (22:13 +0800)
IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
INSTALL/grub/grub.cfg
Ventoy2Disk/Ventoy2Disk/Utility.c
Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c

index 6dd6882b39c12856d934db2c3b5e86c09516b8d1..d2afcc82a1a55283d55fa63563f2b5865221f61c 100644 (file)
@@ -99,7 +99,18 @@ ventoy_udev_disk_common_hook $*
 # So if ventoy is installed on a non-USB device, we just mount /cdrom here except
 # for these has boot=live or boot=casper parameter in cmdline
 #
-if echo $ID_BUS | $GREP -q -i usb; then
+VT_BUS_USB=""
+if [ -n "$ID_BUS" ]; then
+    if echo $ID_BUS | $GREP -q -i usb; then
+        VT_BUS_USB="YES"
+    fi
+else
+    if $BUSYBOX_PATH/ls -l /sys/class/block/${1:0:-1} | $GREP -q -i usb; then
+        VT_BUS_USB="YES"
+    fi
+fi
+
+if [ -n "$VT_BUS_USB" ]; then
     vtlog "$1 is USB device"
 else
     vtlog "$1 is NOT USB device (bus $ID_BUS)"
index 144b78e109f86a09c2d021ac3c79aa15ff5500e5..52e8a6b75d55af8918fd1743e849c97b79dea983 100644 (file)
@@ -650,15 +650,14 @@ else
     set gfxmode=1920x1080,1366x768,1024x768
 fi
 
-if [ -n "$vtoy_theme" ]; then
-    set theme=$vtoy_theme
-else
-    set theme=$prefix/themes/ventoy/theme.txt
-fi
-
 if [ "$vtoy_display_mode" = "CLI" ]; then
     terminal_output  console
-else
+else    
+    if [ -n "$vtoy_theme" ]; then
+        set theme=$vtoy_theme
+    else
+        set theme=$prefix/themes/ventoy/theme.txt
+    fi
     terminal_output  gfxterm
 fi
 
index dc8491db721ac864fa9430f39fee196f46f6b181..586d2368d3491c3634f8bf38d8673f0f83dc1013 100644 (file)
@@ -549,6 +549,7 @@ int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)
     VTOY_GPT_PART_TBL *Table = pInfo->PartTbl;
     static GUID WindowsDataPartType = { 0xebd0a0a2, 0xb9e5, 0x4433, { 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 } };
     static GUID EspPartType = { 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } };
+       //static GUID BiosGrubPartType = { 0x21686148, 0x6449, 0x6e6f, { 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } };
 
     VentoyFillProtectMBR(DiskSizeBytes, &pInfo->MBR);
 
@@ -588,6 +589,14 @@ int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)
     Table[1].Attr = 1;
     memcpy(Table[1].Name, L"VTOYEFI", 7 * 2);
 
+#if 0
+       memcpy(&(Table[2].PartType), &BiosGrubPartType, sizeof(GUID));
+       CoCreateGuid(&(Table[2].PartGuid));
+       Table[2].StartLBA = 34;
+       Table[2].LastLBA = 2047;
+       Table[2].Attr = 0;
+#endif
+
     //Update CRC
     Head->PartTblCrc = VentoyCrc32(Table, sizeof(pInfo->PartTbl));
     Head->Crc = VentoyCrc32(Head, Head->Length);
index e6cb741cd5d6a137d4be13fe27898e21b1cc83c7..2dc33f182c4513d63a6be5c3b5126977d5dfd2b0 100644 (file)
@@ -107,6 +107,21 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes, MBR_HEAD *pMBR, UIN
         return FALSE;
     }
 
+       for (i = 0; i < 4; i++)
+       {
+               Log("=========== Partition Table %d ============", i + 1);
+               Log("PartTbl.Active = 0x%x", MBR.PartTbl[i].Active);
+               Log("PartTbl.FsFlag = 0x%x", MBR.PartTbl[i].FsFlag);
+               Log("PartTbl.StartSectorId = %u", MBR.PartTbl[i].StartSectorId);
+               Log("PartTbl.SectorCount = %u", MBR.PartTbl[i].SectorCount);
+               Log("PartTbl.StartHead = %u", MBR.PartTbl[i].StartHead);
+               Log("PartTbl.StartSector = %u", MBR.PartTbl[i].StartSector);
+               Log("PartTbl.StartCylinder = %u", MBR.PartTbl[i].StartCylinder);
+               Log("PartTbl.EndHead = %u", MBR.PartTbl[i].EndHead);
+               Log("PartTbl.EndSector = %u", MBR.PartTbl[i].EndSector);
+               Log("PartTbl.EndCylinder = %u", MBR.PartTbl[i].EndCylinder);
+       }
+
        if (MBR.PartTbl[0].FsFlag == 0xEE)
        {
                pGpt = malloc(sizeof(VTOY_GPT_INFO));
@@ -143,21 +158,6 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes, MBR_HEAD *pMBR, UIN
        {
                CHECK_CLOSE_HANDLE(hDrive);
 
-               for (i = 0; i < 4; i++)
-               {
-                       Log("=========== Partition Table %d ============", i + 1);
-                       Log("PartTbl.Active = 0x%x", MBR.PartTbl[i].Active);
-                       Log("PartTbl.FsFlag = 0x%x", MBR.PartTbl[i].FsFlag);
-                       Log("PartTbl.StartSectorId = %u", MBR.PartTbl[i].StartSectorId);
-                       Log("PartTbl.SectorCount = %u", MBR.PartTbl[i].SectorCount);
-                       Log("PartTbl.StartHead = %u", MBR.PartTbl[i].StartHead);
-                       Log("PartTbl.StartSector = %u", MBR.PartTbl[i].StartSector);
-                       Log("PartTbl.StartCylinder = %u", MBR.PartTbl[i].StartCylinder);
-                       Log("PartTbl.EndHead = %u", MBR.PartTbl[i].EndHead);
-                       Log("PartTbl.EndSector = %u", MBR.PartTbl[i].EndSector);
-                       Log("PartTbl.EndCylinder = %u", MBR.PartTbl[i].EndCylinder);
-               }
-
                if (MBR.PartTbl[0].StartSectorId != 2048)
                {
                        Log("Part1 not match %u", MBR.PartTbl[0].StartSectorId);