编译OpenWrt过程(配适LB-LINK BL-WP02G)

一、克隆openwrt代码

在openwrt官方git仓库中clone openwrt源码:

git clone https://www.github.com/openwrt/openwrt

或者想得到固定版本的openwrt源码:

git clone https://www.github.com/openwrt/openwrt -b chaos_calmer

使用GIT更新源码:

git pull

更新源:

./scripts/feeds update -a

安装下载好的包:

./scripts/feeds install -a   (或者 'install <PACKAGENAME>' )

二、新增BL-WP02G配置文件

在openwrt目录中创建BL-WP02G的dts文件:

touch ./target/linux/ramips/dts/BL-WP02G.dts 

编辑BL-WP02G.dts文件

/dts-v1/;

#include "rt3050.dtsi"

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

/ {
    compatible = "lb-link,bl-wp02g", "ralink,rt3052-soc";
    model = "LB-LINK BL-WP02G";

    gpio-keys-polled {
        compatible = "gpio-keys-polled";
        poll-interval = <20>;

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

    };
};

&spi0 {
    status = "okay";

    m25p80@0 {
        compatible = "jedec,spi-nor";
        reg = <0>;
        spi-max-frequency = <10000000>;

        partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;

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

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

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

            partition@50000 {
                compatible = "denx,uimage";
                label = "firmware";
                reg = <0x50000 0xfb0000>;
            };
        };
    };
};

&pinctrl {
    state_default: pinctrl0 {
        gpio {
            ralink,group = "i2c", "jtag", "rgmii", "mdio", "uartf";
            ralink,function = "gpio";
        };
    };
};

&ethernet {
    mtd-mac-address = <&devconf 0x4>;
};

&esw {
    mediatek,portmap = <0x2f>;
};

&wmac {
    ralink,mtd-eeprom = <&devconf 0>;
};

三、修改配置文件

编辑./target/linux/ramips/base-files/lib/ramips.sh文件,添加:

*"BL-WP02G")
                name="bl-wp02g"
                ;;

编辑./target/linux/ramips/base-files/etc/board.d/02_network文件,添加:

        bl-wp02g|)
                ucidef_add_switch "switch0" \
                        "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "6@eth0"
                ;;

编辑./target/linux/ramips/image/rt305x.mk文件,添加:

define Device/bl-wp02g
  DTS := BL-WP02G
  IMAGE_SIZE := $(ralink_default_fw_size_16M)
  DEVICE_TITLE := LB-LINK BL-WP02G
endef
TARGET_DEVICES += bl-wp02g

编辑./target/linux/ramips/base-files/lib/upgrade/platform.sh文件,添加

        bl-wp02g|\

编辑./target/linux/ramips/base-files/etc/diag.sh文件,添加:

        bl-wp02g|\

四、编译固件

make defconfig
make menuconfig

选择想要的平台及软件包,保存并退出

make V=99 

编译固件。

转载于:https://www.cnblogs.com/funnymann/p/10865116.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值