2008-07-09 09:41:52     Erasing and Writing in Flash from uClinux

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

2008-07-09 09:41:52     Erasing and Writing in Flash from uClinux

Oussema Harbi (TUNISIA)

Message: 58546   


i want to write a partition image Directly on flash from uClinux ,but all i could find are documents talking about setting some options when compiling the kernel -MTD and jffs2 support .. -


I guess my kernel is  not compiled with those options turned on ,because i couldnt use commands like read or fread or erase or eraseall ...And when doing cat /proc/mtd this is what i get :


dev:    size   erasesize  name

mtd0: 00800000 00001000 "ROMfs" .


That means i have only one partition mounted ,thats the file system .I cant see the kernel partition.


So am asking if someone knows a way to write on flash dirctly.


PS :


I dont have much mem space available ,300ko .When booting the system charges the rootfs in ram and works with it -i deduced that because every changes i made are gone when i reboot -.


When i try to copy some file to /home for example ,it tells me there is no enough space available -that means there are only 300ko available to be written .So am am right when i say that the partition created on ram as romfs has the same sizw as my flash ?




2008-07-09 23:35:02     Re: Erasing and Writing in Flash from uClinux


Message: 58582   


What kernel version are you using?


To use command like "flash_eraseall", please read: http://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:mtd-utils.


"dev:    size   erasesize  name

mtd0: 00800000 00001000 "ROMfs" ."


This means you does not enable any flash. It looks you have enabled "Generic uClinux RAM / ROM FS Support". It is a ram-based mtd driver and not necessary.


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






2008-07-10 04:43:06     Re: Erasing and Writing in Flash from uClinux

Oussema Harbi (TUNISIA)

Message: 58607   


I am using  Linux version (root@sevens) (gcc version 4.1.1 (ADI 07R1)) #4 Thu Apr 5 17:34:01 CST 2007


Am using it ,because that's the newest version with a size less then 4Mo -My flash storage capacity-


It was not me who configured or compiled it ,and as config files are not provided with the kernels available for download )by the way that will be a great idea to put config files with kernels to download them -As configuration of that kernel/linux is not provided ,I couldnt really guess that No Flash devices were enabled - although i should have deduced that when i couldnt find my flash on /proc/mtd-.


Anyway ,I am looking for an image with a size of 3M or 2.5M :I tried to compile my own one ,but the size is everytime more then 4 M -even after compression.


YiLi ,the link you provided is talking about enabling these functions from the kernel configuration  "All utilities can be found in your vendor/user configuration menu"


What i am asking you is exactly : Is it possible to add the support for Flash operations -like erase ,write..- without recompiling the kernel ?


Thank you in advance.


PS :  :


this is the log from the kernel messages that may interrest you :


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

Blackfin mac net device registered

uclinux[mtd]: RAM probe address=0x3700000 size=0x800000

Creating 1 MTD partitions on "RAM":

0x00000000-0x00800000 : "ROMfs"

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

rtc-bfin rtc-bfin: rtc intf: sysfs

rtc-bfin rtc-bfin: rtc intf: proc

rtc-bfin rtc-bfin: rtc intf: dev (254:0)

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0




there is nothing about memory partitions before ,or after that





2008-07-10 06:26:34     Re: Erasing and Writing in Flash from uClinux

Hadi Boulfelfel (FRANCE)

Message: 58616   








If the problem comes from the svn version you are using, try to delete some useless applications when you build the Linux- This will reduce the images size less than 4MB (about 3.6MB).




2008-07-10 10:14:50     Re: Erasing and Writing in Flash from uClinux


Message: 58627   




The config files are in every uImage that we distribute. - kernel config is in /proc/config.gz and userspace config is in /root/config.gz


Boot the image - get the config files.






2008-07-10 13:35:59     Re: Erasing and Writing in Flash from uClinux

Oussema Harbi (TUNISIA)

Message: 58635   


ok ,but i posted that because in some image files ,these config files were missing.




2008-07-15 03:59:28     Re: Erasing and Writing in Flash from uClinux

Mike Frysinger (UNITED STATES)

Message: 58811   


older released versions did not contain all the same config files


if you dont see the flash listed in /proc/mtd then it means you dont have the drivers (or right ones) loaded (or configured)




2008-07-15 04:42:05     Re: Erasing and Writing in Flash from uClinux

Oussema Harbi (TUNISIA)

Message: 58838   


Thank you Mike Frysinger


I noticed that and tried to compile my own kernel including mtd and nand flash driver in it ,but everytime i compile it there is a different error thzt appears ,usch as :


bfin-uclinux-gcc -Wl,-elf2flt -mcpu=bf537-0.2 -o boa alias.o boa.o buffer.o cgi.o cgi_header.o config.o escape.o get.o hash.o ip.o log.o mmap_cache.o pipe.o queue.o range.o read.o request.o response.o signals.o util.o sublog.o select.o timestamp.o -lcrypt

make[4]: quittant le répertoire « /media/disk/oussema/uClinux-dist-2008R1-RC8-2/user/boa-new/src »

make[3]: quittant le répertoire « /media/disk/oussema/uClinux-dist-2008R1-RC8-2/user/boa-new »

make[2]: quittant le répertoire « /media/disk/oussema/uClinux-dist-2008R1-RC8-2/user »

make[1]: *** [all] Erreur 2

make[1]: quittant le répertoire « /media/disk/oussema/uClinux-dist-2008R1-RC8-2/user »

make: *** [subdirs] Erreur 1





So could you please give me a valid config file that works .




2008-07-15 04:51:39     Re: Erasing and Writing in Flash from uClinux

Mike Frysinger (UNITED STATES)

Message: 58839   


you didnt post the actual error.  if you want to quickly see the error message, run `make single`.


every distribution already comes with valid config files ... the default ones.