Monday, May 28, 2007

emulate floppy in linux

So I was trying to write a "hello world" "OS" and then add more functionality to it.. just to try it out.

My colleague had showed me a nice link osdev.org. quite intersting resource regarding os development. There they had tutorials on how to get started.

I found this to be a very nice link to get me started:
http://www.osdever.net/downloads.php

One of the steps involved making a boot floppy with grub etc installed on it. Now I was using vmware and didnt hava floppy drive. So I knew I could use dd to create an image and then change the image's filesystem. Just didnt konw how exactly. So my co-worker gave this!

# create a image of Zeros of length 2048 bytes
dd if=/dev/zero of=floppy.img bs=1024 count=2048

#make the image of ext2 file system
mkfs.ext2 floppy.img

#create a mount point
mkdir floppy.d

#mount the image to the mount point
mount -o loop floppy.img floppy.d


Now you can treat the floppy.d directory as a floppy drive! and then unmount when done and transfer the image anywhere!



works like a charm :)







No comments: