MyOS Problem
Moderator:Moderators
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.
Re: MyOS Problem
dd is your friend. It is much nicer than the windows alternatives.
See man dd for details.
See man dd for details.

Re: MyOS Problem
Thanks but how do you put stage2 on it. I've tried to use loopback but it won't work
Re: MyOS Problem
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
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

Re: MyOS Problem
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
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
Re: MyOS Problem
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"
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"
-
- Posts:22
- Joined:Sat Jul 17, 2010 7:55 am
Re: MyOS Problem
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.
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.