How to do my own custom version of a arduino esp32 platform?

I’ve been using Platform IO for a while to do development the Espressif ESP32 arduino platform and I am very happy with it. But I have reached the point where I need to make a few custom modifications to the esp32 arduino platform code. I am struggling to figure out how do I make my own copy of the platform and use that in my projects.

I’ve done a fork of GitHub - platformio/platform-espressif32: Espressif 32: development platform for PlatformIO and I am now using that fork, but that doesn’t have the actual source for the arduino esp32 libraries, that stuff is in GitHub - espressif/arduino-esp32: Arduino core for the ESP32. I have a fork of that, but how do I get platformio to use that fork?

In platformio.ini, use:

platform_packages =
    platformio/framework-arduinoespressif32 @ symlink://C:/dir/arduino-esp32

Documentation