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.
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.
Now enter the buildroot/output/images directory and check that the packaged rootfs.tar file already contains the app folder.
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.
After compilation and packaging, the etc directory in the packaged file contains the test.sh script file.
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,
after recompiling, the test1.sh file appears in the /output/rockchip_rk3568/target/etc directory.
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.
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
3.2. buildroot/output/target directory
Create the app folder in the buildroot/output/rockchip_rk3568/target directory, as shown in the figure below:
After recompiling, open the rootfs.tar file in the directory /output/rockchip_rk3568/images and you can see that the app folder is
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.
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
appears in the /output/rockchip_rk3568/target/etc directory.
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
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