Search the Community
Showing results for tags 'buildroot'.
-
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:
-
Forlinx Embedded OK113i-S development board has gained a lot of attention since it came into the market for some time, and it has also become a high-quality choice for many customers to select projects. In the actual project development, engineers may need to migrate some tools or protocols in the file system, so how to migrate them? We can port new functions in the Buildroot of the OK113i-S development board by adding the package configuration. This article will show you how to port the MQTT protocol in the Buildroot of the T113-i development board. Part 1 Configuration File Introduction First, take a look at the configuration files involved in porting functionality in Buildroot. View the existing configuration files in the source code of the embedded OK113i-S development board. The following files are included in the path: buildroot/buildroot-201902/package/mosquitto: Config.in mosquitto.mk mosquitto.hash mosquitto.service S50mosquitto ① Config.in The Config.in file informs Buildroot which package needs to be included in the compilation using BR2_PACKAGE_** as a switch. The switch is assigned in the OK113I_linux_defconfig configuration file located in buildroot/buildroot-201902/configs/, similar to the Kconfig file in the kernel. For example: The calling relationship is written in the package/Config.in source "package/mosquitto/Config.in"; The BR2_PACKAGE_MOSQUITTO information is written in package/mosquitto/Config.in. ② demo.mk This file declares some package information, such as the version of the specified package, the package source download link, the storage path, the compilation rules, the toolchain, and so on. When compiling, the source code package will be downloaded to the specified path according to the download address and version in this file, and then compiled and copied, which is equivalent to a Makefile file. For example: mosquitto.mk The software package version and download address are written at the beginning of the file, and we can find the corresponding version of the software package by visiting the address in the browser. When compiling, if the file is not in the source code, it will be downloaded automatically. mosguitto-1.5.8.tar.gz mosguitto-1.5.8.tar.gz.asc In addition, other compilation rules are defined in the file, including the file copy path and so on. ③ demo.hash This file will record the hash check code of the downloaded source code package to prevent errors in the downloaded source code package. ④ demo.service This file serves systemd. After systemd is started, the demo service will be started according to this file. The source path and installed path of this file will be specified in the demo.mk. The OK113i-S development board does not currently use this service, so it can be left alone. ⑤ S50demo It is a demo.service, which is the boot service type currently used by the OK113i-S development board. Among the above 5 kinds of files Config.in and demo.mk is required, and other files can be configured as needed. The specific configuration contents can be written according to the existing documents or the actual situation. Mosquitto already has a written configuration file, which can be used directly. Generally, the configuration file is provided by the maintainer or developer of the project. If there is no configuration file in the file you migrate, you can refer to the existing configuration file to write one. Part 2 Execution We need to generate in buildroot/buildroot-201902 make OK113I_linux_defconfig And then generate in make menuconfig ARCH=arm. Configure in the graphical configuration interface (if an error is reported during execution, please install the command first: sudo apt-get update and sudo apt-get install ncurses). After entering the graphic configuration interface, enter "/" to search for the function to be configured. As shown in the figure, search for the information seen by Mosquitto. Select "1" according to the prompt to enter the target option. Press "Space" to save and exit. After the configuration is complete, execute. /build.sh in the current directory to compile the file system, and then check if there are already corresponding files in the files system. (Note: If there is no network, the source code package cannot be automatically downloaded during compilation. You need to manually download the source code package from the download address and put it in the source code package storage path.) Part 3 Test verification of MQTT Modify the /etc/mosquitto/mosquitto.conf file of the OK113i-S development board, add a line user root after #user mosquitto, and reboot the service or development board. You can also kill the process and re-execute it: /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf Then test—— Subscribe to the test topic: mosquitto_sub -t test & Release the test topic: mosquitto_pub -t test -m "hello world" If you can see the word hello world returned, it means that the migration is successful. Above is the method to port MQTT protocol in Buildroot of Forlinx Embedded OK113i-S development board for engineers in front of the screen.
-
- mqtt protocol
- buildroot
-
(and 3 more)
Tagged with: