Search the Community
Showing results for tags 'embeddedlinux'.
-
This article takes the Forlinx OK3588-C development board platform as an example to explain how to use Buildroot to build a file system and add common system tools such as OpenCV. It is suitable for developers who need to customize embedded Linux systems. 1. Overview This article applies to the Buildroot system of Linux 5.10.209. The purpose of this article is to show how to make customized modifications to Buildroot 209. 2. Operations 2.1 SDK Source Code Download and Decompression forlinx@ubuntu20:~/3-3588-SDK_Kernel_5.10.209/1-Linux5.10.209+Qt5.15.10+Forlinx_Desktop22.04/OK3588-linux-source$ ls app build_secret_uboot.sh debian external output rkbin rtos ubuntu build_close.sh build.sh device kernel prebuilts rkflash.sh tools uefi buildroot common docs Makefile README.md rockdev u-boot yocto 2.2 Buildroot Compilation Available To compile buildroot, delete or remove rootfs.ext4 from this directory (move to another directory or rename it) forlinx@ubuntu20:~/3-3588-SDK_Kernel_5.10.209/1-Linux5.10.209+Qt5.15.10+Forlinx_Desktop22.04/OK3588-linux-source/prebuilts/forlinx/buildroot$ ls rootfs.ext4 2.3 Compiling Default Configuration Items To ensure compatibility with the previous default Buildroot configuration items (forlinx_ok3588_defconfig), re-compile by executing ./build.sh or ./build.sh buildroot. During the build process, according to the configuration items in forlinx_ok3588_defconfig, the source code packages of software projects will be fetched from the server and placed in the /buildroot/package directory. forlinx@ubuntu20:~/3-3588-SDK_Kernel_5.10.209/1-Linux5.10.209+Qt5.15.10+Forlinx_Desktop22.04/OK3588-linux-source/buildroot/package$ After the compilation is complete, a number of files are added and generated. Generate files under buildroot/output/forlinx_ok3588/ Table of Contents Usage Description build Store the intermediate and temporary files generated during the compilation process. If these files are deleted, the recompilation time will be very long. host Contains tools and binary files compiled for the build system host. That is, the cross-compiler. images Stores the finally generated firmware image files. rootfs.ext4 is the Buildroot system image and can be directly replaced. scripts Contains various script files used by Buildroot. Used for automated building, configuring the environment, or handling specific tasks. staging Contains header files, library files, and other development-related files of the target system. Required during the cross-compilation process. target Contains the complete content of the root file system (rootfs) on the target device. Only contains files required at runtime and does not include development-related header files or libraries. After compilation, it will be directly packaged into update.img. Note: Many problems may occur during this process, such as the inability to obtain packages due to network timeouts, insufficient number of threads during compilation, insufficient memory, or insufficient swap partition. Non-software-source-code-related problems are generally considered from these aspects. Remember not to use sudo with root privileges. 2.4. Adding System Tools or Required Library Files to the Buildroot System Here, take OpenCV4 as an example: ①. Enter the Buildroot directory and compile forlinx_ok3588_defconfig make forlinx_ok3588_defconfig ②. Open the menuconfig graphical interface and select the projects need to be compiled. make menuconfig ARCH=arm64 Options Usage Target options Configure the architecture and hardware parameters of the target device. Build options Configure the build behavior of Buildroot. Toolchain Configure the cross-compilation toolchain System configuration Configure the cross-compilation toolchain. Kernel Configure the Linux kernel. Target packages Select the software packages to be installed on the target system. Filesystem images Configure the type of the generated file system image. Bootloaders Configure the bootloaders (e.g., U-Boot, GRUB). Host utilities Configure the tools running on the host. Legacy config options Handle deprecated or obsolete configuration options. If OpenCV4 is needed now, directly search in the visual list, check the required configuration items, save them, and generate a new.config file. ③ Compilation Compile the tool package separately make opencv4 Full compilation Directly execute make make ④ After the full compilation is completed, Buildroot will add the executable and dependent libraries of OpenCV4 to the target file system, which will be present in buildroot/output/forlinx_ok3588/image/rootfs.ext4. At the same time, Buildroot will copy the library files dependent on OpenCV4 compilation to the toolchain, which is the host directory under buildroot/output/forlinx_ok3588 mentioned above. If necessary, you can package the compiler for use. Usage: You can deploy the cross-compilation environment by directly setting the environment variables in the environment-setup file under the host directory. source environment-setup ⑤ Save the current configuration to defconfig It is recommended to make a backup and keep the original forlinx_ok3588_defconfig. make savedefconfig 2.5. Replacement and Transplantation Generally, the cross-compilation tool and the generated file system image are used, which are under: buildroot/output/forlinx_ok3588/host buildroot/output/forlinx_ok3588/image/rootfs.ext4
- 1 reply
-
- embeddedlinux
- buildroot
-
(and 3 more)
Tagged with: