0%

Install Armbian Ubuntu Desktop with the Newest Supported Mainline Linux Kernel onto Orange Pi Plus 2

Today, we are going to install a runnable Linux OS Armbian and then flash the most recent supported Linux Kernel onto an Orange Pi Plus 2, which adopts AllWinner H3 as its CPU. The board looks like (cited from Orange Pi Plus 2 ):

Orange Pi Plus 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)

Processing archive: Armbian_5.38_Orangepiplus_Ubuntu_xenial_default_3.4.113_desktop.7z

Extracting Armbian_5.38_Orangepiplus_Ubuntu_xenial_default_3.4.113_desktop.img
Extracting armbian.txt
Extracting armbian.txt.asc
Extracting Armbian_5.38_Orangepiplus_Ubuntu_xenial_default_3.4.113_desktop.img.asc
Extracting sha256sum.sha

Everything is Ok

Files: 5
Size: 3061862273
Compressed: 606477386

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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
...

Then, Orange Pi Plus 2 will boot into GUI as follows.

Armbian Ubuntu Desktop Overview

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 Update
Armbian 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.

1. Download Armbian Source Code

1
$ git clone git@github.com:armbian/build.git armbian

2. Test Compiling

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,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
$ 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.

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. ] Preparing [ host ]
[ o.k. ] Build host OS release [ xenial ]
[ o.k. ] Syncing clock [ host ]
[ .... ] Downloading [ gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
gpg: keyring `/home/jiapei/Downloads/OperatingSystems/linux/distros/armbian/armbian/cache/.gpg/pubring.gpg' created
gpg: /home/jiapei/Downloads/OperatingSystems/linux/distros/armbian/armbian/cache/.gpg/trustdb.gpg: trustdb created
gpg: error reading key: public key not found
gpg: keyring `/home/jiapei/Downloads/OperatingSystems/linux/distros/armbian/armbian/cache/.gpg/secring.gpg' created
gpg: requesting key 8F427EAF from hkp server keyserver.ubuntu.com
gpg: key 8F427EAF: public key "Linaro Toolchain Builder <michael.hope+cbuild@linaro.org>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
gpg: assuming signed data in `gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz'
gpg: Signature made Wed 16 Apr 2014 11:29:14 AM PDT using RSA key ID 8F427EAF
gpg: Good signature from "Linaro Toolchain Builder <michael.hope+cbuild@linaro.org>"
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-4.9.4-2017.01-x86_64_aarch64-linux-gnu ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-5.5.0-2017.10-x86_64_aarch64-linux-gnu ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabi ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-6.4.1-2017.11-x86_64_arm-linux-gnueabihf ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-6.4.1-2017.11-x86_64_aarch64-linux-gnu ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete
[ .... ] Downloading [ gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf ]
######################################################################## 100.0%
######################################################################## 100.0%
[ .... ] Verifying
[ .... ] Extracting
[ o.k. ] Download complete

Then, a canonical GUI will jump out onto the screen for you to make selections:

U-boot and kernel packages
Show a kernel configuration menu before compilation
Officially 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 in function source [ main.sh:198 ]
[ error ] No kernel branch selected
[ o.k. ] Process terminated

3. Prepare The Board Configuration File

We doublecheck the officially supported boards:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
$ cd ./config/boards
$ ls -1 *orangepi*
orangepi2.conf
orangepi2g-iot.csc
orangepi.eos
orangepilite.conf
orangepimini.eos
orangepione.conf
orangepipc2.conf
orangepipc.conf
orangepipcplus.conf
orangepiplus2e.conf
orangepiplus.conf
orangepiprime.conf
orangepi-r1.conf
orangepiwin.conf
orangepizero.conf
orangepizeroplus2-h3.conf
orangepizeroplus2-h5.conf
orangepizeroplus.conf

As we can see, it is certain that our board Orange Pi Plus 2 is NOT officially supported. Due to the trivial difference between Orange Pi Plus 2 and Orange Pi Plus 2e, we configure our Orange Pi Plus 2 board as a Orange Pi Plus 2e board by:

1
$ cp orangepiplus2e.conf orangepiplus2.conf

Afterwards, we modify the file content in orangepiplus2.conf manually:

1
$ vim orangepiplus2.conf

and, the file content is correspondingly modified to:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# H3 quad core 2GB RAM WiFi eMMC
BOARD_NAME="Orange Pi+ 2"
BOARDFAMILY="sun8i"
BOOTCONFIG="orangepi_plus2_defconfig"
#
MODULES="8189fs #w1-sunxi #w1-gpio #w1-therm #gc2035 #vfe_v4l2 #sunxi-cir"
MODULES_NEXT="8189fs"
CPUMIN="408000"
CPUMAX="1296000"
#
KERNEL_TARGET="default,next,dev"
CLI_TARGET="stretch,xenial:next"
DESKTOP_TARGET="xenial:default"
#
CLI_BETA_TARGET=""
DESKTOP_BETA_TARGET=""
#
RECOMMENDED="Ubuntu_xenial_default_desktop:90,Debian_stretch_next:75"
#
BOARDRATING=""
CHIP="http://docs.armbian.com/Hardware_Allwinner-H3/"
HARDWARE="http://www.orangepi.org/orangepiplus2/"
FORUMS="http://forum.armbian.com/index.php/forum/13-allwinner-h3/"
BUY="http://s.click.aliexpress.com/e/VbA6AEq"

4. Prepare Board Configuration File for U-Boot

Then, we recompile armbian with some particular options (Please refer to Armbian Build Options for parameter details):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ 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.

Target OS release
Target image type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
[ o.k. ] Downloading sources 
[ o.k. ] Checking git sources [ u-boot v2017.11 ]
[ .... ] Creating local copy
[ .... ] Fetching updates
remote: Counting objects: 13853, done.
remote: Compressing objects: 100% (12500/12500), done.
remote: Total 13853 (delta 2493), reused 5244 (delta 1104)
Receiving objects: 100% (13853/13853), 17.27 MiB | 1.00 MiB/s, done.
Resolving deltas: 100% (2493/2493), done.
From git://git.denx.de/u-boot
* tag v2017.11 -> FETCH_HEAD
[ .... ] Checking out
[ o.k. ] Checking git sources [ linux-mainline linux-4.14.y ]
[ .... ] Creating local copy
[ .... ] Fetching updates
remote: Counting objects: 65193, done.
remote: Compressing objects: 100% (60945/60945), done.
remote: Total 65193 (delta 5919), reused 26531 (delta 3272)
Receiving objects: 100% (65193/65193), 172.40 MiB | 3.26 MiB/s, done.
Resolving deltas: 100% (5919/5919), done.
From git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable
* branch linux-4.14.y -> FETCH_HEAD
* [new branch] linux-4.14.y -> origin/linux-4.14.y
[ .... ] Checking out
[ o.k. ] Checking git sources [ sunxi-tools master ]
[ .... ] Creating local copy
[ .... ] Fetching updates
remote: Counting objects: 83, done.
remote: Compressing objects: 100% (78/78), done.
remote: Total 83 (delta 13), reused 33 (delta 4), pack-reused 0
Unpacking objects: 100% (83/83), done.
From https://github.com/linux-sunxi/sunxi-tools
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
[ .... ] Checking out
[ o.k. ] Checking git sources [ rkbin-tools master ]
[ .... ] Creating local copy
[ .... ] Fetching updates
remote: Counting objects: 232, done.
remote: Compressing objects: 100% (182/182), done.
remote: Total 232 (delta 57), reused 209 (delta 50), pack-reused 0
Receiving objects: 100% (232/232), 22.60 MiB | 8.32 MiB/s, done.
Resolving deltas: 100% (57/57), done.
From https://github.com/rockchip-linux/rkbin
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
[ .... ] Checking out
[ o.k. ] Checking git sources [ marvell-tools A3700_utils-armada-17.10 ]
[ .... ] Creating local copy
[ .... ] Fetching updates
remote: Counting objects: 294, done.
remote: Compressing objects: 100% (150/150), done.
remote: Total 294 (delta 151), reused 229 (delta 140), pack-reused 0
Receiving objects: 100% (294/294), 5.80 MiB | 4.40 MiB/s, done.
Resolving deltas: 100% (151/151), done.
From https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell
* branch A3700_utils-armada-17.10 -> FETCH_HEAD
* [new branch] A3700_utils-armada-17.10 -> origin/A3700_utils-armada-17.10
[ .... ] Checking out
[ o.k. ] Checking git sources [ odroidc2-blobs master ]
[ .... ] Creating local copy
[ .... ] Fetching updates
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 13 (delta 0), reused 11 (delta 0), pack-reused 0
Unpacking objects: 100% (13/13), done.
From https://github.com/armbian/odroidc2-blobs
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
[ .... ] Checking out
[ o.k. ] Compiling [ sunxi-tools ]
Setting version information: 5c19710

[ o.k. ] Installing [ rkbin-tools ]
[ 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
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
***
*** Can't find default configuration "arch/../configs/orangepi_plus2_defconfig"!
***
scripts/kconfig/Makefile:121: recipe for target 'orangepi_plus2_defconfig' failed
make[1]: *** [orangepi_plus2_defconfig] Error 1
Makefile:479: recipe for target 'orangepi_plus2_defconfig' failed
make: *** [orangepi_plus2_defconfig] Error 2
sed: can't read .config: No such file or directory
scripts/kconfig/conf --silentoldconfig Kconfig
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
scripts/kconfig/Makefile:46: recipe for target 'silentoldconfig' failed
make[2]: *** [silentoldconfig] Error 1
Makefile:479: recipe for target 'silentoldconfig' failed
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'. Stop.
[ error ] ERROR in function compile_uboot [ compilation.sh:156 ]
[ error ] U-boot compilation failed
[ o.k. ] Process terminated

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:

1) STEP 1:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ cd ./cache/sources/u-boot/v2017.11/configs
$ ls -1 *orangepi*
orangepi_2_defconfig
orangepi_2_defconfig.orig
orangepi_lite_defconfig
orangepi_one_defconfig
orangepi_pc2_defconfig
orangepi_pc2_defconfig.orig
orangepi_pc_defconfig
orangepi_pc_plus_defconfig
orangepi_plus2e_defconfig
orangepi_plus2e_defconfig.orig
orangepi_plus_defconfig
orangepi_plus_defconfig.orig
orangepi_prime_defconfig
orangepi_win_defconfig
orangepi_win_defconfig.orig
orangepi_zero_defconfig
orangepi_zero_defconfig.orig
orangepi_zero_plus2_defconfig
orangepi_zero_plus2_h3_defconfig
orangepizero_plus_defconfig

Clearly, orangepi_plus2_defconfig is NOT in the list. Therefore, we do:

1
2
$ sudo cp orangepi_plus2e_defconfig orangepi_plus2_defconfig
$ sudo vim orangepi_plus2_defconfig

and ensure any plus2e is now plus2.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ 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

and ensure any 2e/2E is now 2.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$ 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";

reg_gmac_3v3: gmac-3v3 {
compatible = "regulator-fixed";
pinctrl-names = "default";
pinctrl-0 = <&gmac_power_pin_orangepi>;
regulator-name = "gmac-3v3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
startup-delay-us = <100000>;
enable-active-high;
gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
};
};

&emac {
/* The Orange Pi Plus 2 uses an external gbit phy */
pinctrl-names = "default";
pinctrl-0 = <&emac_rgmii_pins>;
phy-supply = <&reg_gmac_3v3>;
phy-mode = "rgmii";
/delete-property/allwinner,use-internal-phy;
};

&pio {
gmac_power_pin_orangepi: gmac_power_pin@0 {
allwinner,pins = "PD6";
allwinner,function = "gpio_out";
allwinner,drive = <SUN4I_PINCTRL_10_MA>;
allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
};
};

5. Build the Newest Supported Linux Kernels

Before we build the system again, we just need to ensure our python is of version 2 instead of 3, otherwise, you'll get some ERROR message like:

1
ImportError: No module named _libfdt

NOW, we build the system AGAIN:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
$ ./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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
......
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
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:

1
$ cp *.deb /media/jiapei/ab9545b9-0d2d-4927-83f3-fae97ced83a9/home/orangepiplus2/

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.