forked from mildsunrise/cursed_gpu_linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (40 loc) · 1.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
all: linux_dtb emulator
# emulator
core_test: core.c core.h test.c measure.c reg_macros.h riscv_constants.h
gcc -flto -O3 -g -Wall -Wextra core.c test.c -o $@
emulator: core.c core.h emulator.c measure.c reg_macros.h riscv_constants.h
gcc -flto -O3 -g -Wall -Wextra core.c emulator.c -o $@
# kernel
LINUX_DIR=linux
LINUX_IMAGE=$(LINUX_DIR)/arch/riscv/boot/Image
LINUX_DTC=$(LINUX_DIR)/scripts/dtc/dtc
$(LINUX_IMAGE): linux_config
cp linux_config linux/.config
cd linux && CROSS_COMPILE=riscv32-unknown-linux-gnu- ARCH=riscv make Image
# dtb
LINUX_DTC=$(LINUX_DIR)/scripts/dtc/dtc
$(LINUX_DTC):
make scripts_dtc
DTC_FLAGS=-Wno-interrupt_provider
# extra warnings
DTC_FLAGS += -Wno-unit_address_vs_reg \
-Wno-avoid_unnecessary_addr_size \
-Wno-alias_paths \
-Wno-graph_child_address \
-Wno-simple_bus_reg \
-Wno-unique_unit_address
DTC_FLAGS += -Wnode_name_chars_strict \
-Wproperty_name_chars_strict \
-Winterrupt_provider
DTC_INCLUDE=$(LINUX_DIR)/scripts/dtc/include-prefixes $(LINUX_DIR)/arch/riscv/boot/dts/canaan
linux_dtb: linux_dts $(LINUX_DTC)
cc -E -Wp,-MMD,$@.dep.cpp -undef -D__DTS__ -nostdinc -x assembler-with-cpp \
$(addprefix -I,$(DTC_INCLUDE)) \
-o $@.tmp $<
$(LINUX_DTC) -b 0 \
$(addprefix -i,$(DTC_INCLUDE)) \
$(DTC_FLAGS) -d $@.dep.dtc -o $@ $@.tmp
cat $@.dep.cpp $@.dep.dtc > $@.dep
# (make sure to have the riscv toolchain from
# https://github.com/riscv-collab/riscv-gnu-toolchain/releases
# in path)