• We did not send an email asking for donations - please read this post.

Can't load an arm binary with QEMU


New Member
Jun 19, 2019
Reaction score
I'm trying to single step a raw arm binary using QEMU connected to GDB. My distro is Kali linux 64-bit.
The arm binary is u-boot, which was collected from an old armv6 android tablet.

What i'm trying to do here is:
  1. load a raw binary into memory
  2. point to the first instruction
  3. execute the instruction
  4. report the state of the arm registers to GDB for printing
  5. point to the next instruction, and repeat.
Or basically, I want to do what this guy did. The difference is that he assembled an elf program with debugging symbols, I have just structureless raw bytes.

First I tried using qemu-arm included with the qemu-user package.
qemu-user requires an elf program, so I converted the binary into an elf using arm-none-eabi-objcopy

[email protected]:~# arm-none-eabi-objcopy --input-target=binary --output-target=elf32-little /home/u-boot.bin /home/u-boot.bin.elf

It generates the elf file, but qemu-arm will not accept it for some reason.

[email protected]:~# qemu-arm -cpu arm1176 -g 1234 -singlestep /home/u-boot.bin.elf
> /home/u-boot.bin.elf: Invalid ELF image for this architecture

I decided to move on to the full qemu virtual machine and I loaded the binary using a generic loader, like so:

qemu-system-arm -machine none -cpu arm1176 -s -singlestep -device loader,file=/home/u-boot.bin,addr=0,force-raw=on

But it just gives a nondescript error message:

qemu-system-arm: -device loader,file=/home/u-boot.bin,addr=0,force-raw=on: Cannot load specified image /home/u-boot.bin

I did a chmod 777 on the file, and tried to run as sudo, but it makes no difference. I also tried loading the previously created elf file, same result.
Last edited:
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online