2009-07-23 04:40:15     Change env variables from userspace on NAND memory

Document created by Aaronwu Employee on Sep 25, 2013
Version 1Show Document
  • View in full screen mode

2009-07-23 04:40:15     Change env variables from userspace on NAND memory

Emanuele Italia (ITALY)

Message: 77938   

 

Hello guys,

 

i'm trying to modifiy the enviorment variables from userspace on bf532 with NAND memory, so i compiled u-boot tools (fw_printenv).

 

The problem is that the tool can't find/read the bootloader partition. I follow this guide(http://docs.blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:env&s[]=printenv) but i don't have exactly the same situation(i have NAND memory not SPI).

 

On /proc/mtd i have:

 

dev:    size   erasesize  name

 

mtd0: 00300000 00001000 "ROMfs"

 

mtd1: 00800000 00020000 "linux kernel"

 

mtd2: 0f800000 00020000 "file system"

 

 

 

when i try to execute fw_printenv on mtd0 i have this output:

 

 

 

Unsupported flash type 1

 

 

 

if try on mtd1 or mtd2:

 

 

 

Warning: Bad CRC, using default environment

 

bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm

 

bootdelay=5

 

baudrate=115200

 

 

 

have you you any ideas how to find where is the bootloader? do you have any suggestions?

 

 

 

Thanks in advance.

 

 

 

 

 

Emanuele

 

 

TranslateQuoteReplyEditDelete

 

 

2009-07-23 04:45:45     Re: Change env variables from userspace on NAND memory

Mike Frysinger (UNITED STATES)

Message: 77939   

 

you cant just pick random mtd's and hope things will work.  you need to properly configure your system first.  that means you need to partition the flash and make sure the u-boot sectors are defined in your map.

 

post the full boot log from your board.

QuoteReplyEditDelete

 

 

2009-07-23 04:48:31     Re: Change env variables from userspace on NAND memory

Robin Getz (UNITED STATES)

Message: 77941   

 

Emanuele:

 

I'm trying to understand - you are using 532 (which doesn't support boot from NAND), and you have the Boot loader environment stored in NAND?

 

That doesn't make much sense to me.

 

-Robin

QuoteReplyEditDelete

 

 

2009-07-23 04:55:32     Re: Change env variables from userspace on NAND memory

Emanuele Italia (ITALY)

Message: 77942   

 

you cant just pick random mtd's and hope things will work.  you need to properly configure your system first.  that means you need to partition the flash and make sure the u-boot sectors are defined in your map.

 

post the full boot log from your board.

 

---

 

i didn't do it random

 

Anyway...

 

 

 

Linux version 2.6.19.3-ADI-2007R1.1-svn (root@debian) (gcc version 4.1.1 (ADI 07R1)) #5 Fri Jun 19 12:48:07 SAST 2009

 

Blackfin support (C) 2004-2007 Analog Devices, Inc.

 

Compiled for ADSP-BF533 Rev 0.5

 

Blackfin Linux support by http://blackfin.uclinux.org/

 

Processor Speed: 400 MHz core clock and 133 Mhz System Clock

 

Board Memory: 64MB

 

Kernel Managed Memory: 64MB

 

Memory map:

 

  text      = 0x00001000-0x0015e0ec

 

  init      = 0x0015f000-0x00170c70

 

  data      = 0x00172d8c-0x001b6124

 

  stack     = 0x00174000-0x00176000

 

  bss       = 0x001b6130-0x001c6094

 

  available = 0x001c6094-0x03c00000

 

  rootfs    = 0x03c00000-0x03f00000

 

  DMA Zone  = 0x03f00000-0x04000000

 

On node 0 totalpages: 15360

 

  DMA zone: 120 pages used for memmap

 

  DMA zone: 0 pages reserved

 

  DMA zone: 15240 pages, LIFO batch:3

 

  Normal zone: 0 pages used for memmap

 

Instruction Cache Enabled

 

Data Cache Enabled (write-back)

 

Hardware Trace Enabled

 

Built 1 zonelists.  Total pages: 15240

 

Kernel command line: ethaddr=00:09:45:56:50:B0 console=ttyBF0,115200 root=/dev/mtdblock2 rw

 

Configuring Blackfin Priority Driven Interrupts

 

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

 

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

 

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

 

Physical pages: 3c00

 

Memory available: 59008k/64052k RAM, (71k init code, 1396k kernel code, 63k data, 1024k dma)

 

Blackfin Scratchpad data SRAM: 4 KB

 

Blackfin DATA_A SRAM: 16 KB

 

Blackfin DATA_B SRAM: 16 KB

 

Blackfin Instruction SRAM: 64 KB

 

Blackfin Instruction SRAM size: 57060 Bytes

 

Calibrating delay loop... 798.72 BogoMIPS (lpj=1597440)

 

Security Framework v1.0.0 initialized

 

Mount-cache hash table entries: 512

 

NET: Registered protocol family 16

 

Blackfin GPIO Controller

 

Blackfin DMA Controller

 

bf1_init(): chip_id=527A50CB,dspid=E5040005

 

bf1_init(): registering device resources

 

SCSI subsystem initialized

 

usbcore: registered new interface driver usbfs

 

usbcore: registered new interface driver hub

 

usbcore: registered new device driver usb

 

NET: Registered protocol family 2

 

IP route cache hash table entries: 512 (order: -1, 2048 bytes)

 

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

 

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

 

TCP: Hash tables configured (established 2048 bind 1024)

 

TCP reno registered

 

yaffs Jun 19 2009 10:45:12 Installing.

 

io scheduler noop registered

 

io scheduler anticipatory registered (default)

 

io scheduler cfq registered

 

Dynamic Power Management Controller Driver v0.1: major=10, minor = 254

 

Serial: Blackfin serial driver

 

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 21) is a BFIN-UART

 

RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize

 

dm9000 Ethernet Driver

 

eth0: dm9000 at 20100000,20100002 IRQ 48 MAC: 00:09:45:56:50:b0

 

eth%d: Invalid ethernet MAC address.  Please set using ifconfig

 

eth1: dm9000 at 20200000,20200002 IRQ 47 MAC: 00:00:00:00:00:00

 

BF5xx flash: probing 16-bit flash bus

 

uclinux[mtd]: RAM probe address=0x3c00000 size=0x300000

 

Creating 1 MTD partitions on "RAM":

 

0x00000000-0x00300000 : "ROMfs"

 

uclinux[mtd]: set ROMfs:EXT2  to be root filesystem

 

Generic platform RAM MTD, (c) 2004 Simtec Electronics

 

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

 

Scanning device for bad blocks

 

Bad eraseblock 561 at 0x04620000

 

Bad eraseblock 1305 at 0x0a320000

 

Bad eraseblock 2037 at 0x0fea0000

 

Creating 2 MTD partitions on "NAND 256MiB 3,3V 8-bit":

 

0x00000000-0x00800000 : "linux kernel"

 

0x00800000-0x10000000 : "file system"

 

usbmon: debugfs is not available

 

driver isp1362-hcd, 2005-04-04

 

isp1362-hcd isp1362-hcd.0: ISP1362 Host Controller

 

isp1362-hcd isp1362-hcd.0: new USB bus registered, assigned bus number 1

 

isp1362_hc_reset:

 

Clock not ready after 20ms

 

isp1362-hcd isp1362-hcd.0: can't setup

 

isp1362-hcd isp1362-hcd.0: USB bus 1 deregistered

 

init error, -19

 

Initializing USB Mass Storage driver...

 

usbcore: registered new interface driver usb-storage

 

USB Mass Storage support registered.

 

ip_conntrack version 2.4 (480 buckets, 3840 max) - 208 bytes per conntrack

 

ip_tables: (C) 2000-2006 Netfilter Core Team

 

TCP cubic registered

 

NET: Registered protocol family 1

 

NET: Registered protocol family 17

 

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

 

yaffs: dev is 32505858 name is "mtdblock2"

 

yaffs: Attempting MTD mount on 31.2, "mtdblock2"

 

yaffs: auto selecting yaffs2

 

block 498 is bad

 

block 1242 is bad

 

block 1974 is bad

 

VFS: Mounted root (yaffs filesystem).

 

Freeing unused kernel memory: 68k freed (0x15f000 - 0x16f000)

 

dma_alloc_init: dma_page @ 0x0016d000 - 256 pages at 0x03f00000

 

eth0: link down

 

eth1: link down

 

802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>

 

All bugs added by David S. Miller <davem@redhat.com>

 

Open Source Line Echo Canceller Installed

 

Zapata Telephony Interface Registered on major 196

 

Zaptel Version: 1.4.3

 

Zaptap registered 'sample' char driver on major 33

 

Code test: code function addr = 0x033c9210

 

TranslateQuoteReplyEditDelete

 

 

2009-07-23 04:57:10     Re: Change env variables from userspace on NAND memory

Emanuele Italia (ITALY)

Message: 77943   

 

Emanuele:

 

I'm trying to understand - you are using 532 (which doesn't support boot from NAND), and you have the Boot loader environment stored in NAND?

 

That doesn't make much sense to me.

 

-Robin

 

---

 

Do you need that i post photos?

 

it seems NAND to me...

 

Loading from device 0: NAND 256MiB 3,3V 8-bit (offset 0x0)

 

   Image Name:   uClinux Kernel and ext2

 

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

 

   Data Size:    2130091 Bytes =  2 MB

 

   Load Address: 00001000

 

   Entry Point:  00001000

 

Automatic boot of image at addr 0x02000000 ...

 

## Booting image at 02000000 ...

 

   Image Name:   uClinux Kernel and ext2

 

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

 

   Data Size:    2130091 Bytes =  2 MB

 

   Load Address: 00001000

 

   Entry Point:  00001000

 

   Verifying Checksum ... OK

 

TranslateQuoteReplyEditDelete

 

 

2009-07-23 05:13:46     Re: Change env variables from userspace on NAND memory

Mike Frysinger (UNITED STATES)

Message: 77944   

 

i dont think you understand how u-boot works.  Robin's point is correct -- u-boot's environment by default is where u-boot itself is, and u-boot makes no sense at all being in NAND flash on a BF532.  your output is irrelevant -- you showed the *kernel* booting, not *u-boot*.

 

so unless you're doing some whacky and putting just the environment into NAND flash while keeping u-boot in SPI or parallel flash, your original question makes no sense at all.

QuoteReplyEditDelete

 

 

2009-07-23 05:26:31     Re: Change env variables from userspace on NAND memory

Emanuele Italia (ITALY)

Message: 77945   

 

i dont think you understand how u-boot works.  Robin's point is correct -- u-boot's environment by default is where u-boot itself is, and u-boot makes no sense at all being in NAND flash on a BF532.  your output is irrelevant -- you showed the *kernel* booting, not *u-boot*.

 

so unless you're doing some whacky and putting just the environment into NAND flash while keeping u-boot in SPI or parallel flash, your original question makes no sense at all.

 

---

 

Yes, you are right. I don't know how it works that's why i'm here ...i thought the uboot stays on NAND memory but it seems that i'm totally wrong.

 

Anyway i'd like to know how to change enviorment variables from user-space. Is it possible with my system?do i need to create a partition for env variables?

 

Thank you in advance.

 

Emanuele

TranslateQuoteReplyEditDelete

 

 

2009-07-23 05:30:34     Re: Change env variables from userspace on NAND memory

Mike Frysinger (UNITED STATES)

Message: 77946   

 

i dont know how you're booting your board.  presumably *you* know considering it's *your* board.

 

read the mtd document to figure out how to setup the flash in question for access under Linux:

https://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:mtd

QuoteReplyEditDelete

 

 

2009-07-23 09:45:01     Re: Change env variables from userspace on NAND memory

Emanuele Italia (ITALY)

Message: 77958   

 

Hello,

 

yes you are right my u-boot doesn't use NAND but...

 

starting from spi flash

 

Anyway i was following the guide about MTD , i recompiled the kernel with MTD partitioning support and Command line partition table parsing. 

 

I booted with new kernel with new bootargs but i didn't find any new partition...

 

 

 

ip04>setenv bootargs mtdparts=bfin-async-flash:256k(uboot)ro,1792k(kernel),-(rootfs)

 

ip04>tftp 0x1000000 uImage.new

 

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

 

MAC: 00:09:45:56:50:b0

 

operating at 100M full duplex mode

 

Using DM9000#0 device

 

TFTP from server 10.0.0.200; our IP address is 10.0.0.100

 

Filename 'uImage.new'.

 

Load address: 0x1000000

 

Loading: #################################################################

 

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

 

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

 

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

 

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

 

.

 

.

 

.

 

Creating 1 MTD partitions on "RAM":

 

0x00000000-0x01000000 : "ROMfs"

 

uclinux[mtd]: set ROMfs:EXT2  to be root filesystem

 

Generic platform RAM MTD, (c) 2004 Simtec Electronics

 

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

 

Scanning device for bad blocks

 

Bad eraseblock 561 at 0x04620000

 

Bad eraseblock 1305 at 0x0a320000

 

Bad eraseblock 2037 at 0x0fea0000

 

Creating 2 MTD partitions on "NAND 256MiB 3,3V 8-bit":

 

0x00000000-0x00800000 : "linux kernel"

 

0x00800000-0x10000000 : "file system"

 

 

 

it seems that it does't create partitions like i "asked" on bootargs.

 

i still don't understand why i have to do NAND partitions if i want access on env variables on SPI memory.

 

I'm confused...

 

 

 

Regards,

 

 

 

Emanuele

TranslateQuoteReplyEditDelete

 

 

2009-07-23 10:28:03     Re: Change env variables from userspace on NAND memory

Mike Frysinger (UNITED STATES)

Message: 77966   

 

bfin-async-flash is for parallel flash, not SPI flash.  the mtd doc covers how to enable SPI flash support.

 

no one said you have to partition your NAND flash in order to access SPI flash.

QuoteReplyEditDelete

 

 

2009-07-23 11:03:11     Re: Change env variables from userspace on NAND memory

Emanuele Italia (ITALY)

Message: 77971   

 

how can i know the name of my spi driver? can be "bfin-spi-master "?

 

Thanks,

 

Emanuele

TranslateQuoteReplyEditDelete

 

 

2009-07-23 11:40:26     Re: Change env variables from userspace on NAND memory

Mike Frysinger (UNITED STATES)

Message: 77973   

 

the documentation tells you the name -- m25p80

 

read any of the Blackfin boards for examples

QuoteReplyEditDelete

 

 

2009-07-29 04:48:13     Re: Change env variables from userspace on NAND memory

Emanuele Italia (ITALY)

Message: 78146   

 

the documentation tells you the name -- m25p80

 

read any of the Blackfin boards for examples

 

---

 

It seems no...

 

 

 

Instruction Cache Enabled

 

Data Cache Enabled (write-back)

 

Hardware Trace Enabled

 

Built 1 zonelists.  Total pages: 11938

 

Kernel command line: mtdparts=m25p80:256k(uboot)ro,1792k(kernel),-(rootfs) ethaddr=00:09:45:56:50:B0 console=ttyBF0,115200 root=/dev/mtdblock2 rw

 

Configuring Blackfin Priority Driven Interrupts

 

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

 

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

 

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

 

Physical pages: 2f00

 

.

 

.

 

.

 

F5xx flash: probing 16-bit flash bus

 

uclinux[mtd]: RAM probe address=0x2f00000 size=0x1000000

 

Creating 1 MTD partitions on "RAM":

 

0x00000000-0x01000000 : "ROMfs"

 

uclinux[mtd]: set ROMfs:EXT2  to be root filesystem

 

Generic platform RAM MTD, (c) 2004 Simtec Electronics

 

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

 

Scanning device for bad blocks

 

Bad eraseblock 561 at 0x04620000

 

Bad eraseblock 1305 at 0x0a320000

 

Bad eraseblock 2037 at 0x0fea0000

 

Creating 2 MTD partitions on "NAND 256MiB 3,3V 8-bit":

 

0x00000000-0x00800000 : "linux kernel"

 

0x00800000-0x10000000 : "file system"

 

 

 

how can i know the SPI driver name?

 

 

 

Thank you in advance,

 

 

 

Emanuele

TranslateQuoteReplyEditDelete

 

 

2009-07-29 06:53:47     Re: Change env variables from userspace on NAND memory

Emanuele Italia (ITALY)

Message: 78152   

 

I resolved!

 

i did a stupid mistake, i compiled the kernel for STAMP board.

 

I recompiled for EZKIT, it works perfectly:

 

Creating 2 MTD partitions on "NAND 256MiB 3,3V 8-bit":

 

0x00000000-0x00800000 : "linux kernel"

 

0x00800000-0x10000000 : "file system"

 

m25p80 spi1.2: m25p64 (8192 Kbytes)

 

3 cmdlinepart partitions found on MTD device m25p80

 

Creating 3 MTD partitions on "m25p80":

 

0x00000000-0x00040000 : "uboot"

 

0x00040000-0x00200000 : "kernel"

 

0x00200000-0x00800000 : "rootfs"

 

 

 

Thank you very much for your big support!! i really appreciated ;-)

 

Have nice day

 

 

 

Emanuele

TranslateQuoteReplyEditDelete

Attachments

    Outcomes