Building

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sds2017
Member
Member
Posts: 61
Joined: Tue Jul 05, 2011 10:05 am

Building

Post by sds2017 »

Hi,
I'm Jackson and I'm building a bootloader I've finished Stage1 and trying to load Stage2 of my bootloader but, I can't build the thing to test it. I'm using Linux so I'm using dd and the loopback device. I've seen the page on OSdev on it but every time I try it says the loopback device is busy or it says Sizes don't match. Then I tried the build(shell script) file below but, it always says "cp: cannot create regular file `tmp-loop/KRNLDR.SYS': No space left on device" the code is below. What's wrong?

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"
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Re: Building

Post by xyzzy »

I think the error makes it pretty obvious what the problem is.
immibis
Posts: 19
Joined: Fri Dec 18, 2009 12:38 am

Re: Building

Post by immibis »

Or the fact that you're overwriting the floppy's first sector with your own bootloader - but the first sector contains information necessary for the filesystem to work at all.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Building

Post by Combuster »

immibis wrote:Or the fact that you're overwriting the floppy's first sector with your own bootloader - but the first sector contains information necessary for the filesystem to work at all.
That's only going to be a problem if the bootsector lacks the correct filesystem data (which in this case it probably does: it mounts but acts broken afterwards; I don't expect someone to be stupid enough to actually try and add a >1.44M stage 2). After all your FAT-compatible bootloader has to be filesystem-aware so you probably end up including all the labels for the superblock's data anyway.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply