Get the output of a program in a file using QEmu
Reng Zeng
alan at fiucssa.org
Wed Jun 25 17:41:20 UTC 2008
I remaked all RTEMS code by 'make clean', '../rtems/configure
USE_COM1_AS_CONSOLE=1 BSP_PRESS_KEY_FOR_RESET=0 --target=i386-rtems4.9
--enable-rtemsbsp=pc586 --disable-posix --disable-itron
--enable-tests=samples',
'make', 'make install'.
This 'hello' sample works well for me, in graphical mode:
qemu -serial stdio -boot a -m 128 -fda '/home/zengreng/rtems-boot.img' -hda
'fat:/home/zengreng/pc586/i386-rtems4.9/c/pc586/testsuites/samples/hello'
--no-reboot
But with -nographic , it does not work, simply suspending there, no output.
qemu -nographic -serial stdio -boot a -m 128 -fda
'/home/zengreng/rtems-boot.img' -hda
'fat:/home/zengreng/pc586/i386-rtems4.9/c/pc586/testsuites/samples/hello'
--no-reboot
My QEMU version is 0.9.1 as well.
QEMU PC emulator version 0.9.1, Copyright (c) 2003-2008 Fabrice Bellard
Your command line work well for me, but it is still graphic mode, I can not
log the output.
qemu -boot n -m 128 -tftp
/home/zengreng/pc586/i386-rtems4.9/c/pc586/testsuites/samples/hello/ -bootp
/hello.exe -no-reboot -serial stdio
And when I run it with -nographic, no any output again.... :(
/usr/bin/qemu -boot n -m 128 -tftp
/home/zengreng/pc586/i386-rtems4.9/c/pc586/testsuites/samples/hello/ -bootp
/hello.exe -no-reboot -serial stdio -nographic
I would appreciate if any more clues for me to figure out the cause.
Thanks,
Alan
2008/6/25 Daron Chabot <daron.chabot at usask.ca>:
> What version of Qemu are you using ?
>
> To narrow down the problem, try using one of the sample/test programs
> in /opt/rtems-4.9/i386-rtems4.9/pc586/lib/rtems-4.9/tests (eg: hello.exe).
> The command line I use with Qemu 0.9.1 is:
>
> qemu -no-reboot -m 128 -boot n -tftp
> /opt/rtems/i386-rtems/pc386/lib/rtems-4.9/tests -bootp /hello.exe -serial
> stdio
>
>
> -- dc
>
>
>
> On 25-Jun-08, at 11:11 AM, Reng Zeng wrote:
>
> It does not work as well with '-serial stdio',
>
> btw, I also 'make clean' 'make' my program. And, when I make , it seems do
> not have any "USE_COM1_AS_CONSOLE" in it, is that the problem?
>
> i386-rtems4.9-gcc --pipe -B/opt/rtems-4.9/i386-rtems4.9/pc586/lib/ -specs
> bsp_specs -qrtems -g -Wall -O2 -g -g -mtune=pentium -c -o
> o-optimize/init.o init.c
>
> Thanks,
> Alan
>
> 2008/6/25 Joel Sherrill <joel.sherrill at oarcorp.com>:
>
>> Reng Zeng wrote:
>>
>>> Hi Joel,
>>>
>>> Thanks for your tips, I tried it as steps below, it still does not work.
>>>
>>> 1. ../rtems/configure USE_COM1_AS_CONSOLE=1 BSP_PRESS_KEY_FOR_RESET=0
>>> --target=i386-rtems4.9 --enable-rtemsbsp=pc586 --disable-posix
>>> --disable-itron --enable-tests=samples
>>> 2. make clean
>>> 3. make
>>> 4. make install
>>>
>>> Then I run it my qemu:
>>>
>>> /usr/bin/qemu -monitor null -nographic -serial file:qemu.log -boot a -m
>>> 128 -fda '/home/zengreng/rtems-boot.img' -hda
>>> 'fat:/home/zengreng/workspace/rtems_tools/src/generated/' --no-reboot
>>>
>>> Try -serial stdio and see if that works. Maybe file: doesn't work. I
>> have never used it.
>>
>>> The program to run is managed by Makefile I drafted, not automake, I
>>> attached it to see whether that is the cause things do not work, shall I add
>>> something like "USE_COM1_AS_CONSOLE" into it as well?
>>>
>>> There was no program attached but any of the samples should just work
>> that way.
>>
>>>
>>> Thanks again,
>>> Alan
>>>
>>> 2008/6/25 Joel Sherrill <joel.sherrill at oarcorp.com <mailto:
>>> joel.sherrill at oarcorp.com>>:
>>>
>>>
>>> Reng Zeng wrote:
>>>
>>> Hello,
>>>
>>> It do NOT work for me, I add "#define USE_COM1_AS_CONSOLE 1 "
>>> into my init.c, and run qemu by
>>> qemu -nographic -serial file:output.txt -boot a -m 128
>>> -fda myimage.img -hda fat:.
>>>
>>> No. That's not going to work. You have to configure with that
>>> set on the configure
>>> comment line.
>>>
>>> ..../configure ... USE_COM1_AS_CONSOLE=1 BSP_PRESS_KEY_FOR_RESET=0
>>>
>>> The BSP_PRESS_KEY_FOR_RESET=0 configures the BSP to not wait for a key
>>> press before resetting. Just add --no-reboot to your qemu
>>> command line and
>>> it will "power down" which is exiting. :-D
>>>
>>> I did not get anything from output.txt. It run well in graphic
>>> mode, but I want the output from the program.
>>>
>>> I would appreciate if you could shed me some light on my mind :)
>>>
>>> This is a fragement from the shell script I use.
>>>
>>> QEMU="/usr/local/bin/qemu -cpu 486"
>>>
>>> runit()
>>> {
>>> ARGS="-m 8 -boot a -fda ${fd0Image} -hda fat:${hd0Dir} \
>>> -monitor null -nographic -serial stdio --no-reboot"
>>>
>>> ${QEMU} ${ARGS} >${logfile} 2>&1 &
>>> }
>>>
>>>
>>> Thanks,
>>> Alan
>>>
>>> 2008/3/21 Jean-Claude Grange <lebauce at free.fr
>>> <mailto:lebauce at free.fr> <mailto:lebauce at free.fr
>>>
>>> <mailto:lebauce at free.fr>>>:
>>>
>>>
>>> Hello,
>>>
>>> Thank you all for answers. USE_COM1_AS_CONSOLE =1 worked
>>> just fine.
>>> I'm really interested in your patch, Joel. Are you going to
>>> commit it
>>> soon ? Or would you mind sending your patch to me so that I can
>>> test it.
>>>
>>> Thanks
>>> See you
>>>
>>>
>>> Le 17 mars 08 à 19:47, Joel Sherrill a écrit :
>>>
>>> > Jean-Claude Grange wrote:
>>> >> Hello,
>>> >>
>>> >> Thanks for your answer. I'll try that.
>>> >> But I wonder if it's possible to do it without modifying the
>>> >> program ?
>>> >>
>>> >>
>>> > Define USE_COM1_AS_CONSOLE =1 on the RTEMS configure
>>> > command line and the console will move to the serial port.
>>> > This is how I run RTEMS and GCC tests in an automated
>>> > fashion.
>>> >
>>> > I discovered another nice qemu option --no-reboot which
>>> > exits when the simulated PC does a reset. This means you
>>> > get a single run of the application and then it exits. I
>>> have
>>> > a pending patch in my tree to make the BSP reset on
>>> > application exit or exception without waiting for a human
>>> > to press a character. This sped up the gcc test runs
>>> > by a large factor since they have >50K tests.
>>> >
>>> > --joel
>>> >> José Marinho <zemanel at gmail.com
>>> <mailto:zemanel at gmail.com> <mailto:zemanel at gmail.com
>>> <mailto:zemanel at gmail.com>>> wrote:
>>> >>
>>> >>
>>> >>> you can allways create a file, format it to a specific
>>> fylesystem
>>> >>> and pass
>>> >>> it to qemu as an hard drive, and tell the rtems program
>>> to create
>>> >>> and write
>>> >>> in a file in that hard drive. and then you can mount
>>> that file
>>> >>> with loop
>>> >>> device and access it and get the output file. that's
>>> the approach
>>> >>> that I'de
>>> >>> take. Hope that's usefull to you
>>> >>>
>>> >>> José Marinho
>>> >>>
>>> >>> On 16/03/2008, Jean-Claude Grange <lebauce at free.fr
>>> <mailto:lebauce at free.fr>
>>> <mailto:lebauce at free.fr <mailto:lebauce at free.fr>>> wrote:
>>> >>>
>>> >>>> Hello,
>>> >>>>
>>> >>>> I'm sorry if this is a stupid question but I've
>>> searched on the
>>> >>>> mailing
>>> >>>> list and
>>> >>>> didn't find an answer.
>>> >>>> I'm trying to get the output of a RTEMS program (for
>>> example the
>>> >>>> Hello
>>> >>>> from the
>>> >>>> samples testsuite) using QEmu, into a file. I'm using the
>>> >>>> command (on
>>> >>>> Linux) :
>>> >>>>
>>> >>>> qemu -nographic -serial file:output.txt -boot a -fda
>>> myimage.img
>>> >>>> -hda
>>> >>>> fat:.
>>> >>>>
>>> >>>> but I don't get anything in the 'output.txt' file. I
>>> also tried -
>>> >>>> serial
>>> >>>> /dev/ttyS* and with the -monitor stdio option but I
>>> still have
>>> >>>> nothing. I
>>> >>>> must
>>> >>>> be doing something wrong.
>>> >>>>
>>> >>>> I would really appreciate your help.
>>> >>>> Thank you
>>> >>>> _______________________________________________
>>> >>>> rtems-users mailing list
>>> >>>> rtems-users at rtems.com <mailto:rtems-users at rtems.com>
>>> <mailto:rtems-users at rtems.com <mailto:rtems-users at rtems.com>>
>>>
>>> >>>> http://rtems.rtems.org/mailman/listinfo/rtems-users
>>> >>>>
>>> >>>>
>>> >>>
>>> >>> --
>>> >>> <img> http://www.deec.uc.pt/common/img/deezoom.gif </img>
>>> >>>
>>> >>>
>>> >>
>>> >>
>>> >> _______________________________________________
>>> >> rtems-users mailing list
>>> >> rtems-users at rtems.com <mailto:rtems-users at rtems.com>
>>> <mailto:rtems-users at rtems.com <mailto:rtems-users at rtems.com>>
>>>
>>> >> http://rtems.rtems.org/mailman/listinfo/rtems-users
>>> >>
>>> >
>>> >
>>> > --
>>> > Joel Sherrill, Ph.D. Director of Research &
>>> Development
>>> > joel.sherrill at OARcorp.com On-Line Applications
>>> Research
>>> > Ask me about RTEMS: a free RTOS Huntsville AL 35805
>>> > Support Available (256) 722-9985
>>> >
>>> >
>>>
>>> _______________________________________________
>>> rtems-users mailing list
>>> rtems-users at rtems.com <mailto:rtems-users at rtems.com>
>>> <mailto:rtems-users at rtems.com <mailto:rtems-users at rtems.com>>
>>>
>>> http://rtems.rtems.org/mailman/listinfo/rtems-users
>>>
>>>
>>>
>>>
>>> -- Joel Sherrill, Ph.D. Director of Research &
>>> Development
>>> joel.sherrill at OARcorp.com On-Line Applications Research
>>> Ask me about RTEMS: a free RTOS Huntsville AL 35805
>>> Support Available (256) 722-9985
>>>
>>>
>>>
>>>
>>
>> --
>> Joel Sherrill, Ph.D. Director of Research & Development
>> joel.sherrill at OARcorp.com On-Line Applications Research
>> Ask me about RTEMS: a free RTOS Huntsville AL 35805
>> Support Available (256) 722-9985
>>
>>
>>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20080625/75c2a79d/attachment.html>
More information about the users
mailing list