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.5.tar.gz (9.8 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.5-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bin2elf-0.1.5.tar.gz
  • Upload date:
  • Size: 9.8 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.5.tar.gz
Algorithm Hash digest
SHA256 09ca16c335f86a7e3e902c8f16350757199ace73d9ed37e898d9763f9bdde055
MD5 aed71d6b4e42a26aa87a6733ef259f8f
BLAKE2b-256 f0967524734dbd88e7c0c4f1b6fb5011fce6a47cd1886e90d2d9fcee9261ef18

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bin2elf-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 581ed82c93cfbc49c11ed87532e3912ebbd79ea6f28b620dbc64e0795ecb8fee
MD5 3a81e28665af8077f63b17a69850ba44
BLAKE2b-256 33e98f2d5e2f2c67c1b94041f1ab1c5c52117e9d52188718df256b1d92716134

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