-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-linux.sh
57 lines (30 loc) · 1.25 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
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
if [ ! -e disk_images/sleepingos.flp ]
then
echo ">>> Creating new sleepingos floppy image..."
mkdosfs -C disk_images/sleepingos.flp 1440 || exit
fi
echo ">>> Assembling bootloader..."
nasm -O0 -w+orphan-labels -f bin -o source/bootload/bootload.bin source/bootload/bootload.asm || exit
echo ">>> Assembling sleepingos OS kernel..."
cd source
nasm -O0 -w+orphan-labels -f bin -o kernel.bin kernel.asm || exit
cd ..
echo ">>> Adding bootloader to floppy image..."
dd status=noxfer conv=notrunc if=source/bootload/bootload.bin of=disk_images/sleepingos.flp || exit
echo ">>> Copying sleepingos_OS kernel and programs..."
rm -rf tmp-loop
mkdir tmp-loop && mount -o loop -t vfat disk_images/sleepingos.flp tmp-loop && cp source/kernel.bin tmp-loop/
cp programs/sample.pcx 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/sleepingos.iso
mkisofs -quiet -V 'sleepingos OS' -input-charset iso8859-1 -o disk_images/sleepingos.iso -b sleepingos.flp disk_images/ || exit
echo '>>> Done!'