-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
70 lines (57 loc) · 2.27 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
SHELL := /bin/bash
THIS_FILE := $(lastword $(MAKEFILE_LIST))
PIGEN_DIR = "ext/pi-gen"
EXTRA_DIR = "pi-gen-extra"
locale_check :
ifneq ("$(LC_ALL)","en_US.UTF-8")
$(error "LC_ALL should be set to en_US.UTF-8, see README.md")
endif
# Note: individual stages have not been configured with pre-requisites. Run them in the correct order manually!
.DEFAULT_GOAL := pi-image-racebian
pi-stage1 : locale_check
rm -f ${PIGEN_DIR}/stage0/SKIP
rm -f ${PIGEN_DIR}/stage1/SKIP
cd ${PIGEN_DIR} && STAGE_LIST="stage0 stage1" ./build.sh -c ../../config
pi-stage2 : locale_check
touch ${PIGEN_DIR}/stage0/SKIP
touch ${PIGEN_DIR}/stage1/SKIP
rm -f ${EXTRA_DIR}/stage2/SKIP
rm -f ${EXTRA_DIR}/stage2/SKIP_IMAGES
cd ${PIGEN_DIR} && STAGE_LIST="stage0 stage1 ../../${EXTRA_DIR}/stage2" ./build.sh -c ../../config
pi-stage2-image : locale_check
touch ${PIGEN_DIR}/stage0/SKIP
touch ${PIGEN_DIR}/stage1/SKIP
touch ${EXTRA_DIR}/stage2/SKIP
rm -f ${EXTRA_DIR}/stage2/SKIP_IMAGES
cd ${PIGEN_DIR} && STAGE_LIST="stage0 stage1 ../../${EXTRA_DIR}/stage2" ./build.sh -c ../../config
pi-stageK : locale_check
touch ${PIGEN_DIR}/stage0/SKIP
touch ${PIGEN_DIR}/stage1/SKIP
touch ${EXTRA_DIR}/stage2/SKIP
touch ${EXTRA_DIR}/stage2/SKIP_IMAGES
rm -f ${EXTRA_DIR}/stageK/SKIP
rm -f ${EXTRA_DIR}/stageK/SKIP_IMAGES
cd ${PIGEN_DIR} && STAGE_LIST="stage0 stage1 ../../${EXTRA_DIR}/stage2 ../../${EXTRA_DIR}/stageK" ./build.sh -c ../../config
pi-image-lite : locale_check
$(MAKE) -f $(THIS_FILE) pi-stage1
$(MAKE) -f $(THIS_FILE) pi-stage2
pi-image-racebian : pi-image-lite locale_check
$(MAKE) -f $(THIS_FILE) pi-stageK
pi-flash :
@echo sudo umount "/dev/mmcblk?*"
@echo sudo dd bs=4M if=./imgs/your_image of=/dev/mmcblk? status=progress
clean :
@echo -n
ifneq (, $(shell mount | grep rootfs))
@echo "something went wrong, please unmount rootfs manually."
endif
rm -rf build
clean-imgs :
rm -rf imgs
## ---- Networking functions ---- ##
install-pi-tools :
# install -m 755 -o root ./usbip-client/usbip-attach.sh /usr/bin/pi-usb-attach
# install -m 644 -o root ./usbip-client/usbip-attach.service /etc/systemd/system/pi-usb-attach.service
install -m 755 -o root ./routing/routing-up.sh /usr/bin/pi-routing-up
install -m 755 -o root ./routing/routing-down.sh /usr/bin/pi-routing-down
# systemctl daemon-reload