Here is the script I put together now. I hope I haven't overlooked
anything.
You might need to modify the first section of variables to suit your setup.
Ofcourse you need to run this as root. May be some version of this
should be included with syslinux?
Basically given an existing floppy image, it creates a larger image and
copies its contents over and sets up the bootsector of the newimage
appropriately.
---- SCRIPT STARTS -----
#!/bin/bash
NEWIMAGE=dosimage.img
OLDIMAGE=oldimage.img # Name of an existing dos image
SIZEMB=8
MKDOSFS=mkdosfs # binary for mkdosfs
SIZEKB=`echo "$SIZEMB 1024 * p" | dc`
NUMSECT=`echo "$SIZEKB 2 * p" | dc`
MNTNEW=`mktemp -d /tmp/mntptnew.XXXXXX` # Create a mountpoint
MNTOLD=`mktemp -d /tmp/mntptold.XXXXXX` # Name of an existing mountpoint
# Create the filesystem
OUTLINE=`$MKDOSFS -v -C $NEWIMAGE $SIZEKB | grep heads`
HEADS=`echo $OUTLINE | cut -f3 -d' '`
SECTORS=`echo $OUTLINE | cut -f6 -d' '`
CYLINDERS=`echo "$NUMSECT $HEADS $SECTORS * / p" | dc`
# Copy contents from old image to new image
mount -o loop $NEWIMAGE $MNTNEW
mount -o loop $OLDIMAGE $MNTOLD
cp -r $MNTOLD/* $MNTNEW
umount $MNTNEW
umount $MNTOLD
rmdir $MNTNEW
rmdir $MNTOLD
# Create the boot sector of the new image
# copy the first 512 bytes from the OLD image except the bytes 11
through 61 (inclusive)
dd if=$OLDIMAGE of=$NEWIMAGE bs=1 count=10 conv=notrunc
dd if=$OLDIMAGE of=$NEWIMAGE bs=1 skip=61 seek=61 conv=notrunc count=451
# Print the details
echo "Your floppy image is in $NEWIMAGE. When using it in iso/pxelinux,
dont forget to add"
echo "\"floppy c=$CYLINDERS s=$SECTORS h=$HEADS\" to the argument
of
memdisk"
---- SCRIPT ENDS ----
- Murali
Egan Ford wrote:
> Please do post. I use 2.88 images and didn't know that I could have a
> larger
> image.
>
> Thanks.
>
>> -----Original Message-----
>> From: syslinux-bounces at zytor.com [mailto:syslinux-bounces at
zytor.com]
>> On Behalf Of Murali Krishnan Ganapathy
>> Sent: Tuesday, February 10, 2004 6:15 PM
>> To: syslinux at zytor.com
>> Subject: Re: [syslinux] Memdisk/floppy image question
>>
>>
>> I meant that the script should do all the things necessary to create
>> a floppy image, including
>>
>> * call mkdosfs with right param's
>> * Copy the right section of boot sector code (given an existing
>> bootsector/floppy image)
>> * And output the C/H/S values for use with syslinux.
>>
>> Frankly the verbose output of mkdosfs gives too much information. It
>> took me some time to realise that tracks and cylinder are the same
>> thing (almost). Just a simple script which can be used to create
>> large floppy images. I am planning to write one for my use anyway.
>> Once I finish I can post it here, for inclusion with syslinux.
>>
>> BTW, is there anybody who use the large floppy feature of memdisk. It
>> sure beats having to fit things inside a 2.88 floppy image, and
>> storing a compressed ramdisk image inside a floppy image.
>>
>> - Murali
>>
>> H. Peter Anvin wrote:
>>
>>
>>
>>> ganapathy murali krishnan wrote:
>>>
>>>
>>>
>>>
>>>> I created another one exactly the same size, and used the
>>>
>> information
>>
>>
>>>> gives by mkdosfs this time. The same C/H/S combination
>>>
>> worked. It might
>>
>>
>>>> be useful to have mkfloppyimage script, just like
>>>
>> mkdiskimage. So people
>>
>>
>>>> like me don't do stupid things (like forgetting the
parameters).
>>>>
>>>> What would that do that mkdosfs doesn't?
>>>>
>>>> -hpa
>>>
>