LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices

Reply
 
Search this Thread
Old 07-25-2011, 12:14 PM   #1
lucasct
LQ Newbie
 
Registered: Jul 2011
Posts: 6

Rep: Reputation: Disabled
Unhappy Changing Filesystem and Kernel - Problem with Bad Blocks NandFlash


Hi people, I have reprogramed sucessfully the filesystem and kernel in some units runing linux from nand flash with an aditional SD card and using the DD command and mtd-utils, but in others the filesystem does not start or have corrupted libraries, checking this units i have found bad blocks in the problematic units.

I have 3 partitions:
- Boot(2MB): containing bootstrap, uboot enviroment
- Kernel(2MB): containing kernel.
- Filesystem(250MB): containing the root filesystem
- Backup (2MB): an extra empty partition

1) My process to reprogram the filesystem and kernel at once start reprograming a "mini filesystem" with mtd-utils and busybox (1,5MB) into the "Backup partition" using the DD command, change the uboot enviroment to boot loading the "Backup partition" as root filesystem and rebooting.

Code:
$ flash_eraseall /dev/mtd3
$ dd if=/mnt/minifs of=/dev/mtdblock3 bs=128k conv=noerror,notrunc
$ dd if=/mnt/backup_filesystem_enviroment of=/dev/mtdblock0 seek=3 bs=128k conv=sync
$ reboot
2) When this "mini filesystem" starts it mount the SD card, then erase the "Filesystem partition" and copy the "new filesystem" using the DD command, then erase the "Kernel Partion" and copy the new kernel there and change the uboot enviromet to boot using the "Filesystem Partition"

Code:
$ flash_eraseall /dev/mtd2 > /dev/null
$ dd if=/mnt/newfs of=/dev/mtdblock2 bs=128k conv=noerror,notrunc
$ dd if=/mnt/ubootenv of=/dev/mtdblock0 seek=3 bs=128k conv=sync

$ flash_eraseall /dev/mtd1 > /dev/null
$ dd if=/mnt/newknernel of=/dev/mtdblock1 bs=128k conv=sync
This proces Works perfectly with flawless Nand Flash. But when it have Bad Blocks the root filesystem is mounted with some errors inside or some times cant be mounted.
I was using just conv=sync parameter of DD command, then i have tried conv=noerror but it only avoid read errors.

I have tried using nandwrite command, witch should avoid bad blocks writing, with -p (padding) option but it damage the file sytem.

Somebody knows a better way to do this process avoiding the badblocks writing the filesystem?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filesystem Corruption Possibly Caused By Bad Blocks kbranch Linux - General 5 11-07-2010 04:46 PM
problem bad-blocks to install emamarro Linux - Hardware 1 04-12-2007 01:29 AM
Startup Problem, "Bad Blocks" ncrown23334 Linux - Software 3 07-01-2006 10:45 PM
problem in getting free data blocks in filesystem udayan Programming 4 07-07-2002 02:03 AM


All times are GMT -5. The time now is 03:46 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration