flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 04:06PM
Hello. I have another Pogoplug V4 that I bought used and that doesn't boot, so I was going to install your uboot & openwrt.

I was able to get to the CE boot loader from a serial console, then loaded openwrt via tftp and booted it. I'm now logged in to openwrt, but I'm trying to figure out how to do flash_erase, nandwrite and nanddump. Not finding those utilities on openwrt. I tried downloading the executables for those that I've used on other Pogos under the original Pogo OS, but I get "not found" when I try to run them, so assuming there is a missing dynamic library that they use.

Is there a different version of those utilities somewhere I can install or download?

I do see a "mtd" command. Is this what I should use instead?

Any help/suggestions appreciated.

Ralph
Re: flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 04:57PM
I think I found what I need - nand-utils package. I installed it, but I'm getting permission denied error:

Quote

root@OpenWrt:/tmp# flash_erase /dev/mtd0 0 4
flash_erase: error!: /dev/mtd0
error 13 (Permission denied)
root@OpenWrt:/tmp# ls -l /dev/mtd0
crw------- 1 root root 90, 0 Jan 1 1970 /dev/mtd0
root@OpenWrt:/tmp#

This is what current mtd partitions look like:

Quote

root@OpenWrt:/tmp# cat /proc/mtd
dev: size erasesize name
mtd0: 001c0000 00020000 "uboot"
mtd1: 00040000 00020000 "uboot_env"
mtd2: 07e00000 00020000 "ubi"

and I set /etc/fw_env.config to this

Quote

root@OpenWrt:/tmp# cat /etc/fw_env.config
/dev/mtd1 0x0000 0x40000 0x20000

but apparently that's not right because fw_printenv isn't happy

Quote

root@OpenWrt:/tmp# fw_printenv
Warning: Bad CRC, using default environment
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=5
baudrate=115200


rsantag



Edited 2 time(s). Last edit at 11/03/2020 05:14PM by rsantag.
Re: flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 05:02PM
is it marked read-only in your device tree?
Re: flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 05:20PM
How do I see my device tree? Just ls -l /dev/mtd0, or something else?



Edited 1 time(s). Last edit at 11/03/2020 05:22PM by rsantag.
Re: flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 05:33PM
Ralph,


> This is what current mtd partitions look like:
>
>
Quote

root@OpenWrt:/tmp# cat /proc/mtd
> dev: size erasesize name
> mtd0: 001c0000 00020000 "uboot"
> mtd1: 00040000 00020000 "uboot_env"
> mtd2: 07e00000 00020000 "ubi"
>
> and I set /etc/fw_env.config to this
>
>
Quote

root@OpenWrt:/tmp# cat /etc/fw_env.config
> /dev/mtd1 0x0000 0x40000 0x20000
>
> but apparently that's not right because
> fw_printenv isn't happy

Because you've flashed my u-boot image, the envs area must be:

/etc/fw_env.config
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000

And since OpenWrt embedded the DTB in uImage, it is read-only. So you need to set mtdparts in bootargs to make it writeable. If not sure, please post the entire serial bootlog with a listing of envs in serial console,

printenv

and I'll guide you how to do that.

OTOH, if you are running stock u-boot, then the envs are at a different location.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 3 time(s). Last edit at 11/03/2020 05:37PM by bodhi.
Re: flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 06:46PM
Hi Bodhi. I haven't actually flashed your u-boot yet. I was trying to do the flash_erase so I could do that.

I'm assuming it's running the Cloud Engines uboot because uboot prompt is "CE>". But not sure everything on this device is still stock - I bought it used and when I got it it wouldn't boot to the original OS. And notice /proc/mtd doesn't look normal, at least not what I've seen on other Pogos.

So I was thinking if I did flash_erase, then nandwrite for your u-boot and environment images, and then set fw_env.config to what you have above, I should be able to set the rest of my environment variables, including mtdparts and partition so there are just 2 mtd partitions. Then set netconsole variables, reboot, load and boot openwrt from uboot again, then sysupgrade to write openwrt to nand. Let me know if I'm heading down the wrong path.

But I didn't get very far. Couldn't do flash_erase.

Ralph
Re: flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 09:34PM
Ralph,

Instead of using OpenWrt commands, download my tools tarball.

U-Boot flashing utilities:

https://forum.doozan.com/read.php?3,27280

Extract it and execute the binary directly:
./tools/flash_erase /dev/mtd0 0 4

As I said, OpenWrt system might have disallowed writing to mtd0. So I need to see your serial console log with the printenvs output.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 10:00PM
Same "not found" error as with the other one I tried.

Quote

root@OpenWrt:/tmp/tools# ls -l
-rwxr-xr-x 1 root root 1616492 Nov 15 2010 busybox
-rwxr-xr-x 1 root root 787036 Jun 20 2011 e2fsck
-rwxr-xr-x 1 root root 25632 Jun 30 2014 flash_erase
-rw-r--r-- 1 root root 329 May 17 2016 fw_env.config
-rwxr-xr-x 1 root root 668497 May 17 2016 fw_printenv
-rwxr-xr-x 1 root root 26548 Jun 30 2014 nanddump
-rwxr-xr-x 1 root root 29644 Jun 30 2014 nandwrite
root@OpenWrt:/tmp/tools# ./flash_erase /dev/mtd0 0 4
-ash: ./flash_erase: not found
root@OpenWrt:/tmp/tools#

Assuming missing some dynamic library.

Do I need to do the flash erase from within the CE u-boot?

Or should I just go back to CE u-boot and send you printenv output?

Ralph
Re: flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 10:38PM
> Assuming missing some dynamic library.

Not dynamic library. Those tools binaries are all static.

> Or should I just go back to CE u-boot and send you
> printenv output?

You have not flashed anything, so the CE stock u-boot is still on mtd0.


BTW, try moving the tools folder to the root

cp -a /tmp/tools /mnt

and execute it there

cd /mnt/tools
./flash_erasse ....

so on.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 11/03/2020 10:41PM by bodhi.
Re: flash_erase, nandwrite & nanddump with openwrt
November 03, 2020 11:18PM
Same error on root file system.

Quote

root@OpenWrt:/mnt/tools# ls -al
drwxr-xr-x 2 root root 180 Nov 4 04:45 .
drwxr-xr-x 3 root root 60 Nov 4 04:45 ..
-rwxr-xr-x 1 root root 1616492 Nov 15 2010 busybox
-rwxr-xr-x 1 root root 787036 Jun 20 2011 e2fsck
-rwxr-xr-x 1 root root 25632 Jun 30 2014 flash_erase
-rw-r--r-- 1 root root 329 May 17 2016 fw_env.config
-rwxr-xr-x 1 root root 668497 May 17 2016 fw_printenv
-rwxr-xr-x 1 root root 26548 Jun 30 2014 nanddump
-rwxr-xr-x 1 root root 29644 Jun 30 2014 nandwrite
root@OpenWrt:/mnt/tools# ./flash_erase /dev/mtd0 0 4
-ash: ./flash_erase: not found
root@OpenWrt:/mnt/tools# /mnt/tools/flash_erase /dev/mtd0 0 4
-ash: /mnt/tools/flash_erase: not found
root@OpenWrt:/mnt/tools#

I rebooted into CE u-boot. Here is printenv.
Note that I had already changed/added these variables previously from uboot

ipaddr
serverip
mtdparts
partition
set_bootargs_owrt
bootcmd_owrt
bootcmd
mtdids
bootargs

Quote

root@Dragon:~# cat screenlog.0
printenv
baudrate=115200
loads_echo=0
rootpath=/mnt/ARM_FS/
netmask=255.255.0.0
run_diag=yes
CASset=min
MALLOC_len=1
ethprime=egiga0
load_nand=nboot 0x800000 0 0x200000
load_nand2=nboot 0x800000 0 0x500000
boot=bootm 0x800000
boot_nand=run load_nand boot || run load_nand2 boot
ethmtu=1500
usb0Mode=host
nandEcc=1bit
ethact=egiga0
ethaddr=00:25:31:06:20:30
cesvcid=HAYMK75LDWVALH8Z7MSKZWSCS6
ceboardver=PPV4A1
serverip=192.168.1.162
ipaddr=192.168.1.50
mtdparts=mtdparts=orion_nand:0x200000@0x0(u-boot),-@0x200000(ubi)
partition=nand0,0
set_bootargs_owrt=setenv bootargs console=ttys0,115200 $mtdparts
bootcmd_owrt=run set_bootargs_owrt; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000
bootcmd=run bootcmd_owrt
mtdids=nand0=orion_nand
bootargs=console=ttys0,115200 $mtdparts
stdin=serial
stdout=serial
stderr=serial
mainlineLinux=no
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
netbsd_en=no
vxworks_en=no
bootdelay=1
disaMvPnp=no
hddPowerCtrl=no
pcieTune=no

Environment size: 1059/131068 bytes
CE>>

Ralph
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 01:24AM
Go ahead and boot into OpenWrt and post the boot log here.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 09:40AM
Not sure if you need this, but here is console output

Quote

CE>> tftpboot 0x800000 uImage
Using egiga0 device
TFTP from server 192.168.1.162; our IP address is 192.168.1.50
Filename 'uImage'.
Load address: 0x800000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#######################################################
done
Bytes transferred = 3608527 (370fcf hex)
CE>> bootm 0x800000
## Booting image at 00800000 ...
Image Name: ARM OpenWrt Linux-4.14.195
Created: 2020-09-06 16:19:39 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3608463 Bytes = 3.4 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK

Starting kernel ...

And here is dmesg from openwrt

Quote

root@OpenWrt:~# dmesg
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.195 (builder@buildhost) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11208-ce6496d796)) #0 Sun Sep 6 16:19:39 2020
[ 0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Cloud Engines PogoPlug Series 4
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] On node 0 totalpages: 32768
[ 0.000000] free_area_init_node: node 0, pgdat c0d285e0, node_mem_map c7efa000
[ 0.000000] Normal zone: 256 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 32768 pages, LIFO batch:7
[ 0.000000] random: get_random_bytes called from 0xc0700984 with crng_init=0
[ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 32512
[ 0.000000] Kernel command line: console=ttys0,115200 mtdparts=orion_nand:0x200000@0x0(u-boot),-@0x200000(ubi)
[ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Memory: 117144K/131072K available (4808K kernel code, 163K rwdata, 728K rodata, 6144K init, 209K bss, 13928K reserved, 0K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xc8800000 - 0xff800000 ( 880 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)
[ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[ 0.000000] .text : 0xc0008000 - 0xc05b23f0 (5801 kB)
[ 0.000000] .init : 0xc0700000 - 0xc0d00000 (6144 kB)
[ 0.000000] .data : 0xc0d00000 - 0xc0d28c60 ( 164 kB)
[ 0.000000] .bss : 0xc0d28c60 - 0xc0d5d3e4 ( 210 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 11467562657 ns
[ 0.000012] sched_clock: 32 bits at 166MHz, resolution 6ns, wraps every 12884901885ns
[ 0.000055] Switching to timer-based delay loop, resolution 6ns
[ 0.000167] Calibrating delay loop (skipped), value calculated using timer frequency.. 333.33 BogoMIPS (lpj=1666666)
[ 0.000199] pid_max: default: 32768 minimum: 301
[ 0.000391] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.000419] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.001204] CPU: Testing write buffer coherency: ok
[ 0.002324] Setting up static identity map for 0x100000 - 0x10003c
[ 0.002688] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[ 0.007905] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.007942] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.008059] pinctrl core: initialized pinctrl subsystem
[ 0.010277] NET: Registered protocol family 16
[ 0.010897] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.012436] cpuidle: using governor ladder
[ 0.012951] Feroceon L2: Enabling L2
[ 0.013009] Feroceon L2: Cache support initialised.
[ 0.013372] [Firmware Info]: /ocp@f1000000/ethernet-controller@72000/ethernet0-port@0: local-mac-address is not set
[ 0.019260] No ATAGs?
[ 0.040980] SCSI subsystem initialized
[ 0.041626] libata version 3.00 loaded.
[ 0.041945] usbcore: registered new interface driver usbfs
[ 0.042036] usbcore: registered new interface driver hub
[ 0.042113] usbcore: registered new device driver usb
[ 0.044799] clocksource: Switched to clocksource orion_clocksource
[ 0.045912] NET: Registered protocol family 2
[ 0.046754] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.046787] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.046815] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.046931] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.046965] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.047148] NET: Registered protocol family 1
[ 0.047188] PCI: CLS 0 bytes, default 32
[ 0.181743] Crashlog allocated RAM at address 0x3f00000
[ 0.182736] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[ 0.189176] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.189193] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.286099] io scheduler noop registered
[ 0.286119] io scheduler deadline registered (default)
[ 0.287600] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[ 0.289622] mvebu-pcie mbus@f1000000:pcie@82000000: PCI host bridge to bus 0000:00
[ 0.289649] pci_bus 0000:00: root bus resource [io 0x1000-0xfffff]
[ 0.289665] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xefffffff]
[ 0.289682] pci_bus 0000:00: root bus resource [bus 00-ff]
[ 0.289729] pci 0000:00:01.0: [11ab:6281] type 01 class 0x060400
[ 0.290004] PCI: bus0: Fast back to back transfers disabled
[ 0.290024] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[ 0.290153] PCI: bus1: Fast back to back transfers enabled
[ 0.290176] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[ 0.290208] pci 0000:00:01.0: PCI bridge to [bus 01]
[ 0.290810] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[ 0.293465] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 25, base_baud = 10416666) is a 16550A
[ 0.294592] sata_mv f1080000.sata: version 1.28
[ 0.294863] sata_mv f1080000.sata: slots 32 ports 1
[ 0.303214] scsi host0: sata_mv
[ 0.303478] ata1: SATA max UDMA/133 irq 32
[ 0.304248] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xf1
[ 0.304262] nand: Hynix H27U1G8F2BTR-BC
[ 0.304276] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 0.304305] Scanning device for bad blocks
[ 0.397902] 2 cmdlinepart partitions found on MTD device orion_nand
[ 0.397915] Creating 2 MTD partitions on "orion_nand":
[ 0.397933] 0x000000000000-0x000000200000 : "u-boot"
[ 0.398716] 0x000000200000-0x000008000000 : "ubi"
[ 0.400731] libphy: Fixed MDIO Bus: probed
[ 0.401075] libphy: orion_mdio_bus: probed
[ 0.412634] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[ 0.414573] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 00:25:31:06:20:30
[ 0.414679] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.414691] ehci-pci: EHCI PCI platform driver
[ 0.414769] ehci-orion: EHCI orion driver
[ 0.415069] orion-ehci f1050000.ehci: EHCI Host Controller
[ 0.415113] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[ 0.415303] orion-ehci f1050000.ehci: irq 29, io mem 0xf1050000
[ 0.444820] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[ 0.445609] hub 1-0:1.0: USB hub found
[ 0.445727] hub 1-0:1.0: 1 port detected
[ 0.446346] usbcore: registered new interface driver usb-storage
[ 0.726199] ata1: SATA link down (SStatus 0 SControl F300)
[ 0.814816] usb 1-1: new high-speed USB device number 2 using orion-ehci
[ 1.018186] usb-storage 1-1:1.0: USB Mass Storage device detected
[ 1.018682] scsi host1: usb-storage 1-1:1.0
[ 1.524816] rtc-mv f1010300.rtc: internal RTC not ticking
[ 1.524973] i2c /dev entries driver
[ 1.525873] orion_wdt: Initial timeout 25 sec
[ 1.526668] mvsdio f1090000.mvsdio: Got CD GPIO
[ 1.526711] mvsdio f1090000.mvsdio: Got WP GPIO
[ 1.676116] marvell-cesa f1030000.crypto: CESA device successfully registered
[ 1.677402] NET: Registered protocol family 10
[ 1.679904] Segment Routing with IPv6
[ 1.680005] NET: Registered protocol family 17
[ 1.680055] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[ 1.680069] 8021q: 802.1Q VLAN Support v1.8
[ 1.683104] UBI error: no valid UBI magic found inside mtd1
[ 1.683368] hctosys: unable to open rtc device (rtc0)
[ 1.683587] Warning: unable to open an initial console.
[ 1.694803] random: fast init done
[ 1.708971] Freeing unused kernel memory: 6144K
[ 1.721662] init: Console is alive
[ 1.721869] init: - watchdog -
[ 1.730624] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[ 1.730777] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[ 1.732711] init: - preinit -
[ 1.869042] random: jshn: uninitialized urandom read (4 bytes read)
[ 1.909420] random: jshn: uninitialized urandom read (4 bytes read)
[ 1.936674] random: jshn: uninitialized urandom read (4 bytes read)
[ 2.024285] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 100 Mb/s, full duplex, flow control disabled
[ 2.024385] mv643xx_eth_port mv643xx_eth_port.0 eth0: link down
[ 2.026205] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 2.227013] scsi 1:0:0:0: Direct-Access Lexar USB Flash Drive 1100 PQ: 0 ANSI: 4
[ 2.229386] sd 1:0:0:0: [sda] 31285248 512-byte logical blocks: (16.0 GB/14.9 GiB)
[ 2.229989] sd 1:0:0:0: [sda] Write Protect is off
[ 2.230013] sd 1:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 2.230612] sd 1:0:0:0: [sda] No Caching mode page found
[ 2.230633] sd 1:0:0:0: [sda] Assuming drive cache: write through
[ 2.236821] sda: sda1
[ 2.240307] sd 1:0:0:0: [sda] Attached SCSI removable disk
[ 3.694530] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 100 Mb/s, full duplex, flow control disabled
[ 3.694623] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 4.189612] procd: - early -
[ 4.189719] procd: - watchdog -
[ 4.745666] procd: - watchdog -
[ 4.745842] procd: failed to set stdio: No such device
[ 4.745917] procd: - ubus -
[ 4.750950] urandom_read: 3 callbacks suppressed
[ 4.750958] random: ubusd: uninitialized urandom read (4 bytes read)
[ 4.796432] random: ubusd: uninitialized urandom read (4 bytes read)
[ 4.796830] random: ubusd: uninitialized urandom read (4 bytes read)
[ 4.798104] procd: - init -
[ 5.157918] kmodloader: loading kernel modules from /etc/modules.d/*
[ 5.162955] ip6_tables: (C) 2000-2006 Netfilter Core Team
[ 5.180933] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 5.187955] nf_conntrack version 0.5.0 (2048 buckets, 8192 max)
[ 5.257358] xt_time: kernel timezone is -0000
[ 5.265525] PPP generic driver version 2.4.2
[ 5.275910] NET: Registered protocol family 24
[ 5.279239] kmodloader: done loading kernel modules from /etc/modules.d/*
[ 5.330462] urngd: v1.0.2 started.
[ 5.428124] random: crng init done
[ 5.428138] random: 1 urandom warning(s) missed due to ratelimiting
[ 16.335495] br-lan: port 1(eth0) entered blocking state
[ 16.335517] br-lan: port 1(eth0) entered disabled state
[ 16.335822] device eth0 entered promiscuous mode
[ 16.338862] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[ 17.993823] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 100 Mb/s, full duplex, flow control disabled
[ 17.993919] br-lan: port 1(eth0) entered blocking state
[ 17.993935] br-lan: port 1(eth0) entered forwarding state
[ 17.994335] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
root@OpenWrt:~#

Note that /proc/mtd now shows only the 2 partitions I had defined in mtdparts

root@OpenWrt:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00200000 00020000 "u-boot"
mtd1: 07e00000 00020000 "ubi"
root@OpenWrt:~#
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 02:39PM
OpenWrt normally has the uboot mtd set to read only so you can make a backup but not modify it. I guess that is done to avoid people bricking their devices. So you would have to change the dtb or compile a custom openwrt to be able to update uboot. It may be easier to boot into bodhi's Debian from an USB stick instead and update uboot from there.
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 03:20PM
Hmm, interesting. That explains the permission denied error.

How do I boot from USB using the original CE u-boot? I see diskboot command to boot from IDE, but don't see anything for USB.

Quote

CE>> help
? - alias for 'help'
base - print or set address offset
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootext2 dev:boot_part1,boot_part2 addr boot_image linux_dev_name
bootm - boot application image from memory
bootp - boot image via network using BootP/TFTP protocol
bubt - Burn an image on the Boot Nand Flash.
chpart - change active partition
cmp - memory compare
cmpm - Compare Memory
cp - memory copy
cpumap - Display CPU memory mapping settings.
crc32 - checksum calculation
date - get/set/reset date & time
dclk - Display the MV device CLKs.
dhcp - invoke DHCP client to obtain IP/boot params
diskboot- boot from IDE device
echo - echo args to console
eeprom - EEPROM sub-system
erase - erase FLASH memory
exit - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls - list files in a directory (default /)
fi - Find value in the memory.
flinfo - print FLASH memory information
fsinfo - print information about filesystems
fsload - load binary file from a filesystem image
g - start application at cached address 'addr'(default addr 0x40000)
go - start application at address 'addr'
help - print online help
icrc32 - checksum calculation
ide - IDE sub-system
iloop - infinite loop on address range
imd - i2c memory display
imm[.b, .s, .w, .l] - i2c memory modify (auto-incrementing)
imw - memory write (fill)
inm - memory modify (constant address)
iprobe - probe to discover valid I2C chip addresses
ir - reading and changing MV internal register values.
loop - infinite loop on address range
ls - list files in a directory (default /)
map - Diasplay address decode windows
md - memory display
me - PCI master enable
mm - memory modify (auto-incrementing)
mp - map PCI BAR
mtdparts- define flash/nand partitions
mtest - simple RAM test
mv_diag - perform board diagnostics
mv_diag - run all available tests
mv_diag [1|2|...]
- run specified test number
mw - memory write (fill)
nand - NAND sub-system
nboot - boot from NAND device
nbubt - Burn a boot loader image on the Boot Nand Flash.
nm - memory modify (constant address)
pci - list and access PCI Configuration Space
phyRead - Read PCI-E Phy register
pciePhyWrite - Write PCI-E Phy register
phyRead - Read Phy register
phyWrite - Write Phy register
ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
protect - enable or disable FLASH write protection
rarpboot- boot image via network using RARP/TFTP protocol
reset - Perform RESET of the CPU
resetenv - Return all environment variable to default.
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
se - PCI Slave enable
setenv - set environment variables
sflash - read, write or erase the external SPI Flash.
sg - scanning the PHYs status
sp - Scan PCI bus.
switchRegRead - Read switch register
switchRegWrite - Write switch register
test - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
version - print monitor version
CE>>

If I copied the uImage from a bodhi Debian USB stick (or SD card, which is what I use to boot Debian on my Pogos), and used tftpboot and bootm to load and boot it, would it be smart enough to find the root file system on USB or SD card?

Ralph
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 04:01PM
Koen,

> OpenWrt normally has the uboot mtd set to read
> only so you can make a backup but not modify it. I
> guess that is done to avoid people bricking their
> devices.

True.

> So you would have to change the dtb or
> compile a custom openwrt to be able to update
> uboot.

No need to do that. We only need to change bootargs to overide the DTB. This is the normal booting procedure for all my Kirkwood u-boots.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 04:12PM
But it is best to follow the installation procedure for the Pogo V4 here from the Wiki thread:

Quote

Rescue Systems

Rescue System V2 (Original)
MacPlug & SMBPLug
Rescue System Pogo V3
Rescue System V4, using a custom LEDE firmware (BETA)
Rescue System for Pogo E02 using LEDE/OpenWrt (Install with Serial Console)
Rescue System for Pogo V4/Mobile using OpenWrt (Install with NetConsole)

https://forum.doozan.com/read.php?4,100764,101409#msg-101409


@Ralph,

Please try the above installation if you can still boot to stock OS. Note that the procedure mention netconsole, and you have serial console so you can skip the netconsole connection, and then it is exactly the same.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 06:03PM
Bodhi,

I've never been able to boot to the original OS on this Pogo.

If I manually load and boot your uImage from CE uboot via tftp, will it find the MMC or USB root file system and come up?

If not, plan B is to try to recompile openwrt with MTD_WRITEABLE=1. But if you think plan A will work, I'll try that first.

Ralph
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 07:47PM
Well, not having a lot of luck getting openwrt to compile...

Decided to go ahead and try manual load/boot of bodhi's kernel. Pogo went from blinking green to solid green, but not seeing it come up on the network. Console log is below. Note that I am using an older 3.18.5 kernel that doesn't use a dtb_file.

Quote

CE>> tftpboot 0x800000 uImage
Using egiga0 device
TFTP from server 192.168.1.162; our IP address is 192.168.1.50
Filename 'uImage'.
Load address: 0x800000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##########################################
done
Bytes transferred = 2875692 (2be12c hex)
CE>> tftpboot 0x1100000 uInitrd
Using egiga0 device
TFTP from server 192.168.1.162; our IP address is 192.168.1.50
Filename 'uInitrd'.
Load address: 0x1100000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##########################################
done
Bytes transferred = 6535284 (63b874 hex)
CE>> bootm 0x800000
## Booting image at 00800000 ...
Image Name: Linux-3.18.5-kirkwood-tld-1
Created: 2015-11-11 5:03:31 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2875628 Bytes = 2.7 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Guessing it's not finding root file system on the SD card?

Ralph
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 11:11PM
On the outside chance rootfs on MTD1 is OK, and the only reason it wouldn't boot stock OS was because of some environment variable problem (I have no idea what the previous owner did to it before I got it), is there a command/commands I can run from CE uboot to try to boot into the old OS?

Ralph
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 11:13PM
Ralph,

I hate reinventing the wheel :) so here look at this tftp boot example and see what you did differently:

https://forum.doozan.com/read.php?3,28772,29034#msg-29034

The above instruction uses Debian-4.4.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2, but you can use the latet rootfs (Debian-5.2.9-kirkwood-tld-1-rootfs-bodhi.tar.bz).

Once you boot into Debian rootfs, then anything is possible.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: flash_erase, nandwrite & nanddump with openwrt
November 04, 2020 11:23PM
OK, I was trying to use rootfs on SD card. I'll try using a USB drive.

Ralph
Re: flash_erase, nandwrite & nanddump with openwrt
November 05, 2020 12:26AM
Woohoo! It's up! I plugged the SD card into a USB reader and put that into the Pogo.

The other stuff I did was set mtdparts and partitions back to the way they were before, and added root=LABEL=rootfs and rootdelay=10 to bootargs. I'm guessing root=LABEL=rootfs may have been key.

THANK YOU VERY MUCH!

Ralph
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: