-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
125 lines (88 loc) · 2.67 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
URL_BASE := https://github.com/mlpzaq9998/xjy-1295/releases/download
RELEASE_TAG = latest
DTB := rtd-1295-xjy-2GB.dtb
DTB_URL := $(URL_BASE)/$(RELEASE_TAG)/$(DTB)
KERNEL_URL := $(URL_BASE)/$(RELEASE_TAG)/Image
KMOD_URL := $(URL_BASE)/$(RELEASE_TAG)/modules.tar.xz
TARGETS := debian archlinux alpine ubuntu
DL := dl
DL_KERNEL := $(DL)/kernel/$(RELEASE_TAG)
WGET_KERNEL := wget -P $(DL_KERNEL)
WGET_PKG := wget -P $(DL)
OUTPUT := output
help:
@echo "Usage: make build_[system1]=y build_[system2]=y build"
@echo "available system: $(TARGETS)"
build: $(TARGETS)
clean: $(TARGETS:%=%_clean)
dl_kernel: $(DL_KERNEL)/$(DTB) $(DL_KERNEL)/Image $(DL_KERNEL)/modules.tar.xz
$(DL_KERNEL)/$(DTB):
$(WGET_KERNEL) $(DTB_URL)
$(DL_KERNEL)/Image:
$(WGET_KERNEL) $(KERNEL_URL)
$(DL_KERNEL)/modules.tar.xz:
$(WGET_KERNEL) $(KMOD_URL)
ifeq ($(build_archlinux),y)
ARCHLINUX_PKG := ArchLinuxARM-aarch64-latest.tar.gz
ifneq ($(GITHUB_ACTIONS),)
ARCHLINUX_URL_BASE := http://os.archlinuxarm.org/os
else
ARCHLINUX_URL_BASE := https://mirrors.tuna.tsinghua.edu.cn/archlinuxarm/os
endif
archlinux: archlinux_dl
sudo ./build-archlinux.sh release $(DL)/$(ARCHLINUX_PKG) $(DL_KERNEL)
archlinux_dl: dl_kernel $(DL)/$(ARCHLINUX_PKG)
$(DL)/$(ARCHLINUX_PKG):
$(WGET_PKG) $(ARCHLINUX_URL_BASE)/$(ARCHLINUX_PKG)
archlinux_clean:
rm -f $(DL)/$(ARCHLINUX_PKG)
else
archlinux:
archlinux_clean:
endif
ifeq ($(build_alpine),y)
ALPINE_BRANCH := v3.13
ALPINE_VERSION := 3.13.5
ALPINE_PKG := alpine-minirootfs-$(ALPINE_VERSION)-aarch64.tar.gz
ifneq ($(GITHUB_ACTIONS),)
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
sudo ./build-alpine.sh release $(DL)/$(ALPINE_PKG) $(DL_KERNEL)
alpine_dl: dl_kernel $(DL)/$(ALPINE_PKG)
$(DL)/$(ALPINE_PKG):
$(WGET_PKG) $(ALPINE_URL_BASE)/$(ALPINE_PKG)
alpine_clean:
rm -f $(DL)/$(ALPINE_PKG)
else
alpine:
alpine_clean:
endif
ifeq ($(build_ubuntu),y)
UBUNTU_PKG := ubuntu-base-20.04.2-base-arm64.tar.gz
ifneq ($(GITHUB_ACTIONS),)
UBUNTU_URL_BASE := http://cdimage.ubuntu.com/ubuntu-base/releases/focal/release
else
UBUNTU_URL_BASE := https://mirrors.tuna.tsinghua.edu.cn/ubuntu-cdimage/ubuntu-base/releases/focal/release
endif
ubuntu: ubuntu_dl
sudo ./build-ubuntu.sh release $(DL)/$(UBUNTU_PKG) $(DL_KERNEL)
ubuntu_dl: dl_kernel $(DL)/$(UBUNTU_PKG)
$(DL)/$(UBUNTU_PKG):
$(WGET_PKG) $(UBUNTU_URL_BASE)/$(UBUNTU_PKG)
ubuntu_clean:
rm -f $(DL)/$(UBUNTU_PKG)
else
ubuntu:
ubuntu_clean:
endif
ifeq ($(build_debian),y)
debian: dl_kernel
sudo ./build-debian.sh release - $(DL_KERNEL)
debian_clean:
else
debian:
debian_clean:
endif