-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
166 lines (145 loc) · 7.65 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
SHELL=/usr/bin/env bash
all:
@if [ -d obj ]; then \
$(MAKE) build_all; \
else \
echo "Call 'make setup' once for initial setup." ; \
exit 1; \
fi
clean:
@$(RM) -r obj pre-built-images
setup:
@if [ -d obj ]; then \
echo "Snapshot has already been setup. Proceed with 'make setup' or 'make clean'."; \
else \
export PATH=$$(pwd)/bin:$$PATH; \
chmod +x ./bin/setup.d/*; \
for binary in bin/setup.d/*; do \
./$$binary config || exit 1; \
done; \
for binary in bin/setup.d/*; do \
./$$binary setup || exit 1; \
done; \
echo ====================================================================; \
echo ; \
echo Your L4Re tree is set up now. Type 'make' to build the tree. This; \
echo will take some time \(depending on the speed of your host system, of; \
echo course\).; \
echo ; \
echo Boot-images for ARM targets will be placed into obj/l4/arm-*/images.; \
echo Boot-images for MIPS targets will be placed into obj/l4/mips32/images.; \
echo Check obj/l4/.../conf/Makeconf.boot for path configuration during image builds.; \
echo ; \
fi
build_all: build_fiasco build_l4re #build_l4linux build_images
#.NOTPARALLEL: build_fiasco build_l4re build_l4linux build_images build_all
build_fiasco: $(addsuffix /fiasco,$(wildcard obj/fiasco/*))
build_l4re: $(addsuffix /l4defs.mk.inc,$(wildcard obj/l4/*))
build_l4linux: $(addsuffix /vmlinux,$(wildcard obj/l4linux/*))
$(addsuffix /fiasco,$(wildcard obj/fiasco/*)):
$(MAKE) -C $(@D)
$(addsuffix /l4defs.mk.inc,$(wildcard obj/l4/*)):
$(MAKE) -C $(@D)
obj/l4linux/amd64/vmlinux: obj/l4/amd64/l4defs.mk.inc
$(MAKE) -C src/l4linux O=$(abspath $(@D)) x86_64-mp_vPCI_defconfig
src/l4linux/scripts/config --file $(@D)/.config \
--set-str L4_OBJ_TREE $(abspath obj/l4/amd64)
# temporary quick fix
src/l4linux/scripts/config --file $(@D)/.config -e PCI -e L4_VPCI
$(MAKE) -C $(@D) olddefconfig
$(MAKE) -C $(@D)
obj/l4linux/ux/vmlinux: obj/l4/x86/l4defs.mk.inc
$(MAKE) -C src/l4linux O=$(abspath $(@D)) x86_32-ux_defconfig
src/l4linux/scripts/config --file $(@D)/.config \
--set-str L4_OBJ_TREE $(abspath obj/l4/x86)
$(MAKE) -C $(@D)
obj/l4linux/arm-mp/vmlinux: obj/l4/arm-v7/l4defs.mk.inc
+. obj/.config && $(MAKE) -C src/l4linux L4ARCH=arm \
CROSS_COMPILE=$$CROSS_COMPILE_ARM \
O=$(abspath $(@D)) arm-mp_defconfig
src/l4linux/scripts/config --file $(@D)/.config \
--set-str L4_OBJ_TREE $(abspath obj/l4/arm-v7)
+. obj/.config && $(MAKE) -C $(@D) CROSS_COMPILE=$$CROSS_COMPILE_ARM
obj/l4linux/arm-up/vmlinux: obj/l4/arm-v7/l4defs.mk.inc
+. obj/.config && $(MAKE) -C src/l4linux L4ARCH=arm \
CROSS_COMPILE=$$CROSS_COMPILE_ARM \
O=$(abspath $(@D)) arm_defconfig
src/l4linux/scripts/config --file $(@D)/.config \
--set-str L4_OBJ_TREE $(abspath obj/l4/arm-v7)
+. obj/.config && $(MAKE) -C $(@D) CROSS_COMPILE=$$CROSS_COMPILE_ARM
obj/l4linux/arm64/vmlinux: obj/l4/arm64/l4defs.mk.inc
+. obj/.config && $(MAKE) -C src/l4linux L4ARCH=arm64 \
CROSS_COMPILE=$$CROSS_COMPILE_ARM64 \
O=$(abspath $(@D)) arm64_defconfig
src/l4linux/scripts/config --file $(@D)/.config \
--set-str L4_OBJ_TREE $(abspath obj/l4/arm64)
+. obj/.config && $(MAKE) -C $(@D) CROSS_COMPILE=$$CROSS_COMPILE_ARM64
build_images: build_l4linux build_l4re build_fiasco
@echo "=============== Building Images ==============================="
export PATH=$$(pwd)/bin:$$PATH; \
[ -e obj/.config ] && . obj/.config; \
if [ -z "$(GRUB_INST_PATH)" ]; then \
echo "Need to specify GRUB_INST_PATH"; exit 1; \
fi; \
cd obj/l4; \
for d in *; do \
if [ -d "$$d" -a -e $$d/.imagebuilds ]; then \
cat $$d/.imagebuilds | while read args; do \
$(MAKE) -C $$d uimage $$args; \
if [ "$$d" = "amd64" -o "$$d" = "x86" ]; then \
PATH=$(GRUB_INST_PATH)/efi/bin:$$PATH $(MAKE) -C $$d grub2iso ISONAME_SUFFIX=.efi.iso $$args; \
PATH=$(GRUB_INST_PATH)/pc/bin:$$PATH $(MAKE) -C $$d grub2iso ISONAME_SUFFIX=.pc.iso $$args; \
fi; \
done; \
fi; \
done
@echo "=============== Build done ===================================="
gen_prebuilt: copy_prebuilt pre-built-images/l4image
copy_prebuilt2:
@echo "Creating pre-built image directory"
@cd obj/l4; \
for arch in *; do \
for i in $$arch/images/*; do \
if [ "$$arch" = "amd64" -o "$$arch" = "x86" ]; then \
mkdir -p ../../pre-built-images/$$arch; \
if [ -d $$i ]; then \
for f in $$i/*.elf; do \
cp $$f ../../pre-built-images/$$arch; \
done; \
fi; \
else \
if [ -d $$i ]; then \
pt=$${i#$$arch/images/}; \
mkdir -p ../../pre-built-images/$$arch/$$pt; \
for f in $$i/*.elf $$i/*.uimage; do \
cp $$f ../../pre-built-images/$$arch/$$pt; \
done; \
fi; \
fi; \
done; \
done
copy_prebuilt:
@echo "Creating pre-built image directory"
@cd obj/l4; \
for arch in *; do \
mkdir -p ../../pre-built-images/$$arch; \
for i in $$arch/images/*.elf \
$$arch/images/*.uimage; do \
[ -e $$i ] || continue; \
if [ $$i != $$arch/images/bootstrap.elf -a \
$$i != $$arch/images/bootstrap.uimage -a \
$$i != amd64/images/bootstrap32.elf ]; then \
cp $$i ../../pre-built-images/$$arch; \
fi; \
done; \
done
pre-built-images/l4image:
@echo Creating $@
@src/l4/tool/bin/l4image --create-l4image-binary $@
help:
@echo "Targets:"
@echo " all"
@echo " setup"
@echo " gen_prebuilt"
.PHONY: setup all build_all clean help \
build_images build_fiasco build_l4re build_l4linux