现在的位置: 首页 > 综合 > 正文

OpenWrt添加开发板RT5350-EVB,并成功设置pppoe

2018年04月28日 ⁄ 综合 ⁄ 共 6672字 ⁄ 字号 评论关闭

前段时间在某宝上买了这个RT5350-EVB ver3.1开发板。近日发现,这些核心板都跟HLK-RM04是一样的。。。。。。

OpenWrt使用的是最新的稳定版Barrier Breaker 14.07,该版本已经支持RT5350

因为该开发板与HLK-RM04相似,所以后面的操作都是仿照它添加的

下载链接:http://download.csdn.net/detail/x901205/8055975

1.创建文件barrier_breaker/target/linux/ramips/rt305x/rt5350evb.mk

define Profile/RT5350EVB
	NAME:=RT5350-EVB
	PACKAGES:=\
		kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-netdev
endef

define Profile/RT5350EVB/Description
	Package set for RT5350-EVB Module
endef

$(eval $(call Profile,RT5350EVB))

2.添加如下内容到barrier_breaker/target/linux/ramips/image/Makefile:

438行处:

BuildFirmware/RT5350EVB/squashfs=$(call BuildFirmware/Default8M/squashfs,$(1),$(2),$(3),$(4))
define BuildFirmware/RT5350EVB/initramfs
	$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
	#mkhilinkfw -e -i$(call imgname,$(1),$(2))-uImage.bin -o $(call imgname,$(1),$(2))-factory.bin;
endef
Image/Build/Profile/RT5350EVB=$(call BuildFirmware/RT5350EVB/$(1),$(1),rt5350-evb,RT5350EVB,RT5350-EVB)

607行处:

	$(call Image/Build/Profile/RT5350EVB,$(1))

3.新建文件barrier_breaker/target/linux/ramips/dts/RT5350EVB.dts

/dts-v1/;

/include/ "rt5350.dtsi"

/ {
	compatible = "RT5350EVB", "ralink,rt5350-soc";
	model = "RT5350-EVB";

        memory@0 {
            device_type = "memory";
            reg = <0x0 0x1000000>;   <span style="color:#FF0000;">如果是32M的sdram,应改成0x2000000</span>
        };

        palmbus@10000000 {
		spi@b00 {
			status = "okay";
			m25p80@0 {
				#address-cells = <1>;
				#size-cells = <1>;
				compatible = "mx25l6405d";    <span style="color:#FF0000;">此处的mx25l6405d为flash,后面会提到如何得到这个串</span>
				reg = <0 0>;
				linux,modalias = "m25p80", "mx25l6405d";
				spi-max-frequency = <10000000>;

				partition@0 {
					label = "u-boot";
					reg = <0x0 0x30000>;
					read-only;
				};

				partition@30000 {
					label = "u-boot-env";
					reg = <0x30000 0x10000>;
					read-only;
				};

				factory: partition@40000 {
					label = "factory";
					reg = <0x40000 0x10000>;
					read-only;
				};

				partition@50000 {
					label = "firmware";
					reg = <0x50000 0x7b0000>;
				};
			};
		};
	};

	pinctrl {
		state_default: pinctrl0 {
			gpio {
				ralink,group = "jtag";
				ralink,function = "gpio";
			};
		};
	};

	ethernet@10100000 {
		mtd-mac-address = <&factory 0x4>;
	};

	wmac@10180000 {
		ralink,mtd-eeprom = <&factory 0>;
	};

	ehci@101c0000 {
		status = "okay";
	};

	ohci@101c1000 {
		status = "okay";
	};

	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;
		wps {
			label = "reset";
			gpios = <&gpio0 14 1>;
			linux,code = <0x198>;
		};
	};

	gpio-leds {
		compatible = "gpio-leds";
		power {
			label = "rt5350-evb:red:power";
			gpios = <&gpio0 0 1>;
		};
	};
};

4.添加以下到barrier_breaker/target/linux/ramips/base-files/etc/diag.sh:67

	rt5350-evb)
		status_led="rt5350-evb:red:power"
		;;

5.添加以下到barrier_breaker/target/linux/ramips/base-files/etc/uci-defaults/01_leds:112

	rt5350-evb)
		set_wifi_led "rt2800pci-phy0::radio"
		;;

6.添加以下到barrier_breaker/target/linux/ramips/base-files/etc/uci-defaults/02_network:225

	rt5350-evb | \

7.添加以下到barrier_breaker/target/linux/ramips/base-files/lib/ramips.sh:157

	*"RT5350-EVB")
		name="rt5350-evb"
		;;

8.添加以下到barrier_breaker/target/linux/ramips/base-files/lib/upgrade/platform.sh:55

	rt5350-evb | \

9.编译,烧写(建议直接选上luci,免得后面再来做)

只要配置了正确的cpu、flash、sdram,OpenWrt就可以正常的跑起来了。

怎么得到flash串?

在uboot起动的时候会输出硬件信息,OpenWrt启动的时候也会有检测:

[    0.470000] m25p80 spi32766.0: found mx25l6405d, expected s25fl064k
[    0.490000] m25p80 spi32766.0: mx25l6405d (8192 Kbytes)
[    0.500000] 4 ofpart partitions found on MTD device spi32766.0
[    0.510000] Creating 4 MTD partitions on "spi32766.0":
[    0.520000] 0x000000000000-0x000000030000 : "u-boot"
[    0.530000] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.550000] 0x000000040000-0x000000050000 : "factory"
[    0.560000] 0x000000050000-0x000000800000 : "firmware"
[    0.580000] 0x000000144de5-0x000000800000 : "rootfs"

其中第一行中,表示检测到的是mx25l6405d,而配置的时候,选用的是s25fl064k;在dts文件中改成mx25l6405d并重新编译即可。

内存的检测:

[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x01ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x01ffffff]

说明内存是32M

如果内存不正确的话,可能在运行的时候会出现oom-killer错误:

[  442.120000] udhcpc invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
[  442.130000] CPU: 0 PID: 1120 Comm: udhcpc Not tainted 3.10.49 #1
[  442.140000] Stack : 00000000 00000000 00000000 00000000 802fa35e 00000034 80ea45d8 00000000
          8025638c 8029653b 00000460 802f381c 80ea45d8 00000000 00000000 00000000
          00000086 80203c54 00000000 80172928 00000006 801afca8 802579e4 80e4fb94
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 80e4fb20
          ...
[  442.210000] Call Trace:
[  442.220000] [<801ad498>] show_stack+0x48/0x70
[  442.230000] [<802033c4>] dump_header.isra.16+0x4c/0x13c
[  442.240000] [<801556a8>] oom_kill_process+0xc8/0x3b0
[  442.250000] [<801567ec>] out_of_memory+0x2ac/0x2e4
[  442.260000] [<80024d30>] __alloc_pages_nodemask+0x5d0/0x634
[  442.270000] [<800c93b8>] filemap_fault+0x214/0x3e4
[  442.280000] [<8002d948>] __do_fault+0xd0/0x4fc
[  442.290000] [<800e4be8>] handle_pte_fault+0x188/0x910
[  442.300000] [<800e4890>] handle_mm_fault+0xa0/0xe0
[  442.310000] [<800aa428>] do_page_fault+0x150/0x394
[  442.320000] [<80004820>] ret_from_exception+0x0/0x10
[  442.330000] 
[  442.330000] Mem-Info:
[  442.330000] Normal per-cpu:
[  442.340000] CPU    0: hi:    0, btch:   1 usd:   0
[  442.350000] active_anon:1027 inactive_anon:50 isolated_anon:0
[  442.350000]  active_file:2 inactive_file:19 isolated_file:0
[  442.350000]  unevictable:0 dirty:0 writeback:0 unstable:0
[  442.350000]  free:114 slab_reclaimable:199 slab_unreclaimable:802
[  442.350000]  mapped:2 shmem:151 pagetables:49 bounce:0
[  442.350000]  free_cma:0
[  442.410000] Normal free:456kB min:456kB low:568kB high:684kB active_anon:4108kB inactive_anon:200kB active_file:8kB inactive_file:76kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:16384kB mans
[  442.490000] lowmem_reserve[]: 0 0
[  442.500000] Normal: 0*4kB 1*8kB (U) 0*16kB 0*32kB 1*64kB (U) 1*128kB (U) 1*256kB (R) 0*512kB 0*1024kB 0*2048kB 0*4096kB = 456kB
[  442.520000] 178 total pagecache pages
[  442.530000] 0 pages in swap cache
[  442.530000] Swap cache stats: add 0, delete 0, find 0/0
[  442.540000] Free swap  = 0kB
[  442.550000] Total swap = 0kB
[  442.560000] 4096 pages RAM
[  442.560000] 777 pages reserved
[  442.570000] 264046 pages shared
[  442.580000] 2977 pages non-shared
[  442.580000] [ pid ]   uid  tgid total_vm      rss nr_ptes swapents oom_score_adj name
[  442.600000] [  329]     0   329      223       17       3        0             0 ubusd
[  442.610000] [  330]     0   330      372       21       3        0             0 ash
[  442.630000] [  674]     0   674      262       37       4        0             0 logd
[  442.640000] [  732]     0   732      310       41       4        0             0 odhcpd
[  442.660000] [  777]     0   777      369       15       5        0             0 telnetd
[  442.680000] [  842]     0   842      371       18       3        0             0 ntpd
[  442.690000] [  891] 65534   891      243       24       5        0             0 dnsmasq
[  442.710000] [  968]     0   968      287       19       3        0             0 dropbear
[  442.720000] [ 1061]     0  1061      386       53       4        0             0 netifd
[  442.740000] [ 1120]     0  1120      370       18       4        0             0 udhcpc
[  442.760000] [ 1238]     0  1238      662      458       3        0             0 opkg
[  442.770000] [ 1242]     0  1242      422      211       3        0             0 opkg
[  442.790000] Out of memory: Kill process 1238 (opkg) score 134 or sacrifice child
[  442.800000] Killed process 1242 (opkg) total-vm:1688kB, anon-rss:844kB, file-rss:0kB

关于pppoe的设置:

在 接口->wan中设置中,使用pppoe协议,输入用户密码即可,如果出现不能成功拨号,获取到ip的话,查看交换机的设置,配成如下即可(特别留心4号端口(wan口)):

也可修改配置文件/etc/config/network中的vlan配置:

config switch
	option name 'rt305x'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'rt305x'
	option vlan '1'
	option ports '0 1 2 3 6t'

config switch_vlan
	option device 'rt305x'
	option vlan '2'
	option ports '4 6t'

下面是首页截图

抱歉!评论已关闭.