Welcome! Log In Create A New Profile

Advanced

how to backup/restore your NAND patitions and full device

Posted by ElMariachi 
how to backup/restore your NAND patitions and full device
August 03, 2016 01:06PM
Hello!

I could use an easy to follow guide, on how I could clone one GoFlexNet onto another GoFlexNet.
It should cover all possible data responsible for the characteristics of the device, so that's all NAND, including Bootloader, System and Env.
And I wonder where the device's Pogoplug ID is stored. Is it within one of the mtd partitions? Is it in env?
Would cloning one device onto another actually work?
Thank you! :)
Re: how to backup/restore your NAND patitions and full device
August 03, 2016 01:10PM
To start, look at this thread for the Pogo V4:

http://forum.doozan.com/read.php?3,16789,16789#msg-16789

So, you will need to do a very similar procedure for the GoFlex Net. Take a stab at listing the commands as you think it should be, and I'll correct it.

First, list the MTDs, and you will need to do nanddump for each of these to a file:

cat /proc/mtd

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 04, 2016 08:19AM
Ok. I'll start with the GFN, that I have modded some days ago, using your instructions for Debian 4 and rescue system. As at first I just intend creating full backups of the devices, without flashing, I directly executed the commands. I booted from the rescue system

rescue:/tmp# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 02000000 00020000 "rootfs"
mtd3: 0db00000 00020000 "data"
For the chance to possibly clone the whole system onto another device later, I'd like to use the more robust version:
nanddump --noecc --omitoob -l 0x80000 -f mtd0 /dev/mtd0

At this step I already have the first problem: Why is his length parameter "0x80000"?
By looking at the mtd-table (would partition table be correct?) I'd guess that the correct size for mtd0 would be 0x100000 and not 0x80000, so:
1. where does the correct size for the length parameter come from?

Also I have seen that there are two completely different lists of environment variables, depending on if I use printenv or if I use fw_printenv. (I have attached both, In case this isn't normal!)
2. What's the difference between both?
3. And would I need to backup both?

Then I have seen that there's no cesvcid on this GFN. It's neither stored in printenv nor in fw_printenv.
4. Where is cesvcid supposed to be stored? In printeven or in fw_printenv?
5. Where are the storages for both environment 'tables' actually located? Are they in one of the mtd partitions?
6. Is there a way for generating cesvcid back from the device's serial number or such?
7. What exactly is cesvcid good for? Is it just for identifying with Pogoplug's web services? Or is there more to it?

Thank you :)



Edited 7 time(s). Last edit at 08/04/2016 08:33AM by ElMariachi.
Attachments:
open | download - printenv.txt (992 bytes)
open | download - fw_printenv.txt (3.8 KB)
Re: how to backup/restore your NAND patitions and full device
August 04, 2016 01:16PM
For these mtds. You can just dump the entire partition and save each to a file.

nanddump --noecc --omitoob -f mtd0 /dev/mtd0
nanddump --noecc --omitoob -f mtd1 /dev/mtd1
nanddump --noecc --omitoob -f mtd2 /dev/mtd2
nanddump --noecc --omitoob -f mtd3 /dev/mtd3
After dumping, look at the size of each mtd file to verify they are correct.

Later to restore do this for each mtd. Use cat /proc/mtd to verify the partition layout is the same for the new box first.

nandwrite /dev/mtd0 mtd0

- fw_printenv is Debian command. printenv is u-boot command. They are the same.

- Where is cesvcid supposed to be stored?

It's one of the envs in stock u-boot envs.

- Where are the storages for both environment 'tables' actually located? Are they in one of the mtd partitions?

Irrelevant.

- Is there a way for generating cesvcid back from the device's serial number or such?

Set it back using fw_setenv after installing new u-boot.

- What exactly is cesvcid good for?

It's only relevant when you run stock OK.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 04, 2016 05:57PM
> - fw_printenv is Debian command. printenv is
> u-boot command. They are the same.

I assumed they where same until I discovered, that I get very different results when comparing both using both commands in rescue system. I have attached both to the last post, could you please have a look at it? I need to know, which envs I should use for replicating on the target device.



> - Where are the storages for both environment
> 'tables' actually located? Are they in one of the
> mtd partitions?
>
> Irrelevant.
Aren't these in mtdx? Maybe they are in an internal controller memory?

> - Is there a way for generating cesvcid back from
> the device's serial number or such?
>
> Set it back using fw_setenv after installing new
> u-boot.

What I meant is how to get the correct value for cesvcid if it isn't there anymore. So there is no way? Or is it arbitrary?

Thank you so far, for all your help!
Re: how to backup/restore your NAND patitions and full device
August 04, 2016 11:01PM
ElMariachi Wrote:
-------------------------------------------------------
> > - fw_printenv is Debian command. printenv is
> > u-boot command. They are the same.
>
> I assumed they where same until I discovered, that
> I get very different results when comparing both
> using both commands in rescue system. I have
> attached both to the last post, could you please
> have a look at it? I need to know, which envs I
> should use for replicating on the target device.
>

printenv.txt is from stock u-boot, fw_printenv.txt is from the new u-boot. They are at different location. You should save both.

In the new device, if you have backed up after installing new u-boot then the new u-boot settings should apply. If you back up MTDs while it is still stock u-boot then the stock printenv.txt should apply.

> What I meant is how to get the correct value for
> cesvcid if it isn't there anymore. So there is no
> way? Or is it arbitrary?

No, it is not arbitrary. Each device has a unique stock cesvcid, which determines the registration at pogoplug.com. If you are not going to do that, then there is no need for cesvcid.

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



Edited 1 time(s). Last edit at 08/04/2016 11:30PM by bodhi.
Re: how to backup/restore your NAND patitions and full device
August 07, 2016 03:59AM
Ok. I stored all partitions of my modded device and also stored all printenv and fw_printenv variables into files. Then I bootet another GoFlexNet device.
There I checked partiton table (all same), checked for bad blocks (none) and flashed all mtd files back into the regarding partiton. After this I checked "mtd_parts", it was already same as on the previous GFN.
Additonally I set the variables needed for net console to work:
fw_setenv serverip 192.168.1.2
fw_setenv ipaddr 192.168.1.100
fw_setenv if_netconsole 'ping $serverip'
fw_setenv start_netconsole 'setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;'
fw_setenv preboot 'run if_netconsole start_netconsole'


After rebooting the device, nothing happended at all, not even the LEDs where active anymore.
I can acces the device using kwboot, but I don't know why it wouldn't start normally, and I don't know what I could do from the kwbooted uboot. There's no rootfs available, I can't "ls" anything, nor can I transfer files in any way I know of.

I used the following uboot file:
kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2016.05-tld-1.goflexnet.mtd0.kwb  -p


All information I could get is:


[Type Ctrl-\ + c to quit]


U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:27:19 -0700)
Seagate GoFlex Net

SoC:   Kirkwood 88F6281_A1
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
Error: egiga0 address not set.

88E1116 Initialized on egiga0
*** ERROR: `ethaddr' not set
ping failed; host 192.168.1.35 is not alive
Hit any key to stop autoboot:  0 
*** ERROR: `ethaddr' not set
Wrong Image Format for bootm command
ERROR: can't get kernel image!
GoFlexNet>



GoFlexNet> printenv
baudrate=115200
bootargs=root=/dev/nfs nfsroot=192.168.1.35: ip=192.168.1.40:192.168.1.35:::::off
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=5
ethact=egiga0
if_netconsole=ping $serverip
ipaddr=192.168.1.40
preboot=run if_netconsole start_netconsole
serverip=192.168.1.35
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial

Environment size: 580/131068 bytes
GoFlexNet> version

U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:27:19 -0700)
Seagate GoFlex Net
gcc (Debian 4.9.2-10) 4.9.2
GNU ld (GNU Binutils for Debian) 2.25
GoFlexNet>

Actually I managed reviving LAN now, using:
env default -f ethaddr
env save
So I probably could reflash it now, if only I knew how to access files and devices.

Also it's howing me bad blocks now, though the 'dmesg|grep bad' I issued before flashing didn't reveal me any:
Device 0 bad blocks:
  094e0000
  09be0000
  0dc00000
  0e540000
GoFlexNet>
So are these bad blocks true or just caused by the erroneus system?

What would I need to do for making it boot itself and it's builtin OS again?
And how could I restore all envs from the backup files in one step instead of having to type "setenv ..." for every line?



Edited 9 time(s). Last edit at 08/07/2016 04:30AM by ElMariachi.
Re: how to backup/restore your NAND patitions and full device
August 07, 2016 02:35PM
ElMariach,

> Ok. I stored all partitions of my modded device
> and also stored all printenv and fw_printenv
> variables into files. Then I bootet another
> GoFlexNet device.
> There I checked partiton table (all same), checked
> for bad blocks (none) and flashed all mtd files
> back into the regarding partiton. After this I
> checked "mtd_parts", it was already same as on the
> previous GFN.
> Additonally I set the variables needed for net
> console to work:
>
> fw_setenv serverip 192.168.1.2
> fw_setenv ipaddr 192.168.1.100
> fw_setenv if_netconsole 'ping $serverip'
> fw_setenv start_netconsole 'setenv ncip $serverip;
> setenv bootdelay 10; setenv stdin nc; setenv
> stdout nc; setenv stderr nc; version;'
> fw_setenv preboot 'run if_netconsole
> start_netconsole'
>

Do you keep the log of your MTDs backup session, and the log of your MTDs restore session? please post them here. There might be errors during those.

>
> After rebooting the device, nothing happended at
> all, not even the LEDs where active anymore.

Nothing on serial console?


> I can acces the device using kwboot, but I don't
> know why it wouldn't start normally, and I don't
> know what I could do from the kwbooted uboot.
> There's no rootfs available, I can't "ls"
> anything, nor can I transfer files in any way I
> know of.

If the mtd0 was not nanddump/nandwrite properly, this could happen.

> I used the following uboot file:

> kwboot -t -B 115200 /dev/ttyUSB0 -b
> uboot.2016.05-tld-1.goflexnet.mtd0.kwb -p
>
>
> All information I could get is:
>
>
> [Type Ctrl-\ + c to quit]
> 
>
> U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:27:19
> -0700)
> Seagate GoFlex Net
>
> SoC: Kirkwood 88F6281_A1
> DRAM: 128 MiB
> WARNING: Caches not enabled
> NAND: 256 MiB
> In: serial
> Out: serial
> Err: serial
> Net: egiga0
> Error: egiga0 address not set.
>
> 88E1116 Initialized on egiga0
> *** ERROR: `ethaddr' not set
> ping failed; host 192.168.1.35 is not alive
> Hit any key to stop autoboot: 0
> *** ERROR: `ethaddr' not set
> Wrong Image Format for bootm command
> ERROR: can't get kernel image!
> GoFlexNet>

This what it means as "unbrickable" :) as long as you can kwboot it, you can restore it.

Let me upload the script of the default envs and you can run it in kwboot serial console to boot your current Debian rootfs.

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



Edited 1 time(s). Last edit at 08/07/2016 02:59PM by bodhi.
Re: how to backup/restore your NAND patitions and full device
August 07, 2016 02:57PM
On another Linux box, mount the Debian rootfs that you meant to run on this box and put the attached u-boot script in the /boot folder (if it was mounted at /media/sdb1):

cp -a uboot.2016.05-tld-1.environment.scr /media/sdb1/boot/

kwboot this box and interrupt serial console, run the script loading commands:

usb start
ext2load usb 0:1 0x800000 /boot/uboot.2016.05-tld-1.environment.scr
source 0x800000
printenv

Verify that the default envs look good as the source uboot.2016.05-tld-1.environment (which you've already downloaded).

Adjust the other specific envs and then boot the rootfs:
setenv devices 'usb ide'
setenv ethaddr xx:xx:xx:xx:xx:xx
setenv dtb_file '/boot/dts/kirkwood-goflexnet.dtb'
boot

Once you are in Debian, flash the uboot.2016.05-tld-1 and its default envs images like you did for the orignal box, and then adjust envs,...

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



Edited 1 time(s). Last edit at 08/07/2016 03:01PM by bodhi.
Attachments:
open | download - uboot.2016.05-tld-1.environment.scr (3.2 KB)
Re: how to backup/restore your NAND patitions and full device
August 07, 2016 03:52PM
Hello!

Sorry, I don't have logs of the nanddump and flashing process anymore.
The script results in:
Sending boot message. Please reboot the target.../
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]
  3 % [......................................................................]
  5 % [......................................................................]
  6 % [......................................................................]
  8 % [......................................................................]
 10 % [......................................................................]
 11 % [......................................................................]
 13 % [......................................................................]
 15 % [......................................................................]
 17 % [......................................................................]
 18 % [......................................................................]
 20 % [......................................................................]
 22 % [......................................................................]
 23 % [......................................................................]
 25 % [......................................................................]
 27 % [......................................................................]
 29 % [......................................................................]
 30 % [......................................................................]
 32 % [......................................................................]
 34 % [......................................................................]
 35 % [......................................................................]
 37 % [......................................................................]
 39 % [......................................................................]
 41 % [......................................................................]
 42 % [......................................................................]
 44 % [......................................................................]
 46 % [......................................................................]
 47 % [......................................................................]
 49 % [......................................................................]
 51 % [......................................................................]
 53 % [......................................................................]
 54 % [......................................................................]
 56 % [......................................................................]
 58 % [......................................................................]
 59 % [......................................................................]
 61 % [......................................................................]
 63 % [......................................................................]
 64 % [......................................................................]
 66 % [......................................................................]
 68 % [......................................................................]
 70 % [......................................................................]
 71 % [......................................................................]
 73 % [......................................................................]
 75 % [......................................................................]
 76 % [......................................................................]
 78 % [......................................................................]
 80 % [......................................................................]
 82 % [......................................................................]
 83 % [......................................................................]
 85 % [......................................................................]
 87 % [......................................................................]
 88 % [......................................................................]
 90 % [......................................................................]
 92 % [......................................................................]
 94 % [......................................................................]
 95 % [......................................................................]
 97 % [......................................................................]
 99 % [....................................]
[Type Ctrl-\ + c to quit]


U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:27:19 -0700)
Seagate GoFlex Net

SoC:   Kirkwood 88F6281_A1
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Using egiga0 device

Abort
ping failed; host 192.168.1.35 is not alive
Hit any key to stop autoboot:  0 
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> <INTERRUPT>
GoFlexNet> usb start
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
GoFlexNet> ext2load usb 0:1 0x800000 /boot/uboot.2016.05-tld-1.environment.scr
2845 bytes read in 279 ms (9.8 KiB/s)
GoFlexNet> source 0x800000
## Executing script at 00800000
Unknown command 'bootcmd_exec=run' - try 'help'
## Error: "load_initrd" not defined
## Error: "load_dtb" not defined
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   uboot.2016.05-tld-1.environment.
   Created:      2016-08-07  19:42:49 UTC
   Image Type:   ARM Linux Script (uncompressed)
   Data Size:    2781 Bytes = 2.7 KiB
   Load Address: 00000000
   Entry Point:  00000000
   Contents:
      Image 0: 2773 Bytes = 2.7 KiB
   Verifying Checksum ... OK
Wrong Image Type for bootm command
ERROR: can't get kernel image!
Unknown command 'bootcmd=run' - try 'help'
## Error: "scan_disk" not defined
## Error: "set_bootargs" not defined
## Error: "bootcmd_exec" not defined
Unknown command 'bootcmd_uenv=run' - try 'help'
## Error: "uenv_import" not defined
Unknown command 'devices=usb' - try 'help'
Unknown command 'disks=0' - try 'help'
Unknown command '192.168.1.35' - try 'help'
Unknown command 'led_error=orange' - try 'help'
Unknown command 'led_exit=green' - try 'help'
Unknown command 'led_init=green' - try 'help'
Unknown command 'loading' - try 'help'
10228 bytes read in 968 ms (9.8 KiB/s)
Unknown command 'load_initrd=echo' - try 'help'
6114335 bytes read in 499 ms (11.7 MiB/s)
Unknown command 'load_uimage=echo' - try 'help'
2822232 bytes read in 391 ms (6.9 MiB/s)
Unknown command 'preboot_nc=run' - try 'help'
Unknown command 'scan_disk=echo' - try 'help'
Scan device usb
device usb 0:1
1 bytes read in 242 ms (0 Bytes/s)
Found bootable drive on usb 0
Unknown command 'bootargs' - try 'help'
Unknown command 'ncip' - try 'help'



Edited 5 time(s). Last edit at 08/07/2016 04:32PM by ElMariachi.
Re: how to backup/restore your NAND patitions and full device
August 07, 2016 04:59PM
ElMariachi,

Sorry wrong source file! let me try again.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 07, 2016 05:26PM
I've just reattached the script. Please try again.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 08, 2016 09:13AM
Hello!

Debian is booting now, but I can't login:

[....] Starting OpenBSD Secure Shell server: sshd@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0666 for '/etc/ssh/ssh_host_rsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_rsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0666 for '/etc/ssh/ssh_host_dsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
. ok 
1775 (klogd)
. ok 
[warn] Not starting NFS kernel daemon: no exports. ... (warning).

Debian GNU/Linux 7 debian ttyS0

debian login: root

Login incorrect


And when I try connecting through SSH:
Read from socket failed: Connection reset by peer

I then deleted and recreated the Debian installation on the other, working GoFlexNet and tested login there. It was working and I cleanly shut down the system.
Then I put the drive into the bricked GoFlexNet and got the same login problem again.
And when i then moved the drive back to the working GoFlexNet then it had the login problem, too!
So it seems like booting from the 'side loaded' uboot destroys login of the Debian installation.

Edit:
Ok, after setting /etc/ssh/ssh_host_rsa_key to 004 I can login using SSH! I really wonder, why this doesn't happen when booting normally from UBoot on the other GFN.

When flashing UBoot I again occurred the bad block problem:root@debian:/tmp# dmesg|grep -i 'bad'
[ 1.477840] Scanning device for bad blocks
[ 1.609236] Bad eraseblock 1191 at 0x0000094e0000
[ 1.619905] Bad eraseblock 1247 at 0x000009be0000
[ 1.679371] Bad eraseblock 1760 at 0x00000dc00000
[ 1.691947] Bad eraseblock 1834 at 0x00000e540000
root@debian:/tmp#

From the UBoot instructions I take, that this shouldn't be a problem for UBoot, because all the blocks are far above block 7. But I guess it is going to be a problem for flashing the rescue system? Boot is working again, so far! :)



Edited 7 time(s). Last edit at 08/08/2016 10:00AM by ElMariachi.
Re: how to backup/restore your NAND patitions and full device
August 08, 2016 12:37PM
I successfully flashed the rescue system onto the device now, too.

After all there where some env changes needed here and there.
May I ask you for having a final look at it, if it's ok or could provoke some problems?

rescue:~# fw_printenv 
arcNumber=3089
baudrate=115200
bootargs=root=/dev/nfs nfsroot=192.168.1.35: ip=192.168.1.40:192.168.1.35:::::off
bootcmd=sleep 3; run scan_disk; run set_bootargs; run bootcmd_exec; run bootcmd_pogo; reset
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_pogo=run bootcmd_rescue
bootcmd_rescue=run set_bootargs_rescue; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi; sleep 3
bootdelay=10
bootdev=usb
bootfile=uImage-mtd1.img
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-goflexnet.dtb
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
fileaddr=800000
filesize=ca0
if_netconsole=ping $serverip
ipaddr=192.168.1.40
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=0x1c00000
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)
nand_erasesize=20000
nand_oobsize=40
nand_writesize=800
nc_ready=1
ncip=192.168.1.35
partition=nand0,2
preboot=run preboot_nc
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
rescue_installed=1
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.1.35
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
set_bootargs_rescue=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts
sleep_period=3
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=nc
stdin=nc
stdout=nc
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
rescue:~#

Thank you for all your help! :)
Re: how to backup/restore your NAND patitions and full device
August 08, 2016 11:38PM
ElMariachi,

Everything looks OK!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
I am new to this stuff and need advice on restoring Pogoplug V4-A1and V4-A3. I got kwboot working and sent u-boot into the A1 but still is not back
To normal Pogoplug after Debian install. Can I use kwboot to load the Linux tar or how to completely restore pogo back to original. I am getting old and hard to follow some of this stuff. I am using Ubuntu on my PC. Have only serial interface. Thanks
Re: how to backup/restore your NAND patitions and full device
August 09, 2016 04:03AM
Chuck,

You need to describe a little bit more. Or just do the following.

Boot with kwboot then interrupt serial console and
printenv
and then go ahead boot the USB rootfs (I assume you have already created the Debian 4.4 rootfs on USB).
boot
And post the entire log here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 09, 2016 01:26PM
kwboot will replace your bootloader he moment you boot it. If there's a working system (rootfs) on your device and all environment settings are right, you might be able to fully boot the system using kwboot. Otherwise you might need to first start the device using kwboot and then interrupt the boot process (using ctrl-c or any key during the countdown), Then you can change your environment settings so, that it's able for booting a Debain installation on usb media. You can create the usb media easily using a Linux PC, or any PC using any Linux live CD (just format the usb device to one partition, name the partition rootfs and copy the contents of the Debian archive (rootfs) completely to the new partition.)
Re: how to backup/restore your NAND patitions and full device
August 09, 2016 07:14PM
I installed Debian and Samba on the Mobile V4-A1. It was working fine. At least I was learning Linux. Then I thought I would be smart and
copy the sd card on my Ubuntu machine for a backup. Not a good idea! It had to be un-protected in order to mount. I made a disk image
of the sd card. Then put the original back in and booted up. Just fine except the password files were not there. Made a copy with the image
file and of course it was same. So now my main thing is to find out how to restore Pogoplugs back to original state. I did save the MTD0 thru
MTD4 files from both models before starting Debian load. How do you put them back in the Pogoplug with serial interface only. I have not been able to
find that anywhere in a language that I could understand. Maybe I do not really know how Pogoplug hardware is designed. Thanks for
your quick reply.
Re: how to backup/restore your NAND patitions and full device
August 09, 2016 07:28PM
Chuck,

Do what I asked above (get a serial console log) and we'll go from there:
http://forum.doozan.com/read.php?3,29362,29412#msg-29412

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 10, 2016 08:03PM
Okay, I will try to capture it and printenv. I thought it would be simple with the MTD files already saved. I just need to get them back inside the Pogoplug ram and erase & flash.
My Uboot is working ok and I have a POGO4> prompt & a CE> prompt. Thanks
Re: how to backup/restore your NAND patitions and full device
August 13, 2016 01:46PM
Here is the printenv.

(I assume you have already created the Debian 4.4 rootfs on USB). Answer is NO.
I just got finished downloading and trying follow instructions with Ubuntu and did not work for me. I am a neophyte at this stuff. I really want to learn how to restore my Pogoplugs to factory default so I can sell them when done learning what I can with Debian and Archlinux. It is very easy to mess them up even with cut and paste and sometimes there is a typo. Thanks, Chuck



Edited 1 time(s). Last edit at 08/13/2016 03:04PM by Chuck99.
Attachments:
open | download - PogoplugV4Log.txt (2.3 KB)
Re: how to backup/restore your NAND patitions and full device
August 13, 2016 03:38PM
Chuck99 Wrote:
-------------------------------------------------------
> Here is the printenv.
>
> (I assume you have already created the Debian 4.4
> rootfs on USB). Answer is NO.
> I just got finished downloading and trying follow
> instructions with Ubuntu and did not work for me.
> I am a neophyte at this stuff. I really want to
> learn how to restore my Pogoplugs to factory
> default so I can sell them when done learning what
> I can with Debian and Archlinux. It is very easy
> to mess them up even with cut and paste and
> sometimes there is a typo. Thanks, Chuck

Chuck,

Your u-boot is an older version of mine (2014), but it should work fine if you boot with the Debian 4.4 rootfs.

When you create the USB rootfs on Ubuntu, you need to follow the instruction very closely:

- being root user (not sudo),
- create 1 Ext3 partition,
- and untar the tarball.
- Your u-boot envs as default will need step 4. If you prefer not to do step 4 (because you're not sure) then we can adjust them in serial console to boot the Debian 4.4 rootfs as is (skip step 4).

If you'd like, post the entire log of how you create the rootfs (don't do step 4). And I'll write you instruction boot with some adjustment in u-boot console.

It would be a waste to go back to stock, since you've gotten this far!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 13, 2016 08:42PM
That is my main objective, to learn how to quickly put them back to stock. I will try to figure out how to be a root user in Ubuntu. Why does every forum say to dump your mtd0, etc. if you can not put it back in with serial console?

I was able to get ssh working with Debian. This may help a lot. Had a problem with permissions on sd card file. Fixed it and ssh came alive.I am now going to work on my V4-A3 model.

Could someone tell me step by step how to restore the dumped mtd0-mtd4 via serial interface. I am trying to get back to the beginning so I can try different things on my V4-A1 and V4-A3. Thankyou



Edited 2 time(s). Last edit at 08/17/2016 10:13PM by Chuck99.
Re: how to backup/restore your NAND patitions and full device
August 21, 2016 02:58PM
I have really messed it up now. Only way to get into Mobile device is via kwboot. How can I restore uboot that is loaded with kwboot. If I power off it goes away. I am working on the task of making a USB drive with Debian & Linux. In the mean time I would like to restore it back to factory Pogoplug state.
Attachments:
open | download - Pogoplug _V4-A1-01.txt (7.8 KB)
Re: how to backup/restore your NAND patitions and full device
August 21, 2016 04:50PM
Chuck,

Sine you can kwboot the box like this, so you can proceed to boot the Debian rootfs without changing u-boot envs. From there you can decide whether to restore stock MTDs if you want.

Quote

Updated 20 Feb 2016:

This Debian-4.4.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2 is to keep in sync with kernel Linux-4.4.0-kirkwood-tld-1.

Basic minimal Debian Kirkwood rootfs for most Kirwood plugs

The most important thing in the procedure is to become root. On Ubuntu, to become root you would just:

- open a terminal
- execute command
su
and then enter your user password. And then verify you are root
whoami

The rest of the steps are simple to perform. If you'd like, post questions along the way and I will help you. Give it a shot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 22, 2016 01:56AM
Thanks I will get started. Did you get my message about the bricked V4 Mobile?
Re: how to backup/restore your NAND patitions and full device
August 22, 2016 05:06PM
How can you kwboot the uboot into the Pogoplug and put it into mtd0? When I reset the box it is lost. Or do you not want to do that for some reason?
Re: how to backup/restore your NAND patitions and full device
August 22, 2016 06:52PM
Chuck99 Wrote:
-------------------------------------------------------
> How can you kwboot the uboot into the Pogoplug and
> put it into mtd0? When I reset the box it is
> lost. Or do you not want to do that for some
> reason?

Kwboot does not write to NAND. It's a way to test new uboot without committing. And also a recovery mechanism when uboot stored in NAND is bad.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 22, 2016 09:06PM
I just want to know if I can nandwrite write the kwboot loaded Uboot into mtd0.
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: