This is the 8th day of my participation in the August More Text Challenge. For details, see:August is more challenging
Buildroot based rootfs production
This article records the process of making rockchip-RK3288 platform RootFS using Buildroot.
1. Preparation
First, you need to go to the Buildroot website to download the latest version of the source code, as well as the official user manual. The second chapter of the user manual explains the tools and third-party libraries that Buildroot relies on to build on Linux. The following is a list of possible packages:
sudo apt-get install repo git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler \ Gcc-aarch64-linux-gnu mtools parted libudev-dev libusb-1.0-0-dev python-linaro-image-tools linaro-image-tools \ autoconf autotools-dev libsigsegv2 m4 intltool libdrm-dev curl sed make binutils build-essential gcc g++ bash \ patch gzip bzip2 Perl tar cpio python unzip rsync file BC wget libncurses5 libqt4-dev libglib2.0-dev libgtk2.0-dev libglade2-dev CVS git mercurial rsync openssh-client subversion asciidoc w3m dblatex graphviz python-matplotlib \ libc6:i386 libssl-dev texinfo liblz4-tool genext2fsCopy the code
2. Configure the platform
Buildroot uses a configuration tool similar to the Linux kernel. You can configure the platform compilation parameters using the Make MenuConfig tool. Go to the buildroot home directory and execute
make menuconfig
Copy the code
Above is the Buildroot configuration screen.
2.1 Target Options configuration
The following is the configuration information of rockchip-RK3288 platform:
2.2 Toolchain configuration
Toolchain is used to configure the cross-compiler in two ways:
- Buildroot toolchain
- External toolchain
Buildroot Toolchain is an official Buildroot cross-compiler, while External Toolchain is a third-party cross-compiler. Here we elaborate on External Toolchain.
Buildroot provides three configuration methods for External Toolchain:
Here we select the Custom Toolchain configuration. The configuration parameters are as follows:How to obtain information such as GCC version and kernel headers Series? For the GCC version, run the arm-linux-gnueabihf-gcc -v command. For example:
Linaro GCC 6.3-2017.05Copy the code
For kernel Headers Series, we need to go to the relevant directory of the cross-compiler, such as the one used in this document.
GCC - linaro - 6.3.1-2017.05 - x86_64_arm - Linux - gnueabihf/arm - Linux - gnueabihf/libc/usr/include/Linux/version. H # define LINUX_VERSION_CODE 263680 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))Copy the code
2.3 the System configuration
Configure the System Hostname and System banner as platform-specific information. Configure Init System to be Busybox. Note that /dev management is configured to Dynamic using devtmpfs + mdev and system/device_table. TXT is configured to the Path to the permission tables property. We can use ‘Enable root login with password’ to set the login password for the system.
Finally, configure the system login terminal with the following default configuration:
2.4 Filesystem images
Select a specific file system type based on the kernel configuration, for example:
2.4 Target packages
Target Packages include a large number of third-party libraries that can be compiled into the root file system, depending on the specific requirements of the project.
3. The compilation
Switch to the buildroot’s home directory, execute the make command or perform make O = / path/to/store/build/file (location) of the specified compile results storage, buildroot will automatically download and install software package is used for rootfs. After compilation, buildroot/output will generate rootfs related content. The functions of each file are as follows:
- Target: This folder contains all the rootfs files that we use to debug the development board rootfs issue.
- Image: This folder contains all the different types of file systems. Select the appropriate type and download it to the development board. If something goes wrong, you can refer to target for debugging.
- Build: This folder contains the source files for the packages rootfs needs.
- Host: This folder contains the tools and configuration files required for the rootfs compilation process.
- Makefile: Controls the compilation process of the entire file system.
4. Download rootfs
Download the compiled RootFS through the writing tool of the specific development board. After the download succeeds, restart the system. If the startup is successful, the following information is displayed:Account :root, password :123456 If the partition size of the root file system is incorrect, as shown in the following figure:
You can use the resize2fs command to reidentify the /dev/root device partition size as follows:
Enjoy it!