diff --git a/.gitignore b/.gitignore index 23e656c..01b742f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,11 @@ -build/dsss_objs/* -build/dsss_imports/* -build/dsss.last +build/objs build/xomb.dump build/xomb.iso build/iso/binaries build/iso/LICENSE build/iso/boot/xomb build/root/* -build/dsss.conf +build/build_arch.sh user/nativecall.d libos/penguinhat runtimes/mindrt/*.a diff --git a/build/build.sh b/build/build.sh new file mode 100755 index 0000000..0278acb --- /dev/null +++ b/build/build.sh @@ -0,0 +1,77 @@ +CC=x86_64-pc-elf-gcc +DC=ldc + +source build_arch.sh + +RUNTIME_PATH=../kernel/runtime + +KERNEL_BUILDFLAGS="-d-version=KERNEL -I.. -I${ARCH_PATH} -nodefaultlib ${ARCH_FLAGS}" + +# what the target is +TARGET=xomb.iso + +# compile the assembly for the target + +echo +echo Setting up filesystem for target +mkdir -p root/binaries +mkdir -p iso/binaries +mkdir -p objs + +echo +echo Setting up user interfaces for target: ${ARCH_NAME} +arch_setup; + +echo +echo Compiling Kernel Runtime +echo '--> kernel/runtime/object.d' +${DC} ${KERNEL_BUILDFLAGS} -I${RUNTIME_PATH} -c ../kernel/runtime/object.d -oq -odobjs +echo '--> kernel/runtime/invariant.d' +${DC} ${KERNEL_BUILDFLAGS} -I${RUNTIME_PATH} -c ../kernel/runtime/invariant.d -oq -odobjs + +# Runtime Types +for item in ${RUNTIME_PATH}/std/typeinfo/*.d; +do + echo "--> ${item:3:${#item}}" + ${DC} ${KERNEL_BUILDFLAGS} -I${RUNTIME_PATH} -c ${item} -oq -odobjs +done + +echo '--> kernel/runtime/dstubs.d' +${DC} ${KERNEL_BUILDFLAGS} -I${RUNTIME_PATH} -c ../kernel/runtime/dstubs.d -oq -odobjs +echo '--> kernel/runtime/util.d' +${DC} ${KERNEL_BUILDFLAGS} -I${RUNTIME_PATH} -c ../kernel/runtime/util.d -oq -odobjs +echo '--> kernel/runtime/std/moduleinit.d' +${DC} ${KERNEL_BUILDFLAGS} -I${RUNTIME_PATH} -c ../kernel/runtime/std/moduleinit.d -oq -odobjs + +echo +echo Compiling Kernel Proper with flags: ${KERNEL_BUILDFLAGS} + +ROOT_FILE=../kernel/core/kmain.d + +echo "--> ${ROOT_FILE:3:${#ROOT_FILE}}" +${DC} ${ROOT_FILE} ${KERNEL_BUILDFLAGS} -c -oq -odobjs + +for item in `${DC} ${ROOT_FILE} -c -o- -oq -v ${KERNEL_BUILDFLAGS} | sed 's/import\s*\(tango\|object\|ldc\)//' | grep "import " | sed 's/import\s*\S*\s*[(]\([^)]*\)[)]/\1/'` +do + echo "--> ${item:3:${#item}}" + ${DC} ${item} ${KERNEL_BUILDFLAGS} -c -oq -odobjs +done + +# we will need some post build foo to link and create the iso + +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 ${ARCH_PATH}/linker.ld -o iso/boot/xomb `ls objs/*.o` + +echo +echo Compiling ISO +./buildiso.sh + +echo +echo Creating Kernel Symbol File +echo '--> xomb.sym' +./mkldsym.sh iso/boot/xomb xomb.sym + diff --git a/build/configure.sh b/build/configure.sh index f32d991..582e68f 100755 --- a/build/configure.sh +++ b/build/configure.sh @@ -1,6 +1,5 @@ #!/bin/sh - render_usage() { echo "USAGE: ./configure [TARGET]" @@ -18,5 +17,5 @@ then else FILE=confs/$1.conf echo "Targetting $1" - cp $FILE dsss.conf + cp $FILE build_arch.sh fi diff --git a/build/confs/x86.conf b/build/confs/x86.conf index db5f218..ad19618 100644 --- a/build/confs/x86.conf +++ b/build/confs/x86.conf @@ -1,76 +1,7 @@ -name = xomb +ARCH_NAME=x86 +ARCH_PATH=../kernel/arch/x86 +ARCH_FLAGS="-mattr=-sse -m32 -disable-red-zone -O0 -code-model=large" -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-32 -I.. - -# compile the assembly for the target - -prebuild= \ -\ -\ -echo ; \ -echo Setting up Architecture Dependence: x86; \ -echo '--> architecture.d';\ -mkdir -p dsss_imports;\ -mkdir -p dsss_objs;\ -mkdir -p dsss_objs/G;\ -mkdir -p dsss_objs/O;\ -cp ../kernel/arch/x86/imports/compile_typeinfo.sh dsss_imports/.;\ -cp ../kernel/arch/x86/imports/architecture.d dsss_imports/.;\ -echo '--> nativecall.d';\ -echo ; \ -cp ../kernel/arch/x86/imports/nativecall.d ../user/.;\ -echo Compiling Assembly for target: x86 ;\ -echo '--> boot.S';\ -yasm -felf32 -mx86 -o dsss_objs/O/kernel.arch.x86.boot.boot.o ../kernel/arch/x86/boot/boot.s;\ -\ -echo ; \ -echo Compiling Kernel Runtime ; \ -echo '--> kernel/runtime/object.d';\ -ldc -nodefaultlib -m32 -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 -m32 -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/*';\ -sh ./dsss_imports/compile_typeinfo.sh;\ -echo '--> kernel/runtime/dstubs.d';\ -ldc -nodefaultlib -m32 -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 -m32 -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 -m32 -g -I.. -I../kernel/runtime/. -code-model=kernel -c ../kernel/runtime/std/moduleinit.d -ofdsss_objs/G/kernel.runtime.std.moduleinit.o ;\ -echo '--> kernel/runtime/precision.d';\ -ldc -nodefaultlib -m32 -g -I.. -I../kernel/runtime/. -code-model=kernel -c ../kernel/runtime/precision.d -ofdsss_objs/G/kernel.runtime.precision.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 -melf_i386 -belf32-i386 -T ../kernel/arch/x86/linker.ld -o iso/boot/xomb `ls dsss_objs/G/*.o` `ls dsss_objs/O/*.o`;\ -\ -echo ;\ -echo Creating Kernel Dump; \ -echo '--> xomb.dump';\ -rm -f xomb.dump && 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 +arch_setup() +{ +} diff --git a/build/confs/x86_64.conf b/build/confs/x86_64.conf index b28480c..b081506 100644 --- a/build/confs/x86_64.conf +++ b/build/confs/x86_64.conf @@ -1,81 +1,18 @@ -name = xomb - -CC = x86_64-pc-elf-gcc -CFLAGS = -nostdlib -nodefaultlibs -g -DUSE_ASSERT -mcmodel=large - -[*] -buildflags=-dc=ldc-xomb -d-version=KERNEL -g -disable-red-zone -O0 - -[../kernel/core/kmain.d] -buildflags=-dc=ldc-xomb -d-version=KERNEL -I.. -g -disable-red-zone -O0 - -# compile the assembly for the target - -prebuild= \ -\ -\ -echo ; \ -echo Setting up Architecture Dependence: x86_64; \ -echo '--> architecture.d';\ -mkdir -p dsss_imports;\ -mkdir -p dsss_objs;\ -mkdir -p dsss_objs/G;\ -mkdir -p dsss_objs/O;\ -mkdir -p root/binaries;\ -mkdir -p iso/binaries;\ -cp ../kernel/arch/x86_64/imports/compile_typeinfo.sh dsss_imports/.;\ -cp -r ../kernel/arch/x86_64/architecture dsss_imports/.;\ -echo '--> nativecall.d';\ -echo ; \ -cp ../kernel/arch/x86_64/imports/nativecall.d ../user/.;\ -echo Compiling Assembly for target: x86_64 ;\ -echo '--> boot.s';\ -yasm -o dsss_objs/O/kernel.arch.x86_64.boot.boot.o ../kernel/arch/x86_64/boot/boot.s -felf64 -g stabs;\ -echo '--> load.s';\ -yasm -o dsss_objs/O/kernel.arch.x86_64.boot.load.o ../kernel/arch/x86_64/boot/load.s -felf64;\ -echo '--> trampoline.s';\ -yasm -o dsss_objs/O/kernel.arch.x86_64.boot.trampoline.o ../kernel/arch/x86_64/boot/trampoline.s -felf64 -g stabs;\ -\ -\ -echo ; \ -echo Compiling Kernel Runtime ; \ -echo '--> kernel/runtime/object.d';\ -ldc -O0 -disable-red-zone -d-version=KERNEL -nodefaultlib -g -I.. -Idsss_imports/. -I../kernel/runtime/. -m64 -code-model=large -c ../kernel/runtime/object.d -ofdsss_objs/G/kernel.runtime.object.o; \ -echo '--> kernel/runtime/invariant.d';\ -ldc -O0 -disable-red-zone -d-version=KERNEL -nodefaultlib -g -I.. -Idsss_imports/. -I../kernel/runtime/. -m64 -code-model=large -c ../kernel/runtime/invariant.d -ofdsss_objs/G/kernel.runtime.invariant.o; \ -echo '--> kernel/runtime/std/typeinfo/*';\ -sh ./dsss_imports/compile_typeinfo.sh;\ -echo '--> kernel/runtime/dstubs.d';\ -ldc -O0 -disable-red-zone -d-version=KERNEL -nodefaultlib -g -I.. -Idsss_imports/. -I../kernel/runtime/. -m64 -code-model=large -c ../kernel/runtime/dstubs.d -ofdsss_objs/G/kernel.runtime.dstubs.o ;\ -echo '--> kernel/runtime/util.d';\ -ldc -O0 -disable-red-zone -d-version=KERNEL -nodefaultlib -g -I.. -I../kernel/runtime/. -Idsss_imports/. -m64 -code-model=large -c ../kernel/runtime/util.d -ofdsss_objs/G/kernel.runtime.util.o ;\ -echo '--> kernel/runtime/std/moduleinit.d';\ -ldc -O0 -disable-red-zone -d-version=KERNEL -nodefaultlib -g -I.. -I../kernel/runtime/. -Idsss_imports/. -m64 -code-model=large -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` `ls dsss_objs/O/*.o`;\ -\ -echo ;\ -echo Compiling ISO; \ -./buildiso.sh; \ -\ -echo ;\ -echo Creating Kernel Symbol File; \ -echo '--> xomb.sym';\ -./mkldsym.sh iso/boot/xomb xomb.sym; \ -\ +ARCH_NAME=x86_64 +ARCH_PATH=../kernel/arch/x86_64 +ARCH_FLAGS="-mattr=-sse -m64 -disable-red-zone -O0 -code-model=large" + +arch_setup() +{ + cp ../kernel/arch/x86_64/imports/compile_typeinfo.sh dsss_imports/. + echo '--> nativecall.d' + echo + cp ../kernel/arch/x86_64/imports/nativecall.d ../user/. + echo Compiling Assembly for target: x86_64 + echo '--> boot.s' + yasm -o objs/kernel.arch.x86_64.boot.boot.o ../kernel/arch/x86_64/boot/boot.s -felf64 -g stabs + echo '--> load.s' + yasm -o objs/kernel.arch.x86_64.boot.load.o ../kernel/arch/x86_64/boot/load.s -felf64 + echo '--> trampoline.s' + yasm -o objs/kernel.arch.x86_64.boot.trampoline.o ../kernel/arch/x86_64/boot/trampoline.s -felf64 -g stabs +}