AnsweredAssumed Answered

Kernel and jffs2 in spi-flash

Question asked by vrp on Oct 1, 2013
Latest reply on Oct 4, 2013 by vrp

My steps:


1. tar -vxf blackfin-buildroot-2012R2-RC5.tar

2. cd  blackfin-buildroot/

3. make bf537-stamp_defconfig

4. make


The resulting uImage is loaded and runs just right.


Now I want to generate the Kernel with root file system and save them in the serial flash.

According to topics

we choose (or not) the following options:


make linux-menuconfig

     Device Drivers  --->

           <*> Memory Technology Device (MTD) support  --->

               <*> Memory Technology Device (MTD) support

               <*>   Direct char device access to MTD devices

               <*>   Caching block device access to MTD devices


               Mapping drivers for chip access  --->

                    [*] Support non-linear mappings of flash chips

                    [ ] Generic uClinux RAM/ROM filesystem support

               Self-contained MTD device drivers  --->

                    <*> Support most SPI Flash chips (AT26DF, M25P, W25X, ...)


     File systems  --->

          [*] Miscellaneous filesystems  --->

               <*>   Journalling Flash File System v2 (JFFS2) support


After 'make' we get uImage, vmImage, and rootfs.jffs2.


bfin> tftp 0x1000000 uImage

bfin> bootm


uImage is booting and runs quite right. It shows in particular:

     m25p80 spi0.1: found m25p64, expected m25p80

     m25p80 spi0.1: m25p64 (8192 Kbytes)

     Creating 3 MTD partitions on "m25p80":

     0x000000000000-0x000000040000 : "bootloader(spi)"

     0x000000040000-0x0000001c0000 : "linux kernel(spi)"

     0x0000001c0000-0x000000800000 : "file system(spi)"



Now we erase the entire device

     bfin> sf probe 1

     SF: Detected M25P64 with page size 64 KiB, total 8 MiB

     bfin> mw.b 0x1000000 0x0 0x800000


Save U-Boot in the spi-flash:

     tftp 0x1000000 u-boot.ldr

     Bytes transferred = 210770 (33752 hex)

     sf write 0x1000000 0x0 $(filesize)


Load and save vmImage:

     bfin> mw.b 0x1000000 0x0 0x180000

     bfin> tftp 0x1000000 vmImage

     Bytes transferred = 1146813 (117fbd hex)1c

     bfin> sf write 0x1000000 0x40000 0x180000


Load and save rootfs.jffs2:

     bfin> mw.b 0x1000000 0x0 0x800000

     bfin> tftp 0x1000000 rootfs.jffs2

     Bytes transferred = 2902708 (2c4ab4 hex)

     bfin> sf write 0x1000000 0x1c0000 $(filesize)


Prepare parameters of the U-Boot:

     bfin> setenv bootargs root=/dev/mtdblock2 rw rootfstype=jffs2

     bfin> setenv flashboot 'sf probe 1; sf read 0x1000000 0x40000 0x180000; bootm 0x1000000'

     bfin> setenv bootcmd run flashboot

     bfin> save



     bfin> run bootcmd

there is the following dump:


SF: Detected M25P64 with page size 64 KiB, total 8 MiB

## Booting kernel from Legacy Image at 01000000 ...

   Image Name:   bf537-0.2-3.5.7-ADI-2012R2

   Created:      2013-10-01  11:17:04 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    1146749 Bytes = 1.1 MiB

   Load Address: 00001000

   Entry Point:  001f1d28

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 001f1d28

console [ttyBF0] enabled, bootconsole disabled

Calibrating delay loop... 995.32 BogoMIPS (lpj=1990656)

pid_max: default: 32768 minimum: 301

Mount-cache hash table entries: 512

devtmpfs: initialized

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (16 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (34 KB free)

NET: Registered protocol family 16

Blackfin DMA Controller

stamp_init(): registering device resources

bio: create slab <bio-0> at 0

bfin-spi bfin-spi.0: master is unqueued, this is deprecated

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs@ffc00500, dma channel@7

Switching to clocksource bfin_cs_cycles

NET: Registered protocol family 2

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

TCP established hash table entries: 1024 (order: 1, 8192 bytes)

TCP bind hash table entries: 1024 (order: 0, 4096 bytes)

TCP: Hash tables configured (established 1024 bind 1024)

TCP: reno registered

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

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

NET: Registered protocol family 1

Kernel panic - not syncing: junk in compressed archive

Hardware Trace:

   0 Target : <0x0014ff48> { _dump_stack + 0x0 }

     Source : <0x0014ffe8> { _panic + 0x68 } CALL pcrel

   1 Target : <0x0014ffd6> { _panic + 0x56 }

     Source : <0x0000c31e> { _test_taint + 0x22 } RTS

   2 Target : <0x0000c2fc> { _test_taint + 0x0 }

     Source : <0x0014ffd2> { _panic + 0x52 } CALL pcrel



and so on.


What did I forget? Thank you.