ubuntu16.04编译OpenWrt环境搭建

     OpenWrt 是一个高度模块化、高度主动化的嵌入式的 Linux 刊行版,它的的保证理供给了一个完全可写的文件系统,从应用法式供给商供给的选择和设置装备摆设,并许可您自界说的设备,以顺应任何应用法式,所以具有很强的心猿意马制能力,这也让发烧友们更具有挑战激情。

    同时OpenWRT拥有壮大的收集组件和扩展性,经常被用于德律风、小型机械人、智能家居、以及路由器设备中。

   因为OpenWRT没有刊行小米路由mini版固件,所以只能脱手进行编译一个。

东西/原料

  • ubuntu16.0
  • OpenWrt

方式/步调

  1. 1

        在编译之前我们先要搭建情况,ubuntu下OpenWrt编译情况需要安装良多组件:

    sudo apt-get install gcc  g++ binutils patch bzip2 flex bison make autocnf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev subversion git-cor gaw asciido libz-dev

    若是你怕有些没安装当作功, 也可以一个个安装:

    sudo apt-get install gcc (已安装)

    sudo apt-get install g++ (已安装)

    sudo apt-get install binutils (已安装)

    sudo apt-get install patch (已安装)

    sudo apt-get install bzip2 (已安装)

    sudo apt-get install flex (需安装)

    sudo apt-get install bison (需安装)

    sudo apt-get install make (已安装)

    sudo apt-get install autoconf (需安装)

    sudo apt-get install gettext (已安装)

    sudo apt-get install texinfo (需安装)

    sudo apt-get install unzip (已安装)

    sudo apt-get install sharutils (已安装)

    sudo apt-get install subversion (需安装)

    sudo apt-get install libncurses5-dev (需安装)

    sudo apt-get install ncurses-term (已安装)

    sudo apt-get install zlib1g-dev (已安装)

    sudo apt-get install subversion (已安装)

    sudo apt-get install  git-core(需安装)

    sudo apt-get install gawk(已安装)

    sudo apt-get install asciidoc(需安装)

    sudo apt-get install libz-dev

    当然安装之前最好先更新下组件包:

    sudo apt-get update

    这里小编选择逐个安装

  2. 2

        颠末小编逐个安装,发现年夜部门在ubuntu16.04系统中就已经安装好了,只需再安装以下几条目:

    sudo apt-get install flex

    sudo apt-get install bison 

    sudo apt-get install autoconf 

    sudo apt-get install texinfo 

    sudo apt-get install subversion 

    sudo apt-get install libncurses5-dev 

    sudo apt-get install  git-core

    sudo apt-get install asciidoc(文件比力年夜,耐烦期待)

  3. 3

      新建一个openwrt目次,利用号令:

    mkdir openwrt

    sudo chmod 777 openwrt

      接下来的所有号令都在/openwrt目次下运行(编译系统的绝对路径中不克不及含有空格)。

  4. 4

      下载OpenWrt源码:

       经由过程git来下载OpenWrt bleeding edge

       从官方源下载:git clone git://git.openwrt.org/openwrt.git

       git clone git://git.openwrt.org/15.05/openwrt.git,下载时候比力漫长,请耐烦期待。

  5. 5

       添加软件扩展包:

      cd openwrt/进入/home/kevinfan/openwrt/openwrt目次,可以找到feeds.conf.default文件,将feeds.conf.default点窜为feeds.conf,利用以下号令:

      cp feeds.conf.default feeds.conf

      获得feeds.conf文件

  6. 6

      更新扩展,安装扩展:

    ./scripts/feeds update -a

    ./scripts/feeds install -a

    系统提醒:

    WARNING: No feed for package 'librt' found, maybe it's already part of the standard packages?

    WARNING: No feed for package 'libpthread' found, maybe it's already part of the standard packages?

    WARNING: No feed for package 'lua' found, maybe it's already part of the standard packages?

    WARNING: No feed for package 'libc' found, maybe it's already part of the standard packages?

    WARNING: No feed for package 'libssp' found, maybe it's already part of the standard packages?

  7. 7

        测试下编译情况,利用号令:

       make defconfig

     系统提醒:

    Build dependency: Please install the openssl library (with development headers)

    /home/kevinfan/openwrt/openwrt/include/prereq.mk:12: recipe for target 'prereq' failed

    Prerequisite check failed. Use FORCE=1 to override.

    /home/kevinfan/openwrt/openwrt/include/toplevel.mk:151: recipe for target 'staging_dir/host/.prereq-build' failed

    make: *** [staging_dir/host/.prereq-build] Error 1

    存候装openssl库

  8. 8

      进openssl官网:http://www.openssl.org

      下载页面:http://www.openssl.org/source/

      选择最新版本下载,用WinSCP上传至Ubuntu系统中,这里小编放在Downloads:openssl-1.1.0-pre5.tar.gz

  9. 9

    解压:tar –zxvf openssl-1.1.0-pre5.tar.gz,解压目次为:openssl-1.1.0-pre5

    然后进入到openssl-1.1.0-pre5,进行设置装备摆设、编译、安装。

    设置装备摆设   ./configure或./config

    编译    make安装make install

    若是提醒无权限,可以加上sudo在执行,接着只要比及编译安装完当作即可。

  10. 10

       从头测试下编译情况,利用号令:

       make defconfig

       系统提醒:configuration written to .config(设置装备摆设写入config)。

  11. 11

       接着我们输入号令:

       make menuconfig

       若是一切正常,会呈现一个设置装备摆设菜单,可以选摘要编译的固件平台、型号,还能选择固件中要添加的功能和组件,至此编译情况就搭建好了。

注重事项

  • 利用非root用户来完当作工作
  • 发表于 2018-04-02 00:00
  • 阅读 ( 3706 )
  • 分类:其他类型

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
admin
admin

0 篇文章

作家榜 »

  1. xiaonan123 189 文章
  2. 汤依妹儿 97 文章
  3. luogf229 46 文章
  4. jy02406749 45 文章
  5. 小凡 34 文章
  6. Daisy萌 32 文章
  7. 我的QQ3117863681 24 文章
  8. 华志健 23 文章

联系我们:uytrv@hotmail.com 问答工具