-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.SH
84 lines (63 loc) · 1.58 KB
/
BUILD.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
77
78
79
80
81
82
83
84
# House-DOS build.SH
if test "$(whoami)" != "root" ; then
echo "Must be root to mount images."
echo "Try running again using SUDO."
exit
fi
rm -rf bin
mkdir bin
mkdir bin/usr
cd src || return
echo "Assembling bootloader..."
nasm BOOT16.ASM -o ../bin/BOOT16.BIN || exit
nasm BOOT12.ASM -o ../bin/BOOT12.BIN || exit
echo "Compiling kernel..."
nasm SYS.ASM -o ../bin/SYS.BIN || exit
echo "Assembling commands & programs..."
cd usr || return
for i in *.ASM
do
nasm "$i" -o "../../bin/usr/$(basename "$i" .ASM).BIN" || exit
done
cd ../..
echo "Creating 32M image..."
dd if=/dev/zero of=House-DOS.IMG iflag=fullblock bs=512 count=65536
chmod 777 House-DOS.IMG
echo "Writing bootloader..."
dd if=bin/BOOT16.BIN of=House-DOS.IMG conv=notrunc
fatlabel House-DOS.IMG NATE
echo "Mounting image..."
rm -rf tmp
mkdir tmp
mount House-DOS.IMG tmp
echo "Copying kernel..."
cp bin/SYS.BIN tmp/
fatattr +s tmp/SYS.BIN
mkdir tmp/HOME/
echo "Copying commands & programs..."
mkdir tmp/BIN/
cp bin/usr/*.BIN tmp/BIN/
echo "Unmounting image..."
umount tmp
rm -rf tmp
echo "Creating Floppy image..."
dd if=/dev/zero of=House-DOS-FLP.IMG iflag=fullblock bs=512 count=2880
chmod 777 House-DOS-FLP.IMG
echo "Writing bootloader..."
dd if=bin/BOOT12.BIN of=House-DOS-FLP.IMG conv=notrunc
fatlabel House-DOS-FLP.IMG NATE
echo "Mounting image..."
rm -rf tmp
mkdir tmp
mount House-DOS-FLP.IMG tmp
echo "Copying kernel..."
cp bin/SYS.BIN tmp/
fatattr +s tmp/SYS.BIN
mkdir tmp/HOME/
echo "Copying commands & programs..."
mkdir tmp/BIN/
cp bin/usr/*.BIN tmp/BIN/
echo "Unmounting image..."
umount tmp
rm -rf tmp
echo "Finished."