Difference between revisions of "How to Build FriendlyWrt"

From FriendlyELEC WiKi
Jump to: navigation, search
(Introduction)
Line 5: Line 5:
 
For more details you can refer to:[https://openwrt.org/ OpenWrt Website]。<br>
 
For more details you can refer to:[https://openwrt.org/ OpenWrt Website]。<br>
 
<br>
 
<br>
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.
+
This Wiki pages mainly explains how to compile an OpenWrt system for FriendlyElec's ARM boards but 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: [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]。
  

Revision as of 02:11, 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 but 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就是通过这种方式制作出来的;