forked from teawater/libhermit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reodering of the directory structure
- Loading branch information
Showing
298 changed files
with
235 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
[submodule "hermit/usr/gcc"] | ||
path = hermit/usr/gcc | ||
[submodule "usr/gcc"] | ||
path = usr/gcc | ||
url = https://github.com/RWTH-OS/gcc.git | ||
branch = hermit | ||
[submodule "hermit/usr/binutils"] | ||
path = hermit/usr/binutils | ||
[submodule "usr/binutils"] | ||
path = usr/binutils | ||
url = https://github.com/RWTH-OS/binutils.git | ||
branch = hermit | ||
[submodule "hermit/usr/pte"] | ||
path = hermit/usr/pte | ||
[submodule "usr/pte"] | ||
path = usr/pte | ||
url = https://github.com/RWTH-OS/pthread-embeded.git | ||
branch = hermit | ||
[submodule "hermit/usr/newlib"] | ||
path = hermit/usr/newlib | ||
[submodule "usr/newlib"] | ||
path = usr/newlib | ||
url = https://github.com/RWTH-OS/newlib.git | ||
branch = hermit | ||
[submodule "hermit/lwip"] | ||
path = hermit/lwip | ||
[submodule "lwip"] | ||
path = lwip | ||
url = https://github.com/RWTH-OS/LwIP.git | ||
branch = hermit | ||
[submodule "hermit/usr/libomp"] | ||
path = hermit/usr/libomp | ||
[submodule "usr/libomp"] | ||
path = usr/libomp | ||
url = https://github.com/RWTH-OS/libomp_oss.git | ||
branch = hermit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,197 @@ | ||
TERM = xterm | ||
TOPDIR := $(shell pwd) | ||
ARCH = x86 | ||
NAME = libhermit.a | ||
DRIVERDIRS = drivers/net | ||
LWIPDIRS = lwip/src/arch lwip/src/api lwip/src/core lwip/src/core/ipv4 lwip/src/core/ipv6 lwip/src/netif | ||
KERNDIRS = kernel mm libkern arch/$(ARCH)/kernel arch/$(ARCH)/mm $(LWIPDIRS) $(DRIVERDIRS) | ||
SUBDIRS = $(KERNDIRS) | ||
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags) | ||
TODAY := $(shell date +'%Y%m%d') | ||
QEMU = @QEMU@ -machine accel=kvm -cpu host | ||
CROSSDIR = @CROSSDIR@ | ||
JOBS = $(shell nproc) | ||
ARCH_OPT = @ARCH_OPT@ | ||
|
||
default: | ||
make PATH=$(PATH):$(CROSSDIR) ARCH_OPT="$(ARCH_OPT)" -C hermit | ||
make PATH=$(PATH):$(CROSSDIR) ARCH_OPT="$(ARCH_OPT)" -C hermit/tools proxy | ||
# add path to the cross toolchain | ||
PATH:=$(PATH):$(CROSSDIR) | ||
|
||
travis: | ||
make PATH=$(PATH):$(CROSSDIR) ARCH_OPT="$(ARCH_OPT)" -C hermit | ||
make PATH=$(PATH):$(CROSSDIR) ARCH_OPT="$(ARCH_OPT)" -C hermit/tools proxy | ||
# Set your own cross compiler tool chain prefix here | ||
CROSSCOMPREFIX = x86_64-hermit | ||
STACKPROT = -fno-stack-protector | ||
|
||
all: default | ||
FC_FOR_TARGET = $(CROSSCOMPREFIX)-gfortran | ||
CC_FOR_TARGET = $(CROSSCOMPREFIX)-gcc | ||
GO_FOR_TARGET = $(CROSSCOMPREFIX)-gccgo | ||
CXX_FOR_TARGET = $(CROSSCOMPREFIX)-g++ | ||
GCC_FOR_TARGET = $(CROSSCOMPREFIX)-gcc | ||
CPP_FOR_TARGET = $(CROSSCOMPREFIX)-cpp | ||
AR_FOR_TARGET = $(CROSSCOMPREFIX)-ar | ||
AS_FOR_TARGET = $(CROSSCOMPREFIX)-as | ||
LD_FOR_TARGET = $(CROSSCOMPREFIX)-ld | ||
NM_FOR_TARGET = $(CROSSCOMPREFIX)-nm | ||
OBJDUMP_FOR_TARGET = $(CROSSCOMPREFIX)-objdump | ||
OBJCOPY_FOR_TARGET = $(CROSSCOMPREFIX)-objcopy | ||
RANLIB_FOR_TARGET = $(CROSSCOMPREFIX)-ranlib | ||
STRIP_FOR_TARGET = $(CROSSCOMPREFIX)-strip | ||
READELF_FOR_TARGET = $(CROSSCOMPREFIX)-readelf | ||
ELFEDIT_FOR_TARGET = $(CROSSCOMPREFIX)-elfedit | ||
|
||
MAKE = make | ||
NASM = nasm | ||
NASMFLAGS = -felf64 -g -i$(TOPDIR)/include/hermit/ | ||
|
||
INCLUDE = -I$(TOPDIR)/include -I$(TOPDIR)/arch/$(ARCH)/include -I$(TOPDIR)/lwip/src/include -I$(TOPDIR)/drivers | ||
CFLAGS = -DVERSION=\"$(GIT_VERSION)\" -g -m64 -Wall -O2 -mno-red-zone -fno-var-tracking-assignments -fstrength-reduce -fomit-frame-pointer -finline-functions -ffreestanding -nostdinc -fno-stack-protector -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fno-delete-null-pointer-checks -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mskip-rax-setup -fno-common -Wframe-larger-than=1024 -fno-strict-aliasing -fno-asynchronous-unwind-tables -fno-strict-overflow -maccumulate-outgoing-args $(INCLUDE) | ||
AR = ar | ||
ARFLAGS = rsv | ||
RM = rm -rf | ||
OUTPUT_FORMAT = -O elf64-x86-64-hermit | ||
|
||
# Additional flags for profiling using Xray | ||
PROFILING_LDFLAGS = | ||
PROFILING_CFLAGS = | ||
|
||
ifdef PROFILING | ||
PROFILING_LDFLAGS = -lxray | ||
|
||
PROFILING_CFLAGS = -falign-functions=32 -finstrument-functions | ||
PROFILING_CFLAGS += -finstrument-functions-exclude-function-list=_mm_pause,_mm_setcsr,_mm_getcsr # we need this for libiomp to work | ||
PROFILING_CFLAGS += -DXRAY -DXRAY_DISABLE_BROWSER_INTEGRATION -DXRAY_NO_DEMANGLE | ||
PROFILING_CFLAGS += -DXRAY_ANNOTATE | ||
endif | ||
|
||
CFLAGS_FOR_NEWLIB = -m64 -mtls-direct-seg-refs -O3 -ftree-vectorize $(ARCH_OPT) #$(STACKPROT) | ||
GOFLAGS_FOR_NEWLIB = -m64 -mtls-direct-seg-refs -O3 -ftree-vectorize $(ARCH_OPT) | ||
FCFLAGS_FOR_NEWLIB = -m64 -mtls-direct-seg-refs -O3 -ftree-vectorize $(ARCH_OPT) | ||
FFLAGS_FOR_NEWLIB = -m64 -mtls-direct-seg-refs -O3 -ftree-vectorize $(ARCH_OPT) | ||
CXXFLAGS_FOR_NEWLIB = -m64 -mtls-direct-seg-refs -O3 -ftree-vectorize $(ARCH_OPT) | ||
LDFLAGS_FOR_NEWLIB = | ||
NASMFLAGS_FOR_NEWLIB = -felf64 | ||
CFLAGS_FOR_TOOLS = -O2 -Wall -std=gnu99 | ||
LDFLAGS_FOR_TOOLS = | ||
|
||
# Prettify output | ||
V = 0 | ||
ifeq ($V,0) | ||
Q = @ | ||
P = > /dev/null | ||
endif | ||
|
||
|
||
default: all | ||
|
||
all: arch/x86/kernel/boot.h bootstrap $(NAME) toolchain tools loader | ||
|
||
toolchain: | ||
$Q$(MAKE) ARCH=$(ARCH) \ | ||
LDFLAGS_FOR_TARGET="$(LDFLAGS_FOR_NEWLIB)" \ | ||
GOFLAGS_FOR_TARGET="$(GOFLAGS_FOR_NEWLIB)" \ | ||
CFLAGS_FOR_TARGET="$(CFLAGS_FOR_NEWLIB)" \ | ||
FFLAGS_FOR_TARGET="$(FFLAGS_FOR_NEWLIB)" \ | ||
FCFLAGS_FOR_TARGET="$(FCFLAGS_FOR_NEWLIB)" \ | ||
FCFLAGS="$(FCFLAGS_FOR_NEWLIB)" \ | ||
CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_NEWLIB)" \ | ||
NASMFLAGS="$(NASMFLAGS_FOR_NEWLIB)" \ | ||
CC_FOR_TARGET=$(CC_FOR_TARGET) \ | ||
GO_FOR_TARGET=$(GO_FOR_TARGET) \ | ||
FC_FOR_TARGET=$(FC_FOR_TARGET) \ | ||
CXX_FOR_TARGET=$(CXX_FOR_TARGET) \ | ||
GCC_FOR_TARGET=$(GCC_FOR_TARGET) \ | ||
AR_FOR_TARGET=$(AR_FOR_TARGET) \ | ||
AS_FOR_TARGET=$(AS_FOR_TARGET) \ | ||
LD_FOR_TARGET=$(LD_FOR_TARGET) \ | ||
NM_FOR_TARGET=$(NM_FOR_TARGET) \ | ||
OBJDUMP_FOR_TARGET=$(OBJDUMP_FOR_TARGET) \ | ||
OBJCOPY_FOR_TARGET=$(OBJCOPY_FOR_TARGET) \ | ||
RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET) \ | ||
STRIP_FOR_TARGET=$(STRIP_FOR_TARGET) \ | ||
ELFEDIT_FOR_TARGET=$(ELFEDIT_FOR_TARGET) \ | ||
READELF_FOR_TARGET=$(READELF_FOR_TARGET) \ | ||
PROFILING_CFLAGS="$(PROFILING_CFLAGS)" \ | ||
PROFILING_LDFLAGS="$(PROFILING_LDFLAGS)" -C usr toolchain | ||
|
||
bootstrap: | ||
$Q$(MAKE) ARCH=$(ARCH) CFLAGS="" LDFLAGS="" -C usr bootstrap | ||
|
||
tools: | ||
$Q$(MAKE) ARCH=$(ARCH) CFLAGS="$(CFLAGS_FOR_TOOLS)" LDFLAGS="$(LDFLAGS_FOR_TOOLS)" -C tools | ||
|
||
loader: | ||
$Q$(MAKE) -C arch/$(ARCH)/loader | ||
|
||
$(NAME): | ||
@echo [AR] $(NAME) | ||
$Q$(AR_FOR_TARGET) $(ARFLAGS) -o $(NAME) $^ | ||
$Q$(OBJCOPY_FOR_TARGET) --rename-section .bss=.kbss --rename-section .text=.ktext --rename-section .data=.kdata $(NAME) $(TOPDIR)/usr/$(ARCH)/$(CROSSCOMPREFIX)/lib/$(NAME) | ||
|
||
test: | ||
. ./test.sh | ||
|
||
qemu: | ||
$(QEMU) -smp 10 -m 8G -numa node,nodeid=0,cpus=0-4 -numa node,nodeid=1,cpus=5-9 \ | ||
-kernel config/bzImage \ | ||
-append "root=/dev/ram0 rootfstype=ramfs init=init console=ttyS0" \ | ||
-net nic,model=rtl8139 -net user -net dump \ | ||
-nographic -monitor telnet:127.0.0.1:1235,server,nowait \ | ||
-fsdev local,security_model=none,id=fsdev0,path=$(shell realpath hermit) \ | ||
-device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hermit \ | ||
-s | ||
-kernel config/bzImage \ | ||
-append "root=/dev/ram0 rootfstype=ramfs init=init console=ttyS0" \ | ||
-net nic,model=rtl8139 -net user -net dump \ | ||
-nographic -monitor telnet:127.0.0.1:1235,server,nowait \ | ||
-fsdev local,security_model=none,id=fsdev0,path=$(shell realpath .) \ | ||
-device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hermit \ | ||
-s | ||
|
||
clean: | ||
make -C hermit clean | ||
$Q$(RM) $(NAME) $(NAME).sym $(NAME).bin *~ | ||
$Q$(MAKE) -C tools clean | ||
$Q$(MAKE) -C usr clean | ||
$Q$(MAKE) -C arch/$(ARCH)/loader clean | ||
@echo Cleaned. | ||
|
||
veryclean: clean | ||
$Q$(RM) qemu-vlan0.pcap include/hermit/config.inc | ||
$Q$(MAKE) -C tools veryclean | ||
$Q$(MAKE) -C usr veryclean | ||
$Q$(MAKE) -C arch/$(ARCH)/loader veryclean | ||
@echo Very cleaned | ||
|
||
doc: | ||
@echo Create documentation... | ||
@doxygen | ||
|
||
%.o : %.c | ||
@echo [CC] $@ | ||
$Q$(CC_FOR_TARGET) -c -D__KERNEL__ $(CFLAGS) -o $@ $< | ||
@echo [DEP] $*.dep | ||
$Q$(CC_FOR_TARGET) -MF $*.dep -MT $*.o -MM $(CFLAGS) $< | ||
|
||
arch/x86/kernel/boot.bin: arch/x86/kernel/boot.asm | ||
@echo " NASM $@" | ||
$Q$(NASM) -fbin -o $@ $< | ||
|
||
arch/x86/kernel/boot.h: arch/x86/kernel/boot.bin | ||
@echo " HEXDUMP $@" | ||
$Qecho "static const uint8_t boot_code[] = { \ | ||
$(shell hexdump -v -e '"0x" 1/1 "%02X" ", "' $<) \ | ||
};" > $@ | ||
|
||
include/hermit/config.inc: include/hermit/config.h | ||
@echo "; This file is generated automatically from the config.h file." > include/hermit/config.inc | ||
@echo "; Before editing this, you should consider editing config.h." >> include/hermit/config.inc | ||
@awk '/^#define MAX_CORES/{ print "%define MAX_CORES", $$3 }' include/hermit/config.h >> include/hermit/config.inc | ||
@awk '/^#define KERNEL_STACK_SIZE/{ print "%define KERNEL_STACK_SIZE", $$3 }' include/hermit/config.h >> include/hermit/config.inc | ||
@awk '/^#define VIDEO_MEM_ADDR/{ print "%define VIDEO_MEM_ADDR", $$3 }' include/hermit/config.h >> include/hermit/config.inc | ||
@awk '/^#define CONFIG_VGA/{ print "%define CONFIG_VGA", $$3 }' include/hermit/config.h >> include/hermit/config.inc | ||
@awk '/^#define DYNAMIC_TICKS/{ print "%define DYNAMIC_TICKS", $$3 }' include/hermit/config.h >> include/hermit/config.inc | ||
@awk '/^#define SAVE_FPU/{ print "%define SAVE_FPU", $$3 }' include/hermit/config.h >> include/hermit/config.inc | ||
|
||
%.o : %.asm include/hermit/config.inc | ||
@echo [ASM] $@ | ||
$Q$(NASM) $(NASMFLAGS) -o $@ $< | ||
$Q$(ELFEDIT_FOR_TARGET) --output-osabi HermitCore $@ | ||
#$Q$(OBJCOPY_FOR_TARGET) $(OUTPUT_FORMAT) $@ | ||
|
||
%.o : %.S | ||
@echo [GCC-ASM] $@ | ||
$Q$(CC_FOR_TARGET) $(CFLAGS) -c -o $@ $< | ||
|
||
veryclean: | ||
make -C hermit veryclean | ||
.PHONY: default all clean qemu gdb usr test toolchain tools | ||
|
||
.PHONY: default all clean veryclean test | ||
include $(addsuffix /Makefile,$(SUBDIRS)) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.