Knowledgebase
  • Welcome!
  • Threats
    • Software
      • Malware
      • Ransomware
      • Macros
    • Hardware
      • Flipper Zero
        • Firmware
          • 🐬flipperzero
            • Getting Started
          • 🐬flipper-xtreme
            • Wiki
              • Key Combos
              • Generic Guides
              • iButton key file format
              • SubGhz
              • How to add new SubGHz frequencies
              • Sub-GHz Remote
              • LF RFID key file format
              • NFC Flipper File Formats
              • Infrared Flipper File Formats
              • BadKB
              • Asset Packs
              • Unit tests
              • OTA Updates
              • How To Build
              • Hardware Targets
              • Flipper Build Tool
              • FAP (Flipper Application Package)
              • Flipper Application Manifests (.fam)
          • 🐬roguemaster
          • 🐬unleashed
    • Human
      • Advanced Persistent Threats (APTs)
      • Social engineering
      • Phishing
      • Typosquatting
    • Disinformation
      • Black Propaganda
      • White Propaganda
      • Grey Propaganda
      • Info Warfare
      • Political Warfare
      • Astroturfing
      • Greenwashing
      • Bluewashing
      • Whisper Campaigns
      • Push Polling
      • "Joe Jobs"
      • False Flags
      • Deep Fakes
  • About
    • Ports
      • 20
      • 21
      • 22
      • 23
      • 25
      • 587
      • 2323
      • 53
      • 80
      • 194
  • Tools
    • Radio Frequency & SubGHZ
      • gnuradio
      • hackrf
    • Digital Forensics
      • afflib
    • Reverse Engineering
      • binwalk
      • radare2
    • Hardware & Virtualization
      • qemu
      • freerdp2
      • util-linux
      • lvm2
    • VPN Providers
      • ProtonVPN
      • NordVPN
      • ExpressVPN
      • Surfshark
      • CyberGhost
      • Private Internet Access
    • Database, Cloud, & Firewalls
      • sqlmap
      • cewl
      • gobuster
      • fwbuilder
      • clamav
    • Enumeration & Lists
      • crunch
      • aflplusplus
      • ffuf
      • maltego
        • maltego-teeth
      • getallurls
    • Penetration Testing
      • beef-xss
      • wifite
      • burpsuite
      • metasploit-framework
    • Passwords & Auth
      • john
      • hashcat
      • hydra
      • cryptsetup
    • Surface Intelligence
      • theharvester
      • subfinder
      • dsniff
      • dnsrecon
      • dirb
      • nikto
      • legion
      • spiderfoot
    • Networks & Wireless
      • nmap
      • impacket-scripts
      • tcpdump
      • traceroute
      • wireshark
      • responder
      • aircrack-ng
      • netcat
      • kismet
      • ubertooth
      • routersploit
      • apache2
      • ettercap
      • bettercap
      • bettercap-ui
      • freeradius
      • bind9
      • samba
      • net-snmp
      • tcpreplay
    • Social Media
      • sherlock
    • Miscellaneous
      • git
      • libnfc
      • llvm-defaults
  • Operating Systems
    • Ubuntu
      • Installation
        • Switching
          • From Windows
          • From macOS
          • From a different Linux
        • Applications
        • Ubuntu PreInstalled
    • Linux Mint
      • Installation Guide
        • Verify your ISO image
        • Choose the right edition
        • Boot Linux Mint
        • Create the bootable media
        • Install Linux Mint
        • Hardware drivers
        • Language support
        • EFI
        • Multimedia codecs
        • System snapshots
        • Pre-installing Linux Mint (OEM Installation)
        • Where to find help
        • Boot options
        • Partitioning
        • Multi-boot
      • User Guide
        • Grub Boot Menu
        • Snap Store
        • Chromium
        • Bluetooth
        • Windows ISOs and multiboot USB
        • How to upgrade to Linux Mint 20
        • Edge ISO Images
        • Lost Password
        • Upgrades
        • Printers and Scanners
        • How to upgrade to Linux Mint 21
      • Troubleshooting Guide
        • Expectation
        • Responsibility
        • Change
        • Reproducibility
        • Observation
        • Environment
        • What
        • When
        • Why
        • Errors
        • Where
        • How
      • Translation Guide
        • Using Launchpad
        • Verify your translations
        • Localization
      • Developer Guide
        • Getting Started
          • Setup
          • Technology
        • Mint Tools
        • Cinnamon
        • XApps
        • Development
          • Daily Builds
          • Coding Guidelines
          • Optimizing JS with Cinnamon
          • Building
    • Kali Linux
      • Installation
        • Installing Kali Linux
        • Bare-bones Kali
        • Installing Kali on Mac Hardware
        • Dual Booting Kali with Linux
        • Making a Kali Bootable USB Drive
        • Dual Booting Kali with macOS/OS X
        • Dual Booting Kali with Windows
        • BTRFS Install (Kali Unkaputtbar)
        • Deploying Kali over Network PXE/iPXE Install
      • Virtualization
        • Running Kali Linux as a Virtual Machine in Windows
        • Installing VMware on Apple Silicon (M1/M2) Macs (Host)
        • Customizing a Kali Vagrant Vagrantfile
        • Kali inside Proxmox (Guest VM)
        • Installing VMware on Kali (Host)
        • Installing VirtualBox on Kali (Host)
        • Import Pre-Made Kali VMware VM
        • Kali inside Parallels (Guest VM)
        • Kali inside Vagrant (Guest VM)
        • Kali inside VMware (Guest VM)
        • Kali inside VirtualBox (Guest VM)
        • Import Pre-Made Kali VirtualBox VM
        • Kali inside Hyper-V (Guest VM)
        • Kali inside UTM (Guest VM)
        • Kali inside QEMU/LibVirt with virt-manager (Guest VM)
        • Improving Virtual Machine Performance for VMware
        • Installing VMware Tools (Guest Tools)
        • Installing VirtualBox Guest Addition (Guest Tools)
        • Installing Hyper-V Enhanced Session Mode (Guest Tools)
        • Converting VMX to an OVA
      • USB
        • Making a Kali Bootable USB Drive (Linux)
        • Making a Kali Bootable USB Drive (macOS/OS X)
        • Updating Kali Linux on USB
        • Making a Kali Bootable USB Drive on Windows
        • Standalone Kali Linux 2021.4 Installation on a USB Drive, Fully Encrypted
        • Adding Persistence to a Kali Linux Live USB Drive
        • Adding Encrypted Persistence to a Kali Linux Live USB Drive
        • USB Boot in VirtualBox
        • USB Boot in VMware
      • Kali On ARM
        • BeagleBone Black
        • Acer Tegra Chromebook 13" (Nyan)
        • ASUS Chromebook Flip (Veyron)
        • Banana Pro
        • Banana Pi
        • CubieBoard2
        • CuBox-i4Pro
        • CubieTruck (CubieBoard3)
        • Gateworks Newport
        • CuBox
        • Gateworks Ventana
        • NanoPi NEO Plus2
        • NanoPi2
        • Mini-X
        • NanoPC-T3
        • ODROID-C0/C1/C1+
        • ODROID-XU3
        • ODROID-U2/U3
        • ODROID-C2
        • Pinebook
      • Containers
        • Kali Linux LXC/LXD Images
        • Official Kali Linux Docker Images
        • Installing Docker on Kali Linux
        • Using Kali Linux Docker Images
        • Using Kali Linux Podman Images
      • WSL
        • Win-KeX SL
        • Win-KeX ESM
        • Preparing a system for WSL
        • Win-KeX
        • Win-KeX Win
      • Cloud
        • Digital Ocean
        • AWS
        • Azure
        • Linode
      • Kali NetHunter
        • Installing NetHunter On the OnePlus 7
        • Installing NetHunter On the Gemini PDA
        • Installing NetHunter
        • Installing NetHunter On the TicWatch Pro 3
        • Installing NetHunter On the TicWatch Pro
        • NetHunter Application - Terminal
        • NetHunter BadUSB Attack
        • NetHunter Bluetooth-Arsenal
        • NetHunter Chroot Manager
        • NetHunter Components
        • NetHunter Custom Commands
        • NetHunter Home Screen
        • NetHunter DuckHunter Attacks
        • NetHunter HID Keyboard Attacks
        • NetHunter Exploit Database SearchSploit
        • NetHunter Kali Services
        • NetHunter MAC Changer
        • NetHunter MANA Evil Access Point
        • NetHunter Man In The Middle Framework
        • NetHunter KeX Manager
      • Tools
        • Installing Tor Browser on Kali Linux
        • Kali Tools
        • Installing snapd on Kali Linux
        • Metasploit Framework
        • Installing Flatpak on Kali Linux
        • Submitting tools to Kali
        • Removed Tools From Kali
      • Troubleshooting
        • Discovering Problems With Download Speed
        • Common Cloud Based Setup Information
        • The Basics of Troubleshooting
        • Troubleshooting Installations Failures
        • Troubleshooting Wireless Drivers
        • Minimum Install Setup Information
      • Kali Development
        • Contributing run-time tests with autopkgtest
        • Custom CuBox Image
        • Custom Beaglebone Black Image
        • Custom EfikaMX Image
        • Custom Chromebook Image
        • Custom MK/SS808 Image
        • Custom Raspberry Pi Image
        • Custom ODROID X2 U2 Image
        • Setting up a system for packaging
        • Intermediate packaging step-by-step example
        • Introduction to packaging step-by-step example
        • Getting the best out of the Kali Bot
        • Advanced Packaging Step-By-Step Example (FinalRecon & Python-icmplib)
        • Generate an Updated Kali ISO
        • Creating A Custom Kali ISO
        • Building Custom Kali ISOs
        • Rebuilding a Source Package
        • Recompiling the Kali Linux Kernel
        • ARM Build Scripts
        • Preparing a Kali Linux ARM chroot
    • Arch Linux
      • Installation Guide
      • Frequently Asked Questions
      • General Recommendations
      • Applications
        • Office & Docs
        • Internet
        • Multimedia
        • Science
        • Security
        • Utilities
        • Others
      • Arch compared to other distributions
    • NetBSD
      • Calls and Errors
      • Libraries
      • Lua Modules
      • Devices and Drivers
  • Law, Policy, and Ethics
    • Fair Use
    • DMCA
      • 🗄️Notable Cases
        • MGM Studios Inc. v. Grokster, Ltd.
        • Viacom International, Inc v YouTube, Inc
        • Capitol Records, Inc. v. Thomas-Rasset
        • Perfect 10, Inc. v. Amazon.com
        • Recording Industry Association of America (RIAA) v. Diamond Multimedia Systems, Inc.
        • A&M Records, Inc. v. Napster, Inc.
        • BMG Music v. Gonzalez
        • Sony Computer Entertainment America (SCEA) v. Connectix Corp.
        • Columbia Pictures Industries, Inc. v. Fung
        • Warner Bros. Entertainment Inc. v. RDR Books
        • BMG Music v. John Doe
        • Universal Music Group v. Veoh Networks, Inc.
        • Universal Music Group v. MySpace, Inc.
        • UMG Recordings, Inc. v. MP3.com, Inc.
        • Cartoon Network LP v. CSC Holdings, Inc.
        • Metro-Goldwyn-Mayer Studios Inc. v. Grokster, Ltd.
        • Viacom International Inc. v. Google Inc.
        • Tiffany (NJ) Inc. v. eBay Inc.
        • Perfect 10, Inc. v. Visa International Service Association
        • Universal City Studios Productions LLLP v. Reimerdes
        • Recording Industry Association of America (RIAA) v. Lime Group LLC
        • Sony BMG Music Entertainment v. Tenenbaum
        • Viacom International Inc. v. Time Warner Cable Inc.
        • UMG Recordings, Inc. v. Shelter Capital Partners LLC
        • Sony Computer Entertainment America Inc. v. Bleem LLC
        • Universal City Studios, Inc. v. Corley
        • Ticketmaster Corp. v. Tickets.com, Inc.
        • Authors Guild, Inc. v. Google, Inc.
        • Perfect 10, Inc. v. Cybernet Ventures, Inc.
        • Tiffany (NJ) Inc. v. Ningbo Beyond Home Textile Co., Ltd.
        • Google Inc. v. American Blind & Wallpaper Factory, Inc.
        • Columbia Pictures Industries, Inc. v. Redd Horne, Inc.
Powered by GitBook
On this page
  • Environment
  • Invoking FBT
  • Build directories
  • VSCode integration
  • FBT targets
  • High-level (what you most likely need)
  • Firmware targets
  • Assets
  • Command-line parameters
  • Configuration
  • Firmware application set

Was this helpful?

Edit on GitHub
  1. Threats
  2. Hardware
  3. Flipper Zero
  4. Firmware
  5. flipper-xtreme
  6. Wiki

Flipper Build Tool

PreviousHardware TargetsNextFAP (Flipper Application Package)

Last updated 2 years ago

Was this helpful?

FBT is the entry point for firmware-related commands and utilities. It is invoked by ./fbt in the firmware project root directory. Internally, it is a wrapper around build system.

Environment

To use fbt, you only need git installed in your system.

fbt by default downloads and unpacks a pre-built toolchain, and then modifies environment variables for itself to use it. It does not contaminate your global system's path with the toolchain.

However, if you wish to use tools supplied with the toolchain outside fbt, you can open an fbt shell, with properly configured environment.

  • On Windows, simply run scripts/toolchain/fbtenv.cmd.

  • On Linux & MacOS, run source scripts/toolchain/fbtenv.sh in a new shell.

If your system is not supported by pre-built toolchain variants or you want to use custom versions of dependencies, you can set FBT_NOENV=1. fbt will skip toolchain & environment configuration and will expect all tools to be available on your system's PATH. (this option is not available on Windows)

If FBT_TOOLCHAIN_PATH variable is set, fbt will use that directory to unpack toolchain into. By default, it downloads toolchain into toolchain subdirectory repo's root.

If you want to enable extra debug output for fbt and toolchain management scripts, you can set FBT_VERBOSE=1.

fbt always performs git submodule update --init on start, unless you set FBT_NO_SYNC=1 in the environment:

  • On Windows, it's set "FBT_NO_SYNC=1" in the shell you're running fbt from

  • On *nix, it's $ FBT_NO_SYNC=1 ./fbt ...

There are more variables controlling basic fbt behavior. See fbt & fbtenv scripts' sources for details.

Invoking FBT

To build with FBT, call it and specify configuration options & targets to build. For example:

./fbt COMPACT=1 DEBUG=0 VERBOSE=1 updater_package copro_dist

To run cleanup (think of make clean) for specified targets, add the -c option.

Build directories

fbt builds updater & firmware in separate subdirectories in build, and their names depend on optimization settings (COMPACT & DEBUG options). However, for ease of integration with IDEs, the latest built variant's directory is always linked as built/latest. Additionally, compile_commands.json is generated in that folder (it is used for code completion support in IDEs).

build/latest symlink & compilation database are only updated upon firmware build targets - that is, when you're re-building the firmware itself. Running other tasks, like firmware flashing or building update bundles for a different debug/release configuration or hardware target, does not update built/latest dir to point to that configuration.

VSCode integration

fbt includes basic development environment configuration for VS Code. Run ./fbt vscode_dist to deploy it. That will copy the initial environment configuration to the .vscode folder. After that, you can use that configuration by starting VS Code and choosing the firmware root folder in the "File > Open Folder" menu.

  • On the first start, you'll be prompted to install recommended plugins. We highly recommend installing them for the best development experience. You can find a list of them in .vscode/extensions.json.

  • Basic build tasks are invoked in the Ctrl+Shift+B menu.

  • Debugging requires a supported probe. That includes:

    • Wi-Fi devboard with stock firmware (blackmagic).

    • ST-Link and compatible devices.

  • Without a supported probe, you can install firmware on Flipper using the USB installation method.

FBT targets

fbt keeps track of internal dependencies, so you only need to build the highest-level target you need, and fbt will make sure everything they depend on is up-to-date.

High-level (what you most likely need)

  • fw_dist - build & publish firmware to the dist folder. This is a default target when no others are specified.

  • fap_dist - build external plugins & publish to the dist folder.

  • updater_package, updater_minpackage - build a self-update package. The minimal version only includes the firmware's DFU file; the full version also includes a radio stack & resources for the SD card.

  • copro_dist - bundle Core2 FUS+stack binaries for qFlipper.

  • flash - flash the attached device with OpenOCD over ST-Link.

  • flash_usb, flash_usb_full - build, upload and install the update package to the device over USB. See details on updater_package and updater_minpackage.

  • debug - build and flash firmware, then attach with gdb with firmware's .elf loaded.

  • debug_other, debug_other_blackmagic - attach GDB without loading any .elf. It will allow you to manually add external .elf files with add-symbol-file in GDB.

  • updater_debug - attach GDB with the updater's .elf loaded.

  • blackmagic - debug firmware with Blackmagic probe (WiFi dev board).

  • openocd - just start OpenOCD.

  • get_blackmagic - output the blackmagic address in the GDB remote format. Useful for IDE integration.

  • get_stlink - output serial numbers for attached STLink probes. Used for specifying an adapter with OPENOCD_ADAPTER_SERIAL=....

  • lint, format - run clang-format on the C source code to check and reformat it according to the .clang-format specs.

  • firmware_pvs - generate a PVS Studio report for the firmware. Requires PVS Studio to be available on your system's PATH.

  • cli - start a Flipper CLI session over USB.

Firmware targets

  • faps - build all external & plugin apps as .faps.

  • fbt also defines per-app targets. For example, for an app with appid=snake_game target names are:

    • fap_snake_game, etc. - build single app as .fap by its application ID.

    • Check out --extra-ext-apps for force adding extra apps to external build.

    • fap_snake_game_list, etc - generate source + assembler listing for app's .fap.

  • flash, firmware_flash - flash the current version to the attached device with OpenOCD over ST-Link.

  • jflash - flash the current version to the attached device with JFlash using a J-Link probe. The JFlash executable must be on your $PATH.

  • flash_blackmagic - flash the current version to the attached device with a Blackmagic probe.

  • firmware_all, updater_all - build a basic set of binaries.

  • firmware_list, updater_list - generate source + assembler listing.

  • firmware_cdb, updater_cdb - generate a compilation_database.json file for external tools and IDEs. It can be created without actually building the firmware.

Assets

  • resources - build resources and their manifest files

    • dolphin_ext - process dolphin animations for the SD card

  • icons - generate .c+.h for icons from PNG assets

  • proto - generate .pb.c+.pb.h for .proto sources

  • proto_ver - generate .h with a protobuf version

  • dolphin_internal, dolphin_blocking - generate .c+.h for corresponding dolphin assets

Command-line parameters

  • --options optionfile.py (default value fbt_options.py) - load a file with multiple configuration values

  • --extra-int-apps=app1,app2,appN - force listed apps to be built as internal with the firmware target

  • --extra-ext-apps=app1,app2,appN - force listed apps to be built as external with the firmware_extapps target

  • --proxy-env=VAR1,VAR2 - additional environment variables to expose to subprocesses spawned by fbt. By default, fbt sanitizes the execution environment and doesn't forward all inherited environment variables. You can find the list of variables that are always forwarded in the environ.scons file.

Configuration

Default configuration variables are set in the configuration file: fbt_options.py. Values set in the command line have higher precedence over the configuration file.

You can find out available options with ./fbt -h.

Firmware application set

You can create customized firmware builds by modifying the list of applications to be included in the build. Application presets are configured with the FIRMWARE_APPS option, which is a map(configuration_name:str -> application_list:tuple(str)). To specify an application set to use in the build, set FIRMWARE_APP_SET to its name. For example, to build a firmware image with unit tests, run ./fbt FIRMWARE_APP_SET=unit_tests.

Check out fbt_options.py for details.

J-Link for flashing and debugging (in VSCode only). Note that J-Link tools are not included with our toolchain and you have to them yourself and put them on your system's PATH.

lint_py, format_py - run on the Python source code, build system files & application manifests.

🐬
scons
download
black