modify include lines and Makefiles

This commit is contained in:
Tomoki Shirasawa
2012-12-17 16:10:56 +09:00
parent 6ff27458f4
commit 0a808057eb
47 changed files with 139 additions and 135 deletions

View File

@ -1,28 +1,29 @@
CFLAGS=-c -Wall -O
CFLAGS_TEST=-DTEST
all: elfboot elfboot_test
all: elfboot
elfboot: elfboot.bin
cp $^ $@
truncate -s $(shell expr '(' `stat -c '%s' $^` + 4095 ')' / 4096 '*' 4096) $@
elfboot.bin: elfboot.elf
objcopy -O binary $^ $@
$(OBJCOPY) -O binary $^ $@
elfboot.elf: head.o elfboot.raw.o raw.lds
ld $(LDFLAGS_RAW) -T raw.lds -o $@ $^
$(LD) $(LDFLAGS_RAW) -T raw.lds -o $@ $^
elfboot_test: elfboot.test.o test_main.o
gcc $(LDFLAGS) -o $@ $^
$(CC) -o $@ $^
elfboot.raw.o: elfboot.c
gcc $(CFLAGS) -o $@ $^
$(CC) $(CFLAGS) -o $@ $^
elfboot.test.o: elfboot.c
gcc $(CFLAGS) $(CFLAGS_TEST) -o $@ $^
$(CC) $(CFLAGS) $(CFLAGS_TEST) -o $@ $^
clean:
$(RM) elfboot *.bin *.elf elfboot_test *.o
disas:
objdump -b binary -m i386:x86-64 -D elfboot.bin
$(OBJDUMP) -b binary -m i386:x86-64 -D elfboot.bin

View File

@ -1,5 +1,5 @@
#include <aal/cpu.h>
#include <aal/debug.h>
#include <ihk/cpu.h>
#include <ihk/debug.h>
#include <types.h>
#include <errno.h>
#include <list.h>

View File

@ -4,7 +4,7 @@
#ifndef __HEADER_X86_COMMON_ARCH_LOCK
#define __HEADER_X86_COMMON_ARCH_LOCK
#include <aal/cpu.h>
#include <ihk/cpu.h>
//#define DEBUG_SPINLOCK

View File

@ -1,7 +1,7 @@
#ifndef HEADER_X86_COMMON_AAL_IKC_H
#define HEADER_X86_COMMON_AAL_IKC_H
#include <ikc/aal.h>
#include <ikc/ihk.h>
/* manycore side */
int aal_mc_ikc_init_first(struct aal_ikc_channel_desc *,

View File

@ -1,8 +1,8 @@
#include <cpulocal.h>
#include <aal/atomic.h>
#include <aal/mm.h>
#include <aal/cpu.h>
#include <aal/debug.h>
#include <ihk/atomic.h>
#include <ihk/mm.h>
#include <ihk/cpu.h>
#include <ihk/debug.h>
#include <registers.h>
#include <string.h>

View File

@ -1,4 +1,4 @@
#include <aal/lock.h>
#include <ihk/lock.h>
#if 0

View File

@ -1,6 +1,6 @@
#include <aal/cpu.h>
#include <aal/debug.h>
#include <aal/mm.h>
#include <ihk/cpu.h>
#include <ihk/debug.h>
#include <ihk/mm.h>
#include <types.h>
#include <memory.h>
#include <string.h>

View File

@ -1,5 +1,5 @@
#include <aal/ikc.h>
#include <aal/lock.h>
#include <ihk/ikc.h>
#include <ihk/lock.h>
#include <ikc/msg.h>
#include <memory.h>
#include <string.h>

View File

@ -1,7 +1,7 @@
#include <aal/perfctr.h>
#include <ihk/perfctr.h>
#include <march.h>
#include <errno.h>
#include <aal/debug.h>
#include <ihk/debug.h>
#include <registers.h>
extern unsigned int *x86_march_perfmap;

View File

@ -1,17 +1,12 @@
#ifeq ($(K),"current")
KDIR=/lib/modules/`uname -r `/build
#else
#KDIR=../target
#endif
KDIR ?= /lib/modules/`uname -r `/build
obj-m += mcctrl.o
mcctrl-objs := driver.o control.o ikc.o syscall.o
AALBASE ?= $(src)/../../../aal
EXTRA_CFLAGS = -I$(AALBASE)/host/include -I$(AALBASE)/host/driver/knf -I$(AALBASE)/include -I$(AALBASE)/ikc/include -I$(src)/../include
IHK_BASE=$(src)/../../../ihk
EXTRA_CFLAGS = -I$(IHK_BASE)/linux/include -I$(IHK_BASE)/ikc/include -I$(IHK_BASE)/include -I$(src)/../include
KBUILD_EXTRA_SYMBOLS = $(IHK_BASE)/linux/core/Module.symvers
.PHONY: clean install

View File

@ -8,7 +8,6 @@
#include <asm/delay.h>
#include <asm/msr.h>
#include <asm/io.h>
#include <sysdeps/knf/mic/mic_type.h>
#include "mcctrl.h"
#ifdef DEBUG

View File

@ -7,7 +7,6 @@
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/slab.h>
#include <sysdeps/knf/mic/mic_type.h>
#include "mcctrl.h"
extern long __mcctrl_control(aal_os_t, unsigned int, unsigned long);

View File

@ -4,9 +4,9 @@
#include <linux/miscdevice.h>
#include <linux/slab.h>
#include "mcctrl.h"
#include <aal/ikc.h>
#include <ihk/ikc.h>
#include <ikc/master.h>
#include <sysdeps/knf/mic/micconst.h>
#include <sysdeps/mic/mic/micconst.h>
#define REQUEST_SHIFT 16

View File

@ -1,7 +1,7 @@
#ifndef HEADER_MCCTRL_H
#define HEADER_MCCTRL_H
#include <aal/aal_host_driver.h>
#include <ihk/ihk_host_driver.h>
#include <uprotocol.h>
#include <linux/wait.h>

View File

@ -1,9 +1,16 @@
CFLAGS = -O3 -Wall -g -pthread
#CC=/usr/linux-k1om-4.7/bin/x86_64-k1om-linux-gcc
CC=gcc
CFLAGS=-Wall -O
TARGET=mcexec
all: mcexec
all: $(TARGET)
mcexec: mcexec.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $^ $(EXTRA_OBJS)
$(CC) $(CFLAGS) -pthread -o $@ $^
clean:
rm -f mcexec
$(RM) $(TARGET) *.o
.PHONY: all clean

View File

@ -1,8 +1,8 @@
#BUILD_TARGET = mee knf
BUILD_TARGET = knf
#BUILD_TARGET = builtin-mic attached-mic
BUILD_TARGET = attached-mic
SRC = $(CURDIR)
AALBASE ?= $(SRC)/../../aal/manycore
IHKBASE ?= $(SRC)/../../ihk/cokernel
O ?= $(KBUILD_OUTPUT)
V ?= $(VERBOSE)
@ -12,8 +12,8 @@ KERNELS = $(addsuffix /$(KERNEL),$(addprefix $(O)/,$(BUILD_TARGET)))
SUBCMD_OPTS = V='$(V)'
$(if $(O),,$(error Specify the compilation target directory))
$(if $(shell ls $(AALBASE)/Makefile),,\
$(error AAL is not found in $(AALBASE)))
#$(if $(shell ls $(IHKBASE)/Makefile),,\
# $(error IHK is not found in $(IHKBASE)))
.PHONY: all clean depend
@ -26,8 +26,9 @@ all: $(KERNELS)
%/Makefile: Makefile.build FORCE
@mkdir -p $(dir $@)
@echo 'SRC = $(SRC)' > $@
@echo 'AALBASE = $(AALBASE)' >> $@
@echo 'IHKBASE = $(IHKBASE)' >> $@
@echo 'TARGET = $(notdir $(patsubst %/,%,$(dir $@)))' >> $@
@echo 'TARGETDIR = $$(shell echo $$(TARGET) | sed "s/-/\//")' >> $@
@cat Makefile.build >> $@
@rm -f $(dir $@)/Makefile.dep

View File

@ -1,42 +1,44 @@
AALDIR=$(AALBASE)/$(TARGET)
IHKDIR=$(IHKBASE)/$(TARGETDIR)
OBJS = init.o mem.o debug.o mikc.o listeners.o ap.o syscall.o cls.o host.o
OBJS += process.o copy.o waitq.o futex.o timer.o
DEPSRCS=$(wildcard $(SRC)/*.c)
CFLAGS += -I$(SRC)/include -mcmodel=kernel -D__KERNEL__
LDFLAGS += -e arch_start
AALOBJ = aal/aal.o
IHKOBJ = ihk/ihk.o
include $(SRC)/configs/config.$(TARGET)
include $(AALBASE)/Makefile.common
include $(SRC)/config/config.$(TARGET)
include $(IHKBASE)/Makefile.common
SUBCMD_OPTS = TARGET=$(TARGET) O=$(CURDIR)/aal CC=$(CC) LD=$(LD)
# CFLAGS += -I$(SRC)/../arch/$(IHKARCH)/kernel/include -I$(SRC)/../lib/include
SUBCMD_OPTS = TARGET=$(TARGET) O=$(CURDIR)/ihk CC=$(CC) LD=$(LD) SRC=$(SRC)
ld_kern_cmd_base = $(LD) $(LDFLAGS) -o $@.elf $^
mkimage_cmd_base = [ -f $(SRC)/scripts/mkimage.$(TARGET) ] && CC=$(CC) LD=$(LD) LDFLAGS="$(LDFLAGS_MKIMAGE)" sh $(SRC)/scripts/mkimage.$(TARGET) '$@.elf' '$@' '$(SRC)' || cp $@.elf $@
mkimage_cmd_base = [ -f $(SRC)/script/mkimage.$(TARGET) ] && CC=$(CC) LD=$(LD) LDFLAGS="$(LDFLAGS_MKIMAGE)" OBJDUMP=$(OBJDUMP) OBJCOPY=$(OBJCOPY) sh $(SRC)/script/mkimage.$(TARGET) '$@.elf' '$@' '$(SRC)' || cp $@.elf $@
ld_kern_cmd = $(call echo_cmd,LDKERN,$@)$(ld_kern_cmd_base)
mkimage_cmd = $(call echo_cmd,MKIMAGE,$@)$(mkimage_cmd_base)
all: depend kernel.img
kernel.img: $(OBJS) $(AALOBJ)
kernel.img: $(OBJS) $(IHKOBJ)
$(ld_kern_cmd)
$(mkimage_cmd)
clean:
$(rm_cmd) $(OBJS) kernel.img kernel.img.elf Makefile.dep
@$(submake) -C $(AALBASE) $(SUBCMD_OPTS) clean
@$(submake) -C $(IHKBASE) $(SUBCMD_OPTS) clean
depend: Makefile.dep
Makefile.dep:
$(call dep_cmd,$(DEPSRCS))
$(AALOBJ): FORCE
@mkdir -p $(dir $(AALOBJ))
$(call echo_cmd,BUILD AAL,$(TARGET))$(submake) -C $(AALBASE) $(SUBCMD_OPTS) prepare
$(call echo_cmd,BUILD AAL,$(TARGET))$(submake) -C $(AALBASE) $(SUBCMD_OPTS)
$(IHKOBJ): FORCE
@mkdir -p $(dir $(IHKOBJ))
$(call echo_cmd,BUILD IHK,$(TARGET))$(submake) -C $(IHKBASE) $(SUBCMD_OPTS) prepare
$(call echo_cmd,BUILD IHK,$(TARGET))$(submake) -C $(IHKBASE) $(SUBCMD_OPTS)
%.o: $(SRC)/%.c
$(cc_cmd)

View File

@ -1,8 +1,8 @@
#include <types.h>
#include <kmsg.h>
#include <aal/cpu.h>
#include <aal/mm.h>
#include <aal/debug.h>
#include <ihk/cpu.h>
#include <ihk/mm.h>
#include <ihk/debug.h>
#include <process.h>
#include <init.h>
#include <march.h>

View File

@ -1,10 +1,10 @@
#include <kmsg.h>
#include <string.h>
#include <aal/cpu.h>
#include <aal/debug.h>
#include <aal/lock.h>
#include <aal/mm.h>
#include <aal/page_alloc.h>
#include <ihk/cpu.h>
#include <ihk/debug.h>
#include <ihk/lock.h>
#include <ihk/mm.h>
#include <ihk/page_alloc.h>
#include <cls.h>
#include <page.h>

View File

@ -2,5 +2,5 @@ CC = /opt/knc/linux-k1om-4.7/bin/x86_64-k1om-linux-gcc
LD = /opt/knc/linux-k1om-4.7/bin/x86_64-k1om-linux-ld
CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
LDFLAGS += -m elf_k1om -T $(SRC)/knf.lds
LDFLAGS += -m elf_k1om -T $(SRC)/config/attached-mic.lds
LDFLAGS_MKIMAGE = -m elf_k1om

View File

@ -1,2 +1,2 @@
CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
LDFLAGS += -T $(SRC)/mee.lds
LDFLAGS += -T $(SRC)/config/builtin-x86.lds

View File

@ -1,4 +1,4 @@
#include <aal/dma.h>
#include <ihk/dma.h>
#include <amemcpy.h>
int memcpy_async(unsigned long dest, unsigned long src,

View File

@ -1,8 +1,8 @@
#include <stdarg.h>
#include <string.h>
#include <kmsg.h>
#include <aal/debug.h>
#include <aal/lock.h>
#include <ihk/debug.h>
#include <ihk/lock.h>
struct aal_kmsg_buf kmsg_buf AAL_KMSG_ALIGN;

View File

@ -58,7 +58,7 @@
#include <process.h>
#include <futex.h>
#include <hash.h>
#include <aal/lock.h>
#include <ihk/lock.h>
#include <list.h>
#include <cls.h>
#include <kmsg.h>

View File

@ -1,9 +1,9 @@
#include <types.h>
#include <kmsg.h>
#include <aal/cpu.h>
#include <aal/mm.h>
#include <aal/debug.h>
#include <aal/ikc.h>
#include <ihk/cpu.h>
#include <ihk/mm.h>
#include <ihk/debug.h>
#include <ihk/ikc.h>
#include <ikc/master.h>
#include <syscall.h>
#include <cls.h>

View File

@ -1,7 +1,7 @@
#ifndef HEADER_AMEMCPY_H
#define HEADER_AMEMCPY_H
#include <aal/cpu.h>
#include <ihk/cpu.h>
static void memcpy_async_wait(unsigned long *notify)
{

View File

@ -12,7 +12,7 @@ struct malloc_header {
unsigned long size;
};
#include <aal/lock.h>
#include <ihk/lock.h>
#define CPU_STATUS_DISABLE (0)
#define CPU_STATUS_IDLE (1)
#define CPU_STATUS_RUNNING (2)

View File

@ -55,7 +55,7 @@
#ifdef __KERNEL__
#include <aal/lock.h>
#include <ihk/lock.h>
#include <list.h>
#include <process.h>
#include <waitq.h>

View File

@ -1,7 +1,7 @@
#ifndef __HEADER_KMALLOC_H
#define __HEADER_KMALLOC_H
#include <aal/mm.h>
#include <ihk/mm.h>
void *kmalloc(int size, enum aal_mc_ap_flag flag);
void kfree(void *ptr);

View File

@ -1,10 +1,10 @@
#ifndef HEADER_PROCESS_H
#define HEADER_PROCESS_H
#include <aal/context.h>
#include <aal/cpu.h>
#include <aal/mm.h>
#include <aal/atomic.h>
#include <ihk/context.h>
#include <ihk/cpu.h>
#include <ihk/mm.h>
#include <ihk/atomic.h>
#include <list.h>
#define VR_STACK 0x1

View File

@ -1,7 +1,7 @@
#ifndef __HEADER_SYSCALL_H
#define __HEADER_SYSCALL_H
#include <aal/memconst.h>
#include <ihk/memconst.h>
#define NUM_SYSCALLS 255

View File

@ -1,17 +1,17 @@
#include <types.h>
#include <kmsg.h>
#include <aal/cpu.h>
#include <ihk/cpu.h>
#include <cpulocal.h>
#include <aal/mm.h>
#include <aal/debug.h>
#include <aal/ikc.h>
#include <ihk/mm.h>
#include <ihk/debug.h>
#include <ihk/ikc.h>
#include <errno.h>
#include <cls.h>
#include <syscall.h>
#include <page.h>
#include <amemcpy.h>
#include <uio.h>
#include <aal/lock.h>
#include <ihk/lock.h>
#include <ctype.h>
#include <waitq.h>
#include <rlimit.h>

View File

@ -3,7 +3,7 @@
/* Kitten waitqueue adaptation */
#include <aal/lock.h>
#include <ihk/lock.h>
#include <list.h>
struct process;

View File

@ -1,11 +1,11 @@
#include <types.h>
#include <kmsg.h>
#include <kmalloc.h>
#include <aal/cpu.h>
#include <aal/mm.h>
#include <aal/debug.h>
#include <aal/dma.h>
#include <aal/perfctr.h>
#include <ihk/cpu.h>
#include <ihk/mm.h>
#include <ihk/debug.h>
#include <ihk/dma.h>
#include <ihk/perfctr.h>
#include <process.h>
#include <init.h>
#include <cls.h>

View File

@ -1,9 +1,9 @@
#include <types.h>
#include <kmsg.h>
#include <aal/cpu.h>
#include <aal/mm.h>
#include <aal/debug.h>
#include <aal/ikc.h>
#include <ihk/cpu.h>
#include <ihk/mm.h>
#include <ihk/debug.h>
#include <ihk/ikc.h>
#include <ikc/master.h>
static unsigned long read_tsc(void)

View File

@ -1,14 +1,14 @@
#include <kmsg.h>
#include <kmalloc.h>
#include <string.h>
#include <aal/cpu.h>
#include <aal/debug.h>
#include <aal/lock.h>
#include <aal/mm.h>
#include <aal/page_alloc.h>
#include <ihk/cpu.h>
#include <ihk/debug.h>
#include <ihk/lock.h>
#include <ihk/mm.h>
#include <ihk/page_alloc.h>
#include <registers.h>
#include <sysdeps/knf/mic/micconst.h>
#include <sysdeps/knf/mic/micsboxdefine.h>
#include <sysdeps/mic/mic/micconst.h>
#include <sysdeps/mic/mic/micsboxdefine.h>
#include <cls.h>
//#define DEBUG_PRINT_MEM

View File

@ -1,7 +1,7 @@
#include <kmsg.h>
#include <aal/cpu.h>
#include <aal/debug.h>
#include <aal/ikc.h>
#include <ihk/cpu.h>
#include <ihk/debug.h>
#include <ihk/ikc.h>
#include <ikc/msg.h>
#include <kmalloc.h>

View File

@ -3,7 +3,7 @@
#include <errno.h>
#include <kmalloc.h>
#include <cls.h>
#include <aal/debug.h>
#include <ihk/debug.h>
#include <page.h>
#include <cpulocal.h>
#include <auxvec.h>

View File

@ -4,7 +4,7 @@ set -e
O=`pwd`
make -C $3/../kboot O=$O clean
make -C $3/../kboot O=$O KIMAGE="$O/$1" LOAD_PA=0x401000 CC=${CC} LD=${LD} LDFLAGS="${LDFLAGS}"
make -C $3/../arch/x86/kboot O=$O clean
make -C $3/../arch/x86/kboot O=$O KIMAGE="$O/$1" LOAD_PA=0x401000 CC=${CC} LD=${LD} LDFLAGS="${LDFLAGS}"
cp kboot/kboot.elf $2

View File

@ -1,23 +1,23 @@
#include <types.h>
#include <kmsg.h>
#include <aal/cpu.h>
#include <ihk/cpu.h>
#include <cpulocal.h>
#include <aal/mm.h>
#include <aal/debug.h>
#include <aal/ikc.h>
#include <ihk/mm.h>
#include <ihk/debug.h>
#include <ihk/ikc.h>
#include <errno.h>
#include <cls.h>
#include <syscall.h>
#include <page.h>
#include <amemcpy.h>
#include <uio.h>
#include <aal/lock.h>
#include <ihk/lock.h>
#include <ctype.h>
#include <waitq.h>
#include <rlimit.h>
#include <affinity.h>
#include <time.h>
#include <aal/perfctr.h>
#include <ihk/perfctr.h>
/* Headers taken from kitten LWK */
#include <lwk/stddef.h>

View File

@ -1,17 +1,17 @@
#include <types.h>
#include <kmsg.h>
#include <aal/cpu.h>
#include <ihk/cpu.h>
#include <cpulocal.h>
#include <aal/mm.h>
#include <aal/debug.h>
#include <aal/ikc.h>
#include <ihk/mm.h>
#include <ihk/debug.h>
#include <ihk/ikc.h>
#include <errno.h>
#include <cls.h>
#include <syscall.h>
#include <page.h>
#include <amemcpy.h>
#include <uio.h>
#include <aal/lock.h>
#include <ihk/lock.h>
#include <ctype.h>
#include <waitq.h>
#include <rlimit.h>

View File

@ -1,5 +1,5 @@
#include <aal/debug.h>
#include <aal/cpu.h>
#include <ihk/debug.h>
#include <ihk/cpu.h>
void panic(const char *msg)
{

View File

@ -2,7 +2,7 @@
#define AAL_CPU_H
#include <list.h>
#include <aal/context.h>
#include <ihk/context.h>
void cpu_enable_interrupt(void);
void cpu_disable_interrupt(void);

View File

@ -1,7 +1,7 @@
#ifndef AAL_DEBUG_H
#define AAL_DEBUG_H
#include <aal/memconst.h>
#include <ihk/memconst.h>
struct aal_kmsg_buf {
int tail;

View File

@ -1,7 +1,7 @@
#ifndef __HEADER_GENERIC_INCLUDE_DMA_H
#define __HEADER_GENERIC_INCLUDE_DMA_H
#include <aal/ikc.h>
#include <ihk/ikc.h>
struct aal_dma_request {
aal_os_t src_os;

View File

@ -1,7 +1,7 @@
#ifndef TYPES_H
#define TYPES_H
#include <aal/types.h>
#include <ihk/types.h>
#endif

View File

@ -4,10 +4,10 @@
*/
#include <types.h>
#include <string.h>
#include <aal/debug.h>
#include <aal/lock.h>
#include <aal/mm.h>
#include <aal/page_alloc.h>
#include <ihk/debug.h>
#include <ihk/lock.h>
#include <ihk/mm.h>
#include <ihk/page_alloc.h>
#include <memory.h>
#include <bitops.h>