Difference between revisions of "Didj U-Boot NAND Flashing"

From eLinux.org
Jump to: navigation, search
Line 62: Line 62:
  
 
== Kernel ==
 
== Kernel ==
 +
 +
From the bootloader screen, chose Load uboot from SD
  
 
Initialize SD capabilities.
 
Initialize SD capabilities.
Line 84: Line 86:
 
0x01200000 Kernel1 Start location
 
0x01200000 Kernel1 Start location
  
0xE00000 Length of Kernel space
+
0x200000 Length of Kernel space
  
  LF1000 # nand erase 200000 E00000
+
  LF1000 # nand erase 200000 200000
  NAND erase: device 0 offset 0x00200000, size 0xE00000
+
  NAND erase: device 0 offset 0x00200000, size 0x200000
 
  Erasing at 0x00200000 -- 800% complete.
 
  Erasing at 0x00200000 -- 800% complete.
 
  OK
 
  OK
Line 97: Line 99:
  
 
  LF1000 # nand write 1400000 0x00200000 140000
 
  LF1000 # nand write 1400000 0x00200000 140000
  NAND write: device 0 offset 0x0, size 0x140000
+
  NAND write: device 0 offset 0x00200000, size 0x140000
 
  1310720 bytes written: OK
 
  1310720 bytes written: OK
  
Line 105: Line 107:
 
== File System ==
 
== File System ==
  
Initialize SD capabilities.
+
Initialize SD capabilities. (Skip this step if you did not reboot after writing the kernels)
  
 
  LF1000# mmcinit
 
  LF1000# mmcinit
 
  SD ver 2.0  
 
  SD ver 2.0  
  SD found : Size = 3866624 KBytes  
+
  SD found : Size = 7077888 KBytes  
  
  
Load kernel.bin into memory at address 0x1400000 and write down how many bytes read.
+
Load erootfs.jffs2 into memory at address 0x1400000 and write down how many bytes read.
  
  LF1000# fatload mmc 0 1400000 kernel.bin
+
  LF1000# fatload mmc 0 1400000 erootfs.jffs2
  reading kernel.bin
+
  reading erootfs.jffs2
 
  Why block_cnt == 0??  
 
  Why block_cnt == 0??  
  1310720 bytes read  <== *Write this number down*
+
  7077888 bytes read  <== *Write this number down*
  
  
 
Erase the area you plan to write to "nand erase <location> <length>"
 
Erase the area you plan to write to "nand erase <location> <length>"
  
0x00200000 Kernel0 Start location
+
0x00400000 Linux_RFS0 Start location
  
0x01200000 Kernel1 Start location
+
0x01400000 Linux_RFS1 Start location
  
 
0xE00000 Length of Kernel space
 
0xE00000 Length of Kernel space
  
  LF1000 # nand erase 200000 E00000
+
  LF1000 # nand erase 400000 E00000
  NAND erase: device 0 offset 0x00200000, size 0xE00000
+
  NAND erase: device 0 offset 0x00400000, size 0xE00000
  Erasing at 0x00200000 -- 800% complete.
+
  Erasing at 0x00400000 -- 800% complete.
 
  OK
 
  OK
  
Line 136: Line 138:
 
Write from RAM to NAND "nand write <from> <to> <length>"  
 
Write from RAM to NAND "nand write <from> <to> <length>"  
  
the length is the hex value of the number you wrote down earlier, in this case 1310720, the easiest way is to open up your calculator into scientific mode, make sure its set to decimal, and enter the number, then switch it over to hex, it'll convert the number automatically.
+
the length is the hex value of the number you wrote down earlier, in this case 7077888, the easiest way is to open up your calculator into scientific mode, make sure its set to decimal, and enter the number, then switch it over to hex, it'll convert the number automatically.
  
  LF1000 # nand write 1400000 0x00200000 140000
+
  LF1000 # nand write 1400000 0x00400000 6C0000
  NAND write: device 0 offset 0x0, size 0x140000
+
  NAND write: device 0 offset 0x00400000, size 0x6C0000
  1310720 bytes written: OK
+
  7077888 bytes written: OK

Revision as of 22:59, 28 April 2010

This is a tutorial on how to recover your Didj from absolute failure. It will take a Didj whose NAND has been completely erased, and bring it back to fully functional. Though there is one issue, Bad Blocks, which may get in the way of recovery. I don't recommend doing a full erase of your NAND as this will erase the Bad Blocks set by the factory. TODO: Investigate more about Bad Block and how uboot deals with them.

Programs Needed

Terminal Program (Hyperterminal or equivalent) set to 115200 8/n/1

Hardware Needed

Didj cartridge breakout with SD capabilities (DJHI 2.8 or equivalent) SD Card SD Card Reader/Writer

Files Needed

uboot.bin with SD capabilities [1] lighting-boot.bin (jburks' version 1.4 recommended from above link) kernel.bin (Either from LFP Package or a known working version) erootfs.bin (Either from LFP Package or a known working version)

Getting Started

Connect you're SD Card Reader/Writer to your computer, and plug in the SD Card.

Gather the Files Needed and transfer them to the main directory of the SD Card, they can not be in a folder.

Eject your SD Card and put it into your Didj SD Card adapter.

You are now going to need to load a bootloader over UART Linux/Windows but stop at uboot, also read this tutorial for information on the different bootloader 1.4 variants, you'll need both UART and NAND versions, UART to get started, and NAND to install.

Once at the uboot prompt, we can start writing the files to the Didj.

Lightning Boot

Initialize SD capabilities.

LF1000# mmcinit
SD ver 2.0 
SD found : Size = 3866624 KBytes 


Load lighting boot into memory at address 0x1800000

LF1000# fatload mmc 0 1800000 lightning-boot.bin
reading lightning-boot.bin
Why block_cnt == 0?? 
16384 bytes read


Erase the area you plan to write to "nand erase <location> <length>"

LF1000 # nand erase 0 4000
NAND erase: device 0 offset 0x0, size 0x4000
Erasing at 0x0 -- 800% complete.
OK


Write from RAM to NAND "nand write <from> <to> <length>"

LF1000 # nand write 1800000 0 4000
NAND write: device 0 offset 0x0, size 0x4000
16384 bytes written: OK


lightning-boot.bin v1.4 should now be on your Didj. Turn it off, and back on, and you should see the blue screen with menu choices come up and we can move on to installing the kernel. If not, double check your numbers, its easy to put in an extra 0 or leave one out.

Kernel

From the bootloader screen, chose Load uboot from SD

Initialize SD capabilities.

LF1000# mmcinit
SD ver 2.0 
SD found : Size = 3866624 KBytes 


Load kernel.bin into memory at address 0x1400000 and write down how many bytes read.

LF1000# fatload mmc 0 1400000 kernel.bin
reading kernel.bin
Why block_cnt == 0?? 
1310720 bytes read  <== *Write this number down*


Erase the area you plan to write to "nand erase <location> <length>"

0x00200000 Kernel0 Start location

0x01200000 Kernel1 Start location

0x200000 Length of Kernel space

LF1000 # nand erase 200000 200000
NAND erase: device 0 offset 0x00200000, size 0x200000
Erasing at 0x00200000 -- 800% complete.
OK


Write from RAM to NAND "nand write <from> <to> <length>"

the length is the hex value of the number you wrote down earlier, in this case 1310720, the easiest way is to open up your calculator into scientific mode, make sure its set to decimal, and enter the number, then switch it over to hex, it'll convert the number automatically.

LF1000 # nand write 1400000 0x00200000 140000
NAND write: device 0 offset 0x00200000, size 0x140000
1310720 bytes written: OK


If you want, repeat nand erase, and nand write, but for Kernel1.

File System

Initialize SD capabilities. (Skip this step if you did not reboot after writing the kernels)

LF1000# mmcinit
SD ver 2.0 
SD found : Size = 7077888 KBytes 


Load erootfs.jffs2 into memory at address 0x1400000 and write down how many bytes read.

LF1000# fatload mmc 0 1400000 erootfs.jffs2
reading erootfs.jffs2
Why block_cnt == 0?? 
7077888 bytes read  <== *Write this number down*


Erase the area you plan to write to "nand erase <location> <length>"

0x00400000 Linux_RFS0 Start location

0x01400000 Linux_RFS1 Start location

0xE00000 Length of Kernel space

LF1000 # nand erase 400000 E00000
NAND erase: device 0 offset 0x00400000, size 0xE00000
Erasing at 0x00400000 -- 800% complete.
OK


Write from RAM to NAND "nand write <from> <to> <length>"

the length is the hex value of the number you wrote down earlier, in this case 7077888, the easiest way is to open up your calculator into scientific mode, make sure its set to decimal, and enter the number, then switch it over to hex, it'll convert the number automatically.

LF1000 # nand write 1400000 0x00400000 6C0000
NAND write: device 0 offset 0x00400000, size 0x6C0000
7077888 bytes written: OK