Problems with building i386 simulation environment based on Grub and QEMU
Yin Yan
yinyan at buffalo.edu
Fri Jan 31 00:49:36 UTC 2014
Hi Guys,
My goal is running the rtems-4.10 application on the Intel Galileo board.
Before that, I want to build an i386 simulation environment based on Grub
and QEMU.
I found the wiki page for it from
http://www.rtems.org/wiki/index.php/Building_Grub
Unfortunately, The scripts provided from the wiki don't work on my
Ubuntu12.04.03.
I did the modification for the permission issues, however I am still
getting the following error:
For floppy image:
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..
grub-setup: error: will not proceed with blocklists.
For hard-disk image:
/home/gassa/research/grub/src/grub/grub-bios-setup: error: disk
`hostdisk//dev/loop4' not found.
I have found a pre-build floppy disk image from FTP site, but I still need
the hard-disk image.
Does anyone build the hard-disk image? Please provide me some hints.
The grub I am using is from Grub git repo: git clone git://
git.savannah.gnu.org/grub.git
Thank a lot.
Yin Yan
==================below is the script I am
using===============================
#!/bin/bash
set -e
image="rtems-boot.img"
# Hack to make everything owned by the original user.
user=`whoami | awk '{print $1}'`
echo $user
group=`groups $user | awk '{print $3}'`
echo $group
# Create the actual disk image - 15MB
dd if=/dev/zero of=${image} bs=512 count=32130
chown ${user}:${group} ${image}
# Setup the loopback device, and reture the devie name.
lodev=`sudo losetup -f --show ${image}`
#/dev/loop5
trap 'sudo losetup -d ${lodev}; exit $?' INT TERM EXIT
loname=${lodev##*/}
#/loop5
# Make the partition table, partition and set it bootable.
sudo parted -a min -s ${lodev} mklabel msdos mkpart primary ext2 1M 100% \
set 1 boot on
# Get the start sectors.
start=`sudo fdisk -lu ${lodev} | grep "${loname}p1" | awk '{ print $3}'`
# Find the first unused loop device.
lonxt=`sudo losetup -f`
#/dev/loop6
# Create a loop device for this partition, like /dev/sda and /dev/sda0 work.
sudo losetup -o $(expr 512 \* ${start}) ${lonxt} ${lodev}
# Make an ext2 filesystem on the first partition.
sudo mkfs.ext2 ${lonxt}
# Mount the filesystem via loopback.
sudo mount ${lonxt} /mnt
trap 'sudo umount /mnt; sudo losetup -d ${lonxt}; sudo losetup -d ${lodev};
exit $?' INT TERM EXIT
sudo mkdir -p /mnt/boot/grub
sudo touch /mnt/boot/grub/grub.cfg
sudo chmod 777 /mnt/boot/grub/grub.cfg
echo 'source (hd1,msdos1)/grub.cfg'>/mnt/boot/grub/grub.cfg
sudo mkdir -p /mnt/boot/grub/i386-pc
sudo cp /home/gassa/research/grub/build/lib/grub/i386-pc/*
/mnt/boot/grub/i386-pc/
sudo rm /mnt/boot/grub/i386-pc/*.module
# Make a bootable image of GRUB.
grub-mkimage -d /home/gassa/research/grub/build/lib/grub/i386-pc -O i386-pc
--output=core.img \
--prefix=\(,msdos1\)/boot/grub ext2 part_msdos biosdisk
search_fs_uuid
sudo cp core.img /mnt/boot/grub/i386-pc
# Set up a device to boot using GRUB.
/home/gassa/research/grub/src/grub/grub-bios-setup --allow-floppy --force
--directory=/mnt/boot/grub/i386-pc --device-map= ${lodev}
sync
trap - INT TERM EXIT
umount /mnt
sudo losetup -d ${lonxt}
sudo losetup -d ${lodev}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20140130/7e181a3b/attachment.html>
More information about the users
mailing list