<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hello Yin,<br>
      <br>
      On 01/31/14 00:49, Yin Yan wrote:<br>
    </div>
    <blockquote
cite="mid:CAAayhskXtUQfhXhb+29u1+Ck-VSn_Hded3o04+ykizX8=RKUdw@mail.gmail.com"
      type="cite">
      <div dir="ltr"><span
          style="font-family:arial,sans-serif;font-size:14px">Hi Guys,</span>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">My goal
          is running the rtems-4.10 application on the Intel Galileo
          board.</div>
        <div style="font-family:arial,sans-serif;font-size:14px">Before
          that, I want to build an i386 simulation environment based on
          Grub and QEMU.</div>
        <div style="font-family:arial,sans-serif;font-size:14px">I found
          the wiki page for it from <a moz-do-not-send="true"
            href="http://www.rtems.org/wiki/index.php/Building_Grub"
            target="_blank">http://www.rtems.org/wiki/index.php/Building_Grub</a></div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">Unfortunately,
          The scripts provided from the wiki don't work on my
          Ubuntu12.04.03.</div>
        <div style="font-family:arial,sans-serif;font-size:14px">
          <br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">I did
          the modification for the permission issues, however I am still
          getting the following error:</div>
        <div style="font-family:arial,sans-serif;font-size:14px">
          For <span
style="line-height:19.200000762939453px;font-size:13px;font-family:sans-serif">floppy
            image:</span></div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">
          <div>grub-setup: warning: Embedding is not possible. GRUB can
            only be installed in this setup by using blocklists.
            However, blocklistst are UNRELIABLE and their use is
            discouraged..</div>
          <div>grub-setup: error: will not proceed with blocklists.</div>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">For
          hard-disk image:</div>
        <div style="font-family:arial,sans-serif;font-size:14px">/home/gassa/research/grub/src/grub/grub-bios-setup:
          error: disk `hostdisk//dev/loop4' not found.</div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">I have
          found a pre-build floppy disk image from FTP site, but I still
          need the hard-disk image.</div>
        <div style="font-family:arial,sans-serif;font-size:14px">
          <br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">Does
          anyone build the hard-disk image? Please provide me some
          hints. </div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
      </div>
    </blockquote>
    <br>
    You can create an hard-disk image with<br>
    <br>
    <br>
    dd if=/dev/zero of=hda.img count=1000 (512kB)<br>
    <br>
    mkfs.vfat hda.img<br>
    <br>
    <br>
    And load it with the grub.conf, if you didn't change the floppy (by
    default the floppy looks for the grub.conf on the hard disk)<br>
    To open programs the easier is to put them in a folder on your
    computer and with qemu call a second "hard disk" with <br>
    <br>
    -hdb fat:<program directory> (around 500MB limit on that
    directory for it to load, I think)<br>
    <br>
    <a class="moz-txt-link-freetext" href="http://www.rtems.org/wiki/index.php/QEMU#Making_a_Boot_Floppy_Disk">http://www.rtems.org/wiki/index.php/QEMU#Making_a_Boot_Floppy_Disk</a><br>
    <br>
    You may also try ignoring grub, if you just want to run the
    programs:<br>
    <br>
    <br>
    qemu-system-i386 -no-reboot -kernel <program>.exe<br>
    <br>
    <br>
    Which I think is an easier aproach than changing the grub.conf
    everytime.<br>
    <br>
    There is also an pc386 script (rtems-testing/sim-scripts/pc386) that
    you can use to run programs.<br>
    <br>
    <blockquote
cite="mid:CAAayhskXtUQfhXhb+29u1+Ck-VSn_Hded3o04+ykizX8=RKUdw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div style="font-family:arial,sans-serif;font-size:14px">
          The grub I am using is from Grub git repo: <span
            style="color:rgb(48,48,48);line-height:19.45599937438965px">git
            clone git://<a moz-do-not-send="true"
              href="http://git.savannah.gnu.org/grub.git"
              target="_blank">git.savannah.gnu.org/grub.git</a></span></div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">Thank a
          lot.</div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">
          Yin Yan</div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px"><br>
        </div>
        <div style="font-family:arial,sans-serif;font-size:14px">
          ==================below is the script I am
          using===============================</div>
        <div style="font-family:arial,sans-serif;font-size:14px">
          <div>#!/bin/bash</div>
          <div>set -e</div>
          <div><br>
          </div>
          <div>image="rtems-boot.img"</div>
          <div># Hack to make everything owned by the original user.</div>
          <div>user=`whoami | awk '{print $1}'`</div>
          <div>echo $user</div>
          <div>group=`groups $user | awk '{print $3}'`</div>
          <div>echo $group</div>
          <div>
            <br>
          </div>
          <div># Create the actual disk image - 15MB</div>
          <div>dd if=/dev/zero of=${image} bs=512 count=32130</div>
          <div><br>
          </div>
          <div>chown ${user}:${group} ${image}</div>
          <div><br>
          </div>
          <div># Setup the loopback device, and reture the devie name.</div>
          <div>lodev=`sudo losetup -f --show ${image}`</div>
          <div>#/dev/loop5</div>
          <div><br>
          </div>
          <div>trap 'sudo losetup -d ${lodev}; exit $?' INT TERM EXIT</div>
          <div><br>
          </div>
          <div>loname=${lodev##*/}</div>
          <div>#/loop5</div>
          <div><br>
          </div>
          <div># Make the partition table, partition and set it
            bootable.</div>
          <div>sudo parted -a min -s ${lodev} mklabel msdos mkpart
            primary ext2 1M 100% \</div>
          <div>    set 1 boot on </div>
          <div><br>
          </div>
          <div># Get the start sectors.</div>
          <div>start=`sudo fdisk -lu ${lodev} | grep "${loname}p1" | awk
            '{ print $3}'`</div>
          <div># Find the first unused loop device.</div>
          <div>lonxt=`sudo losetup -f`</div>
          <div>#/dev/loop6</div>
          <div><br>
          </div>
          <div>
            <br>
          </div>
          <div># Create a loop device for this partition, like /dev/sda
            and /dev/sda0 work.</div>
          <div>sudo losetup -o $(expr 512 \* ${start}) ${lonxt} ${lodev}</div>
          <div><br>
          </div>
          <div># Make an ext2 filesystem on the first partition.</div>
          <div>sudo mkfs.ext2 ${lonxt}</div>
          <div># Mount the filesystem via loopback.</div>
          <div>sudo mount ${lonxt} /mnt</div>
          <div>trap 'sudo umount /mnt; sudo losetup -d ${lonxt}; sudo
            losetup -d ${lodev}; exit $?' INT TERM EXIT</div>
          <div>sudo mkdir -p /mnt/boot/grub</div>
          <div>sudo touch /mnt/boot/grub/grub.cfg</div>
          <div>sudo chmod 777 /mnt/boot/grub/grub.cfg</div>
          <div>echo 'source
            (hd1,msdos1)/grub.cfg'>/mnt/boot/grub/grub.cfg</div>
          <div><br>
          </div>
          <div>sudo mkdir -p /mnt/boot/grub/i386-pc</div>
          <div>sudo cp
            /home/gassa/research/grub/build/lib/grub/i386-pc/*
            /mnt/boot/grub/i386-pc/</div>
          <div>sudo rm /mnt/boot/grub/i386-pc/*.module</div>
          <div><br>
          </div>
          <div># Make a bootable image of GRUB.</div>
          <div>grub-mkimage -d
            /home/gassa/research/grub/build/lib/grub/i386-pc -O i386-pc
            --output=core.img \</div>
          <div>        --prefix=\(,msdos1\)/boot/grub ext2 part_msdos
            biosdisk search_fs_uuid</div>
          <div>sudo cp core.img /mnt/boot/grub/i386-pc</div>
          <div># Set up a device to boot using GRUB.</div>
          <div>/home/gassa/research/grub/src/grub/grub-bios-setup
            --allow-floppy  --force --directory=/mnt/boot/grub/i386-pc
            --device-map= ${lodev}</div>
          <div><br>
          </div>
          <div>sync</div>
          <div>trap - INT TERM EXIT</div>
          <div>umount /mnt</div>
          <div>sudo losetup -d ${lonxt}</div>
          <div>sudo losetup -d ${lodev}</div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
rtems-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a>
<a class="moz-txt-link-freetext" href="http://www.rtems.org/mailman/listinfo/rtems-users">http://www.rtems.org/mailman/listinfo/rtems-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>