Macos

System Integrity Protection

csrutil status

Power Management

pmset -b standbydelaylow 900
pmset -b standbydelayhigh 10800
pmset -b tcpkeepalive 0
pmset -g

Disk Util

diskutil list
diskutil unmount
diskutil partitionDisk /dev/disk7 MBR fat32 "P1" 100%

USB Serial

ioreg -p IOUSB -l -b | grep -E "@|PortNum|USB Serial Number"

DNS server

scutil --dns

Route

route -n get default www.google.com
route -n get default
netstat -rn
Dual boot

Holding Option key on boot to switch boot drive. Holding Ctrl key and the icon will change, this set the default boot drive.

Set Disk Label
diskutil list
sudo diskutil mount disk0s1 # mount EFI partition
sudo bless --folder /Volumes/EFI/EFI/Boot --label Windows
csrutil disable # in recovery mode

## For macOS icon
### find the preboot partition
sudo diskutil apfs list
### mount the preboot partition
sudo diskutil mountDisk /dev/disk1s2
### copy icon
sudo cp /System/Library/Extensions/IOStorageFamily.kext/Contents/Resources/Internal.icns /Volumes/Preboot/.VolumeIcon.icns

## For Windows icon
## mount the EFI parititon
sudo diskutil mountDisk /dev/disk0s1
### copy icon
sudo cp /System/Library/Extensions/IOStorageFamily.kext/Contents/Resources/Internal.icns /Volumes/EFI/.VolumeIcon.icns

csrutil enable # in recovery mode

https://apple.stackexchange.com/questions/388246/efi-partition-change-name-and-logo/388287

Bootcamp

Download bootcamp driver from

  1. Apple's bootcamp utility that will save bootcamp driver to USB drive

Macbook Pro mid 2012

Install Windows 10 with EFI. Fix audio driver issue https://egpu.io/forums/pc-setup/fix-dsdt-override-to-correct-error-12/

Download Tools. Windows Binary Tools (WBT - Dec 2016) extracted to c:\dsdt directory. [ newer WBT has parsing errors] https://www.mediafire.com/file/51mbe3payyulw3o/iasl-win-20161222.zip/file

Windows Driver Kit (WDK), which contains the Windows ASL Compiler (asl.exe) https://go.microsoft.com/fwlink/p/?LinkId=526733

mkdir c:\dsdt
c: & cd \dsdt
set 64bit_OS_asl="C:\Program Files (x86)\Windows Kits\10\Tools\x64\ACPIVerify\asl.exe"
set 32bit_OS_asl="C:\Program Files (x86)\Windows Kits\10\Tools\x86\ACPIVerify\asl.exe"
copy /y %32bit_OS_asl% c:\dsdt > nul & copy /y %64bit_OS_asl% c:\dsdt > nul
if not exist c:\dsdt\asl.exe echo ERROR: Failed to copy asl.exe to c:\dsdt
c: & cd \dsdt
acpidump -b -z
asl /u dsdt.dat
copy dsdt.asl dsdt-modified.asl

Modify dsdt-modified.asl

DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
   0x00000000,         // Granularity
   0x000A0000,         // Range Minimum
   0x000BFFFF,         // Range Maximum
   0x00000000,         // Translation Offset
   0x00020000,         // Length
   ,, , AddressRangeMemory, TypeStatic)
// - ADD THIS SECTION ---------------------------------------------------------------------------
QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
   0x0000000000000000, // Granularity
   0x0000000C20000000, // Range Minimum,  set it to 48.5GB
   0x0000000E0FFFFFFF, // Range Maximum,  set it to 56.25GB
   0x0000000000000000, // Translation Offset
   0x00000001F0000000, // Length calculated by Range Max - Range Min.
   ,, , AddressRangeMemory, TypeStatic)
// ----------------------------------------------------------------------------------------------
})
c: & cd \dsdt
asl /loadtable dsdt-modified.aml  
bcdedit -set TESTSIGNING ON

Remove test mode watermark for Windows. https://winaero.com/download-universal-watermark-disabler/universal-watermark-disabler

Fixing hybrid MBR

https://superuser.com/questions/1513265/how-can-i-create-a-bootable-mac-os-with-an-image-of-the-efi-and-os-partitions

GPT

Create a protective MBR which covers the whole disk.
Command (? for help): x

Expert command (? for help): n

Expert command (? for help): o

Disk size is 3907029168 sectors (1.8 TiB)
MBR disk identifier: 0x00000000
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1   3907029167   primary     0xEE

Hybrid MBR

Recovery/transformation command (? for help): h

WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
just hit the Enter key at the below prompt and your MBR partition table will
be untouched.

Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 2 3 4
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): Y

Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default AF): AF
Set the bootable flag? (Y/N): n

Creating entry for GPT partition #3 (MBR partition #3)
Enter an MBR hex code (default 07): 07
Set the bootable flag? (Y/N): y

Creating entry for GPT partition #4 (MBR partition #4)
Enter an MBR hex code (default 07): 07
Set the bootable flag? (Y/N): n

Recovery/transformation command (? for help): o

Disk size is 3907029168 sectors (1.8 TiB)
MBR disk identifier: 0xFDB98627
MBR partitions:

Number  Boot  Start Sector   End Sector   Status      Code
   1                     1       411647   primary     0xEE
   2                411648    250413055   primary     0xAF
   3      *      518879232   2666362879   primary     0x07
   4            2666362880   2934798335   primary     0x07

Create Install Disk for Windows 10

How to Make a Windows 10 USB Using Your Mac

# GPT
diskutil eraseDisk MS-DOS "WIN10" GPT /dev/disk2
# MBR
diskutil eraseDisk MS-DOS "WIN10" MBR /dev/disk2

hdiutil mount ~/Downloads/Win10_1903_V1_English_x64.iso
rsync -vha --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/* /Volumes/WIN10
brew install wimlib
mkdir /Volumes/WIN10/sources
wimlib-imagex split /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim /Volumes/WIN10/sources/install.swm 3800