Welcome! Log In Create A New Profile

Advanced

revive Medion oxnas stg-212

Posted by alexinc 
Re: revive Medion oxnas stg-212
April 04, 2023 04:46PM
alexinc Wrote:
-------------------------------------------------------
> bodhi Wrote:
> -------------------------------------------------------
> > > it's just funny, that everywhere
> > > gets written the device is unbrickable
> >
> > That statement is only about Cloudengine Pogo
> V3
> > Pro/Classic.
>
> i thought pogoplug classic shares the same base?

Yes. Pogo V3 Pro and Pogo V3 Classic are basiclly the same. The Classic does not have Wifi (mPCIe slot).

>
> > Also, if you look at how OpenWrt load and boot
> its
> > kernel, it is different . If you can find the
> > OpenWrt uImage location in their tree, download
> > it. And then after you started the HDD u-boot
> and
> > boot to the prompt, follow their way of loading
> > uImage (but loading from HDD or USB storage),
> and
> > booting (it is definitely different from
> booting
> > Debian). That will at least get you to boot the
> > kernel, the OpenWrt rootfs in NAND will come in
> to
> > play much later.
>
> not sure if i got your point here. i tried the
> following.

Interrupt the count down

> Hit any key to stop autoboot:  0

And then

setenv bootargs 'console=ttyS0,115200 earlyprintk=serial

And then boot like you did above.

OX820> ide reset
OX820> ext2load ide 0:2 64000000 /owrt19/openwrt-19.07.5-oxnas-ox820-mitrastar_stg-212-initramfs-uImage
OX820> bootm 64000000

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 09:14AM
thanks, but that's basically what i already did in my last post and what keeps hanging at "Starting kernel ..."
U-Boot SPL 2013.10-ga72eb8f-dirty (Feb 19 2014 - 15:21:12)
  Boot device: SATA
Attempting to set PLLA to 800 MHz ...
  plla_ctrl0 : 0000030a
  plla_ctrl1 : 00400000
  plla_ctrl2 : 007f0068
  plla_ctrl3 : 00000193

PLLA Set
Bus 0: OK
  Device 0:
reading bootargs.bin
reading u-boot.img
reading u-boot.img


U-Boot 2015.10-tld-2 (Oct 21 2017 - 22:00:02 -0700)
OXNAS OX820

DRAM:  128 MiB
NAND:  128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   dwmac.40400000
Hit any key to stop autoboot:  0
OX820> setenv bootargs 'console=ttyS0,115200 earlyprintk=serial'
OX820> ide reset

Reset IDE: Bus 0: OK
  Device 0: Model: Crucial_CT275MX300SSD1 Firm:  M0CR070 Ser#: 17251799E2D8
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 262321.6 MB = 256.1 GB (537234768 x 512)
OX820> ext2load ide 0:2 64000000 /owrt19/openwrt-19.07.5-oxnas-ox820-mitrastar_stg-212-initramfs-uImage
5698471 bytes read in 730 ms (7.4 MiB/s)
OX820> bootm 64000000
## Booting kernel from Legacy Image at 64000000 ...
   Image Name:   ARM OpenWrt Linux-4.14.209
   Created:      2020-12-06   7:31:03 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5698407 Bytes = 5.4 MiB
   Load Address: 60008000
   Entry Point:  60008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...
Edit: according to https://forum.doozan.com/read.php?4,86219 it seems "Starting kernel ..." means OpenWRT is started in RAM and accessible through LAN - that's what i'm trying next.



Edited 1 time(s). Last edit at 04/05/2023 11:20AM by alexinc.
Re: revive Medion oxnas stg-212
April 05, 2023 02:18PM
alexinc,

> Starting kernel ...
> [/code]
> Edit: according to
> https://forum.doozan.com/read.php?4,86219 it seems
> "Starting kernel ..." means OpenWRT is started in
> RAM and accessible through LAN - that's what i'm
> trying next.

That seems to hang in decompression error the same way. But we cannot see the output. The change above was to see the error early, but apparently OpenWrt kernel does not support early printk.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 02:35PM
at least at work i didn't manage to connect to openwrt for now. would the belonging ip to connect to be that one defined in u-boot env "ethaddr" or is it 192.168.1.1 (like i found googleing for openwrt initramfs images)? not seeing if it hangs again, doesn't make it easier... ;-)

then i'm almost out of ideas what to try next. i can boot rescue hdd, change between u-boot from debian and openwrt, learned how to mtdparts and nand.part erase e.g. but nothings helps to start a basic linux on this box or re-write u-boot to nand for now. :-/
Re: revive Medion oxnas stg-212
April 05, 2023 02:48PM
alexinc,

Another approach is to run a complete OpenWrt installation. And that means you need to restore NAND u-boot to stock first. And then going through their installation procedure.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 02:56PM
that's what i already tried using https://github.com/jedie/NAS7820-Tools/tree/master/flash-recovery-hdd/MedionNAS but it fails too. it boots from the created hdd, but fails to read the belonging sectors or whatever. of course i would try going back to original too, if there's a working way to do so. i'm still up for anything, except throwing it to the bin after all this lifetime i've already spent into this little b**ch. ;-)
Re: revive Medion oxnas stg-212
April 05, 2023 03:06PM
> https://github.com/jedie/NAS7820-Tools/tree/master/flash-recovery-hdd/MedionNAS

> but it fails too. it boots from the created hdd,
> but fails to read the belonging sectors or
> whatever.

It sounds wrong. There is no HDD involed.

In serial console, you'd flash stock u-boot to NAND and then do a reset. It should boot to that u-boot. Once you ar there, you are in a better shape. Because, from there you can install OpenWrt using their procedure. Or try to boot Debian on USB.

Let's make that an itermediate unbrick goal. Find the STG-212 stock mtd0 backup, and I'll help you flash it.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 03:19PM
this github has all the stock mtds included and creates the recovery hdd out of them. this hdd should write those mtds in their belonging sectors. the disc gets generated by build.sh ( https://github.com/jedie/NAS7820-Tools/blob/master/flash-recovery-hdd/MedionNAS/build.sh ) which calculates and generates the u-boot envs, the mtds and their sectors. so we need to flash those mtds to nand.

btw. more than one thanks again! ;-)



Edited 2 time(s). Last edit at 04/05/2023 03:21PM by alexinc.
Re: revive Medion oxnas stg-212
April 05, 2023 03:35PM
Attempting to set PLLA to 725MHz ...
  plla_ctrl0 : 0x0000011A
  plla_ctrl1 : 0x003A0000
  plla_ctrl2 : 0x007300D0
  plla_ctrl3 : 0x000000B6
PLLA Set

Setup memory, testing
Reading disk 0, Image 0
  Sector : 0x0000009A
  Hdr len: 0x0001F854
  Hdr CRC: 0x55B449B2
 OK
Initialising disks
SATA PHY not ready for device 1
Detecting SATA busses:
Bus 0: Found first device OK
  Device 0: Model: CT1000MX500SSD1  Firm: M3CR032  Ser#: 2037E4AF3A94
            Type: Hard Disk
            Capacity: 131071.9 MB = 127.9 GB (268435455 x 512)
  Device 1: not available
Failed to read valid environment from disk, using built-in default


U-Boot 1.1.2 (Dec 30 2011 - 14:55:54)

U-Boot code: 60D00000 -> 60D1F854  BSS: -> 60D24074
RAM Configuration:
        Bank #0: 60000000 128 MB
SRAM Configuration:
        64KB at 0x50000000
NAND:128 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Setting Linux mem= boot arg value

IDE read: device 0 block # 288, count 1 ... 1 blocks read: OK
Hit any key to stop autoboot:  0

IDE device 0: Model: CT1000MX500SSD1  Firm: M3CR032  Ser#: 2037E4AF3A94
            Type: Hard Disk
            Capacity: 131071.9 MB = 127.9 GB (268435455 x 512)
... is now current device

IDE read: device 0 block # 1290, count 10152 ... 10152 blocks read: OK
## Booting image at 60500000 ...
Bad Magic Number

IDE device 0: Model: CT1000MX500SSD1  Firm: M3CR032  Ser#: 2037E4AF3A94
            Type: Hard Disk
            Capacity: 131071.9 MB = 127.9 GB (268435455 x 512)
... is now current device

IDE read: device 0 block # 58344, count 10152 ... 10152 blocks read: OK
## Booting image at 60500000 ...
Bad Magic Number
Light LED

IDE device 1: not available
Light LED

IDE device 1: not available
Unknown command 'lightled' - try 'help'
$ printenv
bootcmd=run select0 load boot || run select0 load2 boot || run lightled select1 load extinguishled boot || run lightled select1 load2 extinguishled boot || lightled
bootdelay=2
baudrate=115200
ethaddr=00:30:e0:00:00:01
ipaddr=192.168.50.100
serverip=192.168.50.59
autoload=n
netmask=255.255.0.0
bootfile="uImage"
select0=ide dev 0
select1=ide dev 1
load=ide read 0x60500000 50a 27a8
load2=ide read 0x60500000 e3e8 27a8
lightled=ledfail 1
extinguishled=ledfail 0
boot=bootm 60500000
stdin=serial
stdout=serial
stderr=serial
bootargs=root=/dev/sda1 console=ttyS0,115200 elevator=cfq mac_adr=0x00,0x30,0xe0,0x00,0x00,0x01 mem=128M poweroutage=yes

Environment size: 644/8188 bytes
$ help
?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
bootm   - boot application image from memory
bootp   - boot image via network using BootP/TFTP protocol
cmp     - memory compare
cp      - memory copy
crc32   - checksum calculation
diskboot- boot from IDE device
echo    - echo args to console
exit    - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls- list files in a directory (default /)
go      - start application at address 'addr'
help    - print online help
ide     - IDE sub-system
iminfo  - print header information for application image
ledfail - Extinguish (0) or light (1) failure LED
loop    - infinite loop on address range
md      - memory display
mm      - memory modify (auto-incrementing)
mtest   - simple RAM test
mw      - memory write (fill)
nand    - NAND sub-system
nboot   - boot from NAND device
nm      - memory modify (constant address)
nwboot          - NAND Write boot information
ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
rarpboot- boot image via network using RARP/TFTP protocol
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv  - set environment variables
test    - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
version - print monitor version



Edited 1 time(s). Last edit at 04/05/2023 03:36PM by alexinc.
Re: revive Medion oxnas stg-212
April 05, 2023 04:13PM
Very nice! Did you just flash it to NAND and do reset?

> Attempting to set PLLA to 725MHz ...
> plla_ctrl0 : 0x0000011A
> plla_ctrl1 : 0x003A0000
> plla_ctrl2 : 0x007300D0
> plla_ctrl3 : 0x000000B6
> PLLA Set
>
> Setup memory, testing
> Reading disk 0, Image 0
> Sector : 0x0000009A
> Hdr len: 0x0001F854
> Hdr CRC: 0x55B449B2
> OK
> Initialising disks
> SATA PHY not ready for device 1
> Detecting SATA busses:
> Bus 0: Found first device OK
> Device 0: Model: CT1000MX500SSD1 Firm: M3CR032
> Ser#: 2037E4AF3A94
> Type: Hard Disk
> Capacity: 131071.9 MB = 127.9 GB
> (268435455 x 512)
> Device 1: not available
> Failed to read valid environment from disk, using
> built-in default
>

SPL is done running.

>
> U-Boot 1.1.2 (Dec 30 2011 - 14:55:54)
>
> U-Boot code: 60D00000 -> 60D1F854 BSS: ->
> 60D24074
> RAM Configuration:
> Bank #0: 60000000 128 MB
> SRAM Configuration:
> 64KB at 0x50000000
> NAND:128 MiB
> *** Warning - bad CRC, using default environment
>
> In: serial
> Out: serial
> Err: serial
> Setting Linux mem= boot arg value
>
> IDE read: device 0 block # 288, count 1 ... 1
> blocks read: OK
> Hit any key to stop autoboot: 0

Stock u-boot is done running.

>
> IDE device 0: Model: CT1000MX500SSD1 Firm:
> M3CR032 Ser#: 2037E4AF3A94
> Type: Hard Disk
> Capacity: 131071.9 MB = 127.9 GB
> (268435455 x 512)
> ... is now current device
>
> IDE read: device 0 block # 1290, count 10152 ...
> 10152 blocks read: OK
> ## Booting image at 60500000 ...
> Bad Magic Number
>
> IDE device 0: Model: CT1000MX500SSD1 Firm:
> M3CR032 Ser#: 2037E4AF3A94
> Type: Hard Disk
> Capacity: 131071.9 MB = 127.9 GB
> (268435455 x 512)
> ... is now current device
>
> IDE read: device 0 block # 58344, count 10152 ...
> 10152 blocks read: OK
> ## Booting image at 60500000 ...
> Bad Magic Number
> Light LED
>
> IDE device 1: not available
> Light LED
>
> IDE device 1: not available
> Unknown command 'lightled' - try 'help'

I don't see USB in the list of commands. But does not matter, the HDD rootfs can be used with this SSD.

Quote

> IDE device 0: Model: CT1000MX500SSD1 Firm:
> M3CR032 Ser#: 2037E4AF3A94
> Type: Hard Disk
> Capacity: 131071.9 MB = 127.9 GB

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 04:32PM
bodhi Wrote:
-------------------------------------------------------
> Very nice! Did you just flash it to NAND and do
> reset?

i just tried once again, but as you can see, it fails flashing... booting without hdd doesn't do anything afterwards, so no spl and/or u-boot on nand.

> I don't see USB in the list of commands. But does
> not matter, the HDD rootfs can be used with this
> SSD.

hdd gets written in raw, so no partition and rootfs on it to continue with... hot swapping ide doesn't seem to work either, as ide reset just states
$ ide reset

Reset IDE: $
for sure the old original u-boot is very very limited in its possibilities!
so were to start/continue from?
Re: revive Medion oxnas stg-212
April 05, 2023 04:43PM
> > Very nice! Did you just flash it to NAND and do
> > reset?
>
> i just tried once again, but as you can see, it
> fails flashing...

Where did it fail? looks like it was good.


> booting without hdd doesn't do
> anything afterwards, so no spl and/or u-boot on
> nand.

No. The stock SPL was running

> Attempting to set PLLA to 725MHz ...
and stock u-boot was running
> U-Boot 1.1.2 (Dec 30 2011 - 14:55:54)

Now you don't need the special HDD. Use another one, or reformat this SSD to be a normal disk, wth Ext3 partition. Untar the rootfs.....

> hdd gets written in raw, so no partition and
> rootfs on it to continue with... hot swapping ide
> doesn't seem to work either, as ide reset just

No, we are beyond that raw sector now, we don't need it anymore!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 05:20PM
I think both, spl and u-boot got loaded from hdd and weren't written to NAND. Before erasing NAND i could boot into u-boot without any disk connected at all, but that doesn't work now.

If i got you right, i should boot from that rescue disk then and switch disks (hotplug) while box is still running in original u-boot? But how should i read from the newly connected hdd with rootfs, if i cannot ide reset? I shouldn't be able to ext2ls or ext2load then?
Re: revive Medion oxnas stg-212
April 05, 2023 05:37PM
> I think both, spl and u-boot got loaded from hdd
> and weren't written to NAND.

That's what I said above. When you update u-boot and spl on HDD, it is not flashing. It is just writing to raw sector. When we say "flashing to NAND" the images are flashed to NAND space using the u-boot nand subsystem commands.

Quote

In serial console, you'd flash stock u-boot to NAND and then do a reset. It should boot to that u-boot. Once you ar there, you are in a better shape. Because, from there you can install OpenWrt using their procedure. Or try to boot Debian on USB.

Let's make that an itermediate unbrick goal. Find the STG-212 stock mtd0 backup, and I'll help you flash it.

Boot with HDD SPL and u-boot. It does not matter which u-boot is on HDD.

Once you are at the u-boot prompt, follow this instruction to flash stock SPL and stock u-boot to NAND

Quote
Wiki thread

Unbrick a Pogoplug Pro v3 OXNAS by flashing u-boot in serial console

https://forum.doozan.com/read.php?3,42599,44024#msg-44024

And the part when I said you might need some help is the numbers might be different between my u-boot build and stock u-boot. And if you have only mtd0 backup file, then the "nand erase" and "nand write" might be different.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 05:55PM
bodhi Wrote:
-------------------------------------------------------
P> Boot with HDD SPL and u-boot. It does not matter
> which u-boot is on HDD.
>
> Once you are at the u-boot prompt, follow this
> instruction to flash stock SPL and stock u-boot to
> NAND
>
>
Quote
Wiki thread
>
> Unbrick a Pogoplug Pro v3 OXNAS by flashing u-boot
> in serial console
>
> https://forum.doozan.com/read.php?3,42599,44024#msg-44024
>

But that's what i already did the last days (maybe without the SPL from that rescue hdd, but does this make the difference? I need a newer u-boot than this from rescue hdd, otherwise i can't follow the instructions, as i can't access any external device, as usb command isn't available in that u-boot and ide doesn't let me load (ide reset) from another disk!? For now it seems you want me to do all the steps i did yesterday again? Sorry, I'm not seeing any difference for now?

> And the part when I said you might need some help
> is the numbers might be different between my
> u-boot build and stock u-boot. And if you have
> only mtd0 backup file, then the "nand erase" and
> "nand write" might be different.

Will those mtd1-mdt7 files from GitHub together result in mtd0? I'm not getting it for now... :-(
Re: revive Medion oxnas stg-212
April 05, 2023 06:04PM
OK, let's go back step by step.

1. Prepare the special HDD per schnee's instruction.

2. Copy the mtd 1-7 to a folder, say, /boot/mtd, on the rootfs on this special HDD.

List the mtds

ls -lh

The SPL and u-boot are quite obvious by size. Or we can look at the stock mtd layout definition and figure out.

3. Boot with the special HDD. Interrupt serial console and see if nand commands are available. I'm looking for "nand erase" and "nand write"

nand

And post the entire log from step 2 and step 3.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 06:07PM
From that GitHub,

These are what we call "mtd0" on the Pogo V3 Pro/Classic


echo "Adding MTD1 data (stage1)"
dd if=mtd1.backup of=$device bs=512 seek=1024 bs=512 conv=notrunc status=noxfer &>/dev/null || {
    echo "Failed to write disk"
    exit 1
}
echo "Adding MTD2 data (NAND U-Boot)"
dd if=mtd2.backup of=$device bs=512 seek=1536 bs=512 conv=notrunc status=noxfer &>/dev/null || {
    echo "Failed to write disk"
    exit 1
}
echo "Adding MTD3 data (U-Boot Environment)"
dd if=mtd3.bin of=$device bs=512 seek=8704 bs=512 conv=notrunc status=noxfer &>/dev/null || {
    echo "Failed to write disk"
    exit 1
}

But it looks like they are not usable.

UPDATE:

Strike that. They are NAND u-boot.

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



Edited 2 time(s). Last edit at 04/05/2023 06:54PM by bodhi.
Re: revive Medion oxnas stg-212
April 05, 2023 06:11PM
So follow the Wiki and flash my u-boot images to NAND. See what'll happen.

uboot.spl.2013.10.ox820.850mhz.mtd0.img
uboot.2015.10-tld-2.ox820.mtd0.img
uboot.2015.10-tld-2.ox820.environment.img

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 06:35PM
bodhi Wrote:
-------------------------------------------------------
> 2. List the mtds
root@Aspire-3820TG:~# ls -lh /media/alex/rootfs/boot/mtd/
insgesamt 118M
-rw-r--r-- 1 root root 256K Apr  6 01:28 mtd1.backup
-rw-r--r-- 1 root root 3,5M Apr  6 01:28 mtd2.backup
-rw-r--r-- 1 root root 8,0K Apr  6 01:28 mtd3.data
-rw-r--r-- 1 root root  10M Apr  6 01:28 mtd4.backup
-rw-r--r-- 1 root root  10M Apr  6 01:28 mtd6.backup
-rw-r--r-- 1 root root  94M Apr  6 01:28 mtd7.backup

> 3. Boot with the special HDD. Interrupt serial
> console and see if nand commands are available.
> I'm looking for "nand erase" and "nand write"
OX820> nand
nand - NAND sub-system

Usage:
nand info - show available NAND devices
nand device [dev] - show or set current device
nand read - addr off|partition size
nand write - addr off|partition size
    read/write 'size' bytes starting at offset 'off'
    to/from memory address 'addr', skipping bad blocks.
nand read.raw - addr off|partition [count]
nand write.raw - addr off|partition [count]
    Use read.raw/write.raw to avoid ECC and access the flash as-is.
nand erase[.spread] [clean] off size - erase 'size' bytes from offset 'off'
    With '.spread', erase enough for given file size, otherwise,
    'size' includes skipped bad blocks.
nand erase.part [clean] partition - erase entire mtd partition'
nand erase.chip [clean] - erase entire chip'
nand bad - show bad blocks
nand dump[.oob] off - dump page
nand scrub [-y] off size | scrub.part partition | scrub.chip
    really clean NAND erasing bad blocks (UNSAFE)
nand markbad off [...] - mark bad block(s) at offset (UNSAFE)
nand biterr off - make a bit error at offset (UNSAFE)
Re: revive Medion oxnas stg-212
April 05, 2023 06:39PM
bodhi Wrote:
-------------------------------------------------------
> But it looks like they are not usable, because
> they were built for SATA boot. Not stock MTD.

If i got it right, those should be the stock mtd backups, at least that was the intension from it's creators (over here at a german forum called mikrocontroller.net) - creating a rescue disk, that rebuilds everything to stock...



Edited 1 time(s). Last edit at 04/05/2023 06:39PM by alexinc.
Re: revive Medion oxnas stg-212
April 05, 2023 06:51PM
bodhi Wrote:
-------------------------------------------------------
> So follow the Wiki and flash my u-boot images to
> NAND. See what'll happen.
U-Boot SPL 2013.10-ga72eb8f-dirty (Feb 19 2014 - 15:21:12)
  Boot device: SATA
Attempting to set PLLA to 800 MHz ...
  plla_ctrl0 : 0000030a
  plla_ctrl1 : 00400000
  plla_ctrl2 : 007f0068
  plla_ctrl3 : 00000193

PLLA Set
Bus 0: OK
  Device 0:
reading bootargs.bin
reading u-boot.img
reading u-boot.img


U-Boot 2015.10-tld-2 (Oct 21 2017 - 22:00:02 -0700)
OXNAS OX820

DRAM:  128 MiB
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   dwmac.40400000
Hit any key to stop autoboot:  0
OX820> ide reset

Reset IDE: Bus 0: OK
  Device 0: Model: Crucial_CT275MX300SSD1 Firm:  M0CR070 Ser#: 17251799E2D8
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 262321.6 MB = 256.1 GB (537234768 x 512)
OX820> ext2ls ide 0:2 /uboot
<DIR>       4096 .
<DIR>       4096 ..
          545676 openwrt-oxnas-ox820-u-boot.bin
          524288 uboot.2015.10-tld-2.ox820.mtd0.img
          131072 uboot.spl.2013.10.ox820.850mhz.mtd0.img
            2636 uboot.2015.10-tld-2.ox820.environment
          131072 uboot.2015.10-tld-2.ox820.environment.img
          131072 uboot.spl.2013.10.ox820.mtd0.img
          524288 uboot.2013.10-tld-3.ox820.mtd0.img
          131072 pogopro_uboot_env.img
OX820> nand erase 0x0 0xC0000

NAND erase: device 0 offset 0x0, size 0xc0000
Erasing at 0xa0000 -- 100% complete.
OK
OX820> ext2load ide 0:2 0x800000 /uboot/uboot.spl.2013.10.ox820.mtd0.img
131072 bytes read in 23 ms (5.4 MiB/s)
OX820> nand write 0x800000 0x0 0x20000

NAND write: device 0 offset 0x0, size 0x20000
 131072 bytes written: OK
OX820> ext2load ide 0:2 0x800000 /uboot/uboot.2015.10-tld-2.ox820.mtd0.img
524288 bytes read in 71 ms (7 MiB/s)
OX820> nand write 0x800000 0x40000 0x80000

NAND write: device 0 offset 0x40000, size 0x80000
 524288 bytes written: OK
OX820> nand erase 0x100000 0x20000

NAND erase: device 0 offset 0x100000, size 0x20000
Erasing at 0x100000 -- 100% complete.
OK
OX820> ext2load ide 0:2 0x800000 /uboot/uboot.2015.10-tld-2.ox820.environment.img
131072 bytes read in 22 ms (5.7 MiB/s)
OX820> nand write 0x800000 0x100000 0x20000

NAND write: device 0 offset 0x100000, size 0x20000
 131072 bytes written: OK
I took older uboot.spl.2013.10.ox820.mtd0.img as i read that overclocked spl may force trouble on stg-212.

rebooting without hdd > nothing happens. no spl, no u-boot.
Re: revive Medion oxnas stg-212
April 05, 2023 06:55PM
alexinc Wrote:
-------------------------------------------------------
> bodhi Wrote:
> -------------------------------------------------------
> > But it looks like they are not usable, because
> > they were built for SATA boot. Not stock MTD.
>
> If i got it right, those should be the stock mtd
> backups, at least that was the intension from it's
> creators (over here at a german forum called
> mikrocontroller.net) - creating a rescue disk,
> that rebuilds everything to stock...

RIght! I misread it :D

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 06:58PM
OK, so flash these.

-rw-r--r-- 1 root root 256K Apr  6 01:28 mtd1.backup
-rw-r--r-- 1 root root 3,5M Apr  6 01:28 mtd2.backup
-rw-r--r-- 1 root root 8,0K Apr  6 01:28 mtd3.data


But hard to see where they should be on NAND. Let's check the DTS.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 07:02PM
bodhi Wrote:
-------------------------------------------------------
> OK, so flash these.
>
>
> -rw-r--r-- 1 root root 256K Apr  6 01:28
> mtd1.backup
> -rw-r--r-- 1 root root 3,5M Apr  6 01:28
> mtd2.backup
> -rw-r--r-- 1 root root 8,0K Apr  6 01:28
> mtd3.data
>
>
>
> But hard to see where they should be on NAND.
> Let's check the DTS.

that's were this comes handy somehow?
echo "Generating NAND U-Boot Environment"
# Sector Starts (all values in HDD sectors)
# MTD1 => 1024
# MTD2 => 1024 + MTD1Size 
# => 1536
# MTD3 => 1024 + MTD1Size + MTD2Size 
# => 8704
# MTD4 => 1024 + MTD1Size + MTD2Size + MTD3Size 
# => 9728
# MTD6 => 1024 + MTD1Size + MTD2Size + MTD3Size + MTD4Size
# => 30208
# MTD7 => 1024 + MTD1Size + MTD2Size + MTD3Size + MTD4Size + MTD6Size
# => 50688

# MTD1Size = 512
# MTD2Size = 7168
# MTD3Size = 1024
# MTD4Size = 20480
# MTD6Size = 20480
# MTD7Size = 192000
i guess not, as they state that values are hdd sectors...



Edited 1 time(s). Last edit at 04/05/2023 07:03PM by alexinc.
Re: revive Medion oxnas stg-212
April 05, 2023 07:02PM
nano ../linux-5.4.224-oxnas/arch/arm/boot/dts/ox820-stg212.dts

&nandc {
        status = "okay";

        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_nand>;

        nand@0 {
                reg = <0>;
                #address-cells = <1>;
                #size-cells = <1>;
                nand-ecc-mode = "soft";
                nand-ecc-algo = "hamming";

                partition@0 {
                        label = "stage1";
                        reg = <0x00000000 0x00040000>;
                };

                partition@40000 {
                        label = "u-boot";
                        reg = <0x00040000 0x00380000>;
                };

                partition@3c0000 {
                        label = "u-boot-env";
                        reg = <0x003c0000 0x00080000>;
                };


Those match the file size!

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



Edited 1 time(s). Last edit at 04/05/2023 07:05PM by bodhi.
Re: revive Medion oxnas stg-212
April 05, 2023 07:20PM
so
OX820> ext2load ide 0:2 0x800000 /boot/mtd/mtd1.backup
262144 bytes read in 46 ms (5.4 MiB/s)
OX820> nand write 0x800000 0x00000000 0x00040000

OX820> ext2load ide 0:2 0x800000 /boot/mtd/mtd2.backup
262144 bytes read in 46 ms (5.4 MiB/s)
OX820> nand write 0x800000 0x00040000 0x00380000

OX820> ext2load ide 0:2 0x800000 /boot/mtd/mtd3.data
262144 bytes read in 46 ms (5.4 MiB/s)
OX820> nand write 0x800000 0x003c0000 0x00080000
then?

right now
OX820> nand write 0x800000 0x00040000 0x00380000      

NAND write: device 0 offset 0x40000, size 0x380000
keeps hanging...
Re: revive Medion oxnas stg-212
April 05, 2023 07:26PM
nand erase 0x0 0x00040000
ext2load ide 0:2 0x800000 mtd1.backup
nand write 0x800000 0x0 0x00040000

nand erase 0x00040000 0x00380000
ext2load ide 0:2 0x800000 mtd2.backup
nand write 0x800000 0x00040000 0x00380000

nand erase 0x3c0000 0x00080000
ext2load ide 0:2 0x800000 mtd3.data
nand write 0x800000 0x3c0000 0x00080000

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 07:31PM
bodhi Wrote:
-------------------------------------------------------
>
> nand erase 0x00040000 0x00380000
> ext2load ide 0:2 0x800000 mtd2.backup
> nand write 0x800000 0x00040000 0x00380000
>
still hangs here. shouldn't take ages writing 3,5M to NAND!? :-(

fyi
OX820> nand erase.chip

NAND erase.chip: device 0 whole chip
Skipping bad block at  0x07b20000                                          
Erasing at 0x7fe0000 -- 100% complete.
OK



Edited 1 time(s). Last edit at 04/05/2023 07:33PM by alexinc.
Re: revive Medion oxnas stg-212
April 05, 2023 07:48PM
> > nand erase 0x00040000 0x00380000
> > ext2load ide 0:2 0x800000 mtd2.backup
> > nand write 0x800000 0x00040000 0x00380000
> still hangs here. shouldn't take ages writing 3,5M
> to NAND!? :-(

That's discouraging :) it should not take long.

> fyi
>
> OX820> nand erase.chip
> 
> NAND erase.chip: device 0 whole chip
> Skipping bad block at  0x07b20000                 
>                         
> Erasing at 0x7fe0000 -- 100% complete.
> OK
>

This bad block is at the end of NAND.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: revive Medion oxnas stg-212
April 05, 2023 07:52PM
I begin to think perhaps we are seeing a faulty RAM.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
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: