How to specify a Github fork of Teensy 4 core library in PlatformIO


I’m using PlatformIO (in VSCode) to build for Teensy 4.1 with the Arduino option (as opposed to the Zephyr option).

When configuring a PIO project for this board, it brings in a package called framework-arduinoteensy which then contains a folder called cores which contains the contents of the official Teensy core library. This library comes from GitHub - PaulStoffregen/cores: Teensy Core Libraries for Arduino.

I am building for a custom PCB that is 99.9% identical to Teensy 4.1 but has some extra pins. At the moment I am just making some minor edits to the source files that PlatformIO is installing in packges/framework-arduinoteensy/cores, but this is obviously not a great solution as these files can be very easily overwritten and are not centralised.

What is the best way to have these files come from my own fork of the Teensy core library repo? Are there configuration directives to achieve this, or do I have to create my own custom Board for PlatformIO? Or some other strategy again? This is my first dive into anything beyond just using the most common settings in platformio.ini.