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

上面是我的微信和QQ群,欢迎新朋友的加入。

目录

1.获取文件系统

2.文件系统编译

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

4.确定网络调试功能

5.Unable to mount root fs on unknown-block

6.incomplete write

7.一直输出can't open /dev/tty

8.完善文件系统


1.获取文件系统

官网:https://busybox.net/

下载一个版本的文件系统

2.文件系统编译

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

make defconfig
make menuconfig

配置:

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

Location:
-> Linux Module Utilities
> Simplified modutils

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

编译

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

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

make install busybox

添加库文件

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

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

 

4.确定网络调试功能

电脑端的IP地址

在uboot下ping通这个IP

查询本设备地址

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

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

这里应该没什么问题了

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

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

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

如:

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

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镜像文件,现在是正常的了

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

再次更新SD里面的内容

完成了

花絮:

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

查了一两天

MMP

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值