<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 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 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 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>