Add complete guide and all config variants
This commit is contained in:
131
hackintosh-guide/Utilities/LegacyBoot/BootInstallBase.sh
Executable file
131
hackintosh-guide/Utilities/LegacyBoot/BootInstallBase.sh
Executable file
@@ -0,0 +1,131 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Install booter on physical disk.
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
|
||||
if [ ! -f "boot${ARCHS}${DUET_SUFFIX}" ] || [ ! -f boot0 ] || [ ! -f boot1f32 ]; then
|
||||
echo "Boot files are missing from this package!"
|
||||
echo "You probably forgot to build DuetPkg first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then echo "Please run this script as root"
|
||||
exit
|
||||
fi
|
||||
if [ "$(which lsblk)" = "" ]; then
|
||||
echo "lsblk tool is missing! Try installing util-linux package"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(which fdisk)" = "" ]; then
|
||||
echo "fdisk tool is missing!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f newbs origbs
|
||||
|
||||
echo "Select the disk where you want to install boot files (${ARCHS}${DUET_SUFFIX}):"
|
||||
lsblk -d | tail -n+2 | cut -d" " -f1
|
||||
echo "Example: sda"
|
||||
read -r DRIVE
|
||||
|
||||
DRIVE="/dev/${DRIVE}"
|
||||
|
||||
if ! lsblk "$DRIVE"; then
|
||||
echo Disk "${DRIVE}" not found
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Choose EFI partition on selected disk:"
|
||||
lsblk -f "${DRIVE}"
|
||||
echo "Example: sda1"
|
||||
read -r EFI_PART
|
||||
|
||||
EFI_PART="/dev/${EFI_PART}"
|
||||
|
||||
if ! lsblk -f "$EFI_PART" | grep -q -e FAT32 -e vfat; then
|
||||
echo "No FAT32 partition to install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Write MBR
|
||||
dd if=boot0 of="$DRIVE" bs=1 count=446 conv=notrunc || exit 1
|
||||
|
||||
umount "${EFI_PART}"
|
||||
|
||||
dd if="${EFI_PART}" count=1 of=origbs
|
||||
cp -v boot1f32 newbs
|
||||
dd if=origbs of=newbs skip=3 seek=3 bs=1 count=87 conv=notrunc
|
||||
dd if=/dev/random of=newbs skip=496 seek=496 bs=1 count=14 conv=notrunc
|
||||
dd if=newbs of="${EFI_PART}"
|
||||
|
||||
p=/tmp/$(uuidgen)/EFI
|
||||
mkdir -p "${p}" || exit 1
|
||||
mount -t vfat "${EFI_PART}" "${p}" -o rw,noatime,uid="$(id -u)",gid="$(id -g)" || exit 1
|
||||
|
||||
cp -v "boot${ARCHS}${DUET_SUFFIX}" "${p}/boot" || exit 1
|
||||
|
||||
echo Check "${p}" boot drive EFI folder to install OpenCorePkg
|
||||
|
||||
DISK_SCHEME=$(fdisk -l "${DRIVE}" | sed -n 's/.*Disklabel type: *//p')
|
||||
if [ "$DISK_SCHEME" != "gpt" ]; then
|
||||
BOOT_FLAG=$(dd if="$DRIVE" bs=1 count=1 status=none skip=$((0x1BE)) | od -t x1 -A n | tr -d ' ')
|
||||
if [ "$BOOT_FLAG" != "80" ]; then
|
||||
fdisk "$DRIVE" <<END
|
||||
p
|
||||
a
|
||||
1
|
||||
w
|
||||
END
|
||||
fi
|
||||
fi
|
||||
else
|
||||
rm -f newbs origbs
|
||||
|
||||
diskutil list
|
||||
echo "Disable SIP in the case of any problems with installation!!!"
|
||||
echo "Enter disk number to install OpenDuet (${ARCHS}${DUET_SUFFIX}) to:"
|
||||
read -r N
|
||||
|
||||
if ! diskutil info disk"${N}" | grep -q "/dev/disk"; then
|
||||
echo Disk "$N" not found
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! diskutil info disk"${N}"s1 | grep -q -e FAT_32 -e EFI; then
|
||||
echo "No FAT32 partition to install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Write MBR
|
||||
sudo fdisk -uy -f boot0 /dev/rdisk"${N}" || exit 1
|
||||
|
||||
diskutil umount disk"${N}"s1
|
||||
sudo dd if=/dev/rdisk"${N}"s1 count=1 of=origbs
|
||||
cp -v boot1f32 newbs
|
||||
sudo dd if=origbs of=newbs skip=3 seek=3 bs=1 count=87 conv=notrunc
|
||||
dd if=/dev/random of=newbs skip=496 seek=496 bs=1 count=14 conv=notrunc
|
||||
sudo dd if=newbs of=/dev/rdisk"${N}"s1
|
||||
#if [[ "$(sudo diskutil mount disk"${N}"s1)" == *"mounted" ]]
|
||||
if sudo diskutil mount disk"${N}"s1 | grep -q mounted; then
|
||||
cp -v "boot${ARCHS}${DUET_SUFFIX}" "$(diskutil info disk"${N}"s1 | sed -n 's/.*Mount Point: *//p')/boot"
|
||||
else
|
||||
p=/tmp/$(uuidgen)/EFI
|
||||
mkdir -p "${p}" || exit 1
|
||||
sudo mount_msdos /dev/disk"${N}"s1 "${p}" || exit 1
|
||||
cp -v "boot${ARCHS}${DUET_SUFFIX}" "${p}/boot" || exit 1
|
||||
open "${p}"
|
||||
fi
|
||||
|
||||
if diskutil info disk"${N}" | grep -q FDisk_partition_scheme; then
|
||||
sudo fdisk -e /dev/rdisk"$N" <<-MAKEACTIVE
|
||||
p
|
||||
f 1
|
||||
w
|
||||
y
|
||||
q
|
||||
MAKEACTIVE
|
||||
fi
|
||||
fi
|
||||
6
hackintosh-guide/Utilities/LegacyBoot/BootInstall_IA32.tool
Executable file
6
hackintosh-guide/Utilities/LegacyBoot/BootInstall_IA32.tool
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
export ARCHS=IA32
|
||||
export DUET_SUFFIX=""
|
||||
source BootInstallBase.sh
|
||||
6
hackintosh-guide/Utilities/LegacyBoot/BootInstall_IA32_BlockIO.tool
Executable file
6
hackintosh-guide/Utilities/LegacyBoot/BootInstall_IA32_BlockIO.tool
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
export ARCHS=IA32
|
||||
export DUET_SUFFIX="-blockio"
|
||||
source BootInstallBase.sh
|
||||
6
hackintosh-guide/Utilities/LegacyBoot/BootInstall_X64.tool
Executable file
6
hackintosh-guide/Utilities/LegacyBoot/BootInstall_X64.tool
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
export ARCHS=X64
|
||||
export DUET_SUFFIX=""
|
||||
source BootInstallBase.sh
|
||||
6
hackintosh-guide/Utilities/LegacyBoot/BootInstall_X64_BlockIO.tool
Executable file
6
hackintosh-guide/Utilities/LegacyBoot/BootInstall_X64_BlockIO.tool
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
export ARCHS=X64
|
||||
export DUET_SUFFIX="-blockio"
|
||||
source BootInstallBase.sh
|
||||
186
hackintosh-guide/Utilities/LegacyBoot/QemuBuild.command
Executable file
186
hackintosh-guide/Utilities/LegacyBoot/QemuBuild.command
Executable file
@@ -0,0 +1,186 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Build QEMU image, example:
|
||||
# qemu-system-x86_64 -drive file=$QEMU_IMAGE/OpenCore.RO.raw -serial stdio \
|
||||
# -usb -device usb-kbd -device usb-mouse -s -m 8192
|
||||
|
||||
cd "$(dirname "$0")" || exit 1
|
||||
|
||||
usage () {
|
||||
echo "Usage: $(basename "$0") [X64|IA32|EFI]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
missing_files () {
|
||||
echo "Boot files are missing from this package!"
|
||||
echo "You probably forgot to build DuetPkg first."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
usage
|
||||
elif [ $# -eq 1 ]; then
|
||||
if [ "$1" != "X64" ] && [ "$1" != "IA32" ] && [ "$1" != "EFI" ]; then
|
||||
usage
|
||||
fi
|
||||
ARCHS=$1
|
||||
elif [ "${ARCHS}" = "" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
if [ "$ARCHS" != "EFI" ]; then
|
||||
if [ ! -f "boot${ARCHS}" ] || [ ! -f boot0 ] || [ ! -f boot1f32 ]; then
|
||||
missing_files
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$(which qemu-img)" = "" ]; then
|
||||
echo "QEMU installation missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d ROOT ]; then
|
||||
echo "No ROOT directory with ESP partition contents"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(uname)" = "Linux" ]; then
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then echo "Please run this script as root"
|
||||
exit
|
||||
fi
|
||||
if [ "$(which qemu-nbd)" = "" ]; then
|
||||
echo "Your QEMU installation doesn't contain qemu-nbd tool!"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(which mkfs.vfat)" = "" ]; then
|
||||
echo "mkfs.vfat not found, dosfstools package is missing?"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(which fdisk)" = "" ]; then
|
||||
echo "fdisk tool is missing!"
|
||||
exit 1
|
||||
fi
|
||||
IMAGE=OpenCore.raw
|
||||
DIR="$IMAGE.d"
|
||||
NBD=/dev/nbd0
|
||||
|
||||
rm -rf "$DIR"
|
||||
rm -f "$IMAGE" newbs origbs
|
||||
mkdir -p "$DIR"
|
||||
|
||||
# Create 200M MS-DOS bootable disk image with 1 FAT32 partition
|
||||
modprobe nbd
|
||||
qemu-img create -f raw "$IMAGE" 200M
|
||||
fdisk "$IMAGE" << END
|
||||
o
|
||||
n
|
||||
p
|
||||
1
|
||||
2048
|
||||
409599
|
||||
t
|
||||
b
|
||||
a
|
||||
w
|
||||
END
|
||||
qemu-nbd -f raw --connect="$NBD" "$IMAGE"
|
||||
# Wait a it after mounting
|
||||
sleep 2
|
||||
mkfs.vfat -F32 ${NBD}p1
|
||||
|
||||
if [ "$ARCHS" != "EFI" ]; then
|
||||
# Copy boot1f32 into FAT32 Boot Record
|
||||
dd if=${NBD}p1 of=origbs count=1
|
||||
cp -v boot1f32 newbs
|
||||
dd if=origbs of=newbs skip=3 seek=3 bs=1 count=87 conv=notrunc
|
||||
dd if=/dev/random of=newbs skip=496 seek=496 bs=1 count=14 conv=notrunc
|
||||
dd if=newbs of=${NBD}p1 conv=notrunc
|
||||
fi
|
||||
|
||||
mount -t vfat ${NBD}p1 "$DIR" -o rw,noatime,uid="$(id -u)",gid="$(id -g)"
|
||||
sleep 2
|
||||
|
||||
if [ "$ARCHS" != "EFI" ]; then
|
||||
# Copy boot file into FAT32 file system
|
||||
cp -v "boot${ARCHS}" "$DIR/boot"
|
||||
fi
|
||||
|
||||
# Copy ESP contents into FAT32 file system
|
||||
cp -rv ROOT/* "$DIR"
|
||||
|
||||
# Remove temporary files
|
||||
sleep 2
|
||||
umount -R "$DIR"
|
||||
qemu-nbd -d "$NBD"
|
||||
rm -r "$DIR"
|
||||
rm newbs origbs
|
||||
|
||||
if [ "$ARCHS" != "EFI" ]; then
|
||||
# Copy boot0 into MBR
|
||||
dd if=boot0 of="$IMAGE" bs=1 count=446 conv=notrunc
|
||||
fi
|
||||
|
||||
chown "$(whoami)" "$IMAGE"
|
||||
elif [ "$(uname)" = "Darwin" ]; then
|
||||
rm -f OpenCore.dmg.sparseimage OpenCore.RO.raw OpenCore.RO.dmg
|
||||
hdiutil create -size 200m -layout "UNIVERSAL HD" -type SPARSE -o OpenCore.dmg
|
||||
newDevice=$(hdiutil attach -nomount OpenCore.dmg.sparseimage |head -n 1 | awk '{print $1}')
|
||||
echo newdevice "$newDevice"
|
||||
|
||||
diskutil partitionDisk "${newDevice}" 1 MBR fat32 TEST R
|
||||
|
||||
# boot install script
|
||||
diskutil list
|
||||
N=$(echo "$newDevice" | tr -dc '0-9')
|
||||
echo "Will be installed to Disk ${N}"
|
||||
|
||||
|
||||
if [[ ! $(diskutil info disk"${N}" | sed -n 's/.*Device Node: *//p') ]]
|
||||
then
|
||||
echo Disk "$N" not found
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FS=$(diskutil info disk"${N}"s1 | sed -n 's/.*File System Personality: *//p')
|
||||
echo "$FS"
|
||||
|
||||
if [ "$FS" != "MS-DOS FAT32" ]
|
||||
then
|
||||
echo "No FAT32 partition to install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$ARCHS" != "EFI" ]; then
|
||||
# Write MBR
|
||||
sudo fdisk -f boot0 -u /dev/rdisk"${N}"
|
||||
|
||||
# Write boot1f32
|
||||
diskutil umount disk"${N}"s1
|
||||
sudo dd if=/dev/rdisk"${N}"s1 count=1 of=origbs
|
||||
cp -v boot1f32 newbs
|
||||
sudo dd if=origbs of=newbs skip=3 seek=3 bs=1 count=87 conv=notrunc
|
||||
dd if=/dev/random of=newbs skip=496 seek=496 bs=1 count=14 conv=notrunc
|
||||
sudo dd if=newbs of=/dev/rdisk"${N}"s1
|
||||
diskutil mount disk"${N}"s1
|
||||
|
||||
# Copy boot
|
||||
cp -v "boot${ARCHS}" "$(diskutil info disk"${N}"s1 | sed -n 's/.*Mount Point: *//p')/boot"
|
||||
fi
|
||||
|
||||
cp -rv ROOT/* "$(diskutil info disk"${N}"s1 | sed -n 's/.*Mount Point: *//p')"
|
||||
|
||||
if [ "$ARCHS" != "EFI" ] && [ "$(diskutil info disk"${N}" | sed -n 's/.*Content (IOContent): *//p')" == "FDisk_partition_scheme" ]; then
|
||||
sudo fdisk -e /dev/rdisk"$N" <<-MAKEACTIVE
|
||||
p
|
||||
f 1
|
||||
w
|
||||
y
|
||||
q
|
||||
MAKEACTIVE
|
||||
fi
|
||||
|
||||
hdiutil detach "$newDevice"
|
||||
hdiutil convert -format UDRO OpenCore.dmg.sparseimage -o OpenCore.RO.dmg
|
||||
qemu-img convert -f dmg -O raw OpenCore.RO.dmg OpenCore.RO.raw
|
||||
fi
|
||||
7
hackintosh-guide/Utilities/LegacyBoot/README.md
Executable file
7
hackintosh-guide/Utilities/LegacyBoot/README.md
Executable file
@@ -0,0 +1,7 @@
|
||||
BootInstall
|
||||
===========
|
||||
|
||||
This tool installs legacy DuetPkg environment on GPT-formatted disk
|
||||
to enable UEFI environment on BIOS-based systems.
|
||||
|
||||
Source code: https://github.com/acidanthera/DuetPkg
|
||||
BIN
hackintosh-guide/Utilities/LegacyBoot/boot0
Executable file
BIN
hackintosh-guide/Utilities/LegacyBoot/boot0
Executable file
Binary file not shown.
BIN
hackintosh-guide/Utilities/LegacyBoot/boot1f32
Executable file
BIN
hackintosh-guide/Utilities/LegacyBoot/boot1f32
Executable file
Binary file not shown.
BIN
hackintosh-guide/Utilities/LegacyBoot/bootIA32
Executable file
BIN
hackintosh-guide/Utilities/LegacyBoot/bootIA32
Executable file
Binary file not shown.
BIN
hackintosh-guide/Utilities/LegacyBoot/bootIA32-blockio
Executable file
BIN
hackintosh-guide/Utilities/LegacyBoot/bootIA32-blockio
Executable file
Binary file not shown.
BIN
hackintosh-guide/Utilities/LegacyBoot/bootX64
Executable file
BIN
hackintosh-guide/Utilities/LegacyBoot/bootX64
Executable file
Binary file not shown.
BIN
hackintosh-guide/Utilities/LegacyBoot/bootX64-blockio
Executable file
BIN
hackintosh-guide/Utilities/LegacyBoot/bootX64-blockio
Executable file
Binary file not shown.
Reference in New Issue
Block a user