Micro2440 Instructions for U-Boot and Linux
We are going to replace all contents of the NAND flash - so make sure to have a backup if there is any valuable data on your device.
What we need
- Micro2440 SDK
- Linux PC (Windows would work as well but I'm not sure how to upload files to Vivi with it.)
- SD/MMC card
- Serial cable
- USB cable or JTAG (to replace vivi)
Replacing the Bootloader
We are going to copy u-boot into the RAM of the board and execute it there. u-boot will provide us all necessary features to prepare nand flash and copy itself there.
##### FriendlyARM BIOS for 2440 ##### [x] bon part 0 320k 2368k [v] Download vivi ...
Supervivi> load ram 0x31000000 239016 u USB host is connected. Waiting a download.
$ sudo ./s3c2410_boot_usb u-boot.bin
Now, Downloading [ADDRESS:31000000h,TOTAL:239026] RECEIVED FILE SIZE: 239026 (116KB/S, 2S) Downloaded file at 0x31000000, size = 239016 bytes
go 0x31000000
U-Boot 1.3.2-dirty-moko12 (Apr 16 2009 - 18:14:52) I2C: ready DRAM: 64 MB Flash: 2 MB NAND: Bad block table not found for chip 0 Bad block table not found for chip 0 64 MiB *** Warning - bad CRC or NAND, using default environment USB: S3C2410 USB Deviced In: serial Out: serial Err: serial MAC: 08:08:11:18:12:27 Hit any key to stop autoboot: 0
MINI2440 # nand scrub
NAND scrub: device 0 whole chip Warning: scrub option will erase all factory set bad blocks! There is no reliable way to recover them. Use this command only for testing purposes if you are sure of what you are doing! Really scrub this NAND flash? <y/N> Erasing at 0x3ffc000 -- 100% complete. Bad block table not found for chip 0 Bad block table not found for chip 0 OK
MINI2440 # nand createbbt
Create BBT and erase everything ? <y/N> Skipping bad block at 0x03ff0000 Skipping bad block at 0x03ff4000 Skipping bad block at 0x03ff8000 Skipping bad block at 0x03ffc000 Creating BBT. Please wait ...
MINI2440 # nand write 0x31000000 u-boot
NAND write: device 0 offset 0x0, size 0x40000 262144 bytes written: OK
Return the boot selection switch to the NAND setting and try your new installed u-boot. Right after reset the u-boot console should appear again.
Working with U-Boot
MINI2440 # dynenv set 40000
At the u-boot prompt enter the following commands
MINI2440 # nand erase kernel MINI2440 # mmcinit MINI2440 # fatload mmc 0:1 0x31000000 uImage MINI2440 # nand write 0x31000000 kernel
The 'filesize' environment variable holds the size of the last file read by the fatload command. Because its padded to a erase block boundary we can use this knowledge to deal with root filesystems of multiple size easily.
MINI2440 # nand erase root MINI2440 # mmcinit MINI2440 # fatload mmc 0:1 0x31000000 gpe-image-micro2440.jffs2 MINI2440 # nand write.jffs2 0x31000000 root ${filesize}
MINI2440 # setenv bootcmd nboot.e kernel \; bootm MINI2440 # saveenv
MINI2440 # setenv bootargs root=/dev/mtdblock3 rootfstype=jffs2 console=ttySAC0, 115200 mini2440=1tb
MINI2440 # reset
Some additional information
U-Boot partition layout
nr name size offset 0 u-boot 0x00040000 0x00000000 1 env 0x00020000 0x00040000 2 kernel 0x00500000 0x00060000 3 root 0x03aa0000 0x00560000
OpenOCD configuration
interface parport parport_port 0x378 parport_cable triton jtag_speed 0 source [find target/samsung_s3c2440.cfg] telnet_port 4444 gdb_port 3333 reset_config trst_and_srst
Bootstrapping without a working bootloader
You will need the JTAG cable, OpenOCD 1.x and the lowlevel_foo.bin image included in the support kit.
Reset the CPU and let it wait
> reset halt
> load_image /path/to/lowlevel_foo.bin 0 downloaded 332 byte in 0s 21899us
> bp 0x33f80000 4 hw breakpoint added at address 0x33f80000
> resume Target 0 resumed > Target 0 halted target halted in ARM state due to breakpoint, current mode: Supervisor cpsr: 0x600000d3 pc: 0x33f80000 MMU: disabled, D-Cache: disabled, I-Cache: enabled
> load_image /path/to/u-boot.bin 0x33f80000
resume
Write the u-boot binary to the "u-boot" partition now. (Same commands like for the kernel, but
use the existing address 0x33f80000 and "u-boot" for the partition name.
References
[2] OpenMoko Wiki: http://wiki.openmoko.org/wiki/Bootloader#Using_JTAG_to_boot_from_RAM
[3] Mini Bringup Guide: http://code.google.com/p/mini2440/wiki/MiniBringup
[4] mini2440 screencast: http://www.youtube.com/watch?v=oi66srITOcA

RamyaRagavi 29p · 292 weeks ago
MSBI Online Training | MSBI Training Course
web browser · 292 weeks ago