I have access to a command 'ir' in the old u-boot. I'm not sure if it takes an absolute address (base+reg) or a register address, or what. But, assuming its just the register address, this is what i get from the original u-boot. ## KW_REG_UNDOC_0x1470 Marvell>> ir 0x1470 Internal register 0x1470 value : 0x1d181e19 31 24 16 8 0by donbowman - uBoot
So, almost success. I have everything working, from u-boot through linux, ram is setup, usb works, ethernet works, etc. But, this system has a sata expander (88SM4140). And i'm not seeing either it or the two disk slots. And this is the primary mission for a NAS :) So I think i have some GPIO setup issues is my conclusion. The board has no LED's that are sw controlled. It doesby donbowman - uBoot
OK sleeves rolled up, i have created a board support in u-boot, compiled it, loaded it from kwboot, and programmed it to flash. and it works. I was able to program it w/ tftpload / nand write will clean up the fixes and send a PR in github. it is similar to the NAS325, but w/ a different Ethernet PHY and init registers / ram.by donbowman - uBoot
Hmm, further... if i let i program mtd0 using u-boot (nbubt command), and then do a nand read of that to ram, and boot there, it works. e.g. the contents of that nand are readable by u-boot properly. So it means that (?) the header doesn't match what the soc boot loader wants (?) nand read 0x2000000 0 0x80000 NAND read: device 0 offset 0x0, size 0x80000 524288 bytes read: ERby donbowman - uBoot
after it programs the u-boot from u-boot (using the bubt). If i try to read the nand, it gives error: Marvell>> nand read 0 0 0x10000 NAND read: device 0 offset 0x0, size 0x10000 65536 bytes read: ERROR leading me to believe its trying to do ecc on the u-boot block whereas if i read from the uImage partition, it works: nand read 0 0x7900000 0x10000 NAND read: device 0by donbowman - uBoot
In the original uboot, there are two commands to program the boot nand. nbubt -- this fetches a file (nboot.bin) w/ tftp, and then erases 0-4096, and programs that. bubt -- this fetches a file w/ tftp (u-boot.bin), and then erases 0-655360 and programs that. i'm not sure what to make of this, is the small one for some mfg process that auto programs the rest? is it a 2-stage boot?by donbowman - uBoot
this is all w/ the stock (mfg-supplied) kernel, i've temporarily parked my uImage. Image Name: Linux-2.6.31.8 Created: 2014-03-16 8:51:43 UTC Its not really obvious what its using for a driver: # dmesg |egrep -i "nand|orion|armada|marvell|mv|mtd" CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977 Kernel command line: console=ttyS0,11520by donbowman - uBoot
So I tried patching the header to be 1-bit hamming, and nogo. (nas)#nandwrite /dev/mtd0 uboot-nand-patched.bin Writing data to block 0 at offset 0x0 Writing data to block 1 at offset 0x20000 Writing data to block 2 at offset 0x40000 Writing data to block 3 at offset 0x60000 (nas)#nanddump -l 0x80000 -f /tmp/mtd0.img /dev/mtd0 ECC failed: 0 ECC corrected: 0 Number of bad blocks: 0 Nby donbowman - uBoot
Hmm, the ECC mode of 0 is not disabled in the header. From tools/kwbimage.h: /* NAND ECC Mode */ #define IBR_HDR_ECC_DEFAULT 0x00 #define IBR_HDR_ECC_FORCED_HAMMING 0x01 #define IBR_HDR_ECC_FORCED_RS 0x02 #define IBR_HDR_ECC_DISABLED 0x03 So maybe i try changing the header to 0x1.by donbowman - uBoot
I have a copy of the mtd0 that i made before i started. I have the mtd2...N from the manufacturer from their web site. I have written to them and asked for the source code to both the u-boot and linux bits, but i do not have much hope. They did release some for x86, so i guess they know they should. I have made my own dts file for linux, and thus my linux uImage will boot (as weil as theby donbowman - uBoot
Yes, but i was thinking of the oob/ecc memory were interleaved in the dump that it wouldn't boot correctly from the serial. my conclusion also was that given i have 512.0K that it must not have oob info. and yeah, i got nothing to lose :) I wonder how one can read the MPP / Boot Device Mode Options register to see what it is expecting from the board strapping. http://www.marvell.by donbowman - uBoot
Ok, some more thinking. I think(?) that i am writing this w/o ECC somehow. if i program it from u-boot (w/ nand write), and then in linux I read it as nanddump -o -f mtd0.img /dev/mtd0 then I see a bunch of lines like: ECC: 8 corrected bitflip(s) at offset 0x000b9000 So what if i have a file which is the post-ecc corrected (e.g. the proper image), but I am writing it somehow such thaby donbowman - uBoot
(nas)#cat /proc/mtd dev: size erasesize name mtd0: 00100000 00020000 "bootloader" mtd1: 00400000 00020000 "data" mtd2: 01000000 00020000 "backup-kernel" mtd3: 06400000 00020000 "backup-system" mtd4: 01000000 00020000 "kernel" mtd5: 17700000 00020000 "rootfs" is what the original kernel shows. the mtd1 is all 0xff from fby donbowman - uBoot
So attempt method #1: corrupt the environment. When i boot (via kwboot) this trips it going back and re-program the world. (gist here). If i then power cycle, nothing happens. This leads me to believe that somehow I have extracted the mtd0 incorrectly, in such a way that it can still boot from kwboot, but not from flash??? [this has programmed the flash as per factory, OK, reboot againby donbowman - uBoot
/home/don/src/u-boot-kirkwood/tools/kwboot -p -t -B 115200 /dev/ttyUSB0 -b bin/targets/kirkwood/generic/uboot-nand.bin is how i am booting it. uboot-nand.bin is the contents i extracted from mtd0. it is working (e.g. the board boots up when i do this). ls -lh bin/targets/kirkwood/generic/uboot-nand.bin -rw-rw-r-- 1 don don 512K Feb 3 17:36 bin/targets/kirkwood/generic/uboot-nand.binby donbowman - uBoot
I have a TerraMaster F2-NAS2. Its a Marvell kirkwood (88F6282). The board is capable of kwboot a u-boot image. I have constructed a .dts file and used this to build a linux uImage, which boots successfully (I have not attempted to build u-boot w/ this yet tho). I have the original u-boot image (extracted from the mtd0) and can boot it from kwboot. But, when i save the image into mtd0, it dby donbowman - uBoot