For firmware version: stable 0.71.1
Use the Docker container of the Flipper Zero toolchain as the compile environment.
docker pull flipperdevices/flipperzero-toolchain
docker run -it flipperdevices/flipperzero-toolchain bash
Get the official Flipper Zero firmware source code.
git clone https://github.com/flipperdevices/flipperzero-firmware.git
Get into the directory
Two files are needed to be modified to unlock region tx restrictions:
First, in ./assets/resources/subghz/assets you need to create a file named as Settings_User . Just copy the same file from the Rogue Master repo.
Rogue Master firmware repository
https://github.com/RogueMaster/flipperzero-firmware-wPlugins
wget -P ./assets/resources/subghz/assets https://github.com/RogueMaster/flipperzero-firmware-wPlugins/raw/420/assets/resources/subghz/assets/setting_user.txt
Second, the file named furi_hal_subghz.c located in ./firmware/targets/f7/furi_hal . In the code block beginning from line 278, comment out the “if” line by adding “// ” at the beginning.
bool furi_hal_subghz_tx () {
// if(furi_hal_subghz.regulation != SubGhzRegulationTxRx) return false;
furi_hal_spi_acquire ( & furi_hal_spi_bus_handle_subghz ) ;
cc1101_switch_to_tx ( & furi_hal_spi_bus_handle_subghz ) ;
furi_hal_spi_release ( & furi_hal_spi_bus_handle_subghz ) ;
return true;
}
But there is no vim or nano in this container , so you need to edit it on the host machine.
mv firmware/targets/f7/furi_hal/furi_hal_subghz.c firmware/targets/f7/furi_hal/furi_hal_subghz.c.backup
#detach from container press ctrl+p then ctrl+q
#on host machine
docker ps
docker cp container_id:/flipperzero-firmware/firmware/targets/f7/furi_hal/flipper-z-f7-full-local.dfu.backup ./
mv furi_hal_subghz.c.backup furi_hal_subghz.c
#edit furi_hal_subghz.c as mentioned
docker cp ./furi_hal_subghz.c container_id:/flipperzero-firmware/firmware/targets/f7/furi_hal
#go back to conainer
docker attach container_id
Run command ./fbt to compile the firmware. When finished you will find the firmware file in ./dist directory.
To copy the firmware from the container to the host machine, run this command on the host machine.
docker cp container_id:/flipperzero-firmware/dist/f7-D/flipper-z-f7-full-local.dfu ./
Reference
Flipper zero: Build your own firmware!
Youtube Channel MugAMuggle