§2023-07-05

The cross-compilation toolchain will only be downloaded when the orangepi-build compilation image is used on an x64 computer. Compiling the linux image of the development board in the Ubuntu22.04 of the development board will not download the cross-compilation toolchain. At this time, orangepi-build/toolchains will be an empty folder.

if you can run on arch OS or bookworm, it is an unsupported system`


  1. Compile kerne;
$ git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next
$ cd orangepi-build
$ sudo ./build.sh --> select build kernel, success
dpkg-deb: building package 'linux-headers-legacy-rockchip-rk3588' in '../linux-headers-legacy-rockchip-rk3588_1.0.6_arm64.deb'.
dpkg-deb: building package 'linux-dtb-legacy-rockchip-rk3588' in '../linux-dtb-legacy-rockchip-rk3588_1.0.6_arm64.deb'.
dpkg-deb: building package 'linux-image-legacy-rockchip-rk3588' in '../linux-image-legacy-rockchip-rk3588_1.0.6_arm64.deb'.
dpkg-buildpackage: info: binary-only upload (no source included)
[ o.k. ] Kernel build done [ @host ]
[ o.k. ] Target directory [ /home/orangepi/build/orangepi-build/output/debs/ ]
[ o.k. ] File name [ linux-image-legacy-rockchip-rk3588_1.0.6_arm64.deb ]
[ o.k. ] Runtime [ 50 min ]
[ o.k. ] Repeat Build Options [ sudo ./build.sh  BOARD=orangepi5plus BRANCH=legacy BUILD_OPT=kernel KERNEL_CONFIGURE=no  ]

$  ls output/debs/
extra  linux-dtb-legacy-rockchip-rk3588_1.0.6_arm64.deb  linux-headers-legacy-rockchip-rk3588_1.0.6_arm64.deb  linux-image-legacy-rockchip-rk3588_1.0.6_arm64.deb  u-boot

make: *** [Makefile:1920: drivers] Error 2 [ error ] ERROR in function compile_kernel [ ./build.sh:305 -> scripts/main.sh:604 -> scripts/main.sh:507 -> scripts/compilation.sh:496 -> scripts/general.sh:0 ] [ error ] Kernel was not built [ @host ] [ o.k. ] Process terminated ```

  1. Compile u-boot
$ sudo ./build.sh --> build u-boot
...
572+0 records in
572+0 records out
292864 bytes (293 kB, 286 KiB) copied, 0.00463482 s, 63.2 MB/s
2712+0 records in
2712+0 records out
1388544 bytes (1.4 MB, 1.3 MiB) copied, 0.0205978 s, 67.4 MB/s
[ o.k. ] Building deb [ linux-u-boot-legacy-orangepi5plus_1.0.6_arm64.deb ]
[ o.k. ] U-boot build done [ @host ]
[ o.k. ] Target directory [ /home/orangepi/build/orangepi-build/output/debs/u-boot ]
[ o.k. ] File name [ linux-u-boot-legacy-orangepi5plus_1.0.6_arm64.deb ]
[ o.k. ] Runtime [ 1 min ]
[ o.k. ] Repeat Build Options [ sudo ./build.sh  BOARD=orangepi5plus BRANCH=legacy BUILD_OPT=u-boot  ]

$ ls output/debs/u-boot/
linux-u-boot-legacy-orangepi5plus_1.0.6_arm64.deb
  1. Compile rootfs
$ sudo ./build.sh
    - Rootfs and all deb packages
    - orangepi5plus Rockchip  RK3588 octa core 4-32GB RAM 2.5GBE USB3 USB-C WiFi/BT NVMe eMMC 
        - bionic   Ubuntu Bionic 18.04 LTS                      
        - bookworm Debian 12 Bookworm
        - bullseye Debian 11 Bullseye     <-- I select this 
            -  Select the target image type     
                - no  Image with console interface (server) 
            - Select the target image type 
                - no  Standard image with console interface 
        - focal    Ubuntu Focal 20.04 LTS 
        - jammy    Ubuntu jammy 22.04 LTS                                                               
$ ls external/cache/rootfs/
bullseye-cli-arm64.668814a547aed0963d2ad97676f77b9b.tar.lz4          bullseye-cli-arm64.668814a547aed0963d2ad97676f77b9b.tar.lz4.list
bullseye-cli-arm64.668814a547aed0963d2ad97676f77b9b.tar.lz4.current
  1. Full OS image for flashing
$ sudo ./build.sh
- Full OS image for flashing 
- Do not change the kernel configuration 
-  orangepi5plus Rockchip  RK3588 octa core 4-32GB RAM 2.5GBE USB3 USB-C WiFi/BT NVMe eMMC
-  Foca Ubuntu
- no  Image with console interface (server) 
- no  Standard image with console interface 

git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next

  1. Download orangepi-build from github

supported boards

$ git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next
# The above git clone command needs to specify the branch of the orangepi-build source code as next.
$ cd orangepi-build
$ git branch
* next
$ ls
build.sh  external  LICENSE  README.md  scripts

`sudo ./build.sh, you have four choices 1. U-boot package 2. Kernel package (Still Failed) 3. Rootfs and all deb packages 4. Full OS image for flashing

  1. The u-boot and linux kernel versions currently used by the development board are as follows
    branch u-boot version linux kernel version
    legacy u-boot 2017.09 linux5.10

Currently, the linux5.10 bsp kernel provided by RK is defined as the legacy branch. If the mainline kernel is supported in the future, a current branch will be added.

  1. orangepi-build will contain the following files and folders after downloading

Compile u-boot on non x86_64 build host is not supported


change to h2Jammy.yushei.net

When orangepi-build runs for the first time, it will automatically download the cross-compilation toolchain and put it in the toolchains folder. Every time after running the build.sh script of orangepi-build, it will check whether the cross-compilation toolchain in toolchains exists , if it does not exist, the download will be restarted, if it exists, it will be used directly, and the download will not be repeated.

  1. run build.sh
$ sudo ./build.sh 
[sudo] password for alexlai: 
[ .... ] Installing basic packages [ dialog uuid uuid-runtime gawk  ]
W: https://packagecloud.io/AtomEditor/atom/any/dists/any/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
Selecting previously unselected package libsigsegv2:amd64.
(Reading database ... 321082 files and directories currently installed.)
Preparing to unpack .../libsigsegv2_2.13-1ubuntu3_amd64.deb ...
Unpacking libsigsegv2:amd64 (2.13-1ubuntu3) ...
Setting up libsigsegv2:amd64 (2.13-1ubuntu3) ...
Selecting previously unselected package gawk.
(Reading database ... 321089 files and directories currently installed.)
Preparing to unpack .../gawk_1%3a5.1.0-1build3_amd64.deb ...
Unpacking gawk (1:5.1.0-1build3) ...
Selecting previously unselected package dialog.
Preparing to unpack .../dialog_1.3-20211214-1_amd64.deb ...
Unpacking dialog (1.3-20211214-1) ...
Selecting previously unselected package libossp-uuid16:amd64.
Preparing to unpack .../libossp-uuid16_1.6.2-1.5build9_amd64.deb ...
Unpacking libossp-uuid16:amd64 (1.6.2-1.5build9) ...
Selecting previously unselected package uuid.
Preparing to unpack .../uuid_1.6.2-1.5build9_amd64.deb ...
Unpacking uuid (1.6.2-1.5build9) ...
Setting up gawk (1:5.1.0-1build3) ...
Setting up libossp-uuid16:amd64 (1.6.2-1.5build9) ...
Setting up dialog (1.3-20211214-1) ...
Setting up uuid (1.6.2-1.5build9) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
[ o.k. ] Create example config file using template [ config-default.conf ]
[ o.k. ] Using config file [ /home/alexlai/build/orangepi-build/userpatches/config-example.conf ]
[ .... ] Extension being added [ rkbin-tools :: added by ./build.sh:305 -> scripts/main.sh:363 -> scripts/configuration.sh:151 -> external/config/sources/families/rockchip-rk3588.conf:1 -> external/config/sources/families/include/rockchip64_common.inc:4 -> scripts/extensions.sh:0 ]
[ o.k. ] Extension manager [ processed 3 Extension Methods calls and 3 Extension Method implementations ]
[ o.k. ] Preparing [ host ]
[ o.k. ] Build host OS release [ jammy ]
[ .... ] Installing build dependencies 
...

[ .... ] downloading using http(s) network [ gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz ]
[#0ea065 15MiB/24MiB(63%) CN:1 DL:8.7MiB ETA:1s]                                                                                                                                                                                                                                                                           
[ o.k. ] Verified [ PGP ]
[ .... ] decompressing 
[ .... ] gcc-linaro-aarch64-none-elf-4.8-2013.11_linux.tar.xz: 24.9MiB [8.61MiB/s] 
[=============================================================================================>] 100%
[ .... ] downloading using http(s) network [ gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz ]
[#e364d7 25MiB/33MiB(75%) CN:1 DL:9.1MiB]                                                                                                                                                                                                                                                                                  
[ o.k. ] Verified [ PGP ]
[ .... ] decompressing 
[ .... ] gcc-linaro-arm-none-eabi-4.8-2014.04_linux.tar.xz: 33.9MiB [7.57MiB/s] 
[====================================================================================>] 100%
[ .... ] downloading using http(s) network [ gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz ]
[#f21497 41MiB/48MiB(85%) CN:1 DL:8.8MiB]                                                                                                                                                                                                                                                                                  
[ o.k. ] Verified [ PGP ]
[ .... ] decompressing 
[ .... ] gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux.tar.xz: 43.0MiB [8.13MiB/s] 
[====================================================================================>] 100%

...
Image Type:   Rockchip RK35 boot image
Init Data Size: 65536 bytes
Boot Data Size: 223232 bytes
0+0 records in
0+0 records out
0 bytes copied, 0.000285201 s, 0.0 kB/s
Warning: The resulting partition is not properly aligned for best performance: 64s % 2048s != 0s
Warning: The resulting partition is not properly aligned for best performance: 1024s % 2048s != 0s
568+0 records in
568+0 records out
290816 bytes (291 kB, 284 KiB) copied, 0.00436937 s, 66.6 MB/s
2715+0 records in
2715+0 records out
1390080 bytes (1.4 MB, 1.3 MiB) copied, 0.024619 s, 56.5 MB/s
[ o.k. ] Building deb [ linux-u-boot-legacy-orangepi5plus_1.0.6_arm64.deb ]
[ o.k. ] U-boot build done [ @host ]
[ o.k. ] Target directory [ /home/alexlai/build/orangepi-build/output/debs/u-boot ]
[ o.k. ] File name [ linux-u-boot-legacy-orangepi5plus_1.0.6_arm64.deb ]
[ o.k. ] Runtime [ 8 min ]
[ o.k. ] Repeat Build Options [ sudo ./build.sh  BOARD=orangepi5plus BRANCH=legacy BUILD_OPT=u-boot  ]
$ ls
build.sh  external  LICENSE  output  README.md  scripts  toolchains  u-boot  userpatches

$ ls output/debs/u-boot/ linux-u-boot-legacy-orangepi5plus_1.0.6_arm64.deb


2. Use the following command to decompress the deb package 

```bash
$ cd output/debs/u-boot/
$ ls
linux-u-boot-legacy-orangepi5plus_1.0.6_arm64.deb
$ sudo dpkg -x linux-u-boot-legacy-orangepi5plus_1.0.6_arm64.deb . # the perid is necessary
t$ tree
.
├── linux-u-boot-legacy-orangepi5plus_1.0.6_arm64.deb
└── usr
    └── lib
        ├── linux-u-boot-legacy-orangepi5plus_1.0.6_arm64
        │   ├── idbloader.img
        │   ├── rkspi_loader.img
        │   └── u-boot.itb
        └── u-boot
            ├── LICENSE
            ├── orangepi_5_plus_defconfig
            └── platform_install.sh

4 directories, 7 files
  1. Build Kernel orangepi5plus-kernel.png

If you do not need to modify the configuration options of the kernel, when running the build.sh script, pass in KERNEL_CONFIGURE=no sudo ./build.sh KERNEL_CONFIGURE=no

$ sudo ./build.sh  --> Select Kernel PAckage
...
*
* Restart config...
*
*
* GCC plugins
*
GCC plugins (GCC_PLUGINS) [Y/n/?] (NEW) Y
'  Compute the cyclomatic complexity of a function (GCC_PLUGIN_CYC_COMPLEXITY) [N/y/?] (NEW) n
  Compute the cyclomatic complexity of a function (GCC_PLUGIN_CYC_COMPLEXITY) [N/y/?] (NEW) N
  Generate some entropy during boot and runtime (GCC_PLUGIN_LATENT_ENTROPY) [N/y/?] (NEW) N
  Randomize layout of sensitive kernel structures (GCC_PLUGIN_RANDSTRUCT) [N/y/?] (NEW) N
* Memory initialization
*
Initialize kernel stack variables at function entry
> 1. no automatic initialization (weakest) (INIT_STACK_NONE)
  2. zero-init structs marked for userspace (weak) (GCC_PLUGIN_STRUCTLEAK_USER) (NEW)
  3. zero-init structs passed by reference (strong) (GCC_PLUGIN_STRUCTLEAK_BYREF) (NEW)
  4. zero-init anything passed by reference (very strong) (GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) (NEW)
choice[1-4?]: 1
Poison kernel stack before returning from syscalls (GCC_PLUGIN_STACKLEAK) [N/y/?] (NEW) N
Enable heap memory zeroing on allocation by default (INIT_ON_ALLOC_DEFAULT_ON) [N/y/?] n
Enable heap memory zeroing on free by default (INIT_ON_FREE_DEFAULT_ON) [N/y/?] n
#
# configuration written to .config
#
  UPD     scripts/kconfig/mconf-cfg
  HOSTCC  scripts/kconfig/mconf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTLD  scripts/kconfig/mconf


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

[ o.k. ] Exporting new kernel config [ /home/alexlai/build/orangepi-build/output/config/linux-rockchip-rk3588-legacy.config ]
  WRAP    arch/arm64/include/generated/uapi/asm/kvm_para.h
  WRAP    arch/arm64/include/generated/uapi/asm/errno.h
  WRAP    arch/arm64/include/generated/uapi/asm/ioctls.h
...
scripts/extract-cert.c: In function ‘display_openssl_errors’:
scripts/extract-cert.c:46:9: warning: ‘ERR_get_error_line’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   46 |         while ((e = ERR_get_error_line(&file, &line))) {
  411 | unsigned long ERR_get_error_line(const char **file, int *line);
scripts/extract-cert.c: In function ‘drain_openssl_errors’:
scripts/extract-cert.c:60:9: warning: ‘ERR_get_error_line’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   60 |         while (ERR_get_error_line(&file, &line)) {}
  411 | unsigned long ERR_get_error_line(const char **file, int *line);
make[2]: *** [scripts/Makefile.build:273: kernel/sched/core.o] Error 1
make[1]: *** [scripts/Makefile.build:516: kernel/sched] Error 2
make: *** [Makefile:1920: kernel] Error 2
[ error ] ERROR in function compile_kernel [ ./build.sh:305 -> scripts/main.sh:604 -> scripts/main.sh:507 -> scripts/compilation.sh:496 -> scripts/general.sh:0 ]
[ error ] Kernel was not built [ @host ]
[ o.k. ] Process terminated 

....
---

The build kernel failed, so I recloned and rebuild again

```bash
$ git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next
$ cd orange-build
$ sudo ./build.sh
...
scripts/extract-cert.c: In function ‘display_openssl_errors’:
scripts/extract-cert.c:46:9: warning: ‘ERR_get_error_line’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   46 |         while ((e = ERR_get_error_line(&file, &line))) {
  411 | unsigned long ERR_get_error_line(const char **file, int *line);
scripts/extract-cert.c: In function ‘drain_openssl_errors’:
scripts/extract-cert.c:60:9: warning: ‘ERR_get_error_line’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
   60 |         while (ERR_get_error_line(&file, &line)) {}
  411 | unsigned long ERR_get_error_line(const char **file, int *line);
make[2]: *** [scripts/Makefile.build:273: kernel/sched/core.o] Error 1
make[1]: *** [scripts/Makefile.build:516: kernel/sched] Error 2
make: *** [Makefile:1920: kernel] Error 2
[ error ] ERROR in function compile_kernel [ ./build.sh:305 -> scripts/main.sh:604 -> scripts/main.sh:507 -> scripts/compilation.sh:496 -> scripts/general.sh:0 ]
[ error ] Kernel was not built [ @host ]
[ o.k. ] Process terminated 

alexlai@SurfacePro:~$ cd build/
alexlai@SurfacePro:~/build$  git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next

$ git branch
* next
$ sudo ./build.sh 
[sudo] alexlai のパスワード: 
[ .... ] Installing basic packages [ dialog uuid uuid-runtime gawk  ]
以前に未選択のパッケージ libsigsegv2:amd64 を選択しています。
(データベースを読み込んでいます ... 現在 268248 個のファイルとディレクトリがインストールされています。)
.../libsigsegv2_2.14-1ubuntu1_amd64.deb を展開する準備をしています ...
libsigsegv2:amd64 (2.14-1ubuntu1) を展開しています...
libsigsegv2:amd64 (2.14-1ubuntu1) を設定しています ...
以前に未選択のパッケージ gawk を選択しています。
(データベースを読み込んでいます ... 現在 268255 個のファイルとディレクトリがインストールされています。)
.../gawk_1%3a5.1.0-1build3_amd64.deb を展開する準備をしています ...
gawk (1:5.1.0-1build3) を展開しています...
以前に未選択のパッケージ dialog を選択しています。
.../dialog_1.3-20211214-1_amd64.deb を展開する準備をしています ...
dialog (1.3-20211214-1) を展開しています...
以前に未選択のパッケージ libossp-uuid16:amd64 を選択しています。
.../libossp-uuid16_1.6.2-1.5build9_amd64.deb を展開する準備をしています ...
libossp-uuid16:amd64 (1.6.2-1.5build9) を展開しています...
以前に未選択のパッケージ uuid を選択しています。
.../uuid_1.6.2-1.5build9_amd64.deb を展開する準備をしています ...
uuid (1.6.2-1.5build9) を展開しています...
gawk (1:5.1.0-1build3) を設定しています ...
libossp-uuid16:amd64 (1.6.2-1.5build9) を設定しています ...
dialog (1.3-20211214-1) を設定しています ...
uuid (1.6.2-1.5build9) を設定しています ...
man-db (2.10.2-2) のトリガを処理しています ...
libc-bin (2.36-0ubuntu4) のトリガを処理しています ...
[ o.k. ] Create example config file using template [ config-default.conf ]
[ o.k. ] Using config file [ /home/alexlai/build/orangepi-build/userpatches/config-example.conf ]
[ .... ] Extension being added [ rkbin-tools :: added by ./build.sh:305 -> scripts/main.sh:363 -> scripts/configuration.sh:151 -> external/config/sources/families/rockchip-rk3588.conf:1 -> external/config/sources/families/include/rockchip64_common.inc:4 -> scripts/extensions.sh:0 ]
[ o.k. ] Extension manager [ processed 3 Extension Methods calls and 3 Extension Method implementations ]
[ o.k. ] Preparing [ host ]
[ o.k. ] Build host OS release [ kinetic ]
[ error ] ERROR in function prepare_host [ ./build.sh:305 -> scripts/main.sh:604 -> scripts/main.sh:415 -> scripts/general.sh:1435 -> scripts/general.sh:0 ]
[ error ] It seems you ignore documentation and run an unsupported build system: kinetic 
[ o.k. ] Process terminated