├── htop-nanopi-r4s.png ├── nanopi-4rs-cam.jpg ├── nanopi-r4s-h264.png ├── nanopi-r4s-htop.png ├── nanopi-r4s-building-kernel.png └── README.md /htop-nanopi-r4s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avafinger/nanopi-r4s-minimal-image/HEAD/htop-nanopi-r4s.png -------------------------------------------------------------------------------- /nanopi-4rs-cam.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avafinger/nanopi-r4s-minimal-image/HEAD/nanopi-4rs-cam.jpg -------------------------------------------------------------------------------- /nanopi-r4s-h264.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avafinger/nanopi-r4s-minimal-image/HEAD/nanopi-r4s-h264.png -------------------------------------------------------------------------------- /nanopi-r4s-htop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avafinger/nanopi-r4s-minimal-image/HEAD/nanopi-r4s-htop.png -------------------------------------------------------------------------------- /nanopi-r4s-building-kernel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avafinger/nanopi-r4s-minimal-image/HEAD/nanopi-r4s-building-kernel.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nanopi-r4s-minimal-image 2 | NanoPi R4S Ubuntu 20.04 LTS 3 | 4 | ![NanoPi R4S](https://github.com/avafinger/nanopi-r4s-minimal-image/raw/main/nanopi-4rs-cam.jpg) 5 | 6 | * [Introduction](#introduction) 7 | * [Kernel History](#kernel-history) 8 | * [Mini Router](#mini-router) 9 | * [H264 Camera](#h264-camera) 10 | * [Monitoring tool](#monitoring-tool) 11 | * [Build your Kernel](#build-kernel) 12 | * [Releases](#releases) 13 | * [Instructions](#instructions) 14 | * [Issues](#issues) 15 | * [Acknowledgement](#acknowledgement) 16 | 17 | ## Introduction 18 | 19 | This is the Ubuntu 20.04 LTS Image for the **NanoPi R4S 4GB** dram version with latest mainline (Kernel / U-Boot). 20 | Image is minimal with some tools already installed. You can switch Kernel version to get most of the board working. 21 | 22 | ![Htop screenshot](https://github.com/avafinger/nanopi-r4s-minimal-image/raw/main/htop-nanopi-r4s.png) 23 | 24 | ## Kernel history 25 | 26 | Kernel will be added as it is a WiP, ideal for testing, developing and checking functionality. 27 | 28 | * **v1 is Kernel 5.10.43** 29 | 30 | The latest patched kernel from FriendlyElec where you get most peripherals working. 31 | 32 | https://github.com/avafinger/nanopi-r4s-minimal-image/releases/tag/v1 33 | 34 | * **v2 is Kernel 5.13.1** 35 | 36 | Mainline Kernel (stable kernel). 37 | 38 | ![CPU Freq / VCore](https://github.com/avafinger/nanopi-r4s-minimal-image/raw/main/nanopi-r4s-htop.png) 39 | 40 | https://github.com/avafinger/nanopi-r4s-minimal-image/releases/tag/v2 41 | 42 | * Upgrade to Kernel 5.13.2 43 | 44 | https://github.com/avafinger/nanopi-r4s-minimal-image/releases/tag/v2-update 45 | 46 | 47 | * Upgrade to Kernel 5.13.3 48 | 49 | https://github.com/avafinger/nanopi-r4s-minimal-image/releases/tag/v2-update-2 50 | 51 | * **v3 is Kernel 4.19.161** 52 | 53 | WiP. 54 | 55 | 56 | ## Mini Router 57 | 58 | Building your mini router with the preferred kernel and configuration. 59 | Instructions and annotations to build our mini router and navigate safer on the Internet. 60 | 61 | WiP 62 | 63 | 64 | ## H264 camera 65 | 66 | Experiments and annotations with USB H.264 Camera (Trial and Error). 67 | 68 | Testing USB2.0 with a USB H264 camera (2MP - 30 FPS), the sensor is 3MP but delivers 1920x1080P 30 FPS. The Camera has good images for indoor usage. 69 | For the test, we build **videostreamer** with HTML5 MP4 support for streaming video. In our test **NanoPi R4S** IP is 192.168.254.119. 70 | The remuxing takes ~20% CPU. The camera delivers ~30 FPS. 71 | 72 | Build: 73 | 74 | sudo apt install golang 75 | sudo apt-get install libmp3lame-dev libx264-dev libpulse-dev libpulse-dev libv4l-dev libvdpau-dev 76 | sudo apt-get install ffmpeg libavcodec-dev libavformat-dev libavdevice-dev 77 | git clone https://github.com/horgh/videostreamer 78 | cd videostreamer 79 | go build 80 | 81 | Run: 82 | 83 | sudo ./videostreamer -host 192.168.254.119 -format v4l2 -input "/dev/video3" -verbose=0 -fcgi=false 84 | 85 | 86 | From a browser (your remote PC), type: 87 | 88 | http://192.168.254.119:8080/stream 89 | 90 | 91 | ![Streaming video H264](https://github.com/avafinger/nanopi-r4s-minimal-image/raw/main/nanopi-r4s-h264.png) 92 | 93 | 94 | ## Monitoring tool 95 | 96 | Htop ( https://github.com/avafinger/htop_2.2.2 ) is used for monitoring the health of the board. 97 | 98 | Config file /root/.config/htop/htoprc: 99 | 100 | # SBC hardware and Kernel specific path. 101 | # Editable manually. 102 | BoardName= 103 | CpuFreq_handler= 104 | CpuTemp_handler= 105 | CpuVCore_l_handler=/sys/class/regulator/regulator.9/microvolts 106 | CpuVCore_b_handler=/sys/class/regulator/regulator.6/microvolts 107 | GpuVCore_handler= 108 | GpuTemp_handler= 109 | # Wlan / Eth alias 110 | eth0_alias= 111 | eth1_alias=enp1s0 112 | wlan0_alias= 113 | wlan1_alias= 114 | 115 | 116 | 117 | ## Building Kernel 118 | 119 | Instructions to build and test your own Kernel (ON-BOARD). 120 | 121 | ![Building Kernel](https://github.com/avafinger/nanopi-r4s-minimal-image/raw/main/nanopi-r4s-building-kernel.png) 122 | 123 | WiP 124 | 125 | 126 | 127 | ## Instructions 128 | 129 | The current setup for the OS image is: 130 | 131 | * eth0 as DHCP (WAN) 132 | * eth1 (R8169) renamed to enp1s0 and static IP: 192.168.254.199 (enabled in /etc/network/interfces) 133 | * No iptables created for the router 134 | * Kernel is conservative, 1.8GHz / 1.4GHz and can be set to 2.0GHz / 1.5GHz 135 | * 8GB SD size minimal. 136 | * all the build tools are installed 137 | * ssh installed, use ssh ubuntu@192.168.254.199 or ssh ubuntu@IP_FROM_DHCP_WAN 138 | 139 | **Credentials** 140 | 141 | user / pass: ubuntu / ubuntu 142 | 143 | **Network** 144 | 145 | Netplan is not active, and you have to edit the file /etc/network/interfaces (with linux) to change the settings: 146 | 147 | ubuntu@192.168.254.199's password: 148 | Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.13.1 aarch64) 149 | 150 | * Documentation: https://help.ubuntu.com 151 | * Management: https://landscape.canonical.com 152 | * Support: https://ubuntu.com/advantage 153 | Last login: Mon Jul 12 23:26:53 2021 from 192.168.254.253 154 | ubuntu@nanopi-r4s:~$ ifconfig 155 | enp1s0: flags=4099 mtu 1500 156 | inet 192.168.254.199 netmask 255.255.0.0 broadcast 192.168.255.255 157 | ether de:68:6e:ce:06:bf txqueuelen 1000 (Ethernet) 158 | RX packets 96 bytes 13677 (13.6 KB) 159 | RX errors 0 dropped 1 overruns 0 frame 0 160 | TX packets 35 bytes 5587 (5.5 KB) 161 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 162 | 163 | eth0: flags=4099 mtu 1500 164 | ether 62:0f:e5:4f:d8:f8 txqueuelen 1000 (Ethernet) 165 | RX packets 0 bytes 0 (0.0 B) 166 | RX errors 0 dropped 0 overruns 0 frame 0 167 | TX packets 0 bytes 0 (0.0 B) 168 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 169 | device interrupt 31 170 | 171 | lo: flags=73 mtu 65536 172 | inet 127.0.0.1 netmask 255.0.0.0 173 | inet6 ::1 prefixlen 128 scopeid 0x10 174 | loop txqueuelen 1000 (Local Loopback) 175 | RX packets 320 bytes 22960 (22.9 KB) 176 | RX errors 0 dropped 0 overruns 0 frame 0 177 | TX packets 320 bytes 22960 (22.9 KB) 178 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 179 | 180 | ubuntu@nanopi-r4s:~$ route 181 | Kernel IP routing table 182 | Destination Gateway Genmask Flags Metric Ref Use Iface 183 | default _gateway 0.0.0.0 UG 0 0 0 enp1s0 184 | 192.168.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp1s0 185 | ubuntu@nanopi-r4s:~$ cat /etc/network/interfaces 186 | # interfaces(5) file used by ifup(8) and ifdown(8) 187 | auto lo 188 | iface lo inet loopback 189 | 190 | #auto eth0 191 | allow-hotplug eth0 192 | iface eth0 inet dhcp 193 | 194 | ## eth1 renamed enp1s0 195 | #allow-hotplug enp1s0 196 | auto enp1s0 197 | #iface enp1s0 inet dhcp 198 | iface enp1s0 inet static 199 | address 192.168.254.199 200 | netmask 255.255.0.0 201 | broadcast 192.168.255.255 202 | gateway 192.168.254.254 203 | dns-nameservers 8.8.8.8 8.8.4.4 204 | 205 | ###auto wlan0 206 | #allow-hotplug wlan0 207 | #iface wlan0 inet dhcp 208 | wpa-ssid "FIB-5G" 209 | wpa-psk "Pw" 210 | ###address 192.168.254.55 211 | ###netmask 255.255.0.0 212 | ###gateway 192.168.254.254 213 | ###dns-nameservers 8.8.8.8 8.8.4.4 214 | ######wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf 215 | ### Disable power saving on compatible chipsets (prevents SSH/connection dropouts over WiFi) 216 | ###wireless-mode Managed 217 | #wireless-power off 218 | 219 | ubuntu@nanopi-r4s:~$ 220 | 221 | **Flashing the Image** 222 | 223 | You need a linux box to burn your SD CARD. 224 | Download the files and find the device name for your SD CARD after is inserted: 225 | 226 | dmesg|tail 227 | [270176.904124] sd 6:0:0:0: [sdd] 31116288 512-byte logical blocks: (15.9 GB/14.8 GiB) 228 | [270176.938132] sdd: sdd1 sdd2 229 | 230 | Burn the Image file like this (taken from the above info): 231 | 232 | ./flash_mainline_sdcard.sh /dev/sdd 233 | 234 | If you have an embedded sd card reader, look for /dev/mmcblkN where N is your sd card number 235 | 236 | ## Releases 237 | 238 | Releases will be available here: https://github.com/avafinger/nanopi-r4s-minimal-image/releases 239 | 240 | 241 | ## Issues 242 | 243 | * Kernel 5.10.43 244 | 245 | Reboot not always works due to "can't mount rootfs" (slow cards). 246 | 247 | 248 | ## Acknowledgement 249 | 250 | I would like to thanks FE for the sample. 251 | --------------------------------------------------------------------------------