-
Notifications
You must be signed in to change notification settings - Fork 36
/
rules.mk
153 lines (111 loc) · 4.54 KB
/
rules.mk
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
KERNEL_VERSION = $(shell (test -f include/config/kernel.release || $(MAKE) include/config/kernel.release &>/dev/null); cat include/config/kernel.release)
ARCH_CONFIG ?= mvebu_v7
J ?= -j $(CONCURRENCY_LEVEL)
ARTIFACTS_TO_COPY ?= include/config/kernel.release Module.symvers modules.builtin modules.order System.map
all:
@echo "This Makefile is used inside Docker"
.PHONY: all enter leave oldconfig olddefconfig menuconfig $(ARCH_CONFIG)_defconfig dtbs build ccache_stats shell defconfig uImage diff uImage-appended
print-%:
@echo $* = $($*)
enter:
$(ENTER_COMMAND)
cp /tmp/.config .config
leave:
cp .config /tmp/.config
oldconfig olddefconfig menuconfig $(ARCH_CONFIG)_defconfig: apply-patches
$(MAKE) $@
/usr/bin/dtc:
wget http://ftp.fr.debian.org/debian/pool/main/d/device-tree-compiler/device-tree-compiler_1.4.0+dfsg-1_amd64.deb -O /tmp/dtc.deb
dpkg -i /tmp/dtc.deb
rm -f /tmp/dtc.deb
apply-patches:
@if [ -f patches-apply.sh -a ! -f patches-applied ]; then \
echo /bin/bash -xe patches-apply.sh; \
/bin/bash -xe patches-apply.sh || exit 1; \
printf "\narch/arm/boot/dts/*.dts\nbuild/\nrules.mk\n" >> .git/info/exclude || true; \
touch patches-applied; \
fi
build_armv7l:
@mv build/build.txt build/build-prev.txt || true
$(MAKE) -f rules.mk uImage dtbs build_info 2>&1 | tee build/build.txt
build_x86_64:
@mv build/build.txt build/build-prev.txt || true
$(MAKE) -f rules.mk bzImage build_info 2>&1 | tee build/build.txt
build_aarch64:
@mv build/build.txt build/build-prev.txt || true
$(MAKE) -f rules.mk vmlinux build_info 2>&1 | tee build/build.txt
build: build_$(KERNEL_ARCH)
dtbs: /usr/bin/dtc apply-patches
-printf "\narch/arm/boot/dts/*.dts\nbuild/\n" >> .git/info/exclude || true
sed -i "s/armada-xp-db.dtb/scaleway-c1.dtb/g" arch/arm/boot/dts/Makefile
git update-index --assume-unchanged arch/arm/boot/dts/Makefile
$(MAKE) dtbs
mkdir -p build/dtbs
cp arch/arm/boot/dts/scaleway-*.dtb build/dtbs
ccache_stats:
ccache -s
shell:
bash
defconfig: $(ARCH_CONFIG)_defconfig
bzImage: apply-patches
make $(J) bzImage
make $(J) modules
make headers_install INSTALL_HDR_PATH=build
cd build/ && tar cf include.tar include
make modules_install INSTALL_MOD_PATH=build INSTALL_MOD_STRIP=1
cd build/ && tar cf lib.tar lib
make install INSTALL_PATH=build
for file in $(ARTIFACTS_TO_COPY); do cp $$file build/; done
echo $(KERNEL_VERSION)
#find . -name "*Image*"
cp arch/x86_64/boot/bzImage build/bzImage-$(KERNEL_VERSION)
cp -f build/bzImage-$(KERNEL_VERSION) build/bzImage
uImage: apply-patches
make $(J) uImage
make $(J) modules
make headers_install INSTALL_HDR_PATH=build
cd build/ && tar cf include.tar include
make modules_install INSTALL_MOD_PATH=build INSTALL_MOD_STRIP=1
cd build/ && tar cf lib.tar lib
make uinstall INSTALL_PATH=build
for file in $(ARTIFACTS_TO_COPY); do cp $$file build/; done
echo $(KERNEL_VERSION)
cp arch/arm/boot/uImage build/uImage-$(KERNEL_VERSION)
cp -f build/uImage-$(KERNEL_VERSION) build/uImage
cp arch/arm/boot/Image build/Image-$(KERNEL_VERSION)
cp -f build/Image-$(KERNEL_VERSION) build/Image
cp arch/arm/boot/zImage build/zImage-$(KERNEL_VERSION)
cp -f build/zImage-$(KERNEL_VERSION) build/zImage
cp -f build/config-$(KERNEL_VERSION) build/config
vmlinux: apply-patches
make $(J) Image.gz modules
make headers_install INSTALL_HDR_PATH=build
cd build/ && tar cf include.tar include
make modules_install INSTALL_MOD_PATH=build INSTALL_MOD_STRIP=1
cd build/ && tar cf lib.tar lib
make install INSTALL_PATH=build
for file in $(ARTIFACTS_TO_COPY); do cp $$file build/; done
echo $(KERNEL_VERSION)
cp vmlinux build/vmlinux-$(KERNEL_VERSION)
cp -f build/config-$(KERNEL_VERSION) build/config
build_info:
@echo "=== $(KERNEL_FULL) - built on `date`"
@echo "=== gcc version"
gcc --version
@echo "=== file listing"
find build -type f -ls
@echo "=== sizes"
du -sh build/*
du -sh build
diff:
cp .config .bkpconfig
$(MAKE) $(ARCH_CONFIG)_defconfig
mv .config .defconfig
mv .bkpconfig .config
diff <(<.defconfig grep "^[^#]" | sort) <(<.config grep "^[^#]" | sort)
uImage-appended: apply-patches
cat build/zImage build/scaleway-c1.dtb > build/zImage-c1-dts-appended-$(KERNEL_VERSION)
cp -f build/zImage-c1-dts-appended-$(KERNEL_VERSION) build/zImage-c1-dts-appended
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Linux-$(KERNEL_VERSION)" -d build/zImage-c1-dts-appended-$(KERNEL_VERSION) uImage-c1-dts-appended
mv uImage-c1-dts-appended build/uImage-c1-dts-appended-$(KERNEL_VERSION)
cp -f build/uImage-c1-dts-appended-$(KERNEL_VERSION) build/uImage-c1-dts-appended