Changes between Version 26 and Version 27 of Developer/Simulators/QEMU


Ignore:
Timestamp:
Jun 10, 2009, 7:06:33 AM (10 years ago)
Author:
Roxana
Comment:

/* Making a Boot Floppy Disk */

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Simulators/QEMU

    v26 v27  
    2727
    2828
    29 We run RTEMS in QEMU by first booting from a floppy disk image containing the GRUB boot loader. You can use the image we have made by downloading it from the RTEMS ftp server. The following instructions built the image and were run on a Fedora Core 5 Linux host.
    30 
    31 Download the latest release of version 2 the [http://grub.enbug.org/FrontPage Grub boot loader] from ftp://alpha.gnu.org/gnu/grub/. Build the package with the following configure command:
    32 
    33   $ ../grub-1.94/configure --prefix=/tmp/g2/build
    34   $ make all install
    35 
    36 where the prefix can be anything suitable for your machine. If configure fails with a missing LZO library check you have the lzo-devel package installed.
    37 
    38 To make the floppy image follow the instructions in the Grub Wiki at http://grub.enbug.org/TestingOnX86. This script is adapted from the instructions:
    39 
    40  #! /bin/sh -x
    41  grub=/tmp/g2/build
    42  workspace=/tmp/g2
    43  mnt=$workspace/mnt/loop
    44  file=$workspace/rtems-boot.img
    45  export PATH=$grub/bin:$grub/sbin:$PATH
    46  mkdir -p $workspace
    47  cd $workspace
    48  grub-mkimage -o core.img _chain ls pc multiboot gpt fat boot reboot configfile cat help
    49  dd if=/dev/zero of=$file bs=512 count=2880
    50  /sbin/mkdosfs $file
    51  mkdir -p $mnt
    52  mount -o loop -t vfat $file $mnt
    53  mkdir -p $mnt/boot/grub
    54  cp $grub/lib/grub/i386-pc/boot.img core.img $grub/lib/grub/i386-pc/*.mod $mnt/boot/grub
    55  echo "configfile (hd0,0)/rtems-grub.cfg" > $mnt/boot/grub/grub.cfg
    56  echo '(fd0)' $file > tmp_device.map
    57  grub-setup -d $mnt/boot/grub -r '(fd0)' -m tmp_device.map '(fd0)'
    58  rm -f tmp_device.map
    59  umount $mnt
    60 
    61 The default '''grub.cfg''' file will attempt to read a GRUB configuration file called '''[http://www.rtems.org/ftp/pub/rtems/qemu/i386-pc/rtems-grub.cfg rtems-grub.cfg]''' from the root directory of the harddisk. This lets you create a specific GRUB configuration for you testing without needing to rebuild the floppy image. An example configuration that lets you run the RTEMS Samples is:
    62 
    63  # RTEMS Grub configuration for the Samples
    64  
    65  set default=0
    66  
    67  menuentry "RTEMS - Hello" {
    68   set root=(hd0,0)
    69   multiboot (hd0,0)/hello/hello.exe
    70  }
    71  
    72  menuentry "RTEMS - Ticker" {
    73   set root=(hd0,0)
    74   multiboot (hd0,0)/ticker/ticker.exe
    75  }
    76  
    77  menuentry "RTEMS - Minimum" {
    78   set root=(hd0,0)
    79   multiboot (hd0,0)/minimum/minimum.exe
    80  }
    81  
    82  menuentry "RTEMS - Paranoia" {
    83   set root=(hd0,0)
    84   multiboot (hd0,0)/paranoia/paranoia.exe
    85  }
    86  
    87  menuentry "RTEMS - File IO" {
    88   set root=(hd0,0)
    89   multiboot (hd0,0)/fileio/fileio.exe
    90  }
    91  
    92  menuentry "RTEMS - Unlimited" {
    93   set root=(hd0,0)
    94   multiboot (hd0,0)/unlimited/unlimited.exe
    95  }
    96  
    97  menuentry "RTEMS - Loopback" {
    98   set root=(hd0,0)
    99   multiboot (hd0,0)/loopback/loopback.exe
    100  }
    101  
    102  menuentry "RTEMS - PPPD" {
    103   set root=(hd0,0)
    104   multiboot (hd0,0)/pppd/pppd.exe
    105  }
    106  
    107  menuentry "RTEMS - Base Mulitprocessor" {
    108   set root=(hd0,0)
    109   multiboot (hd0,0)/base_mp/base_mp.exe
    110  }
    111  
    112  menuentry "RTEMS - Base Single Processor" {
    113   set root=(hd0,0)
    114   multiboot (hd0,0)/base_sp/base_sp.exe
    115  }
    116  
    117  menuentry "RTEMS - C++ Static Constructors" {
    118   set root=(hd0,0)
    119   multiboot (hd0,0)/cdtest/cdtest.exe
    120  }
    121  
    122  menuentry "RTEMS - C++ IO Streams" {
    123   set root=(hd0,0)
    124   multiboot (hd0,0)/iostream/iostream.exe
    125  }
    126 
    127 (Note: I ''think'' that all references to (hd0,0) in the script and configuration file above should be changed to (hd0,1).  The GRUB partition numbering scheme used in the latest versions of GRUB now start partition numbering at 1 instead of 0.)
     29We run RTEMS in QEMU by first booting from a floppy disk image containing the GRUB boot loader. You can use the image we have made by downloading it from the RTEMS ftp server.
     30
     31You can use the [http://www.rtems.org/ftp/pub/rtems/people/chrisj/grub/rtems-boot.img image] we have made by downloading it from the RTEMS ftp server. The script builds the floppy disk, the grub source as per GPL, and the boot image.
     32
     33Now we need to setup some disk drivers for Qemu:
     34{{{$ dd if=/dev/zero of=hda.img count=1000
     35$ ls -las had.img
     36}}}
     37
     38The first creates a disk and second shows you the details of the disk you just created.
     39
     40The default '''grub.cfg''' file will attempt to read a GRUB configuration file called '''[http://www.rtems.org/ftp/pub/rtems/qemu/i386-pc/rtems-grub.cfg rtems-grub.cfg]''' from the root directory of the harddisk. This lets you create a specific GRUB configuration for you testing without needing to rebuild the floppy image.
     41An example configuration that lets you run the RTEMS Samples is:
     42
     43{{{# RTEMS Grub configuration for the Samples
     44
     45set default=0
     46
     47menuentry "RTEMS - Hello" {
     48 set root=(hd1,1)
     49 multiboot (hd1,1)/hello/hello.exe
     50}
     51
     52menuentry "RTEMS - Ticker" {
     53 set root=(hd1,1)
     54 multiboot (hd1,1)/ticker/ticker.exe
     55}
     56
     57menuentry "RTEMS - Minimum" {
     58 set root=(hd1,1)
     59 multiboot (hd1,1)/minimum/minimum.exe
     60}
     61
     62menuentry "RTEMS - Paranoia" {
     63 set root=(hd1,1)
     64 multiboot (hd1,1)/paranoia/paranoia.exe
     65}
     66
     67menuentry "RTEMS - File IO" {
     68 set root=(hd1,1)
     69 multiboot (hd1,1)/fileio/fileio.exe
     70}
     71
     72menuentry "RTEMS - Unlimited" {
     73 set root=(hd1,1)
     74 multiboot (hd1,1)/unlimited/unlimited.exe
     75}
     76
     77menuentry "RTEMS - Loopback" {
     78 set root=(hd1,1)
     79 multiboot (hd1,1)/loopback/loopback.exe
     80}
     81
     82menuentry "RTEMS - PPPD" {
     83 set root=(hd1,1)
     84 multiboot (hd1,1)/pppd/pppd.exe
     85}
     86
     87menuentry "RTEMS - Base Mulitprocessor" {
     88 set root=(hd1,1)
     89 multiboot (hd1,1)/base_mp/base_mp.exe
     90}
     91
     92menuentry "RTEMS - Base Single Processor" {
     93 set root=(hd1,1)
     94 multiboot (hd1,1)/base_sp/base_sp.exe
     95}
     96
     97menuentry "RTEMS - C++ Static Constructors" {
     98 set root=(hd1,1)
     99 multiboot (hd1,1)/cdtest/cdtest.exe
     100}
     101
     102menuentry "RTEMS - C++ IO Streams" {
     103 set root=(hd1,1)
     104 multiboot (hd1,1)/iostream/iostream.exe
     105}
     106}}}
     107
     108To start Qemu 0.9.1 you have to use this script:
     109{{{$ qemu -m 128 -boot a -fda <path to rtems-boot.img> -hda <path to hda.img> -hdb fat:. -serial stdio -no-reboot -s }}}
     110
     111List of the options explained:
     112
     113 '''-m 128''' sets the memory size to 128M
     114 '''-boot a''' boot from the floppy disk a (best option)
     115 '''-fda <path to rtems-boot.img>''' defines the second best floppy disk image
     116 '''-hda <path to hda.img>''' defines the first hard disk image
     117 '''-hdb fat:.''' says hdb is fat disk and . is the directory to make the root of that disk and '''-hdb''' is the mapping to the local disk so we can read the RTEMS executable into memory
     118 '''-serial stdio''' directs the serial port to the stdio of qemu
     119 '''-no-reboot''' tells Qemu to not reboot if the code running wants to. Stops an error looping over and over.
     120 '''-s''' tells Qemu to start a GDB server
    128121= Running Other Images =
    129122