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.
Armbian Kernel Version
We then update/upgrade all upgradable packages, and have the system rebooted.
Armbian Apt UpdateArmbian Apt Upgrade
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.
Armbian All Upgraded
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:
U-boot and kernel packagesShow a kernel configuration menu before compilationOfficially supported boards
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
Install Built DEBs
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
Remove Old Kernels
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
Network Interfaces
Finally, you are recommended to solve all the other issues about Ubuntu Desktop via Google.