diff --git a/.gitignore b/.gitignore index 28a6d48..009d5c4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ build/dsss.last build/xomb.dump build/xomb.iso build/iso/boot/xomb +build/dsss.conf *.swp diff --git a/build/configure.sh b/build/configure.sh new file mode 100755 index 0000000..b78a45a --- /dev/null +++ b/build/configure.sh @@ -0,0 +1,22 @@ +#!/bin/sh + + +render_usage() +{ + echo "USAGE: ./configure --target=[TARGET]" + echo "" + echo "TARGET - one of the following values: " + for item in confs/*.conf; + do + echo "$item" | sed -e 's/confs\/\(.*\)\.conf/\1/'; + done +} + +if [ $# -ne 1 ] +then + render_usage +else + FILE=confs/$1.conf + echo "Targetting $1" + cp $FILE dsss.conf +fi diff --git a/build/dsss.conf b/build/confs/x86.conf similarity index 100% rename from build/dsss.conf rename to build/confs/x86.conf diff --git a/build/confs/x86_64.conf b/build/confs/x86_64.conf new file mode 100644 index 0000000..783ac8b --- /dev/null +++ b/build/confs/x86_64.conf @@ -0,0 +1,71 @@ +name = xomb + +CC = x86_64-pc-elf-gcc +CFLAGS = -nostdlib -nodefaultlibs -g -DUSE_ASSERT -mcmodel=kernel + +[*] +buildflags=-dc=ldc-xomb + +[../kernel/core/kmain.d] + +buildflags=-dc=ldc-xomb -I.. + +# compile the assembly for the target + +prebuild= \ +\ +\ +echo ; \ +echo Setting up Architecture Dependence: x86_64; \ +echo '--> architecture.d';\ +mkdir -p dsss_imports;\ +cp ../kernel/arch/x86_64/imports/architecture.d dsss_imports/.;\ +echo ; \ +echo Compiling Assembly for target: x86_64 ;\ +echo '--> boot.S';\ +yasm -o dsss_objs/G/kernel.arch.x86_64.boot.boot.o ../kernel/arch/x86_64/boot/boot.s -felf64;\ +echo '--> load.S';\ +yasm -o dsss_objs/G/kernel.arch.x86_64.load.load.o ../kernel/arch/x86_64/boot/load.s -felf64;\ +\ +\ +echo ; \ +echo Compiling Kernel Runtime ; \ +echo '--> kernel/runtime/object.d';\ +ldc -nodefaultlib -I.. -I../kernel/runtime/. -code-model=kernel -c ../kernel/runtime/object.d -ofdsss_objs/G/kernel.runtime.object.o; \ +echo '--> kernel/runtime/invariant.d';\ +ldc -nodefaultlib -g -I.. -I../kernel/runtime/. -code-model=kernel -c ../kernel/runtime/invariant.d -ofdsss_objs/G/kernel.runtime.invariant.o; \ +echo '--> kernel/runtime/std/typeinfo/*';\ +ldc -nodefaultlib -g -I.. -I../kernel/runtime/. -code-model=kernel -c `ls ../kernel/runtime/std/typeinfo/*.d` -oddsss_objs/G/. ;\ +echo '--> kernel/runtime/dstubs.d';\ +ldc -nodefaultlib -g -I.. -I../kernel/runtime/. -code-model=kernel -c ../kernel/runtime/dstubs.d -ofdsss_objs/G/kernel.runtime.dstubs.o ;\ +echo '--> kernel/runtime/util.d';\ +ldc -nodefaultlib -g -I.. -I../kernel/runtime/. -code-model=kernel -c ../kernel/runtime/util.d -ofdsss_objs/G/kernel.runtime.util.o ;\ +echo '--> kernel/runtime/std/moduleinit.d';\ +ldc -nodefaultlib -g -I.. -I../kernel/runtime/. -code-model=kernel -c ../kernel/runtime/std/moduleinit.d -ofdsss_objs/G/kernel.runtime.std.moduleinit.o ;\ +\ +echo ; \ +echo Compiling Kernel Proper ; + +# what the target is + +target = xomb.iso + +# we will need some post build foo to link and create the iso + +postbuild = \ +\ +echo ; \ +echo Creating Kernel Executable; \ +echo '--> xomb';\ +#llvm-ld -native -Xlinker=-nostdlib -Xlinker=-Tlinker.ld -Xlinker="-b elf64-x86-64" `ls dsss_objs/G/*.o` -o iso/boot/xomb ; \ +#llvm-ld -nodefaultlib -g -I.. -I../kernel/runtime/. `ls dsss_objs/G/*.o` ;\ +ld -nostdlib -nodefaultlibs -b elf64-x86-64 -T ../kernel/arch/x86_64/linker.ld -o iso/boot/xomb `ls dsss_objs/G/*.o`;\ +\ +echo ;\ +echo Creating Kernel Dump; \ +echo '--> xomb.dump';\ +rm -f xomb.dump && x86_64-pc-elf-objdump -d -S -r iso/boot/xomb > xomb.dump;\ +\ +echo ;\ +echo Compiling ISO; \ +mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 16 -boot-info-table -input-charset UTF-8 -o xomb.iso ./iso