forked from ROCKNIX/distribution
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
160 lines (116 loc) · 6.3 KB
/
Makefile
File metadata and controls
160 lines (116 loc) · 6.3 KB
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
-include $(HOME)/.ROCKNIX/options
all: world
system:
./scripts/image
release:
./scripts/image release
image:
./scripts/image mkimage
noobs:
./scripts/image noobs
clean:
./scripts/makefile_helper --clean
distclean:
./scripts/makefile_helper --distclean
src-pkg:
tar cvJf sources.tar.xz sources
docs:
./tools/foreach './scripts/clean emulators && ./scripts/build emulators'
world: RK3588 RK3576 RK3566 RK3326 RK3399 S922X SM8250 SM8550 H700 SM8650
kconfig-olddefconfig-%:
DEVICE=$* ./tools/adjust_kernel_config olddefconfig
kconfig-menuconfig-%:
DEVICE=$* ./tools/adjust_kernel_config menuconfig
RK3588:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=RK3588 ARCH=arm ./scripts/build_distro
PROJECT=ROCKNIX DEVICE=RK3588 ARCH=aarch64 ./scripts/build_distro
RK3576:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=RK3576 ARCH=arm ./scripts/build_distro
PROJECT=ROCKNIX DEVICE=RK3576 ARCH=aarch64 ./scripts/build_distro
S922X:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=S922X ARCH=arm ./scripts/build_distro
PROJECT=ROCKNIX DEVICE=S922X ARCH=aarch64 ./scripts/build_distro
RK3566:
unset DEVICE_ROOT
DEVICE_ROOT=RK3566 PROJECT=ROCKNIX DEVICE=RK3566 ARCH=arm ./scripts/build_distro
DEVICE_ROOT=RK3566 PROJECT=ROCKNIX DEVICE=RK3566 ARCH=aarch64 ./scripts/build_distro
RK3326:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=RK3326 ARCH=arm ./scripts/build_distro
PROJECT=ROCKNIX DEVICE=RK3326 ARCH=aarch64 ./scripts/build_distro
RK3399:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=RK3399 ARCH=arm ./scripts/build_distro
PROJECT=ROCKNIX DEVICE=RK3399 ARCH=aarch64 ./scripts/build_distro
H700:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=H700 ARCH=arm ./scripts/build_distro
PROJECT=ROCKNIX DEVICE=H700 ARCH=aarch64 ./scripts/build_distro
SM6115:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=SM6115 ARCH=arm ./scripts/build_distro
PROJECT=ROCKNIX DEVICE=SM6115 ARCH=aarch64 ./scripts/build_distro
SM8250:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=SM8250 ARCH=arm ./scripts/build_distro
PROJECT=ROCKNIX DEVICE=SM8250 ARCH=aarch64 ./scripts/build_distro
SM8550:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=SM8550 ARCH=arm ./scripts/build_distro
PROJECT=ROCKNIX DEVICE=SM8550 ARCH=aarch64 ./scripts/build_distro
SM8650:
unset DEVICE_ROOT
PROJECT=ROCKNIX DEVICE=SM8650 ARCH=aarch64 ./scripts/build_distro
update:
PROJECT=ROCKNIX DEVICE=RK3588 ARCH=aarch64 ./scripts/update_packages
package:
./scripts/build ${PACKAGE}
package-clean:
./scripts/clean ${PACKAGE}
## Docker builds - overview
# docker-* commands just wire up docker to call the normal make command via docker
# For example: make docker-SM8250 will use docker to call: make SM8250
# All variables are scoped to docker-* commands to prevent weird collisions/behavior with non-docker commands
docker-%: DOCKER_IMAGE := "ghcr.io/rocknix/rocknix-build:latest"
# DOCKER_WORK_DIR is the directory in the Docker image - it is set to /work by default
# Anytime this directory changes, you must run `make clean` similarly to moving the distribution directory
docker-%: DOCKER_WORK_DIR := $(shell if [ -n "${DOCKER_WORK_DIR}" ]; then echo ${DOCKER_WORK_DIR}; else echo "$$(pwd)" ; fi)
# ${HOME}/.rocknix/options is a global options file containing developer and build settings.
docker-%: GLOBAL_SETTINGS := $(shell if [ -f "${HOME}/.rocknix/options" ]; then echo "-v \"${HOME}/.rocknix/options:${HOME}/.rocknix/options\""; else echo ""; fi)
# LOCAL_SSH_KEYS_FILE is a variable that contains the location of the authorized keys file for development build use. It will be mounted into the container if it exists.
docker-%: LOCAL_SSH_KEYS_FILE := $(shell if [ -n "${LOCAL_SSH_KEYS_FILE}" ]; then echo "-v \"${LOCAL_SSH_KEYS_FILE}:${LOCAL_SSH_KEYS_FILE}\""; else echo ""; fi)
# EMULATIONSTATION_SRC is a variable that contains the location of local emulationstation source code. It will be mounted into the container if it exists.
docker-%: EMULATIONSTATION_SRC := $(shell if [ -n "${EMULATIONSTATION_SRC}" ]; then echo "-v \"${EMULATIONSTATION_SRC}:${EMULATIONSTATION_SRC}\""; else echo ""; fi)
# UID is the user ID of current user - ensures docker sets file permissions properly
docker-%: UID := $(shell id -u)
# GID is the main user group of current user - ensures docker sets file permissions properly
docker-%: GID := $(shell id -g)
# PWD is 'present working directory' and passes through the full path to current dir to docker (becomes 'work')
docker-%: PWD := $(shell pwd)
# Command to use (either `docker` or `podman`)
docker-%: DOCKER_CMD:= $(shell if which docker 2>/dev/null 1>/dev/null; then echo "docker"; elif which podman 2>/dev/null 1>/dev/null; then echo "podman"; fi)
# Podman requires some extra args (`--userns=keep-id` and `--security-opt=label=disable`). Set those args if using podman
# Make sure that docker isn't just an alias for podman
docker-%: PODMAN_ARGS:= $(shell if echo "$$(docker --version 2>/dev/null || podman --version 2>/dev/null )" | grep podman 1>/dev/null ; then echo "--userns=keep-id --security-opt=label=disable -v /proc/mounts:/etc/mtab"; fi)
# Launch docker as interactive if this is an interactive shell (allows ctrl-c for manual and running non-interactive - aka: build server)
docker-%: INTERACTIVE=$(shell [ -t 0 ] && echo "-it")
# By default pass through anything after `docker-` back into `make`
docker-%: COMMAND=make $*
# Get .env file ready
docker-%: $(shell ./scripts/get_env > .env)
# If the user issues a `make docker-shell` just start up bash as the shell to run commands
docker-shell: COMMAND=bash
# Command: builds and saves a docker builder image locally.
# The build user must also be a member of the "docker" group.
docker-image-build:
$(DOCKER_CMD) buildx create --use
$(DOCKER_CMD) buildx build --tag $(DOCKER_IMAGE) --platform $(shell if [ "$$(uname -m)" = "aarch64" ]; then echo "linux/arm64"; else echo "linux/amd64"; fi) --load .
# Command: pulls latest docker image from dockerhub. This will *replace* locally built version.
docker-image-pull:
$(DOCKER_CMD) pull $(DOCKER_IMAGE)
# Wire up docker to call equivalent make files using % to match and $* to pass the value matched by %
docker-%:
BUILD_DIR=$(DOCKER_WORK_DIR) $(DOCKER_CMD) run $(PODMAN_ARGS) $(INTERACTIVE) --init --env-file .env --rm --user $(UID):$(GID) $(GLOBAL_SETTINGS) $(LOCAL_SSH_KEYS_FILE) $(EMULATIONSTATION_SRC) -v $(PWD):$(DOCKER_WORK_DIR) -w $(DOCKER_WORK_DIR) $(DOCKER_EXTRA_OPTS) $(DOCKER_IMAGE) $(COMMAND)