Openwrt相关说明


请尊重原创版权,转载注明出处。

硬件适配部分

    Mtk方案的主要修改dts文件, 目录target/linux/ramips/dts/

例如智开设备:

/dts-v1/;

#include "mt7621.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	compatible = "Surfilter,R200x", "mediatek,mt7621-soc";
	model = "R200b";

	// 定义内存大小
	memory@0 {
		device_type = "memory";
		reg = <0x0 0x10000000>;
	};

	chosen {
		bootargs = "console=ttyS0,57600";
	};

	// 定义led, 主要修改 gpios管脚, 下面定义gpio13位系统灯
	gpio-leds {
		compatible = "gpio-leds";

		system {
			label = "surf:green:system";
			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
		};

		usb2 {
			label = "surf:green:usb2.0";
			gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
		};

		usb3 {
			label = "surf:green:usb3.0";
			gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
		};
	};

	// 定义gpio15为重启按键, 
	gpio-keys-polled {
		compatible = "gpio-keys-polled";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
	};
};

// 定义pin复用中的那些组为gpio 
&pinctrl {
	state_default: pinctrl0 {
		gpio {
			ralink,group = "wdt", "rgmii2";
//			ralink,group = "wdt", "rgmii2", "jtag", "mdio";
			ralink,function = "gpio";
		};
	};
};

// 定义flash分区信息
&spi0 {
	status = "okay";

	m25p80@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <10000000>;
		m25p,chunked-io = <32>;

		partition {
			label = "ALL";
			reg = <0x0 0x2000000>;
		};
		
		partition@0 {
			label = "Bootloader";
			reg = <0x0 0x30000>;
			read-only;
		};

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

		factory: partition@40000 {
			label = "factory";
			reg = <0x40000 0x10000>;
			read-only;
		};
		
		partition@50000 {
			label = "firmware";
			reg = <0x50000 0x10b0000>;
		};
		
		partition@1100000 {
			label = "reserve";
			reg = <0x1100000 0xef0000>;
		};
		
		partition@1ff0000 {
			label = "mib0";
			reg = <0x1ff0000 0x10000>;
		};
	};
};

// 定义mac地址放在什么地方
&ethernet {
	mtd-mac-address = <&factory 0xe000>;
};


uboot启动相关

T1 T2

开启透明网桥

使能网桥转发数据进入netfilter

vi /etc/sysctl.d/11-br-netfilter.conf 

T3

配置所有网口数据经过cpu

vi /etc/config/network 

T4

qos配置

qos配置文件

cat /etc/config/qos

T5

qos解析文件

/etc/init.d/qos 
/usr/lib/qos/tc-generate.sh 
文档信息
--------------
* 作者:
* 版权声明:自由转载-非商用
* 转载: []