2019-04-02 19:55:56 +00:00
|
|
|
.PHONY: help docker-image docker-shell citadel-image citadel-kernel user-rootfs update-submodules realmfs install-build-deps installer
|
2018-02-03 15:24:05 +00:00
|
|
|
|
|
|
|
BASE_DIR = $(shell pwd)
|
2018-02-05 04:02:09 +00:00
|
|
|
BASE_BINDMOUNT = type=bind,source=$(BASE_DIR),target=/home/builder/citadel
|
2018-03-07 23:54:18 +00:00
|
|
|
DOCKER_RUN = docker run -it --mount $(BASE_BINDMOUNT) citadel-builder
|
|
|
|
DOCKER_RUN_PRIV = docker run -it --privileged --mount $(BASE_BINDMOUNT) citadel-builder
|
2018-02-03 15:24:05 +00:00
|
|
|
|
2018-03-28 20:21:46 +00:00
|
|
|
ifdef REALM_NAME
|
|
|
|
undefine DOCKER_RUN
|
|
|
|
undefine DOCKER_RUN_PRIV
|
|
|
|
endif
|
|
|
|
|
2019-04-02 19:55:56 +00:00
|
|
|
REALMFS_IMAGE = build/realmfs/citadel-realmfs.ext4
|
2018-12-31 23:46:26 +00:00
|
|
|
INSTALLER_IMAGE = build/images/citadel-installer.img
|
|
|
|
|
2018-02-05 16:17:22 +00:00
|
|
|
#
|
|
|
|
# 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}'
|
2018-02-03 15:24:05 +00:00
|
|
|
|
2019-04-02 19:55:56 +00:00
|
|
|
installer: ${REALMFS_IMAGE} ## Build citadel installer image (This will build everything)
|
2018-12-31 23:46:26 +00:00
|
|
|
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake --continue citadel-installer-image"
|
|
|
|
@echo "Installer image:"
|
|
|
|
@ls -l $(INSTALLER_IMAGE)
|
|
|
|
|
2019-01-15 19:46:22 +00:00
|
|
|
rootfs: ## Build only citadel rootfs image
|
2018-12-31 23:46:26 +00:00
|
|
|
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake citadel-rootfs-image"
|
2018-02-05 16:17:22 +00:00
|
|
|
|
2019-01-15 19:46:22 +00:00
|
|
|
kernel: ## Build only citadel kernel
|
2018-02-05 16:17:22 +00:00
|
|
|
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake citadel-kernel"
|
2018-02-03 15:24:05 +00:00
|
|
|
|
2019-04-02 19:55:56 +00:00
|
|
|
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'
|
2018-02-13 15:32:31 +00:00
|
|
|
|
2019-01-15 19:46:22 +00:00
|
|
|
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
|
|
|
|
|
2019-01-15 17:40:31 +00:00
|
|
|
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"
|
|
|
|
|
2019-01-15 19:40:59 +00:00
|
|
|
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
|
|
|
|
|
2018-03-07 23:54:18 +00:00
|
|
|
install-build-deps:
|
2019-04-02 19:55:56 +00:00
|
|
|
sudo apt install --no-install-recommends build-essential python bzip2 cpio chrpath diffstat file texinfo inkscape libgmp-dev libmpc-dev libelf-dev gawk wget
|
2018-03-18 23:33:31 +00:00
|
|
|
|
2019-04-02 19:55:56 +00:00
|
|
|
$(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'
|
2018-12-31 23:46:26 +00:00
|
|
|
|
2019-04-02 19:55:56 +00:00
|
|
|
$(INSTALLER_IMAGE): $(REALMFS_IMAGE)
|
2018-12-31 23:46:26 +00:00
|
|
|
$(DOCKER_RUN) bash -c "source setup-build-env && bitbake citadel-installer-image"
|