# NanoPi NEO2 - OpenWrt

**URL:** https://hub.mender.io/t/nanopi-neo2-openwrt/790
**Category:** OpenWrt
**Tags:** openwrt
**Created:** [July 4, 2019, 8:45pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790 "2019-07-04T20:45:43Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)
#### Post date: [July 4, 2019, 8:45pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/1 "2019-07-04T20:45:43Z")

</div>

**Design Philosophy / Build process**  
Generic OpenWrt with mender app and u-boot - non mender load created (with mender if selected in config)  
generic openwrt image post-processed to become mender image  
post-processing: mender disk layout created, distribution specific config, files and apps added  
reason: we use generic openwrt for multiple products, post processing differentiates  
This (post processing) approach also makes if fairly easy to port to other OpenWrt architectures. Amlogic S912 (proprietary) also ported.  
**Prequisites:**  
Mender, openwrt build host prerequisites  
20-40GB free space for openwrt checkout, build  
mkdir your\_openwrt\_build\_dir; cd your\_openwrt\_build\_dir (…/ from where git will place openwrt)  
wget [http://www.rossco.org/Downloads/OpenWrt/openwrt-mender-v1.0.0.tar.gz](http://www.rossco.org/Downloads/OpenWrt/openwrt-mender-v1.0.0.tar.gz)  
tar -zxvf openwrt-mender-v1.0.0.tar.gz  
It is highly recommended to examine the various scripts prior to running them  
Install Mender host build packages. If using Centos 7+, run install\_build\_tools.sh else, determine how **to install tools for your OS**  
Checkout required openwrt version, run: ./get\_openwrt.sh  
Patch openwrt for mender, run: ./openwrt\_to\_mender.sh  
cd openwrt  
**OpenWrt Configuration** (make menuconfig, already done by openwrt\_to\_mender.sh, change after, if required)):  
Target System: Allwinner A1x/A20/A3x  
SubTarget: Allwinner A64  
Target Profile: Nanopi NEO2 (H5) (may work with other H5 dreivitaves)  
Target Images-\> Boot Partition Size: 20M  
Target Images-\> Root partition size: 3650M (assumes 8GB Flash, Total Sectors: 15523840)  
Advanced Configuration -\> ToolChain Options-\>GCC Compiler Version-\>GCC 7.X (other versions may work, untested)  
Advanced Configuration -\> C Library Implementation: Use glibc (crucial)  
Utilities-\>mender-\>selected as builtin (_)  
Utilities-\>jitter-rngd-\>selected as builtin (_) (entropy source, to avoid slow boot)  
OpenWrt Mender Configuration (make menuconfig):  
Utilities-\>mender-\>Configuration (alter to taste):  
() ServerURL # Mender update server URL  
() ServerCertificate # If used  
(/dev/mmcblk0p2) RootfsPartA  
(/dev/mmcblk0p3) RootfsPartB  
(86400) UpdatePollIntervalSeconds  
(86400) InventoryPollIntervalSeconds  
(30) RetryPollIntervalSeconds  
Mender Variables, MENDER\_\* Configuration, if defaults need to be changed.  
Before running openwrt\_to\_mender.sh (set as defaults)  
edit: Custom/package/boot/uboot-sunxi/files/config\_mender\_defines.h  
cp Custom/package/boot/uboot-sunxi/files/config\_mender\_defines.h   
package/boot/uboot-sunxi/files/config\_mender\_defines.h  
After running openwrt\_to\_mender.sh (set before build)  
edit: package/boot/uboot-sunxi/files/config\_mender\_defines.h  
Build Openwrt (with above configuration)  
make, get a jug of coffee  
if, during build, configuration questions arise, answer defaults to all  
Flash Openwrt-Mender  
Change the following variables in mender\_flashdisk.sh to match your tastes / infrastructure:  
BASE\_NAME # What your distribution is called  
DIST\_DEST\_DIR # Directory or cifs mount point of your package repository  
MENDER\_SERVER # URL of mender update server  
MENDER\_SERVER\_UID # User ID for mender update server login  
MENDER\_SERVER\_PASS # Password for mender update server login  
TOTAL\_SECTORS # Default SD sectors 15523840 for 8GB SD. Use fdisk to determine if different SD size  
Place SD card in USB adapter, identify SD disk, IE; sde  
To create image, flash SD and upload mender rootfs artifact:  
./mender\_flashdisk.sh disk  
To only create image and upload mender rootfs artifact:  
./mender\_flashdisk.sh

```
Full mender image (for distribution and flashing by other means):
	/tmp/mender/mender-neo2-openwrt-$(build_date).zip

```

Enjoy;  
Bill Ross  
[www.rossco.org](http://www.rossco.org)

* * *

_If this post was useful to you, please press like, or leave a thank you note to the contributor who put valuable time into this and made it available to you. It will be much appreciated!_

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [July 5, 2019, 2:29pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/2 "2019-07-05T14:29:52Z")

</div>

Thanks @rossbcan, any specific OpenWrt versions that this has been tested on?

---

<div class="post-metadata">

### Author: ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)
#### Post date: [July 5, 2019, 3:07pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/3 "2019-07-05T15:07:38Z")

</div>

Works on the particular version / $ARCH downloaded by above tarball scripts. For the proprietary Amlogic S912 port, openwrt trunk was no problem. Porting to any u-boot based $ARCH is relatively straightforward, with minor script and patch tweaks should versions change…

---

<div class="post-metadata">

### Author: ![lemoose](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@lemoose](https://hub.mender.io/u/lemoose)
#### Post date: [July 9, 2019, 8:37pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/4 "2019-07-09T20:37:45Z")

</div>

> [@rossbcan](#):
>
> Advanced Configuration → C Library Implementation: Use glibc (crucial)

Hey @rossbcan could you explain why there is this hard dependency on glibc? I thought Mender worked well with musl?

This is such a cool toolset. Thank you very much for sharing.

---

<div class="post-metadata">

### Author: ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)
#### Post date: [July 10, 2019, 12:43pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/5 "2019-07-10T12:43:00Z")

</div>

My distribution had other dependencies on glibc. Called it a dependency to avoid verifying alternatives. Why not try with musl, share results? That is what opensource / sharing is all about. Netizens perfect / improve what is shared.

…B

---

<div class="post-metadata">

### Author: ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)
#### Post date: [July 10, 2019, 1:11pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/6 "2019-07-10T13:11:53Z")

</div>

Please note that we have experienced some issues with musl in Yocto,

[https://tracker.mender.io/browse/MEN-2443](https://tracker.mender.io/browse/MEN-2443)

Though this could have been isolated to Yocto, and the type of flags it uses during build and in the end there was a viable workaround.

---

<div class="post-metadata">

### Author: ![beruti](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/beruti/32/329_2.png) [@beruti](https://hub.mender.io/u/beruti)
#### Post date: [July 13, 2019, 7:23am UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/7 "2019-07-13T07:23:53Z")

</div>

Hi @rossbcan,

Thanks for sharing all your work and documenting it so well.

I’m having a few issues creating and uploading the Mender Rootfs Artifact and am wondering if you came across anything similar in making the mender\_flashdisk script.

**Problem: Parsing issues in upload**

Failing on: `mender-cli artifacts upload --server $MENDER_SERVER -v $BASE_NAME-ext4-rootfs-$DATE.mender`

**Description:**  
On my build server I can create a mender rootfs artifact with the following command:

`mender-artifact write rootfs-image -n $BASE_NAME-$DATE -t $BASE_NAME -f $ROOTFS_IMAGE -o $BASE_NAME-ext4-rootfs-$DATE.mender`

(using `-f` instead of `-u` to specify the .img file as per [https://github.com/mendersoftware/mender-artifact/commit/e902214ae87e2376ca67656243d612ff16d19e32](https://github.com/mendersoftware/mender-artifact/commit/e902214ae87e2376ca67656243d612ff16d19e32))

But whilst I can read the artifact generated fine with mender-artifact read and can login to my mender server with the mender-cli when i try the mender-artifact upload I get a failure response of `“unexpected EOF”` or `“Cannot parse artifact file”`.

Likewise if i try to manually upload the .mender rootfs file generated I receive a `cannot parse` failure.

**Did you face any similar problems in mender-artifact creation/upload?**

Many thanks

---

<div class="post-metadata">

### Author: ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)
#### Post date: [July 13, 2019, 9:29am UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/8 "2019-07-13T09:29:16Z")

</div>

Check mender\_flashdisk.sh:  
mender-cli artifacts upload --server $MENDER\_SERVER -v $BASE\_NAME-ext4-rootfs-$DATE.mender  
do mender-cli --help. Think the API changed (-v?)  
you also need to be root for mender\_flashdisk.sh

---

<div class="post-metadata">

### Author: ![beruti](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/beruti/32/329_2.png) [@beruti](https://hub.mender.io/u/beruti)
#### Post date: [July 15, 2019, 3:35pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/9 "2019-07-15T15:35:02Z")

</div>

Thanks for suggestion. Seems its a problem with me using an old version of mender-server. 😅

---

<div class="post-metadata">

### Author: ![EyitopeIO](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/eyitopeio/32/1303_2.png) [@EyitopeIO](https://hub.mender.io/u/EyitopeIO)
#### Post date: [July 8, 2021, 9:47pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/10 "2021-07-08T21:47:43Z")

</div>

Hi @rossbcan The link at [http://www.rossco.org/Downloads/OpenWrt/openwrt-mender-v1.0.0.tar.gz](http://www.rossco.org/Downloads/OpenWrt/openwrt-mender-v1.0.0.tar.gz) returns a **404**. Where might I find the file?

---

<div class="post-metadata">

### Author: ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)
#### Post date: [July 11, 2021, 2:35pm UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/11 "2021-07-11T14:35:39Z")

</div>

Try link again…

![image001.jpg](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/1X/f464dd1c7c382c015b3fc53eebe1cd1aadffee61.jpeg)

---

<div class="post-metadata">

### Author: ![kele6ra](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kele6ra/32/1375_2.png) [@kele6ra](https://hub.mender.io/u/kele6ra)
#### Post date: [September 23, 2021, 9:23am UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/12 "2021-09-23T09:23:58Z")

</div>

It is still 404.

---

<div class="post-metadata">

### Author: ![kele6ra](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kele6ra/32/1375_2.png) [@kele6ra](https://hub.mender.io/u/kele6ra)
#### Post date: [September 23, 2021, 9:35am UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/13 "2021-09-23T09:35:46Z")

</div>

Could you please describe how you have patched your u-boot and where to get mender patch for openWRT?

---

<div class="post-metadata">

### Author: ![rossbcan](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/rossbcan/32/1441_2.png) [@rossbcan](https://hub.mender.io/u/rossbcan)
#### Post date: [August 24, 2024, 10:04am UTC](https://hub.mender.io/t/nanopi-neo2-openwrt/790/14 "2024-08-24T10:04:58Z")

</div>

The link has changed to: [http://www.rossco.org/Downloads/Files/openwrt-mender-v1.0.0.tar.gz](http://www.rossco.org/Downloads/Files/openwrt-mender-v1.0.0.tar.gz)

sorry for long DELAY
