]> wirehaze git hosting - BOS.git/blob - scripts/mac-install.sh

wirehaze git hosting

VFS structures in place, minor typos fixed
[BOS.git] / scripts / mac-install.sh
1 #! /bin/sh
2
3 # BOS MacOS X Installer version 0.2
4 # You must be root to run this script because of the floppy/loopback device
5
6 echo
7 echo " BOS - MacOS X installer"
8 echo "-------------------------"
9 echo "Requires: Homebrew mtools"
10 echo
11
12 if [ `id -u` != "0" ]; then
13 echo "You must be root to use this installer!"
14 echo
15 fi
16
17 if [ -z "$1" ]; then
18 echo "Usage is:"
19 echo "$0 image - Creates a floppy image called bos.img"
20 echo "$0 floppy - Install BOS into a floppy ( must be inserted )"
21 echo
22 echo "Note: this installer will create a bootable image/floppy."
23 echo "Floppy creation is not tested ( I don't have a floppy reader ) and it should be already formatted"
24 exit
25 fi
26
27 echo "Compiling BOS..."
28 ../utils/osxfasm ../kernel/kernel.asm ../kernel/kernel.sys
29 ../utils/osxfasm ../boot/BOS_boot.asm ../boot/BOS_boot.bin
30
31 if [ "$1" = "floppy" ]; then
32 echo "Starting floppy installation..."
33
34 #Install BOS_boot.bin as bootsector into bos.img
35 dd if=../boot/BOS_boot.bin of=/dev/fd0 bs=1 count=512
36 mount /mnt/floppy
37
38 #Insert kernel.sys into image
39 cp ../kernel/kernel.sys /mnt/floppy
40
41 #Umount & cleanup
42 umount /mnt/floppy
43
44 echo "BOS installed."
45
46 else
47 echo "Starting image creation..."
48
49 #Create image
50 rm -rf ../bos.img
51 mformat -C -f 1440 -v BOS -i ../bos.img ::
52
53 #Erhm, it isn't pretty....
54 DISKNAME=`hdiutil attach -nomount ../bos.img`
55 diskutil mount $DISKNAME
56 MOUNTNAME=`diskutil info $DISKNAME | grep 'Mount Point' | cut -d : -f 2 | sed 's/^ *//g' | sed 's/ *$//g';`
57
58 #Mounted, copy kernel.sys
59 cp ../kernel/kernel.sys $MOUNTNAME
60
61 #Install BOS_boot.bin as bootsector into bos.img
62 umount $DISKNAME
63 dd if=../boot/BOS_boot.bin of=$DISKNAME bs=1 count=512
64
65 #Detach
66 hdiutil detach $DISKNAME
67 chmod 0777 ../bos.img
68
69 echo "BOS image created!"
70 fi