Buildroot adds custom files

  In daily development, we often add custom files to the buildroot file system. This article introduces several methods of adding

1. buildroot/system/skeleton directory

  Skeleton can overwrite the specified file to a directory after the target file system is compiled. In this way, we can easily add or modify some files to the root file system. This directory has the characteristics of overwriting if it exists and creating a new one if it does not exist.
  For example, to create an app directory in the /root directory of the development board, the specific steps are as follows:

1.1. Enter the buildroot/system/skeleton directory

  If there is no app directory in the buildroot/system/skeleton directory, just create a new one. Files placed in the app directory will overwrite the app directory on the development board, maintaining the feature of overwriting if there is one and creating a new one if not.
Insert image description here

1. 2. Recompile Buildroot

  After recompiling Buildroot, you can see the app folder in the directory buildroot/output/target where the compiled files are compiled.
Insert image description here
  Now enter the buildroot/output/images directory and check that the packaged rootfs.tar file already contains the app folder.
Insert image description here

2. buildroot/output/target directory

  The buildroot/output/target directory is the system directory of the root file system and is used to create the root file system image. Therefore, adding custom files under this folder can also be packaged into the burned root file system. For example, place a test.sh script file in the etc directory under the buildroot/output/target directory. Note: If you recompile after clearing, files will be lost.
Insert image description here
  After compilation and packaging, the etc directory in the packaged file contains the test.sh script file.
Insert image description here

3. Add custom files to Buildroot of RK3568

  To add custom files to Rockchip's RK3568 Buildroot, you can use the above two methods:

3.1. buildroot/system/skeleton directory

  Place a test1.sh script file in the etc directory of the buildroot/system/skeleton directory. As shown in the figure below,
Insert image description here
  after recompiling, the test1.sh file appears in the /output/rockchip_rk3568/target/etc directory.
Insert image description here
  At this time, in the packaged burn You can see the test1.sh file under the recorded file. Open the rootfs.tar file in the directory /output/rockchip_rk3568/images. You can see that the test1.sh file appears in the etc directory. Insert image description here
  At the same time, find the rootfs.img file in the rockdev directory at the same level as Buildroot, and mount it on the system. View The test1.sh file appears in the /etc/ directory
Insert image description here

3.2. buildroot/output/target directory

  Create the app folder in the buildroot/output/rockchip_rk3568/target directory, as shown in the figure below:
Insert image description here
  After recompiling, open the rootfs.tar file in the directory /output/rockchip_rk3568/images and you can see that the app folder is
Insert image description here
  also in the Buildroot directory. Find the rootfs.img file in the rockdev-level directory and mount it on the system. Check that the app folder appears in the / directory.
Insert image description here

3.3. buildroot/board/rockchip/rk356x/fs-overlay directory

  In addition to the above two methods, rk3568 also has a third method, which is the buildroot/board/rockchip/rk356x/fs-overlay directory. fs-overlay can overwrite the specified file to a directory after the target file system is compiled.
  Place a test2.sh script file in the etc directory of the buildroot/board/rockchip/rk356x/fs-overlay directory. As shown in the figure below, after recompiling, the test2.sh file
Insert image description here
  appears in the /output/rockchip_rk3568/target/etc directory.
Insert image description here
  At this time, you can see the test2.sh file under the packaged burning file. Open the rootfs.tar file in the directory /output/rockchip_rk3568/images. You can see that the test2.sh file appears in the etc directory. At the Insert image description here
  same time, find the rootfs.img file in the rockdev directory at the same level as Buildroot. After mounting it on the system, view The test2.sh file appears in the /etc/ directory
Insert image description here

Guess you like

Origin blog.csdn.net/xxxx123041/article/details/133178611