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:
First I tried using
It generates the elf file, but
I decided to move on to the full qemu virtual machine and I loaded the binary using a generic loader, like so:
But it just gives a nondescript error message:
I did a
The arm binary is u-boot, which was collected from an old armv6 android tablet.
What i'm trying to do here is:
- load a raw binary into memory
- point to the first instruction
- execute the instruction
- report the state of the arm registers to GDB for printing
- point to the next instruction, and repeat.
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
root@kali:~# 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.root@kali:~# 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: