Difference between revisions of "Buildroot"
(→Q&A) |
(updated by API) |
||
(19 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
==Introduction to Buildroot== | ==Introduction to Buildroot== | ||
− | {{RK3399 Buildroot Intro}} | + | {{RK3399 Buildroot Intro|NanoPC-T4}} |
==Download Images of Trial Version== | ==Download Images of Trial Version== | ||
− | Visit [http://download. | + | ===Buildroot for RK3588=== |
+ | Visit [http://download.friendlyelec.com/nanopct6 Download Link]Download:<br /> | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| colspan=2 | Image Files | | colspan=2 | Image Files | ||
|- | |- | ||
− | | | + | | rk3588-sd-buildroot-6.1-arm64-YYYYMMDD.img.gz |
| OS image booting from SD card | | OS image booting from SD card | ||
|- | |- | ||
− | | | + | | rk3588-eflasher-buildroot-YYYYMMDD.img.gz |
| Image used to flash to eMMC | | Image used to flash to eMMC | ||
|} | |} | ||
+ | ===Buildroot for RK3568=== | ||
+ | Visit [http://download.friendlyelec.com/nanopir5s Download Link]Download:<br /> | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | colspan=2 | Image Files | ||
+ | |- | ||
+ | | rk3568-sd-buildroot-6.1-arm64-YYYYMMDD.img.gz | ||
+ | | OS image booting from SD card | ||
+ | |- | ||
+ | | rk3568-eflasher-buildroot-YYYYMMDD.img.gz | ||
+ | | Image used to flash to eMMC | ||
+ | |} | ||
+ | ===Buildroot for RK3399=== | ||
+ | Visit [http://download.friendlyelec.com/nanopct4 Download Link]Download:<br /> | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | colspan=2 | Image Files | ||
+ | |- | ||
+ | | rk3399-sd-buildroot-linux-4.19-arm64-YYYYMMDD.img.zip | ||
+ | | OS image booting from SD card | ||
+ | |- | ||
+ | | rk3399-eflasher-buildroot-4.19-arm64-YYYYMMDD.img.gz | ||
+ | | Image used to flash to eMMC | ||
+ | |} | ||
+ | ===Buildroot for RK3328=== | ||
+ | Visit [http://download.friendlyelec.com/nanopir2cplus Download Link]Download:<br /> | ||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | colspan=2 | Image Files | ||
+ | |- | ||
+ | | rk3328-sd-buildroot-linux-4.19-arm64-YYYYMMDD.img.zip | ||
+ | | OS image booting from SD card | ||
+ | |- | ||
+ | | rk3328-eflasher-buildroot-4.19-arm64-YYYYMMDD.img.gz | ||
+ | | Image used to flash to eMMC | ||
+ | |} | ||
+ | |||
After extract the file you can use either dd or the win32image utility to flash the image to an SD card. | After extract the file you can use either dd or the win32image utility to flash the image to an SD card. | ||
==User Name and Password== | ==User Name and Password== | ||
Line 21: | Line 59: | ||
Password: rockchip<br /> | Password: rockchip<br /> | ||
<br /> | <br /> | ||
+ | To change the password, please modify the following file: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | buildroot/configs/rockchip/network.config # branch: rockchip-kernel4.19 | ||
+ | buildroot/configs/rockchip/base/common.config # branch: rockchip-kernel5.10 / rockchip-kernel6.1 | ||
+ | </syntaxhighlight> | ||
+ | ==Connect WiFi== | ||
+ | * Edit /etc/wpa_supplicant.conf, fill in the ssid and psk with the WiFi information you want to connect to | ||
+ | * Start the wpa_supplicant process with the following command | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf | ||
+ | </syntaxhighlight> | ||
+ | * If there is no error, you can check the ip address with the command 'ifconfig wlan0' | ||
==Obtain Source Code== | ==Obtain Source Code== | ||
===Install repo Utility=== | ===Install repo Utility=== | ||
Install the repo utility: | Install the repo utility: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | git clone https://github.com/friendlyarm/repo | + | git clone https://github.com/friendlyarm/repo --depth 1 |
− | cp repo/repo /usr/bin/ | + | sudo cp repo/repo /usr/bin/ |
+ | </syntaxhighlight> | ||
+ | Install the git-lfs utility: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo apt update | ||
+ | sudo apt install git-lfs | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Download Source Code=== | ===Download Source Code=== | ||
You can retrieve a project's source code in either of the following two ways. The first works better with Mainland Chinese users: | You can retrieve a project's source code in either of the following two ways. The first works better with Mainland Chinese users: | ||
− | ====1: Retrieve Repo Package from | + | ====1: Retrieve Repo Package from NetDrive==== |
− | Download link: [http://download. | + | Download link: [http://download.friendlyelec.com/nanopct6 RK3588] [http://download.friendlyelec.com/nanopir5s RK3568] [http://download.friendlyelec.com/nanopct4 RK3399] [http://download.friendlyelec.com/nanopir2cplus RK3328]<br /> |
− | File location: | + | File location: '07_Source codes'/buildroot-rkXXXX-YYYYMMDD.tar (YYYYMMDD stands for the data when the package is generated)<br /> |
After you get a tar package, untar it and run the following command to extract it: | After you get a tar package, untar it and run the following command to extract it: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | tar xvf /path/to/ | + | tar xvf /path/to/netdrive/'07_Source codes'/buildroot-rkXXXX-YYYYMMDD.tar |
− | cd | + | cd buildroot-rkXXXX |
− | repo sync -l | + | repo sync -l --no-clone-bundle |
+ | (cd external && ./get_libgenmeshlib.sh) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
If you want to get the latest official source code you can run the following commands: | If you want to get the latest official source code you can run the following commands: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | cd | + | cd buildroot-rkXXXX |
− | repo sync | + | repo sync --no-clone-bundle |
</syntaxhighlight> | </syntaxhighlight> | ||
====2: Retrive Repo Package from Github==== | ====2: Retrive Repo Package from Github==== | ||
+ | =====Buildroot for RK3588===== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | mkdir | + | mkdir buildroot-rk3588 |
− | cd | + | cd buildroot-rk3588 |
− | repo init -u https://github.com/friendlyarm/buildroot_manifests -b | + | repo init -u https://github.com/friendlyarm/buildroot_manifests \ |
− | repo sync -c | + | -b rockchip-kernel6.1 -m rk3588.xml --repo-url=https://github.com/friendlyarm/repo \ |
+ | --no-clone-bundle | ||
+ | repo sync -c --no-clone-bundle | ||
+ | (cd external && ./get_libgenmeshlib.sh) | ||
+ | </syntaxhighlight> | ||
+ | =====Buildroot for RK3568===== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | mkdir buildroot-rk3568 | ||
+ | cd buildroot-rk3568 | ||
+ | repo init -u https://github.com/friendlyarm/buildroot_manifests \ | ||
+ | -b rockchip-kernel6.1 -m rk3568.xml --repo-url=https://github.com/friendlyarm/repo \ | ||
+ | --no-clone-bundle | ||
+ | repo sync -c --no-clone-bundle | ||
+ | (cd external && ./get_libgenmeshlib.sh) | ||
+ | </syntaxhighlight> | ||
+ | =====Buildroot for RK3399===== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | mkdir buildroot-rk3399 | ||
+ | cd buildroot-rk3399 | ||
+ | repo init -u https://github.com/friendlyarm/buildroot_manifests \ | ||
+ | -b rockchip-kernel4.19 -m rk3399.xml --repo-url=https://github.com/friendlyarm/repo \ | ||
+ | --no-clone-bundle | ||
+ | repo sync -c --no-clone-bundle | ||
+ | </syntaxhighlight> | ||
+ | =====Buildroot for RK3328===== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | mkdir buildroot-rk3328 | ||
+ | cd buildroot-rk3328 | ||
+ | repo init -u https://github.com/friendlyarm/buildroot_manifests \ | ||
+ | -b rockchip-kernel4.19 -m rk3328.xml --repo-url=https://github.com/friendlyarm/repo \ | ||
+ | --no-clone-bundle | ||
+ | repo sync -c --no-clone-bundle | ||
</syntaxhighlight> | </syntaxhighlight> | ||
====Get Latest Version with Sync==== | ====Get Latest Version with Sync==== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | repo sync -c --no-clone-bundle | |
− | repo sync -c | + | |
</syntaxhighlight> | </syntaxhighlight> | ||
If your network connection is broken during sync you can run the following script to do it: | If your network connection is broken during sync you can run the following script to do it: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
#! /bin/bash | #! /bin/bash | ||
− | repo sync -c | + | repo sync -c --no-clone-bundle |
while [ $? -ne 0 ]; | while [ $? -ne 0 ]; | ||
do | do | ||
− | repo sync -c | + | repo sync -c --no-clone-bundle |
done | done | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
==Compile Source Code== | ==Compile Source Code== | ||
− | ===Setup | + | ===Setup Development Environment=== |
− | + | You need a host PC running a 64-bit Ubuntu 20.04 system and run the following command on the PC: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | wget -O - https://raw.githubusercontent.com/friendlyarm/build-env-on-ubuntu-bionic/master/install.sh | bash | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | ===Build buildroot in Docker container=== | ||
+ | Please use the Docker image provided by this link, for details, please refer to the README document:<br /> | ||
+ | [https://github.com/friendlyarm/docker-cross-compiler-novnc docker-cross-compiler-novnc]<br /> | ||
− | === | + | ===Get Help Info=== |
+ | Run the build.sh script without any options it will print the help information: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | ./build.sh | + | ./build.sh |
</syntaxhighlight> | </syntaxhighlight> | ||
− | ===Compile | + | Let's take RK3588 as an example, the help information will be presented as follows: |
+ | <syntaxhighlight lang="bash"> | ||
+ | USAGE: ./build.sh <parameter> | ||
+ | |||
+ | # Select CPU model: | ||
+ | ./build.sh rk3588 | ||
+ | |||
+ | # Select Module: | ||
+ | ./build.sh all -compile all | ||
+ | ./build.sh uboot -compile uboot | ||
+ | ./build.sh kernel -compile kernel | ||
+ | ./build.sh buildroot -compile buildroot | ||
+ | ./build.sh sd-img -generate an image for an sd card | ||
+ | ./build.sh emmc-img -generate an image for emmc (the generated image should be flased to an SD card and then flashed to emm with this SD card) | ||
+ | # Clean: | ||
+ | ./build.sh clean -remove old images | ||
+ | ./build.sh cleanall | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ===Auto Compile=== | ||
+ | For a first time compilation you need to select an board: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | ./build.sh rk3588 | ||
+ | </syntaxhighlight> | ||
+ | After the script is done successfully all components including a u-boot, a kernel and a buildroot will be compiled, and an image file will be generated. | ||
+ | |||
+ | ===Compile Individual Component=== | ||
====kernel==== | ====kernel==== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 92: | Line 202: | ||
./build.sh uboot | ./build.sh uboot | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | ==== | + | ====buildroot==== |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | ./build.sh | + | ./build.sh buildroot |
</syntaxhighlight> | </syntaxhighlight> | ||
===Generate Image for SD Card=== | ===Generate Image for SD Card=== | ||
Line 100: | Line 210: | ||
sudo ./build.sh sd-img | sudo ./build.sh sd-img | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | If an img file is generated successfully you will see the following messages. You can use the "dd" command to flash the img file to an SD card. Note: you will need to replace "/dev/sdX" with the actual device name which your system recognizes the device as:<br /> | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | Run the following for sdcard install: | |
+ | sudo dd if=out/buildroot_20211213_rk3588_arm64_sd.img bs=1M of=/dev/sdX | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ===Generate emmc (eflasher) Image=== | |
− | ===Generate | + | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo ./build.sh emmc-img | sudo ./build.sh emmc-img | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | If an img file is generated successfully you will see the following messages. You can use the "dd" command to flash the img file to an SD card. Note: you will need to replace "/dev/sdX" with the actual device name which your system recognizes the device as:<br /> | |
− | + | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | Run the following for sdcard install: | |
− | = | + | sudo dd if=out/buildroot_20211213_rk3588_arm64_eflasher.img bs=1M of=/dev/sdX |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Use this SD card to boot the eflasher system and run eflasher commands to install an OS to emmc. After installation is done, take off the SD card of the board and boot your system buildroot will load from eMMC. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
==Customize Buildroot== | ==Customize Buildroot== | ||
===Structure of Directories=== | ===Structure of Directories=== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | ├── | + | ├── buildroot-xxyyzz |
− | + | │ ├── buildroot -> buildroot's source code | |
− | │ ├── buildroot buildroot's | + | │ └── toolchain -> cross-compiler, used for compiling a u-boot and kernel |
− | │ | + | │ ├── build.sh -> build script |
− | │ ├── | + | │ ├── device/friendlyelec -> configuration file for friendlyelec boards |
− | + | │ ├── kernel -> kernel | |
− | + | │ └── u-boot -> u-boot | |
− | + | │ └── app -> rockchip app | |
− | + | │ └── external -> rockchip buildroot package | |
− | │ ├── friendlyelec configuration | + | │ └── rkbin -> rockchip loader binaries |
− | │ ├── kernel kernel | + | │ └── scripts -> script files for generating an img |
− | │ | + | |
− | │ | + | |
− | │ | + | |
− | │ | + | |
− | + | ||
− | + | ||
− | + | ||
− | │ └── | + | |
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
====Update Buildroot Configurations==== | ====Update Buildroot Configurations==== | ||
* List Available Configurations | * List Available Configurations | ||
Line 170: | Line 248: | ||
make list-defconfigs | make list-defconfigs | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | The configuration of FriendlyELEC RK3588:<br /> | |
− | + | configs/rockchip_rk3588_defconfig<br /> | |
* Update Configurations Using menuconfig | * Update Configurations Using menuconfig | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | make | + | make rockchip_rk3588_defconfig |
make menuconfig | make menuconfig | ||
make savedefconfig | make savedefconfig | ||
− | + | cp .defconfig configs/rockchip_rk3588_defconfig | |
− | cp .defconfig configs/ | + | |
</syntaxhighlight> | </syntaxhighlight> | ||
* Recompile | * Recompile | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cd ../ | cd ../ | ||
− | ./build.sh | + | ./build.sh buildroot |
</syntaxhighlight> | </syntaxhighlight> | ||
===Customize File System=== | ===Customize File System=== | ||
− | Put | + | Put the file in device/friendlyelec/misc-files, then repackage the img: |
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo ./build.sh sd-img | ||
+ | sudo ./build.sh emmc-img | ||
+ | </syntaxhighlight> | ||
===Update U-boot and Kernel=== | ===Update U-boot and Kernel=== | ||
You can do it by directly updating the files in the u-boot and kernel directories. | You can do it by directly updating the files in the u-boot and kernel directories. | ||
===Use Cross Compiler in SDK=== | ===Use Cross Compiler in SDK=== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | export PATH=$PWD/buildroot/output/ | + | export PATH=$PWD/buildroot/output/rockchip_rk3588/host/bin/:$PATH |
aarch64-buildroot-linux-gnu-g++ -v | aarch64-buildroot-linux-gnu-g++ -v | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Version information:<br /> | Version information:<br /> | ||
− | gcc version | + | gcc version 12.3.0 (Buildroot -gcfced2b28e) |
+ | <!-- | ||
===Cross Compile Qt Program=== | ===Cross Compile Qt Program=== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 204: | Line 286: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
You can auto-run your Qt program on system boot. For example you want to auto-run a QtE-Demo program. Firstly you can copy the QtE-Demo to your board, open and edit the S50launcher file under the "/etc/init.d/" directory, replace "/usr/local/QLauncher/QLauncher &" with the full path of your QtE-Demo program. | You can auto-run your Qt program on system boot. For example you want to auto-run a QtE-Demo program. Firstly you can copy the QtE-Demo to your board, open and edit the S50launcher file under the "/etc/init.d/" directory, replace "/usr/local/QLauncher/QLauncher &" with the full path of your QtE-Demo program. | ||
+ | --> | ||
+ | ==Enabling ADB== | ||
+ | Enable on Startup | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | mv /etc/init.d/K50usbdevice.sh /etc/init.d/S50usbdevice.sh | ||
+ | reboot | ||
+ | </syntaxhighlight> | ||
+ | Enable Temporarily | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | usbdevice-wrapper start | ||
+ | </syntaxhighlight> | ||
==Q&A== | ==Q&A== | ||
===Generate Image File for Flashing with USB Type-C=== | ===Generate Image File for Flashing with USB Type-C=== | ||
− | After you run the "build.sh emmc-img" command a "buildroot" directory will be generated under the " | + | After you run the "build.sh emmc-img" command a "buildroot" directory will be generated under the "scripts/sd-fuse" directory. You can use the android_tools to load all the files under this "buildroot" directory. |
− | + | ==Report bug== | |
+ | Please mail-to:techsupport@friendlyarm.com<br /> | ||
==Update Log== | ==Update Log== | ||
+ | ===2024-09-29=== | ||
+ | * rk3568/rk3588: update buildroot to linux-5.10-gen-rkr8 | ||
+ | ===2023-08-15=== | ||
+ | * add support for rk3588 | ||
+ | * update buildroot to linux-5.10-gen-rkr5.1 | ||
+ | ===2022-07-20=== | ||
+ | * add support for rk3568 | ||
+ | * update buildroot | ||
+ | ===2021-12-23=== | ||
+ | * Simplify the build script and update buildroot | ||
===May-16-2019=== | ===May-16-2019=== | ||
* Released English version | * Released English version |
Latest revision as of 17:21, 6 October 2024
Contents
1 Introduction to Buildroot
Buildroot is a simple, efficient and easy-to-use tool to generate embedded Linux systems through cross-compilation. It contains a boot-loader, kernel, rootfs, various libraries and utilities(e.g. qt, gstreamer, busybox etc).
FriendlyELEC's Buildroot is based on Rockchip's version which is made with linux-sdk and maintained with git. FriendlyELEC's version is synced with Rockchip's version;
- Rockchip's Buildroot: https://github.com/rockchip-linux/buildroot
- Buildroot's official site: https://buildroot.org
Here is what Buildroot for rockchip looks like
2 Download Images of Trial Version
2.1 Buildroot for RK3588
Visit Download LinkDownload:
Image Files | |
rk3588-sd-buildroot-6.1-arm64-YYYYMMDD.img.gz | OS image booting from SD card |
rk3588-eflasher-buildroot-YYYYMMDD.img.gz | Image used to flash to eMMC |
2.2 Buildroot for RK3568
Visit Download LinkDownload:
Image Files | |
rk3568-sd-buildroot-6.1-arm64-YYYYMMDD.img.gz | OS image booting from SD card |
rk3568-eflasher-buildroot-YYYYMMDD.img.gz | Image used to flash to eMMC |
2.3 Buildroot for RK3399
Visit Download LinkDownload:
Image Files | |
rk3399-sd-buildroot-linux-4.19-arm64-YYYYMMDD.img.zip | OS image booting from SD card |
rk3399-eflasher-buildroot-4.19-arm64-YYYYMMDD.img.gz | Image used to flash to eMMC |
2.4 Buildroot for RK3328
Visit Download LinkDownload:
Image Files | |
rk3328-sd-buildroot-linux-4.19-arm64-YYYYMMDD.img.zip | OS image booting from SD card |
rk3328-eflasher-buildroot-4.19-arm64-YYYYMMDD.img.gz | Image used to flash to eMMC |
After extract the file you can use either dd or the win32image utility to flash the image to an SD card.
3 User Name and Password
User name: root
Password: rockchip
To change the password, please modify the following file:
buildroot/configs/rockchip/network.config # branch: rockchip-kernel4.19 buildroot/configs/rockchip/base/common.config # branch: rockchip-kernel5.10 / rockchip-kernel6.1
4 Connect WiFi
- Edit /etc/wpa_supplicant.conf, fill in the ssid and psk with the WiFi information you want to connect to
- Start the wpa_supplicant process with the following command
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
- If there is no error, you can check the ip address with the command 'ifconfig wlan0'
5 Obtain Source Code
5.1 Install repo Utility
Install the repo utility:
git clone https://github.com/friendlyarm/repo --depth 1 sudo cp repo/repo /usr/bin/
Install the git-lfs utility:
sudo apt update sudo apt install git-lfs
5.2 Download Source Code
You can retrieve a project's source code in either of the following two ways. The first works better with Mainland Chinese users:
5.2.1 1: Retrieve Repo Package from NetDrive
Download link: RK3588 RK3568 RK3399 RK3328
File location: '07_Source codes'/buildroot-rkXXXX-YYYYMMDD.tar (YYYYMMDD stands for the data when the package is generated)
After you get a tar package, untar it and run the following command to extract it:
tar xvf /path/to/netdrive/'07_Source codes'/buildroot-rkXXXX-YYYYMMDD.tar cd buildroot-rkXXXX repo sync -l --no-clone-bundle (cd external && ./get_libgenmeshlib.sh)
If you want to get the latest official source code you can run the following commands:
cd buildroot-rkXXXX repo sync --no-clone-bundle
5.2.2 2: Retrive Repo Package from Github
5.2.2.1 Buildroot for RK3588
mkdir buildroot-rk3588 cd buildroot-rk3588 repo init -u https://github.com/friendlyarm/buildroot_manifests \ -b rockchip-kernel6.1 -m rk3588.xml --repo-url=https://github.com/friendlyarm/repo \ --no-clone-bundle repo sync -c --no-clone-bundle (cd external && ./get_libgenmeshlib.sh)
5.2.2.2 Buildroot for RK3568
mkdir buildroot-rk3568 cd buildroot-rk3568 repo init -u https://github.com/friendlyarm/buildroot_manifests \ -b rockchip-kernel6.1 -m rk3568.xml --repo-url=https://github.com/friendlyarm/repo \ --no-clone-bundle repo sync -c --no-clone-bundle (cd external && ./get_libgenmeshlib.sh)
5.2.2.3 Buildroot for RK3399
mkdir buildroot-rk3399 cd buildroot-rk3399 repo init -u https://github.com/friendlyarm/buildroot_manifests \ -b rockchip-kernel4.19 -m rk3399.xml --repo-url=https://github.com/friendlyarm/repo \ --no-clone-bundle repo sync -c --no-clone-bundle
5.2.2.4 Buildroot for RK3328
mkdir buildroot-rk3328 cd buildroot-rk3328 repo init -u https://github.com/friendlyarm/buildroot_manifests \ -b rockchip-kernel4.19 -m rk3328.xml --repo-url=https://github.com/friendlyarm/repo \ --no-clone-bundle repo sync -c --no-clone-bundle
5.2.3 Get Latest Version with Sync
repo sync -c --no-clone-bundle
If your network connection is broken during sync you can run the following script to do it:
#! /bin/bash repo sync -c --no-clone-bundle while [ $? -ne 0 ]; do repo sync -c --no-clone-bundle done
6 Compile Source Code
6.1 Setup Development Environment
You need a host PC running a 64-bit Ubuntu 20.04 system and run the following command on the PC:
wget -O - https://raw.githubusercontent.com/friendlyarm/build-env-on-ubuntu-bionic/master/install.sh | bash
6.2 Build buildroot in Docker container
Please use the Docker image provided by this link, for details, please refer to the README document:
docker-cross-compiler-novnc
6.3 Get Help Info
Run the build.sh script without any options it will print the help information:
./build.sh
Let's take RK3588 as an example, the help information will be presented as follows:
USAGE: ./build.sh <parameter> # Select CPU model: ./build.sh rk3588 # Select Module: ./build.sh all -compile all ./build.sh uboot -compile uboot ./build.sh kernel -compile kernel ./build.sh buildroot -compile buildroot ./build.sh sd-img -generate an image for an sd card ./build.sh emmc-img -generate an image for emmc (the generated image should be flased to an SD card and then flashed to emm with this SD card) # Clean: ./build.sh clean -remove old images ./build.sh cleanall
6.4 Auto Compile
For a first time compilation you need to select an board:
./build.sh rk3588
After the script is done successfully all components including a u-boot, a kernel and a buildroot will be compiled, and an image file will be generated.
6.5 Compile Individual Component
6.5.1 kernel
./build.sh kernel
6.5.2 u-boot
./build.sh uboot
6.5.3 buildroot
./build.sh buildroot
6.6 Generate Image for SD Card
sudo ./build.sh sd-img
If an img file is generated successfully you will see the following messages. You can use the "dd" command to flash the img file to an SD card. Note: you will need to replace "/dev/sdX" with the actual device name which your system recognizes the device as:
Run the following for sdcard install: sudo dd if=out/buildroot_20211213_rk3588_arm64_sd.img bs=1M of=/dev/sdX
6.7 Generate emmc (eflasher) Image
sudo ./build.sh emmc-img
If an img file is generated successfully you will see the following messages. You can use the "dd" command to flash the img file to an SD card. Note: you will need to replace "/dev/sdX" with the actual device name which your system recognizes the device as:
Run the following for sdcard install: sudo dd if=out/buildroot_20211213_rk3588_arm64_eflasher.img bs=1M of=/dev/sdX
Use this SD card to boot the eflasher system and run eflasher commands to install an OS to emmc. After installation is done, take off the SD card of the board and boot your system buildroot will load from eMMC.
7 Customize Buildroot
7.1 Structure of Directories
├── buildroot-xxyyzz │ ├── buildroot -> buildroot's source code │ └── toolchain -> cross-compiler, used for compiling a u-boot and kernel │ ├── build.sh -> build script │ ├── device/friendlyelec -> configuration file for friendlyelec boards │ ├── kernel -> kernel │ └── u-boot -> u-boot │ └── app -> rockchip app │ └── external -> rockchip buildroot package │ └── rkbin -> rockchip loader binaries │ └── scripts -> script files for generating an img
7.1.1 Update Buildroot Configurations
- List Available Configurations
cd buildroot make list-defconfigs
The configuration of FriendlyELEC RK3588:
configs/rockchip_rk3588_defconfig
- Update Configurations Using menuconfig
make rockchip_rk3588_defconfig make menuconfig make savedefconfig cp .defconfig configs/rockchip_rk3588_defconfig
- Recompile
cd ../ ./build.sh buildroot
7.2 Customize File System
Put the file in device/friendlyelec/misc-files, then repackage the img:
sudo ./build.sh sd-img sudo ./build.sh emmc-img
7.3 Update U-boot and Kernel
You can do it by directly updating the files in the u-boot and kernel directories.
7.4 Use Cross Compiler in SDK
export PATH=$PWD/buildroot/output/rockchip_rk3588/host/bin/:$PATH aarch64-buildroot-linux-gnu-g++ -v
Version information:
gcc version 12.3.0 (Buildroot -gcfced2b28e)
8 Enabling ADB
Enable on Startup
mv /etc/init.d/K50usbdevice.sh /etc/init.d/S50usbdevice.sh reboot
Enable Temporarily
usbdevice-wrapper start
9 Q&A
9.1 Generate Image File for Flashing with USB Type-C
After you run the "build.sh emmc-img" command a "buildroot" directory will be generated under the "scripts/sd-fuse" directory. You can use the android_tools to load all the files under this "buildroot" directory.
10 Report bug
Please mail-to:techsupport@friendlyarm.com
11 Update Log
11.1 2024-09-29
- rk3568/rk3588: update buildroot to linux-5.10-gen-rkr8
11.2 2023-08-15
- add support for rk3588
- update buildroot to linux-5.10-gen-rkr5.1
11.3 2022-07-20
- add support for rk3568
- update buildroot
11.4 2021-12-23
- Simplify the build script and update buildroot
11.5 May-16-2019
- Released English version