aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Stratiienko <r.stratiienko@gmail.com>2022-12-16 12:57:27 +0200
committerRoman Stratiienko <r.stratiienko@gmail.com>2023-01-04 17:17:36 +0200
commit2bf68c374976d0a7a0e71c1843cbeae2a3210b74 (patch)
tree6c965c7b3736754bbaa9f9e6ced196275fade3f6
parent380948102b746dc831b770105e1df1b6c621ded4 (diff)
downloaddrm_hwcomposer-2bf68c374976d0a7a0e71c1843cbeae2a3210b74.tar.gz
drm_hwcomposer: Add meson build to CI
Now CI is building drm_hwcomposer for arm64 arch and generates ready-to-deploy artifacts. Dependencies for meson cross build were extracted from Android-13 using GloDroid/aospext project [1]. ./build_deploy.sh script was migrated into Makefile and no longer require AOSP to work. Usage example: make build_deploy Only arm64 platform is supported at this moment. Other platforms will be added later. [1]: https://github.com/GloDroid/aospext Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
-rw-r--r--.ci/Dockerfile10
-rw-r--r--.gitlab-ci.yml23
-rw-r--r--Makefile32
-rwxr-xr-xbuild_deploy.sh26
4 files changed, 60 insertions, 31 deletions
diff --git a/.ci/Dockerfile b/.ci/Dockerfile
index d0ecee2..32c348f 100644
--- a/.ci/Dockerfile
+++ b/.ci/Dockerfile
@@ -6,7 +6,8 @@ ENV PATH="/home/user/bin:${PATH}"
# Taking into account layer structure, everything should be done within one layer.
RUN apt-get update && apt-get upgrade -y && \
- apt-get install -y clang-15 clang-tidy-15 clang-format-15 git libdrm-dev blueprint-tools libgtest-dev clang llvm make python3 python3-pip wget sudo && \
+ apt-get install -y clang-15 clang-tidy-15 clang-format-15 git libdrm-dev blueprint-tools libgtest-dev clang \
+ llvm make python3 python3-pip wget sudo rsync lld pkg-config ninja-build && \
pip3 install mako meson jinja2 ply pyyaml
ENV RUN_USER user
@@ -35,6 +36,13 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> \
# Pass control to a newly created user
USER ${RUN_USER}
+# Install aospless package (produced by GloDroid/aospext)
+RUN wget -P ${USER_HOME} https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/uploads/28ef9379b1a0ec1ee19a17825b0f3f3f/aospless_drm_hwcomposer_arm64.tar.xz && \
+ cd ${USER_HOME} && \
+ (echo 96b2148d04c50cf36d4151ae022e665764b8ca3317712e9467a433b62c545a43 aospless_drm_hwcomposer_arm64.tar.xz | sha256sum --check) && \
+ tar xf aospless_drm_hwcomposer_arm64.tar.xz && \
+ rm -r ${USER_HOME}/aospless/src && ln -s ../drm_hwcomposer/ ${USER_HOME}/aospless/src
+
# Create project path
RUN mkdir -pv ${USER_HOME}/drm_hwcomposer
WORKDIR ${USER_HOME}/drm_hwcomposer
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f7f9caa..bfc4ede 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,18 +6,35 @@ variables:
before_script:
- apt-get --quiet update --yes >/dev/null
- apt-get --quiet install --yes clang-15 clang-tidy-15 clang-format-15 git libdrm-dev blueprint-tools libgtest-dev make >/dev/null
+ - apt-get --quiet install --yes clang llvm make python3 python3-pip wget sudo rsync lld pkg-config ninja-build >/dev/null
+ - pip3 install mako meson jinja2 ply pyyaml >/dev/null
stages:
- build
+ - tidy
- style
build:
stage: build
script:
- - make -f .ci/Makefile
+ - mkdir -p install/arm64
+ - cd ..
+ - wget https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/uploads/28ef9379b1a0ec1ee19a17825b0f3f3f/aospless_drm_hwcomposer_arm64.tar.xz
+ - tar xf aospless_drm_hwcomposer_arm64.tar.xz
+ - rm -r aospless/src
+ - ln -s ../drm-hwcomposer/ aospless/src
+ - make -C ./aospless all
+ - cp -r aospless/install/* drm-hwcomposer/install/arm64
+
artifacts:
- when: on_failure
- untracked: true
+ paths:
+ - install/
+ expire_in: 1 week
+
+tidy:
+ stage: tidy
+ script:
+ - make -f .ci/Makefile
checkstyle:
stage: style
diff --git a/Makefile b/Makefile
index 16269e2..98e33af 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ $(warning and reboot your PC)
$(error Aborting...)
endef
-.PHONY : help prepare shell ci ci_cleanup local_presubmit local_cleanup
+.PHONY : help prepare shell ci_fast ci ci_cleanup build_deploy bd local_presubmit local_cleanup
.DEFAULT_GOAL := help
help: ## Show this help
@@ -41,10 +41,17 @@ shell: $(PREPARE)
shell: ## Start shell into a container
$(DOCKER_BIN) exec -it $(IMAGE_NAME) bash
+ci_fast: $(PREPARE)
+ci_fast: ## Run meson build for arm64 in docker container
+ @echo "Run meson cross-build for Android:"
+ $(DOCKER_BIN) exec -it $(IMAGE_NAME) bash -c "make -C ~/aospless all"
+
ci: $(PREPARE)
ci: ## Run presubmit within the docker container
@echo "Run native build:"
$(DOCKER_BIN) exec -it $(IMAGE_NAME) bash -c "make -f .ci/Makefile -j$(NPROCS)"
+ @echo "Run meson cross-build for Android:"
+ $(DOCKER_BIN) exec -it $(IMAGE_NAME) bash -c "make -C ~/aospless all"
@echo "Run style check:"
$(if $(GIT_IS_SYMLINK), \
./.ci/.gitlab-ci-checkcommit.sh, \
@@ -53,6 +60,29 @@ ci: ## Run presubmit within the docker container
ci_cleanup: ## Cleanup after 'make ci'
$(DOCKER_BIN) exec -it $(IMAGE_NAME) bash -c "make local_cleanup"
+ $(DOCKER_BIN) exec -it $(IMAGE_NAME) bash -c "rm -rf ~/aospless/build"
+ $(DOCKER_BIN) exec -it $(IMAGE_NAME) bash -c "rm -rf ~/aospless/install"
+ $(DOCKER_BIN) exec -it $(IMAGE_NAME) bash -c "rm -rf ~/aospless/out_src"
+
+build_deploy: $(PREPARE)
+build_deploy: ## Build for Andoid and deploy onto the target device (require active adb device connected)
+ $(if $(filter $(shell adb shell getprop ro.bionic.arch),arm64),,$(error arm64 only is supported at the moment))
+ adb root && adb remount vendor
+ mkdir -p .out/arm64
+ $(DOCKER_BIN) exec -it $(IMAGE_NAME) bash -c "make -C ~/aospless all"
+ $(DOCKER_BIN) exec -it $(IMAGE_NAME) bash -c "cp -r ~/aospless/install/* ~/drm_hwcomposer/.out/arm64"
+ adb push .out/arm64/vendor/lib64/hw/hwcomposer.drm.so /vendor/lib64/hw/hwcomposer.drm.so
+ adb shell stop
+ adb shell stop vendor.hwcomposer-2-1 && adb shell start vendor.hwcomposer-2-1 || true
+ adb shell stop vendor.hwcomposer-2-2 && adb shell start vendor.hwcomposer-2-2 || true
+ adb shell stop vendor.hwcomposer-2-3 && adb shell start vendor.hwcomposer-2-3 || true
+ adb shell stop vendor.hwcomposer-2-4 && adb shell start vendor.hwcomposer-2-4 || true
+ bash -c '[[ "$$HWCLOG" -eq "1" ]] && adb logcat -c || true'
+ adb shell start
+ bash -c '[[ "$$HWCLOG" -eq "1" ]] && adb logcat | grep -i hwc || true'
+
+bd: build_deploy
+bd: ## Alias for build_deploy
local_presubmit: ## Run local presubmit script (requires latest Ubuntu + additional packages). Consider 'make ci' instead
@echo "Run native build:"
diff --git a/build_deploy.sh b/build_deploy.sh
deleted file mode 100755
index ef25e5c..0000000
--- a/build_deploy.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash -e
-
-# To see logs after deploy run: $ HWCLOG=1 TESTDEV=<DEV> ./build_deploy.sh
-
-[ -z "$TESTDEV" ] && echo "Run $ TESTDEV=<Your lunch target> ./build_deploy.sh" && false
-
-cd ../..
-. build/envsetup.sh
-lunch $TESTDEV
-cd -
-
-mm
-
-adb root && adb remount && adb sync vendor
-
-adb shell stop
-adb shell stop vendor.hwcomposer-2-1 && adb shell start vendor.hwcomposer-2-1 || true
-adb shell stop vendor.hwcomposer-2-2 && adb shell start vendor.hwcomposer-2-2 || true
-adb shell stop vendor.hwcomposer-2-3 && adb shell start vendor.hwcomposer-2-3 || true
-adb shell stop vendor.hwcomposer-2-4 && adb shell start vendor.hwcomposer-2-4 || true
-
-[ $HWCLOG -eq "1" ] && adb logcat -c
-
-adb shell start
-
-[ $HWCLOG -eq "1" ] && adb logcat | grep -i hwc