This commit is contained in:
longpanda 2020-07-05 22:12:58 +08:00
parent f7b35f371b
commit b32cf97f1f
4 changed files with 42 additions and 23 deletions

View 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
#
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)"

View File

@ -650,15 +650,14 @@ else
set gfxmode=1920x1080,1366x768,1024x768
fi
if [ "$vtoy_display_mode" = "CLI" ]; then
terminal_output console
else
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
terminal_output gfxterm
fi

View 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);

View 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);