forked from hanwckf/build-beikeyun
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
173 lines (132 loc) · 4.57 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
DTB_HEADLESS := dtbs/5.x-bsp/headless/rk3328-beikeyun-1296mhz.dtb
DTB_BOX := dtbs/4.4-bsp/box/rk3328-beikeyun.dtb
DL := input
WGET := wget -nv -P $(DL)
AXEL := axel -a -n4 -o $(DL)
OUTPUT := output
TARGETS := armbian libreelec alpine archlinux lakka
.PHONY: help build clean
help:
@echo "Usage: make build_[system1]=y build_[system2]=y build"
@echo "available system: $(TARGETS)"
build: $(TARGETS)
clean: $(TARGETS:%=%_clean)
rm -f $(OUTPUT)/*.img $(OUTPUT)/*.xz
ARMBIAN_PKG_UBUNTU_XFCE := Armbian_21.02.3_Rock64_focal_current_5.10.21_xfce_desktop.img.xz
ARMBIAN_PKG_UBUNTU := Armbian_21.02.3_Rock64_focal_current_5.10.21.img.xz
ARMBIAN_PKG_DEBIAN_XFCE_LEGACY := Armbian_21.02.3_Rock64_buster_legacy_4.4.213_xfce_desktop.img.xz
ARMBIAN_PKG_DEBIAN := Armbian_21.02.3_Rock64_buster_current_5.10.21.img.xz
ifneq ($(CI),)
ARMBIAN_URL_BASE := https://mirrors.dotsrc.org/armbian-dl/rock64/archive
# ARMBIAN_URL_BASE := https://imola.armbian.com/dl/rock64/archive
# ARMBIAN_URL_BASE := https://archive.armbian.com/rock64/archive
# ARMBIAN_URL_BASE := https://armbian.tnahosting.net/dl/rock64/archive
else
ARMBIAN_URL_BASE := https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/rock64/archive
endif
ARMBIAN_PKG_%:
@( if [ ! -f "$(DL)/$($(@))" ]; then \
$(WGET) $(ARMBIAN_URL_BASE)/$($(@)) ; \
$(WGET) $(ARMBIAN_URL_BASE)/$($(@)).sha ; \
fi )
ARMBIAN_PKG_%_CLEAN:
rm -f $(DL)/$($(@:_CLEAN=))
ifeq ($(build_armbian),y)
ARMBIAN_TARGETS := ARMBIAN_PKG_UBUNTU_XFCE ARMBIAN_PKG_UBUNTU ARMBIAN_PKG_DEBIAN_XFCE_LEGACY ARMBIAN_PKG_DEBIAN
armbian: $(ARMBIAN_TARGETS)
( for pkg in $(foreach n,$^,$($(n))); do \
sudo ./build-armbian.sh release $(DL)/$$pkg $(DTB_HEADLESS) ; \
done )
armbian_clean: $(ARMBIAN_TARGETS:%=%_CLEAN)
else
armbian:
armbian_clean:
endif
ifeq ($(build_libreelec),y)
#LIBREELEC_URL := http://archive.libreelec.tv
LIBREELEC_URL := http://www.gtlib.gatech.edu/pub/LibreELEC
LIBREELEC_PKG := $(shell basename "`hxwls "$(LIBREELEC_URL)/?C=M;O=D" |grep 'rock64.img.gz$$' |head -1`")
libreelec: libreelec_dl libreelec_release
libreelec_clean:
( if [ -n "$(LIBREELEC_PKG)" ]; then \
rm -f $(DL)/$(LIBREELEC_PKG) ; \
fi )
libreelec_dl:
@( if [ -n "$(LIBREELEC_PKG)" ]; then \
if [ ! -f $(DL)/$(LIBREELEC_PKG) ]; then \
$(WGET) "$(LIBREELEC_URL)/$(LIBREELEC_PKG)" ; \
fi \
else \
echo "fetch libreelec dl url fail" ; exit 1 ; \
fi )
libreelec_release: libreelec_dl
./build-libreelec.sh release $(DL)/$(LIBREELEC_PKG) $(DTB_BOX)
else
libreelec:
libreelec_clean:
endif
ifeq ($(build_lakka),y)
LAKKA_URL := http://le.builds.lakka.tv/Rockchip.ROCK64.arm
LAKKA_PKG := $(shell basename "`hxwls "$(LAKKA_URL)/?C=M&O=D" |grep 'img.gz$$' |head -1`")
LAKKA_IDB := loader/armbian-5.75/idbloader.bin
LAKKA_UBOOT_PATCH := loader/libreelec/u-boot.bin
lakka: lakka_dl lakka_release
lakka_clean:
( if [ -n "$(LAKKA_PKG)" ]; then \
rm -f $(DL)/$(LAKKA_PKG); \
fi )
lakka_dl:
( if [ -n "$(LAKKA_PKG)" ]; then \
if [ ! -f $(DL)/$(LAKKA_PKG) ]; then \
#$(WGET) "$(LAKKA_URL)/$(LAKKA_PKG)" ; \
$(AXEL) -q "$(LAKKA_URL)/$(LAKKA_PKG)" ; \
fi \
else \
echo "fetch lakka dl url fail" ; exit 1 ; \
fi )
lakka_release: lakka_dl
./build-lakka.sh release $(DL)/$(LAKKA_PKG) $(DTB_BOX) $(LAKKA_IDB) $(LAKKA_UBOOT_PATCH)
else
lakka:
lakka_clean:
endif
ifeq ($(build_alpine),y)
ALPINE_BRANCH := v3.10
ALPINE_VERSION := 3.10.0
ALPINE_PKG := alpine-minirootfs-$(ALPINE_VERSION)-aarch64.tar.gz
ifneq ($(CI),)
ALPINE_URL_BASE := http://dl-cdn.alpinelinux.org/alpine/$(ALPINE_BRANCH)/releases/aarch64
else
ALPINE_URL_BASE := https://mirrors.tuna.tsinghua.edu.cn/alpine/$(ALPINE_BRANCH)/releases/aarch64
endif
alpine: alpine_dl alpine_release
alpine_dl: $(DL)/$(ALPINE_PKG)
$(DL)/$(ALPINE_PKG):
$(WGET) $(ALPINE_URL_BASE)/$(ALPINE_PKG)
alpine_release: ARMBIAN_PKG_UBUNTU alpine_dl
sudo ./build-alpine.sh release $(DL)/$(ARMBIAN_PKG_UBUNTU) $(DTB_HEADLESS) $(DL)/$(ALPINE_PKG)
alpine_clean: ARMBIAN_PKG_UBUNTU_CLEAN
rm -f $(DL)/$(ALPINE_PKG)
else
alpine:
alpine_clean:
endif
ifeq ($(build_archlinux),y)
ARCHLINUX_PKG := ArchLinuxARM-aarch64-latest.tar.gz
ifneq ($(CI),)
ARCHLINUX_URL_BASE := http://os.archlinuxarm.org/os
else
ARCHLINUX_URL_BASE := https://mirrors.tuna.tsinghua.edu.cn/archlinuxarm/os
endif
archlinux: archlinux_dl archlinux_release
archlinux_dl: $(DL)/$(ARCHLINUX_PKG)
$(DL)/$(ARCHLINUX_PKG):
$(WGET) $(ARCHLINUX_URL_BASE)/$(ARCHLINUX_PKG)
archlinux_release: ARMBIAN_PKG_UBUNTU archlinux_dl
sudo ./build-archlinux.sh release $(DL)/$(ARMBIAN_PKG_UBUNTU) $(DTB_HEADLESS) $(DL)/$(ARCHLINUX_PKG)
archlinux_clean: ARMBIAN_PKG_UBUNTU_CLEAN
rm -f $(DL)/$(ARCHLINUX_PKG)
else
archlinux:
archlinux_clean:
endif