All, About qemu starting x86 executables: as Gedare said you will need some sort of loader to load the ELF into memory (load segments to the right place & jump into it at the right place).
Interestingly, qemu has a multiboot-compatible (see e.g. http://www.gnu.org/software/grub/manual/multiboot/multiboot.html) loader built-in which is very convenient. The reason it's so convenient is that you don't need to give it a real filesystem in order to run an executable. Patching in bootcode and a filesystem etc. is a bit messy from a Makefile or shellscript. This works very nicely for me, with working networking, invoked from a Makefile: qemu-system-i386 -redir tcp:$(LOCALPORT)::$(HTTPPORT) -netdev user,id=$(NETNAME) -device ne2k_isa,irq=$(IRQ),iobase=$(IOBASE),netdev=$(NETNAME) -serial stdio --no-reboot -kernel $(PGM) this redirects localhost:$(LOCALPORT) to the $(HTTPPORT) on the quest (tcp connections otherwise can't be made inwards with default qemu NAT networking), NETNAME is just something arbitrary ('mynet0') to connect the NIC and the VLAN, IRQ and IOBASE are defined in the Makefile (9 and 0x280) so that I can force the RTEMS driver to use those values too and define them in one place, and PGM is the RTEMS .exe executable. It's the -kernel option that (somewhat magically) invokes the internal qemu bootloader that loads the executable from the host system. Good luck! On Tue, Dec 23, 2014 at 7:53 PM, Dominik Táborský <bre...@seznam.cz> wrote: > Hello, > >> I am sorry for the subject line, but I am so confused right now I couldn't >> think of with a better one. > Not anymore. Do you know how when you want to ask a perfect question, you > find the answer yourself? > > Below is an excerpt from the make log. First line is obviously an invocation > of the compiler to compile just the init.c file from the hello world sample. > The last line links the executable. Where does the rest of RTEMS come in? Is > it in the "-qrtems" option? I coudln't find anything about "-q" option in the > gcc man page. So do you actually patch GCC sources before building your own > special RTEMS compiler toolkit? > > > i386-rtems4.11-gcc -B../../../../../pc386/lib/ -specs bsp_specs -qrtems > -DHAVE_CONFIG_H -I. > -I../../../../../../../rtems/c/src/../../testsuites/samples/hello -I.. > -mtune=i386 -O2 -g -Wall -Wmissing-prototypes -Wimplicit-function-declaration > -Wstrict-prototypes -Wnested-externs -MT init.o -MD -MP -MF .deps/init.Tpo -c > -o init.o > ../../../../../../../rtems/c/src/../../testsuites/samples/hello/init.c > > mv -f .deps/init.Tpo .deps/init.Po > > i386-rtems4.11-gcc -B../../../../../pc386/lib/ -specs bsp_specs -qrtems > -mtune=i386 -O2 -g -Wall -Wmissing-prototypes -Wimplicit-function-declaration > -Wstrict-prototypes -Wnested-externs -Wl,-Ttext,0x00100000 -mtune=i386 > -o hello.exe init.o > > Just to make sure then: RTEMS and the target application are compiled into > one executable that just runs indefinitely. Correct? > > While I'm at it, I have trouble using Qemu. This might deserve a thread on > its own, but have you recently tested it? Running executables in sparc > simulator using GDB works fine, running qemu-system-* also seems ok, but > running qemu-i386 on x86 binaries or qemu-sparc with sparc executables gives > me just "/path/to/exe: Invalid argument" error, nothing else. > > And lastly, I get 404 when accessing Joel's pronounciation of "RTEMS". 4th > question the FAQ: https://devel.rtems.org/wiki/TBR/Website/FAQ. > > > Merry Christmas. > > Dominik > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel