Welcome! Log In Create A New Profile

Advanced

how to set MTDs writeable?

Posted by shivahoj 
how to set MTDs writeable?
December 01, 2016 03:08PM
I just came across this:
root@publik:~# fw_setenv ipaddr 10.9.1.208
Can't open /dev/mtd0: Permission denied
Error: can't write fw_env to flash
root@publik:~#


How do i fix this?

2 Pieces NSA320 , u-boot 2016.05, debian 4.12.1, Several Mac and Linux boxes connected.
More into soldering than programming. Location:Hildesheim, Germany



Edited 1 time(s). Last edit at 12/01/2016 03:18PM by shivahoj.
Re: how to set MTDs writeable?
December 01, 2016 03:36PM
shivahoj Wrote:
-------------------------------------------------------
> I just came across this:
>
> root@publik:~# fw_setenv ipaddr 10.9.1.208
> Can't open /dev/mtd0: Permission denied
> Error: can't write fw_env to flash
> root@publik:~#
>
>
>
> How do i fix this?

Possibly, it meant that your u-boot env bootargs is not set up properly to tell the kernel about the MTDs. Pls get the listing of:

uname -a
cat /proc/cmdline
cat /proc/mtd
dmesg | grep -i mtd
dmesg | grep -i 0x000
fw_printenv

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to set MTDs writeable?
December 01, 2016 03:42PM
root@publik:~# uname -a
Linux publik 4.8.3-kirkwood-tld-1 #1 PREEMPT Thu Oct 20 23:33:18 PDT 2016 armv5tel GNU/Linux
root@publik:~# cat /proc/cmdline
console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=mtdparts=orion_nand:1M(u-boot),512K(uboot_env),512K(key_store),512K(info),10M(etc),10M(kernel_1),48896K(rootfs1),10M(kernel_2),-(rootfs2)
root@publik:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "uboot"
mtd1: 00080000 00020000 "uboot_env"
mtd2: 00080000 00020000 "key_store"
mtd3: 00080000 00020000 "info"
mtd4: 00a00000 00020000 "etc"
mtd5: 00a00000 00020000 "kernel_1"
mtd6: 02fc0000 00020000 "rootfs1"
mtd7: 00a00000 00020000 "kernel_2"
mtd8: 02fc0000 00020000 "rootfs2"
root@publik:~# dmesg | grep -i mtd
[    0.000000] Kernel command line: console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=mtdparts=orion_nand:1M(u-boot),512K(uboot_env),512K(key_store),512K(info),10M(etc),10M(kernel_1),48896K(rootfs1),10M(kernel_2),-(rootfs2)
[    5.919157] 9 ofpart partitions found on MTD device orion_nand
[    5.925042] Creating 9 MTD partitions on "orion_nand":
root@publik:~# dmesg | grep -i 0x000
[    5.893386] Bad eraseblock 852 at 0x000006a80000
[    5.905878] Bad eraseblock 934 at 0x0000074c0000
[    5.930205] 0x000000000000-0x000000100000 : "uboot"
[    5.936602] 0x000000100000-0x000000180000 : "uboot_env"
[    5.943207] 0x000000180000-0x000000200000 : "key_store"
[    5.949869] 0x000000200000-0x000000280000 : "info"
[    5.956180] 0x000000280000-0x000000c80000 : "etc"
[    5.962344] 0x000000c80000-0x000001680000 : "kernel_1"
[    5.968911] 0x000001680000-0x000004640000 : "rootfs1"
[    5.975647] 0x000004640000-0x000005040000 : "kernel_2"
[    5.982220] 0x000005040000-0x000008000000 : "rootfs2"
root@publik:~# fw_printenv
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
device=0:1
disks=0 1 2 3
ethact=egiga0
if_netconsole=ping $serverip
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb_addr=0x1c00000
load_initrd_addr=0x1100000
load_uimage_addr=0x800000
mainlineLinux=yes
mtdids=nand0=orion_nand
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15
arcNumber=3956
mtdparts=mtdparts=mtdparts=orion_nand:1M(u-boot),512K(uboot_env),512K(key_store),512K(info),10M(etc),10M(kernel_1),48896K(rootfs1),10M(kernel_2),-(rootfs2)
ethaddr=b0:b2:dc:ee:d4:f2
ipaddr=10.9.1.209
serverip=10.9.1.200
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi; sleep 3
dtb_file=/boot/dts/kirkwood-nsa320.dtb
devices=ide
bootdelay=5
bootdev=ide
stderr=nc
stdin=nc
stdout=nc
usb_boot=run load_dtb; run load_uimage; if run load_initrd; then bootm 0x800000 0x1100000 0x1c00000; else bootm 0x800000 - 0x1c00000; fi
load_uimage=ext2load ide 0:1 0x800000 /boot/uImage
load_initrd=ext2load ide 0:1 0x1100000 /boot/uInitrd
load_dtb=ext2load ide 0:1 0x1c00000 /boot/dts/kirkwood-nsa320.dtb
root@publik:~#

2 Pieces NSA320 , u-boot 2016.05, debian 4.12.1, Several Mac and Linux boxes connected.
More into soldering than programming. Location:Hildesheim, Germany
Re: how to set MTDs writeable?
December 01, 2016 03:47PM
I forgot! one more item:

cat /etc/fw_env.config

and

ls -l /dev/mtd*

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 12/01/2016 03:49PM by bodhi.
Re: how to set MTDs writeable?
December 01, 2016 10:33PM
root@publik:~# cat /etc/fw_env.config
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000
root@publik:~# ls -l /dev/mtd*
crw------- 1 root root 90,  0 Dec  1 21:36 /dev/mtd0
crw------- 1 root root 90,  1 Dec  1 21:36 /dev/mtd0ro
crw------- 1 root root 90,  2 Dec  1 21:36 /dev/mtd1
crw------- 1 root root 90,  3 Dec  1 21:36 /dev/mtd1ro
crw------- 1 root root 90,  4 Dec  1 21:36 /dev/mtd2
crw------- 1 root root 90,  5 Dec  1 21:36 /dev/mtd2ro
crw------- 1 root root 90,  6 Dec  1 21:36 /dev/mtd3
crw------- 1 root root 90,  7 Dec  1 21:36 /dev/mtd3ro
crw------- 1 root root 90,  8 Dec  1 21:36 /dev/mtd4
crw------- 1 root root 90,  9 Dec  1 21:36 /dev/mtd4ro
crw------- 1 root root 90, 10 Dec  1 21:36 /dev/mtd5
crw------- 1 root root 90, 11 Dec  1 21:36 /dev/mtd5ro
crw------- 1 root root 90, 12 Dec  1 21:36 /dev/mtd6
crw------- 1 root root 90, 13 Dec  1 21:36 /dev/mtd6ro
crw------- 1 root root 90, 14 Dec  1 21:36 /dev/mtd7
crw------- 1 root root 90, 15 Dec  1 21:36 /dev/mtd7ro
crw------- 1 root root 90, 16 Dec  1 21:36 /dev/mtd8
crw------- 1 root root 90, 17 Dec  1 21:36 /dev/mtd8ro
brw-rw---- 1 root disk 31,  0 Dec  1 21:36 /dev/mtdblock0
brw-rw---- 1 root disk 31,  1 Dec  1 21:36 /dev/mtdblock1
brw-rw---- 1 root disk 31,  2 Dec  1 21:36 /dev/mtdblock2
brw-rw---- 1 root disk 31,  3 Dec  1 21:36 /dev/mtdblock3
brw-rw---- 1 root disk 31,  4 Dec  1 21:36 /dev/mtdblock4
brw-rw---- 1 root disk 31,  5 Dec  1 21:36 /dev/mtdblock5
brw-rw---- 1 root disk 31,  6 Dec  1 21:36 /dev/mtdblock6
brw-rw---- 1 root disk 31,  7 Dec  1 21:36 /dev/mtdblock7
brw-rw---- 1 root disk 31,  8 Dec  1 21:36 /dev/mtdblock8
root@publik:~#
Re: how to set MTDs writeable?
December 01, 2016 10:39PM
Everything in your system looks normal!

If you have serial console, then reboot and post the entire serial console log here. Perhaps something out of the ordinary happened during boot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to set MTDs writeable?
December 01, 2016 11:54PM
Hello,
i think i fried the out port of the UART. This must have happened while i was double checking, and crossing the Serial lines. I checked the PCB, and the serial out line runs right into the Kirkwood SoC chip, no other semiconductors involved, as far as i can see. The voltage on the Serial out is about +3 Volts (in silence) and the data transmissions drop it to about +2.6V instead of 0V where it ought to be. And my 3.3V <-> USB converter( i use this one:http://www.ebay.de/itm/FT232RL-USB-TTL-FTDI-Serial-Adapter-Modul-5V-3-3V-fur-Arduino-193-/122228183676?hash=item1c755e127c:g:2m0AAOSwKOJYKEOQ) doesnt trigger on these low changes.
I checked this with an oscilloscope. Otherwise the Spikes are in good rectangular shape.
This Weekend maybe i hook a Transistor to the out port, to re-establish the full 3.3V to 0V Level, and thus reestablish the Serial port.
I will keep you updated on the progress.
Another thing i noticed: The netcat console also doesnt show anything, on both NSA's, during the whole boot process.
You already have my current environment, i even made another Linux box in the Network connect to the nc Server.
10.9.1.200 nc Server cmd line:
nc -lu  6666
10.9.1.222 nc Test client cmd line:
nc -u  10.9.1.200 6666
to ensure this is no Firewall etc. issue. Text i type in either Computers window appears in the other window, but only after i press <Enter>.
So maybe its a weird <CR> vs. <CRLF> issue? Shouldn't the characters appear instantaneously?
Anyway, there is still no boot log from any of the NSA's. Both have the exact same Environment, only the ip and mac addresses are different.

2 Pieces NSA320 , u-boot 2016.05, debian 4.12.1, Several Mac and Linux boxes connected.
More into soldering than programming. Location:Hildesheim, Germany



Edited 1 time(s). Last edit at 12/01/2016 11:56PM by shivahoj.
Re: how to set MTDs writeable?
December 20, 2016 07:14PM
Same issue here with 4.8.3 on pogoplug V4, fairly new uBoot, Debian on SD card

root@pogo:~# fw_setenv ipaddr '192.168.1.2'
Can't open /dev/mtd0: Permission denied
Error: can't write fw_env to flash

Here's the output:

root@pogo:~# uname -a
Linux pogo 4.8.3-kirkwood-tld-1 #1 PREEMPT Thu Oct 20 23:33:18 PDT 2016 armv5tel GNU/Linux


root@pogo:~# cat /proc/cmdline
console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)


root@pogo:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00020000 "u-boot"
mtd1: 00300000 00020000 "uImage"
mtd2: 00300000 00020000 "uImage2"
mtd3: 00800000 00020000 "failsafe"
mtd4: 07000000 00020000 "root"


root@pogo:~# dmesg | grep -i mtd
[    0.000000] Kernel command line: console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)
[    6.948613] 5 ofpart partitions found on MTD device orion_nand
[    6.954440] Creating 5 MTD partitions on "orion_nand":


root@pogo:~# dmesg | grep -i 0x000
[    5.980792] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x0000ffff 64bit]
[    5.980814] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x00000fff 64bit]
[    5.980835] pci 0000:01:00.0: reg 0x20: [mem 0x00000000-0x00000fff 64bit]
[    6.942228] Bad eraseblock 1003 at 0x000007d60000
[    6.959566] 0x000000000000-0x000000200000 : "u-boot"
[    6.966226] 0x000000200000-0x000000500000 : "uImage"
[    6.972777] 0x000000500000-0x000000800000 : "uImage2"
[    6.979475] 0x000000800000-0x000001000000 : "failsafe"
[    6.986284] 0x000001000000-0x000008000000 : "root"
[    8.243380] xhci_hcd 0000:01:00.0: hcc params 0x200073a1 hci version 0x100 quirks 0x00080010


root@pogo:~# fw_printenv
bootcmd_exec=mw 0x800000 0 1; run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x800000 0x1100000 0x1c00000; else bootm 0x800000 0x1100000; fi; else if run load_dtb; then bootm 0x800000 - 0x1c00000; else bootm 0x800000; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
device=0:1
disks=0 1 2 3
ethact=egiga0
if_netconsole=ping $serverip
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; ext2load $bootdev $device 0x1c00000 $dtb_file
load_initrd=echo loading uInitrd ...; ext2load $bootdev $device 0x1100000 /boot/uInitrd
load_uimage=echo loading uImage ...; ext2load $bootdev $device 0x800000 /boot/uImage
mainlineLinux=yes
mtdids=nand0=orion_nand
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if ext2load $dev $disknum:1 0x800000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x810000
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x810000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15
arcNumber=3960
machid=f78
mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)
dtb_file=/boot/dts/kirkwood-pogoplug_v4.dtb
ethaddr=00:25:31:04:d8:e9
ipaddr=192.168.1.22
serverip=192.168.1.3
devices=mmc usb ide
bootdev=mmc


root@pogo:~# cat /etc/fw_env.config
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000
root@pogo:~# ls -l /dev/mtd*
crw------- 1 root root 90, 0 Dec 31  1969 /dev/mtd0
crw------- 1 root root 90, 1 Dec 31  1969 /dev/mtd0ro
crw------- 1 root root 90, 2 Dec 31  1969 /dev/mtd1
crw------- 1 root root 90, 3 Dec 31  1969 /dev/mtd1ro
crw------- 1 root root 90, 4 Dec 31  1969 /dev/mtd2
crw------- 1 root root 90, 5 Dec 31  1969 /dev/mtd2ro
crw------- 1 root root 90, 6 Dec 31  1969 /dev/mtd3
crw------- 1 root root 90, 7 Dec 31  1969 /dev/mtd3ro
crw------- 1 root root 90, 8 Dec 31  1969 /dev/mtd4
crw------- 1 root root 90, 9 Dec 31  1969 /dev/mtd4ro
brw-rw---- 1 root disk 31, 0 Dec 31  1969 /dev/mtdblock0
brw-rw---- 1 root disk 31, 1 Dec 31  1969 /dev/mtdblock1
brw-rw---- 1 root disk 31, 2 Dec 31  1969 /dev/mtdblock2
brw-rw---- 1 root disk 31, 3 Dec 31  1969 /dev/mtdblock3
brw-rw---- 1 root disk 31, 4 Dec 31  1969 /dev/mtdblock4

mtd partitions were not detected at all, i had to add to /boot/uEnv.txt
mtdparts=mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)

No idea what happened, fw_setenv iworked fine with 4.4.0 and 4.6.0

Thanks a lot.
Re: how to set MTDs writeable?
December 21, 2016 05:07PM
Quote

root@pogo:~# cat /proc/cmdline
console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)

mtd partitions were not detected at all, i had to add to /boot/uEnv.txt
mtdparts=mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)


The above did not make sense! The mtd definition in uEnv.txt is obviously wrong! and the cmdline showed they are wrong too. Since you don't have serial console, you could not see the boot process step by step.

Please remove the uEnv.txt and reboot. Post :

- dmesg
- cat /proc/cmdline
- cat /proc/mtd
- cat /etc/fw_env.config
- fw_printenv

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 2 time(s). Last edit at 12/21/2016 05:10PM by bodhi.
Re: how to set MTDs writeable?
December 22, 2016 03:21PM
Thanks a lot !

root@pogo:/boot# mv uEnv.txt Disabled_uEnv.txt
root@pogo:/boot# cd
root@pogo:~# shutdown -r now

Then:
root@pogo:~# uptime
 15:15:00 up 1 min,  1 user,  load average: 0.96, 0.36, 0.13

root@pogo:~# dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.8.3-kirkwood-tld-1 (root@tldDebian) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 PREEMPT Thu Oct 20 23:33:18 PDT 2016
[    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: Pogoplug v4
[    0.000000] Memory policy: Data cache writeback
[    0.000000] On node 0 totalpages: 32768
[    0.000000] free_area_init_node: node 0, pgdat c08b1e78, node_mem_map c7ef9000
[    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] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)
[    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: 113384K/131072K available (6149K kernel code, 614K rwdata, 1664K rodata, 308K init, 318K bss, 17688K reserved, 0K cma-reserved)
[    0.000000] Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xc8800000 - 0xff800000   ( 880 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc0609718   (6150 kB)
      .init : 0xc07dd000 - 0xc082a000   ( 308 kB)
      .data : 0xc082a000 - 0xc08c391c   ( 615 kB)
       .bss : 0xc08c391c - 0xc0913170   ( 319 kB)
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] 	Build-time adjustment of leaf fanout to 32.
[    0.000000] NR_IRQS:16 nr_irqs:16 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.000648] Console: colour dummy device 80x30
[    0.000689] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[    0.090115] pid_max: default: 32768 minimum: 301
[    0.090369] Security Framework initialized
[    0.090558] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.090586] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.091946] CPU: Testing write buffer coherency: ok
[    0.092478] Setting up static identity map for 0x8200 - 0x8258
[    0.092796] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[    0.097763] devtmpfs: initialized
[    0.104338] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.104666] prandom: seed boundary self test passed
[    0.109155] prandom: 100 self tests passed
[    0.109171] pinctrl core: initialized pinctrl subsystem
[    0.110847] NET: Registered protocol family 16
[    0.111465] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.140136] cpuidle: using governor ladder
[    0.170132] cpuidle: using governor menu
[    0.170680] Feroceon L2: Enabling L2
[    0.170734] Feroceon L2: Cache support initialised.
[    0.171244] [Firmware Info]: /ocp@f1000000/ethernet-controller@72000/ethernet0-port@0: local-mac-address is not set
[    0.177178] No ATAGs?
[    0.211843] vgaarb: loaded
[    0.212262] usbcore: registered new interface driver usbfs
[    0.212379] usbcore: registered new interface driver hub
[    0.212455] usbcore: registered new device driver usb
[    0.213802] clocksource: Switched to clocksource orion_clocksource
[    0.268773] VFS: Disk quotas dquot_6.6.0
[    0.268871] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.282531] NET: Registered protocol family 2
[    0.283549] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.283583] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.283608] TCP: Hash tables configured (established 1024 bind 1024)
[    0.283688] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.283714] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.283987] NET: Registered protocol family 1
[    0.284599] RPC: Registered named UNIX socket transport module.
[    0.284614] RPC: Registered udp transport module.
[    0.284623] RPC: Registered tcp transport module.
[    0.284632] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.284647] PCI: CLS 0 bytes, default 32
[    0.284929] Unpacking initramfs...
[    1.061335] Freeing initrd memory: 7176K (c7411000 - c7b13000)
[    1.061535] NetWinder Floating Point Emulator V0.97 (double precision)
[    1.062744] futex hash table entries: 256 (order: -1, 3072 bytes)
[    1.062801] audit: initializing netlink subsys (disabled)
[    1.062862] audit: type=2000 audit(1.050:1): initialized
[    1.063241] Initialise system trusted keyrings
[    1.063479] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    1.063588] zbud: loaded
[    1.064773] NFS: Registering the id_resolver key type
[    1.064808] Key type id_resolver registered
[    1.064818] Key type id_legacy registered
[    1.064838] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    1.064850] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[    1.065168] jffs2: version 2.2. (NAND) (SUMMARY)  \xffffffc2\xffffffa9 2001-2006 Red Hat, Inc.
[    1.065497] orangefs_init: called with debug mask: :none: :0:
[    1.065950] orangefs: module version upstream loaded
[    1.066257] Key type big_key registered
[    2.553810] random: fast init done
[    5.975117] Key type asymmetric registered
[    5.975137] Asymmetric key parser 'x509' registered
[    5.975238] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    5.975253] io scheduler noop registered
[    5.975263] io scheduler deadline registered
[    5.975302] io scheduler cfq registered (default)
[    5.976320] kirkwood-pinctrl f1010000.pin-controller: unknown pinctrl group 47
[    5.976340] kirkwood-pinctrl f1010000.pin-controller: unknown pinctrl group 49
[    5.976736] kirkwood-pinctrl f1010000.pin-controller: registered pinctrl driver
[    5.977787] irq: Cannot allocate irq_descs @ IRQ34, assuming pre-allocated
[    5.978602] irq: Cannot allocate irq_descs @ IRQ66, assuming pre-allocated
[    5.979575] mvebu-pcie mbus@f1000000:pcie-controller@82000000: PCI host bridge to bus 0000:00
[    5.979599] pci_bus 0000:00: root bus resource [io  0x1000-0xfffff]
[    5.979616] pci_bus 0000:00: root bus resource [mem 0xe0000000-0xefffffff]
[    5.979632] pci_bus 0000:00: root bus resource [bus 00-ff]
[    5.979646] pci_bus 0000:00: scanning bus
[    5.979683] pci 0000:00:01.0: [11ab:6281] type 01 class 0x060400
[    5.979740] pci 0000:00:01.0: calling pci_fixup_ide_bases+0x0/0x40
[    5.980074] pci_bus 0000:00: fixups for bus
[    5.980087] PCI: bus0: Fast back to back transfers disabled
[    5.980106] pci 0000:00:01.0: scanning [bus 00-00] behind bridge, pass 0
[    5.980116] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    5.980137] pci 0000:00:01.0: scanning [bus 00-00] behind bridge, pass 1
[    5.980387] pci_bus 0000:01: scanning bus
[    5.980432] pci 0000:01:00.0: [1b73:1009] type 00 class 0x0c0330
[    5.980468] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x0000ffff 64bit]
[    5.980491] pci 0000:01:00.0: reg 0x18: [mem 0x00000000-0x00000fff 64bit]
[    5.980512] pci 0000:01:00.0: reg 0x20: [mem 0x00000000-0x00000fff 64bit]
[    5.980551] pci 0000:01:00.0: calling pci_fixup_ide_bases+0x0/0x40
[    5.980625] pci 0000:01:00.0: supports D1
[    5.980635] pci 0000:01:00.0: PME# supported from D0 D1 D3hot
[    5.980647] pci 0000:01:00.0: PME# disabled
[    6.003868] pci_bus 0000:01: fixups for bus
[    6.003883] PCI: bus1: Fast back to back transfers disabled
[    6.003899] pci_bus 0000:01: bus scan returning with max=01
[    6.003913] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    6.003926] pci_bus 0000:00: bus scan returning with max=01
[    6.003942] pci 0000:00:01.0: fixup irq: got 0
[    6.003951] pci 0000:00:01.0: assigning IRQ 00
[    6.004014] pci 0000:01:00.0: fixup irq: got 84
[    6.004024] pci 0000:01:00.0: assigning IRQ 84
[    6.004063] pci 0000:00:01.0: BAR 14: assigned [mem 0xe0000000-0xe00fffff]
[    6.004088] pci 0000:01:00.0: BAR 0: assigned [mem 0xe0000000-0xe000ffff 64bit]
[    6.004117] pci 0000:01:00.0: BAR 2: assigned [mem 0xe0010000-0xe0010fff 64bit]
[    6.004144] pci 0000:01:00.0: BAR 4: assigned [mem 0xe0011000-0xe0011fff 64bit]
[    6.004167] pci 0000:00:01.0: PCI bridge to [bus 01]
[    6.004186] pci 0000:00:01.0:   bridge window [mem 0xe0000000-0xe00fffff]
[    6.004285] pcieport 0000:00:01.0: enabling device (0140 -> 0142)
[    6.004315] pcieport 0000:00:01.0: enabling bus mastering
[    6.004368] pci 0000:01:00.0: calling quirk_usb_early_handoff+0x0/0x634
[    6.004382] pci 0000:00:01.0: enabling bus mastering
[    6.004395] pci 0000:01:00.0: enabling device (0140 -> 0142)
[    6.004746] mv_xor f1060800.xor: Marvell shared XOR driver
[    6.064678] mv_xor f1060800.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[    6.064952] mv_xor f1060900.xor: Marvell shared XOR driver
[    6.124672] mv_xor f1060900.xor: Marvell XOR (Registers Mode): ( xor cpy intr )
[    6.125275] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    6.126925] console [ttyS0] disabled
[    6.126999] f1012000.serial: ttyS0 at MMIO 0xf1012000 (irq = 25, base_baud = 10416666) is a 16550A
[    6.824710] console [ttyS0] enabled
[    6.829832] nand: Could not find valid ONFI parameter page; aborting
[    6.836229] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xf1
[    6.842552] nand: Hynix NAND 128MiB 3,3V 8-bit
[    6.847000] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    6.854568] Scanning device for bad blocks
[    6.940731] Bad eraseblock 1003 at 0x000007d60000
[    6.947105] 5 ofpart partitions found on MTD device orion_nand
[    6.952911] Creating 5 MTD partitions on "orion_nand":
[    6.958055] 0x000000000000-0x000000200000 : "u-boot"
[    6.964733] 0x000000200000-0x000000500000 : "uImage"
[    6.971288] 0x000000500000-0x000000800000 : "uImage2"
[    6.977968] 0x000000800000-0x000001000000 : "failsafe"
[    6.984754] 0x000001000000-0x000008000000 : "root"
[    6.993732] libphy: Fixed MDIO Bus: probed
[    6.998047] libphy: mdio_driver_register: mv88e6085
[    7.003314] libphy: orion_mdio_bus: probed
[    7.013445] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[    8.113402] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC address 00:25:31:04:d8:e9
[    8.122268] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    8.128814] ehci-pci: EHCI PCI platform driver
[    8.133311] ehci-orion: EHCI orion driver
[    8.137527] orion-ehci f1050000.ehci: EHCI Host Controller
[    8.143026] orion-ehci f1050000.ehci: new USB bus registered, assigned bus number 1
[    8.150897] orion-ehci f1050000.ehci: irq 29, io mem 0xf1050000
[    8.183842] orion-ehci f1050000.ehci: USB 2.0 started, EHCI 1.00
[    8.190076] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    8.196871] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    8.204085] usb usb1: Product: EHCI Host Controller
[    8.208946] usb usb1: Manufacturer: Linux 4.8.3-kirkwood-tld-1 ehci_hcd
[    8.215548] usb usb1: SerialNumber: f1050000.ehci
[    8.221096] hub 1-0:1.0: USB hub found
[    8.224946] hub 1-0:1.0: 1 port detected
[    8.229572] xhci_hcd 0000:01:00.0: enabling bus mastering
[    8.229587] xhci_hcd 0000:01:00.0: xHCI Host Controller
[    8.234892] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 2
[    8.243432] xhci_hcd 0000:01:00.0: hcc params 0x200073a1 hci version 0x100 quirks 0x00080010
[    8.251897] xhci_hcd 0000:01:00.0: enabling Mem-Wr-Inval
[    8.252147] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    8.258941] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    8.266154] usb usb2: Product: xHCI Host Controller
[    8.271015] usb usb2: Manufacturer: Linux 4.8.3-kirkwood-tld-1 xhci-hcd
[    8.277618] usb usb2: SerialNumber: 0000:01:00.0
[    8.283086] hub 2-0:1.0: USB hub found
[    8.286930] hub 2-0:1.0: 2 ports detected
[    8.291575] xhci_hcd 0000:01:00.0: xHCI Host Controller
[    8.296857] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 3
[    8.304387] usb usb3: We don't know the algorithms for LPM for this host, disabling LPM.
[    8.312595] usb usb3: New USB device found, idVendor=1d6b, idProduct=0003
[    8.319384] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    8.326599] usb usb3: Product: xHCI Host Controller
[    8.331460] usb usb3: Manufacturer: Linux 4.8.3-kirkwood-tld-1 xhci-hcd
[    8.338770] usb usb3: SerialNumber: 0000:01:00.0
[    8.344251] hub 3-0:1.0: USB hub found
[    8.348023] hub 3-0:1.0: 2 ports detected
[    8.353215] mousedev: PS/2 mouse device common for all mice
[    8.643840] usb 2-1: new high-speed USB device number 2 using xhci_hcd
[    8.815704] usb 2-1: New USB device found, idVendor=0bc2, idProduct=3322
[    8.822379] usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[    8.829515] usb 2-1: Product: Expansion Desk
[    8.833772] usb 2-1: Manufacturer: Seagate
[    8.837872] usb 2-1: SerialNumber: NA8ERWZQ
[    8.953903] usb 3-2: new SuperSpeed USB device number 2 using xhci_hcd
[    8.984629] usb 3-2: New USB device found, idVendor=0bc2, idProduct=a0a4
[    8.991308] usb 3-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[    8.998443] usb 3-2: Product: Backup+ Desk
[    9.002520] usb 3-2: Manufacturer: Seagate
[    9.006622] usb 3-2: SerialNumber: NA5KY6LH
[    9.443833] rtc-mv f1010300.rtc: internal RTC not ticking
[    9.449425] i2c /dev entries driver
[    9.454335] hidraw: raw HID events driver (C) Jiri Kosina
[    9.460259] drop_monitor: Initializing network drop monitor service
[    9.466826] NET: Registered protocol family 17
[    9.471491] Key type dns_resolver registered
[    9.476804] registered taskstats version 1
[    9.480890] Loading compiled-in X.509 certificates
[    9.485745] zswap: loaded using pool lzo/zbud
[    9.512093] Key type encrypted registered
[    9.516845] hctosys: unable to open rtc device (rtc0)
[    9.523251] PM: Hibernation image not present or could not be loaded.
[    9.524794] Freeing unused kernel memory: 308K (c07dd000 - c082a000)
[    9.531121] This architecture does not have kernel memory protection.
[    9.620835] systemd-udevd[94]: starting version 215
[    9.819865] SCSI subsystem initialized
[    9.828523] usb 3-2: USB controller 0000:01:00.0 does not support streams, which are required by the UAS driver.
[    9.899635] usb 3-2: Please try an other USB controller if you wish to use UAS.
[    9.908613] mvsdio f1090000.mvsdio: Got CD GPIO
[    9.917622] libata version 3.00 loaded.
[    9.938523] usb-storage 3-2:1.0: USB Mass Storage device detected
[    9.967717] sata_mv f1080000.sata: version 1.28
[    9.971629] sata_mv f1080000.sata: slots 32 ports 1
[    9.979702] scsi host0: sata_mv
[    9.980209] ata1: SATA max UDMA/133 irq 32
[   10.010288] mmc0: host does not support reading read-only switch, assuming write-enable
[   10.014760] mmc0: new high speed SDHC card at address 1234
[   10.107392] usb-storage 3-2:1.0: Quirks match for vid 0bc2 pid a0a4: 2000000
[   10.124083] scsi host1: usb-storage 3-2:1.0
[   10.130556] usbcore: registered new interface driver usb-storage
[   10.136754] mmcblk0: mmc0:1234 SA16G 14.4 GiB
[   10.143545]  mmcblk0: p1
[   10.159060] scsi host2: uas
[   10.165687] usbcore: registered new interface driver uas
[   10.172335] scsi 2:0:0:0: Direct-Access     Seagate  Expansion Desk   9401 PQ: 0 ANSI: 6
[   10.306092] ata1: SATA link down (SStatus 0 SControl F300)
[   10.338936] sd 2:0:0:0: [sda] 5860533167 512-byte logical blocks: (3.00 TB/2.73 TiB)
[   10.347894] sd 2:0:0:0: [sda] 4096-byte physical blocks
[   10.354303] sd 2:0:0:0: [sda] Write Protect is off
[   10.359085] sd 2:0:0:0: [sda] Mode Sense: 4f 00 00 00
[   10.359618] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   10.593167]  sda: sda1 sda2
[   10.600757] sd 2:0:0:0: [sda] Attached SCSI disk
[   10.610244] sd 2:0:0:0: Attached scsi generic sg0 type 0
[   11.204659] scsi 1:0:0:0: Direct-Access     Seagate  Backup+ Desk     050B PQ: 0 ANSI: 6
[   11.215928] sd 1:0:0:0: [sdb] 732566645 4096-byte logical blocks: (3.00 TB/2.73 TiB)
[   11.225976] sd 1:0:0:0: Attached scsi generic sg1 type 0
[   11.237321] sd 1:0:0:0: [sdb] Write Protect is off
[   11.242110] sd 1:0:0:0: [sdb] Mode Sense: 4f 00 00 00
[   11.245575] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   11.478620]  sdb: sdb1 sdb2 sdb3
[   11.489419] sd 1:0:0:0: [sdb] Attached SCSI disk
[   20.892756] PM: Starting manual resume from disk
[   20.898053] PM: Hibernation image partition 8:17 present
[   20.898059] PM: Looking for hibernation image.
[   20.917798] PM: Image not found (code -22)
[   20.917809] PM: Hibernation image not present or could not be loaded.
[   21.173377] EXT4-fs (mmcblk0p1): mounting ext3 file system using the ext4 subsystem
[   21.224504] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
[   22.980451] systemd-udevd[314]: starting version 215
[   23.330612] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[   23.734537] marvell-cesa f1030000.crypto: CESA device successfully registered
[   23.770438] orion_wdt: Initial timeout 25 sec
[   24.901018] Adding 204796k swap on /dev/sdb1.  Priority:1 extents:1 across:204796k FS
[   24.988552] Adding 196600k swap on /dev/sda1.  Priority:1 extents:1 across:196600k FS
[   25.130911] EXT4-fs (mmcblk0p1): re-mounted. Opts: (null)
[   25.430881] EXT4-fs (mmcblk0p1): re-mounted. Opts: errors=remount-ro
[   26.587547] random: crng init done
[   27.976121] EXT4-fs (sdb2): mounted filesystem with ordered data mode. Opts: (null)
[   28.235768] EXT4-fs (sdb3): mounted filesystem with ordered data mode. Opts: (null)
[   28.667064] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
[   32.950245] NET: Registered protocol family 10
[   32.955919] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   33.976432] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control disabled
[   33.986284] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   41.978017] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
[   41.995822] NFSD: starting 90-second grace period (net c08a83d0)
[   61.484381] mv643xx_eth_port mv643xx_eth_port.0 eth0: link down
[   65.334125] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000 Mb/s, full duplex, flow control disabled

root@pogo:~# cat /proc/cmdline
console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)

root@pogo:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00020000 "u-boot"
mtd1: 00300000 00020000 "uImage"
mtd2: 00300000 00020000 "uImage2"
mtd3: 00800000 00020000 "failsafe"
mtd4: 07000000 00020000 "root"

root@pogo:~# cat /etc/fw_env.config
# MTD device name	Device offset	Env. size	Flash sector size	Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000

root@pogo:~# fw_printenv
bootcmd_exec=mw 0x800000 0 1; run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x800000 0x1100000 0x1c00000; else bootm 0x800000 0x1100000; fi; else if run load_dtb; then bootm 0x800000 - 0x1c00000; else bootm 0x800000; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
device=0:1
disks=0 1 2 3
ethact=egiga0
if_netconsole=ping $serverip
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; ext2load $bootdev $device 0x1c00000 $dtb_file
load_initrd=echo loading uInitrd ...; ext2load $bootdev $device 0x1100000 /boot/uInitrd
load_uimage=echo loading uImage ...; ext2load $bootdev $device 0x800000 /boot/uImage
mainlineLinux=yes
mtdids=nand0=orion_nand
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if ext2load $dev $disknum:1 0x800000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x810000
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x810000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15
arcNumber=3960
machid=f78
mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)
dtb_file=/boot/dts/kirkwood-pogoplug_v4.dtb
ethaddr=00:25:31:04:d8:e9
ipaddr=192.168.1.22
serverip=192.168.1.3
devices=mmc usb ide
bootdev=mmc

And still the same error

root@pogo:~# fw_setenv ipaddr '192.168.1.2'
Can't open /dev/mtd0: Permission denied
Error: can't write fw_env to flash
root@pogo:~# ls -la /dev/mtd0
crw------- 1 root root 90, 0 Dec 31  1969 /dev/mtd0

Thanks a bunch !

PS: my serial console actually works, i have the Rx/Tx/GND pins bought out of the case, but the Pogo is not in a very easy to reach area. I can get a ladder and get the serial output if it's really needed :-)



Edited 1 time(s). Last edit at 12/22/2016 03:26PM by psergiu.
Re: how to set MTDs writeable?
December 22, 2016 04:38PM
psergiu,


> PS: my serial console actually works, i have the
> Rx/Tx/GND pins bought out of the case, but the
> Pogo is not in a very easy to reach area. I can
> get a ladder and get the serial output if it's
> really needed :-)

No need to go that far :) Here is how to fix it.

As root:

cd /boot
touch uEnv.txt
echo "mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)" > uEnv.txt
Verify:
cat uEnv.txt

expected output:

mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)

Sync and reboot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to set MTDs writeable?
December 23, 2016 10:00AM
( facepalm for myself after realizing what was the issue )

It worked ... thanks a bunch Bodhi !
And i guess shivahoj must do exactly the same thing to fix his :)

I did a:
fw_setenv mtdparts 'mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)'
And now everything works with a empty uEnv.txt

People of the forum, remember: "mtdparts=mtdparts=orion_nand..." is NOT a typo, mtdparts= is supposed to appear twice. The boot scripts will cut-out the 1st "mtdparts=" and the the kernel needs the 2nd one.
Re: how to set MTDs writeable?
September 23, 2017 06:11AM
Hello,
now it worked, and i can use fw_setenv.
My mtdparts line is a bit different, since i am on a NSA320(Linux version 4.12.1-kirkwood-tld-1, U-Boot 2016.05-tld-1)

Just as a reminder for the others out there, here is my command lines(excerpt from my history):
cat /proc/cmdline
 cd /boot
 touch uEnv.txt
 echo "mtdparts=mtdparts=orion_nand:1M(u-boot),512K(uboot_env),512K(key_store),512K(info),10M(etc),10M(kernel_1),48896K(rootfs1),10M(kernel_2),-(rootfs2)" >uEnv.txt
 cat uEnv.txt
mtdparts=mtdparts=orion_nand:1M(u-boot),512K(uboot_env),512K(key_store),512K(info),10M(etc),10M(kernel_1),48896K(rootfs1),10M(kernel_2),-(rootfs2)



Edited 1 time(s). Last edit at 09/23/2017 06:11AM by shivahoj.
Re: how to set MTDs writeable?
December 31, 2021 03:22AM
Hello there. I must be blind, it's probably right in front of my eyes, but I can't figure it out...

# fw_setenv test test
Can't open /dev/mtd0: Permission denied
Error: can't write fw_env to flash

# uname -a
Linux dockstar-multimedia 5.10.0-8-marvell #1 Debian 5.10.46-3 (2021-07-28) armv5tel GNU/Linux


# cat /proc/cmdline
console=ttyS0,115200 root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=192.168.10.1:/srv/nfs/hosts/dockstar-1A8AAA,rsize=32768,wsize=32768,hard,intr,v3 ip=192.168.10.11:192.168.10.1::255.255.255.0:dockstar:eth0:off mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)


# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 0fb00000 00020000 "data"


# dmesg | grep -i mtd
[    0.000000] Kernel command line: console=ttyS0,115200 root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=192.168.10.1:/srv/nfs/hosts/dockstar-1A8AAA,rsize=32768,wsize=32768,hard,intr,v3 ip=192.168.10.11:192.168.10.1::255.255.255.0:dockstar:eth0:off mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
[    2.173189]     mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
[   23.936465] 3 fixed-partitions partitions found on MTD device orion_nand
[   23.943248] Creating 3 MTD partitions on "orion_nand":


# dmesg | grep -i 0x000
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[   22.184652] Bad eraseblock 1092 at 0x000008880000
[   22.337982] Bad eraseblock 1328 at 0x00000a600000
[   23.982877] 0x000000000000-0x000000100000 : "u-boot"
[   24.006601] 0x000000100000-0x000000500000 : "uImage"
[   24.038402] 0x000000500000-0x000010000000 : "data"


# fw_printenv
arcNumber=2998
autoload=no
baudrate=115200
bootcmd=run net_bootcmd
bootcmd.bak=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=3
bootdev=usb
console=ttyS0,115200
custom_params=init=/bin/systemd
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-dockstar.dtb
ethact=egiga0
ethaddr=00:10:75:1A:8A:AA
if_netconsole=ping $serverip
ipaddr=192.168.10.11
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x02000000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
net_bootcmd=run net_check_dhcp_c; run net_check_dhcp_s; run net_set_bootargs; run net_bootcmd_exec
net_bootcmd_exec=run net_load_uimage; if run net_load_initrd; then if run net_load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
net_check_dhcp_c=if test $net_dhcp_c -eq 1 ; then run net_set_c_ip_dhcp; else run net_set_c_ip_stat; fi;echo ** IP Address:  $ipaddr; echo ** Subnet Mask: $netmask; echo ** Def Gateway: $gatewayip
net_check_dhcp_s=if test $net_dhcp_s -eq 1 && test $net_dhcp_c -eq 1 ; then run net_set_s_ip_dhcp; else run net_set_s_ip_stat; fi; echo ** NFS Boot Server: $net_nfs_server; echo
net_dhcp_c=1
net_dhcp_s=1
net_load_dtb=echo NFS loading DTB     :$net_nfs_server:$net_nfs_path/$net_nfs_dtb ...   ; nfs $load_dtb_addr    $net_nfs_server:$net_nfs_path/$net_nfs_dtb; echo
net_load_initrd=echo NFS loading uInitrd :$net_nfs_server:$net_nfs_path/$net_nfs_initrd ...; nfs $load_initrd_addr $net_nfs_server:$net_nfs_path/$net_nfs_initrd; echo
net_load_uimage=echo NFS loading uImage  :$net_nfs_server:$net_nfs_path/$net_nfs_kernel ...; nfs $load_uimage_addr $net_nfs_server:$net_nfs_path/$net_nfs_kernel; echo
net_nfs_dtb=boot/dts/kirkwood-dockstar.dtb
net_nfs_initrd=boot/uInitrd
net_nfs_kernel=boot/uImage
net_nfs_path=/srv/nfs/hosts/dockstar-1A8AAA
net_set_bootargs=setenv serverip $net_nfs_server; setenv bootargs console=$console root=/dev/nfs rw rootfstype=nfs rootwait nfsroot=$net_nfs_server:$net_nfs_path,rsize=32768,wsize=32768,hard,intr,v3 ip=$ipaddr:$net_nfs_server:$gatewayip:$netmask:dockstar:eth0:off $mtdparts
net_set_c_ip_dhcp=dhcp; echo; echo ** Getting IP Settings by DHCP (net_dhcp_c = 1):
net_set_c_ip_stat=setenv ipaddr $net_c_ipaddr; setenv netmask $net_c_netmask; setenv gatewayip $net_c_gatewayip; echo; echo ** Using static IP Settings (net_dhcp_c = 0):
net_set_s_ip_dhcp=setenv net_nfs_server $serverip;echo; echo ** Getting NFS Boot Server by DHCP (net_dhcp_s and net_dhcp_c = 1):
net_set_s_ip_stat=echo; echo ** Using static NFS Boot Server (net_dhcp_s or net_dhcp_c = 0) :
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run bootcmd; fi
rescue_installed=1
rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=192.168.0.220
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15


# cat /etc/fw_env.config
# Configuration file for fw_(printenv/saveenv) utility. (DockStar)
# Up to two entries are valid; in this case the redundant
# environment sector is assumed present.
# Note that "Number of sectors" is ignored on NOR.

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


# ls -l /dev/mtd*
crw------- 1 root root 90, 0 2021-07-31 15:01 /dev/mtd0
crw------- 1 root root 90, 1 2021-07-31 15:01 /dev/mtd0ro
crw------- 1 root root 90, 2 2021-07-31 15:01 /dev/mtd1
crw------- 1 root root 90, 3 2021-07-31 15:01 /dev/mtd1ro
crw------- 1 root root 90, 4 2021-07-31 15:01 /dev/mtd2
crw------- 1 root root 90, 5 2021-07-31 15:01 /dev/mtd2ro

Re: how to set MTDs writeable?
December 31, 2021 03:26PM
tsunulukai,

> Hello there. I must be blind, it's probably right
> in front of my eyes, but I can't figure it out...

> # uname -a
> Linux dockstar-multimedia 5.10.0-8-marvell #1
> Debian 5.10.46-3 (2021-07-28) armv5tel GNU/Linux

The reason is you are running mainline kernel. Therefore the DTB is embedded inside uImage. And mainline DTS for the Dockstar has the mtd0 partition as read-only.

Look at the patch in my tarball: linux-5.15.5-kirkwood-tld-1.patch. The Dockstar DTS is patched as followed:

diff -Naur --no-dereference a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
--- a/arch/arm/boot/dts/kirkwood-dockstar.dts   2021-11-25 00:49:08.000000000 -0800
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts   2021-11-28 17:36:56.143843287 -0800
@@ -79,7 +79,6 @@
        partition@0 {
                label = "u-boot";
                reg = <0x0000000 0x100000>;
-               read-only;
        };
 
        partition@100000 {

So use my DTB in the kernel tarball: linux-5.15.5-kirkwood-tld-1-bodhi.tar.bz2 (linux-dtb-5.15.5-kirkwood-tld-1.tar).

And recreate your uImage like similar to Step 4b.

4b. Boot with DTB file embedded in the kernel image.Again, this step 4b is for stock U-Boot only. 

Please replace kirkwood-goflexnet.dtb below with the correct DTB name for your box. 

Generate the uImage and uInitrd (the kernel files vmlinuz-5.15.5-kirkwood-tld-1 and initrd.img-5.15.5-kirkwood-tld-1 were generated by dpkg in Step 3): 
cd /boot
mv uImage uImage.orig
mv uInitrd uInitrd.orig
cp -a zImage-5.15.5-kirkwood-tld-1  zImage.fdt
cat dts/kirkwood-goflexnet.dtb  >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.15.5-kirkwood-tld-1 -d zImage.fdt  uImage
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-5.15.5-kirkwood-tld-1 -d initrd.img-5.15.5-kirkwood-tld-1 uInitrd

If you had used my kernel build, then the installation instructs to load DTB separately. And there would be no problem with mtd0 locked down to read-only access, if the DTB is loaded separately.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 12/31/2021 03:36PM by bodhi.
Re: how to set MTDs writeable?
December 31, 2021 05:46PM
Hi Bodhi,

I run a custom de-bootstrapped Debian where the the DTB is not appended to the kernel file but loaded separately.
Replacing Debian's native DTB with yours in my /boot/dts/kirkwood-dockstar.dtb did the trick !

Many thanks for your (as always) helpful insight !
Happy New Year !
Re: how to set MTDs writeable?
December 31, 2021 06:17PM
tsunulukai Wrote:
-------------------------------------------------------
> Hi Bodhi,
>
> I run a custom de-bootstrapped Debian where the
> the DTB is not appended to the kernel file but
> loaded separately.

That's the way to do it!

> Replacing Debian's native DTB with yours in my
> /boot/dts/kirkwood-dockstar.dtb did the trick !

Cool :)

> Many thanks for your (as always) helpful insight
> !
> Happy New Year !

Happy New Year!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

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: