-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
191 lines (145 loc) · 5.17 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
REMOTE_HOST ?= arc-qemu-root
REMOTE_PORT ?= 2022
BUGS_DIR := /home/ykolerov/workspace/gdb/bugs
NPROC ?= 4
QEMU_HOME := /tools/qemu-arc
QEMU := $(QEMU_HOME)/bin/qemu-system-arc
QEMU64 := $(QEMU)64
QEMU_FTP := hostfwd=tcp::2021-:21
QEMU_SSH := hostfwd=tcp::2022-:22
QEMU_TLN := hostfwd=tcp::2023-:23
QEMU_GDB := hostfwd=tcp::12345-:12345
QEMU_COMMON_ARGS := \
-display none -nographic -monitor none \
-device virtio-rng-pci \
-netdev user,id=net0,$(QEMU_FTP),$(QEMU_SSH),$(QEMU_TLN),$(QEMU_GDB) \
-device virtio-net-device,netdev=net0
RSYNC_ARGS := -rpltv --chmod=a+wr
#
# Repositories
#
define clone_git_repository
mkdir -p $(1)
cd $(1)
git -C $(1) init
git -C $(1) remote remove origin || true
git -C $(1) remote add origin $(2)
git -C $(1) fetch --all -p
git -C $(1) checkout $(3)
git -C $(1) branch --set-upstream-to=origin/$(3) $(3)
git -C $(1) pull
endef
clone-buildroot-upstream:
$(call clone_git_repository,buildroot,https://git.buildroot.net/buildroot,master)
clone-buildroot-synopsys:
$(call clone_git_repository,buildroot-synopsys,https://github.com/foss-for-synopsys-dwc-arc-processors/buildroot,arc64)
clone-buildroot: clone-buildroot-upstream clone-buildroot-synopsys
update-buildroot-upstream:
git -C buildroot fetch --all -p
git -C buildroot pull
update-buildroot-synopsys:
git -C buildroot-synopsys fetch --all -p
git -C buildroot-synopsys pull
update-buildroot: update-buildroot-upstream update-buildroot-synopsys
#
# QEMU HS4x
#
.PHONY: \
run-qemu-hs4x-gnu \
run-qemu-hs4x-uclibc \
configure-qemu-hs4x-gnu \
configure-qemu-hs4x-uclibc \
build-qemu-hs4x-gnu \
build-qemu-hs4x-uclibc
run-qemu-hs4x-gnu:
$(QEMU) $(QEMU_COMMON_ARGS) \
-M virt -cpu archs -m 2G -kernel build-qemu-hs4x-gnu/images/vmlinux
run-qemu-hs4x-uclibc:
$(QEMU) $(QEMU_COMMON_ARGS) \
-M virt -cpu archs -m 2G -kernel build-qemu-hs4x-uclibc/images/vmlinux
configure-qemu-hs4x-gnu:
rm -rf build-qemu-hs4x-gnu
mkdir -p build-qemu-hs4x-gnu
make -C buildroot O=$(abspath build-qemu-hs4x-gnu) defconfig DEFCONFIG=../defconfigs/qemu_hs4x_gnu_defconfig
configure-qemu-hs4x-uclibc:
rm -rf build-qemu-hs4x-uclibc
mkdir -p build-qemu-hs4x-uclibc
make -C buildroot O=$(abspath build-qemu-hs4x-uclibc) defconfig DEFCONFIG=../defconfigs/qemu_hs4x_uclibc_defconfig
build-qemu-hs4x-gnu:
make -C build-qemu-hs4x-gnu -j $(NPROC)
build-qemu-hs4x-uclibc:
make -C build-qemu-hs4x-uclibc -j $(NPROC)
#
# QEMU HS5x
#
QEMU_HS5X_UCLIBC_BUILD_DIR := build-qemu-hs5x-uclibc
.PHONY: \
run-qemu-hs5x-uclibc \
configure-qemu-hs5x-uclibc \
build-qemu-hs5x-uclibc
run-qemu-hs5x-uclibc:
$(QEMU) $(QEMU_COMMON_ARGS) \
-M virt,ram_start=0 -cpu hs5x -m 2G -kernel $(QEMU_HS5X_UCLIBC_BUILD_DIR)/images/loader
configure-qemu-hs5x-uclibc:
rm -rf $(QEMU_HS5X_UCLIBC_BUILD_DIR)
mkdir -p $(QEMU_HS5X_UCLIBC_BUILD_DIR)
make -C buildroot-synopsys O=$(abspath $(QEMU_HS5X_UCLIBC_BUILD_DIR)) defconfig DEFCONFIG=../defconfigs/qemu_hs5x_uclibc_defconfig
build-qemu-hs5x-uclibc:
make -C $(QEMU_HS5X_UCLIBC_BUILD_DIR) -j $(NPROC)
#
# QEMU HS6x
#
QEMU_HS6X_GNU_BUILD_DIR := build-qemu-hs6x-gnu
.PHONY: \
run-qemu-hs6x-gnu \
configure-qemu-hs6x-gnu \
build-qemu-hs6x-gnu
run-qemu-hs6x-gnu:
$(QEMU64) $(QEMU_COMMON_ARGS) \
-M virt,ram_start=0 -cpu hs6x -m 2G -kernel $(QEMU_HS6X_GNU_BUILD_DIR)/images/loader
configure-qemu-hs6x-gnu:
rm -rf $(QEMU_HS6X_GNU_BUILD_DIR)
mkdir -p $(QEMU_HS6X_GNU_BUILD_DIR)
make -C buildroot-synopsys O=$(abspath $(QEMU_HS6X_GNU_BUILD_DIR)) defconfig DEFCONFIG=../defconfigs/qemu_hs6x_gnu_defconfig
build-qemu-hs6x-gnu:
make -C $(QEMU_HS6X_GNU_BUILD_DIR) -j $(NPROC)
#
# HS Development Kit
#
HSDK_HS4X_GNU_BUILD_DIR := build-hsdk-hs4x-gnu
.PHONY: \
configure-hsdk-hs4x-gnu \
build-hsdk-hs4x-gnu
configure-hsdk-hs4x-gnu:
rm -rf $(HSDK_HS4X_GNU_BUILD_DIR)
mkdir -p $(HSDK_HS4X_GNU_BUILD_DIR)
make -C buildroot O=$(abspath $(HSDK_HS4X_GNU_BUILD_DIR)) defconfig DEFCONFIG=../defconfigs/hsdk_hs4x_gnu_defconfig
build-hsdk-hs4x-gnu:
make -C $(HSDK_HS4X_GNU_BUILD_DIR) -j 1
HSDK_HS4X_GNU_EBPF_BUILD_DIR := build-hsdk-hs4x-gnu-ebpf
.PHONY: \
configure-hsdk-hs4x-gnu-ebpf \
build-hsdk-hs4x-gnu-ebpf
configure-hsdk-hs4x-gnu-ebpf:
rm -rf $(HSDK_HS4X_GNU_EBPF_BUILD_DIR)
mkdir -p $(HSDK_HS4X_GNU_EBPF_BUILD_DIR)
make -C buildroot O=$(abspath $(HSDK_HS4X_GNU_EBPF_BUILD_DIR)) defconfig DEFCONFIG=../defconfigs/hsdk_hs4x_gnu_ebpf_defconfig
build-hsdk-hs4x-gnu-ebpf:
make -C $(HSDK_HS4X_GNU_EBPF_BUILD_DIR) -j 1
#
# Setup
#
setup-gdb-hs4x-uclibc:
rsync --port=$(REMOTE_PORT) $(RSYNC_ARGS) /tools/gdb-arc-linux-uclibc-native/* root@$(REMOTE_HOST):/
setup-gdb-hs4x-gnu:
rsync --port=$(REMOTE_PORT) $(RSYNC_ARGS) /tools/gdb-arc-linux-gnu-native/* root@$(REMOTE_HOST):/
setup-gdb-hs5x-uclibc:
rsync --port=$(REMOTE_PORT) $(RSYNC_ARGS) /tools/gdb-arc32-linux-uclibc-native/* root@$(REMOTE_HOST):/
setup-gdb-hs6x-gnu:
rsync --port=$(REMOTE_PORT) $(RSYNC_ARGS) /tools/gdb-arc64-linux-gnu-native/* root@$(REMOTE_HOST):/
setup-bugs:
rsync --port=$(REMOTE_PORT) $(RSYNC_ARGS) $(BUGS_DIR)/* root@$(REMOTE_HOST):/root/
setup-hs4x-uclibc: setup-gdb-hs4x-uclibc setup-bugs
setup-hs4x-gnu: setup-gdb-hs4x-gnu setup-bugs
setup-hs5x-uclibc: setup-gdb-hs5x-uclibc setup-bugs
setup-hs6x-gnu: setup-gdb-hs6x-gnu setup-bugs