Grub QEMU
Tony Richardson
richardson.tony at gmail.com
Fri Mar 28 15:46:57 UTC 2008
I couldn't find the script Suraj was referring to but
here is a script that I used recently to create a Grub2 floppy
image on Linux. It uses the loopback device (I don't have a real
floppy drive). It is based on a script I found somewhere else.
Sorry for the lack of comments, but maybe it will help?
One neat trick with Grub - I have the menu file on the floppy image
load a second grub menu file from a Qemu hard drive "partition". (The
partition is really a directory on the host computer that I map
to a Qemu partition using the Qemu "-hdb fat:directory" option.)
I can then just drag-and-drop RTEMS executables to the same directory
containing the menu file. A script rebuilds the menu to include whatever
files are in the directory.
==========================================================================
#! /bin/sh -x
#First build GRUB from source under Linux. You may need to install
#the LSO compression library first.
#To install to the /home/xxx tree:
#./configure --prefix=/home/xxx
#After building grub you can build a boot floppy like this:
grub=/home/xxx
file=floppy.img
mnt=loop
grub-mkimage -d $grub/lib/grub/i386-pc -o core.img _chain ls pc multiboot \
gpt fat boot reboot configfile cat help
dd if=/dev/zero of=$file bs=1k count=1440
/sbin/mkdosfs $file
mkdir -p $mnt
mount -o loop -t vfat $file $mnt
mkdir -p $mnt/boot/grub
cp $grub/lib/grub/i386-pc/boot.img core.img \
$grub/lib/grub/i386-pc/*.mod $mnt/boot/grub
echo "configfile (hd0,1)/rtems-grub.cfg" > $mnt/boot/grub/grub.cfg
echo '(fd0)' $file > tmp_device.map
grub-setup -d $mnt/boot/grub -r '(fd0)' -m tmp_device.map '(fd0)'
rm -f tmp_device.map
umount $mnt
==========================================================================
Tony Richardson
> -----Original Message-----
> From: rtems-users-bounces at rtems.org
> [mailto:rtems-users-bounces at rtems.org] On Behalf Of Joel Sherrill
> Sent: Friday, March 28, 2008 7:57 AM
> To: surajkamal at quarkcybernetics.com; RTEMSUsers
> Subject: Re: Grub QEMU
>
> I don't think the script in the Wiki is from me.
> Besides I failed last time I tried to make a new grub boot floppy. :(
>
> Can someone give him a hand?
>
> Thanks.
>
> --joel
>
> surajkamal at quarkcybernetics.com wrote:
> > Hello Joel,
> >
> >
> > I am Suraj Kamal from Quark Cybernetics
> > and am trying to do some projects with RTEMS.
> > Also I am very new to RTEMS and Linux.
> > I just manged to install RTEMS binaries and
> > cross development tool set for PC386.
> > And 'make' "Hello World" example with success.
> > I have installed GRUB version 1.96.
> > My host PC is running on Fedora core 8 on
> x86_64 platform.
> > I have tried shell script for making a floppy image
> > provided by you, in the Wiki pages.
> > But it kicked out some errors....
> > cp: cannot stat `/tmp/g2/build/lib/grub/i386-pc/boot.img': No such
> > file or direc tory
> > cp: cannot stat `core.img': No such file or directory
> > cp: cannot stat `/tmp/g2/build/lib/grub/i386-pc/*.mod': No such file
> > or director y
> >
> > everything else are ok,
> > I tried booting QEMU, but resulted in a screen
> > Showing..
> > "Booting from hard disk...."
> > and no response after....
> >
> >
> > Could you please help me to get
> around the problem?
> >
> > Regards,
> >
> Suraj Kamal
> > Quark
> > Cybernetics
> >
> >
> >
> >
>
>
> --
> Joel Sherrill, Ph.D. Director of Research & Development
> joel.sherrill at OARcorp.com On-Line Applications Research
> Ask me about RTEMS: a free RTOS Huntsville AL 35805
> Support Available (256) 722-9985
>
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
More information about the users
mailing list