[U-Boot] Booting kernel from NAND flash on AT91SAM9 custom board using fsload

Nicholas Kinar n.kinar at usask.ca
Sun Apr 3 03:50:15 CEST 2011


Nicholas Kinar wrote:
> I then used the "ubifsload" command to load the uImage into SDRAM memory:
> U-Boot>  ubifsload 0x22000000 uImage
> Loading file 'uImage' to addr 0x22000000 with size 1256920 (0x00132dd8)...
> Done
>
> The "bootargs" environment variable was set to be the following:
>
> U-Boot>  setenv bootargs console=ttyS0,115200 rootfstype=ubifs ubi.mtd=1
> root=ubi0:container mtdparts=flash:10M(kernel),100M(root),-(storage)
>
> However, after running the "bootm" command, I find that I cannot boot
> the Linux kernel, and the booting process hangs:
>
> U-Boot>  bootm
> ## Booting kernel from Legacy Image at 22000000 ...
>      Image Name:   Linux-2.6.37
>      Image Type:   ARM Linux Kernel Image (uncompressed)
>      Data Size:    1256856 Bytes = 1.2 MiB
>      Load Address: 20008000
>      Entry Point:  20008000
>      Verifying Checksum ... OK
>      Loading Kernel Image ... OK
> OK
>
> Starting kernel ...
>
> In the Linux kernel xconfig, I've switched on support for UBI and
> UBIFS.  I am wondering what might be the problem here.  Are the bootargs
> being passed properly to the Linux kernel?
>
> Nicholas
>

I now strongly believe that the bootargs are not being passed in 
properly to the kernel.  Having found a posting on the AT91 website [1], 
I now realize that the Linux kernel has been built with a load address 
of 0x20008000, but must be loaded to different address 0x20080000.

Posting:
[1] 
http://www.at91.com/forum/viewtopic.php/f,12/t,5038/start,0/st,0/sk,t/sd,a/

Now the kernel boots, but as shown below a kernel panic occurs, so I 
think that the issue might be due to the "root=ubi0:container" bootarg.  
How would I set the root bootarg for this particular NAND flash filesystem?

My mtdparts is the following:

U-Boot> mtdparts

device nand0 <flash>, # parts = 3
  #: name                size            offset          mask_flags
  0: kernel              0x00a00000      0x00000000      0
  1: root                0x06400000      0x00a00000      0
  2: storage             0x79200000      0x06e00000      0

active partition: nand0,0 - (kernel) 0x00a00000 @ 0x00000000

defaults:
mtdids  : nand0=flash
mtdparts: mtdparts=flash:10M(kernel),100M(root),-(storage)

Now booting the kernel:

U-Boot> bootm 0x20080000
## Booting kernel from Legacy Image at 20080000 ...
    Image Name:   Linux-2.6.37
    Image Type:   ARM Linux Kernel Image (uncompressed)
    Data Size:    1256880 Bytes = 1.2 MiB
    Load Address: 20008000
    Entry Point:  20008000
    Verifying Checksum ... OK
    Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.37 (nkinar at matilda) (gcc version 4.3.5 (Buildroot 
2011.02) ) #3 Sat Apr 2 17:28:21 CST 2011
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Atmel AT91SAM9RL-EK
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 200 MHz, master 100 MHz, main 12.000 MHz
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: console=ttyS0,115200 root=ubi0:container 
mtdparts=flash:10M(kernel),100M(root),-(storage) rw 
rootfstype                                                =ubifs
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 62348k/62348k available, 3188k reserved, 0K highmem
Virtual kernel memory layout:
     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
     DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
     vmalloc : 0xc4800000 - 0xfee00000   ( 934 MB)
     lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
     modules : 0xbf000000 - 0xc0000000   (  16 MB)
       .init : 0xc0008000 - 0xc0023000   ( 108 kB)
       .text : 0xc0023000 - 0xc025537c   (2249 kB)
       .data : 0xc0256000 - 0xc026e3e0   (  97 kB)
NR_IRQS:192
AT91: 128 gpio irqs in 4 banks
Console: colour dummy device 80x30
console [ttyS0] enabled
Calibrating delay loop... 99.53 BogoMIPS (lpj=497664)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
SCSI subsystem initialized
i2c-gpio i2c-gpio: using pins 55 (SDA) and 56 (SCL)
Switching to clocksource pit
NET: Registered protocol family 1
msgmni has been set to 121
io scheduler noop registered (default)
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
brd: module loaded
loop: module loaded
NAND device: Manufacturer ID: 0x20, Chip ID: 0xd5 (ST Micro )
Scanning device for bad blocks
Bad eraseblock 65 at 0x000001040000
Bad eraseblock 1014 at 0x00000fd80000
Bad eraseblock 1159 at 0x0000121c0000
Bad eraseblock 2072 at 0x000020600000
Bad eraseblock 2536 at 0x000027a00000
Bad eraseblock 2540 at 0x000027b00000
Bad eraseblock 3101 at 0x000030740000
Bad eraseblock 3343 at 0x0000343c0000
Bad eraseblock 3778 at 0x00003b080000
Bad eraseblock 4516 at 0x000046900000
Bad eraseblock 4712 at 0x000049a00000
Bad eraseblock 4807 at 0x00004b1c0000
Bad eraseblock 5254 at 0x000052180000
Bad eraseblock 5256 at 0x000052200000
Bad eraseblock 8149 at 0x00007f540000
Creating 2 MTD partitions on "atmel_nand":
0x000000000000-0x000000040000 : "Partition 1"
0x000000040000-0x000080000000 : "Partition 2"
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffcc000 (irq 13)
mtd_dataflash spi0.0: AT45DB021B (264 KBytes) pagesize 264 bytes (OTP)
mice: PS/2 mouse device common for all mice
rtc-at91sam9 at91_rtt.0: rtc core: registered at91_rtt as rtc0
rtc-at91sam9 at91_rtt.0: rtc0: SET TIME!
i2c /dev entries driver
AT91SAM9 Watchdog: sorry, watchdog is disabled
at91_wdt: probe of at91_wdt failed with error -5
rtc-at91sam9 at91_rtt.0: hctosys: unable to read the hardware clock
VFS: Cannot open root device "ubi0:container" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available 
partitions:
1f00             256 mtdblock0  (driver?)
1f01         2096896 mtdblock1  (driver?)
1f02             264 mtdblock2  (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on 
unknown-block(0,0)
[<c0028240>] (unwind_backtrace+0x0/0xec) from [<c01c3dd8>] 
(panic+0x4c/0x180)
[<c01c3dd8>] (panic+0x4c/0x180) from [<c0009064>] 
(mount_block_root+0x25c/0x2b4)
[<c0009064>] (mount_block_root+0x25c/0x2b4) from [<c00091b4>] 
(prepare_namespace+0x8c/0x1c8)
[<c00091b4>] (prepare_namespace+0x8c/0x1c8) from [<c00085ac>] 
(kernel_init+0x10c/0x150)
[<c00085ac>] (kernel_init+0x10c/0x150) from [<c00248c4>] 
(kernel_thread_exit+0x0/0x8)






More information about the U-Boot mailing list