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.0.tar.gz (10.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.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bin2elf-0.1.0.tar.gz
  • Upload date:
  • Size: 10.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.0.tar.gz
Algorithm Hash digest
SHA256 e96772292d1e3dd550955d3098c00a5b3a51b8ef73fd2a4a8bf80694b9b8f427
MD5 d8ab588fd88409a5c6c27fa826e12776
BLAKE2b-256 d7d2f09aeb9939d7b909c83f769f48945798c8abe2f88d891251dfc61f4c2f24

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bin2elf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 561ec8f971916f3d98a2c55ad65078cef6e6a774634a98e8f7b88ad7e70b9410
MD5 f1f76af1cb487dfc90176bbfff56cc7d
BLAKE2b-256 de5d6fe19d32b5284517cb6eb0cf2f099792cd1aee927fe8e721ee0fcc80f82d

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