mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
reodering of the directory structure
This commit is contained in:
parent
ef24d2a880
commit
dfd4272d59
298 changed files with 235 additions and 252 deletions
34
.gitignore
vendored
34
.gitignore
vendored
|
@ -11,3 +11,37 @@ autom4te.cache
|
|||
*.pyc
|
||||
*.callgrind
|
||||
*.xray
|
||||
*.o
|
||||
*.a
|
||||
*.dep
|
||||
*~
|
||||
*.elf
|
||||
*.elf32
|
||||
*.sym
|
||||
*.bin
|
||||
qemu-vlan0.pcap
|
||||
autom4te.cache
|
||||
documentation/html/
|
||||
include/hermit/config.inc
|
||||
tools/proxy
|
||||
usr/tests/hello
|
||||
usr/tests/hello++
|
||||
usr/tests/hellof
|
||||
usr/tests/jacobi
|
||||
usr/tests/thr_hello
|
||||
usr/tests/pi
|
||||
usr/tests/RCCE_minimum
|
||||
usr/tests/signals
|
||||
usr/tests/server
|
||||
usr/benchmarks/RCCE_pingping
|
||||
usr/benchmarks/RCCE_pingpong
|
||||
usr/benchmarks/stream
|
||||
usr/benchmarks/hg
|
||||
usr/benchmarks/netio
|
||||
usr/benchmarks/basic
|
||||
usr/openmpbench/schedbench
|
||||
usr/openmpbench/syncbench
|
||||
usr/openmpbench/taskbench
|
||||
usr/x86/
|
||||
usr/tmp/
|
||||
arch/x86/kernel/boot.h
|
||||
|
|
24
.gitmodules
vendored
24
.gitmodules
vendored
|
@ -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
|
||||
|
|
199
Makefile.in
199
Makefile.in
|
@ -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:
|
||||
make -C hermit veryclean
|
||||
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
|
||||
|
||||
.PHONY: default all clean veryclean test
|
||||
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 $@ $<
|
||||
|
||||
.PHONY: default all clean qemu gdb usr test toolchain tools
|
||||
|
||||
include $(addsuffix /Makefile,$(SUBDIRS))
|
||||
|
|
10
README.md
10
README.md
|
@ -64,7 +64,7 @@ On Debian-based systems the packets can be installed by executing:
|
|||
2. Install the Linux kernel and its initial ramdisk on your system (see descriptions of your Linux distribution).
|
||||
We recommend to disable Linux NO_HZ feature by setting the kernel parameter `nohz=off`.
|
||||
3. After a reboot of the system, register the HermitCore loader at your system with following command: `echo ":hermit:M:7:\\x42::/path2proyxy/proxy:" > /proc/sys/fs/binfmt_misc/register`, in which `path2proxy` defines the path to the loader.
|
||||
You find the loader `proxy` after building the HermiCore sources in the subdirectory `hermit/tools` of the directory, which contains this *README*.
|
||||
You find the loader `proxy` after building the HermiCore sources in the subdirectory `tools` of the directory, which contains this *README*.
|
||||
4. The IP device between HermitCore and Linux currently does not support IPv6.
|
||||
Consequently, disable IPv6 by adding following line to `/etc/sysctl.conf`: `net.ipv6.conf.mmnif.disable_ipv6 = 1`.
|
||||
5. Per default, the IP device uses a static IP address range.
|
||||
|
@ -81,7 +81,7 @@ NM_CONTROLLED=yes
|
|||
```
|
||||
Finally, follow the [above tutorial](#building-and-testing-hermitcore-within-a-virtual-machine) from Step 5.
|
||||
|
||||
The demo applications are located in their subdirectories `hermit/usr/{tests,benchmarks}`.
|
||||
The demo applications are located in their subdirectories `usr/{tests,benchmarks}`.
|
||||
|
||||
## Builting and testing HermitCore as classical standalone unikernel
|
||||
|
||||
|
@ -106,13 +106,13 @@ The connection to the system monitor used automatically `HERMIT_PORT+1`, i.e., t
|
|||
|
||||
The following example starts the stream benchmark in a virtual machine, which has 4 cores and 6GB memory.
|
||||
```
|
||||
HERMIT_ISLE=qemu HERMIT_CPUS=4 HERMIT_MEM=6G hermit/usr/benchmarks/stream
|
||||
HERMIT_ISLE=qemu HERMIT_CPUS=4 HERMIT_MEM=6G usr/benchmarks/stream
|
||||
```
|
||||
|
||||
## Building HermitCore applications
|
||||
|
||||
After successful building of HermitCore and its demo applications (see above), HermitCore’s cross toolchain (*gcc*, *g++*, *gfortran*, *gccgo*, *objdump*, etc.) is located at the subdiretory `hermit/usr/x86` of the directory, which contains this *README*.
|
||||
To use these tools, add `hermit/usr/x86/bin` to your environment variable `PATH`.
|
||||
After successful building of HermitCore and its demo applications (see above), HermitCore’s cross toolchain (*gcc*, *g++*, *gfortran*, *gccgo*, *objdump*, etc.) is located at the subdiretory `usr/x86` of the directory, which contains this *README*.
|
||||
To use these tools, add `usr/x86/bin` to your environment variable `PATH`.
|
||||
As with any other cross toolchain, the tool names begin with the target architecture (*x86_64*) and the name of the operating system (*hermit*).
|
||||
For instance, `x86_64-hermit-gcc` stands for the GNU C compiler, which is able to build HermitCore applications.
|
||||
|
||||
|
|
3
configure
vendored
3
configure
vendored
|
@ -1727,8 +1727,7 @@ done
|
|||
|
||||
# Checks for library functions.
|
||||
|
||||
cp config/linux_config linux/.config
|
||||
CROSSDIR=`pwd`/hermit/usr/x86/bin
|
||||
CROSSDIR=`pwd`/usr/x86/bin
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@ AC_CHECK_PROGS(QEMU, qemu-system-x86_64)
|
|||
|
||||
# Checks for library functions.
|
||||
|
||||
cp config/linux_config linux/.config
|
||||
CROSSDIR=`pwd`/hermit/usr/x86/bin
|
||||
CROSSDIR=`pwd`/usr/x86/bin
|
||||
AC_SUBST(CROSSDIR)
|
||||
|
||||
AC_ARG_WITH([mtune],
|
||||
|
|
34
hermit/.gitignore
vendored
34
hermit/.gitignore
vendored
|
@ -1,34 +0,0 @@
|
|||
*.o
|
||||
*.a
|
||||
*.dep
|
||||
*~
|
||||
*.elf
|
||||
*.elf32
|
||||
*.sym
|
||||
*.bin
|
||||
qemu-vlan0.pcap
|
||||
autom4te.cache
|
||||
documentation/html/
|
||||
include/hermit/config.inc
|
||||
tools/proxy
|
||||
usr/tests/hello
|
||||
usr/tests/hello++
|
||||
usr/tests/hellof
|
||||
usr/tests/jacobi
|
||||
usr/tests/thr_hello
|
||||
usr/tests/pi
|
||||
usr/tests/RCCE_minimum
|
||||
usr/tests/signals
|
||||
usr/tests/server
|
||||
usr/benchmarks/RCCE_pingping
|
||||
usr/benchmarks/RCCE_pingpong
|
||||
usr/benchmarks/stream
|
||||
usr/benchmarks/hg
|
||||
usr/benchmarks/netio
|
||||
usr/benchmarks/basic
|
||||
usr/openmpbench/schedbench
|
||||
usr/openmpbench/syncbench
|
||||
usr/openmpbench/taskbench
|
||||
usr/x86/
|
||||
usr/tmp/
|
||||
arch/x86/kernel/boot.h
|
178
hermit/Makefile
178
hermit/Makefile
|
@ -1,178 +0,0 @@
|
|||
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')
|
||||
INITRAMFS=../../busybox-1.23.2/initramfs/
|
||||
|
||||
# Set your own cross compiler tool chain prefix here
|
||||
CROSSCOMPREFIX = x86_64-hermit
|
||||
STACKPROT = -fno-stack-protector
|
||||
|
||||
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)
|
||||
|
||||
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 $@ $<
|
||||
|
||||
.PHONY: default all clean emu gdb usr toolchain tools
|
||||
|
||||
include $(addsuffix /Makefile,$(SUBDIRS))
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 9ba109795f17376ea5dde09656de9b9c841819c5
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue