This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: Linux synthetic target build errors


I think I have most of the pieces in place (grub, qemu, kqemu, etc).

What parameter do I need to pass to the shell script (runit.sh) when running it?

Thanks!
Aziz

On Sat, May 1, 2010 at 12:32 PM, Grant Edwards
<grant.b.edwards@gmail.com> wrote:
> On 2010-05-01, Aziz Bodal <azizbodal@gmail.com> wrote:
>
>> I am writing a paper for a Real-time OS class on comparing the
>> scheduling algorithms of two real-time operating systems. The RTOS
>> systems I am comparing are eCOS and FreeRTOS. I need to run a
>> multi-threaded application and compare some statistics.
>>
>> I am a newbie at this so please excuse my ignorance. I am looking for
>> a good emulator so that I can compare these two operating systems.
>
> Qemu works nicely for eCos.
>
> I found the easiest way to to it was to create a bootable CD ISO image
> and then tell Qemu to boot from that.
>
> Build your application using "grub" startup mode.
>
> Then you can use the shellscript below to run it. ?The script creates
> the bootable CD containing the grub bootloader and the eCos
> application specified on the commandline. ?Then it runs Qemu using
> that CD image.
>
> ------------------------------runit.sh------------------------------
> #!/bin/bash
> #set -x
>
> # a shell script to run in the Qemu PC emulator an eCos
> # application that's been built with "Grub" startup mode for the
> # pc_rltk8239 target.
> #
> # The program to be run is $1. ?It runs Qemu with the no-graphics
> # option and with a single serial port connected to a telnet
> # server socket.
> #
> # An instance of the "aterm" X11 terminal emulator is started with
> # telnet command to connect to that virtual serial port.
> #
> # TUN/TAP networking is used to create a point-to-point Ethernet link
> # to the virtual machine. ?The host end is 172.16.0.1, so you should
> # configure the eCos build to use a static 172.16.0.x network address.
> #
> # The script could be modified to bridge the virtual TAP interface
> # with a physcial interface if you want to make the virtual machine
> # accessible from other hosts. ?Or you could start a DHCP server on
> # the TAP interface so that you don't have to build apps with static
> # IP configurations.
>
> # set this to point to your grub el torito stage 2 file
> ElToritoStage2=/lib/grub/i386-pc/stage2_eltorito
>
> function StartQemu {
> ?# create a TAP interface belonging to the user
> ?User=$USER
> ?TAP=$(sudo /usr/bin/tunctl -b -u $User)
> ?sudo /sbin/ifconfig $TAP 172.16.0.1 promisc up
> ?# try to load the kqemu module to speed up emulation
> ?sudo /sbin/modprobe kqemu
> ?# start the emulator using the TAP interface we created above
> ?qemu -net nic,model=rtl8139 ?-net tap,ifname=$TAP,script=no -nographic $*
> ?# remove the TAP interface
> ?sudo /usr/bin/tunctl -d $TAP
> ?}
>
> test -f $ElToritoStage2 || { echo "grub el torito stage 2 file not found"; exit 1; }
>
> test -z "$TEMP" && TEMP=/tmp
>
> # create a bootable ISO image with Grub configured to load the program
>
> ProgPath="$1"
> Prog=$(basename "$ProgPath")
> Iso=$TEMP/grub-$$.iso
> Tree=$TEMP/grub-$$-tree
>
> # we want to end up with an ISO image with this structure:
> #
> # /
> # |-- boot
> # | ? `-- grub
> # | ? ? ? |-- menu.lst
> # | ? ? ? `-- stage2_eltorito
> # `-- eCosApplication
>
> # create the empty directry "tree" (only has the one branch)
> mkdir -p $Tree/boot/grub
>
> # copy Grub stage2 file
> cp $ElToritoStage2 $Tree/boot/grub
>
> # create Grub configuration file that loads program
> cat >$Tree/boot/grub/menu.lst <<EOF
> serial --unit=0 --speed=115200
> terminal --timeout=2 serial console
> default 0
> timeout 1
> title ?/$Prog
> kernel /$Prog
> EOF
>
> # application goes in "root" directory, and stripping it will
> # speed up loading
> cp $ProgPath $Tree
> strip $Tree/$Prog
>
> # create the bootable ISO9660 image
> mkisofs -quiet -R -b boot/grub/stage2_eltorito -no-emul-boot \
> ? -boot-load-size 4 -boot-info-table -o $Iso $Tree
>
> # done with the tree
> rm -rf $Tree
>
> # start a terminal that will telnet to the virtual machine's serial port
> (sleep 0.5; aterm -title "eCos Serial 0" -name "eCos Serial 0" -e telnet localhost 9876)&
>
> # start the emulator
> StartQemu -boot cdrom -cdrom $Iso -serial telnet:localhost:9876,server
>
> # clean up
> rm -rf $Iso
> --------------------------------------------------------------------
>
>
> --
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>
>

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]