Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed Jul 5, 2020
1 parent f7b35f3 commit b32cf97
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 23 deletions.
13 changes: 12 additions & 1 deletion IMG/cpio/ventoy/hook/debian/udev_disk_hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
13 changes: 6 additions & 7 deletions INSTALL/grub/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions Ventoy2Disk/Ventoy2Disk/Utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
30 changes: 15 additions & 15 deletions Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b32cf97

Please sign in to comment.