forked from wendlers/rpi-kmod-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (58 loc) · 2.16 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
MODULES += modules/kmod-clarg
MODULES += modules/kmod-gpio_inpirq
MODULES += modules/kmod-gpio_inpthrd
MODULES += modules/kmod-gpio_outptask
MODULES += modules/kmod-gpio_output
MODULES += modules/kmod-gpio_outptimer
MODULES += modules/kmod-gpio_outphrtimer
MODULES += modules/kmod-moppy
# MODULES += modules/kmod-pdev
MODULES += modules/kmod-tasklet
all: pack
info:
echo $(PATH)
.PHONY: build
build: build-kernel build-modules
.PHONY: clean
clean: clean-kernel clean-modules
if [ -f rpi-modtest-sysroot.tar.bz2 ]; then rm rpi-modtest-sysroot.tar.bz2; fi
.PHONY: distclean
distclean: clean distclean-kernel distclean-modules
.PHONY: proper
proper: distclean
if [ -d ./tools ]; then rm -fr ./tools; fi
if [ -d ./linux ]; then rm -fr ./linux; fi
.PHONY: install
install: build install-kernel install-modules
clone-tools:
if ! [ -d ./tools ]; then git clone --depth 1 https://github.com/raspberrypi/tools; fi
clone-kernel:
if ! [ -d ./linux ]; then git clone --depth 1 https://github.com/raspberrypi/linux.git linux; fi
if ! [ -f ./linux/localversion ]; then echo "-wendlers" > ./linux/localversion; fi
build-kernel: clone-tools clone-kernel
if ! [ -f ./linux/.config ]; then (cd ./linux && make bcm2709_defconfig); fi
(cd ./linux && make -j4)
build-modules:
for i in $(MODULES); do (cd $$i && make); done
clean-kernel:
(cd ./linux && make clean)
clean-modules:
for i in $(MODULES); do (cd $$i && make clean); done
distclean-kernel:
(cd ./linux && make distclean)
distclean-modules:
if [ -d ./sysroot ]; then rm -r ./sysroot; fi
install-kernel:
(cd ./linux && make INSTALL_MOD_PATH=../sysroot modules_install)
mkdir -p ./sysroot/boot/overlays
(cd ./linux && scripts/mkknlimg arch/arm/boot/zImage \
../sysroot/boot/$(KERNEL).img)
(cd ./linux && cp arch/arm/boot/dts/*.dtb ../sysroot/boot/.)
(cd ./linux && cp arch/arm/boot/dts/overlays/*.dtb* ../sysroot/boot/overlays/.)
(cd ./linux && cp arch/arm/boot/dts/overlays/README ../sysroot/boot/overlays/.)
install-modules:
for i in $(MODULES); do (cd $$i && make modules_install); done
install-usrspc:
for i in $(USRSPC); do (cd $$i && make install); done
pack: install
(cd ./sysroot && tar -jcvf ../rpi-modtest-sysroot.tar.bz2 *)