Importance of Bochs (and PearPC)
Joel Sherrill <joel@OARcorp.com>
joel.sherrill at OARcorp.com
Tue Oct 19 13:50:56 UTC 2004
Chris Johns wrote:
> Joel Sherrill <joel at OARcorp.com> wrote:
>
>>
>> + If you have knowledge of the ATA subsystem,
>> please give Bochs a try for the File IO test and
>> post the complete setup.
>>
>
> I see on the wiki page you want to know how to create a disk image and
> then format it. On Linux I use the loopback device (man losetup) and
> mkdosfs to create a disk image. Does the attached script help ?
I now have a loopback image formatted but don't know enough about
how it was formatted to write the corresponding Bochs configuration
file entry. Do you know enough to answer the ata* configuration
parameters?
http://bochs.sourceforge.net/cgi-bin/topper.pl?name=New+Bochs+Documentation&url=http://bochs.sourceforge.net/doc/docbook/user/book1.html
It looks like we have to know the mode (flat?), sector size,
and some math about heads, cylinders, and "spts". What would those be?
Sorry to be so dense.
--joel
> ------------------------------------------------------------------------
>
> #!/bin/bash
> #
> # Make the disk.
> #
> # Chris Johns (chrisj at rtems dot org)
> #
> #
>
> if [ $# -ne 2 ]; then
> echo "Need to supply the image name and image size in megs."
> exit 1
> fi
>
> PATH=/sbin:/usr/sbin:$PATH
>
> DATE=`date +%Y%m%d`
>
> MNTPOINT=mnt-image
> IMAGESIZE_IN_MEGS=$2
> IMAGESIZE=`expr $IMAGESIZE_IN_MEGS \* 1024`
> IMAGE=$1-$DATE.img
>
> rm -f $IMAGE
> rm -f $IMAGE.gz
>
> dd if=/dev/zero of=$IMAGE bs=1k count=$IMAGESIZE
>
> for devnum in 0 1 2 3 4 5 6 7 8; do
> if losetup /dev/loop$devnum $IMAGE 2>/dev/null ; then break; fi
> done
>
> if [ "$devnum" = "8" ]; then
> rm -rf $MNTPOINT $IMAGE
> echo "All of your loopback devices are in use!" >&2
> exit 1
> fi
>
> LODEV=/dev/loop$devnum
>
> # We have to "echo y |" so that it doesn't complain about $IMAGE not
> # being a block device
> echo y | mkdosfs $LODEV $IMAGESIZE >/dev/null 2>/dev/null
>
> echo "Using loopback device $LODEV"
>
> mkdir -p $MNTPOINT
> mount -t vfat $LODEV $MNTPOINT || {
> echo "Can't get a loopback device"
> exit 1
> }
>
> here=$(pwd)
>
> cd $MNTPOINT
>
> #
> # Add files for the image here.
> #
>
> cd $here
> umount $MNTPOINT
> losetup -d $LODEV
>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list