1. General Steps for Building Root Filesystem with Buildroot
Buildroot is a framework for building embedded Linux systems, which can automate the configuration, compilation of the kernel, u-boot, and root filesystem. Here is a basic step-by-step guide for generating a root filesystem using Buildroot:
1. Install Buildroot: First, you need to install Buildroot on your host system. This usually involves downloading the source code from the official Buildroot website or source code repository, then extracting and configuring the Makefile for installation.
2. Configure Buildroot: In the Buildroot source directory, run the make menuconfig
command to configure the build options. This command will start a text-based configuration tool where you can select the target architecture, kernel version, packages, etc. Choose the target architecture based on the embedded hardware (e.g., ARM, MIPS, etc.). Configure the kernel options, including whether to compile u-boot (usually not needed unless there is a specific requirement). Select the packages you want to include in the root filesystem.
3. Compile Buildroot: After configuration is complete, run the make
command to start the compilation process. This may take some time, depending on your hardware configuration and the number of packages selected.
4. Generate Root Filesystem: Once the compilation is complete, Buildroot will generate the root filesystem in the output/
directory. This directory contains all the necessary files and directories to run the Linux system on the embedded device.
5. Test Root Filesystem: Before deploying the root filesystem to the embedded device, you can simulate the embedded environment on your host system using tools like QEMU to test the functionality of the root filesystem.
6. Deploy to Embedded Device: If you are satisfied with the functionality of the root filesystem, you can deploy it to the embedded device. This usually involves flashing the root filesystem image to the device’s storage medium and configuring the device to boot from that medium.
Please note that the above steps are a basic guide and may need to be adjusted based on your specific requirements. When building the root filesystem, be sure to refer to the official Buildroot documentation and the hardware documentation of your embedded device to ensure that the configuration and steps are correct.
2. Buildroot Configuration for Root Filesystem
Embedded Hardware: NUC980-ETH2P Development Board
Ubuntu: Ubuntu 22.04.3 LTS, 64-bit
Buildroot Version: buildroot-2022.02.3
Switch Buildroot to Domestic Source There are two methods to modify: 1. Modify the configuration file 2. Configure in menuconfig
In the Buildroot directory, modify the following content in the .config
file:
BR2_BACKUP_SITE="http://sources.buildroot.net"
BR2_KERNEL_MIRROR="https://mirror.bjtu.edu.cn/kernel/"
BR2_GNU_MIRROR="http://mirrors.nju.edu.cn/gnu/"
BR2_LUAROCKS_MIRROR="https://luarocks.cn"
BR2_CPAN_MIRROR="http://mirrors.nju.edu.cn/CPAN/"
Or select the addresses in make menuconfig under Build options–>Mirrors and Download locations and fill in the following domestic acceleration mirror source URLs one by one.
After switching to domestic sources, configure as follows.Buildroot Configuration
make menuconfig
Configure target platformConfigure the compilation toolchain
Cancel Linux kernel and U-boot
Set root user password
Save, exit, and compile
make