diff --git a/.gitignore b/.gitignore index cae77b40..58b85b29 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ Makefile include/metalsvm/config.h include/metalsvm/config.inc tools/make_initrd +tools/scc_bootinfo.asm newlib/examples/hello newlib/examples/jacobi newlib/examples/echo diff --git a/Makefile.scc b/Makefile.scc index ed5cc5d6..7eeb59ad 100644 --- a/Makefile.scc +++ b/Makefile.scc @@ -12,10 +12,6 @@ STACKPROT = -fno-stack-protector # Set your own cross compiler tool chain prefix here CROSSCOMPREFIX = -# Uncomment both lines if compiling for the SCC! -CROSSCOMPREFIX = i386-unknown-linux-gnu- -STACKPROT = - CC_FOR_TARGET = $(CROSSCOMPREFIX)gcc CXX_FOR_TARGET = $(CROSSCOMPREFIX)g++ GCC_FOR_TARGET = $(CROSSCOMPREFIX)gcc @@ -42,7 +38,7 @@ NASMFLAGS = -felf32 -g -i$(TOPDIR)/include/metalsvm/ INCLUDE = -I$(TOPDIR)/include -I$(TOPDIR)/arch/$(ARCH)/include -I$(TOPDIR)/lwip/src/include -I$(TOPDIR)/lwip/src/include/ipv4 -I$(TOPDIR)/drivers # For 64bit support, you have to define "-m64 -mno-red-zone" instead of "-m32 -march=i586" # Compiler options for final code -CFLAGS = -g -m32 -march=i586 -Wall -O2 -fstrength-reduce -fomit-frame-pointer -finline-functions -ffreestanding $(INCLUDE) $(STACKPROT) +CFLAGS = -g -m32 -march=i586 -mtune=i586 -Wall -O2 -fstrength-reduce -fomit-frame-pointer -finline-functions -ffreestanding $(INCLUDE) $(STACKPROT) # Compiler options for debuging #CFLAGS = -g -O -m32 -march=i586 -Wall -fomit-frame-pointer -ffreestanding $(INCLUDE) $(STACKPROT) ARFLAGS = rsv @@ -51,7 +47,7 @@ STRIP_DEBUG = --strip-debug KEEP_DEBUG = --only-keep-debug OUTPUT_FORMAT = -O elf32-i386 # For 64bit support, you have to define -m64 instead of "-m32 -march=i586" -CFLAGS_FOR_NEWLIB = -m32 -march=i586 -O2 $(STACKPROT) +CFLAGS_FOR_NEWLIB = -m32 -march=i586 -mtune=i586 -O2 $(STACKPROT) # For 64bit support, you have to define -m64 instead of "-m32 -march=i586" LDFLAGS_FOR_NEWLIB = -m32 -march=i586 # For 64bit support, you have to define -m64 instead of "-m32" diff --git a/tools/Makefile b/tools/Makefile index cfd2db1b..e57293fa 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,10 +1,10 @@ MAKE = make CC = gcc -CROSS_COMPILE=i386-unknown-linux-gnu-gcc -CROSS_OBJCOPY=i386-unknown-linux-gnu-objcopy +CROSS_COMPILE=gcc +CROSS_OBJCOPY=objcopy CFLAGS = -m32 -O2 -Wall LDFLGAS = -DEFINES= +DEFINES = NASM = nasm NASMFLAGS = -fbin EXECFILES = $(shell find ../newlib/examples -perm -u+r+x -type f) @@ -33,6 +33,9 @@ smp_setup.hex: smp_setup.bin scc_setup.bin: scc_setup.asm $(NASM) $(NASMFLAGS) -o $@ $< +reset_vector.o: reset_vector.S + gcc -m32 -c -o reset_vector.o reset_vector.S + reset_vector.bin: reset_vector.o ld --oformat binary -Ttext 0 -melf_i386 -o $@ $< diff --git a/tools/reset_vector.S b/tools/reset_vector.S index 944e8c29..090b80f2 100644 --- a/tools/reset_vector.S +++ b/tools/reset_vector.S @@ -3,6 +3,8 @@ * Copyright (c) 2004 Fabrice Bellard */ +// MetalSVM reuses the same routine to launch its preloaded kernel + #define LOAD_SEG 0x9000 // define CONFIG_MCEMU_DEBUG 1 .code16 @@ -36,4 +38,4 @@ _realstart: _start: jmp _realstart _end: - .fill 4096 - _end, 1, 0 + .fill 4096 - $, 1, 0