2021-09-14 15:48:57 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# ----------------- lux Operating System -----------------
|
|
|
|
OBJ=build
|
|
|
|
COMPILER=gcc
|
|
|
|
LINKER=ld
|
|
|
|
|
|
|
|
BuildC()
|
|
|
|
{
|
|
|
|
Percent=10
|
|
|
|
|
|
|
|
while read descript
|
|
|
|
do
|
|
|
|
read line
|
|
|
|
read empty
|
|
|
|
echo "[ $Percent%] KERNEL :: $descript"
|
|
|
|
File=${line##*/}
|
|
|
|
File=${File%%.*}
|
|
|
|
$COMPILER -Wall -Wextra -O -nostdinc -fno-builtin -I./Kernel/include -c -o $OBJ/$File.o $line -nostdlib -nostartfiles -nodefaultlibs
|
|
|
|
Percent=$(($Percent + 2)) #Increase PERCENT
|
|
|
|
done < $1
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
BuildAsm()
|
|
|
|
{
|
|
|
|
Percent=85
|
|
|
|
|
|
|
|
while read descript
|
|
|
|
do
|
|
|
|
read line
|
|
|
|
read empty
|
|
|
|
echo "[ $Percent%] KERNEL :: $descript"
|
|
|
|
File=${line##*/}
|
|
|
|
File=${File%%.*}
|
|
|
|
nasm -f elf -o $OBJ/$File.o $line
|
|
|
|
Percent=$(($Percent + 1)) #Increase PERCENT
|
|
|
|
done < $1
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
echo "lux operating system v0.1"
|
|
|
|
|
|
|
|
# Clean up
|
|
|
|
echo "[ 1%] CLEANUP"
|
|
|
|
rm $OBJ/* 2>/dev/null
|
|
|
|
|
|
|
|
# Calculate version number
|
|
|
|
read buildno < ./scripts/version.txt
|
|
|
|
buildno=$(($buildno + 1))
|
|
|
|
echo $buildno > ./scripts/version.txt
|
|
|
|
echo "#define OS_BUILD \"0.1.0.$buildno\"" > ./Kernel/include/version.h
|
|
|
|
|
|
|
|
# Build kernel
|
|
|
|
BuildC "filelistC.txt"
|
|
|
|
BuildAsm "filelistAsm.txt"
|
|
|
|
|
|
|
|
# Link
|
|
|
|
echo "[ 95%] LINKING..."
|
|
|
|
$LINKER -T link.ld $OBJ/*.o
|
|
|
|
|
|
|
|
# Make floppy image
|
|
|
|
echo "[ 97%] WRITING FLOPPY IMAGE..."
|
|
|
|
cp floppy/original.img luxos.img
|
|
|
|
mkdir /media/floppy1
|
|
|
|
mount -o loop luxos.img /media/floppy1
|
|
|
|
cp kernel.bin /media/floppy1/
|
2021-09-14 15:50:50 +00:00
|
|
|
sleep 1
|
2021-09-14 15:48:57 +00:00
|
|
|
umount /media/floppy1
|
|
|
|
rm -r /media/floppy1
|
|
|
|
|
|
|
|
# DONE
|
|
|
|
echo "[100%] DONE!\n"
|
|
|
|
|
|
|
|
|
|
|
|
exit 0
|