src/platform/extra_variants/README.md
This directory tree is designed to solve two problems.
So we are borrowing the initVariant() ideas here (by using weak gcc references). You can now define earlyInitVariant() and lateInitVariant() if your board needs them. earlyInitVariant() runs at the beginning of setup() directly after waitUntilPowerLevelSafe(); while lateInitVariant() runs after the LoRa radio is initialized.
If you'd like a board specific variant to be run, add the variant.cpp file to an appropriately named subdirectory and check for _VARIANT_boardname in the cpp file (so that your code is only built for your board). You'll need to define _VARIANT_boardname in your corresponding variant.h file. See existing boards for examples.
This approach has no added runtime cost.