制作和使用cramfs中遇到的问题解决方法

  之前自己写的开发板使用手册上关于cramfs的使用自己也没有验证过,因为cramfs用的很少,nandflash一般都使用yaffs文件系统,资源利用率更高一些。


  今天有客户要求使用cramfs文件系统格式烧写根文件系统到nand上,我就自己做了一遍,才发现命令的使用有问题,内核在启动过程中出现下面的错误信息:


  VFS: Mounted root (cramfs filesystem) readonly.

  Freeing unused kernel memory: 168k freed

  Error -3 while decompressing!

  804878c4(1884)->81200000(16384)

  Failed to execute /linuxrc. Attempting defaults...

  Kernel panic - not syncing: No init found. Try passing init= option to kernel.

  最终找到问题就是在mkfs.cramfs的使用。

usage: mkfs.cramfs [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] [-n name] dirname outfile
 -h         print this help
 -v         be verbose
 -E         make all warnings errors (non-zero exit status)
 -b blksize use this blocksize, must equal page size
 -e edition set edition number (part of fsid)
 -N endian  set cramfs endianness (big|little|host), default host
 -i file    insert a file image into the filesystem (requires >= 2.4.0)
 -n name    set name of cramfs filesystem
 -p         pad by 512 bytes for boot code
 -s         sort directory entries (old option, ignored)
 -z         make explicit holes (requires >= 2.3.39)
 dirname    root of the filesystem to be compressed
 outfile    output file

-b参数指定内核的页大小,注意是内存管理的页大小,而不是nand的块大小。我们开发板内核的页大小是16K,因此是16384.这样重新做一遍文件系统镜像烧到nand上,内核就正常启动进入控制台了。




 


你可能感兴趣的:(制作和使用cramfs中遇到的问题解决方法)