### Install Camera Utilities and Man Pages Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_utils/CMakeLists.txt Installs the built executables to the bin directory and their corresponding man pages. ```cmake install(TARGETS raspistill raspiyuv raspivid raspividyuv RUNTIME DESTINATION bin) install(FILES raspistill.1 raspiyuv.1 raspivid.1 raspividyuv.1 DESTINATION man/man1) install(FILES raspicam.7 DESTINATION man/man7) ``` -------------------------------- ### Install libgpiod Development Library Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_tests/install_sdl.txt Installs the libgpiod-dev package. Similar to the SDL installation, it bypasses certificate validation and check-date. ```bash sudo apt -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false -o "Acquire::https::Verify-Peer=false" install libgpiod-dev ``` -------------------------------- ### Install SDL2 and SDL1.2 Development Libraries Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_tests/install_sdl.txt Installs libsdl2-dev, libsdl1.2-dev, and libconfig++-dev. The apt options bypass certificate validation and check-date for older repositories. ```bash sudo apt -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false -o "Acquire::https::Verify-Peer=false" --fix-missing install libsdl2-dev libsdl1.2-dev libconfig++-dev ``` -------------------------------- ### Install SDL and Configuration Libraries with SSL Verification Disabled Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Installs SDL (Simple DirectMedia Layer) development libraries and configuration libraries, bypassing SSL verification for package sources. Includes a fix for missing packages. ```bash sudo apt -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false -o "Acquire::https::Verify-Peer=false" install --fix-missing libsdl2-dev libsdl1.2-dev libconfig++-dev ``` -------------------------------- ### Install GPIO and I2C Development Libraries with SSL Verification Disabled Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Installs libraries for GPIO (libgpiod-dev) and I2C communication (i2c-tools, libi2c-dev, linux-libc-dev), disabling SSL verification for package sources. ```bash sudo apt-get -o "Acquire::https::Verify-Peer=false" install -y libgpiod-dev sudo apt -o "Acquire::https::Verify-Peer=false" install -y i2c-tools libi2c-dev linux-libc-dev ``` -------------------------------- ### Install Linux kernel build header files Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt Install the necessary header files for building the Linux kernel. These are often required for compiling kernel modules or specific software that interacts with the kernel. ```bash sudo apt-get install raspberrypi-kernel-headers ``` -------------------------------- ### Build MPP Repository using CMake and Make Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Navigates into the cloned MPP directory, configures the build using CMake, and then builds and installs the project using Make. This is the standard build process for the MPP library. ```bash cd mpp cmake -B build sudo cmake --build build --target install ``` -------------------------------- ### Install Development Libraries with SSL Verification Disabled Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Installs essential development libraries required for building software, such as libdrm-dev and libcairo-dev, while disabling SSL certificate verification for package sources. ```bash sudo apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false -o "Acquire::https::Verify-Peer=false" install -y libdrm-dev libcairo-dev ``` -------------------------------- ### Install CMake Build System Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Installs CMake, a cross-platform build system generator, which is commonly used for managing the build process of C/C++ projects. ```bash sudo apt install cmake ``` -------------------------------- ### Include Directories Setup Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_utils/CMakeLists.txt Specifies the directories to include for header files during the build process. ```cmake include_directories(${PROJECT_SOURCE_DIR}/host_applications/linux/libs/bcm_host/include) include_directories(${PROJECT_SOURCE_DIR}/host_applications/linux/apps/raspicam/) include_directories(${PROJECT_SOURCE_DIR}/host_applications/linux/libs/sm) ``` -------------------------------- ### Pico SPI Project CMakeLists.txt Setup Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_tests/pico_spi/CMakeLists.txt This snippet configures the build system for a Raspberry Pi Pico project using CMake. It sets the minimum CMake version, includes the Pico SDK, defines C and C++ standards, initializes the SDK, and adds the main application directory. ```cmake cmake_minimum_required(VERSION 3.13) include(pico_sdk_import.cmake) project(pico_project C CXX ASM) set(CMAKE_C_STANDARD 11) set(CMAKE_CXX_STANDARD 17) pico_sdk_init() add_subdirectory(main) ``` -------------------------------- ### Update apt sources with a mirror Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt If package installation fails, edit the sources.list file to use a specific mirror server from the provided list. This ensures a reliable source for package updates. ```bash deb http://mirror.aarnet.edu.au/pub/raspbian/raspbian buster main contrib non-free rpi ``` -------------------------------- ### Compile raspivid with userland modifications Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt To compile raspivid, update and upgrade packages, install build tools, and then modify the userland build script. Remove the 'install' part from the buildme script to prevent conflicts. ```bash sudo apt update sudo apt upgrade sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential ``` ```bash if [ "$1" != "" ]; then sudo make install DESTDIR=$1 else sudo make install fi ``` -------------------------------- ### Clean apt lists when package installation fails Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt If you encounter issues installing packages, remove the contents of the apt lists directory and then run an update. This can resolve problems caused by corrupted or outdated list files. ```bash sudo rm -r /var/lib/apt/lists/* sudo apt update ``` -------------------------------- ### Get Git Commit ID Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_utils/CMakeLists.txt Executes a git command to retrieve the short commit hash and defines it for the compiler. ```cmake execute_process( COMMAND git log -1 --abbrev=12 --format=%h OUTPUT_VARIABLE GIT_COMMIT_ID OUTPUT_STRIP_TRAILING_WHITESPACE ) add_definitions("-DGIT_COMMIT_ID=\"${GIT_COMMIT_ID}\"" ) ``` -------------------------------- ### Compile userland using buildme script Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt Navigate to the userland folder and execute the buildme script to compile the userland components. This is a standard method for building the necessary libraries and tools. ```bash ./buildme ``` -------------------------------- ### Compile userland using CMake Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt Alternatively, compile userland by creating a build directory, changing into it, and using CMake to configure the build. Then, use make to compile the project. ```bash mkdir build cd build cmake ../ make ``` -------------------------------- ### Define Common Source Files Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_utils/CMakeLists.txt Lists common source files used by multiple camera utilities. ```cmake set (COMMON_SOURCES RaspiCamControl.c RaspiCLI.c RaspiPreview.c RaspiCommonSettings.c RaspiHelpers.c RaspiGPS.c base.c libgps_loader.c) ``` -------------------------------- ### Link Common Dependencies Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_tests/pico_spi/main/CMakeLists.txt Links the target against common Pico SDK libraries, including stdlib and hardware_spi. ```cmake # pull in common dependencies target_link_libraries(test_spi pico_stdlib hardware_spi) ``` -------------------------------- ### Define Executable and Source Files Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_tests/pico_spi/main/CMakeLists.txt Defines the executable target name and its source files. ```cmake add_executable(test_spi test_spi.c) ``` -------------------------------- ### Configure EGL and GL Scene Sources Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_utils/CMakeLists.txt Conditionally sets EGL and OpenGL scene source files based on the ARM64 architecture. ```cmake if(NOT ARM64) set (EGL_LIBS brcmGLESv2 brcmEGL) set (EGL_SOURCES RaspiTex.c RaspiTexUtil.c tga.c) set (GL_SCENE_SOURCES gl_scenes/models.c gl_scenes/mirror.c gl_scenes/yuv.c gl_scenes/sobel.c gl_scenes/square.c gl_scenes/teapot.c gl_scenes/vcsm_square.c) else() set (EGL_SOURCES RaspiTexStub.c) endif() ``` -------------------------------- ### Capture video with ruby_capture_raspi Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt This command captures video using the ruby_capture_raspi tool with various H.264 encoding parameters. It logs output to a file and runs in the background. ```bash ./ruby_capture_raspi -cd H264 -n -fl -w 1280 -h 720 -fps 30 -g 12 -b 7000000 -ih -pf main -lev 4.1 -if cyclic -br 57 -co -11 -sa -20 -sh 9 -vf -hf -drc med -ex backlight -awb auto -mm backlit -a "DEV" -log -t 0 -o - >> tmp/ruby/fifocam & ``` -------------------------------- ### Define Executable Targets Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_utils/CMakeLists.txt Creates executable targets for raspistill, raspiyuv, raspivid, and raspividyuv. ```cmake add_executable(raspistill ${COMMON_SOURCES} RaspiStill.c ${EGL_SOURCES} ${GL_SCENE_SOURCES} ) add_executable(raspiyuv ${COMMON_SOURCES} RaspiStillYUV.c) add_executable(raspivid ${COMMON_SOURCES} RaspiVid.c) add_executable(raspividyuv ${COMMON_SOURCES} RaspiVidYUV.c) ``` -------------------------------- ### Build Kernel Drivers for Raspberry Pi 3 Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Compiles the kernel drivers for Raspberry Pi 3 using Make, specifying the kernel version and source path. The '-j4' flag enables parallel compilation with 4 jobs. ```bash make -j4 KVER=5.10.103-v7+ KSRC=/lib/modules/5.10.103-v7+/build ``` -------------------------------- ### Set Compiler Options Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_tests/pico_spi/main/CMakeLists.txt Applies private compile-time options, such as enabling all warnings. ```cmake target_compile_options(test_spi PRIVATE -Wall) ``` -------------------------------- ### Set Compiler Warnings and Linker Flags Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_utils/CMakeLists.txt Configures the build to treat warnings as errors and sets the linker to not use --as-needed for mmal_vc_client. ```cmake SET(COMPILE_DEFINITIONS -Werror) # Set --no-as-needed to stop the linker discarding mmal_vc_client # as it can't see that the constructor registers a load of functionality # with the MMAL core. SET( CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed" ) ``` -------------------------------- ### Link MMAL Libraries to Targets Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_utils/CMakeLists.txt Links the necessary MMAL and other libraries to the camera utility executables. ```cmake set (MMAL_LIBS mmal_core mmal_util mmal_vc_client) target_link_libraries(raspistill ${MMAL_LIBS} vcos bcm_host ${EGL_LIBS} m dl) target_link_libraries(raspiyuv ${MMAL_LIBS} vcos bcm_host m) target_link_libraries(raspivid ${MMAL_LIBS} vcos bcm_host m) target_link_libraries(raspividyuv ${MMAL_LIBS} vcos bcm_host m) ``` -------------------------------- ### Set environment variables for userland compilation Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt After modifying the build script, set the necessary environment variables for CPATH and C_INCLUDE_PATH to point to the opt/vc/include directory. This ensures the compiler can find the required header files. ```bash export PATH=$PATH:/opt/vc/include export CPATH=/opt/vc/include/ export C_INCLUDE_PATH=/opt/vc/include/ ``` -------------------------------- ### Configure Standard Output Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_tests/pico_spi/main/CMakeLists.txt Enables USB stdio output and disables UART stdio output for the specified target. ```cmake # enable usb output, disable uart output pico_enable_stdio_usb(test_spi 1) pico_enable_stdio_uart(test_spi 0) ``` -------------------------------- ### Build Kernel Drivers for Raspberry Pi 4 Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Compiles the kernel drivers for Raspberry Pi 4 using Make, specifying the kernel version and source path. The '-j4' flag enables parallel compilation with 4 jobs. ```bash make -j4 KVER=5.10.103-v7l+ KSRC=/lib/modules/5.10.103-v7l+/build ``` -------------------------------- ### Generate Additional Output Files Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_tests/pico_spi/main/CMakeLists.txt Adds extra output formats such as map, bin, and hex files for the target. ```cmake # create map/bin/hex/uf2 file etc. pico_add_extra_outputs(test_spi) ``` -------------------------------- ### View MMAL errors Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt To diagnose issues with the Media Manager Abstraction Layer (MMAL), use the vcdbg log msg command. This command displays MMAL-related messages, aiding in debugging. ```bash sudo vcdbg log msg ``` -------------------------------- ### Set System Date Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Sets the system date and time. This command is useful for ensuring accurate timestamps for package updates and logs. ```bash date -s "20250303 09:45" ``` -------------------------------- ### Update Package Lists with SSL Verification Disabled Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Updates the package lists for APT, bypassing certificate verification for HTTPS sources. This is often used in environments with self-signed certificates or network restrictions. ```bash sudo apt update sudo apt -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false -o "Acquire::https::Verify-Peer=false" update ``` -------------------------------- ### Play H.264 frames with ffplay, filtering B-frames Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt Use ffplay to play H.264 frames from a file, specifically selecting and displaying only B-frames. This can be useful for analyzing video compression techniques. ```bash ffplay -i test3.h264 -vf select='eq(pict_type\,B)' ``` -------------------------------- ### Update apt with release file error Source: https://github.com/petrusoroaga/rubyfpv/blob/main/backup/howtocompile_raspivid.txt To resolve 'release file is not valid yet' errors during apt update, use the --allow-releaseinfo-change flag. Alternatively, you can disable date and validity checks and manually set the system date. ```bash sudo apt-get update --allow-releaseinfo-change ``` ```bash apt-get -o Acquire::Check-Valid-Until=false -o Acquire::Check-Date=false update ``` ```bash sudo date -s '9 Jul 2023 22:44' ``` -------------------------------- ### Disable Git SSL Verification and Clone MPP Repository Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/renderer/cairo_mpp.txt Configures Git to ignore SSL certificate verification for HTTP/HTTPS operations and then clones the MPP (Media Processing Platform) repository from GitHub. ```bash export GIT_SSL_NO_VERIFY=1 git config --global http.sslverify false git clone https://github.com/rockchip-linux/mpp.git ``` -------------------------------- ### Determine if Build is Tainted Source: https://github.com/petrusoroaga/rubyfpv/blob/main/code/r_utils/CMakeLists.txt Checks for modified git files to determine if the build is 'tainted' and defines a preprocessor macro accordingly. ```cmake if(NOT SKIP_TAINTED_CHECK) execute_process( COMMAND bash "-c" "git ls-files -m | wc -l" WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE GIT_TAINTED OUTPUT_STRIP_TRAILING_WHITESPACE ) add_definitions("-DGIT_TAINTED=${GIT_TAINTED}") endif(NOT SKIP_TAINTED_CHECK) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.