Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
The OC plistlib generator is a tool allowing you to automate OC upgrades, with no (or minimal) configuration changes. The setup.py example settings are based on @cdf's OpenCore on the Mac Pro guide and you can customize everything to your likings.

Why I created this tool? Once you are familiar with OC, you will notice there is a long list of pre-defined OC properties (which can be either updated of replaced) and for each new OC release, there are no changes to your own configuration properties. The plistlib generator will take care of that, I will maintain the default properties (in collaboration with @cdf). This will allow you to customize only the properties you desire, into a compact and easy to understand setup.py file.

Beside configuration, the generator will also properly build your EFI tree with latest Acidanthera software.

If you have any questions, please ask them here.

macOS Monterey 12.3+ Changes​

Monterey 12.3 introduces Python 3 as default libraries, making Python 2 obsolete. Therefore, for future macOS upgrades, a new Plistlib Generator library was written with Python 3 support (see notable changes).

To upgrade your OS from Monterey 12.2.1 version (or less), to Monterey 12.3, run:

Code:
~$ git clone -b 1.2.6 --depth 1 https://github.com/axivo/opencore.git
~$ cd opencore
~$ python -B setup.py

Look at the setup.py custom settings to see how the required ASPP-Override kext is implemented.

Once you upgraded to Monterey 12.3, you can use the new Python 3 library to generate your EFI directory:

Code:
~$ git clone https://github.com/axivo/opencore.git
~$ cd opencore
~$ python3 -B setup.py

Visit the configuration wiki page for detailed instructions.

Latest Release​

Visit the Releases page, for latest available version.
 
Last edited:

startergo

macrumors 603
Sep 20, 2018
5,022
2,283
Can you please provide a complete example file with all the possible methods?
 

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
Sure @startergo, can you help me understand what do you mean by all possible methods? I presume you refer to the DEBUG build or how to use your own custom kexts? I'll add your suggestions into documentation.
 
  • Like
Reactions: startergo

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
@startergo I created a new wiki page called Build Options. For a full setup.py example, take a look at opencore/examples. I will keep this file updated, so you can easily see if there are any differences for a new OC release, it has all settings highlighted into @cdf's thread, hardware acceleration, external disks as internal, Night Shift enabler, etc.

I recommend starting to read the Configuration wiki page, to understand better the product flexibility and overall usage.

Related to the possible Python methods used, you will only need to deal with the ones listed inside default setup.py, I responded to your Github issue.
 
Last edited:

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
As discussed with @cdf, I added the firmware features into opencore/examples/setup.py file. For example, you can calculate easy the Hex value used into build.unhexlify method. Say you want to find the Hex value for P/8f/w==, enter it as Base64 into Hackintool to obtain the Hex:

1613006031040.png


In real life, you should always use a Hex value, which will be transformed into Base64 and used into your config.plist file.
 
Last edited:

Steve_Jones

macrumors member
Jan 26, 2019
34
14
Having an issue with the new version. Downloaded the new version, copy and pasted my bits in and I'm getting the following error when I try to run it:

Code:
  File "setup.py", line 24
    build = OpenCoreBuild('Volumes/EFI', kexts)
                                              ^

IndentationError: unindent does not match any outer indentation level

Here's my setup.py (I've also zipped it up as an attachment):

#!/usr/bin/env python





from opencore.build import OpenCoreBuild








if __name__ == '__main__':


kexts = [


{


'project': 'Lilu',


'repo': 'acidanthera',


'version': '1.5.1'


},


{


'project': 'NightShiftEnabler',


'repo': 'cdf',


'version': '1.1.0'


},


{


'project': 'WhateverGreen',


'repo': 'acidanthera',


'version': '1.4.7'


}


]


build = OpenCoreBuild('Volumes/EFI', kexts)


build.write_tree()





settings = {


'DeviceProperties': {


'Add': {


'PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)': {


'agdpmod': build.unhexlify('70 69 6B 65 72 61 00'),


'rebuild-device-tree': build.unhexlify('00'),


'shikigva': build.unhexlify('50'),


'unfairgva': build.unhexlify('01 00 00 00')


},





}


},


'Kernel': {


'Emulate': {


'Cpuid1Data': build.unhexlify('00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'),


'Cpuid1Mask': build.unhexlify('00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')


}


},


'NVRAM': {


'Add': {


'4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14': {


'DefaultBackgroundColor': build.unhexlify('00 00 00 00'),


'UIScale': build.unhexlify('02')


}


},


'Delete': {


'4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14': [


'DefaultBackgroundColor',


'UIScale'


]


}


},


'PlatformInfo': {


'SMBIOS': {


'BIOSVersion': '9999.0.0.0.0',


'BoardProduct': 'Mac-27AD2F918AE68F61',


'FirmwareFeatures': build.unhexlify('03 54 0C E0'),


'FirmwareFeaturesMask': build.unhexlify('3F FF 1F FF')


},


'UpdateSMBIOS': True


}


}


build.write_plist(settings)


build.run_misc_tasks()

Any help would be appreciated.

Thanks.
 

Attachments

  • setup.py.zip
    1.3 KB · Views: 175

Steve_Jones

macrumors member
Jan 26, 2019
34
14
Well I'm not sure what the issue was but I started editing it in nano instead of Xcode and all was happy.
 

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
@Steve_Jones settings indentation is not right:

1615055032986.png


It should be:

1615055086918.png


Once you get setup.py file configured to your liking, you can use it for any future OC version, as it will never change unless there are new OC features added/tweaked specifically for cMP.

BTW, latest OC 0.6.7 adds new features, you missed few from last updates also. Take a look at latest full config example.

Also, try Visual Studio Code as editor. It will tell you where the issue is.

1615055588782.png


The other 15 problems are keywords not being seen as correct English :D
 
Last edited:
  • Like
Reactions: Steve_Jones

MacForumsUser

macrumors member
Dec 17, 2012
58
25
Issue: The boot picker does not display properly when connecting my monitor via DisplayPort. The boot picker displays properly when connected via HDMI.

Code:
#!/usr/bin/env python

from opencore.build import OpenCoreBuild


if __name__ == '__main__':
    kexts = [
        {
            'project': 'Lilu',
            'repo': 'acidanthera',
            'version': '1.5.1'
        },
        {
            'project': 'NightShiftEnabler',
            'repo': 'cdf',
            'version': '1.1.0'
        },
        {
            'project': 'WhateverGreen',
            'repo': 'acidanthera',
            'version': '1.4.8'
        }
    ]
    build = OpenCoreBuild('Volumes/EFI', kexts)
    build.write_tree()

    settings = {
        'DeviceProperties': {
            'Add': {
                'PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)': {
                    'agdpmod': build.unhexlify('70 69 6B 65 72 61 00'),
                    'rebuild-device-tree': build.unhexlify('00'),
                    'shikigva': build.unhexlify('50'),
                    'unfairgva': build.unhexlify('01 00 00 00')
                },
                'PciRoot(0x0)/Pci(0x7,0x0)/Pci(0x0,0x0)': {
                    'built-in': build.unhexlify('00')
                },
                'PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x4,0x0)/Pci(0x0,0x0)': {
                    'built-in': build.unhexlify('00')
                }
            }
        },
        'Kernel': {
            'Quirks': {
                'DisableLinkeditJettison': True,
                'SetApfsTrimTimeout': 9999999
            },
            'Scheme': {
                'KernelArch': 'x86_64'
            }
        },
        'Misc': {
            'Boot': {
                'ConsoleAttributes': 15,
                'HideAuxiliary': True,
                'PollAppleHotKeys': True,
                'PickerMode': 'External',
                'ShowPicker': False
            },
            'Security': {
                'BlacklistAppleUpdate': True,
                'ExposeSensitiveData': 3,
                'ScanPolicy': 0,
                'SecureBootModel': 'Disabled',
                'Vault': 'Optional'
            }
        },
        'NVRAM': {
            'Add': {
                '4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14': {
                    'DefaultBackgroundColor': build.unhexlify('00 00 00 00'),
                    'UIScale': build.unhexlify('02')
                }
            },
            'Delete': {
                '4D1EDE05-38C7-4A6A-9CC6-4BCCA8B38C14': [
                    'DefaultBackgroundColor',
                    'UIScale'
                ]
            }
        },
        'PlatformInfo': {
            'SMBIOS': {
                'BIOSVersion': '9999.0.0.0.0',
                'BoardProduct': 'Mac-7BA5B2D9E42DDD94',
                'FirmwareFeatures': build.unhexlify('03 54 0C E0'),
                'FirmwareFeaturesMask': build.unhexlify('3F FF 1F FF')
            },
            'UpdateSMBIOS': True
        },
        'UEFI': {
            'ConnectDrivers': True,
            'Drivers': [
                'ExFatDxeLegacy.efi',
                'OpenCanopy.efi',
                'OpenRuntime.efi'
            ],
            'Output': {
                'DirectGopRendering': False,
                'ProvideConsoleGop': True,
                'Resolution': 'Max'
            },
            'ProtocolOverrides': {
                'AppleBootPolicy': True,
                'AppleUserInterfaceTheme': True
            },
            'Quirks': {
                'RequestBootVarRouting': True
            }
        }
    }
    build.write_plist(settings)
    build.run_misc_tasks()
 
Last edited:

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
@RicheeThree can you please use [code] instead of spoiler, it messes the formatting and formatting is super important in Python.

Edit: I looked at your configuration and everything is correct, if you use an RX580 GPU. You can remove the DirectGopRendering line, as failsafe value is already False. Did you generated a fresh EFI and replaced the old one?
Code:
~$ git clone https://github.com/axivo/opencore.git
~$ cd opencore
~$ python setup.py

~$ diskutil list /dev/disk0
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI ⁨EFI⁩                     209.7 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk2⁩         499.9 GB   disk0s2

~$ sudo diskutil mount /dev/disk0s1
Password:
Volume EFI on /dev/disk0s1 mounted

~$ ls -lh /Volumes/EFI/EFI
total 3
drwxrwxrwx  1 floren  staff   512B 19 Nov 17:56 BOOT
drwxrwxrwx  1 floren  staff   1.0K 19 Nov 17:56 OC

~$ rm -rf /Volumes/EFI/EFI
~$ cp -a Volumes/EFI/EFI /Volumes/EFI/

~$ sudo diskutil unmount /dev/disk0s1
Volume EFI on disk0s1 unmounted
 
Last edited:

MacForumsUser

macrumors member
Dec 17, 2012
58
25
@RicheeThree can you please use [code] instead of spoiler, it messes the formatting and formatting is super important in Python.

Edit: I looked at your configuration and everything is correct, if you use an RX580 GPU. You can remove the DirectGopRendering line, as failsafe value is already False. Did you generated a fresh EFI and replaced the old one?
Code:
~$ git clone https://github.com/axivo/opencore.git
~$ cd opencore
~$ python setup.py

~$ diskutil list /dev/disk0
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI ⁨EFI⁩                     209.7 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk2⁩         499.9 GB   disk0s2

~$ sudo diskutil mount /dev/disk0s1
Password:
Volume EFI on /dev/disk0s1 mounted

~$ ls -lh /Volumes/EFI/EFI
total 3
drwxrwxrwx  1 floren  staff   512B 19 Nov 17:56 BOOT
drwxrwxrwx  1 floren  staff   1.0K 19 Nov 17:56 OC

~$ rm -rf /Volumes/EFI/EFI
~$ cp -a Volumes/EFI/EFI /Volumes/EFI/

~$ sudo diskutil unmount /dev/disk0s1
Volume EFI on disk0s1 unmounted
Sorry about that. I edited the post and removed [/SPOILER].

I'll remove the DirectGopRendering line.

I generated a fresh EFI tree and entirely replaced the old one using the commands as suggested in the Axivo wiki.
 

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
No worries, you don’t have any configuration issues which is great, nice job. You are using a RX580, I presume. I need you to check if your GPU has a dual ROM switch and make sure is on left side. See #10.
 
Last edited:

MacForumsUser

macrumors member
Dec 17, 2012
58
25
No worries, you don’t have any configuration issues which is great, nice job. You are using a RX580, I presume. I need you to check if your GPU has a dual ROM switch and make sure is on left side.
Thanks :) But I didn't really do anything. I couldn't have done it without the Axivo tool!

Anyway, I am using a RX 580 with dual ROM. Switch is on the left/in position 1 ("Gaming" mode or "Quiet" mode).
 
Last edited:
  • Like
Reactions: TECK

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
Plistlib Generator 1.1.4 was released with support for OC 0.7.2 (see notable changes), you will need to perform several minor changes to your current setup.py file, prior executing the usual upgrade process.
 
Last edited:

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
@borgo1971 formatting is done automatically with plutil, so the configuration has always a standard output. That’s how Apple does it.
 

borgo1971

macrumors regular
Sep 5, 2013
158
39
OK. Another question. Can I add RadeonBoost.kext to OC (kext & config file) through setup.py? It seems I get a little better score with them enabled, on Geekbench 5. Even my goal is to archive pre-login video signal on DisplayPort, I trying to optimize my configuration too. Even enabling DirectGopRendering seems to help for this... have this sense with RX580 Nitro+ (I know it should be disabled for Pulse, not sure for Nitro)?
 

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
@borgo1971 You can use any downloadable GitHub or custom kext you desire. Take a look at all build options, including the Kext section:

The easiest way to build your own kext is to create a .zip file format identical to the Acidanthera kext format. If you have any questions, please ask them here.

Edit: To make things even easier, I added AppleMCEReporterDisabler as custom kext, into files directory. This should help you understand how to use your own kexts. Once you drop the file into directory, the tool will implement your kext and also write the proper configuration for it.
 
Last edited:

TECK

macrumors 65816
Original poster
Nov 18, 2011
1,129
478
I added Latebloom support into OC Plistlib Generator, see #111 and #112. I had to format Latebloom the zip file as it was not properly formatted for some reason (see command used into PR). I also updated the documentation.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.