u-boot-2012.04.01移植到TQ2440(七):添加分区信息并启动jffs2文件系统

时间:2022-09-27 16:34:24

一、    添加分区信息并启动jffs2文件系统

烧写之前的内核看输出分区信息

TQ2440 # tftp 32000000uImage

dm9000 i/o: 0x20000000, id:0x90000a46

DM9000: running in 16 bitmode

MAC: 00:0c:29:4d:e4:f4

Using dm9000 device

TFTP from server172.28.12.60; our IP address is 172.28.12.10

Filename 'uImage'.

Load address: 0x32000000

Loading: T#################################################################

        #################################################################

         ################

done

Bytes transferred = 2138388(20a114 hex)

TQ2440 # bootm 32000000

…………

Creating 4 MTD partitions on"NAND":

0x000000000000-0x000000040000: "u-boot"

0x000000040000-0x000000060000: "params"

0x000000060000-0x000000360000: "kernel"

0x000000360000-0x000010000000: "rootfs"

…………

修改配置文件include\configs\tq2440.h打开之前屏蔽的MTDPARTS命令的宏

#if 0

#define CONFIG_CMD_FAT

#define CONFIG_CMD_EXT2

#define CONFIG_CMD_UBI

#define CONFIG_CMD_UBIFS

#endif

#define CONFIG_CMD_MTDPARTS

#if 0

#define CONFIG_MTD_DEVICE

#defineCONFIG_MTD_PARTITIONS

#define CONFIG_YAFFS2

#define CONFIG_RBTREE

#endif

添加如下分区信息

#define CONFIG_MTD_DEVICE

#defineMTDIDS_DEFAULT              "nand0=tq2440-0"  /*哪一个设备 */

#defineMTDPARTS_DEFAULT  "mtdparts=tq2440-0:256k(u-boot),"       \

                                     "128k(params),"          \

                                     "3m(kernel),"  \

                                     "-(rootfs)"        \

重新编译,烧到开发板并启动

U-Boot 2012.04.01 (Dec 312012 - 16:52:29)

CPUID: 32440001

FCLK:      400 MHz

HCLK:      100 MHz

PCLK:       50 MHz

DRAM:  64 MiB

WARNING: Caches not enabled

Flash: *** failed ***

NAND:  256 MiB

In:    serial

Out:   serial

Err:   serial

Net:   dm9000

TQ2440 # mtdparts default第一次启动首先执行mtdparts default

TQ2440 # save
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x40000 -- 100% complete.
Writing to Nand... done

TQ2440 # mtdparts

device nand0<tq2440-0>, # parts = 4

 #: name                size            offset          mask_flags

 0: u-boot              0x00040000      0x00000000      0

 1: params              0x00020000      0x00040000      0

 2: kernel              0x00300000      0x00060000      0

 3: rootfs              0x0fca0000      0x00360000      0

active partition: nand0,0 -(u-boot) 0x00040000 @ 0x00000000

defaults:

mtdids  : nand0=tq2440-0

mtdparts:mtdparts=tq2440-0:256k(u-boot),128k(params),3m(kernel),-(rootfs)

TQ2440 # nand erase.part kernel

NAND erase.part: device 0offset 0x60000, size 0x400000

Erasing at 0x440000 -- 100%complete.

OK

TQ2440 # tftp 32000000 uImage

dm9000 i/o: 0x20000000, id:0x90000a46

DM9000: running in 16 bitmode

MAC: 00:0c:29:4d:e4:f4

Using dm9000 device

TFTP from server172.28.12.60; our IP address is 172.28.12.10

Filename 'uImage'.

Load address: 0x32000000

Loading: T#################################################################

        #################################################################

         ################

done

Bytes transferred = 2138388(20a114 hex)

TQ2440 # nand write 32000000 kernel

NAND write: device 0 offset0x60000, size 0x400000

 4194304 bytes written: OK

设置启动参数

TQ2440 # set bootcmd nand read 32000000 kernel\;bootm 32000000

TQ2440 # save

Saving Environment toNAND...

Erasing Nand...

Erasing at 0x40000 -- 100%complete.

Writing to Nand... done

烧写jffs2文件系统

TQ2440 # tftpboot 32000000 rootfs.jffs2

dm9000 i/o: 0x20000000, id:0x90000a46

DM9000: running in 16 bitmode

MAC: 00:0c:29:4d:e4:f4

Using dm9000 device

TFTP from server172.28.12.60; our IP address is 172.28.12.10

Filename 'rootfs.jffs2'.

Load address: 0x32000000

Loading: T#################################################################

        #################################################################

        #################################################################

         ############################

done

Bytes transferred = 3262836(31c974 hex)

TQ2440 # nand erase.part rootfs

NAND erase.part: device 0offset 0x460000, size 0xfba0000

Skipping bad block at  0x08260000                                         

Erasing at 0xffe0000 -- 100%complete.

OK

TQ2440 # nand write 32000000 rootfs $filesize

NAND write: device 0 offset0x460000, size 0x31c974

 3262836 bytes written: OK

设置启动参数

TQ2440 # set bootargs root=/dev/mtdblock3 rootfstype=jffs2init=/linuxrc console=ttySAC0,115200

TQ2440 # save

Saving Environment toNAND...

Erasing Nand...

Erasing at 0x40000 -- 100%complete.

Writing to Nand... done

TQ2440 # res  重启

resetting ...

U-Boot 2012.04.01 (Dec 31 2012- 16:52:29)

 

CPUID: 32440001

FCLK:      400 MHz

HCLK:      100 MHz

PCLK:       50 MHz

DRAM:  64 MiB

WARNING: Caches not enabled

Flash: *** failed ***

NAND:  256 MiB

In:    serial

Out:   serial

Err:   serial

Net:   dm9000

Hit any key to stopautoboot:  0

 

NAND read: device 0 offset0x60000, size 0x300000

 3145728 bytes read: OK

## Booting kernel fromLegacy Image at 32000000 ...

   Image Name:  Linux-2.6.36.4

   Created:     2012-12-31   8:37:05 UTC

   Image Type:  ARM Linux Kernel Image (uncompressed)

   Data Size:   2138324 Bytes = 2 MiB

   Load Address: 30008000

   Entry Point: 30008000

   Verifying Checksum ... OK

   Loading Kernel Image ... OK

OK

 

Starting kernel ...

 

Uncompressing Linux... done,booting the kernel.

Linux version 2.6.36.4(root@zjh) (gcc version 4.4.3 (ctng-1.6.1) ) #4 Mon Dec 31 16:36:50 CST 2012

CPU: ARM920T [41129200]revision 0 (ARMv4T), cr=c0007177

CPU: VIVT data cache, VIVTinstruction cache

Machine: SMDK2440

Memory policy: ECC disabled,Data cache writeback

CPU S3C2440A (id 0x32440001)

S3C24XX Clocks, Copyright2004 Simtec Electronics

S3C244X: core 400.000 MHz,memory 100.000 MHz, peripheral 50.000 MHz

CLOCK: Slow mode (1.500MHz), fast, MPLL on, UPLL on

Built 1 zonelists in Zoneorder, mobility grouping on.  Totalpages: 16256

Kernel command line:root=/dev/mtdblock3 rootfstype=jffs2 init=/linuxrc console=ttySAC0,115200

PID hash table entries: 256(order: -2, 1024 bytes)

Dentry cache hash table entries:8192 (order: 3, 32768 bytes)

Inode-cache hash tableentries: 4096 (order: 2, 16384 bytes)

Memory: 64MB = 64MB total

Memory: 60620k/60620kavailable, 4916k reserved, 0K highmem

Virtual kernel memorylayout:

    vector : 0xffff0000 - 0xffff1000   (   4 kB)

    fixmap : 0xfff00000 - 0xfffe0000   ( 896kB)

    DMA    : 0xffc00000 - 0xffe00000   (   2 MB)

    vmalloc : 0xc4800000 - 0xe0000000   ( 440 MB)

    lowmem : 0xc0000000 - 0xc4000000   (  64 MB)

    modules : 0xbf000000 - 0xc0000000   (  16MB)

      .init : 0xc0008000 - 0xc0028000   ( 128 kB)

      .text : 0xc0028000 - 0xc03d1000   (3748 kB)

      .data : 0xc03ea000 - 0xc040cac0   ( 139 kB)

Hierarchical RCUimplementation.

        RCU-based detection of stalled CPUs isdisabled.

        Verbose stalled-CPUs detection isdisabled.

NR_IRQS:85

irq: clearing subpendingstatus 00000002

Console: colour dummy device80x30

console [ttySAC0] enabled

Calibrating delay loop...199.47 BogoMIPS (lpj=498688)

pid_max: default: 32768minimum: 301

Mount-cache hash tableentries: 512

CPU: Testing write buffercoherency: ok

gpiochip_add: gpios 288..303(GPIOK) failed to register

gpiochip_add: gpios 320..334(GPIOL) failed to register

gpiochip_add: gpios 352..353(GPIOM) failed to register

NET: Registered protocolfamily 16

S3C Power Management,Copyright 2004 Simtec Electronics

S3C2440: Initialisingarchitecture

S3C2440: IRQ Support

S3C24XX DMA Driver,Copyright 2003-2006 Simtec Electronics

DMA channel 0 at c4808000,irq 33

DMA channel 1 at c4808040, irq34

DMA channel 2 at c4808080,irq 35

DMA channel 3 at c48080c0,irq 36

S3C244X: Clock Support, DVSoff

bio: create slab<bio-0> at 0

SCSI subsystem initialized

usbcore: registered newinterface driver usbfs

usbcore: registered newinterface driver hub

usbcore: registered newdevice driver usb

s3c-i2c s3c2440-i2c: slaveaddress 0x10

s3c-i2c s3c2440-i2c: busfrequency set to 97 KHz

s3c-i2c s3c2440-i2c: i2c-0:S3C I2C adapter

Advanced Linux SoundArchitecture Driver Version 1.0.23.

NET: Registered protocolfamily 2

IP route cache hash tableentries: 1024 (order: 0, 4096 bytes)

TCP established hash tableentries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries:2048 (order: 1, 8192 bytes)

TCP: Hash tables configured(established 2048 bind 2048)

TCP reno registered

UDP hash table entries: 256(order: 0, 4096 bytes)

UDP-Lite hash table entries:256 (order: 0, 4096 bytes)

NET: Registered protocolfamily 1

RPC: Registered udptransport module.

RPC: Registered tcptransport module.

RPC: Registered tcp NFSv4.1backchannel transport module.

NetWinder Floating PointEmulator V0.97 (extended precision)

JFFS2 version 2.2. (NAND)(SUMMARY)  © 2001-2006 Red Hat, Inc.

ROMFS MTD (C) 2007 Red Hat,Inc.

msgmni has been set to 118

io scheduler noop registered

io scheduler deadlineregistered

io scheduler cfq registered(default)

Console: switching to colourframe buffer device 30x40

fb0: s3c2410fb frame bufferdevice

lp: driver loaded but nodevices found

ppdev: user-space parallelport driver

Serial: 8250/16550 driver, 4ports, IRQ sharing enabled

s3c2440-uart.0:s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440

s3c2440-uart.1:s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440

s3c2440-uart.2:s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440

brd: module loaded

loop: module loaded

Uniform Multi-Platform E-IDEdriver

ide-gd driver 1.18

ide-cd driver 5.00

S3C24XX NAND Driver, (c)2004 Simtec Electronics

s3c24xx-nand s3c2440-nand:Tacls=1, 10ns Twrph0=3 30ns, Twrph1=1 10ns

s3c24xx-nand s3c2440-nand:NAND soft ECC

NAND device: ManufacturerID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)

Scanning device for badblocks

Bad eraseblock 1043 at0x000008260000

Creating 4 MTD partitions on"NAND":

0x000000000000-0x000000040000: "u-boot"

0x000000040000-0x000000060000: "params"

0x000000060000-0x000000360000: "kernel"

0x000000360000-0x000010000000: "rootfs"

dm9000 Ethernet Driver,V1.31

usbmon: debugfs is notavailable

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 42, io mem 0x49000000

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 2 portsdetected

usbcore: registered newinterface driver libusual

usbcore: registered newinterface driver usbserial

USB Serial supportregistered for generic

usbcore: registered newinterface driver usbserial_generic

usbserial: USB Serial Drivercore

USB Serial supportregistered for FTDI USB Serial Device

usbcore: registered newinterface driver ftdi_sio

ftdi_sio: v1.6.0:USB FTDISerial Converters Driver

USB Serial supportregistered for pl2303

usbcore: registered newinterface driver pl2303

pl2303: Prolific PL2303 USBto serial adaptor driver

mice: PS/2 mouse devicecommon for all mice

S3C24XX RTC, (c) 2004,2006Simtec Electronics

S3C2410 Watchdog Timer, (c)2004 Simtec Electronics

s3c2410-wdt s3c2410-wdt:watchdog inactive, reset disabled, irq enabled

No device for DAI UDA134X

No device for DAIs3c24xx-i2s

ALSA device list:

  No soundcards found.

TCP cubic registered

NET: Registered protocolfamily 17

drivers/rtc/hctosys.c:unable to open rtc device (rtc0)

VFS: Mounted root (jffs2filesystem) on device 31:3.

Freeing init memory: 128K

 

Please press Enter toactivate this console.

Processing /etc/profile...

Done

[root@tq2440 /]#