How to Compile custom Firmware Using PlatformIO?

I think you have misunderstood the architecture.

The base image (Oct2017) and the firmware are completely different things. For the EmonPi, the firmware is what runs on the daughter board attached to the Pi inside, which does have an RFM card on it.

The best thing for you to do is to follow the instructions on the Pinned Post (emonSD-24Jul20 release), get a new SD card with a new image and migrate your settings/data. This will also update the firmware on the EmonPi.