Thinkpads

This commit is contained in:
sickcodes 2021-10-31 21:03:01 +00:00
parent e9b2bf825c
commit 051f06ae23
5 changed files with 80 additions and 5 deletions

View file

@ -251,6 +251,51 @@ CUSTOM_PLIST=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/ma
--height 1080 --height 1080
``` ```
## Thinkpad Errors in OpenCore
If you have errors related to a think pad, try toggling `--thinkpad`.
This will set `ForceOcWriteFlash` to `true`, as per https://dortania.github.io/docs/latest/Configuration.html
## Rough example used in Docker-OSX in a Dockerfile
```dockerfile
ARG STOCK_DEVICE_MODEL=iMacPro1,1
ARG STOCK_SERIAL=C02TM2ZBHX87
ARG STOCK_BOARD_SERIAL=C02717306J9JG361M
ARG STOCK_UUID=007076A6-F2A2-4461-BBE5-BAD019F8025A
ARG STOCK_MAC_ADDRESS=00:0A:27:00:00:00
ARG STOCK_WIDTH=1920
ARG STOCK_HEIGHT=1080
ARG STOCK_MASTER_PLIST_URL=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist
ARG STOCK_MASTER_PLIST_URL_NOPICKER=https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-nopicker-custom.plist
ARG STOCK_BOOTDISK=/home/arch/OSX-KVM/OpenCore/OpenCore.qcow2
ARG STOCK_BOOTDISK_NOPICKER=/home/arch/OSX-KVM/OpenCore/OpenCore-nopicker.qcow2
RUN ./generate-specific-bootdisk.sh \
--master-plist-url="${STOCK_MASTER_PLIST_URL}" \
--model "${STOCK_DEVICE_MODEL}" \
--serial "${STOCK_SERIAL}" \
--board-serial "${STOCK_BOARD_SERIAL}" \
--uuid "${STOCK_UUID}" \
--mac-address "${STOCK_MAC_ADDRESS}" \
--width "${STOCK_WIDTH}" \
--height "${STOCK_HEIGHT}" \
--output-bootdisk "${STOCK_BOOTDISK}" || exit 1
RUN ./generate-specific-bootdisk.sh \
--master-plist-url="${STOCK_MASTER_PLIST_URL_NOPICKER}" \
--model "${STOCK_DEVICE_MODEL}" \
--serial "${STOCK_SERIAL}" \
--board-serial "${STOCK_BOARD_SERIAL}" \
--uuid "${STOCK_UUID}" \
--mac-address "${STOCK_MAC_ADDRESS}" \
--width "${STOCK_WIDTH}" \
--height "${STOCK_HEIGHT}" \
--output-bootdisk "${STOCK_BOOTDISK_NOPICKER}" || exit 1
```
# Examples from Docker-OSX # Examples from Docker-OSX

View file

@ -1378,7 +1378,7 @@
<key>ExitBootServicesDelay</key> <key>ExitBootServicesDelay</key>
<integer>0</integer> <integer>0</integer>
<key>ForceOcWriteFlash</key> <key>ForceOcWriteFlash</key>
<false/> <{{THINKPAD}}/>
<key>ForgeUefiSupport</key> <key>ForgeUefiSupport</key>
<false/> <false/>
<key>IgnoreInvalidFlexRatio</key> <key>IgnoreInvalidFlexRatio</key>

View file

@ -1378,7 +1378,7 @@
<key>ExitBootServicesDelay</key> <key>ExitBootServicesDelay</key>
<integer>0</integer> <integer>0</integer>
<key>ForceOcWriteFlash</key> <key>ForceOcWriteFlash</key>
<false/> <{{THINKPAD}}/>
<key>ForgeUefiSupport</key> <key>ForgeUefiSupport</key>
<false/> <false/>
<key>IgnoreInvalidFlexRatio</key> <key>IgnoreInvalidFlexRatio</key>

View file

@ -30,10 +30,11 @@ Optional options:
--master-plist <filename> Same as above. --master-plist <filename> Same as above.
--output-bootdisk <filename> Optionally change the bootdisk filename --output-bootdisk <filename> Optionally change the bootdisk filename
--output-plist <filename> Optionally change the output plist filename --output-plist <filename> Optionally change the output plist filename
--thinkpad Sets ForceOcWriteFlash to true
--help, -h, help Display this help and exit --help, -h, help Display this help and exit
Placeholders: {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, {{UUID}}, Placeholders: {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, {{UUID}},
{{ROM}}, {{WIDTH}}, {{HEIGHT}} {{ROM}}, {{WIDTH}}, {{HEIGHT}}, {{THINKPAD}}
Example: Example:
./generate-specific-bootdisk.sh \\ ./generate-specific-bootdisk.sh \\
@ -183,6 +184,12 @@ while (( "$#" )); do
shift shift
;; ;;
--thinkpad )
export THINKPAD=true
shift
;;
*) *)
echo "Invalid option ${1}. Running with default values..." echo "Invalid option ${1}. Running with default values..."
shift shift
@ -233,6 +240,13 @@ generate_bootdisk () {
wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}"
fi fi
if [[ "${THINKPAD}" == true ]]; then
echo "Thinkpads: setting ForceOcWriteFlash to true"
export THINKPAD=true
else
export THINKPAD=false
fi
[ -e ./opencore-image-ng.sh ] \ [ -e ./opencore-image-ng.sh ] \
|| { wget "${OPENCORE_IMAGE_MAKER_URL}" \ || { wget "${OPENCORE_IMAGE_MAKER_URL}" \
&& chmod +x opencore-image-ng.sh ; } && chmod +x opencore-image-ng.sh ; }
@ -252,6 +266,7 @@ generate_bootdisk () {
-e s/\{\{ROM\}\}/"${ROM}"/g \ -e s/\{\{ROM\}\}/"${ROM}"/g \
-e s/\{\{WIDTH\}\}/"${WIDTH:-1920}"/g \ -e s/\{\{WIDTH\}\}/"${WIDTH:-1920}"/g \
-e s/\{\{HEIGHT\}\}/"${HEIGHT:-1080}"/g \ -e s/\{\{HEIGHT\}\}/"${HEIGHT:-1080}"/g \
-e s/\{\{THINKPAD\}\}/"${THINKPAD:-false}"/g \
"${MASTER_PLIST}" > ./tmp.config.plist || exit 1 "${MASTER_PLIST}" > ./tmp.config.plist || exit 1
else else
cat <<EOF && exit 1 cat <<EOF && exit 1

View file

@ -30,6 +30,7 @@ General options:
--create-envs, --envs Create all corresponding sourcable envs --create-envs, --envs Create all corresponding sourcable envs
--create-plists, --plists Create all corresponding config.plists --create-plists, --plists Create all corresponding config.plists
--create-bootdisks, --bootdisks Create all corresponding bootdisks [SLOW] --create-bootdisks, --bootdisks Create all corresponding bootdisks [SLOW]
--thinkpad Toggles ForceOcWriteFlash to true
--help, -h, help Display this help and exit --help, -h, help Display this help and exit
Additional options only if you are creating ONE serial set: Additional options only if you are creating ONE serial set:
@ -38,7 +39,7 @@ Additional options only if you are creating ONE serial set:
Custom plist placeholders: Custom plist placeholders:
{{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}}, {{DEVICE_MODEL}}, {{SERIAL}}, {{BOARD_SERIAL}},
{{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}} {{UUID}}, {{ROM}}, {{WIDTH}}, {{HEIGHT}}, {{THINKPAD}}
Example: Example:
./generate-unique-machine-values.sh --count 1 --plists --bootdisks --envs ./generate-unique-machine-values.sh --count 1 --plists --bootdisks --envs
@ -203,8 +204,13 @@ while (( "$#" )); do
shift shift
;; ;;
--thinkpad )
export THINKPAD=true
shift
;;
*) *)
echo "Invalid option. Running with default values..." echo "Invalid option ${1}. Running with default values..."
shift shift
;; ;;
esac esac
@ -313,6 +319,7 @@ export UUID="${UUID}"
export MAC_ADDRESS="${MAC_ADDRESS}" export MAC_ADDRESS="${MAC_ADDRESS}"
export WIDTH="${WIDTH}" export WIDTH="${WIDTH}"
export HEIGHT="${HEIGHT}" export HEIGHT="${HEIGHT}"
export THINKPAD="${THINKPAD}"
EOF EOF
fi fi
@ -333,6 +340,13 @@ EOF
wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}" wget -O "${MASTER_PLIST:=./config-nopicker-custom.plist}" "${MASTER_PLIST_URL}"
fi fi
if [[ "${THINKPAD}" == true ]]; then
echo "Thinkpads: setting ForceOcWriteFlash to true"
export THINKPAD=true
else
export THINKPAD=false
fi
mkdir -p "${OUTPUT_DIRECTORY}/plists" mkdir -p "${OUTPUT_DIRECTORY}/plists"
source "${OUTPUT_ENV_FILE}" source "${OUTPUT_ENV_FILE}"
ROM="${MAC_ADDRESS//\:/}" ROM="${MAC_ADDRESS//\:/}"
@ -344,6 +358,7 @@ EOF
-e s/\{\{ROM\}\}/"${ROM}"/g \ -e s/\{\{ROM\}\}/"${ROM}"/g \
-e s/\{\{WIDTH\}\}/"${WIDTH}"/g \ -e s/\{\{WIDTH\}\}/"${WIDTH}"/g \
-e s/\{\{HEIGHT\}\}/"${HEIGHT}"/g \ -e s/\{\{HEIGHT\}\}/"${HEIGHT}"/g \
-e s/\{\{THINKPAD\}\}/"${THINKPAD}"/g \
"${MASTER_PLIST}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1 "${MASTER_PLIST}" > "${OUTPUT_DIRECTORY}/plists/${SERIAL}.config.plist" || exit 1
fi fi