Skip to main content

RPI4 Cross Compile for libcamera-app on Mac Pro (with docker) (1): Preface

 

RPI4 Cross Compile for libcamera-app on Mac Pro (with docker) (1): Preface

Why am I doing this

After reading the camera app instructions, I thought of starting the development by modifying the libcamera-apps. Therefore, the first step is to build the original repo; after that, I can add my stuff to the official standard version.

It looks easy. The code-building instructions are well-documented on the official website, but there is a catch in my mind. I bought an expensive, neat, and tidy Macbook Pro after quitting my job as a mind-comforting geek gadget to compensate for losing my working life, so I don't want to build the code on a small RPI board. Instead, I want to build the code and develop things on my new laptop, which is why I got into this over tons of unexpected things just popping up in my sight…


Goals

  1. Create a docker container where I can cross-compile the libcamera-apps.
    1. Setup chroot
    2. Setup toolchain
    3. Build libcamera-apps
  2. The docker container should include the development environment I like.
    1. Setup vim
  3. Develop and debug for the self-built libcamera-apps
  4. My GitHub repository

Goals Explanation

First, I didn’t want to mess up my computer’s environment, so I chose to build a docker container with all the cross-compiling environment and tools.

Then, according to the materials [Earthly, A. Bhattacharyea] [Medium, S.Preston] I surveyed, the minimum things I should put into the docker container are two:

  • The sysroot (chroot) compatible with the system files of the RPI4.
  • The proper toolchain contains many binary tools that can help build the binaries and link the proper libraries from the sysroot to the binaries.

Since RPI OS is based on the Debian Linux distribution, Debian has good support for crossbuilding packages using multiarch[reference]. Therefore, if the environment is well set, the scenario will be that both sysroot, in the docker container, and RPI OS, in the separated target board, can update the system by using apt so that the cross-built binary from the sysroot can run the RPI OS without extra settings.

Next, about the toolchain, the resource [docker-arm-cross-toolchain] on the internet is provided for the X86 system, so I used the crosstool-ng to build my toolchain for my Macbook Pro with Apple M2 SoC.

In the end, for the simple building test, I tested by using CMake and meson, and the reason I tested on meson is the libcamea-apps deprecates the CMake build and switch to meson, so I have to know how to cross-compile with meson.

Comments

Popular posts from this blog

RPI4 Cross Compile for libcamera-app on Mac Pro (with docker) (4): Build libcamera-apps

  RPI4 Cross Compile for libcamera-app on Mac Pro (with docker) (4): Build libcamera-apps Why am I doing this After reading the  camera app instructions , I thought of starting the development by modifying the libcamera-apps. Therefore, the first step is to build the original repo; after that, I can add my stuff to the official standard version. It looks easy. The  code-building instructions  are well-documented on the official website, but there is a catch in my mind. I bought an expensive, neat, and tidy Macbook Pro after quitting my job as a mind-comforting geek gadget to compensate for losing my working life, so I don't want to build the code on a small RPI board. Instead, I want to build the code and develop things on my new laptop, which is why I got into this over tons of unexpected things just popping up in my sight… Preface Create a docker container where I can cross-compile the libcamera-apps. Setup chroot Setup toolchain Build libcamera-apps  <- The docker container s

RPI camera → website → Chromecast → TV: (2) Streaming the video to TV

 RPI camera → website → Chromecast → TV: (2) Streaming the video to TV Why am I doing this? As an unemployed engineer, I need to find interesting things to fill my leisure time. I found there is a thing I can do to make my life more convenient to see the toys under my couch without in the crowing position of bending my knee and waist to find the toys which are "eaten by the couch," my kids said. Maybe I can use a camera on RPI to see the area under the couch and project the streaming video onto the TV by Chromecast. That is my initial thought. Devices An RPI4 A V2 camera My computer that I can run a server on. A Chromecast and TV Goal Streaming the video to TV From the previous post , I can stream camera data from RPI to my computer; this time, I need to project the camera data to my TV. There are many ways to send the video to TV. My initial thoughts are that if I can write a website to show videos, I can project the webpage using the browser's built-in button, and all t

RPI camera → website → Chromecast → TV: (1) Capture video by RPI

 RPI camera → website → Chromecast → TV: (1) Capture video by RPI Why am I doing this? As an unemployed engineer, I need to find interesting things to fill my leisure time. I found there is a thing I can do to make my life more convenient to see the toys under my couch without in the crowing position of bending my knee and waist to find the toys which are “eaten by the couch,” my kids said. Maybe I can use a camera on RPI to see the area under the couch and project the streaming video onto the TV by Chromecast. That is my initial thought. Devices An RPI4 A V2 camera My computer that I can run a server on. A Chromecast and TV Goal Capture video by RPI libcamera-vid libcamera-vid is a built-in app for the RPI system. I found that the network streaming functionality can be enabled with libcamera-vid terminal command line, written in the official document . Thus, I can send the streamed video using the app by UDP, TCP, or RTSP. Benchmark setting The RPI camera captures the computer