Skip to main content

Convert a raw binary blob into a minimal ARM ELF at a chosen load address.

Project description

bin2elf

GitHub PyPI Version License Buy Me A Coffee

Convert a raw binary blob (e.g., a firmware dump) into a minimal ARM ELF file with a chosen load address - handy for disassemblers, debuggers, and reverse-engineering tools that expect ELF.

macOS & Linux systems (Windows supported via WSL).

This package provides a single CLI command:

bin2elf

It wraps GNU binutils (arm-none-eabi-*) in a tiny pipeline that:

  1. wraps your raw bytes into a relocatable ELF,
  2. marks the bytes as executable code,
  3. links it at the address you provide, and
  4. strips symbols for a clean, minimal output.

Highlights

  • 🔧 Choose endianness: little or big (-EL / -EB).
  • 📍 Explicit base address: place .text exactly at --load_addr (e.g., 0x08000000).
  • 🧰 Pure binutils under the hood: predictable and portable.

Requirements

  • Python = 3.7

  • GNU ARM Embedded binutils available on your PATH:

    • arm-none-eabi-ld
    • arm-none-eabi-objcopy
    • arm-none-eabi-strip

Tip: Package names you might look for on your OS:

  • Debian/Ubuntu: binutils-arm-none-eabi (or the full gcc-arm-none-eabi toolchain)
  • Arch: arm-none-eabi-binutils
  • macOS (Homebrew): arm-none-eabi-binutils
  • Windows: use WSL or an ARM embedded toolchain (ensure arm-none-eabi-* tools are in PATH).

Installation

pip install bin2elf

Usage

bin2elf <input.bin> <output.elf> <load_addr> [--endian little|big] [--prefix arm-none-eabi-]

Positional arguments

  • input – path to the raw binary file.
  • output – desired ELF output path.
  • load_addr – load address (e.g., 0x08000000; accepts 0x hex or decimal).

Options

  • --endian {little,big}important, target endianness (default: little).
  • --prefix – toolchain prefix (default: arm-none-eabi-).

Examples

Little-endian blob at 0x08000000:

bin2elf firmware.bin firmware.elf 0x08000000

Big-endian blob at 0x00100000:

bin2elf image.bin image_be.elf 0x00100000 --endian big

Analyze the result:

arm-none-eabi-readelf -h -S -l firmware.elf
arm-none-eabi-objdump -D firmware.elf | less

Exit codes

  • 0 – success
  • 1 – an external tool returned an error (you’ll see the message on stderr)

Security

This tool does not execute your binary; it just wraps bytes into an ELF container. Still, be mindful when opening unknown binaries in debuggers or emulators. Happy reversing! 🛠️📦


Tim Abdiukov

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bin2elf-0.1.4.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bin2elf-0.1.4-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file bin2elf-0.1.4.tar.gz.

File metadata

  • Download URL: bin2elf-0.1.4.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for bin2elf-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1a49d7f28768652e9d330bfbf5502eb29bcea1b86790381a232a3635d2c1ce8e
MD5 7df292ce2b554a37352b7c2ff364db1d
BLAKE2b-256 c8e65add612ee0a1a18e821c377ea604357c86105aa3cc58c842033206939cce

See more details on using hashes here.

File details

Details for the file bin2elf-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: bin2elf-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for bin2elf-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 aeeb41f6111b3f9b362bee586b68d7227b388a47ace33191235613f93712db3f
MD5 b8b1a48a00985a519420c4f7082af02f
BLAKE2b-256 1da3f31e8b3f9710ea2fe93aa328c67a534827891cc4a27332f518ba87ee737f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page