Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the root file system construction tool Buildroot in embedded Linux kernel

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

I believe many inexperienced people don't know what to do about how to use the root file system construction tool Buildroot in the embedded Linux kernel. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Buildroot Quick start Guide

Buildroot is an open source tool for customizing the kernel and root file system (rootfs) of embedded Linux. It is very powerful and convenient, but too many configuration items are obviously difficult for beginners. The goal of this article is to briefly introduce this tool and let beginners get started quickly.

Goal:

1 2 directories and 1 file that beginners need to know

2 be familiar with the basic commands of the tool

3 build a kernel and a root file system

Exercise:

1 option to view typical configuration files for a specific development board

2 generate a Linux kernel and root file system using the configuration file included with the tool

The first step is to get the tool. On github, the command is as follows:

Git clone https://github.com/buildroot/buildroot

Enter the directory and view:

Pi@rpi / opt/github/buildroot $ls-altotal 420drwxr-xr-x 15 root root 4096 Dec 24 21:18 .drwxr-xr-x 73 git git 4096 Jan 3 08:01.. drwxr-xr-x 2 root root 4096 Dec 24 21:15 archdrwxr-xr-x 25 root root 4096 Dec 24 21:15 boarddrwxr-xr-x 15 root root 4096 Dec 24 21:15 boot-rw-r--r-- 1 root root 146433 Dec 24 21:15 CHANGES-rw -root root Murray-1 root root 44501 Dec 24 21:16. Config-rw-r--r-- 1 root root 19111 Dec 24 21:15 Config.in-rw-r--r-- 1 root root 42879 Dec 24 21:15 Config.in.legacydrwxr-xr-x 2 root root 4096 Dec 24 21:15 configs-rw-r--r-- 1 root root 17987 Dec 24 21:15 COPYING-rw-r--r-- 1 root root 1246 Dec 24 21:15 .defconfigdrwxr-xr-x 5 root root 4096 Dec 24 21:15 docsdrwxr-xr-x 15 root root 4096 Dec 24 21:15 fsdrwxr-xr-x 8 root root 4096 Dec 24 21:18 .git-rw-r--r-- 1 root root 25 Dec 24 21:15 .gitignoredrwxr-xr-x 2 root root 4096 Dec 24 21:15 linux-rw-r--r-- 1 root root 34899 Dec 24 21:15 Makefile-rw- RMui root root 2432 Dec 24 21:15 Makefile.legacydrwxr-xr-x 3 root root 4096 Dec 24 21:18 outputdrwxr-xr-x 1266 root root 36864 Dec 24 21:15 package-rw-r--r-- 1 root root 972 Dec 24 21:15 READMEdrwxr-xr-x 11 root root 4096 Dec 24 21:15 supportdrwxr-xr-x 3 root root 4096 Dec 24 21:15 systemdrwxr-xr-x 5 root root 4096 Dec 24 21:15 toolchainpi@rpi / opt/github/buildroot $1. Two directories and one file that beginners need to know first: directory 1: `configs`

One is the configs directory, which stores some system-specific build configurations provided by the tools, in other words, some widely used build configuration files for Linux embedded systems. For example, the familiar raspberry pie 1 raspberrypi_defconfig and 2 raspberrypi2_defconfig build configuration files are among them. We can take a look at the contents:

Pi@rpi / opt/github/buildroot $ls. / configsaltera_sockit_defconfig calao_usb_a9g20_lpw_defconfig minnowboard_defconfig qemu_ppc_virtex_ml507_defconfigarmadeus_apf27_defconfig ci20_defconfig minnowboard_max_defconfig qemu_sh5_r2d_defconfigarmadeus_apf28_defconfig cubieboard2_defconfig mx53loco_defconfig qemu_sparc_ Ss10_defconfigarmadeus_apf51_defconfig cubieboard_defconfig nitrogen6x_defconfig qemu_x86_64_defconfigarmadeus_apf9328_defconfig freescale_imx28evk_defconfig olimex_imx233_olinuxino_defconfig qemu_x86_defconfigarm_foundationv8_defconfig freescale_imx31_3stack_defconfig openblocks_a6_defconfig qemu_xtensa_lx60_defconfigat91rm9200df_defconfig freescale_imx6dlsabreauto_defconfig pandaboard_defconfig qmx6_ Defconfigat91sam9260dfc_defconfig freescale_imx6dlsabresd_defconfig qemu_aarch74_virt_defconfig raspberrypi2_defconfigat91sam9260eknf_defconfig freescale_imx6qsabreauto_defconfig qemu_arm_nuri_defconfig raspberrypi_defconfigat91sam9261ek_defconfig freescale_imx6qsabresd_defconfig qemu_arm_versatile_defconfig raspberrypi_dt_defconfigat91sam9263ek_defconfig freescale_imx6sololiteevk_defconfig qemu_arm_vexpress_defconfig riotboard_defconfigat91sam9g20dfc_defconfig freescale_mpc8315erdb_defconfig qemu_microblazebe_mmu_defconfig S6lx9_microboard_defconfigat91sam9g45m10ek_defconfig freescale_p1010rdb_pa_defconfig qemu_microblazeel_mmu_defconfig sheevaplug_defconfigatmel_xplained_defconfig freescale_p2020ds_defconfig qemu_mips64el_malta_defconfig telit_evk_pro3_defconfigbeaglebone_defconfig gnublin_defconfig qemu_mips64_malta_defconfig ts5x00_defconfigcalao_qil_a9260_defconfig integrator926_defconfig qemu_mipsel_malta_defconfig Udoo_quad_defconfigcalao_snowball_defconfig kb9202_defconfig qemu_mips_malta_defconfig wandboard_defconfigcalao_tny_a9g20_lpw_defconfig lego_ev3_defconfig qemu_ppc64_pseries_defconfig zedboard_defconfigcalao_usb_a9260_defconfig loongson1c_smartloong_defconfig qemu_ppc_g3beige_defconfigcalao_usb_a9263_defconfig mini2440_defconfig qemu_ppc_ Mpc8544ds_defconfigpi@rpi / opt/github/buildroot $directory 2: `output`

The other is the output directory, which stores the output of your build, and the built kernel and root file system under the output/images/ directory. We can take a look at the structure of this directory before we start building:

Pi@rpi / opt/github/buildroot $tree. / output./output └── build └── buildroot-config ├── conf.o ├── lxdialog │ ├── checklist.o │ ├── inputbox.o │ ├── menubox.o │ ├── textbox.o │ ├── util.o │ └ ── yesno.o ├── mconf ├── mconf.o ├── zconf.hash.c ├── zconf.lex.c └── zconf.tab.o3 directories 12 filespi@rpi / opt/github/buildroot $file: `.config`

One file is .config, which is the configuration file used to build. For example, if we plan to use the configuration file that comes with the tool to build the kernel and root file system of Raspberry Pie 2, first copy it from the configs directory and overwrite the .config file in the current directory, as follows:

Cp. / configs/ raspberrypi2_defconfig. / .config

After explaining two simple directories and one file, let's talk about the basic commands.

two。 Be familiar with the basic commands of the tool

The basic command of buildroot is make, which only needs to be executed twice for beginners:

The first execution with parameters is used to customize the system:

The command to customize the system is:

Make menuconfig

After execution, a configuration menu will be launched, and after entering it, you can add or tailor the system functions according to your own needs, and then select Save, and all configurations will be saved as .config files in the current directory.

The execution interface looks like this:

You can also load the configuration file that comes with the tool through the load option to see what a typical configuration looks like.

The second execution without parameters is used to build the system:

The build command is:

Make

It will take a long time to build. After the construction is completed, you can check the. / output/images/ directory just mentioned. I just finished building the root file system of the Longxin Zhilong open source development board. We can take a look:

Git@debian:/opt/github/pengphai-buildroot$ ls-al. / output Total usage 28drwxr-xr-x 6 git git 4096 August 6 06:51. Drwxr-xr-x 16 git git August 6 06:51.. drwxr-xr-x 54 git git 4096 August 6 07:36 builddrwxr-xr-x 5 git git 4096 August 6 07:12 hostdrwxr-xr-x 2 git git 4096 August 6 07:36 imageslrwxrwxrwx 1 git git 81 August 6 06:51 staging-> / opt/github/pengphai-buildroot/output/host/usr/mipsel-buildroot-linux-gnu/sysrootdrwxr-xr-x 19 git git 4096 August 6 07:36 targetgit@debian:/opt/github/pengphai-buildroot$ ls-al. / output/images Total dosage 22956drwxr-xr-x 2 git git 4096 August 6 07:36. Drwxr-xr-x 6 git git 4096 August 6 06:51.-rw- 1 git git 23498112 August 6 07: 36 rootfs.yaffs2imggit@debian:/opt/github/pengphai-buildroot$3. Build a kernel and a root file system

The command is very simple. Let's take raspberry pie 2 as an example and directly use the configuration file that comes with the tool. The command is as follows:

Pi@rpi / opt/github/buildroot $sudo cp. / configs/raspberrypi2_defconfig. / configpi@rpi / opt/github/buildroot $sudo make

I built it on raspberry pie 2, so it should be a long build process.

In addition, I just found that there are many unconfigured items in the configuration file of raspberry pie 2, which need to be selected by the user. Later, I will write a fully configured one. This example will only confuse the novice.

After reading the above, have you mastered how to use the root file system building tool Buildroot in the embedded Linux kernel? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report