This repository has been archived by the owner on Feb 13, 2018. It is now read-only.
/
build-osx.sh
executable file
·77 lines (42 loc) · 1.67 KB
/
build-osx.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
# This script assembles the MikeOS bootloader, kernel and programs
# with NASM, and then creates floppy and CD images (on Mac OS X)
# Only the root user can mount the floppy disk image as a virtual
# drive (loopback mounting), in order to copy across the files
echo ">>> MikeOS OS X build script - requires nasm and mkisofs"
if test "`whoami`" != "root" ; then
echo "You must be logged in as root to build (for loopback mounting)"
echo "Enter 'su' or 'sudo bash' to switch to root"
exit
fi
echo ">>> Assembling bootloader..."
nasm -f bin -o source/bootload/bootload.bin source/bootload/bootload.asm || exit
echo ">>> Assembling MikeOS kernel..."
cd source
nasm -f bin -o kernel.bin kernel.asm || exit
cd ..
echo ">>> Assembling programs..."
cd programs
for i in *.asm
do
nasm -f bin $i -o `basename $i .asm`.bin || exit
done
cd ..
echo ">>> Creating floppy..."
cp disk_images/mikeos.flp disk_images/mikeos.dmg
echo ">>> Adding bootloader to floppy image..."
dd conv=notrunc if=source/bootload/bootload.bin of=disk_images/mikeos.dmg || exit
echo ">>> Copying MikeOS kernel and programs..."
rm -rf tmp-loop
dev=`hdid -nobrowse -nomount disk_images/mikeos.dmg`
mkdir tmp-loop && mount -t msdos ${dev} tmp-loop && cp source/kernel.bin tmp-loop/
cp programs/*.bin programs/*.bas programs/test.pcx tmp-loop
echo ">>> Unmounting loopback floppy..."
umount tmp-loop || exit
hdiutil detach ${dev}
rm -rf tmp-loop
echo ">>> MikeOS floppy image is disk_images/mikeos.dmg"
echo ">>> Creating CD-ROM ISO image..."
rm -f disk_images/mikeos.iso
mkisofs -quiet -V 'MIKEOS' -input-charset iso8859-1 -o disk_images/mikeos.iso -b mikeos.dmg disk_images/ || exit
echo '>>> Done!'