Dockerized build system for Linux kernel & related (e.g. U-Boot) components for the Radxa Rock 5 series of devices
- Docker w/ buildx plugin
- If
docker buildx inspectworks, you're all set!
- If
amd64orarm64hostamd64usesgcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnuas provided by Radxa for cross-compilation (no configuration needed)
Run docker buildx bake from the repo root to build the Kernel and stable U-Boot.
Individual groups and targets also exist if you don't want to build everything or want to use one of the experimental targets.
Artifacts will be output to out/ in the repo root:
out
├── edk2
│ └── RK3588_NOR_FLASH.img
├── kernel
│ ├── dtb
│ │ └── rockchip
│ │ ├── overlay
│ │ ├── rk3588-rock-5b.dtb
│ │ └── rk3588-rock-5b-v11.dtb
│ ├── lib
│ │ └── modules
│ │ └── 5.10.110-gd0b0fd354269
│ └── vmlinuz
└── u-boot
├── collabora
│ ├── idbloader.img
│ ├── rk3588_spl_loader_v1.08.111.bin
│ ├── spi
│ │ └── spi_image.img
│ └── u-boot.itb
└── radxa
├── idbloader.img
├── rk3588_spl_loader_v1.08.111.bin
├── spi
│ └── spi_image.img
└── u-boot.itb
Upstream: https://github.com/radxa/kernel/tree/linux-5.10-gen-rkr3.4
docker buildx bake kernelout/kernel
├── dtb
│ └── rockchip
│ ├── overlay
│ ├── rk3588-rock-5b.dtb
│ └── rk3588-rock-5b-v11.dtb
├── lib
│ └── modules
│ └── 5.10.110-gd0b0fd354269
└── vmlinuz
# note: tree listing limited to three levels
You can generate a custom kernel config with the defconfig.sh script in this repo:
./defconfig.shThis builds an image with the kernel sources and then runs make menuconfig in a container.
Afterwards, the resulting configuration is copied to the current working directory as rockchip_linux_defconfig.
Then, set the DEFCONFIG environment variable to the current directory:
DEFCONFIG='.' docker buildx bake kernelThis adds your current directory as an extra context for the build.
The build will then copy & use rockchip_linux_config from your current directory to be used instead of the default Radxa config.
The buildx u-boot group will build both the stable U-Boot from Radxa as well as the experimental build from Collabora's mainline fork.
Once the Collabora patches have been merged into upstream U-Boot, a target will be added to build directly from that and building from Collabora's fork will eventually be deprecated.
Upstream: https://github.com/radxa/u-boot/tree/stable-5.10-rock5
docker buildx bake u-boot-radxaout/u-boot
└── radxa
├── idbloader.img
├── rk3588_spl_loader_v1.08.111.bin
├── spi
│ └── spi_image.img
└── u-boot.itb
Upstream: https://gitlab.collabora.com/hardware-enablement/rockchip-3588/u-boot/-/tree/2023.04-rc2-rock5b
Collabora is working on upstreaming RK3588 support into mainline U-Boot. The first set of patches have been submitted as of February 2023. See details at RK3588 Mainline U-Boot Instructions.
docker buildx bake u-boot-collaboraout/u-boot
└── collabora
├── idbloader.img
├── rk3588_spl_loader_v1.08.111.bin
├── spi
│ └── spi_image.img
└── u-boot.itb
💁 Put the device into maskrom mode before proceeding!
🐳 Replace
sudo rkdeveloptoolwith./rkdeveloptool-docker.shto run via container (more details in therkdeveloptool(via Docker) section)
First, run the bootloader to initialize the device for flashing:
sudo rkdeveloptool db ./out/rk3588_spl_loader_v1.08.111.binThe spi_image.img includes the pre-loader and U-Boot at the right offsets and is sized for the SPI chip.
docker buildx bake spl
sudo rkdeveloptool wl 0x0 ./out/u-boot/radxa/spi/spi_image.imgAlternatively, you can write the individual components at their offsets.
This is helpful for non-SPI (e.g. eMMC) to avoid destroying the GPT partition table.
- Flash pre-loader:
sudo rkdeveloptool wl 0x40 ./out/u-boot/idbloader.img
- Flash U-Boot:
sudo rkdeveloptool wl 0x4000 ./out/u-boot/u-boot.itb
Upstream: https://github.com/edk2-porting/edk2-rk35xx
docker buildx bake edk2out/edk2
└── RK3588_NOR_FLASH.img
Upstream: https://github.com/rockchip-linux/rkdeveloptool
This is a Dockerized build for rkdeveloptool, which can be run as a privileged container with /dev/usb bind-mounted from the host.
A helper script, rkdeveloptool-docker.sh, is provided:
./rkdeveloptool-docker.sh ldDevNo=1 Vid=0x2207,Pid=0x350b,LocationID=704 Maskrom
The out/ directory will be bind-mounted to /out.
If you're in the repo root directory, this means you can use relative paths:
# get the latest spl loader from radxa repos
docker buildx bake spl
# initialize the bootloader on the device in maskrom mode
./rkdeveloptool-docker.sh db ./out/rk3588_spl_loader_v1.08.111.binDisable USB auto-suspend (run this on your host machine, not via Docker):
sudo sh -c 'echo -1 > /sys/module/usbcore/parameters/autosuspend'NOTE: This won't be preserved across reboots.