Welcome! Log In Create A New Profile

Advanced

Debian on Netgear RN102

Posted by whitepawn 
Re: Debian on Netgear RN102
September 15, 2020 07:52PM
Keep us updated though. I've been trying to build a u-boot image for a different armada-370 device (Linkstation LS441DE). I've had some success setting up a crossbuild setup but haven't been able to generate anything useful yet.
Re: Debian on Netgear RN102
September 16, 2020 04:31AM
I see bodhi, anyway thank you very much for your support.
Re: Debian on Netgear RN102
September 16, 2020 04:00PM
whitepawn,

If you have specific questions while rebuilding the RN102 stock u-boot from GPL, I'll do my best to answer them.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Netgear RN102
September 16, 2020 04:31PM
All,
First i get really pissed off to netgear because they didn't share u-boot source code, since i get mad to netgear i was desoldered 8gb flash and resoldered 128mb and removed SPI flash mod while doing this surgery i realized why i should not download their entire GPL source codes and look each one by one in first place? I couldn't give up easy.

I didn't have much hope but after downloading nearly 30 gigabytes of netgear source code I finally managed to find GPL code for RN102 in ReadyNASOS_V6.6.0_WW_src.zip.When i saw sourcecode i had a big facepalm and get mad to myself because have already soldered stock flash chip to box.

Anyway i get very motivated like candy seen childs and tried to compile stock u-boot without touching anyhing in code first.After reviewing readme files and downloading toolchain spesific for this u-boot i crossed my fingers and holded my breath:

jigsaw@whitepawn:~/u-boot-2011.12-armada370$ export PATH=$PATH:/opt/armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/bin/
jigsaw@whitepawn:~/u-boot-2011.12-armada370$ export CROSS_COMPILE=/opt/armv7-marvell-linux-uclibcgnueabi-softfp_i686_64K_Dev_20131002/bin/arm-marvell-linux-uclibcgnueabi-
jigsaw@whitepawn:~/u-boot-2011.12-armada370$ export CROSS_COMPILE_BH=/opt/armv7-marvell-linux-uclibcgnueabi-softfp_i686_64K_Dev_20131002/bin/arm-marvell-linux-uclibcgnueabi-

jigsaw@whitepawn:~/u-boot-2011.12-armada370$ ./build_rn102-nand.pl -v 2.0 -d ../armada-370-netgear-rn102.dtb
No secure boot option selected

**** [Cleaning Make]	*****

Configuring for armada_370_db - Board: armada_370, Options: DB_88F6710_BP

**** [Setting Macros]	*****

Boot from NAND
** Little ENDIAN ** 
Enable NAND controller NFC
Support flash: NAND 
Project: RN102 
**** [Building U-BOOT]	*****

Generating include/generated/asm-offsets.h
/home/jigsaw/u-boot-2011.12-armada370/lib/sha1.c:389:19: warning: ‘_sha1_src’ defined but not used [-Wunused-const-variable=]
  389 | static const char _sha1_src[] = "_sha1_src";
      |                   ^~~~~~~~~
In file included from aisimage.c:29:
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:534:12: warning: inline function ‘fit_parse_subimage’ declared but never defined
  534 | inline int fit_parse_subimage(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~~~~~
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:532:12: warning: inline function ‘fit_parse_conf’ declared but never defined
  532 | inline int fit_parse_conf(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~
In file included from default_image.c:31:
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:534:12: warning: inline function ‘fit_parse_subimage’ declared but never defined
  534 | inline int fit_parse_subimage(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~~~~~
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:532:12: warning: inline function ‘fit_parse_conf’ declared but never defined
  532 | inline int fit_parse_conf(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~
In file included from fit_image.c:31:
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:534:12: warning: inline function ‘fit_parse_subimage’ declared but never defined
  534 | inline int fit_parse_subimage(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~~~~~
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:532:12: warning: inline function ‘fit_parse_conf’ declared but never defined
  532 | inline int fit_parse_conf(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~
In file included from /home/jigsaw/u-boot-2011.12-armada370/common/image.c:73:
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:534:12: warning: inline function ‘fit_parse_subimage’ declared but never defined
  534 | inline int fit_parse_subimage(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~~~~~
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:532:12: warning: inline function ‘fit_parse_conf’ declared but never defined
  532 | inline int fit_parse_conf(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~
In file included from imximage.c:32:
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:534:12: warning: inline function ‘fit_parse_subimage’ declared but never defined
  534 | inline int fit_parse_subimage(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~~~~~
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:532:12: warning: inline function ‘fit_parse_conf’ declared but never defined
  532 | inline int fit_parse_conf(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~
In file included from kwbimage.c:29:
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:534:12: warning: inline function ‘fit_parse_subimage’ declared but never defined
  534 | inline int fit_parse_subimage(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~~~~~
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:532:12: warning: inline function ‘fit_parse_conf’ declared but never defined
  532 | inline int fit_parse_conf(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~
In file included from mkimage.c:25:
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:534:12: warning: inline function ‘fit_parse_subimage’ declared but never defined
  534 | inline int fit_parse_subimage(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~~~~~
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:532:12: warning: inline function ‘fit_parse_conf’ declared but never defined
  532 | inline int fit_parse_conf(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~
In file included from omapimage.c:37:
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:534:12: warning: inline function ‘fit_parse_subimage’ declared but never defined
  534 | inline int fit_parse_subimage(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~~~~~
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:532:12: warning: inline function ‘fit_parse_conf’ declared but never defined
  532 | inline int fit_parse_conf(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~
In file included from ublimage.c:36:
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:534:12: warning: inline function ‘fit_parse_subimage’ declared but never defined
  534 | inline int fit_parse_subimage(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~~~~~
/home/jigsaw/u-boot-2011.12-armada370/include/image.h:532:12: warning: inline function ‘fit_parse_conf’ declared but never defined
  532 | inline int fit_parse_conf(const char *spec, ulong addr_curr,
      |            ^~~~~~~~~~~~~~
  CC    aes.c
  CC    arc4.c
hdrparser.c: In function ‘parse_main_header’:
hdrparser.c:195:19: warning: too many arguments for format [-Wformat-extra-args]
  195 |   fprintf(stdout, "[15:12]Source address (LBA):      0x%08X\n",
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hdrparser.c:198:19: warning: too many arguments for format [-Wformat-extra-args]
  198 |   fprintf(stdout, "[15:12]Source address:            0x%08X\n",
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hdrparser.c: In function ‘parse_bin_header’:
hdrparser.c:295:18: warning: too many arguments for format [-Wformat-extra-args]
  295 |  fprintf(stdout, "[0005:0005]Reserved:              0x%02X\n",
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hdrparser.c:297:18: warning: too many arguments for format [-Wformat-extra-args]
  297 |  fprintf(stdout, "[0007:0005]Reserved:              0x%04X\n",
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC    base64.c
  CC    bignum.c
  CC    certs.c
  CC    debug.c
  CC    des.c
  CC    dhm.c
  CC    havege.c
  CC    md2.c
  CC    md4.c
  CC    md5.c
  CC    net.c
  CC    padlock.c
  CC    rsa.c
  CC    sha1.c
  CC    sha2.c
  CC    sha4.c
  CC    ssl_cli.c
  CC    ssl_srv.c
  CC    ssl_tls.c
  CC    timing.c
  CC    x509parse.c
  CC    xtea.c
  CC    camellia.c
  CC    mvMemPool.c
  AR    libpolarssl.a
ar: creating libpolarssl.a
  RL    libpolarssl.a
  CC    aes/aescrypt2.c
  CC    hash/hello.c
  CC    hash/md5sum.c
  CC    hash/sha1sum.c
  CC    hash/sha2sum.c
  CC    pkey/dh_client.c
  CC    pkey/dh_genprime.c
  CC    pkey/dh_server.c
  CC    pkey/mpi_demo.c
  CC    pkey/rsa_genkey.c
  CC    pkey/rsa_sign.c
pkey/rsa_sign.c: In function ‘main’:
pkey/rsa_sign.c:104:17: warning: implicit declaration of function ‘sha4_file’; did you mean ‘sha1_file’? [-Wimplicit-function-declaration]
  104 |     if( ( ret = sha4_file( argv[1], hash, 0 ) ) != 0 )
      |                 ^~~~~~~~~
      |                 sha1_file
  CC    pkey/rsa_verify.c
  CC    ssl/ssl_client1.c
pkey/rsa_verify.c: In function ‘main’:
pkey/rsa_verify.c:129:17: warning: implicit declaration of function ‘sha4_file’; did you mean ‘sha1_file’? [-Wimplicit-function-declaration]
  129 |     if( ( ret = sha4_file( argv[1], hash, 0 ) ) != 0 )
      |                 ^~~~~~~~~
      |                 sha1_file
  CC    ssl/ssl_client2.c
  CC    ssl/ssl_server.c
  CC    test/benchmark.c
  CC    test/selftest.c
  CC    test/ssl_test.c
test/selftest.c: In function ‘main’:
test/selftest.c:143:17: warning: implicit declaration of function ‘camellia_self_test’; did you mean ‘xtea_self_test’? [-Wimplicit-function-declaration]
  143 |     if( ( ret = camellia_self_test( v ) ) != 0 )
      |                 ^~~~~~~~~~~~~~~~~~
      |                 xtea_self_test
Building linker script for board a370, Non-secure mode
Building linker script for board a370, Secure mode
a - uboot_drv.o
a - uboot_skb.o
a - sky2.o
a - skge.o
a - sky2le.o
a - skdim.o
a - skaddr.o
a - skgehwt.o
a - skgeinit.o
a - skgesirq.o
a - sktwsi.o
a - sklm80.o
a - skqueue.o
a - skrlmt.o
a - sktimer.o
a - skvpd.o
a - skxmac2.o
a - skcsum.o

**** [Creating Image]	*****


 Ext. headers = 1, Header size = 76160 bytes Hdr-to-Img gap = 0 bytes
New image size = 0xbdfc4[778180] Source image size = 0xbdfc4[778180]
====>>>> u-boot-a370-2.0-nand-db-uart.bin was created

 Ext. headers = 1, Header size = 81920 bytes Hdr-to-Img gap = 0 bytes
New image size = 0xc5fc8[810952] Source image size = 0xbdfc4[778180]
failed to open '../armada-370-netgear-rn102.dtb'
Error writing u-boot-a370-2.0-nand-db.bin file 

 *** Error: Doimage failed


 *** Error: Build u-boot boot from NAND failed

jigsaw@whitepawn:~/u-boot-2011.12-armada370$

It failed in nand image because of dtb file but it doesn't matter now we can deal this later.I can try my u-boot on box with serial anyway since it generated u-boot-a370-2.0-nand-db-uart.bin.
I soldered back 8GB flash and tried my u-boot on box with my xeon machine:

root@whitepawnxeon:/home/jigsaw/Downloads# kwboot -t -B 115200 /dev/ttyUSB0 -b u-boot-a370-2.0-nand-db-uart.bin -p
Sending boot message. Please reboot the target...-
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]
  2 % [......................................................................]
  3 % [......................................................................]
  4 % [......................................................................]
  5 % [......................................................................]
  6 % [......................................................................]
  7 % [......................................................................]
  8 % [......................................................................]
  9 % [......................................................................]
 10 % [......................................................................]
 11 % [......................................................................]
 12 % [......................................................................]
 13 % [......................................................................]
 14 % [......................................................................]
 15 % [......................................................................]
 16 % [......................................................................]
 17 % [......................................................................]
 18 % [......................................................................]
 19 % [......................................................................]
 20 % [......................................................................]
 22 % [......................................................................]
 23 % [......................................................................]
 24 % [......................................................................]
 25 % [......................................................................]
 26 % [......................................................................]
 27 % [......................................................................]
 28 % [......................................................................]
 29 % [......................................................................]
 30 % [......................................................................]
 31 % [......................................................................]
 32 % [......................................................................]
 33 % [......................................................................]
 34 % [......................................................................]
 35 % [......................................................................]
 36 % [......................................................................]
 37 % [......................................................................]
 38 % [......................................................................]
 39 % [......................................................................]
 40 % [......................................................................]
 41 % [......................................................................]
 43 % [......................................................................]
 44 % [......................................................................]
 45 % [......................................................................]
 46 % [......................................................................]
 47 % [......................................................................]
 48 % [......................................................................]
 49 % [......................................................................]
 50 % [......................................................................]
 51 % [......................................................................]
 52 % [......................................................................]
 53 % [......................................................................]
 54 % [......................................................................]
 55 % [......................................................................]
 56 % [......................................................................]
 57 % [......................................................................]
 58 % [......................................................................]
 59 % [......................................................................]
 60 % [......................................................................]
 61 % [......................................................................]
 62 % [......................................................................]
 63 % [......................................................................]
 65 % [......................................................................]
 66 % [......................................................................]
 67 % [......................................................................]
 68 % [......................................................................]
 69 % [......................................................................]
 70 % [......................................................................]
 71 % [......................................................................]
 72 % [......................................................................]
 73 % [......................................................................]
 74 % [......................................................................]
 75 % [......................................................................]
 76 % [......................................................................]
 77 % [......................................................................]
 78 % [......................................................................]
 79 % [......................................................................]
 80 % [......................................................................]
 81 % [......................................................................]
 82 % [......................................................................]
 83 % [......................................................................]
 84 % [......................................................................]
 86 % [......................................................................]
 87 % [......................................................................]
 88 % [......................................................................]
 89 % [......................................................................]
 90 % [......................................................................]
 91 % [......................................................................]
 92 % [......................................................................]
 93 % [......................................................................]
 94 % [......................................................................]
 95 % [......................................................................]
 96 % [......................................................................]
 97 % [......................................................................]
 98 % [......................................................................]
 99 % [.........................]
[Type Ctrl-\ + c to quit]

 __   __                      _ _
|  \/  | __ _ _ ____   _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| |  | | (_| | |   \ V /  __/ | |
|_|  |_|\__,_|_|    \_/ \___|_|_|
         _   _     ____              _
        | | | |   | __ )  ___   ___ | |_ 
        | | | |___|  _ \ / _ \ / _ \| __| 
        | |_| |___| |_) | (_) | (_) | |_ 
         \___/    |____/ \___/ \___/ \__| 
 ** LOADER **


U-Boot 2011.12 (Sep 16 2020 - 23:34:16) Marvell version: v2011.12 2014_T2.0p1 
06/23/2015 ReadyNAS-102 V2.0

Board: DB-88F6710-BP
SoC:   MV6710 A1
CPU:   Marvell PJ4B v7 UP (Rev 1) LE
       CPU    @ 1200 [MHz]
       L2     @ 600 [MHz]
       TClock @ 200 [MHz]
       DDR    @ 600 [MHz]
       DDR 16Bit Width, FastPath Memory Access
DRAM:  512 MiB

Map:   Code:		0x1feef000:0x1ff9efc4
       BSS:		0x1ffef4a0
       Stack:		0x1f9eeef8
       Heap:		0x1f9ef000:0x1feef000

NAND:  (ID 0x642c)	mvNfcInit() failed.
0 MiB
MMC:   MRVL_MMC: 0
*** Warning - readenv() failed, using default environment


Initialize and scan all PCI interfaces
PEX unit.port(active IF[-first bus]):
------------------------------------------
PEX 0: Root Complex Interface, Detected Link X1, GEN 2.0
PEX 1: Root Complex Interface, Detected Link X1, GEN 2.0
FPU not initialized
USB 0: Host Mode
USB 1: Host Mode
Shutting down unused interfaces:
       GBE0
       SDIO
       AUDIO
       TDM
Modules/Interfaces Detected:
       RGMII1 Phy
       PEX0 (Lane 0)
       PEX1 (Lane 1)
       SATA0 (Lane 2)
       SATA1 (Lane 3)
Net:   , egiga1 [PRIME]
Detect MVT/MP board...
Saving Environment to NAND...
Erasing Nand...
Attempt to erase non page aligned data
Power On!

Updating env to v3...
Saving Environment to NAND...
Erasing Nand...
Attempt to erase non page aligned data
raise: Signal # 8 caught
raise: Signal # 8 caught

 __   __                      _ _
|  \/  | __ _ _ ____   _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| |  | | (_| | |   \ V /  __/ | |
|_|  |_|\__,_|_|    \_/ \___|_|_|
         _   _     ____              _
        | | | |   | __ )  ___   ___ | |_ 
        | | | |___|  _ \ / _ \ / _ \| __| 
        | |_| |___| |_) | (_) | (_) | |_ 
         \___/    |____/ \___/ \___/ \__| 
 ** LOADER **


U-Boot 2011.12 (Sep 16 2020 - 23:34:16) Marvell version: v2011.12 2014_T2.0p1 
06/23/2015 ReadyNAS-102 V2.0

Board: DB-88F6710-BP
SoC:   MV6710 A1
CPU:   Marvell PJ4B v7 UP (Rev 1) LE
       CPU    @ 1200 [MHz]
       L2     @ 600 [MHz]
       TClock @ 200 [MHz]
       DDR    @ 600 [MHz]
       DDR 16Bit Width, FastPath Memory Access
DRAM:  512 MiB

Map:   Code:		0x1feef000:0x1ff9efc4
       BSS:		0x1ffef4a0
       Stack:		0x1f9eeef8
       Heap:		0x1f9ef000:0x1feef000

NAND:  (ID 0x642c)	mvNfcInit() failed.
0 MiB
MMC:   MRVL_MMC: 0
*** Warning - readenv() failed, using default environment


Initialize and scan all PCI interfaces
PEX unit.port(active IF[-first bus]):
------------------------------------------
PEX 0: Root Complex Interface, Detected Link X1, GEN 2.0
PEX 1: Root Complex Interface, Detected Link X1, GEN 2.0
FPU not initialized
USB 0: Host Mode
USB 1: Host Mode
Shutting down unused interfaces:
       GBE0
       SDIO
       AUDIO
       TDM
Modules/Interfaces Detected:
       RGMII1 Phy
       PEX0 (Lane 0)
       PEX1 (Lane 1)
       SATA0 (Lane 2)
       SATA1 (Lane 3)
Net:   , egiga1 [PRIME]
Detect MVT/MP board...
Saving Environment to NAND...
Erasing Nand...
Attempt to erase non page aligned data
Power On!

Updating env to v3...
Saving Environment to NAND...
Erasing Nand...
Attempt to erase non page aligned data
raise: Signal # 8 caught
raise: Signal # 8 caught

 __   __                      _ _
|  \/  | __ _ _ ____   _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| |  | | (_| | |   \ V /  __/ | |
|_|  |_|\__,_|_|    \_/ \___|_|_|
         _   _     ____              _
        | | | |   | __ )  ___   ___ | |_ 
        | | | |___|  _ \ / _ \ / _ \| __| 
        | |_| |___| |_) | (_) | (_) | |_ 
         \___/    |____/ \___/ \___/ \__| 
 ** LOADER **


U-Boot 2011.12 (Sep 16 2020 - 23:34:16) Marvell version: v2011.12 2014_T2.0p1 
06/23/2015 ReadyNAS-102 V2.0

Board: DB-88F6710-BP
SoC:   MV6710 A1
CPU:   Marvell PJ4B v7 UP (Rev 1) LE
       CPU    @ 1200 [MHz]
       L2     @ 600 [MHz]
       TClock @ 200 [MHz]
       DDR    @ 600 [MHz]
       DDR 16Bit Width, FastPath Memory Access
DRAM:  512 MiB

Map:   Code:		0x1feef000:0x1ff9efc4
       BSS:		0x1ffef4a0
       Stack:		0x1f9eeef8
       Heap:		0x1f9ef000:0x1feef000

NAND:  (ID 0x642c)	mvNfcInit() failed.
0 MiB
MMC:   MRVL_MMC: 0
*** Warning - readenv() failed, using default environment


Initialize and scan all PCI interfaces
PEX unit.port(active IF[-first bus]):
------------------------------------------
PEX 0: Root Complex Interface, Detected Link X1, GEN 2.0
PEX 1: Root Complex Interface, Detected Link X1, GEN 2.0
FPU not initialized
USB 0: Host Mode
USB 1: Host Mode
Shutting down unused interfaces:
       GBE0
       SDIO
       AUDIO
       TDM
Modules/Interfaces Detected:
       RGMII1 Phy
       PEX0 (Lane 0)
       PEX1 (Lane 1)
       SATA0 (Lane 2)
       SATA1 (Lane 3)
Net:   , egiga1 [PRIME]

When i saw the todays date on u-boot i had a pretty nasty smile on my face:)
Then i made some online search for flash chip IDs in u-boot.It seems /u-boot-2011.12-armada370/drivers/mtd/nand/nand_ids.c does this ID stuff.I have added this to code:
/* 64 Gigabit */
{"NAND 8GiB 1,8V 8-bit",  0xAE, 8192, LP_OPTIONS},
{"NAND 8GiB 3,3V 8-bit",  0xDE, 8192, LP_OPTIONS},
{"NAND 8GiB 1,8V 16-bit", 0xBE, 8192, LP_OPTIONS16},
{"NAND 8GiB 3,3V 16-bit", 0xCE, 8192, LP_OPTIONS16},
Compiled u-boot and tried again but it seems i have to find another config option in this file.Still investigating the NAND ID i just wanted to share updates with you guys.Will post results if i succeeded.

Btw I have uploaded toolchain and u-boot source code to my dropbox folder if anyone interested.

https://www.dropbox.com/sh/v2wsgzx6kk0b76c/AAB6DKBMaxJQNqwMxVNLDH-Ra?dl=0

Regards.
Re: Debian on Netgear RN102
September 16, 2020 04:46PM
whitepawn,

> U-Boot 2011.12 (Sep 16 2020 - 23:34:16) Marvell
> version: v2011.12 2014_T2.0p1
> 06/23/2015 ReadyNAS-102 V2.0


Cool!

You should tried this kwboot with the original NAND before desolder/solder new NAND :)

-bodhi
===========================
Forum Wiki
bodhi's corner
tme
Re: Debian on Netgear RN102
September 17, 2020 01:09AM
Quote
whitepawn
When I saw today's date on u-boot I had a pretty nasty smile on my face :)

Wonderful! Congratulation! This is great news.

To me, the most annoying shortcoming of the stock u-boot is its inability to boot from a memory stick or an SSD attached to the rear connectors, so USB3 and SATA support are on the top of my wish list for a new u-boot implementation. I understand you have support for large SPI eeproms on your wish list.

What else should be aimed for? Eliminating the incompatibility between the u-boot's serial console and the default Linux' serial console physical addresses? Support for separate DTBs? Adding a tftp boot mode to the boot menu?

I imagine the right way to proceed is to extract the ReadyNAS specific patches from the Marvell u-boot version v2011.12, and modify these patches so they can be applied seamlessly to a recent main stream u-boot implementation. What are the candidates for the "recent main stream u-boot implementation"?

Regards,
Trond Melen
Re: Debian on Netgear RN102
September 17, 2020 01:23AM
> To me, the most annoying shortcoming of the stock
> u-boot is its inability to boot from a memory
> stick or an SSD attached to the rear connectors,

Unfortunately booting with USB 3.0 port will probably not easy to achieve with stock u-boot (of course, it depends on how extensive the Netgear patch is, too). But that booting option is not a priority for NAS vendors so usually they don't botther adding code for it.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Netgear RN102
September 17, 2020 05:15AM
bodhi Wrote:
-------------------------------------------------------
> whitepawn,
>
> > U-Boot 2011.12 (Sep 16 2020 - 23:34:16)
> Marvell
> > version: v2011.12 2014_T2.0p1
> > 06/23/2015 ReadyNAS-102 V2.0

>
> Cool!
>
> You should tried this kwboot with the original
> NAND before desolder/solder new NAND :)
Bodhi,
Yes you are right but "i also like to live dangerously"
I modified nand_ids.c code to
{"NAND 8GiB 3,3V 8-bit Custom",	0x64, 0, 8192, 0, LP_OPTIONS},
since 0x64 is my nand id and 2c is manufacturer micron flash id according to here but it cannot id correctly.What am i missing?Are there anymore files to patch?
@tme
I think USB 3.0 boot is not possible because i couldn't find any code regarding fresco FL1009 USB 3.0 controller in stock u-boot.Front USB 2.0 is directly hardwired to Armada CPU on the other hand USB 3.0 is wired to fresco contoller then which is wired to cpu via pci interface since my aim is booting whole system on nand (because of usb reset problems i have) so i didn't investigated deeply.I can try to add fresco driver to stock u-boot but as i said i am a hardware guy more then software so i even don't know what i am doing.
Tftp boot is already in stock u-boot i guess.
Regards.
Re: Debian on Netgear RN102
September 17, 2020 05:53AM
whitepawn,

Look for

./board/mv_ebu/common/mv_hal/nfc/mvNfc.c

Regarding USB 3.0, yes, it is the PCI bus.

Trond,

Quote

I imagine the right way to proceed is to extract the ReadyNAS specific patches from the Marvell u-boot version v2011.12, and modify these patches so they can be applied seamlessly to a recent main stream u-boot implementation. What are the candidates for the "recent main stream u-boot implementation"?

In theory, that's an ideal situation. But U-boot has gone through architectural changes a few times. The Marvell u-boot that is used in these NAS is quite old (its software architecture is at least twice removed from the current mainline u-boot).

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Netgear RN102
September 17, 2020 06:08AM
All,

Could you guys describe how you connect serial console. Where is the header and what is the pinouts?


It is for AkkJaa in this thread:

https://forum.doozan.com/read.php?3,106724,107619#msg-107619

Seems like the RN102 and RN104 have the same board.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Netgear RN102
September 17, 2020 06:30AM
Bodhi,
Please see this about serial pinout.TX and RX is enough for console.GND and VCC are not used if AkkJaa uses USB to serial adapter which is self powered by itself in his case.
Also board itself has 4 pinheader internally but i havent tested yet.
I can upload my own connection photos if you are needed.
Regards.
Re: Debian on Netgear RN102
September 17, 2020 06:38AM
whitepawn,

> Also board itself has 4 pinheader internally but i
> havent tested yet.

That's the J7 header, the 2nd UART port. So you have UART0 and UART1.

-bodhi
===========================
Forum Wiki
bodhi's corner
tme
Re: Debian on Netgear RN102
September 17, 2020 08:43AM
Quote
whitepawn
TX and RX is enough for console.

Maybe. Add GND for reliable communication. But I agree to leave 3.3 V VCC unconnected.

RX of the USB-to-serial adapter should be connected to TX of the box, and vice versa. Trial and error is the easiest approach since it is harmless to get this wrong. Make sure to get GND right every time - getting this wrong may harm the box or adapter.
Attachments:
open | download - RN102-serial-console-reduced.jpeg (304.8 KB)
Re: Debian on Netgear RN102
September 17, 2020 09:56AM
Tme,
If you are using isolated power bricks or using plugs without earth (which always connects GND) GND must be connected.
If your PC and Nas power brick connects same outlet with earthing you don't need to connect GND because it is connected Via earthing internally so you won't need to connect extra ground.
Regards.
Re: Debian on Netgear RN102
September 17, 2020 04:02PM
Quote

If you are using isolated power bricks or using plugs without earth (which always connects GND) GND must be connected.
If your PC and Nas power brick connects same outlet with earthing you don't need to connect GND because it is connected Via earthing internally so you won't need to connect extra ground.

Yes. And it does not hurt to connect GND in either cases and keep it simple for someone is using this the 1st time.

Quote

RX of the USB-to-serial adapter should be connected to TX of the box, and vice versa.

Not for certain module converter like the CP2012. This converter is already crossed. So RXD to RXD and TXD to TXD is the right connection. OTOH, the Prolific PL3xxx must be connected crossed wire.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Netgear RN102
September 17, 2020 04:15PM
Bodhi,
I managed to detect 8gb flash with your recommendation:
Quote
Bodhi
whitepawn,

Look for

./board/mv_ebu/common/mv_hal/nfc/mvNfc.c

I have edited nand_ids.c

{"NAND 8GiB 3,3V 16-bit Custom",	0x64, 0, 8192, 0, LP_OPTIONS16},
First it complained about 8 bit config which is LP_OPTIONS then i changed it to LP_OPTIONS16 no more complains from u-boot.

And edited mnNfc.c to:
{			/* Micron 64Gb */
	 .tADL = 0,		/* tADL, Address to write data delay */
	 .tCH = 20,		/* tCH, Enable signal hold time */
	 .tCS = 20,		/* tCS, Enable signal setup time */
	 .tWC = 90,		/* tWC, ND_nWE cycle duration */
	 .tWH = 45,		/* tWH, ND_nWE high duration */
	 .tWP = 45,		/* tWP, ND_nWE pulse time */
	 .tRC = 90,		/* tWC, ND_nRE cycle duration */
	 .tRH = 45,		/* tRH, ND_nRE high duration */
	 .tRP = 45,		/* tRP, ND_nRE pulse width */
	 .tR = 0,		/* tR = data transfer from cell to register */
	 .tWHR = 90,		/* tWHR, ND_nWE high to ND_nRE low delay for status read */
	 .tAR = 65,		/* tAR, ND_ALE low to ND_nRE low delay */
	 .tRHW = 32,		/* tRHW, ND_nRE high to ND_nWE low delay */
	 .pgPrBlk = 256,	/* Pages per block - detected */
	 .pgSz = 8192,		/* Page size */
	 .oobSz = 448,		/* Spare size */
	 .blkNum = 4096,	/* Number of blocks/sectors in the flash */
	 .id = 0x642C,		/* Device ID 0xDevice,Vendor */
	 .model = "Micron 64Gb 8bit",
	 .bb_page = 0,		/* Manufacturer Bad block marking page in block */
	 .flags = NFC_CLOCK_UPSCALE_200M
	 },
Now it detects flash as 8192 megabytes.Yes!

root@whitepawnxeon:/home/jigsaw/Downloads# kwboot -t -B 115200 /dev/ttyUSB0 -b u-boot-a370-2.1WP-nand-db-uart.bin -p
Sending boot message. Please reboot the target...\
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]
  2 % [......................................................................]
  3 % [......................................................................]
  4 % [......................................................................]
  5 % [......................................................................]
  6 % [......................................................................]
  7 % [......................................................................]
  8 % [......................................................................]
  9 % [......................................................................]
 10 % [......................................................................]
 11 % [......................................................................]
 12 % [......................................................................]
 13 % [......................................................................]
 14 % [......................................................................]
 15 % [......................................................................]
 16 % [......................................................................]
 17 % [......................................................................]
 18 % [......................................................................]
 19 % [......................................................................]
 20 % [......................................................................]
 22 % [......................................................................]
 23 % [......................................................................]
 24 % [......................................................................]
 25 % [......................................................................]
 26 % [......................................................................]
 27 % [......................................................................]
 28 % [......................................................................]
 29 % [......................................................................]
 30 % [......................................................................]
 31 % [......................................................................]
 32 % [......................................................................]
 33 % [......................................................................]
 34 % [......................................................................]
 35 % [......................................................................]
 36 % [......................................................................]
 37 % [......................................................................]
 38 % [......................................................................]
 39 % [......................................................................]
 40 % [......................................................................]
 41 % [......................................................................]
 43 % [......................................................................]
 44 % [......................................................................]
 45 % [......................................................................]
 46 % [......................................................................]
 47 % [......................................................................]
 48 % [......................................................................]
 49 % [......................................................................]
 50 % [......................................................................]
 51 % [......................................................................]
 52 % [......................................................................]
 53 % [......................................................................]
 54 % [......................................................................]
 55 % [......................................................................]
 56 % [......................................................................]
 57 % [......................................................................]
 58 % [......................................................................]
 59 % [......................................................................]
 60 % [......................................................................]
 61 % [......................................................................]
 62 % [......................................................................]
 63 % [......................................................................]
 65 % [......................................................................]
 66 % [......................................................................]
 67 % [......................................................................]
 68 % [......................................................................]
 69 % [......................................................................]
 70 % [......................................................................]
 71 % [......................................................................]
 72 % [......................................................................]
 73 % [......................................................................]
 74 % [......................................................................]
 75 % [......................................................................]
 76 % [......................................................................]
 77 % [......................................................................]
 78 % [......................................................................]
 79 % [......................................................................]
 80 % [......................................................................]
 81 % [......................................................................]
 82 % [......................................................................]
 83 % [......................................................................]
 84 % [......................................................................]
 86 % [......................................................................]
 87 % [......................................................................]
 88 % [......................................................................]
 89 % [......................................................................]
 90 % [......................................................................]
 91 % [......................................................................]
 92 % [......................................................................]
 93 % [......................................................................]
 94 % [......................................................................]
 95 % [......................................................................]
 96 % [......................................................................]
 97 % [......................................................................]
 98 % [......................................................................]
 99 % [........................]
[Type Ctrl-\ + c to quit]

 __   __                      _ _
|  \/  | __ _ _ ____   _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| |  | | (_| | |   \ V /  __/ | |
|_|  |_|\__,_|_|    \_/ \___|_|_|
         _   _     ____              _
        | | | |   | __ )  ___   ___ | |_ 
        | | | |___|  _ \ / _ \ / _ \| __| 
        | |_| |___| |_) | (_) | (_) | |_ 
         \___/    |____/ \___/ \___/ \__| 
 ** LOADER **


U-Boot 2011.12 (Sep 17 2020 - 23:05:36) Marvell version: v2011.12 2014_T2.0p1 
06/23/2015 ReadyNAS-102 V2.0

Board: DB-88F6710-BP
SoC:   MV6710 A1
CPU:   Marvell PJ4B v7 UP (Rev 1) LE
       CPU    @ 1200 [MHz]
       L2     @ 600 [MHz]
       TClock @ 200 [MHz]
       DDR    @ 600 [MHz]
       DDR 16Bit Width, FastPath Memory Access
DRAM:  512 MiB

Map:   Code:		0x1feef000:0x1ff9ef5c
       BSS:		0x1ffef0a0
       Stack:		0x1f9eeef8
       Heap:		0x1f9ef000:0x1feef000

NAND:  (ID 0x642c)	8192 MiB
MMC:   MRVL_MMC: 0
Bad block table not found for chip 0
Bad block table not found for chip 0
Bad block table written to 0x0001ffff0000, version 0x01
Bad block table written to 0x0001fffe0000, version 0x01
*** Warning - bad CRC, using default environment


Initialize and scan all PCI interfaces
PEX unit.port(active IF[-first bus]):
------------------------------------------
PEX 0: Root Complex Interface, Detected Link X1, GEN 2.0
PEX 1: Root Complex Interface, Detected Link X1, GEN 2.0
FPU not initialized
USB 0: Host Mode
USB 1: Host Mode
Shutting down unused interfaces:
       GBE0
       SDIO
       AUDIO
       TDM
Modules/Interfaces Detected:
       RGMII1 Phy
       PEX0 (Lane 0)
       PEX1 (Lane 1)
       SATA0 (Lane 2)
       SATA1 (Lane 3)
Net:   , egiga1 [PRIME]
Detect MVT/MP board...
Saving Environment to NAND...
Erasing Nand...
Writing to Nand... done
Power On!

Updating env to v3...
Saving Environment to NAND...
Erasing Nand...
Writing to Nand... done
Loading FDT from NAND 0xEC000 to 0x1000000 failed!
Saving Environment to NAND...
Erasing Nand...
Writing to Nand... done
Hit any key to stop autoboot:  0 

NAND read: device 0 offset 0x200000, size 0x400000
Skipping bad block 0x00210000
Skipping bad block 0x00320000
Skipping bad block 0x00380000
Skipping bad block 0x003d0000
Skipping bad block 0x00400000
Skipping bad block 0x00410000
Skipping bad block 0x00420000
Skipping bad block 0x00430000
Skipping bad block 0x00440000
Skipping bad block 0x00450000
Skipping bad block 0x00460000
Skipping bad block 0x00470000
Skipping bad block 0x00480000
Skipping bad block 0x00490000
Skipping bad block 0x004a0000
Skipping bad block 0x004b0000
Skipping bad block 0x004c0000
Skipping bad block 0x004d0000
Skipping bad block 0x004e0000
Skipping bad block 0x004f0000
Skipping bad block 0x00500000
Skipping bad block 0x00510000
Skipping bad block 0x00520000
Skipping bad block 0x00530000
Skipping bad block 0x00540000
Skipping bad block 0x00550000
Skipping bad block 0x00560000
Skipping bad block 0x00570000
Skipping bad block 0x00580000
Skipping bad block 0x00590000
Skipping bad block 0x005a0000
Skipping bad block 0x005b0000
Skipping bad block 0x005c0000
Skipping bad block 0x005d0000
Skipping bad block 0x005e0000
Skipping bad block 0x005f0000
Skipping bad block 0x00600000
Skipping bad block 0x00610000
Skipping bad block 0x00620000
Skipping bad block 0x00630000
Skipping bad block 0x00640000
Skipping bad block 0x00650000
Skipping bad block 0x00660000
Skipping bad block 0x00670000
Skipping bad block 0x00680000
Skipping bad block 0x00690000
Skipping bad block 0x006a0000
Skipping bad block 0x006b0000
Skipping bad block 0x006c0000
Skipping bad block 0x006d0000
Skipping bad block 0x006e0000
Skipping bad block 0x006f0000
Skipping bad block 0x00700000
Skipping bad block 0x00710000
Skipping bad block 0x00720000
Skipping bad block 0x00730000
Skipping bad block 0x00740000
Skipping bad block 0x00750000
Skipping bad block 0x00760000
Skipping bad block 0x00770000
Skipping bad block 0x00780000
Skipping bad block 0x00790000
Skipping bad block 0x007a0000
Skipping bad block 0x007b0000
Skipping bad block 0x007c0000
Skipping bad block 0x007d0000
Skipping bad block 0x007e0000
Skipping bad block 0x007f0000
Skipping bad block 0x00800000
Skipping bad block 0x00810000
Skipping bad block 0x00820000
Skipping bad block 0x00830000
Skipping bad block 0x00840000
Skipping bad block 0x00850000
Skipping bad block 0x00860000
Skipping bad block 0x00870000
Skipping bad block 0x00880000
Skipping bad block 0x00890000
Skipping bad block 0x008a0000
Skipping bad block 0x008b0000
Skipping bad block 0x008c0000
Skipping bad block 0x008d0000
Skipping bad block 0x008e0000
Skipping bad block 0x008f0000
Skipping bad block 0x00900000
Skipping bad block 0x00910000
Skipping bad block 0x00920000
Skipping bad block 0x00930000
Skipping bad block 0x00940000
Skipping bad block 0x00950000
Skipping bad block 0x00960000
Skipping bad block 0x00970000
Skipping bad block 0x00980000
Skipping bad block 0x00990000
Skipping bad block 0x009a0000
Skipping bad block 0x009b0000
Skipping bad block 0x009c0000
Skipping bad block 0x009d0000
Skipping bad block 0x009e0000
Skipping bad block 0x009f0000
Skipping bad block 0x00a00000
Skipping bad block 0x00a10000
Skipping bad block 0x00a20000
Skipping bad block 0x00a30000
Skipping bad block 0x00a40000
Skipping bad block 0x00a50000
Skipping bad block 0x00a60000
Skipping bad block 0x00a70000
Skipping bad block 0x00a80000
Skipping bad block 0x00a90000
Skipping bad block 0x00aa0000
Skipping bad block 0x00ab0000
Skipping bad block 0x00ac0000
Skipping bad block 0x00ad0000
Skipping bad block 0x00ae0000
Skipping bad block 0x00af0000
Skipping bad block 0x00b00000
Skipping bad block 0x00b10000
Skipping bad block 0x00b20000
Skipping bad block 0x00b30000
Skipping bad block 0x00b40000
Skipping bad block 0x00b50000
Skipping bad block 0x00b60000
Skipping bad block 0x00b70000
Skipping bad block 0x00b80000
Skipping bad block 0x00b90000
Skipping bad block 0x00ba0000
Skipping bad block 0x00bb0000
Skipping bad block 0x00bc0000
Skipping bad block 0x00bd0000
Skipping bad block 0x00be0000
Skipping bad block 0x00bf0000
Skipping bad block 0x00c00000
Skipping bad block 0x00c10000
Skipping bad block 0x00c20000
Skipping bad block 0x00c30000
Skipping bad block 0x00c40000
Skipping bad block 0x00c50000
Skipping bad block 0x00c60000
Skipping bad block 0x00c70000
Skipping bad block 0x00c80000
Skipping bad block 0x00c90000
Skipping bad block 0x00ca0000
Skipping bad block 0x00cb0000
Skipping bad block 0x00cc0000
Skipping bad block 0x00cd0000
Skipping bad block 0x00ce0000
Skipping bad block 0x00cf0000
Skipping bad block 0x00d00000
Skipping bad block 0x00d10000
Skipping bad block 0x00d20000
Skipping bad block 0x00d30000
Skipping bad block 0x00d40000
Skipping bad block 0x00d50000
Skipping bad block 0x00d60000
Skipping bad block 0x00d70000
Skipping bad block 0x00d80000
Skipping bad block 0x00d90000
Skipping bad block 0x00da0000
Skipping bad block 0x00db0000
Skipping bad block 0x00dc0000
Skipping bad block 0x00dd0000
Skipping bad block 0x00de0000
Skipping bad block 0x00df0000
 4194304 bytes read: OK

NAND read: device 0 offset 0x800000, size 0x400000
Skipping bad block 0x00800000
Skipping bad block 0x00810000
Skipping bad block 0x00820000
Skipping bad block 0x00830000
Skipping bad block 0x00840000
Skipping bad block 0x00850000
Skipping bad block 0x00860000
Skipping bad block 0x00870000
Skipping bad block 0x00880000
Skipping bad block 0x00890000
Skipping bad block 0x008a0000
Skipping bad block 0x008b0000
Skipping bad block 0x008c0000
Skipping bad block 0x008d0000
Skipping bad block 0x008e0000
Skipping bad block 0x008f0000
Skipping bad block 0x00900000
Skipping bad block 0x00910000
Skipping bad block 0x00920000
Skipping bad block 0x00930000
Skipping bad block 0x00940000
Skipping bad block 0x00950000
Skipping bad block 0x00960000
Skipping bad block 0x00970000
Skipping bad block 0x00980000
Skipping bad block 0x00990000
Skipping bad block 0x009a0000
Skipping bad block 0x009b0000
Skipping bad block 0x009c0000
Skipping bad block 0x009d0000
Skipping bad block 0x009e0000
Skipping bad block 0x009f0000
Skipping bad block 0x00a00000
Skipping bad block 0x00a10000
Skipping bad block 0x00a20000
Skipping bad block 0x00a30000
Skipping bad block 0x00a40000
Skipping bad block 0x00a50000
Skipping bad block 0x00a60000
Skipping bad block 0x00a70000
Skipping bad block 0x00a80000
Skipping bad block 0x00a90000
Skipping bad block 0x00aa0000
Skipping bad block 0x00ab0000
Skipping bad block 0x00ac0000
Skipping bad block 0x00ad0000
Skipping bad block 0x00ae0000
Skipping bad block 0x00af0000
Skipping bad block 0x00b00000
Skipping bad block 0x00b10000
Skipping bad block 0x00b20000
Skipping bad block 0x00b30000
Skipping bad block 0x00b40000
Skipping bad block 0x00b50000
Skipping bad block 0x00b60000
Skipping bad block 0x00b70000
Skipping bad block 0x00b80000
Skipping bad block 0x00b90000
Skipping bad block 0x00ba0000
Skipping bad block 0x00bb0000
Skipping bad block 0x00bc0000
Skipping bad block 0x00bd0000
Skipping bad block 0x00be0000
Skipping bad block 0x00bf0000
Skipping bad block 0x00c00000
Skipping bad block 0x00c10000
Skipping bad block 0x00c20000
Skipping bad block 0x00c30000
Skipping bad block 0x00c40000
Skipping bad block 0x00c50000
Skipping bad block 0x00c60000
Skipping bad block 0x00c70000
Skipping bad block 0x00c80000
Skipping bad block 0x00c90000
Skipping bad block 0x00ca0000
Skipping bad block 0x00cb0000
Skipping bad block 0x00cc0000
Skipping bad block 0x00cd0000
Skipping bad block 0x00ce0000
Skipping bad block 0x00cf0000
Skipping bad block 0x00d00000
Skipping bad block 0x00d10000
Skipping bad block 0x00d20000
Skipping bad block 0x00d30000
Skipping bad block 0x00d40000
Skipping bad block 0x00d50000
Skipping bad block 0x00d60000
Skipping bad block 0x00d70000
Skipping bad block 0x00d80000
Skipping bad block 0x00d90000
Skipping bad block 0x00da0000
Skipping bad block 0x00db0000
Skipping bad block 0x00dc0000
Skipping bad block 0x00dd0000
Skipping bad block 0x00de0000
Skipping bad block 0x00df0000
 4194304 bytes read: OK
Wrong Image Format for bootm command
ERROR: can't get kernel image!
Marvell>>

Then i booted debian to just to see if it works.Attached full log in post.


First of all is it safe to erase all chip with "nand erase.chip" command?If you say yes then i must use "nand scrub.chip" to mark false positive bad blocks right?

Here is my mtd partition plan:
mtd0 is u-boot 1.5megs
mtd1 is u-boot envs 128k
mtd2 is rootfs rest of flash

Is this the right way to do it?I just want to use your kernel and rootfs i don't need stock os anymore.
Is there any tutorial how to partition nand?After partitioning i will make an image of mtd2 size on pc and dd it to box.I don't know if my taughts are true or this is the right way i am just making speculation.
Regards.
Attachments:
open | download - Firstbootrn102with8gbnand.txt (173.6 KB)
Re: Debian on Netgear RN102
September 17, 2020 04:59PM
whitepawn,

> NAND:  (ID 0x642c)	8192 MiB
[    4.957071][    T1] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x64
[    4.963573][    T1] nand: Micron MT29F64G08CBABAWP
[    4.969041][    T1] nand: 8192 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB size: 744
Neutron
Linux version 5.8.5-mvebu-370xp-tld-1 (root@tldDebianVM) (arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0, GNU ld (GNU Binutils for Ubuntu) 2.30) #1.0 SMP PREEMPT Mon Aug 31 00:00:32 PDT 2020
Debian 10.5
Thu Sep 17 13:34:00 PDT 2020 up 2 minutes

Congrats! looks very nice.

> First of all is it safe to erase all chip with
> "nand erase.chip" command?If you say yes then i
> must use "nand scrub.chip" to mark false positive
> bad blocks right?

Yes. I would do that nand scrub the first time. After that the mtd system will mark the real bad blocks for you.

> Here is my mtd partition plan:
> mtd0 is u-boot 1.5megs
> mtd1 is u-boot envs 128k
> mtd2 is rootfs rest of flash
>
> Is this the right way to do it?I just want to use
> your kernel and rootfs i don't need stock os
> anymore.
> Is there any tutorial how to partition nand?After
> partitioning i will make an image of mtd2 size on
> pc and dd it to box.I don't know if my taughts are
> true or this is the right way i am just making
> speculation.

There are 2 things to do.

1. Define the mtdparts variable, and possibly also 2 other variables if needed

Example (this is my definition for NSA325 box, adjust them to your real definition)
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:0x100000(uboot),0x80000(uboot_env)
partition=nand0,2

You must keep the u-boot and u-boot envs mtds exactly the way they were in stock.

$ cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00180000 00020000 "u-boot"
mtd1: 00020000 00020000 "u-boot-env"
mtd2: 00600000 00020000 "uImage"
mtd3: 00400000 00020000 "minirootfs"
mtd4: 07400000 00020000 "ubifs"

And the remaining space could be anything you want. Something like this:

setenv mtdparts mtdparts=orion-nand:0x180000@0(u-boot),0x20000@0x180000(u-boot-env),-(rootfs)
And then boot into Debian.

And use nandwrite to populate the first 2 mtds inside Debian (always better to do it in Linux to take advantage of better MTD sysem software).

1. U-boot image can be flashed directly to mtd0 (pay attention to image size and mtd0 size). But still better to pad the rest to fit exactly to mtd0.

2. The easy way to populate the envs mtd is to save it in serial console after the u-boot was flashed and reboot (The harder way is format it as an u-boot image of 128K before flashing).

3. mtd2 UBIFS device needs to be attached before you can create a volume, mount, and then tar the rootfs tarball to it.

Note: mtd2 does not need to be UBIFS, if you just want to populate uImage and uInitrd to boot the USB rootfs. If the goal is to have a real rootfs on NAND then yes, UBIFS is the best option. But this configuration is flexible. There are many alternatives. If you want to real rootfs on USB 3.0 then you need mtd2 and mtd3 to be where the uImage and uInitrd reside.

All 3 steps above need to be filled in (please post questions if you are not sure which commands to use).

========

Food for thought: my rootfs on the Mirabox is on USB 3.0 in the back. My kernel files uImage and uInitrd are on SD card /boot folder. I'm still testing so don't want to flash uImage and uInitrd to MTDs.

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



Edited 2 time(s). Last edit at 09/17/2020 05:55PM by bodhi.
Re: Debian on Netgear RN102
September 17, 2020 07:05PM
Bodhi,
Thank you for your fast reply.
I have scrubbed then erased whole NAND.After scrubbing, my placebo "bad blocks" are gone.I still have some of them but i assume it is normal in such big NAND.Attached log in attachment.

After clearing NAND issues i have set up my envs like below:

Marvell>> mtdparts=pxa3xx_nand-0:0x180000@0(u-boot),0x20000@0x180000(u-boot-env)
Marvell>> mtdids=nand0=pxa3xx
Marvell>> partition=nand0,2
Marvell>> setenv mtdparts 'mtdparts=pxa3xx_nand-0:0x180000@0(u-boot),0x20000@0x180000(u-boot-env),-(rootfs)'
Marvell>> setenv usb_set_bootargs 'setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial'
Marvell>> setenv load_uimage 'ext2load usb 0:1 0x2000000 /boot/uImage'
Marvell>> setenv load_uinitrd 'ext2load usb 0:1 0x3000000 /boot/uInitrd'
Marvell>> setenv usb_boot 'run load_uimage; if run load_uinitrd; then bootm 0x2000000 0x3000000; else bootm 0x2000000; fi'
Marvell>> setenv usb_bootcmd 'run usb_set_bootargs; run usb_boot'
Marvell>> setenv bootcmd 'usb start; run usb_bootcmd; usb stop; reset'
Marvell>> setenv fdt_skip_update yes
Marvell>> boot

Booted debian on USB drive.Attached log in attachment.
It complains about error correction system, how can i fix this?:

T1] nand: WARNING: pxa3xx_nand-0: the ECC used on your system (16b/2048B) is too weak compared to the one required by the NAND chip (40b/1024B)


Checked mtd parts, seems right:


root@Neutron:~# lsblk
NAME      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda         8:0    0  7.5G  0 disk 
`-sda1      8:1    0  7.5G  0 part /
mtdblock0  31:0    0  1.5M  1 disk 
mtdblock1  31:1    0  128K  1 disk 
mtdblock2  31:2    0    8G  1 disk 
root@Neutron:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00180000 00200000 "u-boot"
mtd1: 00020000 00200000 "u-boot-env"
mtd2: 1ffe60000 00200000 "rootfs"
root@Neutron:~#

But when i used nandwrite to test if i can write mtd1 it says permission denied:

root@Neutron:/media# nandwrite -p /dev/mtd1 mtd1  
nandwrite: error!: /dev/mtd1
           error 13 (Permission denied)
root@Neutron:/media# flash_eraseall -j /dev/mtd1
flash_eraseall has been replaced by `flash_erase <mtddev> 0 0`; please use it
flash_erase: error!: /dev/mtd1
             error 13 (Permission denied)

Also could you please make dtb for this layout?Or your linux-5.8.5-mvebu-370xp-tld-1-bodhi archive dtb is enough?I needed it to build U-boot nand image, right now i am using uart image as you know:
Ext. headers = 1, Header size = 81920 bytes Hdr-to-Img gap = 0 bytes
New image size = 0xc5f48[810824] Source image size = 0xbdf44[778052]
failed to open '../armada-370-netgear-rn102.dtb'
Error writing u-boot-a370-2.1WP-nand-db.bin file 

 *** Error: Doimage failed


 *** Error: Build u-boot boot from NAND failed

Quote
Bodhi
1. U-boot image can be flashed directly to mtd0 (pay attention to image size and mtd0 size). But still better to pad the rest to fit exactly to mtd0.
I can take my original mtd0 backup fill it with ff and insert new nand uboot code in it then i can dd it (unsafe maybe because not verified i think) or nandwrite(much safer?)

Quote
Bodhi
2. The easy way to populate the envs mtd is to save it in serial console after the u-boot was flashed and reboot (The harder way is format it as an u-boot image of 128K before flashing).
Since i have original mtd1 backup (which has serial number and my original mac) for this i think i will format partition and dd or nandwrite it.I think i will use hard way.

Quote
Bodhi
3. mtd2 UBIFS device needs to be attached before you can create a volume, mount, and then tar the rootfs tarball to it.

Note: mtd2 does not need to be UBIFS, if you just want to populate uImage and uInitrd to boot the USB rootfs. If the goal is to have a real rootfs on NAND then yes, UBIFS is the best option. But this configuration is flexible. There are many alternatives. If you want to real rootfs on USB 3.0 then you need mtd2 and mtd3 to be where the uImage and uInitrd reside.

Actually i didn't quite understand this question.(Sorry it is late in here and my iq level is dropping.)I want to boot all my system on NAND i will set it and forget it no USB devices needed.I know using system like this will wear out NAND flash but i don't care if it brokes some day i can always solder new one.So is UBIFS the right choice for this purpose right?

Thanks again for your great support.
Regards.
Attachments:
open | download - Nand_scrub.txt (44 KB)
open | download - bootlog.txt (30.8 KB)
Re: Debian on Netgear RN102
September 17, 2020 07:45PM
whitepawn,

I will be back. You need to get some sleep:)

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on Netgear RN102
September 17, 2020 11:01PM
whitepawn,

> It complains about error correction system, how
> can i fix this?

It is ony a warning, it is OK ignore it. To make it perfect, iirc somewhere in the DTS must be modified for this chip. The DTS currently being used works for all MVEBU boxes stock NAND chips.

> But when i used nandwrite to test if i can write
> mtd1 it says permission denied:

Looks like there was error in the initializtion so they are read-only.

[   10.037570][    T1] mtd: partition "u-boot" doesn't end on an erase/write block -- force read-only
[   10.048169][    T1] 0x000000180000-0x0000001a0000 : "u-boot-env"
[   10.053714][    T1] mtd: partition "u-boot-env" doesn't start on an erase/write block boundary -- force read-only
[   10.066049][    T1] 0x0000001a0000-0x000200000000 : "rootfs"
[   10.071274][    T1] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only

So I need to take a look at this a bit closer.

> Also could you please make dtb for this layout?Or
> your linux-5.8.5-mvebu-370xp-tld-1-bodhi archive
> dtb is enough?

Yes. The current DTB in kernel linux-5.8.5-mvebu-370xp-tld-1 is good. The MTDs definition actually is from the bootargs mtdparts. The mtd partitions definition in the DTS is not relevant.

> I can take my original mtd0 backup fill it with ff
> and insert new nand uboot code in it then i can dd
> it (unsafe maybe because not verified i think) or
> nandwrite(much safer?)

Not dd (never use dd to flash u-boot or envs). nandwrite is the tool. And don't manually fill with ff(s) either.

Either use the -p option to let nandwrite pad the empty space for you. Or do it in 2 steps: use dd to write the new u-boot image to a new file which has the size of 0x00180000 (1.5 MB), and then use nandwrite to flash.

> Since i have original mtd1 backup (which has
> serial number and my original mac) for this i
> think i will format partition and dd or
> nandwrite it.I think i will use hard way.

Yeah, I forgot that you have mtd1 backup! that's the better way, use nandwrite to flash.

> Actually i didn't quite understand this
> question.(Sorry it is late in here and my iq level
> is dropping.)I want to boot all my system on NAND
> i will set it and forget it no USB devices
> needed.I know using system like this will wear out
> NAND flash but i don't care if it brokes some day
> i can always solder new one.So is UBIFS the right
> choice for this purpose right?

Yes, UBIFS is the right choice. So to do that, you need to check to see if ubifs commands are available in u-boot. And the env will let the kernel know such file system is used (in the bootargs).

-bodhi
===========================
Forum Wiki
bodhi's corner
tme
Re: Debian on Netgear RN102
September 18, 2020 01:29AM
Hi All,

To assess the amount of work involved in extracting the patches from the stock RN102 U-Boot and apply them to a recent U-Boot, I downloaded the mainline v2011.12 release and the Marwell/Netgear implementation to create the diff-file (attached):
wget https://gitlab.denx.de/u-boot/u-boot/-/archive/v2011.12/u-boot-v2011.12.tar.bz2
tar xf u-boot-v2011.12.tar.bz2 
wget https://www.downloads.netgear.com/files/GPL/ReadyNASOS_V6.6.0_WW_src.zip
mkdir ReadyNASOS_V6.6.0_WW_src && (cd ReadyNASOS_V6.6.0_WW_src && unzip -q ../ReadyNASOS_V6.6.0_WW_src.zip)
ln -s ReadyNASOS_V6.6.0_WW_src/u-boot-2011.12-armada370 u-boot-v2011.12-armada370
diff --recursive --ignore-all-space --ignore-blank-lines u-boot-v2011.12/ u-boot-v2011.12-armada370/ > u-boot-v2011-12.diff

Number of patches:
egrep '^[0-9]' u-boot-v2011-12.diff | wc -l
630

Number of source code lines modified or removed:
egrep '^<' u-boot-v2011-12.diff | wc -l
622

Number of source code lines modified or added:
egrep '^>' u-boot-v2011-12.diff | wc -l
3698

Number of files modified:
egrep '^diff' u-boot-v2011-12.diff | wc -l
97

Number of files added:
egrep '^Only in u-boot-v2011.12-armada370/' u-boot-v2011-12.diff | wc -l
39

Number of files deleted:
egrep '^Only in u-boot-v2011.12/' u-boot-v2011-12.diff | wc -l
16
egrep '^Only in u-boot-v2011.12/' u-boot-v2011-12.diff | egrep -v .gitignore | wc -l
0

My conclusion: The Marwell/Neatgear U-Boot implementaion is very different from the original v2011.12 version. It makes little sense to try to apply the 630 patches to a recent version.

Quote
bodhi
In theory, that's an ideal situation. But U-boot has gone through architectural changes a few times.

Which makes it insane. All work and no play makes Jack a dull boy.

It may make more sense to add support for RN102 in the upcoming U-Boot v2020.10. Support for Marvell Armada 370 and XP SoC was added to mainline U-Boot already in 2015 and was aligned with the Linux 5.x device tree last year. "This file contains the definitions that are common to the Armada 370 and Armada XP SoC". So maybe it's no big deal to add support for RN102 (and RN104). Any thoughts?

Regards,
Trond Melen
Attachments:
open | download - u-boot-v2011-12.diff (163.8 KB)
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: