3 # This script assembles the MikeOS bootloader, kernel and programs
4 # with NASM, and then creates floppy and CD images (on Mac OS X)
6 # Only the root user can mount the floppy disk image as a virtual
7 # drive (loopback mounting), in order to copy across the files
10 echo ">>> MikeOS OS X build script - requires nasm and mkisofs"
13 if test "`whoami`" != "root" ; then
14 echo "You must be logged in as root to build (for loopback mounting)"
15 echo "Enter 'su' or 'sudo bash' to switch to root"
20 echo ">>> Assembling bootloader..."
22 nasm
-O0 -f bin
-o source
/bootload
/bootload.bin source
/bootload
/bootload.asm ||
exit
25 echo ">>> Assembling MikeOS kernel..."
28 nasm
-O0 -f bin
-o kernel.bin kernel.asm ||
exit
32 echo ">>> Assembling programs..."
38 nasm
-O0 -f bin
$i -o `basename $i .asm`.bin ||
exit
43 echo ">>> Creating floppy..."
44 cp disk_images
/mikeos.flp disk_images
/mikeos.dmg
47 echo ">>> Adding bootloader to floppy image..."
49 dd conv
=notrunc
if=source
/bootload
/bootload.bin of
=disk_images
/mikeos.dmg ||
exit
52 echo ">>> Copying MikeOS kernel and programs..."
56 dev
=`hdid -nobrowse -nomount disk_images/mikeos.dmg`
57 mkdir tmp-loop
&& mount
-t msdos
${dev} tmp-loop
&& cp source
/kernel.bin tmp-loop
/
59 cp programs
/*.bin programs
/*.bas programs
/test.pcx tmp-loop
61 echo ">>> Unmounting loopback floppy..."
63 umount tmp-loop ||
exit
68 echo ">>> MikeOS floppy image is disk_images/mikeos.dmg"
71 echo ">>> Creating CD-ROM ISO image..."
73 rm -f disk_images
/mikeos.iso
74 mkisofs
-quiet -V 'MIKEOS' -input-charset iso8859-1
-o disk_images
/mikeos.iso
-b mikeos.dmg disk_images
/ ||
exit