Skip to content

Commit

Permalink
Adds new building process to rid ourselves of dsss.
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkie committed Jan 24, 2013
1 parent c88ee6e commit 10b0994
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 162 deletions.
6 changes: 2 additions & 4 deletions .gitignore
@@ -1,13 +1,11 @@
build/dsss_objs/* build/objs
build/dsss_imports/*
build/dsss.last
build/xomb.dump build/xomb.dump
build/xomb.iso build/xomb.iso
build/iso/binaries build/iso/binaries
build/iso/LICENSE build/iso/LICENSE
build/iso/boot/xomb build/iso/boot/xomb
build/root/* build/root/*
build/dsss.conf build/build_arch.sh
user/nativecall.d user/nativecall.d
libos/penguinhat libos/penguinhat
runtimes/mindrt/*.a runtimes/mindrt/*.a
Expand Down
77 changes: 77 additions & 0 deletions 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

3 changes: 1 addition & 2 deletions build/configure.sh
@@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh



render_usage() render_usage()
{ {
echo "USAGE: ./configure [TARGET]" echo "USAGE: ./configure [TARGET]"
Expand All @@ -18,5 +17,5 @@ then
else else
FILE=confs/$1.conf FILE=confs/$1.conf
echo "Targetting $1" echo "Targetting $1"
cp $FILE dsss.conf cp $FILE build_arch.sh
fi fi
81 changes: 6 additions & 75 deletions 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 arch_setup()
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
99 changes: 18 additions & 81 deletions build/confs/x86_64.conf
@@ -1,81 +1,18 @@
name = xomb ARCH_NAME=x86_64

ARCH_PATH=../kernel/arch/x86_64
CC = x86_64-pc-elf-gcc ARCH_FLAGS="-mattr=-sse -m64 -disable-red-zone -O0 -code-model=large"
CFLAGS = -nostdlib -nodefaultlibs -g -DUSE_ASSERT -mcmodel=large

arch_setup()
[*] {
buildflags=-dc=ldc-xomb -d-version=KERNEL -g -disable-red-zone -O0 cp ../kernel/arch/x86_64/imports/compile_typeinfo.sh dsss_imports/.

echo '--> nativecall.d'
[../kernel/core/kmain.d] echo
buildflags=-dc=ldc-xomb -d-version=KERNEL -I.. -g -disable-red-zone -O0 cp ../kernel/arch/x86_64/imports/nativecall.d ../user/.

echo Compiling Assembly for target: x86_64
# compile the assembly for the target echo '--> boot.s'

yasm -o objs/kernel.arch.x86_64.boot.boot.o ../kernel/arch/x86_64/boot/boot.s -felf64 -g stabs
prebuild= \ echo '--> load.s'
\ yasm -o objs/kernel.arch.x86_64.boot.load.o ../kernel/arch/x86_64/boot/load.s -felf64
\ echo '--> trampoline.s'
echo ; \ yasm -o objs/kernel.arch.x86_64.boot.trampoline.o ../kernel/arch/x86_64/boot/trampoline.s -felf64 -g stabs
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; \
\

0 comments on commit 10b0994

Please sign in to comment.