diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 51a42d4..54be796 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,17 +13,42 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: pguyot/arm-runner-action@v2 + + # From https://github.com/pguyot/arm-runner-action/blob/main/.github/workflows/test-cache.yml + - uses: actions/cache@v3 + id: cache + with: + path: $RUNNER_TEMP/photon_libcam_builder.img + key: ${{ hashFiles('**/*.yml') }} + - uses: pguyot/arm-runner-action@HEAD + id: install_deps + if: steps.cache.outputs.cache-hit != 'true' + with: + # we don't want to optimize as it's two-stage + optimize_image: no + image_additional_mb: 1500 + base_image: https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2023-12-11/2023-12-11-raspios-bookworm-arm64-lite.img.xz + commands: | + apt-get update + apt-get install -y libopencv-dev libegl1-mesa-dev libcamera-dev cmake build-essential libdrm-dev libgbm-dev default-jdk openjdk-17-jdk + + - name: Move and rename image with dependencies + if: steps.cache.outputs.cache-hit != 'true' + run: | + mv ${{ steps.install_deps.outputs.image }} $RUNNER_TEMP/photon_libcam_builder.img + + - uses: pguyot/arm-runner-action@HEAD with: - base_image: raspios_lite_arm64:latest + base_image: file://$RUNNER_TEMP/photon_libcam_builder.img cpu: cortex-a7 image_additional_mb: 1500 bind_mount_repository: true + # Update again anyways to pull down the latest libcamera et al commands: | apt-get update apt-get install -y libopencv-dev libegl1-mesa-dev libcamera-dev cmake build-essential libdrm-dev libgbm-dev default-jdk openjdk-17-jdk cmake -B build-pi -DCMAKE_BUILD_TYPE=Release - cmake --build build-pi -j 4 + cmake --build build-pi -- -j - run: find . @@ -54,3 +79,15 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-chroot: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: | + sudo apt-get update && sudo apt-get install -y qemu qemu-user-static binfmt-support + docker run --mount type=bind,source=$(pwd),target=/opt/photon_sysroot/work mcm001/photon-libcamera-builder-entry:latest chroot /opt/photon_sysroot bash -c 'uname -a && cat /etc/os-release && cd /work && cmake -B build-pi -DCMAKE_BUILD_TYPE=Release && cmake --build build-pi -- -j' + - uses: actions/upload-artifact@master + with: + name: libcamera-driver-chroot + path: build-pi/*.so diff --git a/.gitignore b/.gitignore index e48269c..8b0f973 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .idea/ .vscode build +build-pi .cache/ compile_commands.json +photon_sysroot \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 73a38f3..9ca75cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.25.1) +cmake_minimum_required(VERSION 3.15) project(libcamera_meme) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..31a2812 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM ubuntu:22.04 +RUN apt-get update && apt-get install -y qemu qemu-user-static binfmt-support libopencv-dev libegl1-mesa-dev libcamera-dev cmake build-essential libdrm-dev libgbm-dev default-jdk openjdk-17-jdk && apt-get clean +COPY photon_sysroot /opt/photon_sysroot diff --git a/README.md b/README.md index 793c762..90b55bc 100644 --- a/README.md +++ b/README.md @@ -30,3 +30,19 @@ This should spit out the shared library into the build directory. Compile with `g++ -std=c++17 -o eglinfo eglinfo.c headless_opengl.cpp -lEGL -lGLESv2 -lgbm`, and then run with `./eglinfo` +## Chroot stuff + +Using our docker image and run with --privileged + +docker run -it --privileged --mount type=bind,source="$(pwd)",target=/opt/photon_sysroot_v2023.4.2/opt/photon-libcamera-gl-driver photon-libcamera-builder:latest +/opt/photon_sysroot_v2023.4.2/opt/photon-libcamera-gl-driver/start_chroot.sh + +Or + +docker run -it --privileged --mount type=bind,source="$(pwd)",target=/opt/photon_sysroot_v2023.4.2/opt/photon-libcamera-gl-driver photon-libcamera-builder-entry:latest + +# git clone ${{ github.repositoryUrl }} && cd "$(basename "$_" .git)" + + +rm -rf /var/lib/apt/lists/* +locale-gen --purge POSTIX && echo 'Success!'