blob: 708fdb26edf7c7f099f6b215dd305395ffcc8b02 (
plain)
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
|
# use sudo (non interactively) when running as regular user
ifneq ($(shell id -u),0)
AS_ROOT := sudo -n
endif
CTR := podman
CTR_IMG_TAG := avans-linux
CTRIZE := $(CTR) run
CTRIZE += --rm
CTRIZE += --tty
CTRIZE += --volume /tmp:/tmp:rw
CTRIZE += --volume .:/workdir:rw
CTRIZE += --env-file ./env
CTRIZE += --env MAKE*
CTRIZE += $(CTR_IMG_TAG)
export
# create dummy files to represent non-file targets (container image build
# status, sd card partition status, git submodule initialization, etc.)
$(eval $(shell state/gen))
# read environment variables from ./env
include ./env
export
.PHONY: FORCE
all: FORCE load_boot load_rootfs
include state.mk
include base.mk
include software.mk
build_kernel: FORCE $(KERNEL_FILES)
build_bootloader: FORCE $(BOOTLOADER_FILES)
build_software: FORCE $(SOFTWARE_FILES)
load_boot: FORCE $(FILES_PART_BOOT) state/sdcard_fmt
mkdir -p mnt/boot
$(AS_ROOT) mount $(SDCARD_PART_BOOT) mnt/boot
$(AS_ROOT) cp $(FILES_PART_BOOT) mnt/boot
$(AS_ROOT) sync
$(AS_ROOT) umount mnt/boot
load_rootfs: FORCE $(FILES_PART_ROOTFS) state/sdcard_fmt
mkdir -p mnt/rootfs
$(AS_ROOT) mount $(SDCARD_PART_ROOTFS) mnt/rootfs
$(AS_ROOT) util/mkrootfs mnt/rootfs
$(AS_ROOT) sync
$(AS_ROOT) umount mnt/rootfs
status: FORCE
@echo 'ENVIRONMENT'
@state/gen | grep ':=' | sed -e 's/^\$$(eval / /' -e 's/)$$//'
@echo 'TARGETS'
@ls state | awk '$$0 == "gen" { next } { print }' | sed 's/^/ /'
__software_files: FORCE
@echo $(SOFTWARE_FILES) | tr ' ' '\n'
|