-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-linux.sh
96 lines (63 loc) · 2.09 KB
/
build-linux.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
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
#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 ">>> Creating new InpyoOS floppy image..."
rm disk_images/inpyoos.flp
mkdosfs -C disk_images/inpyoos.flp 1440 || exit
echo ">>> Assembling bootloader..."
nasm -O0 -w+orphan-labels -f bin -o source/bootload/bootload.bin source/bootload/bootload.asm || exit
echo ">>> Assembling InpyoOS kernel..."
cd source
nasm -O0 -w+orphan-labels -f bin -o inpyoos.sys system.asm || exit
echo ">>> Assembling InpyoOS 2nd-stage bootloader..."
nasm -O0 -w+orphan-labels -f bin -o boot.sys boot.asm || exit
cd ..
echo ">>> Assembling test documents..."
cd example_content
for i in *.mus
do
nasm -O0 -w+orphan-labels -f bin $i -o `basename $i .mus`.mmf || exit
done
cd ../programs
echo ">>> Assembling programs..."
for i in *.asm
do
nasm -O0 -w+orphan-labels -f bin $i -o ../programs-out/`basename $i .asm`.app || exit
done
cd ..
cd cprograms
# get folders in cprograms
for i in *
do
cd $i
make || exit
mv $i.app ../../programs-out/
cd ..
done
cd ..
echo ">>> Adding bootloader to floppy image..."
dd status=noxfer conv=notrunc if=source/bootload/bootload.bin of=disk_images/inpyoos.flp || exit
echo ">>> Copying InpyoOS kernel, bootloader and programs..."
rm -rf tmp-loop
mkdir tmp-loop
mount -t vfat disk_images/inpyoos.flp tmp-loop
cp source/boot.sys tmp-loop/
cp source/inpyoos.sys tmp-loop/
cp programs-out/*.app programs/*.bas programs/*.dat tmp-loop/
cp example_content/*.asc example_content/*.pcx example_content/*.mmf example_content/*.dro example_content/*.rad tmp-loop/
cp source/sys/*.sys tmp-loop/
sleep 0.2
echo ">>> Unmounting loopback floppy..."
umount tmp-loop || exit
rm -rf tmp-loop
echo ">>> Creating CD-ROM ISO image..."
rm -f disk_images/inpyoos.iso
mkisofs -quiet -V 'MICHALOS' -input-charset iso8859-1 -o disk_images/inpyoos.iso -b inpyoos.flp disk_images/ || exit
echo ">>> Copying some stuff..."
cp disk_images/inpyoos.flp disk_images/inpyoos.img
chmod 777 disk_images/inpyoos.flp
./boot.bat
echo '>>> Done!'