<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.banana-pi.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Symowl</id>
		<title>Banana Pi Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.banana-pi.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Symowl"/>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/Special:Contributions/Symowl"/>
		<updated>2026-05-01T06:48:32Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.banana-pi.org/index.php?title=Getting_Started_with_R2&amp;diff=7829</id>
		<title>Getting Started with R2</title>
		<link rel="alternate" type="text/html" href="https://wiki.banana-pi.org/index.php?title=Getting_Started_with_R2&amp;diff=7829"/>
				<updated>2019-09-07T07:19:26Z</updated>
		
		<summary type="html">&lt;p&gt;Symowl: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zh:快速上手 香蕉派 BPI-R2]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
='''Introduction'''=&lt;br /&gt;
&lt;br /&gt;
[[File:BPI-R2_3.JPG|thumb|Overview [[Banana Pi BPI-R2]]]]&lt;br /&gt;
&lt;br /&gt;
   The Banana Pi R2 is a router based development board, which can run on a variety of open source operating systems including OpenWrt, Android, and Bananian. It has 4 Gigabit LAN ports, 1 Gigabit WAN, and 300Mbs wireless N capabilities. &lt;br /&gt;
&lt;br /&gt;
Read more: [[Banana Pi BPI-R2]]&lt;br /&gt;
&lt;br /&gt;
==Key Features==1&lt;br /&gt;
&lt;br /&gt;
* MediaTek MT7623N, Quad-core ARM Cortex-A7&lt;br /&gt;
* Mali 450 MP4 GPU&lt;br /&gt;
* 2G DDR3 SDRAM&lt;br /&gt;
* 1x Mini PCIE interface&lt;br /&gt;
* 2x SATA interface&lt;br /&gt;
* 4x Gigabit LAN 1x Gigabit WAN&lt;br /&gt;
&lt;br /&gt;
==Hardware==&lt;br /&gt;
==BPI-R2 SATA interface==&lt;br /&gt;
BPI-R2 support 2 sata interface and onboard power port.&lt;br /&gt;
&lt;br /&gt;
[[File:BPI-R2_SATA.jpg]]&lt;br /&gt;
&lt;br /&gt;
you can use sata line connect your hardisk on BPI-R2.&lt;br /&gt;
&lt;br /&gt;
*Test a SAMSUNG SSD DISK, the Read/Write performance are below:&lt;br /&gt;
&lt;br /&gt;
::Read from disk: 230MB/s \(command: dd if=/dev/sda of=/dev/zero bs=1M count=10240\)&lt;br /&gt;
&lt;br /&gt;
:: Write to disk: 192MB/s \(command: dd if=/dev/zero of=/dev/sda bs=1M count=1024 oflag=direct\)&lt;br /&gt;
&lt;br /&gt;
*Note:&lt;br /&gt;
&lt;br /&gt;
::if you use 3.5 big hardisk ,you may need power with outside power. on board power maybe can not support enough current&lt;br /&gt;
&lt;br /&gt;
='''Development'''=&lt;br /&gt;
Let's get start to develop on BPI-R2, see amazing things happen.&lt;br /&gt;
==Basic Development==&lt;br /&gt;
===Prepare to develop===&lt;br /&gt;
  * Prepare 16G/above TF card, USB-Serial interface, Ubuntu System&lt;br /&gt;
  * Using your USB-Serial Connect debug console on R2&lt;br /&gt;
&lt;br /&gt;
  [[Image:R2_debug_console.png|240px]]&lt;br /&gt;
&lt;br /&gt;
  * BananaPi R2 - Debug-UART ：http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:debug-uart&lt;br /&gt;
&lt;br /&gt;
===Load your first image on R2===&lt;br /&gt;
  1.You could download latest image from our forum&lt;br /&gt;
  * Here is the example image link: http://forum.banana-pi.org/t/bpi-r2-new-image-release-ubuntu-16-04-v1-3-2018-3-30/5293&lt;br /&gt;
  &lt;br /&gt;
  2.Install bpi-tools on your Ubuntu&lt;br /&gt;
  * apt-get install pv&lt;br /&gt;
  * curl -sL https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools | sudo -E bash&lt;br /&gt;
  &lt;br /&gt;
  3.After you download the image, insert your TF card into your Ubuntu&lt;br /&gt;
  * Execute &amp;quot;bpi-copy xxx.img /dev/sdx&amp;quot; to install image on your TF card&lt;br /&gt;
  &lt;br /&gt;
  4.After step 3, then you can insert your TF card into R2, and press power button for around 10s to setup R2&lt;br /&gt;
&lt;br /&gt;
====Update Your Ubuntu On SD Card====&lt;br /&gt;
  1. Clone Bsp project from Github&lt;br /&gt;
  * Execute &amp;quot;git clone git@github.com:BPI-SINOVOIP/BPI-R2-bsp.git&amp;quot; &lt;br /&gt;
  &lt;br /&gt;
  2. Execute &amp;quot;./build.sh&amp;quot;, to build your own uboot and kernel.&lt;br /&gt;
 [[Image:R2_build_sh.png]]&lt;br /&gt;
  &lt;br /&gt;
  3. After finish built, Execute &amp;quot;cd SD&amp;quot;, plug your Ubuntu TFcard in PC. &lt;br /&gt;
  &lt;br /&gt;
  4. Execute &amp;quot;bpi-update -c bpi-r2.conf -d /dev/sdX&amp;quot;, to update the compiled kernel to your TFcard.&lt;br /&gt;
&lt;br /&gt;
====Ubuntu On Emmc====&lt;br /&gt;
  1. If you want to install Ubuntu on EMMC, follow these steps：&lt;br /&gt;
  * Burn an image to sd card, and set up R64 with sd card.&lt;br /&gt;
  * Copy the image which name contains &amp;quot;xxx-emmc-xxx&amp;quot; to U disk.&lt;br /&gt;
  * mount U disk to R64, then use bpi-copy to burn image to Emmc.  &lt;br /&gt;
&lt;br /&gt;
    bpi-copy  &amp;lt;XXX.img.zip&amp;gt; &lt;br /&gt;
&lt;br /&gt;
  * XXX.img.zip is ubuntu image we can get it from http://www.banana-pi.org/r2-download.html &lt;br /&gt;
  * power off&lt;br /&gt;
  * remove SD &amp;amp; power on&lt;br /&gt;
&lt;br /&gt;
====OpenWrt On SD &amp;amp; Emmc Steps====&lt;br /&gt;
  1. Clone OpenWrt project from Github.&lt;br /&gt;
  * Execute &amp;quot;git clone https://github.com/garywangcn/bpi-r2_lede.git&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  2. You need to have installed gcc, binutils, bzip2, flex, python, perl, make, find, grep, diff, unzip, gawk, getopt, subversion, libz-dev and libc headers.&lt;br /&gt;
  &lt;br /&gt;
  3. Run &amp;quot;./scripts/feeds update -a&amp;quot; to get all the latest package definitions defined in feeds.conf / feeds.conf.default respectively and &amp;quot;./scripts/feeds install -a&amp;quot; to install symlinks of all of them into package/feeds/.&lt;br /&gt;
  &lt;br /&gt;
  4. Use &amp;quot;make menuconfig&amp;quot; to configure your image.&lt;br /&gt;
  * Choose &amp;quot;Target System&amp;quot; to config as &amp;quot;MediaTek Ralink ARM&amp;quot;&lt;br /&gt;
  * Choose &amp;quot;Boot Loaders&amp;quot; to config as &amp;quot;u-boot-bpi_r2&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  5. Execute &amp;quot;make -j1 V=s&amp;quot; to build your own OpenWrt image.&lt;br /&gt;
  &lt;br /&gt;
  6. After built, we have two ways to install image.&lt;br /&gt;
  (1) Plug your TFcard in Ubuntu PC, and enter to &amp;quot;build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_32/&amp;quot;, &lt;br /&gt;
      you will find two images:&lt;br /&gt;
      * mtk-bpi-r2-EMMC.img&lt;br /&gt;
      * mtk-bpi-r2-SD.img&lt;br /&gt;
  (2) Write image to TF card, execute &amp;quot;dd if=mtk-bpi-r2-SD.img of=/dev/sdX&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
  (3) If you want to install image to EMMC, We need another system which is running on SD card to program EMMC image to EMMC, please follow below steps to do:&lt;br /&gt;
      * Copy EMMC image to a running system which is from SD card&lt;br /&gt;
      * Program EMMC image to User Data Area of EMMC: dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0 (assume /dev/mmcblk0 is for EMMC)&lt;br /&gt;
      * Unlock EMMC boot0 block: echo 0 &amp;gt; /sys/block/mmcblk0boot0/force_ro&lt;br /&gt;
      * Program preloader to EMMC boot0 block: dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0boot0 bs=1M count=1&lt;br /&gt;
      * Change the Partition configurion of EMMC is 48h: reboot the system which is running SD, and enter the U-boot command line, run command emmc pconf 48 (for this steps, we can change partition configuration in userspace by using mmc-utils,see more information in BPI-R2 OpenWrt(LEDE) Souce code : 2018-04-11)&lt;br /&gt;
      * Power off, remove SD card, and then power on R2 board&lt;br /&gt;
  &lt;br /&gt;
  7. This step is for upgrade, if you don't want to install image after you built, you could use runtime upgrade.&lt;br /&gt;
  * Copy &amp;quot;bin/targets/mediatek/32/lede-mediatek-32-bananapi,bpi-r2-sysupgrade.tar&amp;quot; to R2 board which is running OpenWrt system(no matter where(SD or EMMC) it boots from), and then run command &amp;quot;sysupgrade lede-mediatek-32-bananapi,bpi-r2-sysupgrade.tar&amp;quot; to update both kernel and rootfs.&lt;br /&gt;
&lt;br /&gt;
* 1,Banana Pi R2 install openWRT: https://www.cnblogs.com/topbin/p/8794152.html&lt;br /&gt;
* 2,Banana Pi R2 Openwrt Network port configuration analysis : https://www.cnblogs.com/topbin/p/9518279.html&lt;br /&gt;
* 3,Banana Pi R2 developing a simple router based on Openwrt : https://www.cnblogs.com/topbin/p/9519881.html&lt;br /&gt;
* 4,Banana Pi R2 Openwrt Luci : https://www.cnblogs.com/topbin/p/9519875.html&lt;br /&gt;
&lt;br /&gt;
=== Network-Configuration===&lt;br /&gt;
*Network-Configuration : http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:network:start&lt;br /&gt;
&lt;br /&gt;
==Advanced Development==&lt;br /&gt;
===GPIO===&lt;br /&gt;
====GPIO Control====&lt;br /&gt;
* echo xxx &amp;gt; /sys/class/gpio/export&lt;br /&gt;
* echo in/out &amp;gt; /sys/class/gpio/gpioxxx/direction&lt;br /&gt;
* echo 0/1 &amp;gt; /sys/class/gpio/gpioxxx/value&lt;br /&gt;
&lt;br /&gt;
Check the base gpio, you could see mine is 233&lt;br /&gt;
&lt;br /&gt;
[[Image:R2_gpio_base.png]]&lt;br /&gt;
&lt;br /&gt;
For example: if you want to change gpio 22 as out highlevel, you need input commands like this：&lt;br /&gt;
&lt;br /&gt;
* echo 255（22+233） &amp;gt; /sys/class/gpio/export&lt;br /&gt;
* echo out &amp;gt; /sys/class/gpio/gpio255/direction&lt;br /&gt;
* echo 1 &amp;gt; /sys/class/gpio/gpio255/value&lt;br /&gt;
&lt;br /&gt;
====PWM Control====&lt;br /&gt;
* echo x &amp;gt;/sys/class/pwm/pwmchip0/export&lt;br /&gt;
* echo 200000 &amp;gt;/sys/class/pwm/pwmchip0/pwmx/period &lt;br /&gt;
* echo 100000 &amp;gt;/sys/class/pwm/pwmchip0/pwmx/duty_cycle                                                                     &lt;br /&gt;
* echo 1 &amp;gt;/sys/class/pwm/pwmchip0/pwmx/enable&lt;br /&gt;
&lt;br /&gt;
More about GPIO : http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:gpio&lt;br /&gt;
&lt;br /&gt;
====Install RPi.GPIO====&lt;br /&gt;
* Execute &amp;quot;git clone https://github.com/BPI-SINOVOIP/RPi.GPIO&amp;quot;&lt;br /&gt;
* after clone the repo, cd RPi.GPIO&lt;br /&gt;
* Execute &amp;quot;sudo apt-get update&amp;quot;&lt;br /&gt;
* Execute &amp;quot;sudo apt-get install python-dev python3-dev&amp;quot;&lt;br /&gt;
* Execute &amp;quot;sudo python setup.py install&amp;quot; or &amp;quot;sudo python3 setup.py install&amp;quot; to install the module&lt;br /&gt;
&lt;br /&gt;
====Using RPi.GPIO====&lt;br /&gt;
* cd /usr/local/bin&lt;br /&gt;
* Execute &amp;quot;./g40.py&amp;quot; to test RPi.GPIO&lt;br /&gt;
&lt;br /&gt;
===Develop 4G module with R2===&lt;br /&gt;
Gets more info from here: &lt;br /&gt;
&lt;br /&gt;
[[Using 4G module with BananaPi]]&lt;br /&gt;
&lt;br /&gt;
===WiFi and Ap mode on R2 Ubuntu===&lt;br /&gt;
====STA====&lt;br /&gt;
* wmt_loader (ignore errors)&lt;br /&gt;
* stp_uart_launcher -p /etc/firmware &amp;amp;&lt;br /&gt;
* ip link set wlan0 up&lt;br /&gt;
* iw dev wlan0 scan | grep SSID&lt;br /&gt;
* vim /etc/wpasupplicant/wpa_supplicant.conf&lt;br /&gt;
 network={    &lt;br /&gt;
 ssid=&amp;quot;ssid&amp;quot;    &lt;br /&gt;
 psk=&amp;quot;password&amp;quot;    &lt;br /&gt;
 priority=1 &lt;br /&gt;
 }&lt;br /&gt;
* wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;
* dhclient wlan0&lt;br /&gt;
&lt;br /&gt;
====AP mode====&lt;br /&gt;
* wmt_loader (ignore errors)&lt;br /&gt;
* stp_uart_launcher -p /etc/firmware &amp;amp;&lt;br /&gt;
* echo A &amp;gt;/dev/wmtWifi&lt;br /&gt;
* create your hostapd.conf: &amp;quot;vim /etc/hostapd/hostapd.conf &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 interface=ap0&lt;br /&gt;
 bridge=br0&lt;br /&gt;
 ssid=test_r2&lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 country_code=US&lt;br /&gt;
 hw_mode=b&lt;br /&gt;
 channel=1&lt;br /&gt;
 max_num_sta=5&lt;br /&gt;
 wpa=2       &lt;br /&gt;
 auth_algs=1 &lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 wpa_passphrase=ledetest&lt;br /&gt;
 logger_stdout=-1&lt;br /&gt;
 logger_stdout_level=2&lt;br /&gt;
&lt;br /&gt;
* According to your network interface(can search internet) to config ap0:&lt;br /&gt;
  my network interface which can search internet is wan, and ip is 192.168.30.102, so I config ap0 as follows:&lt;br /&gt;
&lt;br /&gt;
“ifconfig ap0 192.168.30.188 netmask 255.255.255.0”&lt;br /&gt;
&lt;br /&gt;
* Run hostapd : “hostapd -d /etc/hostapd/hostapd.conf”&lt;br /&gt;
* Config dhcp file : “vim /etc/dhcp/dhcpd.conf”&lt;br /&gt;
&lt;br /&gt;
 subnet 192.168.30.0 netmask 255.255.255.0 {&lt;br /&gt;
 range 192.168.30.2 192.168.30.250;&lt;br /&gt;
 option domain-name-servers 8.8.8.8;&lt;br /&gt;
 option routers 192.168.30.1; }&lt;br /&gt;
&lt;br /&gt;
* Config dhcp of ap0, then the devices which connect ap0 could get IP: &amp;quot;dhcpd ap0 -pf /var/run/dhcpd.pid &amp;quot;&lt;br /&gt;
* And a bridge&lt;br /&gt;
* brctl addbr br0&lt;br /&gt;
* brctl addif br0 ap0&lt;br /&gt;
* brctl addif br wan&lt;br /&gt;
* Config br0 : “ifconfig br0 192.168.30.180 netmask 255.255.255.0”&lt;br /&gt;
* Add br0 gw as : “route add -net default netmask 255.255.255.0 gw 192.168.30.1 dev br0”&lt;br /&gt;
&lt;br /&gt;
====Ap Mode FAQ====&lt;br /&gt;
If you meet problem like this：&lt;br /&gt;
&lt;br /&gt;
[[Image:A64_ap_1.png]]&lt;br /&gt;
&lt;br /&gt;
Then, you could solve by following command： &lt;br /&gt;
* nmcli radio wifi off&lt;br /&gt;
[[Image:A64_ap_2.png]]&lt;br /&gt;
* rfkill unblock 1&lt;br /&gt;
* rfkill unblock 2&lt;br /&gt;
* ifconfig ap0 up&lt;br /&gt;
* hostapd -d  hostapd.conf&lt;br /&gt;
[[Image:A64_ap_3.png]]&lt;br /&gt;
&lt;br /&gt;
===WiFi and Ap mode on R2 Openwrt===&lt;br /&gt;
====AP mode====&lt;br /&gt;
1. Make a bash script&lt;br /&gt;
* vim setup.sh&lt;br /&gt;
 #!/bin/ash&lt;br /&gt;
 wmt_loader &amp;amp;&lt;br /&gt;
 sheep 3&lt;br /&gt;
 stp_uart_launcher -p /etc/firmware &amp;amp;&lt;br /&gt;
 sleep 5&lt;br /&gt;
 echo A &amp;gt; /dev/wmtWifi &amp;amp;&lt;br /&gt;
 sleep 5&lt;br /&gt;
 hostapd -d hostapd.conf&lt;br /&gt;
2. Create your hostapd.conf&lt;br /&gt;
* vim hostapd.conf&lt;br /&gt;
 interface=ap0&lt;br /&gt;
 bridge=br-lan&lt;br /&gt;
 ssid=BPI_R2&lt;br /&gt;
 driver=nl80211&lt;br /&gt;
 country_code=CN&lt;br /&gt;
 hw_mode=g&lt;br /&gt;
 channel=1&lt;br /&gt;
 max_num_sta=5&lt;br /&gt;
 wpa=2&lt;br /&gt;
 auth_algs=1&lt;br /&gt;
 rsn_pairwise=CCMP&lt;br /&gt;
 wpa_key_mgmt=WPA-PSK&lt;br /&gt;
 wpa_passphrase=ledetest&lt;br /&gt;
 logger_stdout=-1&lt;br /&gt;
 logger_stdout_level=2&lt;br /&gt;
&lt;br /&gt;
3. Make it run&lt;br /&gt;
* ./setup.sh&lt;br /&gt;
&lt;br /&gt;
4. Add it to starting progress&lt;br /&gt;
* vim /etc/rc.local&lt;br /&gt;
  cd /root/&lt;br /&gt;
  sleep 6&lt;br /&gt;
  ./setup.sh &amp;amp;&lt;br /&gt;
&lt;br /&gt;
5. If your Ap is not stable, please limit the speed, here I limit download speed as 8Mbit/s, upload as 4Mbit/s&lt;br /&gt;
* tc qdisc add dev ap0 root handle 1: htb default 11&lt;br /&gt;
* tc class add dev ap0 parent 1:1 classid 1:2 htb rate 8Mbit ceil 4Mbit prio 2&lt;br /&gt;
&lt;br /&gt;
===Make your own image===&lt;br /&gt;
* Prepare a SD card which have installed Ubuntu system&lt;br /&gt;
* Boot your SD card with R2, after R2 finish starting, copy your files and config your Ubuntu, then poweroff R2&lt;br /&gt;
* Plug your SD card in Linux PC, &amp;quot;cd /media&amp;quot;, then &amp;quot;ln -s &amp;lt;your account&amp;gt; pi&amp;quot;&lt;br /&gt;
* Execute &amp;quot;bpi-migrate -c bpi-r2.conf -c ubuntu-mate-from-sd.conf -d /dev/sdx&amp;quot;&lt;br /&gt;
* Then you could get your own image now&lt;br /&gt;
&lt;br /&gt;
==FAQ==&lt;br /&gt;
*1.Banana Pi BPI-R2 Razberry board OpenHab2 &lt;br /&gt;
::https://community.openhab.org/t/banana-pi-bpi-r2-razberry-board-openhab2-help/37222/8&lt;br /&gt;
&lt;br /&gt;
='''Reference Link'''=&lt;br /&gt;
&lt;br /&gt;
http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:start&lt;br /&gt;
&lt;br /&gt;
http://www.banana-pi.org/r2.html&lt;br /&gt;
&lt;br /&gt;
http://forum.banana-pi.org/&lt;/div&gt;</summary>
		<author><name>Symowl</name></author>	</entry>

	</feed>