imx6q 制作文件系统

实际项目中可以使用Buildroot制作根文件系统
一、制作文件系统
1、下载busybox源码 https://busybox.net/downloads/
2、解压tar -xjf util-linux-2.23.1.tar.bz2
3、配置
export ARCH=arm
export CROSS_COMPILE=arm-none-eabi-
//export CROSS_COMPILE=arm-linux-gnueabihf-
make menuconfig
Busybox Settings--->
    Build Options--->
        [*]Build BusyBox as a static binary(no shared libs)
        
Busybox Library Tuning--->
    [*]vi-style line editing commands
    [*]Fancy shell prompts    
    
Linux Module Utilities--->
    [ ]Simplified modutils
    [*]insmod
    [*]rmmod
    [*]lsmod
    [*]modprobe
    [*]depmod
    
Linux System Utilities--->[*]mdev
    [*]Support /etc/mdev.conf
    [*]Support subdirs/symlinks
    [*]Support regular expressions substitutions when renaming dev
    [*]Support command execution at device addition/removal
    [*]Support loading of firmwares

4、编译与安装    
make CROSS_COMPILE=arm-linux-gnueabi-    
//make CROSS_COMPILE=arm-linux-gnueabihf-
make CROSS_COMPILE=arm-linux-gnueabi- install
//make CROSS_COMPILE=arm-linux-gnueabihf- install
mv _install nfs_root  通过网络文件系统挂载到nfs_root
5.添加etc/inittab,内容如下:
# /etc/inittab
::sysinit:/etc/init.d/rcS
::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
::restart:/sbin/init
6.添加etc/init.d/rcS, 内容如下:
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel
mount -a
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
/bin/hostname -F /etc/sysconfig/HOSTNAME
ifconfig eth0 192.168.1.106

7.创建etc/fstab
#device         mount-point     type    options         dump    fsck order
proc            /proc           proc    defaults                0       0
tmpfs           /tmp            tmpfs   defaults                0       0
sysfs           /sys            sysfs   defaults                0       0
tmpfs           /dev            tmpfs   defaults                0       0
var             /dev            tmpfs   defaults                0       0
ramfs           /dev            ramfs   defaults                0       0

8.创建/etc/sysconfig/HOSTNAME文件,里面填为Lonnox
9.创建/etc/profile
# Ash profile
# vim: syntax=sh
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
PS1='[\u@\h \W]\# '
PATH=$PATH
HOSTNAME=`/bin/hostname`
export USER LOGNAME PS1 PATH
10.在根目录中创建proc sys var dev lib tmp文件夹
11.拷贝动态库:cp -a /usr/arm-linux-gnueabi/lib/*.so* ~/work/imx6/nfs_root/lib

附件3:制作ext2格式的镜像并烧录启动
(1)执行下述命令
dd if=/dev/zero of=rootfs.ext2 bs=1024 count=10240
losetup /dev/loop1 rootfs.ext2
mke2fs -m 0 /dev/loop1 10240
mount -t ext2 /dev/loop1 ./ext2_rootfs/
(2)向./rootfs中复制内容,用cp ../rootfs/* ./ -rf
(3)umount /dev/loop1
losetup -d /dev/loop1
(4)完成后得到的rootfs.ext2就是我们做好的rootfs镜像。拿去烧录即可。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值