SAMD21 custom board and building/uploading custom bootloader


I integrated into a blink project. To do this I put a json under .platformio/boards, the variants folder into the project and extended the ini (board_build.variants_dir and board_build.variant) accordingly. This works so far.


Now I also want to add and customize the bootloader. I can already build it with make. What is a good way to integrate the bootloader build process into PlatformIO? And how to integrate the flashing process of the bootloader with openocd via blackmagic probe?

Are extra_scripts the way to go?