MINI2440のNAND FLASHのバックアップ2009年08月18日 20時41分02秒

DNWでNAND Flashバックアップ中

預っているMNI2440のNAND FLASHにはU-Bootが書き込まれているので、とりあえずNAND Flashのバックアップを実施します。 ドキュメントや各種ファイルは全てこちらにあります。

WindowsPCへのツールインストール

マニュアルによるとWindowsPCでUSB接続する必要があるようです。

必要なツールは以下。

NAND Flashのバックアップ

TeraTermを使ってPCとMINI2440をシリアル接続した上でさらにUSBケーブルでPCとMINI2440を接続して、NOR Flashで起動します。

TeraTermより「u」コマンドを入力してDNWで「Usb Port」→「Backup NandFlash to File」を選択します。

冒頭の写真がバックアップ中の状態です。

NAND Flashのパーティション

superviviのメニューで「x」を選択してNAND Flashのパーティションを確認します。というつもりだったけど、これはNAND Flashのパーティションを切りなおして初期化するみたいなので実行しちゃだめですね。

##### FriendlyARM BIOS for 2440 #####
[x] bon part 0 320k 2368k
[v] Download vivi
[k] Download linux kernel
[y] Download root_yaffs image
[c] Download root_cramfs image
[a] Absolute User Application
[n] Download Nboot
[e] Download Eboot
[i] Download WinCE NK.nb0
[w] Download WinCE NK.bin
[d] Download & Run
[z] Download zImage into RAM
[g] Boot linux from RAM
[f] Format the nand flash
[p] Partition for Linux
[b] Boot the system
[s] Set the boot parameters
[t] Print the TOC struct of wince
[u] Backup NAND Flash to HOST through USB(upload)
[r] Restore NAND Flash from HOST through USB
[q] Goto shell of vivi
Enter your selection: x
doing partition
size = 0
size = 327680
size = 2424832
check bad block
part = 0 end = 327680
part = 1 end = 2424832
part = 2 end = 67108864
part0:
        offset = 0
        size = 327680
        bad_block = 0
part1:
        offset = 327680
        size = 2097152
        bad_block = 0
part2:
        offset = 2424832
        size = 64667648
        bad_block = 0

MINI2440のNANDにvivi+linux2.6.29kernel+rootfsを書いて起動2009年08月18日 22時49分17秒

viviからのブート

NAND Flashのバックアップを採ったので安心して書き換えてみます。

イメージファイルのダウンロード

書き込むイメージのファイルは全てllinux-images.tgzに含まれます。

以下のファイルが必要です。

  • viviブートローダ(supervivi_mini2440)
  • linux 2.6.29 kernel(zImage_N35)
  • rootfs(root_qtopia.img)

イメージファイルをNAND Flashに書き込む

NAND Flashのバックアップを採ったときのようにNWDを起動してイメージを書き込みます。

  1. viviブートローダダウンロード(vコマンド)
  2. kernelイメージダウンロード(kコマンド)
  3. rootfsイメージダウンロード(yコマンド)
##### FriendlyARM BIOS for 2440 #####
[x] bon part 0 320k 2368k
[v] Download vivi
[k] Download linux kernel
[y] Download root_yaffs image
[c] Download root_cramfs image
[a] Absolute User Application
[n] Download Nboot
[e] Download Eboot
[i] Download WinCE NK.nb0
[w] Download WinCE NK.bin
[d] Download & Run
[z] Download zImage into RAM
[g] Boot linux from RAM
[f] Format the nand flash
[p] Partition for Linux
[b] Boot the system
[s] Set the boot parameters
[t] Print the TOC struct of wince
[u] Backup NAND Flash to HOST through USB(upload)
[r] Restore NAND Flash from HOST through USB
[q] Goto shell of vivi
Enter your selection: v
USB host is connected. Waiting a download.

Now, Downloading [ADDRESS:30000000h,TOTAL:127794]
RECEIVED FILE SIZE:  127794 (124KB/S, 1S)
Downloaded file at 0x30000000, size = 127784 bytes
Found block size = 0x00020000
Erasing...    ... done
Writing...    ... done
Written 127784 bytes

##### FriendlyARM BIOS for 2440 #####
[x] bon part 0 320k 2368k
[v] Download vivi
[k] Download linux kernel
[y] Download root_yaffs image
[c] Download root_cramfs image
[a] Absolute User Application
[n] Download Nboot
[e] Download Eboot
[i] Download WinCE NK.nb0
[w] Download WinCE NK.bin
[d] Download & Run
[z] Download zImage into RAM
[g] Boot linux from RAM
[f] Format the nand flash
[p] Partition for Linux
[b] Boot the system
[s] Set the boot parameters
[t] Print the TOC struct of wince
[u] Backup NAND Flash to HOST through USB(upload)
[r] Restore NAND Flash from HOST through USB
[q] Goto shell of vivi
Enter your selection: k
USB host is connected. Waiting a download.

Now, Downloading [ADDRESS:30000000h,TOTAL:2022358]
RECEIVED FILE SIZE: 2022358 (493KB/S, 4S)
Downloaded file at 0x30000000, size = 2022348 bytes
Found block size = 0x001f0000
Erasing...    ... done
Writing...    ... done
Written 2022348 bytes

##### FriendlyARM BIOS for 2440 #####
[x] bon part 0 320k 2368k
[v] Download vivi
[k] Download linux kernel
[y] Download root_yaffs image
[c] Download root_cramfs image
[a] Absolute User Application
[n] Download Nboot
[e] Download Eboot
[i] Download WinCE NK.nb0
[w] Download WinCE NK.bin
[d] Download & Run
[z] Download zImage into RAM
[g] Boot linux from RAM
[f] Format the nand flash
[p] Partition for Linux
[b] Boot the system
[s] Set the boot parameters
[t] Print the TOC struct of wince
[u] Backup NAND Flash to HOST through USB(upload)
[r] Restore NAND Flash from HOST through USB
[q] Goto shell of vivi
Enter your selection: y
USB host is connected. Waiting a download.

Now, Downloading [ADDRESS:30000000h,TOTAL:51244522]
Downloaded file at 0x30000000, size = 51244512 bytes
Flash params: oobsize = 16, oobblock = 512, erasesize = 16384, partition size = 64667648
Erasing and programming NAND with yaffs image
 Block erasing(addr/count) --- Block bad(addr/count) --- Block processed/All(%)
--------------------------------------------------------------------------------
     0x03ff8000/03947            0x00000000/00000           03947/03947=100%
Load yaffs OK:
Blocks scanned: 3947, Blocks erased: 3947, Blocks are bad: 0
RECEIVED and Writed FILE SIZE:51244522 (454KB/S, 110S)

viviからのLinux起動

スイッチをNAND Flashブートモードに切り替えて起動させます。

VIVI version 0.1.4 (root@russell-work-pc) (gcc version 2.95.3 20010315 (release)) #0.1.4 Tue Jun 16 15:20:37 CST 2009
MMU table base address = 0x33DFC000
Succeed memory mapping.
DIVN_UPLL0
MPLLVal [M:7fh,P:2h,S:1h]
CLKDIVN:5h


+---------------------------------------------+
| S3C2440A USB Downloader ver R0.03 2004 Jan  |
+---------------------------------------------+
USB: IN_ENDPOINT:1 OUT_ENDPOINT:3
FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>
NOTE: Power off/on or press the reset button for 1 sec
      in order to get a valid USB device address.

NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)
Could not found stored vivi parameters. Use default vivi parameters.
Press Return to start the LINUX/Wince now, any other key for vivi
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
MACH_TYPE = 782
NOW, Booting Linux......
Uncompressing Linux.................................................................................................................................. done, booting the kernel.
Linux version 2.6.29.4-FriendlyARM (root@russell-work-pc) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #2 Tue Jun 9 16:26:18 CST 2009
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: FriendlyARM Mini2440 development board
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60608KB available (3724K code, 407K data, 128K init)
SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 296 bytes
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Using static regulatory domain info
cfg80211: Regulatory domain: US
        (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
        (2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
        (5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
        (5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
        (5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
        (5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
        (5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
cfg80211: Calling CRDA for country: US
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
yaffs Jun  9 2009 16:05:22 Installing.
msgmni has been set to 118
alg: No test for stdrng (krng)
io scheduler noop registered (default)
Console: switching to colour frame buffer device 30x20
fb0: s3c2410fb frame buffer device
backlight       initialized
leds    initialized
buttons initialized
pwm     initialized
adc     initialized
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
loop: module loaded
dm9000 Ethernet Driver, V1.31
Now use the default MAC address: 08:90:90:90:90:90
eth0 (dm9000): not using net_device_ops yet
eth0: dm9000e at c4810000,c4814004 IRQ 51 MAC: 08:90:90:90:90:90 (friendly-arm)
usbcore: registered new interface driver rt73usb
Linux video capture interface: v2.00
gspca: main v2.4.0 registered
usbcore: registered new interface driver conex
conex: registered
usbcore: registered new interface driver etoms
etoms: registered
usbcore: registered new interface driver finepix
finepix: registered
usbcore: registered new interface driver mars
mars: registered
usbcore: registered new interface driver ov519
ov519: registered
usbcore: registered new interface driver ov534
ov534: registered
usbcore: registered new interface driver pac207
pac207: registered
usbcore: registered new interface driver pac7311
pac7311: registered
usbcore: registered new interface driver sonixb
sonixb: registered
usbcore: registered new interface driver sonixj
sonixj: registered
usbcore: registered new interface driver spca500
spca500: registered
usbcore: registered new interface driver spca501
spca501: registered
usbcore: registered new interface driver spca505
spca505: registered
usbcore: registered new interface driver spca506
spca506: registered
usbcore: registered new interface driver spca508
spca508: registered
usbcore: registered new interface driver spca561
spca561: registered
usbcore: registered new interface driver sunplus
sunplus: registered
usbcore: registered new interface driver stk014
stk014: registered
usbcore: registered new interface driver t613
t613: registered
usbcore: registered new interface driver tv8532
tv8532: registered
usbcore: registered new interface driver vc032x
vc032x: registered
usbcore: registered new interface driver zc3xx
zc3xx: registered
usbcore: registered new interface driver ALi m5602
ALi m5602: registered
usbcore: registered new interface driver STV06xx
STV06xx: registered
usbcore: registered new interface driver uvcvideo
USB Video Class driver (v0.1.0)
initializing s3c2440 camera interface......
s3c2440 camif init done
Loading OV9650 driver.........
SCCB address 0x60, manufacture ID 0xFFFF, expect 0x7FA2
SCCB address 0x60, manufacture ID 0xFFFF, expect 0x7FA2
No OV9650 found!!!
Driver 'sd' needs updating - please use bus_type methods
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 3 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x000000000000-0x000000030000 : "supervivi"
0x000000050000-0x000000250000 : "Kernel"
0x000000250000-0x000003ffc000 : "root"
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: S3C24XX OHCI
usb usb1: Manufacturer: Linux 2.6.29.4-FriendlyARM ohci_hcd
usb usb1: SerialNumber: s3c24xx
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver usbserial
usbserial: USB Serial Driver core
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
mice: PS/2 mouse device common for all mice
s3c2410 TouchScreen successfully loaded
input: s3c2410 TouchScreen as /devices/virtual/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
mapped channel 0 to 0
s3c2440-sdi s3c2440-sdi: powered down.
s3c2440-sdi s3c2440-sdi: initialisation done.
s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c2440-sdi s3c2440-sdi: powered down.
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.18a.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
  #0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
lib80211: common routines for IEEE802.11 drivers
s3c2410-rtc s3c2410-rtc: setting system clock to 2009-08-18 13:37:53 UTC (1250602673)
FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 128K
[18/Aug/2009:05:38:00 +0000] boa: server version Boa/0.94.13
[18/Aug/2009:05:38:00 +0000] boa: server built Mar 26 2009 at 15:28:42.
[18/Aug/2009:05:38:00 +0000] boa: starting server pid=498, port 80

Try to bring eth0 interface up......eth0: link down
Done

Please press Enter to activate this console.

USBメモリを挿してみる

以下のように平気に認識します。

[root@FriendlyARM /]# usb 1-1: new full speed USB device using s3c2410-ohci and address 2
usb 1-1: New USB device found, idVendor=090c, idProduct=1000
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: Memorette UFD
usb 1-1: Manufacturer: MWR UFD
usb 1-1: SerialNumber: MWR0901143200176
usb 1-1: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
scsi 0:0:0:0: Direct-Access     MWR UFD  Memorette UFD    1100 PQ: 0 ANSI: 0 CCS
sd 0:0:0:0: [sda] 7831552 512-byte hardware sectors: (4.00 GB/3.73 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] 7831552 512-byte hardware sectors: (4.00 GB/3.73 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!

[root@FriendlyARM /]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                63152     48644     14508  77% /
tmpfs                    30400         0     30400   0% /dev/shm
/dev/udisk             3908100   2908448    999652  74% /udisk
[root@FriendlyARM /]#

ファイルシステムの概要

この状態でのファイルシステムの概要はこちらです。 これはUSBメモリをマウントした上でdfコマンドとlsコマンドで出力したものです。