-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (87 loc) · 2.67 KB
/
Copy pathMakefile
File metadata and controls
98 lines (87 loc) · 2.67 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
PLATFORMS?=linux/arm64
IMAGE?=archlinuxarm
KERNEL_FLAVOR?=rpi
.PHONY: binfmt
binfmt:
docker run --privileged --rm tonistiigi/binfmt --install arm64
# --- Builds ---
.PHONY: build-minimal
build-minimal:
docker buildx build \
--platform $(PLATFORMS) \
-t $(IMAGE):minimal-aarch64 \
-f dockerfiles/Dockerfile.base \
--target archarm \
--load \
.
.PHONY: build-aarch64
build-aarch64: binfmt
docker buildx build \
--platform $(PLATFORMS) \
-t $(IMAGE):generic-aarch64 \
-f dockerfiles/Dockerfile.aarch64 \
--target builder \
--load \
.
.PHONY: build-aarch64-rootfs
build-aarch64-rootfs: binfmt
docker buildx build \
--platform $(PLATFORMS) \
-t $(IMAGE):generic-aarch64-rootfs \
-f dockerfiles/Dockerfile.aarch64 \
--target export \
--load \
.
.PHONY: build-astroarch
build-astroarch: binfmt
docker buildx build \
--build-arg KERNEL_FLAVOR=$(KERNEL_FLAVOR) \
--platform $(PLATFORMS) \
-t astroarch:latest \
-f dockerfiles/Dockerfile.astroarch \
--target builder \
--load \
.
.PHONY: build-astroarch-rootfs
build-astroarch-rootfs: binfmt
docker buildx build \
--build-arg BUILDKIT_SANDBOX_SIZE=30G \
--build-arg KERNEL_FLAVOR=$(KERNEL_FLAVOR) \
--platform $(PLATFORMS) \
-t astroarch-rootfs:latest \
-f dockerfiles/Dockerfile.astroarch \
--target astroarch-rootfs \
--load \
.
.PHONY: build-aur
build-aur: binfmt
@if [ -z "$(PKG)" ]; then \
echo "Usage: make build-aur PKG=<aur-package-name>"; \
exit 1; \
fi
docker buildx build \
--platform $(PLATFORMS) \
-f dockerfiles/Dockerfile.aur \
--target export \
--build-arg PKG=$(PKG) \
--output type=local,dest=$(CURDIR) \
.
.PHONY: create-rootfs-container
create-rootfs-container:
docker create --platform=$(PLATFORMS) --name take astroarch-rootfs:latest sh
.PHONY: copy-rootfs-tar
copy-rootfs-tar:
docker cp take:/astroarch-rootfs.tar ./rootfs.tar
docker rm -f take
# --- Bootable images ---
# Board profiles live in boards/<name>.conf (KERNEL_FLAVOR, boot strategy,
# bootloader, console, ...). Add a board by dropping in a new .conf file -
# no Makefile changes needed.
.PHONY: check-board
check-board:
@[ -n "$(BOARD)" ] || { echo "Usage: make prepare-img BOARD=<board>"; exit 1; }
@[ -f boards/$(BOARD).conf ] || { echo "Unknown BOARD=$(BOARD) (no boards/$(BOARD).conf)"; exit 1; }
.PHONY: prepare-img
prepare-img: KERNEL_FLAVOR = $(shell . boards/$(BOARD).conf 2>/dev/null && echo $$KERNEL_FLAVOR)
prepare-img: check-board build-astroarch-rootfs create-rootfs-container copy-rootfs-tar
BOARD=$(BOARD) IMG=archarm-$(BOARD)-aarch64.img ./scripts/build_img.sh