luxos/build-linux.sh
Tiberiu Chibici 0372dcee81 [GOOD] BUILD 0.1.0.470 DATE 8/30/2011 AT 6:40 PM
====================================================
Mainly changed: HAL.VFS
+ Designed virtual file system
+ Completed the VFS
+ Added verbose mode for VFS
+ Updated shell script, now shows build number when building
? TODO: Implement one file system (most likely FAT12)
? TODO: Mount floppy device
2021-09-14 18:50:50 +03:00

80 lines
1.4 KiB
Bash

#!/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/
sleep 1
umount /media/floppy1
rm -r /media/floppy1
# DONE
echo "[100%] DONE!\n"
exit 0