luxos/build.sh
Tiberiu Chibici caa7718af9 [GOOD] BUILD 0.1.0.551 DATE 9/03/2011 AT 9:25 AM
====================================================
Mainly changed: HAL.FSs
+ Updated 'mount' call in floppy driver, now done after controller is
initialized
+ Added 'detect' function for FAT file systems
+ Implemented 'initdr' driver, however still bugged
+ Improved logger
2021-09-14 18:51:43 +03:00

78 lines
1.5 KiB
Bash

#!/bin/sh
# ----------------- lux Operating System -----------------
OBJ=build
COMPILER=i586-elf-gcc
LINKER=i586-elf-ld
BUILD_VER="0.1.0"
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 + 1)) #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
}
# Calculate version number
read buildno < ./scripts/version.txt
buildno=$(($buildno + 1))
echo $buildno > ./scripts/version.txt
echo "#define OS_BUILD \"$BUILD_VER.$buildno\"" > ./Kernel/include/version.h
# On the screen
echo "========================================================"
echo "LUX Operating System build $BUILD_VER.$buildno"
echo "========================================================"
# Clean up
echo "[ 1%] CLEANUP"
rm $OBJ/* 2>/dev/null
# 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..."
mount A: /mnt/floppy 2>/dev/null >/dev/null
cp kernel.bin /mnt/floppy/
# DONE
echo "[100%] DONE!"
exit 0