Welcome! Log In Create A New Profile

Advanced

how to backup/restore your NAND patitions and full device

Posted by ElMariachi 
Re: how to backup/restore your NAND patitions and full device
August 22, 2016 11:21PM
Chuck99 Wrote:
-------------------------------------------------------
> I just want to know if I can nandwrite write the
> kwboot loaded Uboot into mtd0.

You could. But doing that Debian is a lot easier. Are you giving up on booting Debian?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 23, 2016 02:03AM
I would like to learn how to restore these plugs back to factory quickly. In all these forums no one tells you exactly how to do it. Then I can start again in my own pace to try different things like alarm, Debian. Ubuntu is a pain. It never works exactly like everyone says. I got to root but still get permission trouble. Only thing I have working well is kwboot. At 70 years old the brain is slowing down. I have years writing Motorola 6800 code and Z80. Have been in computers since I was hired at 19 yrs. old by IBM.
It bothers me that everyone says save your MTD0-4 but no one uses them to restore machine. Why is that. My serial interface works great.
Re: how to backup/restore your NAND patitions and full device
August 23, 2016 02:47AM
Chuck99 Wrote:
-------------------------------------------------------
> I would like to learn how to restore these plugs
> back to factory quickly. In all these forums no
> one tells you exactly how to do it. Then I can
> start again in my own pace to try different things
> like alarm, Debian. Ubuntu is a pain. It never
> works exactly like everyone says. I got to root
> but still get permission trouble. Only thing I
> have working well is kwboot. At 70 years old the
> brain is slowing down. I have years writing
> Motorola 6800 code and Z80. Have been in computers
> since I was hired at 19 yrs. old by IBM.
> It bothers me that everyone says save your MTD0-4
> but no one uses them to restore machine. Why is
> that. My serial interface works great.

OK Chuck :) I'll write instruction for you. I understood, it's a tried and true method to start fresh. Stick around, don't sell your box.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 23, 2016 02:59AM
Let me update the Wiki post

Section

Quote

Booting Debian on Pogoplug

How to set up U-Boot for booting in multiple drives configuration
Backup and Restore NAND mtds
UART Booting HowTo for Selected Kirkwood Devices
Migrating from Arch to Debian?
How to boot new Debian rootfs using stock u-boot tftp

And will tell you when it is done.

In the mean time look at that section "Backup and Restore NAND mtds" to see how you would restore it inside Debian.

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



Edited 1 time(s). Last edit at 08/23/2016 03:00AM by bodhi.
Re: how to backup/restore your NAND patitions and full device
August 23, 2016 09:35AM
Thank you sir.
Re: how to backup/restore your NAND patitions and full device
August 23, 2016 11:22AM
Thanks Bodhi, I am not ready to sell them yet. hi hi I would rather learn the architecture of the box. I enjoy modifying them for other tasks. Thanks
Re: how to backup/restore your NAND patitions and full device
August 24, 2016 02:37AM
@Chuck,

The instruction (Backup and Restore NAND mtds)

Quote

B. How to restore NAND in Serial Console:

is up in the Wiki post linked above.

UPDATE:

OK, it's done now. Go ahead.

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



Edited 2 time(s). Last edit at 08/24/2016 03:07AM by bodhi.
Re: how to backup/restore your NAND patitions and full device
August 24, 2016 10:43AM
Thank you. I will try it today. Looks easy to me. One question. When dumping mtd0 etc. what is the .oob file?
Re: how to backup/restore your NAND patitions and full device
August 24, 2016 11:52PM
Followed instructions with no errors. Mtd0 went clean. Would not work. Had to use kwboot to re access. After loading mtd1 same thing. Loaded mtd2 now have not got kwboot to work again. Funny thing if I put the mmc card in the front led blinks rapidly and I can ping lan address but can not ssh or telnet. Connection refused. Mmc card has some Debian files from my attempt to make the Debian rescue I think. Why do you see addresses shown two ways? I.e.: 0x00800000 and 0x800000. This may be why it is almost bricked. Thanks
Re: how to backup/restore your NAND patitions and full device
August 25, 2016 02:17AM
Chuck,

> Followed instructions with no errors. Mtd0 went
> clean. Would not work.

Perhaps the backed up mtd0 was bad.

> Had to use kwboot to re
> access. After loading mtd1 same thing. Loaded
> mtd2 now have not got kwboot to work again.

kwboot should work regardless how messed up the NAND partitions are. They don't even come in to play at all.

> Funny
> thing if I put the mmc card in the front led
> blinks rapidly and I can ping lan address but can
> not ssh or telnet. Connection refused. Mmc card
> has some Debian files from my attempt to make the
> Debian rescue I think.

When did it happen? after the flashing of mtd0 and power cycle?

> Why do you see addresses
> shown two ways? I.e.: 0x00800000 and 0x800000.

They are the same to u-boot.

You know what, i'd suggest that you get kwboot to work again, and get the new Debian rootfs created on USB, boot with it. Capture serial console log and post here so I can take a look to see what's wrong.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 25, 2016 02:30AM
I will definitely give it a try. I was thinking why doesn't kwboot loop looking for activity from serial interface? Does the Pogoplug not send anything until it receives a nak or something? You see many techniques using kwboot. What exactly is the correct way. Once I see any reply from Pogoplug I know I have it made. Just a pain to keep cycling power to plug.
What is best to use for a learning tool. Archlinux or Debian?



Edited 1 time(s). Last edit at 08/25/2016 02:32AM by Chuck99.
Re: how to backup/restore your NAND patitions and full device
August 25, 2016 03:00AM
Chuck,

> I was thinking
> why doesn't kwboot loop looking for activity from
> serial interface? Does the Pogoplug not send
> anything until it receives a nak or something?

kwboot uses xmodem protocol to talk to the box. This is because the Kirkwood bootRom has this built-in logic that it will look for data in the UART0 port upon power up (before it tries NAND u-boot). And then it tries to detect an xmodem message. Once it sees the xmodem message, it will Ack and then starts receiving the image.

> You
> see many techniques using kwboot. What exactly is
> the correct way. Once I see any reply from
> Pogoplug I know I have it made. Just a pain to
> keep cycling power to plug.

With the Pogo V4, just power up and Control-C when you see any error output (or wait for 1 second), recall the kwboot command, execute it again. You might need to repeat it many times until the handshake occurs (this is a Pogo V4 quirk, other boxes should handshake right away). No need to cycle the power.

> What is best to use for a learning tool. Archlinux
> or Debian?

Use Debian. The command line syntax is easier and will experience less breakage when you update the system. Arch is a rolling release so it will break your system sometime.

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



Edited 2 time(s). Last edit at 08/25/2016 03:04AM by bodhi.
Re: how to backup/restore your NAND patitions and full device
August 25, 2016 01:09PM
How to you "Please reboot the target" without power cycling the Pogoplug?
Re: how to backup/restore your NAND patitions and full device
August 25, 2016 02:44PM
device nand0 <orion_nand>, # parts = 5
#: name size offset mask_flags
0: u-boot 0x00200000 0x00000000 0
1: uImage 0x00300000 0x00200000 0
2: uImage2 0x00300000 0x00500000 0
3: failsafe 0x00800000 0x00800000 0
4: root 0x07000000 0x01000000 0

Everything seems to work fine without errors writing nand but can not load mtd4 into 0x800000. Gets a timeout or something. I will have to capture it. That file is 121 megabytes in size. Could it be it is exceeding the size of the ram buffer at 0x800000? I can kwboot fine to this V4-A1 now. Need to replace root I think.
Re: how to backup/restore your NAND patitions and full device
August 25, 2016 03:02PM
Once you have the u-boot partition restored, why wouldn't you boot up Debian from USB and then use the nandwrite tool to restore the other partitions? This would provide better error handling and feedback than the limited tools available inside u-boot itself.

Ray
Re: how to backup/restore your NAND patitions and full device
August 25, 2016 03:20PM
Chuck,

> Everything seems to work fine without errors
> writing nand but can not load mtd4 into 0x800000.
> Gets a timeout or something. I will have to
> capture it. That file is 121 megabytes in size.
> Could it be it is exceeding the size of the ram
> buffer at 0x800000?

This is one of the reasons I would not recommend you flashing in u-boot.

> I can kwboot fine to this
> V4-A1 now.

But stock u-boot that you flashed back did not work, so you can't boot stock! and you don't even need stock u-boot restored to boot Debian, since kwboot works :)

> Need to replace root I think.

You do need to create a rootfs to run Linux. So why not just go ahead and do that now?

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



Edited 2 time(s). Last edit at 08/25/2016 03:47PM by bodhi.
Re: how to backup/restore your NAND patitions and full device
August 25, 2016 03:53PM
These things do strange stuff. Now kwboot stopped working after last attempt to load mtd4 but now I get a CE>> prompt everytime. What is difference between PPV4>> and CE>> prompt? I see I can not start usb for one thing.
Re: how to backup/restore your NAND patitions and full device
August 25, 2016 04:48PM
Chuck99 Wrote:
-------------------------------------------------------
> These things do strange stuff. Now kwboot stopped
> working after last attempt to load mtd4 but now I
> get a CE>> prompt everytime. What is difference
> between PPV4>> and CE>> prompt? I see I can not
> start usb for one thing.

Ah! that's stock u-boot running. Not stragnge at all. It meant your mtd0 was restored.

So now it is running, go ahead and
boot
See if you can boot into stock.

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



Edited 1 time(s). Last edit at 08/25/2016 04:49PM by bodhi.
Re: how to backup/restore your NAND patitions and full device
August 26, 2016 01:50PM
The V4-A1 will not kwboot not. So I set it aside for awhile. The V4-A3 now connects to Pogoplug.com but can't find andy memory. Says it is off line. I think I have a mix of things running. It does not have SSH but serial still works and I can get a # cursor so something is working. I have attached log and ls of /sbin. Linux is working I presume to some extent. I am going to work on the Debian rootsf now.
Attachments:
open | download - PogoV4A3_3A2C.odt (23.7 KB)
Re: how to backup/restore your NAND patitions and full device
August 26, 2016 05:35PM
Pogoplug.com is no longer usable. Stock OS should only be a vehicle to install new Debian/Arch rootfs and new u-boot.

In the mean time, to make it easier to log in to the box. In stock OS, to kill pogoplug service and start SSH.

edit the file /etc/init.d/rcS
###/etc/init.d/hbmgr.sh start
/usr/sbin/dropbear

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 26, 2016 06:27PM
Yes, I know about Pogoplug guys. They are really ripping people off but so far I have 3 accounts that are old enough that they are leaving active without cloud and no monthly fee as before. I only use them for picture backups etc. from iPad & iPhones. Your are correct. I did do most of the Debian on USB memory. Now I just need to know what to do with it. Notes 1& 2 after procedure do not make since to me. Could you point me to your complete starting from scratch procedure to install Debian on V4-A3. I have 2 things I would like to do. Set up an easy to use NAS and I would like to connect my IP Cemeras to there own NAS. Thank you.
Re: how to backup/restore your NAND patitions and full device
August 26, 2016 07:24PM
Chuck,

Just do as Note 1 said. It is to secure your box, in case you have it facing the net. Ignore Note 2, unecessary for you. But these are done *after* you have booted into Debian. So wait until later.

The best way to learn is to set out and do it. Create the rootfs on USB. Capture everything you did in a log, and post it here. I will look and point out any misstep you might have made, and answer questions that you annotated in the log.

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



Edited 1 time(s). Last edit at 08/26/2016 07:25PM by bodhi.
Re: how to backup/restore your NAND patitions and full device
August 27, 2016 08:23PM
I think I am done with Debian on USB do I have to do the Linux compile next or do I need that?
Re: how to backup/restore your NAND patitions and full device
August 27, 2016 11:30PM
Chuck99 Wrote:
-------------------------------------------------------
> I think I am done with Debian on USB do I have to
> do the Linux compile next or do I need that?

After you created the rootfs on USB, you can start on booting it. Are you keeping stock u-boot, or going to install new u-boot? If you're going to install new u-boot then you should do it now.

If you're keeping stock u-boot, then some adjustment is needed. Depending on whether you did step 4 while creating the rootfs 4.4.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 28, 2016 05:42PM
I have now booted Debian from USB. I had to first run kwboot with your .kwb file. Now what? Will it load without kwboot now or do I need to change mtd's? I have left it alone now.
Shall I put in your Uboot next?
Attachments:
open | download - Debian Boot USB.odt (25.4 KB)
Re: how to backup/restore your NAND patitions and full device
August 28, 2016 05:49PM
Nice to have SSH!

I think this text file is bad. .odt file should be good.



Edited 1 time(s). Last edit at 08/28/2016 05:53PM by Chuck99.
Attachments:
open | download - Debian Boot USB.txt (36.8 KB)
Re: how to backup/restore your NAND patitions and full device
August 28, 2016 11:26PM
Chuck,

Congrats :) Debian has booted.

One more thing: because the DTB (the kernel file device tree file that describes the hardware) was the GoFlex Net DTB (you have appended it when you created the rootfs), it was booted as the GoFlex Net.

Quote
Rootfs instruction

4. Create uImage with embedded DTB for booting with older u-boots (2012 or earlier). Skip this step if you have installed the latest U-Boot for Kirkwood (or are installing this u-boot at the same time).

Please replace kirkwood-goflexnet.dtb below with the correct DTB name for your box (see the folder /media/sdb1/boot/dts).

Generate the uImage with DTB embedded inside:
cd /media/sdb1/boot
cp -a zImage-4.4.0-kirkwood-tld-1 zImage.fdt
cat dts/kirkwood-goflexnet.dtb >> zImage.fdt
mv uImage uImage.orig
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-4.4.0-kirkwood-tld-1 -d zImage.fdt uImage
sync

In your box, this should have been
cat dts/kirkwood-pogoplug_v4.dtb  >> zImage.fdt

So to fix it:

Boot in to Debian
cd /boot
cp -a uImage.orig uImage 
cp -a zImage-4.4.0-kirkwood-tld-1  zImage.fdt
cat dts/kirkwood-pogoplug_v4.dtb  >> zImage.fdt
mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-4.4.0-kirkwood-tld-1 -d zImage.fdt  uImage
sync

Shutdown
sync
shutdown -h now

Reboot with kwboot, observe the front LED light. Green LED will flash quickly, becomes solid Orange, and then becomes solid Green. That's when the kernel has booted. Wait about 10 seconds for the rootfs to be mounted. And try to SSH in.

Execute my customed command (it's a shell alias defined in /root/.profile).
myinfo
This should show that your system is a Pogoplug V4, your IP address, your Linux version, and your boot command.

This time when you shutdown
sync
shutdown -h now
The LED light will turn off after the system power was off. Wait a couple of seconds. This is when it's safe to remove the USB rootfs if you want to make a backup.


After verifying Debian is running correctly, you can proceeed to install new u-boot. The instruction is a little bit overwhelming, because it was written to cover all Kirkwood boxes. So copy it, and reword the commands for Pogplug V4. If you'd like, post the series of commands that you think you should run here and I'll take a look.

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



Edited 1 time(s). Last edit at 08/28/2016 11:29PM by bodhi.
Re: how to backup/restore your NAND patitions and full device
August 29, 2016 11:07AM
cp -a uImage.orig uImage
cp: cannot create regular file 'uImage':Read-only file system.
I assume this means I need to make uImage r/w but I forgot the command.

Would it be ok to update uboot so I don't have to boot with kwboot to get Debian loaded.



Edited 1 time(s). Last edit at 08/29/2016 03:08PM by Chuck99.
Re: how to backup/restore your NAND patitions and full device
August 30, 2016 12:10AM
Chuck,

> Would it be ok to update uboot so I don't have to
> boot with kwboot to get Debian loaded.

Yes. It would be OK now to update u-boot.

After updating u-boot, you need to correct the uImage before rebooting. This is because the new u-boot default is to boot with separated DTB.

cd /boot
cp -a uImage.orig uImage

If you still have trouble copying the uImage file then post the output of:
cat /etc/fstab
mount

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: how to backup/restore your NAND patitions and full device
August 30, 2016 01:31PM
running sudo gtkterm with Ubuntu trying to cp -a uImage.orig uImage and cp -a zImage-4.4.0-kirkwood-tld-1 zImage.fdt it says "read-only file system". tried chown and chmod. what now?
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: