目录

1.获取文件系统

2.文件系统编译

3.制作文件系统镜像文件

4.确定网络调试功能

5.Unable to mount root fs on unknown-block

6.incomplete write

 

8.完善文件系统


1.获取文件系统

官网:https://busybox.net/

IMX6学习记录(4)-文件系统_IMX6ULL

下载一个版本的文件系统

IMX6学习记录(4)-文件系统_IMX6ULL_02

IMX6学习记录(4)-文件系统_IMX6ULL_03

2.文件系统编译

直接编译吧,不搞太麻烦了

make defconfig
make menuconfig

配置:

Location:
-> Settings
-> vi-style line editing command

IMX6学习记录(4)-文件系统_IMX6ULL_04

Location:
-> Linux Module Utilities
> Simplified modutils

IMX6学习记录(4)-文件系统_IMX6ULL_05

Location:
-> Settings
-> Support Unicode //选中
-> Check $LC_ALL, $LC_CTYPE and $LANG environment variables //选中

IMX6学习记录(4)-文件系统_IMX6ULL_06

编译

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

当前目录下生成可执行文件busybox

make install busybox

IMX6学习记录(4)-文件系统_IMX6ULL_07

IMX6学习记录(4)-文件系统_IMX6ULL_08

添加库文件

cd /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc//lib/
cp *so* *.a /home/jun/i.mx6/image/rootfs/lib/ -d
cd /home/jun/i.mx6/image/rootfs/lib/
rm ld-linux-armhf.so.3
cd -
cp ld-linux-armhf.so.3 /home/jun/i.mx6/image/rootfs/lib/
cd -
mkdir dev proc mnt sys tmp root etc

IMX6学习记录(4)-文件系统_IMX6ULL_09

3.制作文件系统镜像文件
sudo apt-get install genext2fs
genext2fs -b 131072 -d rootfs/ ramdisk
gzip -9 –f ramdisk
mkimage -A arm -O linux -T ramdisk -C none -a 0x81800000 -n "ramdisk" -d ramdisk.gz ramdisk.img

IMX6学习记录(4)-文件系统_IMX6ULL_10

 

4.确定网络调试功能

IMX6学习记录(4)-文件系统_IMX6ULL_11

电脑端的IP地址

IMX6学习记录(4)-文件系统_IMX6ULL_12

在uboot下ping通这个IP

查询本设备地址

IMX6学习记录(4)-文件系统_IMX6ULL_13

测试通过NFS,从ubuntu里面下载zimage到设备

nfs 80800000 192.168.1.111:/home/jun/i.mx6/image/zImage

IMX6学习记录(4)-文件系统_IMX6ULL_14

这里应该没什么问题了

5.Unable to mount root fs on unknown-block

挂载失败

指定rootfs的加载地址

setenv bootcmd 'mmc dev 0; fatload mmc 0:1 80800000 zImage; fatload mmc 0:1 81800000 ramdisk.img;fatload mmc 0:1 87800000 imx6ullofsbc.dtb; bootz 80800000 81800000 87800000;'
saveenv
6.incomplete write
---[ end trace 3d1f918b7f7d8518 ]---
mmcblk0: error -110 sending status command, retrying
mmcblk0: error -110 sending status command, retrying
mmcblk0: error -110 sending status command, aborting
blk_update_request: I/O error, dev mmcblk0, sector 0
Buffer I/O error on dev mmcblk0, logical block 0, async page read
 mmcblk0: unable to read partition table
RAMDISK: gzip image found at block 0
RAMDISK: incomplete write (13670 != 32768)
write error
Waiting for root device /dev/mmcblk1...
random: nonblocking pool is initialized

空间问题,修改内核编译选项

Device Drivers——>Block devices——>Default Ram Disk Size

IMX6学习记录(4)-文件系统_IMX6ULL_15

7.一直输出can't open /dev/tty
can't open /dev/tty3: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty2: No such file or directory

这个时候,其实文件系统已经起来了,正常的操作是可以实现的

如:

IMX6学习记录(4)-文件系统_IMX6ULL_16

这个不要紧,因为文件系统是没有做完整的,继续下一步

8.完善文件系统

创建/etc/init.d/rcS 文件

#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/usr/lib
export PATH LD_LIBRARY_PATH runlevel

mount -a
mkdir /dev/pts
mount -t devpts devpts /dev/pts

echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s

创建/etc/fstab 文件

#<file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
tmpfs /dev tmpfs defaults 0 0

创建/etc/inittab 文件

#etc/inittab
::sysinit:/etc/init.d/rcS
console::askfirst:-/bin/sh
::restart:/sbin/init
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
::shutdown:/sbin/swapoff -a

重新创建rootfs镜像文件,现在是正常的了

IMX6学习记录(4)-文件系统_IMX6ULL_17

为了确定这个文件系统是我自己编译的,打包之前,创建一个以我ID命名的文件夹

IMX6学习记录(4)-文件系统_IMX6ULL_18

再次更新SD里面的内容

IMX6学习记录(4)-文件系统_IMX6ULL_19

完成了

花絮:

我之前一直以为文件系统搞失败了,英文里面有一个lost+found的文件夹,这个在我打包之前是没有的

查了一两天

MMP