MyOS Problem

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
jackson
Posts:14
Joined:Sat Aug 06, 2011 7:52 pm
MyOS Problem

Post by jackson » Sat Aug 13, 2011 5:49 pm

Hi my name is Jackson and I'm a following the tuturial series and building a bootloader. I'm using Linux Mint 10 for all of the compiling and coding. I'm wondering how to put both of them on a floppy. I like linux and mac but not windows. It would be great if somebody could explain.

Andyhhp
Moderator
Posts:387
Joined:Tue Oct 23, 2007 10:05 am
Location:127.0.0.1
Contact:

Re: MyOS Problem

Post by Andyhhp » Sat Aug 13, 2011 11:21 pm

dd is your friend. It is much nicer than the windows alternatives.

See man dd for details.
Image

jackson
Posts:14
Joined:Sat Aug 06, 2011 7:52 pm

Re: MyOS Problem

Post by jackson » Sun Aug 14, 2011 1:43 am

Thanks but how do you put stage2 on it. I've tried to use loopback but it won't work

Andyhhp
Moderator
Posts:387
Joined:Tue Oct 23, 2007 10:05 am
Location:127.0.0.1
Contact:

Re: MyOS Problem

Post by Andyhhp » Sun Aug 14, 2011 10:43 am

Yes it really will.

You make a loopback device, dd the bootsector to the beginning, remount it to get the correct filesystem driver, and cp the second stage on.

~Andrew
Image

jackson
Posts:14
Joined:Sat Aug 06, 2011 7:52 pm

Re: MyOS Problem

Post by jackson » Sun Aug 14, 2011 2:31 pm

So it would look like this right?

dd if=Stage1.bin bs512 count=2880 of OS.img

losetup /dev/loop0 OS.img

mkdosfs /dev/loop0

mount -t msdos /dev/loop0 /mnt/MyOS

cp OS.img Stage1.bin

jackson
Posts:14
Joined:Sat Aug 06, 2011 7:52 pm

Re: MyOS Problem

Post by jackson » Sun Aug 14, 2011 5:06 pm

This is the .sh build file I use but when I type
sudo bash
./MyOS/build.sh

It says

Compiling Files...
Copying bootloader to floppy...
1+0 records in
1+0 records out
Copying Kernel and files to floppy...
cp: cannot create regular file `tmp-loop/KRNLDR.SYS': No space left on device
Unmounting loopback floppy
Done

Why does it say "cp: cannot create regular file `tmp-loop/KRNLDR.SYS': No space left on device "

So no matter what if run it in qemu it won't work because the Stage2 file is not on the floppy image because

Here's the file I don't know why but, it won't work.

if test "`whoami`" != "root" ; then
echo "You must be logged in as root to build"
echo "Enter su or sudo bash to switch to root"
exit
fi

if [ ! -e coppingos.flp]
then
echo "Making Floppy..."
mkdosfs -C MyOS/MyOS.flp 1440 || exit
fi

echo "Compiling Files..."
nasm MyOS/Stage2.asm -o MyOS/KRNLDR.SYS
nasm MyOS/Stage1.asm -o MyOS/Stage1.bin

echo "Copying bootloader to floppy..."

dd status=noxfer conv=notrunc if=MyOS/Stage1.bin of=MyOS/MyOS.flp || exit

echo "Copying Kernel and files to floppy..."

rm -rf tmp-loop

mkdir tmp-loop && mount -o loop -t vfat MyOS/MyOS.flp tmp-loop && cp MyOS/KRNLDR.SYS tmp-loop

echo "Unmounting loopback floppy"

umount tmp-loop || exit

rm -rf tmp-loop

echo "Done"

chibicitiberiu
Posts:22
Joined:Sat Jul 17, 2010 7:55 am

Re: MyOS Problem

Post by chibicitiberiu » Fri Aug 19, 2011 7:22 am

Here is an article which may be useful: http://wiki.osdev.org/GRUB#Installing_to_floppy

And as a tip, you can type #!/bin/bash in the first line of your shell script, then enable permission to execute file (from Properties - Permissions), and then you can launch it as executable.

Post Reply