[ROC-RK3568-PC] teach you how to compile Linux_SDK and package builderoot system firmware

🍇 Author home page: Neutionwei
🍇 About the author: 🏆 New star creator of CSDN embedded field
🍇 Hello, I'm Neutionwei. Welcome to read my article. Before that, I hope you can give me a five-star in a few seconds ⭐ ️ ⭐ ️ ⭐ ️ ⭐ ️ ⭐ ️

👉 Bloggers recently participated in the 2021 blog star campaign. This is a campaign post. Please add other content here. Including but not limited to: your harvest, perception, feedback on CSDN products and hope for 2022. At the same time, please vote and score for me. Your every score is my support and encouragement

👉 Voting address: Click here

✏️ ROC-RK3568-PC introduction serialization process:

[ROC-RK3568-PC] teach you to burn the factory Android system into Ubuntu system
[ROC-RK3568-PC] teach you how to make the TF Card startup disk of Ubuntu system
[ROC-RK3568-PC] teach you how to compile Linux_SDK and package Ubuntu system firmware
[ROC-RK3568-PC] teach you how to unpack Ubuntu system firmware
[ROC-RK3568-PC] teach you how to unpack and package Ubuntu system firmware under Linux
[ROC-RK3568-PC] teach you how to package Ubuntu system firmware that can be burned using the Etcher or dd command

All the previous articles focus on Ubuntu firmware. Interested readers can read it by themselves. Next, let's talk about how to compile and package Buildroot system firmware! Compiling Linux_ The SDK process is mostly the same as the Ubuntu system firmware described earlier. If the reader has ever compiled Linux_SDK, please read directly from the third part!

1, Construction of development environment

As we all know, the biggest headache of compilation is the host environment! Suppose I have boards from other chip manufacturers, each manufacturer's SDK uses a different compilation environment, and my Ubuntu host system has only one, what should I do?

Use Docker container!

According to the official wiki of Firefly, Ubuntu 18.04 is recommended. Let's build an Ubuntu 18.04 system under Docker!

1.1 host installation Docker

Copy this article I wrote earlier: Linux tools | building Docker container engine for Ubuntu

1.2 Docker installation Ubuntu 18.04

neutionwei@x:~$ sudo apt update
neutionwei@x:~$ docker pull ubuntu:18.04

Switch Shell to Ubuntu 18.04:

neutionwei@x:~$ docker container run -p 8000:3000 -it ubuntu:18.04 /bin/bash
root@32b7b9ddcaab:/# cat /etc/issue
Ubuntu 18.04.6 LTS \n \l

1.3 common tools for Ubuntu 18.04 installation

root@32b7b9ddcaab:/# apt update
root@32b7b9ddcaab:/# apt install byobu vim-gtk inetutils-ping net-tools wget cpio unzip rsync xz-utils

In the process, the region needs to be configured. Select Asia and Shanghai:

Configuring tzdata
------------------

Please select the geographic area in which you live. Subsequent configuration questions will narrow this down by presenting a list of cities,
representing the time zones in which they are located.

  1. Africa   3. Antarctica  5. Arctic  7. Atlantic  9. Indian    11. SystemV  13. Etc
  2. America  4. Australia   6. Asia    8. Europe    10. Pacific  12. US
Geographic area: 6

Please select the city or region corresponding to your time zone.

  1. Aden      13. Barnaul     25. Dushanbe     37. Jerusalem     49. Macau         61. Pyongyang      73. Taipei         85. Vientiane
  2. Almaty    14. Beirut      26. Famagusta    38. Kabul         50. Magadan       62. Qatar          74. Tashkent       86. Vladivostok
  3. Amman     15. Bishkek     27. Gaza         39. Kamchatka     51. Makassar      63. Qostanay       75. Tbilisi        87. Yakutsk
  4. Anadyr    16. Brunei      28. Harbin       40. Karachi       52. Manila        64. Qyzylorda      76. Tehran         88. Yangon
  5. Aqtau     17. Chita       29. Hebron       41. Kashgar       53. Muscat        65. Rangoon        77. Tel_Aviv       89. Yekaterinburg
  6. Aqtobe    18. Choibalsan  30. Ho_Chi_Minh  42. Kathmandu     54. Nicosia       66. Riyadh         78. Thimphu        90. Yerevan
  7. Ashgabat  19. Chongqing   31. Hong_Kong    43. Khandyga      55. Novokuznetsk  67. Sakhalin       79. Tokyo
  8. Atyrau    20. Colombo     32. Hovd         44. Kolkata       56. Novosibirsk   68. Samarkand      80. Tomsk
  9. Baghdad   21. Damascus    33. Irkutsk      45. Krasnoyarsk   57. Omsk          69. Seoul          81. Ujung_Pandang
  10. Bahrain  22. Dhaka       34. Istanbul     46. Kuala_Lumpur  58. Oral          70. Shanghai       82. Ulaanbaatar
  11. Baku     23. Dili        35. Jakarta      47. Kuching       59. Phnom_Penh    71. Singapore      83. Urumqi
  12. Bangkok  24. Dubai       36. Jayapura     48. Kuwait        60. Pontianak     72. Srednekolymsk  84. Ust-Nera
Time zone: 70


Current default time zone: 'Asia/Shanghai'
Local time is now:      Tue Nov 30 18:05:30 CST 2021.
Universal Time is now:  Tue Nov 30 10:05:30 UTC 2021.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

Set superuser:

root@32b7b9ddcaab:/# visudo

Add your own user name, save and exit:

neutionwei	ALL=(ALL:ALL) ALL

2, Download Linux_SDK

Go to Firefly's official website and download it. The link is as follows:

https://www.t-firefly.com/doc/download/107.html

Click the place pointed in the following picture to download:


Download the latest version:

Because it is a certain degree of network disk, the download speed is...

Finally, the download is complete. First, use md5sum to verify:

neutionwei@x:~/Download/rk356x_linux_release_v1.2.0_20211019_split_dir$ ls
md5sum.txt
README_EN.txt
README.txt
rk356x_linux_release_v1.2.0_20211019_firefly_split.file0
rk356x_linux_release_v1.2.0_20211019_firefly_split.file1
rk356x_linux_release_v1.2.0_20211019_firefly_split.file2
rk356x_linux_release_v1.2.0_20211019_firefly_split.file3
rk356x_linux_release_v1.2.0_20211019_firefly_split.file4
neutionwei@x:~/Download/rk356x_linux_release_v1.2.0_20211019_split_dir$  md5sum *firefly_split*
b633414d69240faa0c3bd755c255ede8  rk356x_linux_release_v1.2.0_20211019_firefly_split.file0
5cb1e2b63bbb4e3595c731038f6723fd  rk356x_linux_release_v1.2.0_20211019_firefly_split.file1
e06c0f29fd5a870e0942139a1877a470  rk356x_linux_release_v1.2.0_20211019_firefly_split.file2
4e14fbf72ccbb9b87f81d83a256205b0  rk356x_linux_release_v1.2.0_20211019_firefly_split.file3
be8b003703b51e7220e52bb36439a357  rk356x_linux_release_v1.2.0_20211019_firefly_split.file4

Confirm with md5sum in the directory Txt file content is correct!

3, Compiling Linux_SDK

Install the necessary tools according to the official Firefly Wiki:

neutionwei@32b7b9ddcaab:/$ sudo apt-get install repo git ssh make gcc libssl-dev liblz4-tool \
expect g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support \
qemu-user-static live-build bison flex fakeroot cmake gcc-multilib g++-multilib \
unzip device-tree-compiler python-pip ncurses-dev python-pyelftools

Create a new directory for Ubuntu 18.04:

neutionwei@32b7b9ddcaab:/$ cd ~
neutionwei@32b7b9ddcaab:~$ mkdir project
neutionwei@32b7b9ddcaab:~$ cd project/
neutionwei@32b7b9ddcaab:~/project$ pwd
/home/neutionwei/project

The host uses the docker command to convert Linux_ Copy SDK to Ubuntu 18.04 under docker:

neutionwei@x:~/Download$ docker cp rk356x_linux_release_v1.2.0_20211019_split_dir 32b7b9ddcaab:/home/neutionwei/project

Unzip Linux_SDK:

neutionwei@32b7b9ddcaab:~/project$ cat rk356x_linux_release_v1.2.0_20211019_split_dir/*firefly_split* | tar -xzv

Configure the board model and select roc-rk3568-pc-builderoot mk:

neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ls
Makefile  build.sh   debian  docs         external  mkfirmware.sh  rkbin       tools   yocto
app       buildroot  device  envsetup.sh  kernel    prebuilts      rkflash.sh  u-boot
neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ls device/rockchip/rk356x/
BoardConfig-rk3566-evb2-lp4x-v10-32bit.mk        aio-3568j-openwrt.mk                       parameter-buildroot-spi-nor-64M.txt
BoardConfig-rk3566-evb2-lp4x-v10.mk              aio-3568j-ubuntu.mk                        parameter-openwrt.txt
BoardConfig-rk3568-evb1-ddr4-v10-32bit.mk        boot.its                                   parameter-ubuntu-fit.txt
BoardConfig-rk3568-evb1-ddr4-v10-spi-nor-64M.mk  boot4recovery.its                          roc-rk3566-pc-buildroot.mk
BoardConfig-rk3568-evb1-ddr4-v10.mk              bootramdisk.its                            roc-rk3566-pc-lede.mk
BoardConfig-rk3568-nvr-spi-nand.mk               firefly-rk3566-buildroot.mk                roc-rk3566-pc-openwrt.mk
BoardConfig-rk3568-nvr.mk                        firefly-rk3566-ubuntu.mk                   roc-rk3566-pc-ubuntu.mk
BoardConfig-rk3568-uvc-evb1-ddr4-v10.mk          firefly-rk3568-buildroot.mk                roc-rk3568-pc-buildroot.mk
BoardConfig.mk                                   firefly-rk3568-nvr-buildroot.mk            roc-rk3568-pc-lede.mk
aio-3566-jd4-buildroot.mk                        firefly-rk3568-ubuntu.mk                   roc-rk3568-pc-openwrt.mk
aio-3566-jd4-ubuntu.mk                           firefly-rk356x-openwrt.mk                  roc-rk3568-pc-ubuntu.mk
aio-3568j-buildroot.mk                           parameter-buildroot-NVR-128M.txt           station-m2-ubuntu.mk
aio-3568j-lede.mk                                parameter-buildroot-NVR-spi-nand-128M.txt  station-p2-ubuntu.mk
aio-3568j-nvr.mk                                 parameter-buildroot-fit.txt                zboot.its
neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh roc-rk3568-pc-buildroot.mk
processing option: roc-rk3568-pc-buildroot.mk
switching to board: /home/neutionwei/project/rk356x_linux_release_20211019/device/rockchip/rk356x/roc-rk3568-pc-buildroot.mk

Start full compilation:

neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh all

Error during compilation:

/bin/sh: 1: bc: not found
Kbuild:42: recipe for target 'include/generated/timeconst.h' failed
make[1]: *** [include/generated/timeconst.h] Error 127
Makefile:1244: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
make: *** Waiting for unfinished jobs....
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/util.o
  LEX     scripts/dtc/dtc-lexer.lex.c
  YACC    scripts/dtc/dtc-parser.tab.h
  HOSTCC  scripts/resource_tool
  HOSTCC  scripts/mkkrnlimg
  HOSTCC  scripts/mod/sumversion.o
  YACC    scripts/dtc/dtc-parser.tab.c
  HOSTCC  scripts/sortextable
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTCC  scripts/extract-cert
  HOSTLD  scripts/mod/modpost
  HOSTLD  scripts/dtc/dtc
ERROR: Running build_kernel failed!
ERROR: exit code 2 from line 561:
    make ARCH=$RK_ARCH $RK_KERNEL_DTS.img -j$RK_JOBS

Install bc command:

neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ sudo apt install bc

Continue full compilation:

neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh all

There are still errors:

./build.sh: line 874: /usr/bin/time: No such file or directory
ERROR: Running build_recovery failed!
ERROR: exit code 127 from line 874:
    /usr/bin/time -f "you take %E to build recovery" $COMMON_DIR/mk-ramdisk.sh recovery.img $RK_CFG_RECOVERY

Install time command:

neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ sudo apt install time

Continue full compilation:

neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh all

If there are any missing commands in the process, continue the installation, and then continue the full compilation. The compilation process of builderoot is relatively long, because it involves the capture and of source code packages, and most of the source code package websites are not in China, so the capture speed is slow and even errors occur!

4, Package builderoot system firmware

Update package catalog soft link:

neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./mkfirmware.sh 

Package builderoot firmware:

neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh updateimg

The firmware we packaged is in / home/neutionwei/project/rk356x_linux_release_20211019/rockdev/pack / directory.

Use the docker command on the host to copy the firmware back to the host and burn it:

neutionwei@x:~/Download$ docker cp 32b7b9ddcaab:/home/neutionwei/project/rk356x_linux_release_20211019/rockdev/pack/ROC-RK3568-PC-Buildroot-GPT-20211231-2044.img .

Write to the end

The word "liver" is not easy, and the quality of Sanlian is my support and affirmation 😘

Keywords: Linux Operation & Maintenance server rk3568

Added by twizler on Fri, 31 Dec 2021 15:25:21 +0200