buildroot 构建根文件系统

   目     录

下载buildroot源码

配置 

1、配置 Target options

2、配置 Toolchain 

3、配置 System configuration

4、配置 Filesystem images

5、禁止编译 Linux 内核和 uboot

6、配置 Target packages

7、保存配置项 

8、配置busybox 

9、编译

10、 验证


下载buildroot源码

        首先需要到buildroot官网下载源码。Buildroot - Making Embedded Linux Easy

         点击download下载,你需要版本的源码。拷贝到ubuntu下并解压。

配置 

        进入源码目录。输入下方命令,进入图形化配置界面。

        make menuconfig

        接下来我们就依次配置 buildroot,配置完成以后就可以进行编译了。

1、配置 Target options

Target options
        -> Target Architecture                      = ARM (little endian)
        -> Target Binary Format                   = ELF
        -> Target Architecture Variant           = cortex-A7
        -> Target ABI                                    = EABIhf
        -> Floating point strategy                 = NEON/VFPv4
        -> ARM instruction set                     = ARM

2、配置 Toolchain 

Toolchain

        -> Toolchain type = External toolchain
        -> Toolchain = Custom toolchain   // 用户自己的交叉编译器
        -> Toolchain origin = Pre-installed toolchain // 预装的编译器
        -> Toolchain path =/usr/local/arm/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf
        -> Toolchain prefix = $(ARCH) -none-linux-gnueabihf //前缀
        -> External toolchain gcc version = 9.x
        -> External toolchain kernel headers series = 4.20.x // 交叉编译器的 linux 版本号
        -> External toolchain C library = glibc/eglibc
        -> [*] Toolchain has SSP support? (NEW)     //选中
        -> [*] Toolchain has RPC support? (NEW)    //选中
        -> [*] Toolchain has C++ support?                //选中
        -> [*] Enable MMU support (NEW)               //选中

3配置 System configuration

此选项用于设置一些系统配置,比如开发板名字、欢迎语、用户名、密码等。需要配置的
项目和其对应的内容如下:

System configuration

        -> System hostname   = huerli  // 平台名字,自行设置
        -> System banner   = Welcome to my workspace // 欢迎语 自行设置
        -> Init system = BusyBox // 使用 busybox
        -> /dev management  = Dynamic using devtmpfs + mdev   // 使用 mdev
        -> [*] Enable root login with password (NEW)   // 使能登录密码

4、配置 Filesystem images

此选项配置我们最终制作的根文件系统为什么格式的,配置如下:

-> Filesystem images
        -> [*] ext2/3/4 root filesystem   // 如果是 EMMC SD 卡的话就用 ext3/ext4
        -> ext2/3/4 variant           = ext4 // 选择 ext4 格式
        -> exact size                    =1G //ext4 格式根文件系统 1GB( 根据实际情况修改 )

5、禁止编译 Linux 内核和 uboot

 -> Kernel

        -> [ ] Linux Kernel //不要选择编译 Linux Kernel 选项!
-> Bootloaders
        -> [ ] U-Boot //不要选择编译 U-Boot 选项!

6、配置 Target packages

 -> Target packages

        -> System tools
        -> [*] kmod           //使能内核模块相关命令

7、保存配置项 

保存以下 按两下esc 再回车确认保存。

同时我们还需要进行备份,将其放在configs下 。

 将光标通过左右键切换到save回车保存,这里需要修改一下路径。

        make my_defconfig 

8、配置busybox 

我们还需要配置一下busybox,因为buildroot相当于在busybox上再去添加一些东西,因为busybox配置出来真的很小,就是就基础的。

        make busybox-menuconfig

Location:
        -> Settings
                -> Build static binary (no shared libs)    确保没选中

                 -> vi-style line editing commands        

                -> Support Unicode //选中

                        -> Check $LC_ALL, $LC_CTYPE and $LANG environment variables // 选中
        -> Linux Module Utilities
                -> Simplified modutils                确保没选择
                -> depmod
        -> Linux System Utilities
                -> mdev (16 kb) //确保下面的全部选中,默认都是选中的

         make show-targets

9、编译

        make busybox

        make

10、 验证

通过nfs网络挂在文件系统。

需要修改bootargs。bootargs修改教程

将编译好的根文件系统(在源码的output/image/)复制到 nfs/rootfs 下进行解压。再重启验证

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值