It has been quite a while that my VOSM has NOT been updated. My bad for sure. But today, I have it updated, and VOSM-0.3.5 is released. Just refer to the following 3 pages on github:
To download videos from Youtube is sometimes required. Some Chrome plugins can be used to download Youtube videos, such as: Youtube Downloader. Other methods can also be found on various resources, such as: WikiHow.
In this blog, I’m going to cite (copy and paste) from WikiHow about How to download Youtube videos by using VLC.
STEP1: Copy Youtube URL
Find the Youtube video that you would like to download, and copy the Youtube URL.
STEP 2: Broadcast Youtube Video in VLC
Paste the URL under VLC Media Player->Media->Open Network Stream->Network Tab->Please enter a network URL:, and Play:
STEP 3: Get the Real Location of Youtube Video
Then, copy the URL under Tools->Codec Information->Codec->Location:
We can of course directly download the package from WeeChat Download, and have it installed from source. However, installing WeeChat from repository is recommended.
Finally, I’ve got some time to write something about PyTorch, a popular deep learning tool. We suppose you have had fundamental understanding of Anaconda Python, created Anaconda virtual environment (in my case, it’s named condaenv), and had PyTorch installed successfully under this Anaconda virtual environment condaenv.
Since I’m using Visual Studio Code to test my Python code (of course, you can use whichever coding tool you like), I suppose you’ve already had your own coding tool configured. Now, you are ready to go!
In my case, I’m giving a tutorial, instead of coding by myself. Therefore, Jupyter Notebook is selected as my presentation tool. So, I’ll demonstrate everything both in .py files, as well as .ipynb files. All codes can be found at Longer Vision PyTorch_Examples. However, ONLYJupyter Notebook presentation is given in my blogs. Therefore, I suppose you’ve already successfully installed Jupyter Notebook, as well as any other required packages under your Anaconda virtual environment condaenv.
The ONLY concept in CNN we want to emphasize here is Back Propagation, which has been widely used in traditional neural networks, which takes the solution similar to the final Fully Connected Layer of CNN. You are welcome to get some more details from https://brilliant.org/wiki/backpropagation/.
Pre-defined Variables
Training Database
$X={(\vec{x_1},\vec{y_1}),(\vec{x_2},\vec{y_2}),…,(\vec{x_N},\vec{y_N})}$: the training dataset $X$ is composed of $N$ pairs of training samples, where $(\vec{x_i},\vec{y_i}),1 \le i \le N$
$(\vec{x_i},\vec{y_i}),1 \le i \le N$: the $i$th training sample pair
$\vec{x_i}$: the $i$th input vector (can be an original image, can also be a vector of extracted features, etc.)
$\vec{y_i}$: the $i$th desired output vector (can be a one-hot vector, can also be a scalar, which is a 1-element vector)
$\hat{\vec{y_i} }$: the $i$th output vector from the nerual network by using the $i$th input vector $\vec{x_i}$
$N$: size of dataset, namely, how many training samples
$w_{ij}^k$: in the neural network’s architecture, at level $k$, the weight of the node connecting the $i$th input and the $j$th output
$\theta$: a generalized denotion for any parameter inside the neural networks, which can be looked on as any element from a set of $w_{ij}^k$.
Hi, today, I’m going to revisit a very old topic, Setup Repeater Bridge Using A dd-wrt Router. This reminds me of my FIRST startup Misc Vision that used to resell Foscam home security IP cameras. That is a long story. Anyway, this blog is going to heavily cite the contents on this page.
PART A: Flash A Supported Router with DD-WRT Firmware
Before we start to tackle the problem, the open source firmware DD-WRT is strongly recommended to flash your router.
1. DD-WRT and OpenWRT
Two widely used open source router firmware have been published online for quite a bit of time: DD-WRT, OpenWRT In fact, each of these two are OK for router firmware flashing.
2. DD-WRT Supported Routers
To check if your router is supported by DD-WRT, you need to check this page.
3. DD-WRT SL-R7202
In my case, I got a lot of such routers in hand and am selling them on Craigslist (if anybody is interested in it, please let me know). You can also find some either continued or discontinued such products on the market, such as Gearbest.
DD-WRT SL-R7202 looks good:
In one word, find some DD-WRT supported router, and have it successfully flashed FIRST. As a lazy man, I’m NOT going to flash anything but just use a router coming with an existing DD-WRT firmware, namely, DD-WRT SL-R7202.
PART B: The Problem
The problem that we are going to deal with is how to connect multiple routers, so that the Internet range can be expanded. For routers with dd-wrt firmware, there are mulitple ways to connect routers, please refer to https://www.dd-wrt.com/wiki/index.php/Linking_Routers.
1. Linking Routers
In the following, most contents are CITED directly from Linking Routers and its extended webpages.
Access Point / Switch - Extend the Wireless access area using more routers, with WIRED connections between routers, or turn a WIRED port on an existing network into a Wireless Access Point. All computers will be on the same network segment, and will be able to see one another in Windows Network. This works with all devices with LAN ports, and does not require dd-wrt to be installed. “
Wireless Access Point - Extend Wi-Fi & LAN (Requires physical(just WIRED) ethernet connection between routers)
Switch - Similar config as WAP, but radio disabled (accepts only WIRED connections)
Repeater / Repeater Bridge - Extend the Wireless access area using a second router WIRELESSLY connected to the primary. The secondary router must have dd-wrt installed; the primary does not need dd-wrt.
Repeater Bridge - A wireless repeater with DHCP & NAT disabled, clients on same subnet as host AP (primary router). That is, all computers can see one another in Windows Network.
Repeater - A wireless repeater with DHCP & NAT enabled, clients on different subnet from host AP (primary router). Computers connected to one router can not see computers connected to other routers in Windows Network.
Universal Wireless Repeater - Uses a program/script called AutoAP to keep a connection to the nearest/best host AP.
Client / Client Bridge - Connect two wired networks using a WiFi link (WIRELESS connection between two routers). The secondary router must have dd-wrt installed; the primary router does not need to have dd-wrt.
Client Bridged - Join two wired networks by two Wireless routers building a bridge. All computers can see one another in Windows Network.
Client Mode - Join two wired networks by two Wireless routers (unbridged). Computers on one wired network can not see computers on other wired network in Windows Network.
WDS - Extend the Wireless access area using more routers connected WIRELESSLY. WDS is a mesh network. Routers must almost always have the SAME chipset type for WDS to work, and any non dd-wrt routers must be WDS compatible. Using identical routers is best, but not always necessary if all devices have the same chipset types. (All Broadcom or all Atheros etc)
OLSR - Extend the Wireless access area using more routers. Extra routers do not need any wired connections to each other. Use several ISP (Internet) connections. OLSR is a mesh network.
In my case, my laptop and some of my IoT devices can be easily connected to the ShawCable Modem/Router combo, which is on the 2nd floor in my living room and directly connected to the Internet. However, my R&D office is located in my garage on the 1st floor, where dd-wrt router is put in. In such a case, my dd-wrt router must be connected to my ShawCable Modem/Router WIRELESSLY.
Due to the reason explained in the section Difference between Client Bridge and Repeater Bridge. A standard wireless bridge (Client Bridge) connects wired clients to a secondary router as if they were connected to your main router with a cable. Secondary clients share the bandwidth of a wireless connection back to your main router. Of course, you can still connect clients to your main router using either a cable connection or a wireless connection.
The limitation with standard bridging is that it only allows WIRED clients to connect to your secondary router. WIRELESS clients cannot connect to your secondary router configured as a standard bridge. Repeater Bridge allows both WIRELESS AND WIRED clients to connect to a the Repeater Bridge router, and through that device WIRELESSLY to a primary router. You can still use this mode if you only need to bridge wired clients; the extra wireless repeater capability comes along for free; however, you are not required to use it.
Therefore, we select Repeater Bridge as our solution. Here, DD-WRT SL-R7202 is selected as the Repeater Bridge. The difficulty is how to setup DD-WRT SL-R7202 to make it work as a wireless Repeater Bridge?
PART C: About Firmware (Optional)
1. Do We Need Firmware Upgrading?
Actually, before I come to this step, I’ve already:
and afterwards, I found a video solution at https://www.youtube.com/watch?v=ByB8vVGBjh4, which seems to be suitable for my case. However, it finally turns out that my DD-WRT SL-R7202 router comes with a firmware version DD-WRT (build 13064), but the tutorial on Youtube uses a router with firmware version DD-WRT (build 21061).
It seems to me that a firmware upgrading is a must before we setup the Wireless Repeater Bridge Mode. But, How?
2. Reset to Factory Defaults on DD-WRT Router (The 2nd Router)
First of all, we need to reset DD-WRT. There is a black button on my DD-WRT SL-R7202, as shown:
In fact, how to reset DD-WRT needs to be paid attention to. > Hold the reset button until lights flash (10-30sec) or 30-30-30 if appropriate for your router. (DO NOT 30-30-30 ARM routers.)
After successfully reset DD-WRT router to factory default, connect it with your host computer via a WIRED cable, for better stablity. Then, we change our network connection from our FIRST router to SECOND router: dd-wrt router. Afterwards, let’s visit http://192.168.1.1.
NOTE: My host computer’s IP address on the FIRST router, namely, ShawCable Modem/Router is staticly set as 192.168.0.8 (which is able to connect to the Internet). After I switch to the Wifi dd-wrt, my host’s IP is DHCP allocated to 192.168.1.103. The gateway on ShawCable is 192.168.0.1, which is different from the gateway on dd-wrt 192.168.1.1 by default.
1) FIRST Page
DD-WRT home page looks like:
And it’s suggested we input a new router username root and password admin. After the button Change Password is clicked, we are entering the very first page of DD-WRT Web GUI.
We can easily tell the firmware’s info on the top right corner.
1 2 3
Firmware: DD-WRT v24-sp2 (10/10/09) std Time: 00:01:13 up 1 min, load average: 0.12, 0.04, 0.00 WAN IP: 0.0.0.0
And, we can also easily tell from the bottom of this page that for now, only 1 DHCP client is connected to this router, which is just our host computer: jiapei-GT72-6QE.
2) System Info on Status Page
DD-WRT Status page tells a lot about what’s in this router:
Clearly, our router model is Buffalo WHR-G300N, and our firmware build version is 13064.
Clearly, we should be able to upgrade from our current firmware version 13064 to the newer one 14896.
With the existing firmware version 13064 installed on the router SL-R7202, we can directly upgrade the firmware through web flash by downloading the firmware WHR-G300N-webflash.bin, but ignoring downloading all TFTP and openvpn files.
4) Firmware Upgrading
Just click Administration -> Firmware Upgrade, and then choose WHR-G300N-webflash.bin.
After clicking Choose file, the system is automatically upgraded after several minutes.
NOTE: Do NOT touch anything during the upgrading process.
After firmware upgrading, we can easily tell some difference: From Setup Page, on the left-top corner, we can see the builder version is now 14896. And from the right-top corner, the current firmware info is:
1 2 3
Firmware: DD-WRT v24-sp2 (08/07/10) std Time: 00:08:20 up 8 min, load average: 0.00, 0.02, 0.00 WAN IP: 0.0.0.0
From the Status Page, we can doublecheck the firmware version is now 14896.
Wireless Network Mode: Must Be Exactly The Same As Primary Router
Wireless Network Name (SSID): Must Be Exactly The Same As Primary Router. Be Careful: DD-WRT is ONLY a 2.4G router. If your primary router has two bands, namely, 2.4G and 5G, make sure you connect to the 2.4G network.
Wireless Channel: Must Be Exactly The Same As Primary Router
Channel Width: Must Be Exactly The Same As Primary Router
Wireless SSID Broadcast: Enabled
Network Configuration: Bridged
Then, click Save without Apply, we get:
2. Wireless -> Wireless Security
Physical Interface section
Security Mode: Must Be WPA2 Personal, and The Primary Router Must Be Exactly The Same.
WPA Algorithms: Must Be AES, and The Primary Router Must Be Exactly The Same.
WPA Shared Key: Must Be Exactly The Same As Primary Router
Key Renewal Interval (in seconds): Leave as it is, normally, 3600.
Then, click Save without Apply, we get:
3. Setup -> Basic Setup
WAN Connection Type Section
Connection Type: Disabled
STP: Disabled
Optional Settings
Router Name: DD-WRT, just let it be
Router IP
IP Address: 192.168.0.2 (in my case, my Primary Router IP is 192.168.0.1, and 192.168.0.2 has NOT been used yet.)
Subnet Mask: 255.255.255.0
Gateway: 192.168.0.1 (Must Be Primary Router IP)
Local DNS: 192.168.0.1 (Must Be Primary Router IP)
Most of the time, in order to get the fastest Internet speed, I use Primary Router 1’s 5G network. Therefore, for my final demonstration, my PC is wirelessly connected to the 5G network. And, I can successfully visit http://192.168.0.1 and http://192.168.0.2.
Similar to our previous blog Install Armbian Debian Server onto NanoPi NEO, to build the Mainline Linux for Orange Pi Plus 2, we use the Embedded Linux management open source Armbian. However, this time, we’ll have the most recently supported Linux Kernel updated finally.
PART A: Install Ubuntu Desktop Built By Armbian onto Orange Pi Plus 2
1. Download Armbian Ubuntu Desktop for Orange Pi Plus 2
We FIRST go visiting the website https://www.armbian.com/orange-pi-plus-2/ and click Ubuntu desktop - legacy kernel icon, a file named Armbian_5.38_Orangepiplus_Ubuntu_xenial_default_3.4.113_desktop.7z will be automatically downloaded.
Then, we extract this .7z file by
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
$ 7z x Armbian_5.38_Orangepiplus_Ubuntu_xenial_default_3.4.113_desktop.7z
7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=en_CA.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
2. Install Armbian Ubuntu Desktop for Orange Pi Plus 2
After the extracted image file is prepared, it’s the time to install the Armbian Ubuntu Desktop onto our TF card. We FIRST format the TF card:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
$ sudo mkfs.ext4 /dev/mmcblk0 [sudo] password for jiapei: mke2fs 1.42.13 (17-May-2015) Found a dos partition table in /dev/mmcblk0 Proceed anyway? (y,n) y Discarding device blocks: done Creating filesystem with 7791744 4k blocks and 1949696 inodes Filesystem UUID: 8873533f-4a66-4e8c-8633-844eaa90116d Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000
Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
Afterwards, use dd to install the downloaded Armbian Ubuntu Desktop image.
1 2 3 4 5
$ sudo dd bs=4M if=Armbian_5.38_Orangepiplus_Ubuntu_xenial_default_3.4.113_desktop.img of=/dev/mmcblk0 conv=fsync [sudo] password for jiapei: 730+0 records in 730+0 records out 3061841920 bytes (3.1 GB, 2.9 GiB) copied, 381.133 s, 8.0 MB/s
3. Boot Into Orange Pi Plus 2
We now unplug the TF card from the host and put it into the Orange Pi Plus 2 board, Armbian Ubuntu Desktop boots successfully. Make sure the username and password are respectively: root and 1234. And you will notice that
1 2 3 4 5 6
You are required to change your password immediately (root enforced) Changing password for root. (current) UNIX password: Enter new UNIX password: Retype new UNIX password: ...
And, for the FIRST boot, we’ll be asked to create a NEW user besides root:
Creating a new user account. Press <Ctrl-C> to abort Desktop enironment will not be enabled if you abort the new user creation
Please provide a username (eg. your forename): orangepiplus2 Trying to add user orangepiplus2 Adding user 'orangepiplus2' ... Adding new group 'orangepiplus2' (1000) ... Adding new user 'orangepiplus2' (1000) with group 'orangepiplus2' ... Creating home directory '/home/orangepiplus2' ... Copying files from '/etc/ske1' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for orangepiplus2 Eter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] Y ...
We are now able to see the kernel version is of 3.4.113, which is a very old Linux Kernel.
We then update/upgrade all upgradable packages, and have the system rebooted.
After finishing the upgrading, Ubuntu has successfully upgraded from 16.04.3 to 16.04.4, but Linux Kernel is still of version 3.4.113.
PART B: Build The Newest Armbian U-Boot and Linux Kernel for Orange Pi Plus 2
As shown in PART A, the current Linux Kernel on our Orange Pi Plus 2 is of an old version 3.4.113. Are we able to upgrade the Linux Kernel to the most recent one? The ANSWER is of course YES.
We now try to compile Armbian for our very FIRST attempt. This will help us to download a lot required packages, including all Linaro toolchains, U-Boot, etc., and save those packages under folder cache,
$ cd ./armbian $ ./compile.sh [ o.k. ] Using config file [ config-default.conf ] [ warn ] This script requires root privileges, trying to use sudo [sudo] password for jiapei: [ o.k. ] Using config file [ config-default.conf ] [ o.k. ] This script will try to update Permission denied (publickey). fatal: Could not read from remote repository.
Then, a canonical GUI will jump out onto the screen for you to make selections:
Clearly, our board Orange Pi Plus 2 is NOT in the list. Therefore, we select Cancel here for now, and some ERROR messages will be generated as follows.
1 2 3
[ error ] ERROR infunctionsource [ main.sh:198 ] [ error ] No kernel branch selected [ o.k. ] Process terminated
$ cd ../../ $ ./compile.sh BOARD="orangepiplus2" BRANCH="next" KERNEL_ONLY="yes" KERNEL_CONFIGURE="no" [ o.k. ] Using config file [ config-default.conf ] [ warn ] This script requires root privileges, trying to use sudo [sudo] password for jiapei: [ o.k. ] Using config file [ config-default.conf ] [ o.k. ] This script will try to update Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists. Already on 'master' Your branch is up-to-date with 'origin/master'. [ o.k. ] Command line: setting BOARD to [ orangepiplus2 ] [ o.k. ] Command line: setting BRANCH to [ next ] [ o.k. ] Command line: setting KERNEL_ONLY to [ no ] [ o.k. ] Command line: setting KERNEL_CONFIGURE to [ no ] [ o.k. ] Preparing [ host ] [ o.k. ] Build host OS release [ xenial ] [ o.k. ] Syncing clock [ host ]
Again, the canonical GUI will jump out onto the screen for you to make selections, here we select Ubuntu Xenial 16.04 LTS and Image with console interface (server) respectively.
We end up with ERROR messages again. Clearly, it’s because U-Boot does NOT support orangepi_plus2_defconfig. Therefore, we do the same to U-Boot board configuration by two steps:
$ cat orangepi_plus2_defconfig CONFIG_ARM=y CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN8I_H3=y CONFIG_DRAM_CLK=624 CONFIG_DRAM_ZQ=3881979 CONFIG_DRAM_ODT_EN=y CONFIG_MACPWR="PD6" CONFIG_MMC_SUNXI_SLOT_EXTRA=2 CONFIG_DEFAULT_DEVICE_TREE="sun8i-h3-orangepi-plus2" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL=y CONFIG_SPL_I2C_SUPPORT=y # CONFIG_CMD_FLASH is not set # CONFIG_CMD_FPGA is not set # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_SPL_ISO_PARTITION is not set # CONFIG_SPL_EFI_PARTITION is not set CONFIG_SUN8I_EMAC=y CONFIG_SY8106A_POWER=y CONFIG_USB_EHCI_HCD=y CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
2) STEP 2:
1 2 3 4 5 6 7 8 9 10
$ cd ./cache/sources/u-boot/v2017.11/arch/arm/dts $ ls -1 *sun8i-h3-orangepi* sun8i-h3-orangepi-2.dts sun8i-h3-orangepi-lite.dts sun8i-h3-orangepi-one.dts sun8i-h3-orangepi-pc.dts sun8i-h3-orangepi-pc-plus.dts sun8i-h3-orangepi-plus2e.dts sun8i-h3-orangepi-plus.dts sun8i-h3-orangepi-zeroplus2.dts
Clearly, sun8i-h3-orangepi-plus2.dts is NOT in the list. Therefore, we do:
1 2
$ sudo cp sun8i-h3-orangepi-plus2e.dts sun8i-h3-orangepi-plus2.dts $ sudo vim sun8i-h3-orangepi-plus2.dts
$ cat sun8i-h3-orangepi-plus2.dts ...... // ignore /* * The Orange Pi Plus 2 is an extended version of the Orange Pi PC Plus 2, * with 2G RAM and an external gbit ethernet phy. */
#include "sun8i-h3-orangepi-pc-plus.dts"
/ { model = "Xunlong Orange Pi Plus 2"; compatible = "xunlong,orangepi-plus2", "allwinner,sun8i-h3";
$ ./compile.sh BOARD="orangepiplus2" BRANCH="next" KERNEL_ONLY="yes" KERNEL_CONFIGURE="no" [ o.k. ] Using config file [ config-default.conf ] [ warn ] This script requires root privileges, trying to use sudo [ o.k. ] Using config file [ config-default.conf ] [ o.k. ] This script will try to update Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists. Already on 'master' Your branch is up-to-date with 'origin/master'. [ o.k. ] Command line: setting BOARD to [ orangepiplus2 ] [ o.k. ] Command line: setting BRANCH to [ next ] [ o.k. ] Command line: setting KERNEL_ONLY to [ yes ] [ o.k. ] Command line: setting KERNEL_CONFIGURE to [ no ] [ o.k. ] Preparing [ host ] [ o.k. ] Build host OS release [ xenial ] [ o.k. ] Syncing clock [ host ] [ o.k. ] Downloading sources [ o.k. ] Checking git sources [ u-boot v2017.11 ] [ .... ] Checking out [ o.k. ] Checking git sources [ linux-mainline linux-4.14.y ] [ .... ] Up to date [ o.k. ] Checking git sources [ sunxi-tools master ] [ .... ] Up to date [ o.k. ] Checking git sources [ rkbin-tools master ] [ .... ] Up to date [ o.k. ] Checking git sources [ marvell-tools A3700_utils-armada-17.10 ] [ .... ] Up to date [ o.k. ] Checking git sources [ odroidc2-blobs master ] [ .... ] Up to date [ o.k. ] Cleaning output/debs for [ orangepiplus2 next ] [ o.k. ] Cleaning [ u-boot/v2017.11 ] [ o.k. ] Compiling u-boot [ 2017.11 ] [ o.k. ] Compiler version [ arm-linux-gnueabihf-gcc 7.2.1 ] [ .... ] Checking out sources [ o.k. ] Cleaning [ u-boot/v2017.11 ] [ o.k. ] Started patching process for [ u-boot sunxi-orangepiplus2-next ] [ o.k. ] Looking for user patches in [ userpatches/u-boot/u-boot-sunxi ] [ o.k. ] * [l][c] 0020-sunxi-call-fdt_fixup_ethernet-again-to-set-macaddr-f.patch [ o.k. ] * [l][c] 4kfix-limit-screen-to-full-hd.patch [ o.k. ] * [l][c] Add-A20-Olimex-SOM204-EVB-board.patch [ o.k. ] * [l][c] add-a20-olinuxino-micro-emmc-support.patch [ o.k. ] * [l][c] add-a20-optional-eMMC.patch [ o.k. ] * [l][c] add-bananapi-bpi-m2-zero.patch [ o.k. ] * [l][c] add-beelink-x2.patch [ o.k. ] * [l][c] add-nanopi-air-emmc.patch [ o.k. ] * [l][c] add-nanopi-duo.patch [ o.k. ] * [l][c] add-nanopi-m1-plus2-emmc.patch [ o.k. ] * [l][c] add-nanopineoplus2.patch [ o.k. ] * [l][c] add-orangepi-plus2-emmc.patch [ o.k. ] * [l][c] add-orangepi-zeroplus.patch [ o.k. ] * [l][c] add-orangepi-zeroplus2_h3.patch [ o.k. ] * [l][c] add-sunvell-r69.patch [ o.k. ] * [l][c] add-tritium.patch [ o.k. ] * [l][c] add_emmc_olinuxino_a64.patch [ o.k. ] * [l][c] add_emmc_orangepiwin.patch [ o.k. ] * [l][c] adjust-default-dram-clockspeeds.patch [ o.k. ] * [l][c] adjust-small-boards-cpufreq.patch [ o.k. ] * [l][c] enable-DT-overlays-support.patch [ o.k. ] * [l][c] enable-autoboot-keyed.patch [ o.k. ] * [l][c] fdt-setprop-fix-unaligned-access.patch [ o.k. ] * [l][c] fix-sdcard-detect-bpi-m2z.patch [ o.k. ] * [l][c] fix-sunxi-gpio-driver.patch [ o.k. ] * [l][c] fix-usb1-vbus-opiwin.patch [ o.k. ] * [l][c] h3-Fix-PLL1-setup-to-never-use-dividers.patch [ o.k. ] * [l][c] h3-enable-power-led.patch [ o.k. ] * [l][c] h3-set-safe-axi_apb-clock-dividers.patch [ o.k. ] * [l][c] lower-default-DRAM-freq-A64-H5.patch [ o.k. ] * [l][c] lower-default-cpufreq-H5.patch [ o.k. ] * [l][c] sun8i-set-machid.patch [ o.k. ] * [l][c] video-fix-vsync-polarity-bits.patch [ o.k. ] * [l][b] workaround-reboot-is-poweroff-olimex-a20.patch HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config # scripts/kconfig/conf --silentoldconfig Kconfig .config:1120:warning: override: reassigning to symbol BOOTDELAY # # configuration written to .config # CHK include/config.h UPD include/config.h GEN include/autoconf.mk.dep CFG u-boot.cfg CFG spl/u-boot.cfg GEN include/autoconf.mk GEN spl/include/autoconf.mk CHK include/config/uboot.release CHK include/generated/timestamp_autogenerated.h UPD include/generated/timestamp_autogenerated.h UPD include/config/uboot.release CHK include/generated/version_autogenerated.h HOSTCC scripts/dtc/dtc.o ......
And, it took me about 5 minutes to have everything built.
...... patching file tools/include/tools/be_byteshift.h patching file tools/include/tools/le_byteshift.h CLEAN scripts/basic CLEAN scripts/dtc CLEAN scripts/kconfig CLEAN scripts/mod CLEAN scripts/selinux/genheaders CLEAN scripts/selinux/mdp CLEAN scripts dpkg-deb: building package 'linux-dtb-next-sunxi'in'../linux-dtb-next-sunxi_5.41_armhf.deb'. dpkg-deb: building package 'linux-headers-next-sunxi'in'../linux-headers-next-sunxi_5.41_armhf.deb'. dpkg-deb: building package 'linux-image-next-sunxi'in'../linux-image-next-sunxi_5.41_armhf.deb'. dpkg-genchanges: warning: package linux-libc-dev-next-sunxi in control file but not in files list dpkg-genchanges: binary-only upload (no source code included) dpkg-deb: building package 'linux-source-4.14.22-next-sunxi'in'/home/jiapei/Downloads/OperatingSystems/linux/distros/armbian/armbian/.tmp/linux-source-next-sunxi_5.41_all.deb'. [ o.k. ] Kernel build done [ @host ] [ o.k. ] Target directory [ /home/jiapei/Downloads/OperatingSystems/linux/distros/armbian/armbian/output/debs/ ] [ o.k. ] File name [ linux-image-next-sunxi_5.41_armhf.deb ] [ o.k. ] Runtime [ 5 min ]
PART C: Copy Linux Kernel DEBs for Orange Pi Plus 2
1. Doublecheck Built Linux Kernel Related DEBs
1 2 3 4 5 6 7 8 9
$ cd ./output/debs $ ls -1 * linux-dtb-next-sunxi_5.41_armhf.deb linux-headers-next-sunxi_5.41_armhf.deb linux-image-next-sunxi_5.41_armhf.deb linux-source-next-sunxi_5.41_all.deb linux-u-boot-next-orangepiplus2_5.41_armhf.deb
extra:
Five .deb files have been successfully generated, and the folder extra is empty.
2. Copy Built DEBs onto TF Card
Since Armbian Ubuntu Desktop has already been installed on our TF card, after plugging TF card back to my host computer again, it’s automatically mounted as /media/jiapei/ab9545b9-0d2d-4927-83f3-fae97ced83a9. Then, we copy all five .deb files onto TF card by:
PART D: Install the Built DEBs, Remove the Old Kernel(s), and Wifi Configuration
Now we plug the TF card back into the Orange Pi Plus 2 board and boot into Armbian Ubuntu Desktop with kernel 3.4.113.
1. Install NEW Linux Kernels
Single command will do.
1
$ sudo dpkg -i *.deb
It’s OK for us NOT to upgrade u-boot.
2. Remove OLD Linux Kernel(s)
Reboot Orange Pi Plus 2 board, and you’ll see the NEW kernel 4.14.22 is now booted successfully. Now, it’s optional for us to remove old kernel(s) 3.4.113. Two commands will do.
1
dpkg --list | grep linux-image
will help to list all installed Linux Kernel. And then, we remove all unwanted kernels, for instance:
1
dpkg --purge linux-image-sun8i
3. Wifi Configuration
As known, Orange Pi Plus 2 board comes with Wifi 2.4G support. To enable Wifi for Orange Pi Plus 2 board, we need to make sure there are ONLY 3 effective lines in file /etc/network/interfaces:
1 2 3
source /etc/network/interfaces.d/* auto lo iface lo inet loopback
Finally, you are recommended to solve all the other issues about Ubuntu Desktop via Google.
Hi, all, I flied back and forth between ShenZhen China and Vancouver Canada in January 2018, and took a holiday break in California USA during Chinese Spring Festival in Febrary 2018. Now, I’m back to Vancouver and write this blog. Today, we are going to talk about how to flash the most recent Linux Kernel onto an NanoPi NEO. The board looks like (cited from NanoPi NEO ):
Before starting, the following paragraph is cited to explain the relationships among AllWinner, Sunxi and Linaro.
In march 2014, Allwinner joined Linaro as part of the new linaro digital home group. After this, Allwinner stopped communicating with the sunxi community, as linaro membership apparently satisfies the marketing need to be seen as an open source friendly company. Despite Linaro membership, Allwinner still violates the GPL on many counts. (cited from http://linux-sunxi.org/Allwinner .)
PART A: Install Debian Server Built By Armbian onto NanoPi NEO
1. Download Armbian Debian Server for NanoPi NEO
We FIRST go visiting the website https://www.armbian.com/nanopi-neo/ and click Debian server – mainline kernel icon, a file named Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14.7z will be automatically downloaded.
Then, we extract this .7z file by
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
$ 7za e Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14.7z
7-Zip (A) [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=en_CA.UTF-8,Utf16=on,HugeFiles=on,8 CPUs)
Afterwards, use dd to install the downloaded Armbian Ubuntu Desktop image.
1 2 3 4 5
$ sudo dd bs=4M if=Armbian_5.38_Nanopineo_Debian_stretch_next_4.14.14.img of=/dev/mmcblk0 conv=fsync [sudo] password for jiapei: 333+0 records in 333+0 records out 1396703232 bytes (1.4 GB, 1.3 GiB) copied, 157.712 s, 8.9 MB/s
PART B: Boot Into Armbian, Network Configuration and Armbian Upgrading
As known, NanoPi NEO comes with NEITHER a HDMI interface for display, NOR a Wifi interface for wireless network connection. Therefore, we may have to find a wired cable, and connect our NanoPi NEO to a router, which also connects with our host computer. Afterwards, we’ll have to find our NanoPi NEO connection via router settings. Here in my case, I’m using a Cisco DPC3848V DOCSIS 3.0 Gateway, with the gateway IP: 192.168.0.1. By visiting http://192.168.0.1 -> Setup -> LAN Setup -> Connected Devices Summary, you should be able to find out which is the newly connected network device, namely NanoPi NEO.
$ ssh root@192.168.0.76 The authenticity of host '192.168.0.76 (192.168.0.76)' can't be established. ECDSA key fingerprint is SHA256:L0qZCYEGGallJo9jSpM63TWAYJ4vU/JzIbMJS80Lx8I. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.0.76' (ECDSA) to the list of known hosts. root@192.168.0.76's password:
Then you input 1234 as the password, you’ll be asked to change your password right away.
Creating a new user account. Press <Ctrl-C> to abort
Please provide a username (eg. your forename): nanopineo Trying to add user nanopineo perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US.UTF-8", LC_ALL = (unset), LC_MEASUREMENT = "en_CA.UTF-8", LC_PAPER = "en_CA.UTF-8", LC_MONETARY = "en_CA.UTF-8", LC_NAME = "en_CA.UTF-8", LC_ADDRESS = "en_CA.UTF-8", LC_NUMERIC = "en_CA.UTF-8", LC_MESSAGES = "en_US.UTF-8", LC_TELEPHONE = "en_CA.UTF-8", LC_IDENTIFICATION = "en_CA.UTF-8", LC_TIME = "en_CA.UTF-8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_US.UTF-8"). Adding user `nanopineo' ... Adding new group `nanopineo' (1000) ... Adding new user `nanopineo' (1000) with group `nanopineo' ... Creating home directory `/home/nanopineo' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for nanopineo Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] Y
Dear nanopineo, your account nanopineo has been created and is sudo enabled. Please use this account for your daily work from now on.
I noticed that when you reboot NanoPi NEO, the IP address changed from time to time. The reason why it is so is because the MAC address of NanoPi NEO change randomly after Armbian reboot. Therefore, it’s recommended to manually set a static MAC address for NanoPi NEO in file /etc/network/interfaces.
1
root@nanopineo:~# vim /etc/network/interfaces
Just make sure to uncomment this line hwaddress ether # if you want to set MAC manually and write in a fixed MAC address. The final /etc/network/interfaces for my NanoPi NEO is as follows:
# Wired adapter #1 allow-hotplug eth0 no-auto-down eth0 iface eth0 inet dhcp #address 192.168.0.100 #netmask 255.255.255.0 #gateway 192.168.0.1 #dns-nameservers 8.8.8.8 8.8.4.4 hwaddress ether d2:d0:78:47:06:b3 # if you want to set MAC manually # pre-up /sbin/ifconfig eth0 mtu 3838 # setting MTU for DHCP, static just: mtu 3838
# Wireless adapter #1 # Armbian ships with network-manager installed by default. To save you time # and hassles consider using 'sudo nmtui' instead of configuring Wi-Fi settings # manually. The below lines are only meant as an example how configuration could # be done in an anachronistic way: # #allow-hotplug wlan0 #iface wlan0 inet dhcp #address 192.168.0.100 #netmask 255.255.255.0 #gateway 192.168.0.1 #dns-nameservers 8.8.8.8 8.8.4.4 # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf # Disable power saving on compatible chipsets (prevents SSH/connection dropouts over WiFi) #wireless-mode Managed #wireless-power off
# Local loopback auto lo iface lo inet loopback
And before reboot Armbian, we also need to set a **FIXED** IP address (Here in my case: 192.168.0.36) for the device with the static MAC address you just specified (Here in my case: **d2:d0:78:47:06:b3**).
## 3. Reboot Armbian
Now, reboot Armbian.
```console root@nanopineo:~# sudo reboot
After a while, ssh into Armbian with created user nanopineo:
We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility.
[sudo] password for nanopineo: Hit:1 http://security.debian.org stretch/updates InRelease Hit:4 http://apt.armbian.com stretch InRelease Ign:2 http://cdn-fastly.deb.debian.org/debian stretch InRelease Hit:3 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease Hit:5 http://cdn-fastly.deb.debian.org/debian stretch-backports InRelease Hit:6 http://cdn-fastly.deb.debian.org/debian stretch Release Reading package lists... Done Building dependency tree Reading state information... Done 3 packages can be upgraded. Run 'apt list --upgradable' to see them. nanopineo@nanopineo:~$ apt list --upgradable Listing... Done linux-dtb-next-sunxi/stretch 5.41 armhf [upgradable from: 5.38] linux-image-next-sunxi/stretch 5.41 armhf [upgradable from: 5.38] tzdata/stable-updates 2018c-0+deb9u1 all [upgradable from: 2017c-0+deb9u1] nanopineo@nanopineo:~$ sudo apt upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages will be upgraded: linux-dtb-next-sunxi linux-image-next-sunxi tzdata 3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 20.2 MB of archives. After this operation, 240 kB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://cdn-fastly.deb.debian.org/debian stretch-updates/main armhf tzdata all 2018c-0+deb9u1 [264 kB] Get:2 http://apt.armbian.com stretch/main armhf linux-dtb-next-sunxi armhf 5.41 [175 kB] Get:3 http://apt.armbian.com stretch/main armhf linux-image-next-sunxi armhf 5.41 [19.7 MB] Fetched 20.2 MB in 14s (1387 kB/s) perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US.UTF-8", LC_ALL = (unset), LC_TIME = "en_CA.UTF-8", LC_MONETARY = "en_CA.UTF-8", LC_ADDRESS = "en_CA.UTF-8", LC_TELEPHONE = "en_CA.UTF-8", LC_MESSAGES = "en_US.UTF-8", LC_NAME = "en_CA.UTF-8", LC_MEASUREMENT = "en_CA.UTF-8", LC_IDENTIFICATION = "en_CA.UTF-8", LC_NUMERIC = "en_CA.UTF-8", LC_PAPER = "en_CA.UTF-8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_US.UTF-8"). locale: Cannot set LC_ALL to default locale: No such file or directory Preconfiguring packages ... (Reading database ... 32833 files and directories currently installed.) Preparing to unpack .../tzdata_2018c-0+deb9u1_all.deb ... Unpacking tzdata (2018c-0+deb9u1) over (2017c-0+deb9u1) ... Preparing to unpack .../linux-dtb-next-sunxi_5.41_armhf.deb ... Unpacking linux-dtb-next-sunxi (5.41) over (5.38) ... Preparing to unpack .../linux-image-next-sunxi_5.41_armhf.deb ... update-initramfs: Deleting /boot/initrd.img-4.14.14-sunxi Removing obsolete file uInitrd-4.14.14-sunxi Unpacking linux-image-next-sunxi (5.41) over (5.38) ... Setting up linux-dtb-next-sunxi (5.41) ... Setting up tzdata (2018c-0+deb9u1) ... locale: Cannot set LC_ALL to default locale: No such file or directory
Current default time zone: 'Etc/UTC' Local time is now: Thu Mar 1 06:34:05 UTC 2018. Universal Time is now: Thu Mar 1 06:34:05 UTC 2018. Run 'dpkg-reconfigure tzdata'if you wish to change it.
Setting up linux-image-next-sunxi (5.41) ... update-initramfs: Generating /boot/initrd.img-4.14.18-sunxi update-initramfs: Converting to u-boot format nanopineo@nanopineo:~$
5. Kernel Doublechecking
Finally, we have the system and kernel doublechecked.
1 2 3 4 5 6 7 8 9 10 11
nanopineo@nanopineo:~$ uname -r 4.14.14-sunxi nanopineo@nanopineo:~$ uname -a Linux nanopineo 4.14.14-sunxi #1 SMP Thu Jan 25 12:20:57 CET 2018 armv7l GNU/Linux nanopineo@nanopineo:~$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.3 (stretch) Release: 9.3 Codename: stretch nanopineo@nanopineo:~$
Happy new year everybody. How time flies. It is already 2018. Longer Vision has been struggling on this tough road towards a successful enterprise. Algorithms ONLY are NOT enough for nowadays business. BSP (board support package) and IC design are a must for a successful business nowadays. Thus, ever since 2018, Longer Vision is going to balance both hardware and software, particularly, ARM based open source embedded development board and computer vision algorithms.
Linaro is a popular platform providing high-quality code for both Linux kernel and GCC tool chain. Linaro’s GCC toolchain of varoius versions can be directly found here.
$ ${CC}gcc --version arm-linux-gnueabihf-gcc (Linaro GCC 6.4-2017.11) 6.4.1 20171012 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the sourcefor copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Their differences are: - bb-kernel: based on mainline, no-smp, optimized for AM335x devices. - ti-linux-kernel-dev: based on TI’s git tree, smp, optimized for AM335x/AM43xx/AM57x devices.
A file named system.sh.sample has been provided for us to configure accordingly. We FIRST do a copy.
1
$ cp system.sh.sample system.sh
Then, we manually re-specifying two MACROs: CC and LINUX_GIT, respectively to two directories containing the above downloaded Linaro GCC compiler and the current Torvalds’ Linux Kernel. We also specify MMC for TF/SD Card as follows:
After the above configurations, we start building the Linux Kernel using the following command line. This will probably take you one hour.
1
$ ./build_kernel.sh
When you see this Kernel Configuration page,
Exit right away without any modification. And you will see:
After a while, you will see Linux Kernel has been successfully built:
4. Root File System
We then install the latest Debian (for now, Debian 9.3) according to Robert Nelson’s minimal operating system. Three commands are to be executed in a row for downloading, verifying, and extraction.
We FIRST make sure which version of sfdisk is. In my case, it is of version 2.27.1
1 2
$ sudo sfdisk --version sfdisk from util-linux 2.27.1
Then we create the partition layout by:
1 2 3
$ sudo sfdisk ${DISK} <<-__EOF__ 4M,,L,* __EOF__
Afterwards, we need to format the created partition by mkfs.ext4. We also need to make sure which version of mkfs.ext4 is. In my case, it is of version 1.42.13.
1 2 3
$ mkfs.ext4 -V mke2fs 1.42.13 (17-May-2015) Using EXT2FS Library version 1.42.13
Then, we format the partition by:
1
$ sudo mkfs.ext4 -L rootfs ${DISK}p1
After formatting, the TF card should be able to be either automatically mounted or manually mounted by the following command:
1 2
$ sudo mkdir -p /media/rootfs/ $ sudo mount ${DISK}p1 /media/rootfs/
Under the folder bb-kernel, a file named kernel_version was generated while building Linux kernel. In my case, I was building the NEWEST kernel 4.14.13-bone12. For convenience, we export a new MACRO kernel_version.
$ sudo tar xfv ./bb-kernel/deploy/${kernel_version}-modules.tar.gz -C /media/rootfs/
7) Set File Systems Table (/etc/fstab)
1
$ sudo sh -c "echo '/dev/mmcblk0p1 / auto errors=remount-ro 0 1' >> /media/rootfs/etc/fstab"
8) Networking
To enable the Internet for the FIRST booting, we need to do the network configuration:
1
$ sudo nano /media/rootfs/etc/network/interfaces
Add the following content:
1 2 3 4 5
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp
In order to use a shared SD card with multiple BeagleBones, and always enable the Ethernet interface as eth0, we need to add a particular udev rule as:
PART C: Configurations after Booting from the SD Card
Insert TF card into a Beaglebone Black, connect BBB with an Internet cable, and connect a Micro HDMI cable on demand. After the flashing of on-board LEDs, you should be able to find the IP address of BBB via your router. All our future jobs are to be done via ssh command through this IP address. My personal preference is to set a static IP address for this particularly BBB in the router settings.
Some initialization work need to be done, including: 1) define the termination criteria when refine the corner sub-pixel later on; 2) blob detection parameters; 3) object points coordinators initialization.
# Filter by Area. blobParams.filterByArea = True blobParams.minArea = 64# minArea may be adjusted to suit for your experiment blobParams.maxArea = 2500# maxArea may be adjusted to suit for your experiment
# Filter by Circularity blobParams.filterByCircularity = True blobParams.minCircularity = 0.1
# Filter by Convexity blobParams.filterByConvexity = True blobParams.minConvexity = 0.87
# Filter by Inertia blobParams.filterByInertia = True blobParams.minInertiaRatio = 0.01
# Create a detector with the parameters blobDetector = cv2.SimpleBlobDetector_create(blobParams)
# Arrays to store object points and image points from all the images. objpoints = [] # 3d point in real world space imgpoints = [] # 2d points in image plane.
Fourthly
After localizing 10 frames (10 can be changed to any positive integer as you wish) of a grid of 2D circles, camera matrix and distortion coefficients can be calculated by invoking the function calibrateCamera. Here, we are testing on a real-time camera stream. Similar to Camera Posture Estimation Using Circle Grid Pattern, the trick is to do blobDetector.detect() and draw the detected blobs using cv2.drawKeypoints() before invoking cv2.findCirclesGrid(), so that the entire grid is easier to be found.
cap = cv2.VideoCapture(0) found = 0 while(found < 10): # Here, 10 can be changed to whatever number you like to choose ret, img = cap.read() # Capture frame-by-frame gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Write the calculated calibration parameters into a yaml file. Here, it is a bit tricky. Please bear in mind that you MUST call function tolist() to transform a numpy array to a list.
1 2 3 4
# It's very important to transform the matrix to list. data = {'camera_matrix': np.asarray(mtx).tolist(), 'dist_coeff': np.asarray(dist).tolist()} withopen("calibration.yaml", "w") as f: yaml.dump(data, f)
Additionally
You may use the following piece of code to load the calibration parameters from file “calibration.yaml”.