Cannot flash complete NAND in one go

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cannot flash complete NAND in one go

1,062 Views
henri_bragge
Contributor II

Hi,

I have a problem flashing NAND on MX53 (SABRE-AI). After I flash bootloader with kobs-ng and then the kernel right after, everything seems to go okay (readback from flash is correct), but after rebooting, I can see that kernel is corrupt (some bytes have flipped to 0xff). After re-writing kernel-only, then it will appear correct after reboot. Why cannot I write complete NAND in one go, is it even supposed to work? From the forums or application notes I didn't find anything concerning this problem.

Here are the commands I've been using:

# flash_erase /dev/mtd0 0 0

# kobs-ng init --chip_0_device_path=/dev/mtd0 uboot.bin

# flash_erase /dev/mtd1 0 0

# nandwrite -p /dev/mtd1 kernel.bin

I have verified the behavior with two different NAND models: MT29F2G08 and S34ML01G2. My kernel version is 2.6.35.3.

Labels (2)
0 Kudos
2 Replies

632 Views
BrilliantovKiri
Senior Contributor I

Hello, Henri!

Follow my work sequency for write Linux and U-Boot on NAND:

// U-Boot

TARGET=`grep bootloader /proc/mtd | cut -d ':' -f1`

echo "Write U-Boot on NAND /dev/$TARGET"

/root/flash_erase /dev/$TARGET 0 0

echo 1 > /sys/devices/platform/mxc_nandv2_flash.0/ignorebad

/root/kobs-ng init --chip_0_device_path=/dev/$TARGET $UBOOT

echo 0 > /sys/devices/platform/mxc_nandv2_flash.0/ignorebad

// Linux

TARGET=`grep -m 1 kernel /proc/mtd | cut -d ':' -f1`

echo "Write Linux on NAND /dev/$TARGET"

/root/flash_erase /dev/$TARGET 0 0

/root/nandwrite -mp /dev/$TARGET $LINUX

Hope this help you.

0 Kudos

632 Views
henri_bragge
Contributor II

Hi Kirill, thanks for your answer. The commands worked otherwise, but unfortunately didn't solve the problem. After reboot I still get errors like this when diffing hexdumps of the original file and NAND:

-00002fd0  03 00

+00002fd0  ff 00

-000037d0  00 09

+000037d0  ff 09

But your answer confirmed me that it should be possible and my commands are OK. There could be something wrong with my custom-built kernel or mtd-tools, I will probably try to rule that out next.

- Henri

0 Kudos