let's say I have a file full of ARM processor instructions which are already represented as bytes. What is the best way to execute them directly with qemu-arm?
Thanks!
If your data is a bootable image, qemu can be started directly with the image file:
qemu-system-arm -hda data.img
where data.img is the name of your binary file.
Otherwise, as Peter Cordes wrote, the easiest way would be to create an ELF executable (see How to run a bare metal ELF file on QEMU?) and start it via
qemu-system-arm -kernel data.elf
where data.elf is the name of the created ELF executable.
(too long for a comment, so I posted it as an answer)
Related
I have builded the U-boot for minnowboard max. I am seeing the files like uboot.rom uboot.bin etc.
what is the difference between uboot.rom and uboot.bin ? Which files I should flash to SPI NOR flash.
This is explained in doc/README.x86. In short, if you are going to be writing U-Boot to SPI NOR then you need to ensure that you have the correct binary blobs in the correct locations AND use BUILD_ROM=y so that u-boot.rom is generated as this is the file that is required on x86 to run on bare metal (rather than say as a coreboot payload).
Edit to address the comment:
The file 'u-boot' is the ELF object that is the result of building all of the U-Boot sources and linking them. This includes all of the extra sections and information an ELF file can contain. This is also by and large not bootable. The u-boot.bin file is the ELF u-boot but passed via objcopy to strip out (by and large, see the Makefile for the various flags or build with V=1) everything except for text/data sections so that we have only what is required to boot. Then u-boot.rom is the combination of objects and formatting that the x86 architecture requires in order to execute and run an image. Building with V=1 will show all of the details here.
I couldn't find any answer for this question from stackoverflow.com yet.
% uname -a
HP-UX rx3600 B.11.31 U ia64 2782985371
In linux, I can get the filename from core dump file as below.
"gserver" is the executable binary filename I'm looking for here.
% file ./core.4837
./core.4837: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from 'gserver --shared 1 --msgqkey=22581'
But, I got a different output of "file" command in HPUX, which has no executable filename matching the core.
% file ./core.10496
./core.10496: ELF 64-bit MSB core file IA-64, version 1 (HP-UX)
Is there any way to get it?
#anorm
Thanks.
Here is my output of pldd command.
% pldd ./core.10496
error obtaining loadmap address from gmaster
file may not be a shared IPF executable
Maybe I can get a hint from here.
"gmaster" is my executable binary filename.
I wanted to read the architecture information about object(.so) files example x86, x86_64, armeabi, armeabi-v7a, mips etc from the file and display these information. I know I can use "file" or other Linux commands to get this info, But I wanted to use the kernel structure to get above values.
I went through the ELF header file but not getting much help.
Can someone please suggest how to proceed for this?
A elf binary contains a elf-header at the beginning of the file. You can read this header by any elf-reader program, and here I will give you the example for readelf
readelf -h <binaryFile>
For more information, you could read the ELF Format Specification to learn about how elf binaries are loaded & executed.
I need to do some Trace32 debugging and i need to see the symbols of the IFS image.
I generate the IFS image for my ARM A9 platform but dont know how to generate the ELF file.
can somebody help me out ?
thanks.
IFS is a file system with many binaries and scripts. For trace32, when you try to debug any process (including procnto), you'd need the symbols of that process of interest. There is not such thing as ELF for IFS. It's like asking for the ELF of your harddisk.
Use dumpifs. Example:
dumpifs shell.ifs
check this
the -x option can extract the files specified after the image.
Using readelf we can separate the data part from elf file(using shell)Is it possible to do the same with a C program?
Use can use libelf for this purpose.
http://mdsp.googlecode.com/files/libelf-by-example-20100112.pdf
readelf itself is program written in C. So the answer is yes.
If you are on a debian-like linux distribution, you can probably get the source of readelf by typing apt-get source binutils and see how it is done.