Welcome! Log In Create A New Profile

Advanced

Debian Installation on Thecus N2350 (Marvell Armada 385)

Posted by lordzahl 
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
April 24, 2018 09:25PM
Manuel,

For info:

Got access to my NSA310S again today. Looks like kernel 4.16.1 is running esekeyd perfectly.

root@Nsa310s:~# uname -a
Linux Nsa310s 4.16.1-kirkwood-tld-1 #1 PREEMPT Mon Apr 9 00:51:18 PDT 2018 armv5tel GNU/Linux

root@Nsa310s:~# dpkg -l | grep esekey
ii  esekeyd                               1.2.7-1                              armel        multimedia keyboard daemon for Linux

root@Nsa310s:~# logread -f
Apr 24 19:15:55 Nsa310s user.notice logger[2490]: POWER button pushed
Apr 24 19:15:58 Nsa310s user.notice logger[2492]: COPY button pushed
Apr 24 19:15:58 Nsa310s user.notice logger[2494]: COPY button pushed
Apr 24 19:16:00 Nsa310s user.notice logger[2496]: COPY button pushed
Apr 24 19:16:00 Nsa310s user.notice logger[2498]: COPY button pushed

So this NSA310S DTS is a better example, atm.

                        pmx_btn_reset: pmx-btn-reset {
                                marvell,pins = "mpp24"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_btn_copy: pmx-btn-copy {
                                marvell,pins = "mpp25"; /* OK */
                                marvell,function = "gpio";
                        };

                        pmx_btn_power: pmx-btn-power {
                                marvell,pins = "mpp26"; /* OK */
                                marvell,function = "gpio";
                        };



gpio_keys {
                compatible = "gpio-keys";
                #address-cells = <1>;
                #size-cells = <0>;
                pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
                pinctrl-names = "default";

                button@1 {
                        label = "Power Button";
                        linux,code = <KEY_POWER>;
                        gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
                };
                button@2 {
                        label = "Copy Button";
                        linux,code = <KEY_COPY>;
                        gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
                };
                button@3 {
                        label = "Reset Button";
                        linux,code = <KEY_RESTART>;
                        gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
                };
        };

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
April 25, 2018 01:42AM
It turns out the esekeyd is broken.

It did not work on my NAS326 either :)
Linux Nas326 4.16.2-mvebu-tld-1 #2 SMP PREEMPT Thu Apr 19 02:47:42 PDT 2018 armv7l GNU/Linux

I guess we're back to square one. I need to figure out why it is not working on kernel 4.16.2-mvebu-tld-1 (it worked in previous version).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
April 28, 2018 08:29PM
Manuel,

It is interesting that the bootcmd exhibits the same problem as with other Armada box! it is always replaced by a hard code bootcmd, even though I have saved a new bootcmd in SPI flash :)

A dilema.

Time to look at u-boot GPL source code!

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



Edited 2 time(s). Last edit at 04/28/2018 08:31PM by bodhi.
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
April 28, 2018 08:56PM
Yes. That was a pretty lazy and nasty piece of code (WTF were they thinking? or perhaps smoking? :)

env = getenv("firstboot");
        if (env && (strcmp(env, "1") == 0)){
                setenv("bootcmd", "usb start;"
                "if fatload usb 0:1 0x2000000 rescue_fw/rescue_fw.img;"
                "then imi 0x2000000;source 0x2000000;"
                "else setenv firstboot 0;saveenv;fi;"
                "ubi part ubifs;ubifsmount boot;ubifsload 0x2000000 boot/bzImage;"
                "ubifsload 0x3000000 boot/ramdisk;bootm 0x2000000 0x3000000;");
        }else{
                setenv("bootcmd", "usb start;"
                "if fatload usb 0:1 0x2000000 rescue_fw/rescue_fw.img;"
                "then imi 0x2000000;source 0x2000000;fi;"
                "ubi part ubifs;ubifsmount boot;ubifsload 0x2000000 boot/bzImage;"
                "ubifsload 0x3000000 boot/ramdisk;bootm 0x2000000 0x3000000;");
        }

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



Edited 1 time(s). Last edit at 04/28/2018 08:57PM by bodhi.
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
April 30, 2018 05:10PM
Manuel,

Looks like our mtdparts definition has some problem. Stock OS use a different one internally.

N2350:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 20000000 00020000 "ubifs"
mtd1: 00400000 00010000 "U-Boot-img"
mtd2: 00300000 00010000 "U-Boot-env"


Did we use the current defintion base on stock u-boot envs?

root@ThecusN2350:/localdisk/linux/thecus_n2350# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 20000000 00020000 "ubifs"
mtd1: 00100000 00001000 "uboot"
mtd2: 00010000 00001000 "uboot_env"

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
April 30, 2018 07:46PM
I got it.

I see this is not totally wrong (they way we defined it).

cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 20000000 00020000 "ubifs"
mtd1: 00100000 00001000 "uboot"
mtd2: 00010000 00001000 "uboot_env"

But it did prevent us from using an internal feature supported by stock u-boot.

I'll do some more testing and will post a new approach in booting Debian using run_script env. I think it will be more elegant than using a FAT partition with rescue FW. Really a saving grace from that bad hardcoded bootcmd they have right now :)

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



Edited 1 time(s). Last edit at 04/30/2018 07:48PM by bodhi.
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 01, 2018 04:50AM
Hi bodhi,

Sorry for not replying for a few days. We had/still have a holiday here in germany.
The hard coded bootcmd really sucks. It's a really stupid idea from the thecus guys.
I will try to catch up with your posts when i am home tomorrow.
I am happy to see that you had time to get your box running!
Cheers,
Manuel
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 01, 2018 03:16PM
Manuel,

It is running quite well! I'm adding some more LED GPIOs. Also the Poweroff GPIO worked as intended (shutdown the box completely). But I have not tried testing WOL yet.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 01, 2018 07:44PM
Manuel,

mtdparts shoud be:

setenv set_bootargs 'setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:-(ubifs);spi1.0:0x00400000(uboot),0x00010000@0x00100000(uboot_env) earlyprintk=serial"'

This makes the u-boot mtd to be 4MB. Which is what stock defined it to be.

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



Edited 1 time(s). Last edit at 05/02/2018 04:17AM by bodhi.
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 02, 2018 04:16AM
Hi Manuel,

You have the u-boot GPL in this post:

https://forum.doozan.com/read.php?2,50829,56009#msg-56009

But I could not find instruction to set up the build environment in this tarball!

Things such as arm-marvell-linux-gnueabi-gcc library needd to be prepared before we can rebuild stock u-boot. Were there some other scripts included in some other download tarball?

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 02, 2018 04:23AM
Hi bodhi,

No there were no other scripts in other tar balls.

There is only the "Build_Thecus.sh" script, which defines the CROSS_COMPILE(_BH) commands and then calls ./build.pl, which seems to be also a custom Thecus/Marvell build script.

I have just set CROSS_COMPILE(_BH) to some appropriate cross compiler, which was installable with my package system (on ARCH linux). Should be an older compiler - they used 4.6 or 4.9 as stated in the Build_Thecus.sh script. But i guess you will have a toolchain lying around.

I have already rebuild stock uboot (which i used for booting over UART) - so i can take a look at home, which toolchain i used.
Cheers, Manuel
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 02, 2018 04:41AM
Thanks Manuel!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 02, 2018 05:15PM
I think I got the toochain in NAS326 u-boot GPL: NAS326_520AAZF1C0.tar.gz.

This is a slightly older version for Zyxel NAS326 u-boot which is based of the same Marvell u-boot. Will try to see it is good enough.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 02, 2018 07:31PM
bodhi Wrote:
-------------------------------------------------------
> I think I got the toochain in NAS326 u-boot GPL:
> NAS326_520AAZF1C0.tar.gz.
>
> This is a slightly older version for Zyxel NAS326
> u-boot which is based of the same Marvell u-boot.
> Will try to see it is good enough.

Nope! it is a different toolchain: arm-marvell-linux-gnueabihf.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 02, 2018 08:57PM
So my show stopper right now in building this uboot.

This library probably is too specific to Thecus build.
cat Build_Thecus.sh
#!/bin/sh

		export PATH=/usr/local/armv7-marvell-linux-gnueabi-softfp-4.6.4_64K_i686_20160226/bin:/usr/local/gcc-4.9.3/bin:$PATH
		# To build Uboot
		export CROSS_COMPILE=arm-marvell-linux-gnueabi-
		# To Build Bin-Hdr
		export CROSS_COMPILE_BH=arm-marvell-linux-gnueabi-

		make mrproper

		./build.pl -b armada_38x_customer0 -f spi -v 2015T1_p18_Thecus -i nand:spi -c -o . -m4

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 03, 2018 12:59AM
Hi bodhi,

Sorry, i forgot to look up my toolchain yesterday.
You don't need the PATH variable, if you have your toolchain already available. The thecus guys just load their toolchain with this.
The only thing you need to do, is to set CROSS_COMPILE[_BH] with an arm cross compiling toolchain.
I can give detailed instructions this evening.

Why did the Thecus guys use a softfp toolchain. Doesn't have the 38x Marvell CPUs a floating point unit and are hardfp therefore?
Cheers, Manuel

edit the 2nd:
Yes, hardfloat does not work with this uboot. So i just tested this:
From here download
"gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi.tar.xz" if you are compiling on a x86_64 machine.
The Build_Thecus.sh script should now look like this:
TOOLCHAIN=$PWD/../../gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi
export PATH=$TOOLCHAIN/bin:$PATH
export CROSS_COMPILE=arm-linux-gnueabi-
export CROSS_COMPILE_BH=$CROSS_COMPILE

make mrproper

./build.pl -b armada_38x_customer0 -f spi -v 2015T1_p18_Thecus -i nand:spi -c -o . -m4

Just replace the TOOLCHAIN= value with the path where you extracted the linaro toolchain.
Then the build should run fine.



Edited 3 time(s). Last edit at 05/03/2018 01:17AM by lordzahl.
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 03, 2018 01:50AM
Thanks Manuel!

It's strange that they released the GPL without the tools installations script. That usually comes inside the tarball.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 03, 2018 03:48AM
You did good works Manuel :)

UART booting was successful on my Thecus with the script.

1st terminal

./download-serial.sh /dev/ttyUSB0 u-boot-a38x-2015T1_p18_Thecus-spi-uart.bin 
Now reset or power cycle your Armada 38x board and then press enter
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something -1
Sleeping
Out of sleep
Got something 21
Got NACK (0x15) character
The board should be in serial downloader now. Sending the binary file 
Sending u-boot-a38x-2015T1_p18_Thecus-spi-uart.bin, 7486 blocks: Give your local XMODEM receive command now.
Bytes Sent: 958336   BPS:9796                            

Transfer complete



2nd terminal

V /  __/ | |
|_|  |_|\__,_|_|    \_/ \___|_|_|
         _   _     ____              _
        | | | |   | __ )  ___   ___ | |_Board: A38x-Customer0-Thecus-N2350
SoC:   MV88F6820 Rev A0
       running 2 CPUs
CPU:   ARM Cortex A9 MPCore (Rev 1) LE
       CPU 0
       CPU    @ 1066 [MHz]
       L2     @ 800 [MHz]
       TClock @ 200 [MHz]
       DDR4    @ 800 [MHz]
       DDR4 32 Bit Width,FastPath Memory Access, DLB Enabled, ECC Disabled
DRAM:  1 GiB
NAND:  512 MiB
MMC:   mv_sdh: 0
SF: Detected MX25L3205D with page size 64 KiB, total 4 MiB
USB2.0 0: Host Mode
USB3.0 0: Host Mode
USB3.0 1: Host Mode

Map:   Code:			0x3fed4000:0x3ff95ce4
       BSS:			0x3ffef504
       Stack:			0x3f9c3f20
       Heap:			0x3f9c4000:0x3fed4000
       U-Boot Environment:	0x00100000:0x00110000 (SPI)

Board configuration detected:
Net:   
|  port  | Interface | PHY address  |
|--------|-----------|--------------|
| egiga0 |   SGMII   |     0x01     |
egiga0 [PRIME]
Hit any key to stop autoboot:  0 
Marvell>> ver

U-Boot 2013.01 (May 03 2018 - 01:03:35) Marvell version: 2015_T1.0p18-bodhi-tld-1
arm-linux-gnueabi-gcc (Linaro GCC 4.9-2017.01) 4.9.4
GNU ld (Linaro_Binutils-2017.01) 2.24.0.20141017 Linaro 2014_11-3-git

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



Edited 1 time(s). Last edit at 05/03/2018 03:51AM by bodhi.
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 03, 2018 05:23PM
Using the internal script feature, I've flashed a run script to SPI flash mtd3 which is at 0x000000300000 address (starting at 3MB). After the script was written to mtd3, to activate this feature, set the env

run_script=yes


The most important thing to be aware is this Thecus implementation is a little bit too careless (they probably expected only developer would know how to use it). I would not execute this script too early like they are doing.

So we want to take precaution and avoid running any thing in this script
. We should only redefine the envs and let it boot naturally.


BootROM - 1.73
Booting from SPI flash


General initialization - Version: 1.0.0
AVS selection from EFUSE disabled (Skip reading EFUSE values)
Overriding default AVS value to: 0x23
Detected Device ID 6820
High speed PHY - Version: 2.0

Init Customer board board SerDes lanes topology details:
 | Lane # | Speed|    Type     |
 ------------------------------|
 |   0    |  0   |  SGMII0     |
 |   1    |  3   |  SATA0      |
 |   2    |  3   |  SATA1      |
 |   4    |  5   |  USB3 HOST0 |
 |   5    |  5   |  USB3 HOST1 |
 -------------------------------
High speed PHY - Ended Successfully
DDR4 Training Sequence - Ver TIP-0.23.(Sublib 0.8)0
DDR4 Training Sequence - Switching XBAR Window to FastPath Window 
DDR4 Training Sequence - Ended Successfully
BootROM: Image checksum verification PASSED

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


U-Boot 2013.01 (Jun 20 2017 - 14:02:04) Marvell version: 2015_T1.0p18

Board: A38x-Customer0-Thecus-N2350
SoC:   MV88F6820 Rev A0
       running 2 CPUs
CPU:   ARM Cortex A9 MPCore (Rev 1) LE
       CPU 0
       CPU    @ 1066 [MHz]
       L2     @ 800 [MHz]
       TClock @ 200 [MHz]
       DDR4    @ 800 [MHz]
       DDR4 32 Bit Width,FastPath Memory Access, DLB Enabled, ECC Disabled
DRAM:  1 GiB
NAND:  512 MiB
MMC:   mv_sdh: 0
SF: Detected MX25L3205D with page size 64 KiB, total 4 MiB
USB2.0 0: Host Mode
USB3.0 0: Host Mode
USB3.0 1: Host Mode

Map:   Code:			0x3fed0000:0x3ff959e4
       BSS:			0x3ffef104
       Stack:			0x3f9bff20
       Heap:			0x3f9c0000:0x3fed0000
       U-Boot Environment:	0x00100000:0x00110000 (SPI)

Board configuration detected:
SF: Detected MX25L3205D with page size 64 KiB, total 4 MiB
## Executing script at 3f9d8080

U-Boot custom run script …
boot_config=setenv devices "usb ide"; setenv bootdev usb; setenv device 0:1; setenv disks "0 1 2 3 4 5 6 7";
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if ext2load $dev $disknum:1 $load_image_addr /boot/zImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
kernel_config=setenv load_dtb_addr 0x1000000; setenv load_initrd_addr 0x3000000; setenv load_image_addr 0x02000000; setenv dtb_file /boot/dts/armada-385-thecus-n2350.dtb
load_image=echo loading zImage ...; ext2load $bootdev $device $load_image_addr /boot/zImage
load_dtb=echo loading DTB $dtb_file ...; ext2load $bootdev $device $load_dtb_addr $dtb_file
load_initrd=echo loading uInitrd ...; ext2load $bootdev $device $load_initrd_addr /boot/uInitrd
set_bootargs=setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:-(ubifs);spi1.0:0x00400000(uboot),0x00010000@0x00100000(uboot_env),0x00010000@0x00300000(uboot_scr) earlyprintk=serial"
bootcmd_exec=echo Booting from $bootdev $device …; setenv fdt_skip_update yes; setenv initrd_high 0xffffffff; if run load_image; then; if run load_initrd; then if run load_dtb; then bootz $load_image_addr $load_initrd_addr $load_dtb_addr; else bootz $load_image_addr $load_initrd_addr; fi; else if run load_dtb; then bootz $load_image_addr - $load_dtb_addr; else bootz $load_image_addr; fi; fi; fi
bootcmd_custom=run boot_config; run kernel_config; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd=echo Booting Debian ...; run bootcmd_custom; echo Booting stock ...; usb reset; if fatload usb 0:1 0x2000000 rescue_fw/rescue_fw.img;then imi 0x2000000;source 0x2000000; fi; ubi part ubifs;ubifsmount boot;ubifsload 0x2000000 boot/bzImage;ubifsload 0x3000000 boot/ramdisk;bootm 0x2000000 0x3000000
Done executing U-boot custom run script …

Net:   
|  port  | Interface | PHY address  |
|--------|-----------|--------------|
| egiga0 |   SGMII   |     0x01     |
egiga0 [PRIME]
Hit any key to stop autoboot:  0 
Booting Debian ...
running scan_disk ...
Scan device usb
(Re)start USB...
USB0:   Port (usbActive) : 0	Interface (usbType = 3) : Anson:xhci_usb_lowlevel_init--1--index=0
Anson:xhci_usb_lowlevel_init--2
Anson:Register 2000120 NbrPorts 2
USB XHCI 1.00
Anson:xhci_usb_lowlevel_init--3
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
       scanning usb for ethernet devices... 0 Ethernet Device(s) found
device usb 0:1
1 bytes read in 303 ms (0 Bytes/s)
Found bootable drive on usb 0
Booting from usb 0:1 …
loading zImage ...
4325872 bytes read in 404 ms (10.2 MiB/s)
loading uInitrd ...
9080165 bytes read in 539 ms (16.1 MiB/s)
loading DTB /boot/dts/armada-385-thecus-n2350.dtb ...
19337 bytes read in 966 ms (19.5 KiB/s)
## Loading init Ramdisk from Legacy Image at 03000000 ...
   Image Name:   initramfs-4.16.2-mvebu-tld-1
   Created:      2018-04-20   8:46:24 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    9080101 Bytes = 8.7 MiB
   Load Address: 00000000
   Entry Point:  00000000
## Flattened Device Tree blob at 01000000
   Booting using the fdt blob at 0x01000000
   Loading Device Tree to 00ff8000, end 00fffb88 ... OK

   Skipping Device Tree update ('fdt_skip_update' = yes)

Limit DDR size at 3GB due to power of 2 requirement of Address decoding

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.16.2-mvebu-tld-1 (root@tldDebianVM) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)) #2 SMP PREEMPT Thu Apr 19 02:47:42 PDT 2018
[    0.000000] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Thecus N2350
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] random: fast init done
[    0.000000] percpu: Embedded 18 pages/cpu @(ptrval) s40972 r8192 d24564 u73728
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 260608
[    0.000000] Kernel command line: console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:-(ubifs);spi1.0:0x00400000(uboot),0x00010000@0x00100000(uboot_env),0x00010000@0x00300000(uboot_scr) earlyprintk=serial

<snip>


[    1.637633] 3 cmdlinepart partitions found on MTD device spi1.0
[    1.643605] Creating 3 MTD partitions on "spi1.0":
[    1.648424] 0x000000000000-0x000000400000 : "uboot"
[    1.654001] 0x000000100000-0x000000110000 : "uboot_env"
[    1.659857] 0x000000300000-0x000000310000 : "uboot_scr"

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



Edited 1 time(s). Last edit at 05/03/2018 05:27PM by bodhi.
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 04, 2018 11:55PM
GPIO fan is not working as I would expect. We can only turn it on full speed!

Perhaps stock OS has some utility to manage the fan speed.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 05, 2018 05:22AM
Hi bodhi,

Thanks for the new kernel!
I need to catch up to your updated mtd definitions soon..
Ok, i didn't try the fan yet. I only use 2.5" HDDs, so not much heat. Bute only full speed is not good.
Sorry i don't have a lot of time at the moment. I will be very busy with work this month.
Cheers, Manuel
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 05, 2018 05:44AM
Manuel,

> Sorry i don't have a lot of time at the moment. I
> will be very busy with work this month.

That's fine! I think we got all the main features running well.

Only miscellaneous stuff such as the fan that need to be explored. But like you, I run with 2.5 HDD so I kept the fan in default low speed set by u-boot. The full speed fan is definitely a no-no for me (I would go the extra mile to eliminate that noise if I have to :)

There is also a network LED in the front panel that flashes constanly when we connect to it. That will be turned off when I can test a few more gpio-leds in the DTS.

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



Edited 2 time(s). Last edit at 05/05/2018 05:50AM by bodhi.
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 05, 2018 05:49AM
Here is the LEDS setup I've added to run in /etc/rc.local.

Note the Power LED and USB LED are new.


if [ -d /sys/class/leds/n2350:white:sys ]; then

	echo default-on >  /sys/class/leds/n2350\:blue\:pwr/trigger 
	echo none >  /sys/class/leds/n2350\:red\:pwr/trigger 
	echo default-on	> /sys/class/leds/n2350\:white\:sys/trigger 
        echo none	> /sys/class/leds/n2350\:red\:sys/trigger 
	echo ide-disk1  > /sys/class/leds/n2350:white:sata1/trigger
	echo ide-disk2  > /sys/class/leds/n2350:white:sata2/trigger
	echo usb-host  >  /sys/class/leds/n2350\:white\:usb/trigger 
fi

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



Edited 1 time(s). Last edit at 05/05/2018 05:51AM by bodhi.
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 05, 2018 08:59PM
Hi Manuel,

In case you want to test this run_script.

The command to flash the script (see attached script file):

flashcp -v thecus-n2350-boot-script-tld-2.scr  /dev/mtd3

And then set to run Debian

fw_setenv run_script yes

And then set to run stock
fw_setenv run_script no

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



Edited 1 time(s). Last edit at 05/05/2018 09:40PM by bodhi.
Attachments:
open | download - thecus-n2350-boot-script-tld-2.scr (2.6 KB)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 13, 2018 04:25PM
Manuel,

The run_script can be easily installed while in Debian as I described above, but not in stock OS. Stock OS kernel is too old, so to set up the Debian installation procedure for it is not easy. Too many hoops for the users to jump through.

I've patched stock u-boot to work the way we want, and flashed it to mtd1. It is working fine so I will release that as part of the installation instruction.

When you come back to this thread, let me know if you want to test flashing new u-boot.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 14, 2018 02:35AM
Hi bodhi,

Yes, i should be able to test this, maybe this evening or in the following days.
I need to fix my mtds first. You posted a correction to their definition a couple of posts back.
I will check back with you, if they are allright, before flashing, just to be sure.
Cheers,
Manuel
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 14, 2018 04:10AM
Flash new u-boot in stock OS or Debian.

This new u-boot is a drop-in replacement for stock u-boot. The only thing I've changed were: remove the code to always reset bootcmd, and the identification string. With this u-boot, whatever we set the bootcmd to, it will stick permanently.

There are 2 files attached in this post.

-rw-r--r--   1 root root 959584 May 12 16:14 u-boot-a38x-2015T1_p18_Thecus-tld-2-spi.bin
-rwxr-xr-x   1 root root   2732 May 13 15:31 thecus-n2350-boot-script-tld-3.sh

sha256sum
4c6c17dc5b3e622f95447ba7f8049f0991ffca2636c429f27f176473b3b260fc  u-boot-a38x-2015T1_p18_Thecus-tld-2-spi.bin

1. In either stock OS or Debian, make sure the first 3 mtds have the following definition

cat /proc/mtd
dev:    size   erasesize  name
mtd0: 20000000 00020000 "ubifs"
mtd1: 00400000 00010000 "U-Boot-img"
mtd2: 00300000 00010000 "U-Boot-env"
And dump mtds to backup:
nanddump --noecc --omitoob -f thecus_n2350.mtd0 /dev/mtd0
dd if=/dev/mtd1 of=thecus_n2350.mtd1 bs=4096k conv=sync
dd if=/dev/mtd2 of=thecus_n2350.mtd2 bs=3072k conv=sync


2. Flash new u-boot to mtd1:

flashcp -v u-boot-a38x-2015T1_p18_Thecus-tld-2-spi.bin  /dev/mtd1
Expected output
Erasing blocks: 15/15 (100%)
Writing data: 937k/0k (100%)
Verifying data: 937k/0k (100%)

3. Proceed to set all the necessary envs with the script thecus-n2350-boot-script-tld-3.sh.

Note: You choose to can reboot right now without setting envs permanently (running this script will set all envs permanently to mtd2 to boot Debian and stock). This u-boot behavior is exactly the same as before (the rescue FW will work the same way) without any new envs needed.

./thecus-n2350-boot-script-tld-3.sh
Expected output
boot_config=setenv devices "usb ide"; setenv bootdev usb; setenv device 0:1; setenv disks "0 1 2 3 4 5 6 7";
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if ext2load $dev $disknum:1 $load_image_addr /boot/zImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
kernel_config=setenv load_dtb_addr 0x1000000; setenv load_initrd_addr 0x3000000; setenv load_image_addr 0x02000000; setenv dtb_file /boot/dts/armada-385-thecus-n2350.dtb
load_image=echo loading zImage ...; ext2load $bootdev $device $load_image_addr /boot/zImage
load_dtb=echo loading DTB $dtb_file ...; ext2load $bootdev $device $load_dtb_addr $dtb_file
load_initrd=echo loading uInitrd ...; ext2load $bootdev $device $load_initrd_addr /boot/uInitrd
set_bootargs=setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:-(ubifs);spi1.0:0x00400000(uboot),0x00010000@0x00100000(uboot_env),0x00010000@0x00300000(uboot_scr) earlyprintk=serial"
set_bootargs_stock=setenv bootargs "root=/dev/ram0 rw max_loop=210 console=ttyS0,115200 init=sbin/init rootdelay=3 ubi.mtd=0 mtdparts=armada-nand:-(ubifs);spi_flash:0x00400000(uboot),0x00010000@0x00100000(uboot_env)"
bootcmd_exec=echo Booting from $bootdev $device …; setenv fdt_skip_update yes; setenv initrd_high 0xffffffff; if run load_image; then; if run load_initrd; then if run load_dtb; then bootz $load_image_addr $load_initrd_addr $load_dtb_addr; else bootz $load_image_addr $load_initrd_addr; fi; else if run load_dtb; then bootz $load_image_addr - $load_dtb_addr; else bootz $load_image_addr; fi; fi; fi
bootcmd_custom=run boot_config; run kernel_config; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd=echo Booting Debian ...; run bootcmd_custom; echo Booting stock ...; run set_bootargs_stock; usb reset; if fatload usb 0:1 0x2000000 rescue_fw/rescue_fw.img;then imi 0x2000000;source 0x2000000; fi; ubi part ubifs;ubifsmount boot;ubifsload 0x2000000 boot/bzImage;ubifsload 0x3000000 boot/ramdisk;bootm 0x2000000 0x3000000

4. Reboot

Watch serial console, the u-boot banner will show

U-Boot 2013.01 (May 12 2018 - 16:14:10) Marvell version: 2015_T1.0p18-tld-2

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



Edited 4 time(s). Last edit at 05/14/2018 05:15AM by bodhi.
Attachments:
open | download - u-boot-a38x-2015T1_p18_Thecus-tld-2-spi.bin (937.1 KB)
open | download - thecus-n2350-boot-script-tld-3.sh (2.7 KB)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 14, 2018 04:30AM
OK I'm done editing the installation post above :)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 14, 2018 02:05PM
Hi bodhi,

Thanks for your detailed description.
You show the result of "cat /proc/mtd". Can you give me your line for the mtdparts definition as well?
Your script only includes e.g.
mtdparts=armada-nand:-(ubifs);spi1.0:0x00400000(uboot),0x00010000@0x00100000(uboot_env),0x00010000@0x00300000(uboot_scr)

which leads to:
$ cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 20000000 00020000 "ubifs"
mtd1: 00400000 00001000 "uboot"
mtd2: 00010000 00001000 "uboot_env"
mtd3: 00010000 00001000 "uboot_scr"

Also a few posts earlier you gave a corrected mtdparts definition, which still is different from what you show in your last post.
Thanks!
Manuel
Re: Debian Installation on Thecus N2350 (Marvell Armada 385)
May 14, 2018 04:47PM
Hi Manuel,

If you cat the script thecus-n2350-boot-script-tld-3.sh, you'll see the envs define the mtdparts for both stock and Debian.

The mtdparts for stock is in this bootargs

set_bootargs_stock=setenv bootargs "root=/dev/ram0 rw max_loop=210 console=ttyS0,115200 init=sbin/init rootdelay=3 ubi.mtd=0 mtdparts=armada-nand:-(ubifs);spi_flash:0x00400000(uboot),0x00010000@0x00100000(uboot_env)"
Therefore
mtdparts=armada-nand:-(ubifs);spi_flash:0x00400000(uboot),0x00010000@0x00100000(uboot_env)

The mtdparts for Debian is in this bootargs
set_bootargs=setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:-(ubifs);spi1.0:0x00400000(uboot),0x00010000@0x00100000(uboot_env),0x00010000@0x00300000(uboot_scr) earlyprintk=serial"
Therefore
mtdparts=armada-nand:-(ubifs);spi1.0:0x00400000(uboot),0x00010000@0x00100000(uboot_env),0x00010000@0x00300000(uboot_scr)


For stock, actually the mtdparts will take the definition inside DTB. I've redefined it here in bootargs just for clarity. When you boot to stock it wil show the actual name from the DTB (The extra mtds 3 to 6 were created by UBIFS during stock kernel booting, not by DTB).

N2350:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 20000000 00020000 "ubifs"
mtd1: 00400000 00010000 "U-Boot-img"
mtd2: 00300000 00010000 "U-Boot-env"
mtd3: 058c3000 0001f000 "boot"
mtd4: 008d7000 0001f000 "etc"
mtd5: 16fc3000 0001f000 "rom"
mtd6: 01477000 0001f000 "version"

========

And the only relevant parts that need to be verified are the first 3 mtds.

Note they are the same except for the name (which is irrelevant to us).

cat /proc/mtd # ---- stock
dev:    size   erasesize  name
mtd0: 20000000 00020000 "ubifs"
mtd1: 00400000 00010000 "U-Boot-img"
mtd2: 00300000 00010000 "U-Boot-env"

$ cat /proc/mtd # ---- Debian
dev:    size   erasesize  name
mtd0: 20000000 00020000 "ubifs"
mtd1: 00400000 00001000 "uboot"
mtd2: 00010000 00001000 "uboot_env"

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



Edited 2 time(s). Last edit at 05/14/2018 11:41PM by bodhi.
Author:

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: