找回密码
 立即注册
搜索
查看: 263|回复: 0

9G25 使用 Buildroot 创建 rootfs

[复制链接]

266

主题

0

回帖

1119

积分

管理员

积分
1119
发表于 2024-2-21 14:38:58 | 显示全部楼层 |阅读模式

tar -jxvf buildroot-2017.02.tar.bz2 

make at91sam9g20dfc_defconfig

make menuconfig

Target options  --->
Enable VFP extension support

Build options  --->
Mirrors and Download locations  --->
修改几处源为国内的源,以加快下载速度
│ │    ()  Primary download site                                        │ │
│ │    (http://sources.buildroot.net) Backup download site              │ │
│ │    (http://mirrors.ustc.edu.cn/kernel.org) Kernel.org mirror        │ │
│ │    (http://mirrors.ustc.edu.cn/gnu) GNU Software mirror             │ │
│ │    (http://rocks.moonscript.org) LuaRocks mirror                    │ │
│ │    (http://mirrors.ustc.edu.cn/CPAN) CPAN mirror (Perl packages)

工具链配置 Toolchain  --->
Toolchain type (Buildroot toolchain)
(buildroot) custom toolchain vendor name
C library (glibc)

Kernel Headers (Linux 3.2.x kernel headers)  版本至少与实际使用的内核的版本一样老才可以,否则启动的时候会提示:

FATAL: kernel too old

Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00

查看busybox支持的Linux版本:file busybox | grep Linux

glibc version (2.23)

Binutils Version (binutils 2.26.1)

GCC compiler Version (gcc 5.x)

Enable C++ support

注:在使用 Buildroot 自己编译的 toolchian 之前我使用过 gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabi 作为外部 Toolchain,但是遇到了问题,编译的 rootfs 在启动的时候报错:

Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004

网上说问题可能是 Kernel 与 rootfs 在编译的时候没有同时开启 EABI,但我检查(readelf -hA vmlinux busybox)的结果是都开启了。会不会是浮点数的问题?配置的都是 soft float,也没问题。最后发现是 rootfs 指令集用的是 ARMv7-a,而 CPU 是 AT91SAM9G25(ARM926EJ-S(ARM9)),支持的指令集是 ARMv5t。单 buildroot 中没找到向外部 GCC 传递 CFLAGS(-march=armv5t)的配置,于是放弃使用外部工具链。

System configuration  --->

/dev management (Dynamic using devtmpfs + eudev)

不选 Run a getty (login prompt) after boot (具体行为后续再 inittab 中改)

(eth0) Network interface to configure through DHCP

Kernel  --->

不选择编译 Kernel

Target packages  --->

Show packages that are also provided by busybox

Shell and utilities  --->

bash

Debugging, profiling and benchmark  --->  

gdb

Compressors and decompressors  --->

bzip2

gzip

Networking applications  --->

pppd

Bootloaders  --->

不选

如果需要额外配置 busybox,使用:make busybox-menuconfig ,这里使用默认配置

编译系统:

make -j4

会在 dl 文件夹放置下载到的源码,在 output/image 中生成 rootfs.tar

mkdir rootfs

sudo tar -xvf rootfs.tar -C rootfs

添加 10_usbkey.rules到 /etc/udev/rules.d

/etc/profile
export LD_LIBRARY_PATH=/qtlib

/etc/inittab
ttyS0::respawn:/bin/login -f root 

/etc/init.d/S10udev
修改 udevadm trigger --type=devices --action=add
为 udevadm trigger --type=devices

创建 /qtlib 把 QT 的部分动态库库放进去。

将 linux-ppp-scripts_v1.2 的文件放到相应的位置

sudo ./mkubifsimage rootfs/ ubifs.img

发现的问题:

在启动初始化时,执行 init.d/S10udev 中的 udevadm trigger --type=devices --action=add 时,会出现错误信息:

UBI error: ubi_open_volume: cannot open device 0, volume 0, error -16

(估计是操作 /dev/mtd8 时出现的错误,因为 cat /dev/mtd8 时会出现同样的错误信息)

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00020000 "bootstrap"
mtd1: 00080000 00020000 "uboot"
mtd2: 00040000 00020000 "env"
mtd3: 00040000 00020000 "env_redundant"
mtd4: 00040000 00020000 "spare"
mtd5: 00080000 00020000 "dtb"
mtd6: 00600000 00020000 "kernel"
mtd7: 0f800000 00020000 "rootfs"
mtd8: 0eb68000 0001f000 "rootfs"

为什么会有两个 rootfs 呢?mtd8 是怎么来的,留待以后研究。

暂时的解决对策是: 去掉此行中的 --action=add


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|棱讯科技 ( 粤ICP备2024228160号-2|粤公网安备44030002003510号 )

GMT+8, 2024-7-27 18:51 , Processed in 0.015664 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表