Author:    eilian
Blog:       
Copyright:Original
Date:   2011、12、14
1、Hosting environment:VMare ubuntu10.04 
2、Cross-compiling environment:arm-2009q3.tar.bz2
3、Development board:QT6410
4、nanflash:K9F2G08(256M)
5、linux -version:Linux-2.6.39
6、uboot-version:u-boot-2010.06
-------cramfs文件系统之安装内核模块,在QT6410移植linux-2.6.39 笔记(二)-添加NANDFLASH分区 的基础上重新配置内核并编译
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#make menuconfig
加入文件系统的支持                                
  │ │        File systems  --->    │ │    [*] Miscellaneous filesystems  --->    
cramfs   
  <*>   yaffs2 file system support                                              #支持yaffs2
   │ │    -*-     512 byte / page devices                                   
 配置好后保存退出root@bootloader:/home/eilian/development/Linux/linux-2.6.39#make uImage
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#make modules ARCH=arm CROSS_COMPILE=arm-linux-
root@bootloader:/home/eilian/development/Linux/linux-2.6.39#make modules_install ARCH=INSTALL_MOD_PATH=/home/eilian/development/rootfs
至此文件系统已完善,再接下来就是要将roots压缩成cramfs                 
-------- 编译cramfs制作工具
 从http://sourceforge.net/projects/cramfs/下载cramfs-1.1.tar.gz。然后执行root@bootloader:/home/eilian/development/Tools#tar zxvf cramfs-1.1.tar.gz
root@bootloader:/home/eilian/development/Tools/cramfs-1.1#make
 编译完成之后,会生成mkcramfs和cramfsck两个可执行文件,其中mkcramfs工具是用来创建cramfs文件系统的,而cramfsck工具则用来进行cramfs文件系统的释放以及检查。将这两个文件拷贝到/usr/local/bin目录下,方便使用.root@bootloader:/home/eilian/development/Tools/cramfs-1.1#cpmkcramfs/usr/local/bin
root@bootloader:/home/eilian/development/Tools/cramfs-1.1#cpcramfsck/usr/local/bin
---------mkcramfs的命令格式
 mkcramfs [-h] [-e edition] [-i file] [-n name] dirname outfile
 mkcramfs的各个参数解释如下:
 -h:            显示帮助信息
 -e edition:设置生成的文件系统中的版本号
 -i file:        将一个文件映像插入这个文件系统之中(只能在Linux2.4.0以后的内核版本中使用)
 -n name:  设定cramfs文件系统的名字
 dirname:  指明需要被压缩的整个目录树
 outfile:     最终输出的文件cramfsck的命令格式:
 cramfsck [-hv] [-x dir] file
 cramfsck的各个参数解释如下:
 -h:           显示帮助信息
 -x dir:      释放文件到dir所指出的目录中
 -v:           输出信息更加详细
 file:         希望测试的目标文件--------压缩rootfs根文件系统生成 cramfs
root@bootloader:/home/eilian/development#mkcramfs ./rootfs ./cramfs
---------通过SD卡一键烧写将cramfs烧写到NANDFLASH中
 当前,NandFlash分区情况如下:
 -------------------------------------------------------------------------------------------------------------
 NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
 Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
 0x000000000000-0x000000100000 : "Bootloader"
 0x000000100000-0x000000600000 : "Kernel"
 0x000000600000-0x000007e00000 : "User"
 0x000007e00000-0x000010000000 : "File System"
-------------------------------------------------------------------------------------------------------------值得注意的事:修改uboot中启动参数
 setenv bootargs 'root=/dev/mtdblock2 rootfstype=cramfs console=ttySAC0,115200'
 注意:启动参数里没有写上init=/linuxrc,所以启动默认是按照busybox的配置文件来进行的. 

 
另一个要注意的就是:如果没SD卡怎么办?怎么一键烧写,身边有个朋友说,没SD卡那还烧个毛。。。。。。。
好了这样做,同理打开超级终端(uboot已烧入nand的第一分区)
U-Boot 2010.06 (Dec 12 2011 - 18:39:28) for QT6410
 **********************************************
 **    u-boot-2010.06                     
 **    Updated for QT6410 Board          
 **    Version 1.0 (11-12-15)            
 **    Author: eilian                    
 **    blog: 
 **    E-mail: 305075262@          
 **********************************************
 CPU:     S3C6410@667MHz
          Fclk = 667MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)
 Board:   QT6410
 DRAM:  128 MiB
 NAND:  256 MiB
 *** Warning - bad CRC, using default environment
 In:    serial
 Out:   serial
 Err:   serial
 Net:   dm9000
 Hit any key to stop autoboot:  0QT6410# 
将上面制作好的cramfs通过tftp服务下载到DDR(放心这个cramfs只有9M,DDR有128M呢),再把cramfs从内存中写入nandflash,操作如下
QT6410# tftp 50000000  cramfs
写nand前需要先擦除nand,我们需要将cramfs写到nandflash的0x000000600000-0x000007e00000处
QT6410#nand erase  0x0000006000000x000007e00000
QT6410#nand write 500000000x000000600000
将DDR中50000000处的cramfs 写入nandflash,写到那个地方?0x000000600000开始处
-----------------最后贴出系统启动信息如下
U-Boot 2010.06 (Dec 13 2011 - 09:50:08) for QT6410

 ********************************************
 **    u-boot-2010.06                      **
 **    Updated for QT6410 Board            **
 **    Version 1.0 (11-12-15)              **
 **    Author: eilian                      **
 **    blog: **
 **    E-mail: 305075262@            **
 ********************************************

 CPU:     S3C6410@667MHz
          Fclk = 667MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)
 Board:   QT6410
 DRAM:  128 MiB
 NAND:  256 MiB
 *** Warning - bad CRC, using default environment

 In:    serial
 Out:   serial
 Err:   serial
 Net:   dm9000
 Hit any key to stop autoboot:  0

 NAND read: device 0 offset 0x100000, size 0x500000
  5242880 bytes read: OK
 ## Booting kernel from Legacy Image at 50018000 ...
    Image Name:   Linux-2.6.39
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    1313224 Bytes = 1.3 MiB
    Load Address: 50008000
    Entry Point:  50008000
    Verifying Checksum ... OK
    Loading Kernel Image ... OK
 OK

 Starting kernel ...

 Uncompressing Linux... done, booting the kernel.
 Linux version 2.6.39 (root@bootloader) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #1 Tue Dec 13 01:08:35 CST 2011
 CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f
 CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: QT6410 development board
 Memory policy: ECC disabled, Data cache writeback
 CPU S3C6410 (id 0x36410101)
 S3C24XX Clocks, Copyright 2004 Simtec Electronics
 camera: no parent clock specified
 S3C64XX: PLL settings, A=667000000, M=533000000, E=24000000
 S3C64XX: HCLK2=266500000, HCLK=133250000, PCLK=66625000
 mout_apll: source is fout_apll (1), rate is 667000000
 mout_epll: source is epll (1), rate is 24000000
 mout_mpll: source is mpll (1), rate is 533000000
 mmc_bus: source is mout_epll (0), rate is 24000000
 mmc_bus: source is mout_epll (0), rate is 24000000
 mmc_bus: source is mout_epll (0), rate is 24000000
 usb-bus-host: source is clk_48m (0), rate is 48000000
 uclk1: source is mout_epll (0), rate is 24000000
 spi-bus: source is mout_epll (0), rate is 24000000
 spi-bus: source is mout_epll (0), rate is 24000000
 audio-bus: source is mout_epll (0), rate is 24000000
 audio-bus: source is mout_epll (0), rate is 24000000
 audio-bus: source is mout_epll (0), rate is 24000000
 irda-bus: source is mout_epll (0), rate is 24000000
 camera: no parent clock specified
 Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
 Kernel command line: root=/dev/mtdblock2 rootfstype=cramfs console=ttySAC0,115200
 PID hash table entries: 512 (order: -1, 2048 bytes)
 Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
 Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
 Memory: 128MB = 128MB total
 Memory: 127092k/127092k available, 3980k reserved, 0K highmem
 Virtual kernel memory layout:
     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
     DMA     : 0xff600000 - 0xffe00000   (   8 MB)
     vmalloc : 0xc8800000 - 0xf6000000   ( 728 MB)
     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
     modules : 0xbf000000 - 0xc0000000   (  16 MB)
       .init : 0xc0008000 - 0xc0022000   ( 104 kB)
       .text : 0xc0022000 - 0xc0264568   (2314 kB)
       .data : 0xc0266000 - 0xc02892c0   ( 141 kB)
 SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
 NR_IRQS:246
 VIC @f6000000: id 0x00041192, vendor 0x41
 VIC @f6010000: id 0x00041192, vendor 0x41
 Console: colour dummy device 80x30
 console [ttySAC0] enabled
 Calibrating delay loop... 666.41 BogoMIPS (lpj=3332096)
 pid_max: default: 32768 minimum: 301
 Mount-cache hash table entries: 512
 CPU: Testing write buffer coherency: ok
 s3c64xx_dma_init: Registering DMA channels
 PL080: IRQ 73, at c8808000, channels 0..8
 PL080: IRQ 74, at c880c000, channels 8..16
 S3C6410: Initialising architecture
 bio: create slab <bio-0> at 0
 usbcore: registered new interface driver usbfs
 usbcore: registered new interface driver hub
 usbcore: registered new device driver usb
 s3c-i2c s3c2440-i2c.0: slave address 0x10
 s3c-i2c s3c2440-i2c.0: bus frequency set to 65 KHz
 s3c-i2c s3c2440-i2c.0: i2c-0: S3C I2C adapter
 ROMFS MTD (C) 2007 Red Hat, Inc.
 io scheduler noop registered
 io scheduler deadline registered
 io scheduler cfq registered (default)
 start plist test
 end plist test
 s3c-fb s3c-fb: window 0: fb
 Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
 s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 16) is a S3C6400/10
 s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 20) is a S3C6400/10
 s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 24) is a S3C6400/10
 s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 28) is a S3C6400/10
 brd: module loaded
 loop: module loaded
S3C NAND Driver, (c) 2008 Samsung Electronics
 S3C NAND Driver is using hardware ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
 Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
 0x000000000000-0x000000100000 : "Bootloader"
 0x000000100000-0x000000600000 : "Kernel"
 0x000000600000-0x000007e00000 : "User"
 0x000007e00000-0x000010000000 : "File System"
 ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
 s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
 s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
 s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x74300000
 s3c2410-ohci s3c2410-ohci: init err (00000000 0000)
 ohci_hcd: can't start s3c24xx
 s3c2410-ohci s3c2410-ohci: startup error -75
 s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered
 s3c2410-ohci: probe of s3c2410-ohci failed with error -75
 mousedev: PS/2 mouse device common for all mice
 S3C24XX RTC, (c) 2004,2006 Simtec Electronics
 s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
 s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
 i2c /dev entries driver
 sdhci: Secure Digital Host Controller Interface driver
 sdhci: Copyright(c) Pierre Ossman
 s3c-sdhci s3c-sdhci.0: clock source 0: hsmmc (133250000 Hz)
 s3c-sdhci s3c-sdhci.0: clock source 1: hsmmc (133250000 Hz)
 s3c-sdhci s3c-sdhci.0: clock source 2: mmc_bus (24000000 Hz)
 mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA
 s3c-sdhci s3c-sdhci.1: clock source 0: hsmmc (133250000 Hz)
 s3c-sdhci s3c-sdhci.1: clock source 1: hsmmc (133250000 Hz)
 s3c-sdhci s3c-sdhci.1: clock source 2: mmc_bus (24000000 Hz)
 mmc0: mmc_rescan_try_freq: trying to init card at 400000 Hz
 mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.1] using ADMA
 usbcore: registered new interface driver usbhid
 usbhid: USB HID core driver
 VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
 s3c-rtc s3c64xx-rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
 mmc0: mmc_rescan_try_freq: trying to init card at 300000 Hz
VFS: Mounted root (cramfs filesystem) readonly on device 31:2.
 Freeing init memory: 104K
 mmc0: mmc_rescan_try_freq: trying to init card at 200000 Hz
 mmc0: mmc_rescan_try_freq: trying to init card at 100000 Hz
 mmc1: mmc_rescan_try_freq: trying to init card at 400000 Hz
 mmc1: mmc_rescan_try_freq: trying to init card at 300000 Hz
 mmc1: mmc_rescan_try_freq: trying to init card at 200000 Hz
 mmc1: mmc_rescan_try_freq: trying to init card at 100000 Hz
 **************munt all************************
 ***********************************************
 **********booting for QT6410 *************
 Kernel version:linux-2.6.39
 Author:eilian
 Date:2011.12.14
 ***********************************************

 Please press Enter to activate this console.
 Processing /etc/profile...
 Set search library path in /etc/profile
 Set user path in /etc/profile
 -/bin/sh: PAT: not found
 root@bootloader#ls
 bin      etc      linuxrc  proc     sys      usr
 dev      lib      mnt      sbin     tmp      var
 root@bootloader# 
我就纳闷了,我怎么就没看到yaffs2文件系统的打印信息呢?记得已经配置并且也打了yaffs2补丁的啊