-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
65 lines (48 loc) · 2.71 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
.PHONY: help docker-image docker-shell citadel-image citadel-kernel user-rootfs update-submodules realmfs install-build-deps installer
BASE_DIR = $(shell pwd)
BASE_BINDMOUNT = type=bind,source=$(BASE_DIR),target=/home/builder/citadel
DOCKER_RUN = docker run -it --mount $(BASE_BINDMOUNT) citadel-builder
DOCKER_RUN_PRIV = docker run -it --privileged --mount $(BASE_BINDMOUNT) citadel-builder
ifdef REALM_NAME
undefine DOCKER_RUN
undefine DOCKER_RUN_PRIV
endif
REALMFS_IMAGE = build/realmfs/citadel-realmfs.ext4
INSTALLER_IMAGE = build/images/citadel-installer.img
#
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
#
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
installer: ${REALMFS_IMAGE} ## Build citadel installer image (This will build everything)
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake --continue citadel-installer-image"
@echo "Installer image:"
@ls -l $(INSTALLER_IMAGE)
rootfs: ## Build only citadel rootfs image
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake citadel-rootfs-image"
kernel: ## Build only citadel kernel
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake citadel-kernel"
realmfs: ## Build only base realmfs image
$(DOCKER_RUN_PRIV) bash -c 'sudo REALMFS_BUILDER_BASE=$${PWD}/realmfs-builder realmfs-builder/stage-one.sh --no-confirm -i -d build/realmfs'
docker-image: ## Create docker builder image. You need to run this one time before running anything else.
docker build -t citadel-builder scripts/docker
docker-shell: ## Open an interactive shell in the docker build container configured for running bitbake commands.
$(DOCKER_RUN)
update-submodules: ## Retrieve or update submodule projects
git submodule update --init
fetch-all: ## Download all source packages needed for build in advance
mkdir -p build/conf
echo 'BB_NUMBER_THREADS="2"' > build/conf/fetch-prefile.conf
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake --read=conf/fetch-prefile.conf --continue --runall=fetch citadel-installer-image"
installer-test: ## Boot installer image with Qemu
@scripts/qemu-boot installer
kernel-test: ## Boot kernel with Qemu ('ctrl-a x' to exit qemu)
@scripts/qemu-boot kernel
install-build-deps:
sudo apt install --no-install-recommends build-essential python bzip2 cpio chrpath diffstat file texinfo inkscape libgmp-dev libmpc-dev libelf-dev gawk wget
$(REALMFS_IMAGE):
@mkdir -p build/realmfs
$(DOCKER_RUN_PRIV) bash -c 'sudo REALMFS_BUILDER_BASE=$${PWD}/realmfs-builder realmfs-builder/stage-one.sh --no-confirm -i -d build/realmfs'
$(INSTALLER_IMAGE): $(REALMFS_IMAGE)
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake citadel-installer-image"