linux 文件系统的建立

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/tbadolph/article/details/78219201

1.     文件系统的制作

Linux Core NANDUser’s Guide

http://processors.wiki.ti.com/index.php/Linux_Core_NAND_User%27s_Guide#.23Building_UBI_File_system

制作工具: mkfs.ubifs 和Ubinize 两个工具。

1.1.通过sudo apt-get install mtd-utils 安装。

When building a UBI file systemyou need to have a directory that contains the exact files and directorieslayout that you plan to use for your file system. This is similar to the filesand directories layout you will use to copy a file system onto a SD card forbooting purposes. It is important that your file system size is smaller than thefile system partition in the NAND.

Next you need a file namedubinize.cfg. Below contains the exact contents of ubinize.cfg you should use.However, replace<name> with a name of your choosing.

1.2建立目录

解压TI提供的文件系统arago-base-tisdk-image-am335x-evm.tar.gz,进入filesystem 目录

$   mkdir rootfs

$   tar -xf  arago-base-tisdk-image-am335x-evm.tar.xz -C rootfs


ubinize.cfg是ubinize命令的一个配置文件:每句后面注意不要有空格。

[ubifs]
mode=ubi
image=ubifs.img //
mkfs.ubifs工具制作出来的ubifs镜像
vol_id=0

vol_size=260MiB   /* 大小视mkfs.ubifs制作出来的文件大小而定*/
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

1.3编译命令

$ sudo mkfs.ubifs -r/home/tb/ti_sdk/filesystem/rootfs -F -m 2048 -e 126976 -c 5600 -o ubifs.img

-r ./rootfs :指定制作UBIFS文件系统的源文件目录

-m 2048:指定最小I/O操作的大小为2048字节

-e 126976:指定逻辑擦除块的大小

-c 992:指定最大逻辑除块的数目

-o ubifs.img 生成的文件,同ubinize.cfg配置中的image名字一样。

-F 不加可能会出错。

$  sudoubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg

上面两条命令的具体参数要看板子NAND参数

1.4编译脚本

#! /bin/sh

echo "make director rootfs to ubifs.img..."

sudo mkfs.ubifs -r /home/tb/ti_sdk/filesystem/rootfs -F -m 2048 -e126976 -c 5600 -o ubifs.img

echo "ubifs.img done."

#使用ubinize可以将mkfs.ubifs命令制作出来的UBIFS 文件系统镜像直接在FLASH上烧写的>格式

#(带有UBI文件系统镜像卷标)

#能过此命令生成的ubi.img可直接烧写到NAND FLASH上。

echo "make ubifs.img to ubi.img..."

sudo ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg

echo "ubi.img done."

猜你喜欢

转载自blog.csdn.net/tbadolph/article/details/78219201