Difference between revisions of "How to Build FriendlyWrt"

From FriendlyELEC WiKi
Jump to: navigation, search
Line 45: Line 45:
 
$ ./build.sh nanopi-h3
 
$ ./build.sh nanopi-h3
 
</syntaxhighlight>
 
</syntaxhighlight>
编译完成后,会生成下列文件:
+
After compilation is done the following files will be generated:
 
<syntaxhighlight lang="text">
 
<syntaxhighlight lang="text">
 
$ tree bin/targets/sunxi/cortexa7/ -L 1
 
$ tree bin/targets/sunxi/cortexa7/ -L 1
Line 61: Line 61:
 
└── sha256sums
 
└── sha256sums
 
</syntaxhighlight>
 
</syntaxhighlight>
openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-m1-plus-ext4-sdcard.img.gz可以用于烧写到TF卡并放在NanoPi M1 PLus上运行。<br>
+
openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-m1-plus-ext4-sdcard.img.gz is used to make a bootable TF card for the NanoPi M1 Plus.<br>
openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-neo-ext4-sdcard.img.gz可以烧写到TF卡并放在NanoPi NEO上运行。<br>
+
openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-neo-ext4-sdcard.img.gz is used to make a bootable TF card for the NanoPi NEO.<br>
这两个系统映像都是最原汁原味的OpenWrt系统。
+
These two are very typical OpenWrt system.
  
 
<br>
 
<br>

Revision as of 02:34, 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 SoC

  • You need to compile an OpenWrt system as a non-root user.In our test we logged in and switched to a non-root user "fa" by running the following command:
$ su fa

All the following commands should be run as a non-root user.


  • For FriendlyElec's ARM boards OpenWrt's version 18.06.1. is integrated. Run the following commands to clone a branch:
$ cd /home/fa/
$ git clone https://github.com/friendlyarm/openwrt -b master-v18.06.1

After cloning is successful a "openwrt" directory will be generated.
Currently version 18.06.1 works with FriendlyElec's H3 based NanoPi NEO and NanoPi M1 Plus. You can make an OpenWrt system for other FriendlyElec's H3 based boards as well by using a config for NanoPi M1 Plus. Here are the steps to make an OpenWrt system for the NanoPi M1 Plus. Before proceed we highly recommend you to carefully read this document:openwrt buildsystem.


  • To compile an OpenWrt system it needs various software packages. To make a compilation process more quickly and smoothly we suggest you download these packages before you start compilation. Here is a link to the tar ball of all necessary packages:prebuilt/openwrt-18.06.1-prebuilt_YYYYMMDD.tar.gz

After you download the tar ball extract the ball and copy the whole "dl" directory to your OpenWrt's root directory:

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

The "bin" directory will have all the image files generated after compiling an OpenWrt system. The "dl" directory has all the necessary packages needed for compilation:

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


  • Run the following commands to compile an OpenWrt system for FriendlyElec's H3 based boards(NanoPi NEO / NanoPi M1 Plus):
$ cd /home/fa/openwrt/friendlyelec
$ ./build.sh nanopi-h3

After compilation is done the following files will be generated:

$ 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 is used to make a bootable TF card for the NanoPi M1 Plus.
openwrt-18.06.1-sunxi-cortexa7-sun8i-h3-nanopi-neo-ext4-sdcard.img.gz is used to make a bootable TF card for the NanoPi NEO.
These two are very typical OpenWrt system.


  • 注意事项

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就是通过这种方式制作出来的;