Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Rock5/guide/build-u-boot-on-5b"

< Rock5‎ | guide
(Created page with "{{rock5_header}} {{Languages|rock5/guide/build-u-boot-on-5b}} ROCK 5 > Guide > Build U-Boot on ROCK 5B...")
 
 
(5 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
     [[rock5 | ROCK 5]] > [[rock5/guide | Guide]] > [[rock5/guide/build-u-boot-on-5b | Build U-Boot on ROCK 5B]]
 
     [[rock5 | ROCK 5]] > [[rock5/guide | Guide]] > [[rock5/guide/build-u-boot-on-5b | Build U-Boot on ROCK 5B]]
  
== Build U-Boot on ROCK 5B ==
+
== Build Vendor U-Boot on Rock 5B ==
 +
Vendor U-Boot can be compiled and flashed on the Rock 5B device from the Linux distribution. For mainline U-boot, please check [https://gitlab.collabora.com/hardware-enablement/rockchip-3588/notes-for-rockchip-3588/-/blob/main/upstream_uboot.md collabora's upstream uboot note]
 +
 
 +
=== Preparation ===
 +
 
 +
1. Install the necessary build dependencies:
 +
 
 +
sudo apt-get update
 +
sudo apt-get install -y git  device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools bc python dosfstools flex bison
 +
 
 +
If you're not using Debian or Ubuntu, you'll need to install the equivalent packages for your distribution.
 +
 
 +
2. Set up your workspace and get the source code from the Radxa Git repositories:
 +
 
 +
mkdir ~/rk3588-sdk && cd ~/rk3588-sdk
 +
git clone -b stable-5.10-rock5 https://github.com/radxa/u-boot.git
 +
git clone -b master https://github.com/radxa/rkbin.git
 +
git clone -b debian https://github.com/radxa/build.git
 +
 
 +
And you will get
 +
 
 +
/~/rk3588-sdk/
 +
├── build
 +
├── rkbin
 +
└── u-boot
 +
 
 +
* <code>~/rk3588-sdk/build/</code>: Radxa helper script files and configuration files for building U-Boot, Linux kernel and rootfs.
 +
* <code>~/rk3588-sdk/rkbin/</code>: Pre-built Rockchip binaries, including first stage loader and ATF (Arm Trustzone Firmware)
 +
* <code>~/rk3588-sdk/u-boot/</code>: Second stage bootloader used to start the OS (e.g. Linux or Android)
 +
 
 +
=== Build U-Boot ===
 +
 
 +
Compile U-Boot with the <code>rock-5b-rk3588_defconfig</code>:
 +
cd ~/rk3588-sdk
 +
./build/mk-uboot.sh rk3588-rock-5b    #For ROCK 5B
 +
 
 +
After a successful build, the <code>~/rk3588-sdk/out/u-boot</code> directory will be populated
 +
~/rk3588-sdk/out/u-boot
 +
├── idbloader.img
 +
├── rk3588_spl_loader_v1.08.111.bin
 +
├── spi
 +
│  └── spi_image.img
 +
└── u-boot.itb
 +
 
 +
=== Flash U-Boot ===
 +
Once you've built U-Boot, you can flash it to your desired storage device.
 +
Booting directly from an NVMe device requires flashing U-Boot to SPI (see [[rock5/guide/spi-nvme-boot | SPI NVMe Boot Guide]]).
 +
 
 +
Note that [[Rock5/downloads | flashable OS images]] already include U-Boot, so manually flashing U-Boot is not necessary for eMMC or SD Card installs.
 +
 
 +
The following commands assume they are run from the <code>~/rk3588-sdk</code> directory.
 +
 
 +
===== eMMC =====
 +
⚠️ Some versions of the Rock 5B kernel have the eMMC and SD Card devices swapped
 +
 
 +
sudo dd if=./out/u-boot/idbloader.img of=/dev/mmcblk0 bs=512 seek=64
 +
sudo dd if=./out/u-boot/u-boot.itb of=/dev/mmcblk0 bs=512 seek=16384
 +
 
 +
===== SD Card =====
 +
⚠️ Some versions of the Rock 5B kernel have the eMMC and SD Card devices swapped
 +
 
 +
sudo dd if=./out/u-boot/idbloader.img of=/dev/mmcblk1 bs=512 seek=64
 +
sudo dd if=./out/u-boot/u-boot.itb of=/dev/mmcblk1 bs=512 seek=16384
 +
 
 +
===== SPI NOR =====
 +
sudo dd if=./out/u-boot/idbloader.img of=/dev/mtdblock0 bs=512 seek=64
 +
sudo dd if=./out/u-boot/u-boot.itb of=/dev/mtdblock0 bs=512 seek=16384
 +
 
 +
====== Alternative Method ======
 +
The Radxa U-Boot build scripts also produce a 16MB convenience image suitable for flashing to SPI.
 +
This image includes the first-stage loader (<code>idbloader.img</code>) and U-Boot (<code>u-boot.itb</code>) at the right offsets and is sized appropriately for the SPI chip but is otherwise identical to flashing the individual components.
 +
 +
sudo dd if=./out/u-boot/spi/spi_image.img of=/dev/mtdblock0 bs=512
 +
 
 +
=== Troubleshooting ===
 +
 
 +
Check [[rock5/FAQs |ROCK 5 FAQs]] first, if it doesn't help, start a new post on the forum https://forum.radxa.com/c/rock5.

Latest revision as of 10:30, 18 July 2023

    ROCK 5 >  Guide >  Build U-Boot on ROCK 5B

Build Vendor U-Boot on Rock 5B

Vendor U-Boot can be compiled and flashed on the Rock 5B device from the Linux distribution. For mainline U-boot, please check collabora's upstream uboot note

Preparation

1. Install the necessary build dependencies:

sudo apt-get update
sudo apt-get install -y git  device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools bc python dosfstools flex bison

If you're not using Debian or Ubuntu, you'll need to install the equivalent packages for your distribution.

2. Set up your workspace and get the source code from the Radxa Git repositories:

mkdir ~/rk3588-sdk && cd ~/rk3588-sdk
git clone -b stable-5.10-rock5 https://github.com/radxa/u-boot.git
git clone -b master https://github.com/radxa/rkbin.git
git clone -b debian https://github.com/radxa/build.git

And you will get

/~/rk3588-sdk/
├── build
├── rkbin
└── u-boot
  • ~/rk3588-sdk/build/: Radxa helper script files and configuration files for building U-Boot, Linux kernel and rootfs.
  • ~/rk3588-sdk/rkbin/: Pre-built Rockchip binaries, including first stage loader and ATF (Arm Trustzone Firmware)
  • ~/rk3588-sdk/u-boot/: Second stage bootloader used to start the OS (e.g. Linux or Android)

Build U-Boot

Compile U-Boot with the rock-5b-rk3588_defconfig:

cd ~/rk3588-sdk
./build/mk-uboot.sh rk3588-rock-5b     #For ROCK 5B

After a successful build, the ~/rk3588-sdk/out/u-boot directory will be populated

~/rk3588-sdk/out/u-boot
├── idbloader.img
├── rk3588_spl_loader_v1.08.111.bin
├── spi
│   └── spi_image.img
└── u-boot.itb

Flash U-Boot

Once you've built U-Boot, you can flash it to your desired storage device. Booting directly from an NVMe device requires flashing U-Boot to SPI (see SPI NVMe Boot Guide).

Note that flashable OS images already include U-Boot, so manually flashing U-Boot is not necessary for eMMC or SD Card installs.

The following commands assume they are run from the ~/rk3588-sdk directory.

eMMC

⚠️ Some versions of the Rock 5B kernel have the eMMC and SD Card devices swapped

sudo dd if=./out/u-boot/idbloader.img of=/dev/mmcblk0 bs=512 seek=64
sudo dd if=./out/u-boot/u-boot.itb of=/dev/mmcblk0 bs=512 seek=16384
SD Card

⚠️ Some versions of the Rock 5B kernel have the eMMC and SD Card devices swapped

sudo dd if=./out/u-boot/idbloader.img of=/dev/mmcblk1 bs=512 seek=64
sudo dd if=./out/u-boot/u-boot.itb of=/dev/mmcblk1 bs=512 seek=16384
SPI NOR
sudo dd if=./out/u-boot/idbloader.img of=/dev/mtdblock0 bs=512 seek=64
sudo dd if=./out/u-boot/u-boot.itb of=/dev/mtdblock0 bs=512 seek=16384
Alternative Method

The Radxa U-Boot build scripts also produce a 16MB convenience image suitable for flashing to SPI. This image includes the first-stage loader (idbloader.img) and U-Boot (u-boot.itb) at the right offsets and is sized appropriately for the SPI chip but is otherwise identical to flashing the individual components.

sudo dd if=./out/u-boot/spi/spi_image.img of=/dev/mtdblock0 bs=512

Troubleshooting

Check ROCK 5 FAQs first, if it doesn't help, start a new post on the forum https://forum.radxa.com/c/rock5.