1.在编译openwrt之前,需要先安装依赖包,命令如下:

sudo apt-get install autoconf binutils bison bzip2 flex gawk gettext make libncurses5-dev patch unzip wget zlib1g curl libcurl3 openssl libssl-dev perl libperl-dev cpio libexpat1 gettext openssh-client subversion cmake libtool

2.然后新建用户

#adduser openwrt

3.再开始编译openwrt源码生成镜像文件

3.1.首先下载openwrt源码,
下载地址:https://github.com/openwrt/openwrt/tree/chaos_calmer
或者使用git工具(要先装git工具),输入下列命令:

git clone git://git.openwrt.org/openwrt.git

参考:https://dev.openwrt.org/wiki/GetSource

这是我的openwrt的源码:https://github.com/qinfupingqq/openwrt

3.2.然后解压下载的文件

解压zip格式的压缩文件的话使用:

unzip openwrt***.zip

如果使用git联网下载就不需要解压。
3.3.然后进入openwrt文件夹

#cd openwrt

3.4.添加软件扩展包

./script/feeds update -a #更新所有附加的包(如:luci 等等)
./script/feeds install -a #安装所有更新的包

3.5.接着,测试编译环境

#make defconfig

3.6.进入定制界面,配置编译选项

make menuconfig #设置编译配置

选项配置参考:blog.csdn.net/xingyuzhe/article/details/48976501(其中有的选项位置和图片不一样,应该是版本不同,耐心找找就能找到位置,主要在"base system" "kernel modules" "luci" "network" "utilities")

上面的参考是树莓派的配置且用来制作无线路由的,自己的需要根据自身需要选择。

这里需要注意
1."target system"要根据自己板子的实际来选择,否则编译出来的系统放到开发板上也是跑不起来的,如果"target system"中没有完全匹配的可以,在"subtarget"中选择,然后在"target profile"中选择开发板名称
例如,我的是树莓派3,就应该在"target system"选择"Broadcom BCM2708",在"subtarget"中选择"Broadcom BCM2710",在"target profile"中选择"raspberrypi3 B"
2.其他配置中,下面列出部分自己找到的说明:
我配置的选项是:(后面跟default表示,没有修改,选择默认的选项)
target system-----------------------------Broadcom BCM2708
subtarget---------------------------------Broadcom BCM2710
target profile----------------------------raspberrypi3 B(default)
Global build settings---------------------compile with support for patented functionality(default)
enable shadow password support
enable support for prink
support for paging of anonymous memory
compile the kernel with debug filesystem enabled
...
base system-------------------------------wireless tools
Luci:
Applications----------------------------luci-app-samba
kernel module
block device------------------------------kmod-block2mtd(MTD:memory technology device内存技术设备)
Cryptographic API modules-----------------kmod-crypto-ccm
kmod-crypto-cmac
file systems------------------------------ext4
kmod-fs-ntfs
kmod-fs-vfat
USB Supprot-------------------------------kmod-usb-ohci
kmod-usb-uhci
kmod-usb-storage-extras
kmod-usb2
mount-utils
ntfs-3g
block-mount
video support-----------------------------kmod-video-core
kmod-video-uvc
Wireless Drivers--------------------------kmod-ath
kmod-ath9k-common
kmod-ath9k-htc
kmod-brcmfmac
network-------------------------------------netperf
wpa-supplicant
SSH---------------------------------------openssh-sftp-server
utilities-----------------------------------usbstils
disc--------------------------------------fdisk
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

关于其中的配置的部分说明如下

Base system—> <*> block-mount (用于自动挂载的工具)
Kernel modules—> Filesystems—> <*> kmod-fs-ext4 (ext4分区格式支持组件)
Kernel modules—> Native Language Support—> <*> kmod-nls-utf8 (编码格式)
Kernel modules—> Sound Support—> <*> kmod-sound-core (声卡)
Kernel modules—> Sound Support—> <*> kmod-usb-audio (声卡)
Kernel modules—> USB Support—> <*> kmod-usb-cm109 (声卡)
Kernel modules—> USB Support—> <*> kmod-usb-serial (串口)
Kernel modules—> USB Support—> <*> kmod-usb-serial-ch341 (ch341)
Kernel modules—> USB Support—> <*> kmod-usb-serial-cp210x (cp210x)
Kernel modules—> USB Support—> <*> kmod-usb-serial-ftdi (ftdi)
Kernel modules—> USB Support—> <*> kmod-usb-storage (u盘)
Kernel modules—> USB Support—> <*> kmod-usb-storage-extras (u盘)
Kernel modules—> Video Support—> <*> kmod-video-core (视频)
Kernel modules—> Video Support—> <*> kmod-video-uvc (视频)
Kernel modules—> Video Support—> <*> kmod-video-videobuf2 (视频)
Libraries—> <*> alsa-lib (视频)
LuCI设置界面,其中Applications
luci-app-ahcp..................................... LuCI Support for AHCPd
luci-app-ddns..........动态域名.......... Dynamic DNS configuration module
luci-app-diag-core......................... LuCI Diagnostics Tools (Core)
luci-app-diag-devinfo....磁盘信息.... LuCI Diagnostics Tools (Device Info)
luci-app-epg-oscam.......卫星电视.......... epg-oscam configuration module
luci-app-filebrowser......文件浏览............... File browser tool module
luci-app-firewall.......防火墙.... Firmware and Portforwarding application
luci-app-freifunk-policyrouting.......... Policy routing for mesh traffic
luci-app-guide...........应用向导.............. guide configuration module
luci-app-hd-idle.........磁盘休眠......... Hard Disk Idle Spin-Down module
luci-app-ipid.................................. ipid configuration module
luci-app-lqtapifoss.......................................... Lantiq voip
luci-app-mentohust.......校园认证................. mentohust confi
luci-app-meshwizard...... Shellscript based wizard to setup mesh networks
luci-app-mldonkey......mldonkey下载服务..... mldonkey configuration module
luci-app-mmc-over-gpio................ MMC-over-GPIO configuration module
luci-app-multiwan............ LuCI Support for the OpenWrt MultiWAN agent
luci-app-n2n.................................... n2n configuration module
luci-app-nfsd........................ Network Shares - NFS SERVERS module
luci-app-ntpc.............. NTP time synchronisation configuration module
luci-app-nwan..............多拨服务 ....... nwan configuration module
luci-app-openvpn................................ LuCI Support for OpenVPN
luci-app-p2pblock.......... LuCI Support for the Freifunk P2P-Block addon
luci-app-p910nd........打印服务............ p910nd - Printer server module
luci-app-polipo........................ LuCI Support for the Polipo Proxy
luci-app-pppoeserver.................... pppoeserver configuration module
luci-app-pptpd................................ pptpd configuration module
luci-app-qos..................... Quality of Service configuration module
luci-app-qosv4........QOS平衡服务.............. qosv4 configuration module
luci-app-radvd.................................... LuCI Support for Radvd
luci-app-samba.........共享服务.... Network Shares - Samba SMB/CIFS module
luci-app-siitwizard............. SIIT IPv4-over-IPv6 configuration wizard
luci-app-splash......................... Freifunk DHCP-Splash application
luci-app-statistics.......................... LuCI Statistics Application
luci-app-tinyproxy............... Tinyproxy - HTTP(S)-Proxy configuration
luci-app-transmission.......BT下载器.... transmission configuration module
luci-app-upnp................. Universal Plug & Play configuration module
luci-app-ushare.....流媒体服务....... uShare - UPnP A/V & DLNA Media Server
luci-app-vnstat.................................. LuCI Support for VnStat
luci-app-voice-core........................... LuCI Voice Software (Core)
luci-app-vsftpd..........FTP服务.............. vsftpd configuration module
luci-app-webcam.............................. webcam configuration module
luci-app-webshell.......WEB命令控制台........ webshell configuration module
luci-app-wol..........网络唤醒............... LuCI Support for Wake-on-LAN
luci-app-wshaper................................ LuCI Support for wshaper
Multimedia—> <*> mjpg-streamer (视频)
Utilities—> Filesystems—> <*> badblocks (u盘)
Utilities—> <*> alsa-utils-tests (声卡)
luci-i18n-chinese //luci中文支持
luci-app-ushare //媒体服务
luci-app-ddns //ddns
luci-app-qos //qos
luci-app-hd-idle //usb硬盘自动休眠
luci-app-samba //samba
luci-app-upnp //upnp端口映射
ushare //媒体服务
usbutils //usb工具如lsusb
nfs-kernel-server //NFS文件服务器
fdisk
e2fsprogs //分区管理工具
kmod-usb-storage //USB存储设备支持
kmod-fs-ntfs //ntfs,只读
kmod-fs-vfat //fat,fat32文件系统支持
ntfs-3g //可读写NTFS支持
kmod-fs-ext4 //ext2,ext3,ext4
kmod-nls-utf8 //文件系统语言支持
kmod-fs-nfs-common
kmod-fs-nfs //NFS
//摄像头
kmod-video-core //视频支持
kmod-video-gspca-core
kmod-video-uvc //免驱摄像头
kmod-i2c-core
kmod-input-core
motion //监控软件
block-mount //自动挂载,可在luci的系统->挂载点查看相关信息

network中wpa-supplicant和wpa-psk的区别
WPA-PSK是指Pre-Shared Key,就是用户已经有了一个Key,通过这个Key来进行WPA认证,不需要认证服务器。如果不是PSK的话,需要认证服务器来产生Key。
WPA和WPA-PSK采用了相同的加密机制,其区别仅在于WPA-PSK的认证机制只有简单的一般密码,而非针对用户特定的身份认证。虽然这种一般密码式的方法存在被暴力破解的可能性,但是,与WEP相比,无线网络的安全性仍然大大强化。
从技术角度看,WPA主要解决了WEP在共享密钥上的漏洞,添加了用户级的认证措施。Wi-Fi联盟给出的WPA定义即为:
  WPA = 802.1X + EAP + TKIP + MIC
WPA只是在802.11i正式推出之前的Wi-Fi企业联盟的安全标准,802.11i,该标准通过使用CCM (Counter-Mode/CBC-MAC)认证方式和AES(Advanced Encryption Standard)加密算法,更进一步加强了无线局域网的安全和对用户信息的保护。

以上是配置中的选项的部分解释,备注一下。
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
3.7.最后是编译的过程,如下:

注意:编译的时候尽量使用root用户,否则,可能出现没有创建某个文件的权限,没有删除某个文件的权限等问题,此时,即便使用chmod改变所有文件的权限也行不通,因为,里面部分文件是临时创建的,创建出来的文件可能会没有权限。

make download #提前下载需要编译软件的源代码(可以跳过)
make V=99 #V=99表示显示编译详情(便于调试编译错误)
#等待编译完成,编译完成后所有的输出镜像和ipk包会在openwrt/bin目录下。
注意:部分安装包可能会很难下载,可以翻墙下载下来,然后放到openwrt/dl目录下边。

下面给出地址,里面有我安装时需要的安装包:

https://github.com/qinfupingqq/dl

下面是我编译出来的镜像(我的是树莓派3):

链接:http://pan.baidu.com/s/1jI21Ll0 密码:nbwc

编译过程有几个问题需要注意
1.you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
解决方法
输入命令:export FORCE_UNSAFE_CONFIGURE=1
2.编译的时候尽量使用root用户,否则,可能出现没有创建某个文件的权限,没有删除某个文件的权限等问题,此时,即便使用chmod改变所有文件的权限也行不通,因为,里面部分文件是临时创建的,创建出来的文件可能会没有权限。
3.编译到后面,会有一个选择是否安装Broadcom BCM2835 camera interface driver的选项,此时要选N,如果选择Y,就会遇到
config.status: error: cannot find input file: `po/Makefile.in.in'
Makefile:198: recipe for target '/home/openwrt/openwrt/build_dir/target-arm_arm1176jzf-s+vfp_musl-1.1.16_eabi/transmission-mbedtls/transmission-2.92+git/.configured_yyyyyyyy' failed
make[3]: *** [/home/openwrt/openwrt/build_dir/target-arm_arm1176jzf-s+vfp_musl-1.1.16_eabi/transmission-mbedtls/transmission-2.92+git/.configured_yyyyyyyy] Error 1
make[3]: Leaving directory '/home/openwrt/openwrt/feeds/packages/net/transmission'
package/Makefile:196: recipe for target 'package/feeds/packages/transmission/compile' failed
make[2]: *** [package/feeds/packages/transmission/compile] Error 2
make[2]: Leaving directory '/home/openwrt/openwrt'
package/Makefile:193: recipe for target '/home/openwrt/openwrt/staging_dir/target-arm_arm1176jzf-s+vfp_musl-1.1.16_eabi/stamp/.package_compile' failed
make[1]: *** [/home/openwrt/openwrt/staging_dir/target-arm_arm1176jzf-s+vfp_musl-1.1.16_eabi/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/openwrt/openwrt'
/home/openwrt/openwrt/include/toplevel.mk:192: recipe for target 'world' failed
make: *** [world] Error 2
等问题,配置失败导致缺乏文件。
4.如果编译成功,也生成了镜像,但是写到板子上却无法启动,就要检查前面选择树莓派时的配置("target system")是否正确。
5.如果烧写到树莓派启动发现系统是read-only filesystem时,就要检查启动时,文件系统有没有问题,可能是镜像损坏了,重新写一个系统就能解决。

启动openwrt

整个编译过程结束后,可以在bin/brcm2708的目录下找到编译成功的镜像,使用工具烧写到SD卡上,然后插入到树莓派上通电就可以启动了。

参考博客:

http://blog.csdn.net/dissipated_man/article/details/52572624

http://blog.csdn.net/xingyuzhe/article/details/48976501

http://www.cnblogs.com/merlindu/p/6435211.html

https://wiki.openwrt.org/toh/raspberry_pi_foundation/raspberry_pi#boot_log_raspberry_pi_3

树莓派3安装openwrt的更多相关文章

  1. 树莓派3B安装OpenWrt打造超级路由器

    网上有很多树莓派安装OpenWrt的教程,我这里写一下个人安装体验以及踩过的坑

  2. RaspberryPi 3b+ 安装OpenWrt教程

    layout: post title: "RaspberryPi 3b+ 安装OpenWrt教程" date: 2019-09-28 22:00:00 +0800 categori ...

  3. 树莓派3B安装LEDE

    本来想安装openwrt的,但是op官方没有支持pi3,甚至op都不怎么发新版了,仅LEDE分支有缓慢的更新..离题了,之前给pi3装过LEDE,体验不是很好.今天到openwrt官网看了下,发现之前 ...

  4. 配置树莓派3的openwrt中的网络

    在上一篇中讲到openwrt的编译安装: http://www.cnblogs.com/yeqluofwupheng/p/7296218.html 但是烧写进去,启动系统后发现它的默认配置是路由器,所 ...

  5. 树莓派centos安装的基本配置

    萌新再发一帖,这篇文章呢主要是为大家在树莓派上安装centos以后提供一个问题的解决方案. 首先我呢觉得好奇就在某宝上花了两百来块钱买了一套树莓派,很多人喜欢在树莓派上安装Debian,我呢更青睐用R ...

  6. GO语言.树莓派.环境安装和测试

    Go是Google开发的一种静态强类型.编译型.并发型,并具有垃圾回收功能的编程语言.为了方便搜索和识别,有时会将其称为Golang 记录一下如何在树莓派上安装语言环境 第一步: 下载安装包 http ...

  7. 路由器安装Openwrt&&***

    路由器安装Openwrt&&*** 前言 对于给路由器刷系统,肯定是有风险的,敢于承担风险的才开始动手. Openwrt其实也是一款嵌入式Linux系统,对于闪存大小也是有一定的要求的 ...

  8. 树莓派3B安装远程

    步骤1:树莓派3安装 RDP SERVER 及VNC SERVER sudo apt-get install -y tightvncserver sudo vncserver 最后才知道一定要加上VN ...

  9. 在(Raspberry Pi)树莓派上安装NodeJS

    本文主讲如何在树莓派3B上安装node.js 环境描述1. 树莓派安装了`2016-11-25-raspbian-jessie-lite`(PS:在此版本的镜像中,默认禁用了ssh,在烧录好镜像之后, ...

随机推荐

  1. 讲解开源项目:功能强大的 JS 文件上传库

    本文作者:HelloGitHub-kalifun HelloGitHub 的<讲解开源项目>系列,项目地址:https://github.com/HelloGitHub-Team/Arti ...

  2. Container及其内部进程监控剖析

    目前市场上的虚拟化技术种类很多,例如moby(docker).LXC.RKT等等.在带来方便应用部署和资源充分利用的好处的同时,如何监控相应Container及其内部应用进程成为运维人员不可避免遇到的 ...

  3. Mbatis是什么?怎么运行?

    一   .    Mybatis是什么? Mybatis是一个持久层框架,其中编写的过程中sql语句是需要程序员自己去编写,Mybatis也有 一些映射(输入参数映射,输出参数映射),Mybatis是 ...

  4. JAVA 获取时间段内的每一天

    public class day { public static void main(String[] args) { // TODO Auto-generated method stub Strin ...

  5. 读书分享全网学习资源大合集,推荐Python学习手册等三本书「01」

    0.前言 在此之前,我已经为准备学习python的小白同学们准备了轻量级但超无敌的python开发利器之visio studio code使用入门系列.详见 1.PYTHON开发利器之VS Code之 ...

  6. 对IOC和DI的通俗理解

    学习过spring框架的人一定都会听过Spring的IoC(控制反转) .DI(依赖注入)这两个概念,对于初学Spring的人来说,总觉得IoC .DI这两个概念是模糊不清的,是很难理解的,今天和大家 ...

  7. Javaweb Cookie机制

    Javaweb Cookie机制 一.前言 HTTP协议是一种无状态的协议,WEB服务器本身不能识别出哪些请求是同一个浏览器发出的 ,浏览器的每一次请求都是完全孤立的,即使 HTTP1.1 支持持续连 ...

  8. 安装yarn集群

    安装yarn集群 # mapreduce运行平台YARN mapreduce程序应该是在很多机器上并行启动,而且先执行map task,当众多的maptask都处理完自己的数据 后,还需要启动众多的r ...

  9. 一看就懂-Docker容器化

    一.Docker简介 1.1 什么是docker docker的英文意思是 码头工人,意思就是搬运东西的意思,其实这和docker的特点是一样的,docker提供的就是一种容器化搬运东西(我们的软件. ...

  10. 转载-SpringBoot开发案例之整合日志管理

    转载:https://cloud.tencent.com/developer/article/1097579 有一种力量无人能抵挡,它永不言败生来倔强.有一种理想照亮了迷茫,在那写满荣耀的地方. 00 ...