Day: December 16, 2012

Mapping Flash partition from command line

Yesterday we saw how to map the NOR flash of VStarcam H6837WI camera.

Now we need to create the partitions to it.

We know from original linux kernel log it has 5 partitions:

[ 0.870000] Creating 5 MTD partitions on "NOR flash on ipcam":
[ 0.870000] 0x000000000000-0x000000030000 : "ARMboot"
[ 0.880000] 0x000000030000-0x0000001a0000 : "Kernel"
[ 0.890000] 0x0000001a0000-0x0000005a0000 : "RootFS"
[ 0.900000] 0x0000005a0000-0x0000007f0000 : "IpcamFS"
[ 0.910000] 0x0000007f0000-0x000000800000 : "param"

Then I need to pass this mtdparts to Linux kernel command line:

mtdparts=physmap-flash.0:192k(ARMboot)ro,1472k(Kernel),4096k(RootFS),2368k(IpcamFS),-(param)

This is my complete bootargs line:

bootargs=mtdparts=physmap-flash.0:192k(ARMboot)ro,1472k(Kernel),4096k(RootFS),2368k(IpcamFS),-(param) mem=20M console=ttyS0,115200n8 init=/sbin/init root=/dev/mtdblock2

Excellent, it can boots to camera Linux file system:

$ bootm

 Starting kernel ...

Uncompressing Linux............................................................................................. done, booting the kern
el.
[    0.000000] Linux version 2.6.24ssl (alan@aureo) (gcc version 3.4.6) #1 PREEMPT Sat Dec 15 16:13:03 BRST 2012
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[    0.000000] Machine: Solomon Magus Accio P1
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] CPU0: D VIVT write-back cache
[    0.000000] CPU0: I cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
[    0.000000] CPU0: D cache: 8192 bytes, associativity 4, 32 byte lines, 64 sets
[    0.000000] Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 5080
[    0.000000] Kernel command line: mtdparts=physmap-flash.0:192k(ARMboot)ro,1472k(Kernel),4096k(RootFS),2368k(IpcamFS),-(param) mem=20
M console=ttyS0,115200n8 init=/sbin/init root=/dev/mtdblock2
[    0.000000] intc: init info - ver=1,0
[    0.000000] gpio: init info - ver=1,0 
[    0.000000] clock: init info - ver=1,0 
[    0.000000] MAGUS Clocks : ARM-240.000 MHz, HCLK-120.000 MHz, PCLK-60.000 MHz, PERCLK1-60.000 MHz, PERCLK2-24.000 MHz
[    0.000000] PID hash table entries: 128 (order: 7, 512 bytes)
[    0.000000] Console: colour dummy device 80x30
[    0.000000] console [ttyS0] enabled
[    0.010000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.020000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.030000] Memory: 20MB = 20MB total
[    0.040000] Memory: 17280KB available (2680K code, 219K data, 72K init)
[    0.270000] Mount-cache hash table entries: 512
[    0.270000] CPU: Testing write buffer coherency: ok
[    0.290000] net_namespace: 64 bytes
[    0.300000] NET: Registered protocol family 16
[    0.330000] dma: init info - ver 1.0 fifosize=128, 8 channels
[    0.330000] MAGUS cpu freq change driver v1.0
[    0.340000] 
[    0.340000] cpufreq: magus_set_target: request for target_freq = 240000 KHz
[    0.350000] cpufreq: magus_set_target: cur_pll_out = 240000 KHz, cur_arm_freq = 240000 KHz
[    0.380000] SCSI subsystem initialized
[    0.390000] usbcore: registered new interface driver usbfs
[    0.400000] usbcore: registered new interface driver hub
[    0.400000] usbcore: registered new device driver usb
[    0.470000] NET: Registered protocol family 2
[    0.570000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.580000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.590000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.590000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.600000] TCP reno registered
[    0.630000] Power Management for MAGUS. V0.1.1
[    0.630000] NetWinder Floating Point Emulator V0.97 (extended precision)
[    0.650000] JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
[    0.660000] io scheduler noop registered
[    0.660000] io scheduler deadline registered (default)
[    0.690000] Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
[    0.700000] ttyS0: autoconf (0x0000, 0xf000300c): uart: id=7000041
[    0.700000] type=16550A
[    0.710000] serial8250: ttyS0 at MMIO 0x0 (irq = 16) is a 16550A
[    0.710000] ttyS1: autoconf (0x0000, 0xf000400c): uart: id=7000041
[    0.720000] type=16550A
[    0.720000] serial8250: ttyS1 at MMIO 0x0 (irq = 17) is a 16550A
[    0.730000] Driver 'sd' needs updating - please use bus_type methods
[    0.740000] Driver 'sr' needs updating - please use bus_type methods
[    0.750000] physmap platform flash device: 00800000 at 10000000
[    0.760000] physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
[    0.770000]  Amd/Fujitsu Extended Query Table at 0x0040
[    0.770000] number of CFI chips: 1
[    0.770000] cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
[    0.780000] 5 cmdlinepart partitions found on MTD device physmap-flash.0
[    0.790000] Creating 5 MTD partitions on "physmap-flash.0":
[    0.800000] 0x00000000-0x00030000 : "ARMboot"
[    0.800000] 0x00030000-0x001a0000 : "Kernel"
[    0.810000] 0x001a0000-0x005a0000 : "RootFS"
[    0.820000] 0x005a0000-0x007f0000 : "IpcamFS"
[    0.830000] 0x007f0000-0x00800000 : "param"
[    0.840000] spi: init info - ver=1.0 fifo=16 slaves=5 master=1
[    0.850000] spi: init info - ver=1.0 fifo=16 slaves=5 master=1
[    0.970000] ehci ehci: ssl ehci
[    0.970000] ehci ehci: new USB bus registered, assigned bus number 1
[    0.980000] ehci ehci: irq 14, io mem 0x08403000
[    1.000000] ehci ehci: USB 0.0 started, EHCI 1.00, driver 10 Dec 2004
[    1.010000] usb usb1: configuration #1 chosen from 1 choice
[    1.010000] hub 1-0:1.0: USB hub found
[    1.020000] hub 1-0:1.0: 1 port detected
[    1.130000] usb usb1: Product: ssl ehci
[    1.130000] usb usb1: Manufacturer: Linux 2.6.24ssl ssl ehci
[    1.140000] usb usb1: SerialNumber: ssl_ehci
[    1.140000] Initializing USB Mass Storage driver...
[    1.370000] CI reset done
[    1.430000] usb 1-1: new high speed USB device using ehci and address 2
[    1.550000] CI reset done
[    1.660000] usb 1-1: configuration #1 chosen from 1 choice
[    1.680000] usb 1-1: Product: 802.11 n WLAN
[    1.680000] usb 1-1: Manufacturer: Ralink
[    1.690000] usb 1-1: SerialNumber: 1.0
[    1.690000] usbcore: registered new interface driver usb-storage
[    1.700000] USB Mass Storage support registered.
[    1.710000] usbcore: registered new interface driver libusual
[    1.710000] i2c /dev entries driver
[    1.720000] i2c: init info - ver=1,0
[    1.730000] 
[    1.730000] cpufreq: magus_set_target: request for target_freq = 240000 KHz
[    1.740000] cpufreq: magus_set_target: cur_pll_out = 240000 KHz, cur_arm_freq = 240000 KHz
[    1.750000] TCP cubic registered
[    1.750000] NET: Registered protocol family 1
[    1.760000] NET: Registered protocol family 17
[    1.770000] VFS: Can't find an ext2 filesystem on dev mtdblock2.
[    1.780000] VFS: Mounted root (cramfs filesystem) readonly.
[    1.790000] Freeing init memory: 72K
/usr/bin/sdupdate: error while loading shared libraries: libgpioctrl.so: cannot open shared object file: No such file or directory
[    4.240000] jffs2: Too few erase blocks (1)
mount: mounting /dev/mtdblock4 on /mnt failed: Invalid argument
/etc/init.d/rcS: line 132: /mnt/init/ipcam.sh: not found
/ #