Difference between revisions of "How to Build FriendlyWrt"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
Line 1: Line 1:
 
[[How to Build OpenWrt/zh|查看中文]]
 
[[How to Build OpenWrt/zh|查看中文]]
  
==简介==
+
==Introduction==
OpenWrt是适合于嵌入式设备的一个Linux发行版,它不是一个单一、静态的固件,而是提供了一个可添加软件包的可写的文件系统。
+
OpenWrt is a highly extensible GNU/Linux distribution for embedded devices.Unlike many other distributions for routers, OpenWrt is built from the ground up to be a full-featured, easily modifiable operating system for embedded devices. In practice, this means that you can have all the features you need with none of the bloat, powered by a modern Linux kernel.
这使用户可以自由的选择应用程序和配置,而不必受设备提供商的限制,并且可以使用一些适合某方面应用的软件包来定制你的设备。
+
For more details you can refer to:[https://openwrt.org/ OpenWrt Website]。<br>
对于开发者来说,OpenWrt是一个框架,开发者不必麻烦地构建整个固件就能得到想要的应用程序;对于用户来说,这意味着完全定制的能力,与以往不同的方式使用设备,OPKG包含超过3500个软件。
+
更详细的介绍请参考: [https://openwrt.org/ OpenWrt官网]。<br>
+
 
<br>
 
<br>
本Wiki页面的主要用于介绍如何为FriendlyElec发行的开发板编译OpenWrt,并不涉及太多对OpenWrt的定制和研究。
+
This Wiki pages mainly explains how to compile an OpenWrt system for FriendlyElec's ARM boards and doesn't have details about how to customize an OpenWrt system.
OpenWrt是由开源组织维护的开源项目,其官网上已经有丰富的用户文档和开发者文档,如果您需要对OpenWrt进行定制开发,请自行查看OpenWrt官方提供的文档: [https://openwrt.org/docs/start openwrt doc]。
+
OpenWrt is maintained by open source communities and its website has rich resources. If you want to customize an OpenWrt you can refer to: [https://openwrt.org/docs/start openwrt doc]。
 
+
  
 
==H3 平台==
 
==H3 平台==

Revision as of 02:05, 15 January 2019

查看中文

1 Introduction

OpenWrt is a highly extensible GNU/Linux distribution for embedded devices.Unlike many other distributions for routers, OpenWrt is built from the ground up to be a full-featured, easily modifiable operating system for embedded devices. In practice, this means that you can have all the features you need with none of the bloat, powered by a modern Linux kernel. For more details you can refer to:OpenWrt Website

This Wiki pages mainly explains how to compile an OpenWrt system for FriendlyElec's ARM boards and doesn't have details about how to customize an OpenWrt system. OpenWrt is maintained by open source communities and its website has rich resources. If you want to customize an OpenWrt you can refer to: openwrt doc

2 H3 平台

  • 首先,OpenWrt必须切换到普通用户才能正常编译,假设你的PC机的普通用户为fa,执行下列命令切换为该普通用户:
$ su fa

接下来的所有操作请务必在普通用户的环境下进行。


  • FriendlyElec使用的OpenWrt基于18.06.1版本,执行下列命令克隆源码并切换分支:
$ cd /home/fa/
$ git clone https://github.com/friendlyarm/openwrt -b master-v18.06.1

克隆完毕后,会得到一个名"openwrt"的目录。
虽然该版本的OpenWrt目前仅支持为两款FriendlyElec H3开发板(NanoPi NEO / NanoPi M1 Plus)制作系统映像,但是由于FriendlyElec H3开发板都比较兼容和类似,所以我们完全可以基于NanoPi M1 Plus的config,为其他FriendlyElec H3开发板制作OpenWrt系统映像。 下面将以NanoPi M1 Plus为例,描述如何编译制作OpenWrt系统映像。在开始编译制作OpenWrt系统映像前,请务必先阅读OpenWrt官方编写的编译文档openwrt buildsystem,下面将不再赘述每一步编译操作的作用。


下载成功后,解压并拷贝dl目录到OpenWrt源码的根目录:

$ cd /home/fa/
$ tar openwrt-18.06.1-prebuilt_YYYMMDD.tar.gz ./
$ ls openwrt-18.06.1-prebuilt
bin  dl

其中,bin目录里包含的文件为FriendlyElec编译OpenWrt后产生的系统映像等文件,dl目录则为FriendlyElec预先下载好的软件包目录,将dl目录拷贝到OpenWrt源码的根目录:

$ cp -r openwrt-18.06.1-prebuilt/dl /home/fa/openwrt/


  • 执行下列命令为FriendlyElec H3开发板(NanoPi NEO / NanoPi M1 Plus)编译并制作OpenWrt系统映像:
$ cd /home/fa/openwrt/friendlyelec
$ ./build.sh nanopi-h3

编译完成后,会生成下列文件:

$ tree bin/targets/sunxi/cortexa7/ -L 1
bin/targets/sunxi/cortexa7/
├── config.seed
├── openwrt-18.06.1-sunxi-cortexa7-device-sun8i-h3-nanopi-m1-plus.manifest
├── openwrt-18.06.1-sunxi-cortexa7.manifest
├── openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-m1-plus-ext4-sdcard.img.gz
├── openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-m1-plus-squashfs-sdcard.img.gz
├── openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-neo-ext4-sdcard.img.gz
├── openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-neo-squashfs-sdcard.img.gz
├── openwrt-imagebuilder-18.06.1-sunxi-cortexa7.Linux-x86_64.tar.xz
├── openwrt-sdk-18.06.1-sunxi-cortexa7_gcc-7.3.0_musl_eabi.Linux-x86_64.tar.xz
├── packages
└── sha256sums

openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-m1-plus-ext4-sdcard.img.gz可以用于烧写到TF卡并放在NanoPi M1 PLus上运行。
openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-neo-ext4-sdcard.img.gz可以烧写到TF卡并放在NanoPi NEO上运行。
这两个系统映像都是最原汁原味的OpenWrt系统。


  • 注意事项

OpenWrt作为一个一体化的嵌入式系统制作方案,它集成了编译U-boot、Linux Kernel、Rootfs制作、软件源码包管理的功能。
本WiKi编写时,对于FriendlyElec H3系列的开发板,OpenWrt官方使用的U-boot和Linux源码均为第三方开源社区维护的u-boot-2017.11.tar.bz2和linux-4.14.63.tar.xz(均位于dl目录下),而非FriendlyElec官方维护的版本。
开源社区维护的源码版本迭代较快并且变化较多,如果您想使用FriendlyElec官方维护的稳定版U-boot和Linux内核,请使用FriendlyElec定制过的系统映像,或者自行编译FriendlyElec提供的BSP源码并制作系统映像,相关参考如下:
1) Building U-boot and Linux for H5/H3/H2+,编译FriendlyElec维护的U-boot和Linux内核;
2) How to make your own SD-bootable ROM,以FriendlyElec的方式制作系统映像,FriendlyElec提供的nanopi-r1_sd_openwrt_4.14_armhf_YYYYMMDD.img.zip就是通过这种方式制作出来的;