Help supporting Thecus N2200
Raymond Elliot <[email protected]> Mon, 21 May 2018 18:06:04 +0100
| Newsgroups | io.groups.linux-oxnas |
|---|---|
| Message-ID | <CABNOhB=VrOBfkdTUr4_xhT63Yk-UNWf+TkxSV9=oPJr15WSB1A@mail.gmail.com> |
Hi there,
While I have been doing development and architecture for a long time (25+
years) I am a bit of a kernel newbie and as such Neil Armstrong has pointed
me in this direction for help in building a kernel for the Thecus N2200
(which is an ox810se based NAS).
I apologise for the lengthy email, but Neil asked for all the steps that I
took to run it.
I assume the N2200 is ox810se board based on cat'ing /proc/cpuinfo which
reads:
Processor : ARM926EJ-S rev 5 (v5l)
BogoMIPS : 183.09
Features : swp half thumb fastmult edsp java
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant : 0x0
CPU part : 0x926
CPU revision : 5
Cache type : write-back
Cache clean : cp15 c7 ops
Cache lockdown : format C
Cache format : Harvard
I size : 32768
I assoc : 4
I line length : 32
I sets : 256
D size : 32768
D assoc : 4
D line length : 32
D sets : 256
Hardware : Oxsemi NAS
Revision : 0000
Serial : 00000acbd96ea900
My plan was to take a recent kernel (I started on this a while back and so
tried 4.9.93) and piggy back on the support included for the MBWE support
already there. To test it I'm trying to build the kernel along with the
relevant device tree based on arch/arm/boot/dts/wde-mbwe.dts, deploy it to
a TFTP server and boot it manually using u-boot (the built-in version is
1.1.2) using the following script which was already defined:
ramboot=setenv bootargs root=/dev/ram rw init=/linuxrc mem=256M
mac_addr=$ethaddr mac1_addr=$eth1addr console=$consoledev,$baudrate
$othbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $uimageaddr
$uimagefile;bootm $uimageaddr $ramdiskaddr
The relevant u-boot environment values are:
bootargs= mem=256M
eth1addr=00:50:8D:30:FF:B3
consoledev=ttyS0
uimageaddr=49000000
uimagefile=N2200/uImage
ramdiskaddr=4B000000
ramdiskfile=N2200/uramdisk
I've got to the stage where I can build the kernel and attempt to start it
with u-boot but the kernel crashes with a "data abort" error and a readout
of the register values, but nothing more.
Here are the steps I've taken so far.
Created a base .config file:
$ ARCH_OXNAS=y ARCH_MULTI_V5=y ARCH=arm make versatile_defconfig
My understanding of v1.1.2 of u-boot is that I need to append the DTB onto
the end of the kernel so I updated the .config using make menuconfig as
follows (.config is attached):
$ ARCH_OXNAS=y ARCH_MULTI_V5=y ARCH=arm make menuconfig
-> Enable "System Type" / "Oxford Semiconductor OXNAS Family SoCs" /
"Support OX810SE Based Products"
-> Enable "Boot options" / [*] Use appended device tree blob to zImage
(EXPERIMENTAL)
[*] Supplement the appended
DTB with traditional ATAG information
I then created a new arch/arm/boot/dts/thecus-n2200.dts file:
/*
* thecus-n2200.dts - Device tree file for Thecus N2200
*
* Copyright (C) 2018 Raymond Elliot <[email protected]>
*
* Licensed under GPLv2 or later
*/
/dts-v1/;
#include "ox810se.dtsi"
/ {
model = "Thecus N2200";
compatible = "thecus,thecus-n2200", "oxsemi,ox810se";
chosen {
bootargs = "console=ttyS1,115200n8";
};
memory {
/* Max 256MB @ 0x48000000 */
reg = <0x48000000 0x10000000>;
};
aliases {
serial1 = &uart1;
gpio0 = &gpio0;
gpio1 = &gpio1;
};
gpio-keys-polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <100>;
power {
label = "power";
gpios = <&gpio0 0 1>;
linux,code = <0x198>;
};
recovery {
label = "recovery";
gpios = <&gpio0 4 1>;
linux,code = <0xab>;
};
};
leds {
compatible = "gpio-leds";
a0 {
label = "activity0";
gpios = <&gpio0 25 0>;
default-state = "keep";
};
a1 {
label = "activity1";
gpios = <&gpio0 26 0>;
default-state = "keep";
};
a2 {
label = "activity2";
gpios = <&gpio0 5 0>;
default-state = "keep";
};
a3 {
label = "activity3";
gpios = <&gpio0 6 0>;
default-state = "keep";
};
a4 {
label = "activity4";
gpios = <&gpio0 7 0>;
default-state = "keep";
};
a5 {
label = "activity5";
gpios = <&gpio1 2 0>;
default-state = "keep";
};
};
i2c-gpio {
compatible = "i2c-gpio";
gpios = <&gpio0 3 0 /* sda */
&gpio0 2 0 /* scl */
>;
i2c-gpio,delay-us = <2>; /* ~100 kHz */
#address-cells = <1>;
#size-cells = <0>;
rtc0: rtc@48 {
compatible = "st,m41t00";
reg = <0x68>;
};
};
};
&uart1 {
status = "okay";
pinctrl-names = "default";
pinctrl-1 = <&pinctrl_uart1>;
};
My first goal was to at least get some output from the serial console so at
least I could see if and where things were going wrong. However, I wasn't
sure how to configure it, so I played around with different alias values
for serial1 and uart1, but to no avail. The original Thecus kernel
(2.6.24) has the following defined which is why I was trying to get serial1
to work:
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_ARCH_OXNAS_UART2=y
CONFIG_ARCH_OXNAS_CONSOLE_UART=2
I then updated arch/arm/boot/dts/Makefile to include a thecus-n2200.dtb
target.
The kernel was built using:
$ LOADADDR=0x49000000 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make -j8
uImage dtbs
I only have bootm available in u-boot so the compressed images (uImage and
zImage) didn't work and resulted in invalid instruction crashes, so the
device tree was appended thus:
$ cat arch/arm/boot/Image arch/arm/boot/dts/thecus-n2200.dtb >
arch/arm/boot/dts/Image+dtb
I then created the final image by doing the following:
$ mkimage -A arm -O linux -T kernel -C none -a 0x49000000 -e 0x49000000 -n
"My Kernel" -d "arch/arm/boot/dts/Image+dtb" arch/arm/boot/uImage.n2200
uImage.n2200 was copied to my TFTP server and renamed N2200/uImage as per
the u-boot tftp command.
I then started the NAS and from u-boot did (the uramdisk image is the
original initramfs file from the machine):
N2200$ run ramboot
Wait GMAC to reset
Wait for PHY reset
Wait for link to come up.............Link up
Wait for auto-negotiation to complete
Link is 1000M
TFTP from server 192.168.0.50; our IP address is 192.168.0.52
Filename 'N2200/uramdisk'.
Load address: 0x4b000000
Loading: #################################################################
#################################################################
#################################################################
##############################################################
done
Bytes transferred = 1310720 (140000 hex)
Wait GMAC to reset
Wait for PHY reset
Wait for link to come up................Link up
Wait for auto-negotiation to complete
Link is 1000M
TFTP from server 192.168.0.50; our IP address is 192.168.0.52
Filename 'N2200/uImage'.
Load address: 0x49000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#############################################
done
Bytes transferred = 4556591 (45872f hex)
## Booting image at 49000000 ...
Image Name: My Kernel
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4556527 Bytes = 4.3 MB
Load Address: 49000000
Entry Point: 49000000
Verifying Checksum ... OK
XIP Kernel Image ... OK
## Loading Ramdisk Image at 4b000000 ...
Image Name: uboot initramfs
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 1228235 Bytes = 1.2 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Starting kernel ...
data abort
pc : [<491c0544>] lr : [<4900000c>]
sp : 48cdd7b4 ip : 00000003 fp : 48d1664c
r10: 00000003 r9 : ffed3b51 r8 : 48cddfdc
r7 : 00000003 r6 : 00000480 r5 : 00000000 r4 : ffffb400
r3 : 00000010 r2 : 48cdd7b4 r1 : ffffda00 r0 : 000000e1
Flags: nzcv IRQs off FIQs off Mode SVC_32
So that's where I'm at now and basically kinda stuck. Any help or
suggestions you have would be very gratefully received !
Kind regards,
Raymond
.config
(application/octet-stream, 62.2 KB) - not displayed