为openwrt 15.05(Chaos Calmer) 新增优酷土豆路由宝配置[转]

11:37 星期一 eehello 发表于 OpenWRT 分类,

0


转载自:http://www.w2bc.com/article/119553


一 主要修改的文件有:

    1.修改: target/linux/ramips/base-files/etc/board.d/01_leds

    2.修改: target/linux/ramips/base-files/etc/board.d/02_network

    3.修改: target/linux/ramips/base-files/lib/ramips.sh

    4.修改: target/linux/ramips/base-files/lib/upgrade/platform.sh

    5.修改: target/linux/ramips/image/Makefile

    6.新增: target/linux/ramips/dts/YOUKU.dts

二 文件修改

    1.修改: target/linux/ramips/base-files/etc/board.d/01_leds新增youku节点:


    xiaomi-miwifi-mini)
        ucidef_set_led_default "power" "power" "xiaomi:red:status" "1"
        ;;
    youku)
        ucidef_set_led_default "power" "power" "youku-yk1:blue:power" "1"
        ucidef_set_led_default "wan" "wan" "youku-yk1:blue:wan" "1"
        set_wifi_led "youku-yk1:blue:air"
        set_usb_led "youku-yk1:blue:usb"
        ;;

    y1 |\
    y1s)
        ucidef_set_led_default "power" "power" "lenovo:blue:power" "1"
        set_usb_led "lenovo:blue:usb"
        set_wifi_led "lenovo:blue:wifi"
        ;;



2.修改: target/linux/ramips/base-files/etc/board.d/02_network :


    3g-6200n | \
    ai-br100 | \
    dir-610-a1 | \
    dir-300-b7 | \
    dir-320-b1 | \
    dir-615-h1 | \
    firewrt | \
    pbr-m1 | \
    hlk-rm04 | \
    mt7621 | \
    mt7628 | \
    mzk-w300nh2 | \
    mzk-750dhp | \
    whr-300hp2 | \
    whr-600d | \
    wsr-600 | \
    wsr-1166 | \
    wt1520 | \
    xiaomi-miwifi-mini |\
    youku |\
    y1|\
    zbt-wg2626)
        ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
        ucidef_add_switch "switch0" "1" "1"
        ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
        ucidef_add_switch_vlan "switch0" "2" "4 6t"
        ;;



3.修改: target/linux/ramips/base-files/lib/ramips.sh :


    *"Xiaomi MiWiFi Mini")
        name="xiaomi-miwifi-mini"
        ;;
    *"YOUKU")
        name="youku"
        ;;

    *"Sercomm NA930")
        name="na930"
        ;;



4.修改: target/linux/ramips/base-files/lib/upgrade/platform.sh :


    wr6202 |\
    wr8305rt |\
    wrtnode |\
    wt1520 |\
    wt3020 |\
    x5 |\
    x8 |\
    xiaomi-miwifi-mini |\
    youku |\
    y1 |\
    y1s |\
    zbt-wa05 |\
    zbt-wg2626 |\
    zte-q7)
        [ "$magic" != "27051956" ] && {
            echo "Invalid image type."
            return 1
        }
        return 0
        ;;



5.修改: target/linux/ramips/image/Makefile :


Image/Build/Profile/YOUKU=$(call BuildFirmware/Default32M/$(1),$(1),YOUKU,YOUKU)
#Image/Build/Profile/E1700=$(call BuildFirmware/UMedia/$(1),$(1),e1700,E1700,0x013326)
#ex2700_mtd_size=3866624
#Image/Build/Profile/EX2700=$(call BuildFirmware/Netgear/$(1),$(1),ex2700,EX2700,65536,29764623+4+0+32+2x2+0,$(ex2700_mtd_size))
#Image/Build/Profile/MT7620a=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
#Image/Build/Profile/MT7620a_MT7610e=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
#Image/Build/Profile/MT7620a_MT7530=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
#Image/Build/Profile/MT7620a_V22SG=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_v22sg,MT7620a_V22SG)
#br100_mtd_size=8126464
#Image/Build/Profile/AIBR100=$(call BuildFirmware/CustomFlash/$(1),$(1),ai-br100,AIBR100,$(br100_mtd_size),Ai-BR)
#Image/Build/Profile/RP-N53=$(call BuildFirmware/Default8M/$(1),$(1),rp_n53,RP-N53)
#whr_300hp2_mtd_size=7012352
#Image/Build/Profile/WHR300HP2=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-300hp2,WHR-300HP2,$(whr_300hp2_mtd_size))
#Image/Build/Profile/WHR600D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-600d,WHR-600D,$(whr_300hp2_mtd_size))
#whr_1166d_mtd_size=15400960
#Image/Build/Profile/WHR1166D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-1166d,WHR-1166D,$(whr_1166hd_mtd_size))
#dlink810l_mtd_size=6881280
#Image/Build/Profile/CF-WR800N=$(call BuildFirmware/Default8M/$(1),$(1),cf-wr800n,CF-WR800N)
#Image/Build/Profile/DIR-810L=$(call BuildFirmware/CustomFlash/$(1),$(1),dir-810l,DIR-810L,$(dlink810l_mtd_size))
#na930_mtd_size=20971520
#Image/Build/Profile/NA930=$(call BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
#Image/Build/Profile/MZK-750DHP=$(call BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
#Image/Build/Profile/Y1=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1,Y1)
#Image/Build/Profile/Y1S=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1s,Y1S)
#Image/Build/Profile/MLW221=$(call BuildFirmware/Default16M/$(1),$(1),mlw221,MLW221)
#Image/Build/Profile/MLWG2=$(call BuildFirmware/Default16M/$(1),$(1),mlwg2,MLWG2)
#Image/Build/Profile/WMR300=$(call BuildFirmware/Default8M/$(1),$(1),wmr-300,WMR300)
#Image/Build/Profile/RT-N14U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n14u,RT-N14U)
#Image/Build/Profile/WR8305RT=$(call BuildFirmware/Default8M/$(1),$(1),wr8305rt,WR8305RT)
#Image/Build/Profile/WRTNODE=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode,WRTNODE)
#Image/Build/Profile/WT3020=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt3020,WT3020)
#Image/Build/Profile/XIAOMI-MIWIFI-MINI=$(call BuildFirmware/Default16M/$(1),$(1),xiaomi-miwifi-mini,XIAOMI-MIWIFI-MINI)
#Image/Build/Profile/ZTE-Q7=$(call BuildFirmware/Default8M/$(1),$(1),zte-q7,ZTE-Q7)
#Image/Build/Profile/ZBT-WA05=$(call BuildFirmware/Default8M/$(1),$(1),zbt-wa05,ZBT-WA05)
#Image/Build/Profile/ArcherC20i=$(call BuildFirmware/Tplink/$(1),$(1),ArcherC20i,ArcherC20i)
#microwrt_mtd_size=16515072
#Image/Build/Profile/MicroWRT=$(call BuildFirmware/CustomFlash/$(1),$(1),microwrt,MicroWRT,$(microwrt_mtd_size))


ifeq ($(SUBTARGET),mt7620)
define Image/Build/Profile/Default
      $(call Image/Build/Profile/YOUKU,$(1))
#    $(call Image/Build/Profile/E1700,$(1))
#    $(call Image/Build/Profile/EX2700,$(1))
#    $(call Image/Build/Profile/MT7620a,$(1))
#    $(call Image/Build/Profile/MT7620a_MT7610e,$(1))
#    $(call Image/Build/Profile/MT7620a_MT7530,$(1))
#    $(call Image/Build/Profile/MT7620a_V22SG,$(1))
#    $(call Image/Build/Profile/CF-WR800N,$(1))
#    $(call Image/Build/Profile/RP-N53,$(1))
#    $(call Image/Build/Profile/DIR-810L,$(1))
#    $(call Image/Build/Profile/WHR300HP2,$(1))
#    $(call Image/Build/Profile/WHR600D,$(1))
#    $(call Image/Build/Profile/WHR1166D,$(1))
#    $(call Image/Build/Profile/MZK-750DHP,$(1))
#    $(call Image/Build/Profile/NA930,$(1))
#    $(call Image/Build/Profile/Y1,$(1))
#    $(call Image/Build/Profile/Y1S,$(1))
#    $(call Image/Build/Profile/MLW221,$(1))
#    $(call Image/Build/Profile/MLWG2,$(1))
#    $(call Image/Build/Profile/WMR300,$(1))
#    $(call Image/Build/Profile/RT-N14U,$(1))
#    $(call Image/Build/Profile/WR8305RT,$(1))
#    $(call Image/Build/Profile/WRTNODE,$(1))
#    $(call Image/Build/Profile/WT3020,$(1))
#    $(call Image/Build/Profile/XIAOMI-MIWIFI-MINI,$(1))
#    $(call Image/Build/Profile/ZTE-Q7,$(1))
#    $(call Image/Build/Profile/ZBT-WA05,$(1))
#    $(call Image/Build/Profile/ArcherC20i,$(1))
#    $(call Image/Build/Profile/MicroWRT,$(1))
endef
endif



6.新增: target/linux/ramips/dts/YOUKU.dts :

/dts-v1/;
/include/ "mt7620a.dtsi"
/ {
    compatible = "YOUKU", "ralink,mt7620a-soc";
    model = "YOUKU";
    chosen {
        bootargs = "console=ttyS0,115200";
    };
    palmbus@10000000 {
        gpio0: gpio@600 {
            status = "okay";
        };
        gpio1: gpio@638 {
            status = "okay";
        };
        gpio2: gpio@660 {
            status = "okay";
        };
        spi@b00 {
            status = "okay";
            m25p80@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "w25q128";
                reg = <0 0>;
                linux,modalias = "m25p80", "w25q128";
                spi-max-frequency = <10000000>;
                partition@0 {
                    label = "u-boot";
                    reg = <0x0 0x30000>;
                };
                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 0x1f80000>;
                };
                partition@1fd0000 {
                    label = "crash";
                    reg = <0x1fd0000 0x10000>;
                };
                partition@1fe0000 {
                    label = "reserved";
                    reg = <0x1fe0000 0x10000>;
                    read-only;
                };
                partition@1ff0000 {
                    label = "Bdata";
                    reg = <0x1ff0000 0x10000>;
                };
            };
        };
    };
    ehci@101c0000 {
        status = "okay";
    };
    ohci@101c1000 {
        status = "okay";
    };
    sdhci@10130000 {
        status = "okay";
    };
    ethernet@10100000 {
        pinctrl-names = "default";
        pinctrl-0 = <&ephy_pins>;
        mtd-mac-address = <&factory 0x4>;
        ralink,port-map = "llllw";
    };
    wmac@10180000 {
        ralink,mtd-eeprom = <&factory 0>;
    };
    pcie@10140000 {
        status = "okay";
        pcie-bridge {
            mt76@0,0 {
                reg = <0x0000 0 0 0 0>;
                device_type = "pci";
                mediatek,mtd-eeprom = <&factory 0x8000>;
                mediatek,2ghz = <0>;
            };
        };
    };
    pinctrl {
        state_default: pinctrl0 {
            gpio {
                ralink,group = "i2c", "rgmii1";
                ralink,function = "gpio";
            };
        };
    };
    gpio-leds {
        compatible = "gpio-leds";
        wan {
            label = "youku-yk1:blue:wan";
            gpios = <&gpio2 4 1>;
        };
        air {
            label = "youku-yk1:blue:air";
            gpios = <&gpio3 0 1>;
        };
        usb {
            label = "youku-yk1:blue:usb";
            gpios = <&gpio1 11 1>;
        };
        power {
            label = "youku-yk1:blue:power";
            gpios = <&gpio1 5 1>;
        };
    };
    gpio-keys-polled {
        compatible = "gpio-keys-polled";
        #address-cells = <1>;
        #size-cells = <0>;
        poll-interval = <20>;
        reset {
            label = "reset";
            gpios = <&gpio0 1 1>;
            linux,code = <0x198>;
        };
    };
};





发表评论: