向OpenWRT中添加新设备支持

3917

这里还是向OpenWRT中添加对小度路由的支持
向 target/linux/ramips/image/makefile中写入新设备

image/build/profile/mt7620a_CLZ=$(call buildFirmware/Default8M/$(1),$(1),mt7620a_clz,MT7620a_CLZ)
$(call image/Build/Profile/MT7620a_CLZ,$(1))

 

base-files中的一些可用配置:

base-files/etc/diag.sh  控制LED在OpenWRT启动时是否闪烁
base-files/lib/upgrade/platform.sh  允许sysupgrade工作
base-files/etc/uci-defaults/network to configure(安装) default network interface(界面) settings, particularly MAC addresses
base-files/etc/uci-defaults/leds if you have configurable(可配置的) LEDs which should default to a behavior(行为), like a WLAN activity LED
base-files/etc/hotplug.d/firmware(固件)/10-rt2x00-eeprom to extract(提取) the firmware image for the wireless(无线的) module
base-files/lib/preinit/06_set_iface_mac to set the MAC addresses of any other interfaces(界面)

 

编写的小度路由用的dts文件

/dts-v1/;

/include/ "mt7620a.dtsi"

/ {
	compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";
	model = "Ralink MT7620A xiaodu board";

	palmbus@10000000 {
		sysc@0 {
			ralink,gpiomux = "i2c";
			ralink,uartmux = "gpio";
			ralink,wdtmux = <1>;
		};

		gpio0: gpio@600 {
			status = "okay";
		};

		spi@b00 {
			status = "okay";

			w25q64bv@0 {
				#address-cells = <1>;
				#size-cells = <1>;
				compatible = "w25q64bv";
				reg = <0 0>;
				linux,modalias = "w25q64bv";
				spi-max-frequency = <1000000>;

				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 0x6b0000>;
				};

				partition@700000 {
					label = "usercfg";
					reg = <0x700000 0x100000>;
				};
			};
		};
	};

	ethernet@10100000 {
		status = "okay";

		pinctrl-names = "default";
		pinctrl-0 = <&ephy_pins>;

		ralink,port-map = "llllw";
	};

	gsw@10110000 {
		ralink,port4 = "ephy";
	};

	sdhci@10130000 {
		status = "okay";
	};

	pcie@10140000 {
		status = "okay";
	};

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

 

 

添加设备后,最好需要将之前编译产生的临时文件删除,语句如下

 cd trunk
 rm -rf tmp
 make menuconfig

 

 

参考:http://wiki.openwrt.org/doc/devel/add.new.device

4 意见

  1. 请问你搞定mt7620的wifi驱动了吗?我有个小度路由,刷完openwrt一直没能驱动起来wifi,望博主指教!

回复 sjkgl

Please enter your comment!
Please enter your name here