Welcome! Log In Create A New Profile

Advanced

Debian on wrt1200ac

Posted by fsonnlei 
Debian on wrt1200ac
July 31, 2019 01:16PM
Hi all.

Recently I installed Debian mvebu on my wrt1200ac.
Using dts from https://github.com/Chadster766/McDebian/tree/master/linux-4.19.12/arch/arm/boot/dts and kernel / rootfs 5.1.7 from bodhi (thanks!), I successfully booted and ran the OS. Almost everything works: ethernet switch, wifi (mwlwifi compiled as module), cpu speed, etc.

However the kernel reports less memory than other OSs:
              total        used        free      shared  buff/cache   available
Mem:         376032       62060      107272        1448      206700      258396
Swap:             0           0           0

The router has 512mb ram. OpenWRT and mcdebian (https://github.com/Chadster766/McDebian) reports full ram capacity.

Any ideas?

Regards
fsonnlei
Re: Debian on wrt1200ac
July 31, 2019 04:19PM
Hi,

Starting point is a full serial log, from uboot init through loading of the kernel + with a openwrt boot as well. It's possible WRT is doing platform specific tricks, but hard to know without the log.
Re: Debian on wrt1200ac
July 31, 2019 04:37PM
Thanks. Attached files:
- fw_printenv from Debian Bodhi
- dmesg from Debian Bodhi
- dmesg from OpenWRT

Best,
fsonnlei
Attachments:
open | download - printenv.txt (4 KB)
open | download - dmesg_bodhi.txt (42.4 KB)
open | download - dmesg_openwrt.txt (34.4 KB)
Re: Debian on wrt1200ac
July 31, 2019 04:45PM
uboot.txt
Attachments:
open | download - uboot.txt (5.5 KB)
Re: Debian on wrt1200ac
August 01, 2019 12:20AM
fsonnlei,

> Recently I installed Debian mvebu on my
> wrt1200ac.
> Using dts from
> https://github.com/Chadster766/McDebian/tree/master/linux-4.19.12/arch/arm/boot/dts
> and kernel / rootfs 5.1.7 from bodhi (thanks!),

Please describe how did you use the DTS from Chadster766 Github. Did you append the DTB to uImage? or did you use bootz? and where is that DTB come from?

And the log files you've posted made it difficult for me to figure out! you should do this instead:

- With serial console connected, power up, interrupt u-boot at countdown.
- Enter the envs you need to do to boot Debian.

- Print the envs
printenv

- And boot
boot

Let it boot all the way to Debian prompt.

And then capture the entire serial console log and post here (in code tag), don't attach log files.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on wrt1200ac
August 01, 2019 12:47AM
I'm no expert, but I think the dts is doing something odd, in the dmesg it has;

OF: fdt: Ignoring memory range 0x0 - 0x8000000

When booting Bodhi's kernel, but not the OpenWRT kernel. Bodhi's then has less memory pages set up, perhaps due to this range being ignored.

Which of those DTS' did you use?
Re: Debian on wrt1200ac
August 01, 2019 12:55AM
Quote

OF: fdt: Ignoring memory range 0x0 - 0x8000000

That's what my questions above are driving at. In the chain of DTS includes, somewhere there is a problem. I need to know how the DTB was created to find the wrong memory definition.

But first, the serial log should show the whole picture.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on wrt1200ac
August 03, 2019 01:48PM
Hi all.

Your questions pointed me in the right, I think, direction.


I started from scratch, just using Bodhi's linux-5.1.7-mvebu and stock kernel 5.1.7 (kernel.org).

uboot:

U-Boot 2013.01 (Mar 27 2015 - 16:55:31) Marvell version: 2014_T3.0p6

Boot version : v2.0.13

Board: RD-NAS-88F6820-DDR3
SoC:   MV88F6820 Rev A0
       running 2 CPUs
CPU:   ARM Cortex A9 MPCore (Rev 1) LE
       CPU 0
       CPU    @ 1332 [MHz]
       L2     @ 666 [MHz]
       TClock @ 200 [MHz]
       DDR    @ 666 [MHz]
       DDR 32 Bit Width, FastPath Memory Access, DLB Enabled, ECC Disabled
DRAM:  512 MiB

Map:   Code:                    0x1fea9000:0x1ff7632c
       BSS:                     0x1ffef6b4
       Stack:                   0x1f9a8f20
       Heap:                    0x1f9a9000:0x1fea9000
raise: Signal # 8 caught
U-ENV offset == 0x200000
raise: Signal # 8 caught
U-ENV offset == 0x200000
       U-Boot Environment:      0x00200000:0x00220000 (NAND)

NAND:  128 MiB
MMC:   mv_sdh: 0
DEVINFO offset == 0x900000
U-ENV offset == 0x200000
U-ENV offset == 0x200000
S-ENV offset == 0x240000


#### auto_recovery ####
[u_env] get auto_recovery == yes
[u_env] get auto_recovery == yes
[u_env] get boot_part == 1
[u_env] get boot_part_ready == 3
auto_recovery enabled:1, boot_part:1, boot_part_ready:3

S-ENV offset == 0x240000
[boot_count_read] block:0x240000, size:128KB, records:64
[boot_count_read_record] boot_count:3, next_record:33

[auto_recovery_init] BOOT_COUNT_TO_RECOVERY
[boot_count_write] erase:0, auto_recovery->block_offset:0x240000 offset=0x250800

Updating boot_count ...
[boot_count_write] offset:0x250800 , length:2048
done

PCI-e 0 (IF 0 - bus 0) Root Complex Interface, Detected Link X1, GEN 2.0
PCI-e 1 (IF 1 - bus 1) Root Complex Interface, Detected Link X1, GEN 1.1
USB2.0 0: Host Mode
USB3.0 1: Host Mode
USB3.0 0: Host Mode
Board configuration detected:
mvEthE6171SwitchBasicInit init
Net:
|  port  | Interface | PHY address  |
|--------|-----------|--------------|
| egiga0 |   RGMII   |     0x01     |
| egiga1 |   SGMII   |     0x00     |
egiga0 [PRIME], egiga1
Saving Environment to NAND...
U-ENV offset == 0x200000
Erasing Nand...
Writing to Nand... U-ENV offset == 0x200000
U-ENV offset == 0x200000
done
#### auto_recovery:2 ####
auto_recovery_check changes bootcmd: run altnandboot
Hit any key to stop autoboot:  0
Marvell>>


Booting Bodhi's linux-5.1.7-mvebu (including wrt1200ac DTB):

Marvell>> setenv bootargs console=ttyS0,115200 init=/sbin/init root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial ipv6.disable=1
Marvell>> dhcp
Marvell>> tftpboot 0x02000000 wrt/test/zImage
Marvell>> tftpboot 0x2900000 wrt/test/uInitrd
Marvell>> tftpboot 0x1000000 wrt/test/armada-385-linksys-caiman.dtb
Marvell>> setenv fdt_skip_update yes
Marvell>> bootz 0x02000000 0x2900000 0x1000000

# uname -a
Linux roshi 5.1.7-mvebu-tld-1 #1 SMP PREEMPT Sat Jun 8 20:04:26 PDT 2019 armv7l GNU/Linux


# dmesg |grep fdt
[Sat Aug  3 14:19:54 2019] OF: fdt: Machine model: Linksys WRT1200AC

# free
              total        used        free      shared  buff/cache   available
Mem:           506M         44M        392M        237K         68M        412M


# dmesg |grep -i rtc
[Sat Aug  3 14:19:56 2019] armada38x-rtc f10a3800.rtc: registered as rtc0
[Sat Aug  3 14:19:56 2019] armada38x-rtc f10a3800.rtc: setting system clock to 2019-08-03T18:18:57 UTC (1564856337)


# cat /proc/mtd
dev:    size   erasesize  name


# cat /proc/cmdline
console=ttyS0,115200 init=/sbin/init root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:2048K(uboot)ro,256K(u_env),256K(s_env),1m@9m(devinfo),40m@10m(kernel),34m@16m(rootfs),40m@50m(alt_kernel),34m@56m(alt_rootfs),80m@10m(ubifs),-@90m(syscfg) earlyprintk=serial ipv6.disable=1



Using stock kernel (with Bodhi's .config and patches, but stock DTB)

Marvell>> setenv bootargs console=ttyS0,115200 init=/sbin/init root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial ipv6.disable=1
Marvell>> dhcp
Marvell>> tftpboot 0x02000000 wrt/test/zImage
Marvell>> tftpboot 0x2900000 wrt/test/uInitrd
Marvell>> tftpboot 0x1000000 wrt/test/armada-385-linksys-caiman-kernel.dtb
Marvell>> setenv fdt_skip_update yes
Marvell>> bootz 0x02000000 0x2900000 0x1000000


# uname -a
Linux roshi 5.1.7-mvebu-tld-1 #1 SMP PREEMPT Sat Jun 8 20:04:26 PDT 2019 armv7l GNU/Linux


# dmesg |grep fdt
[Sat Aug  3 14:25:28 2019] OF: fdt: Machine model: Linksys WRT1200AC


# free
              total        used        free      shared  buff/cache   available
Mem:           506M         44M        392M        237K         68M        412M


# dmesg |grep -i rtc
[Sat Aug  3 14:25:30 2019] hctosys: unable to open rtc device (rtc0)

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00020000 "u-boot"
mtd1: 00040000 00020000 "u_env"
mtd2: 00040000 00020000 "s_env"
mtd3: 00100000 00020000 "devinfo"
mtd4: 02800000 00020000 "kernel1"
mtd5: 02200000 00020000 "rootfs1"
mtd6: 02800000 00020000 "kernel2"
mtd7: 02200000 00020000 "rootfs2"
mtd8: 02600000 00020000 "syscfg"
mtd9: 00680000 00020000 "unused_area"



# cat /proc/cmdline
console=ttyS0,115200 init=/sbin/init root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:2048K(uboot)ro,256K(u_env),256K(s_env),1m@9m(devinfo),40m@10m(kernel),34m@16m(rootfs),40m@50m(alt_kernel),34m@56m(alt_rootfs),80m@10m(ubifs),-@90m(syscfg) earlyprintk=serial ipv6.disable=1

So, full ram amount is detected, but as you can see I've access to RTC and /proc/mtd in different terms if I use Bodhi's or Stock kernel DTB definition.
To get the stock DTB, I downloaded kernel from www.kernel.org and did copy the .config file, make oldconfig, make prepare, make dtbs

I review Kernel stock DTB and i saw a strange line regarding rtc:
status = "disabled";

That line wasn't present in Bodhi's DTB (decompiled using DTC).
So i took stock kernel and delete the "disabled" line, compiled it with "make dtbs" and... voila!
Apparently everything is working: full memory, rtc detected, /proc/mtd looks ok, etc.

Thanks
fsonnlei
Re: Debian on wrt1200ac
August 03, 2019 06:39PM
Congrats!
Re: Debian on wrt1200ac
August 04, 2019 12:00AM
fsonnlei,

Quote

Apparently everything is working: full memory, rtc detected, /proc/mtd looks ok, etc.

Cool!

Quote

Booting Bodhi's linux-5.1.7-mvebu (including wrt1200ac DTB):

Marvell>> setenv bootargs console=ttyS0,115200 init=/sbin/init root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial ipv6.disable=1
Marvell>> dhcp
Marvell>> tftpboot 0x02000000 wrt/test/zImage
Marvell>> tftpboot 0x2900000 wrt/test/uInitrd
Marvell>> tftpboot 0x1000000 wrt/test/armada-385-linksys-caiman.dtb
Marvell>> setenv fdt_skip_update yes
Marvell>> bootz 0x02000000 0x2900000 0x1000000

# uname -a
Linux roshi 5.1.7-mvebu-tld-1 #1 SMP PREEMPT Sat Jun 8 20:04:26 PDT 2019 armv7l GNU/Linux


# dmesg |grep fdt
[Sat Aug 3 14:19:54 2019] OF: fdt: Machine model: Linksys WRT1200AC

# free
total used free shared buff/cache available
Mem: 506M 44M 392M 237K 68M 412M


# dmesg |grep -i rtc
[Sat Aug 3 14:19:56 2019] armada38x-rtc f10a3800.rtc: registered as rtc0
[Sat Aug 3 14:19:56 2019] armada38x-rtc f10a3800.rtc: setting system clock to 2019-08-03T18:18:57 UTC (1564856337)


# cat /proc/mtd
dev: size erasesize name


# cat /proc/cmdline
console=ttyS0,115200 init=/sbin/init root=LABEL=rootfs rootdelay=10 mtdparts=armada-nand:2048K(uboot)ro,256K(u_env),256K(s_env),1m@9m(devinfo),40m@10m(kernel),34m@16m(rootfs),40m@50m(alt_kernel),34m@56m(alt_rootfs),80m@10m(ubifs),-@90m(syscfg) earlyprintk=serial ipv6.disable=1


So the bottom line is you can run my released kernel and see 512MB RAM?

It seems mtd definition needs some adjustment. Other than this issue, is there any other problem running linux-5.1.7-mvebu-tld-1?

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Debian on wrt1200ac
August 04, 2019 04:49PM
Yes, your kernel is working ok, thank you.
So far the mtd definition and access to leds (/sys/class/leds) needs some adjustments.

Best
fsonnlei
Re: Debian on wrt1200ac
August 22, 2019 06:24AM
fsonnlei,


Let's try if we can see the MTD definition.

Quote

Booting Bodhi's linux-5.1.7-mvebu (including wrt1200ac DTB):

Marvell>> setenv bootargs console=ttyS0,115200 init=/sbin/init root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial ipv6.disable=1
Marvell>> dhcp
Marvell>> tftpboot 0x02000000 wrt/test/zImage
Marvell>> tftpboot 0x2900000 wrt/test/uInitrd
Marvell>> tftpboot 0x1000000 wrt/test/armada-385-linksys-caiman.dtb
Marvell>> setenv fdt_skip_update yes
Marvell>> bootz 0x02000000 0x2900000 0x1000000

Try this additional env

setenv mtdparts 'mtdparts=pxa3xx_nand-0:2048K(uboot)ro,256K(u_env),256K(s_env),1m@9m(devinfo),40m@10m(kernel),34m@16m(rootfs),40m@50m(alt_kernel),34m@56m(alt_rootfs),80m@10m(ubifs),-@90m(syscfg)'

And after you've booted into Debian, get the list of LEDS in /sys/class:

ls -l /sys/class/leds

Please post the entire serial console log here (in code tags).

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



Edited 2 time(s). Last edit at 08/22/2019 06:28AM by bodhi.
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: