Overview
The R-Car V4H SH uses Linux kernel 6.18.39 from the R-Car Community team, whose sources live in linux-sh. Every component is rebuilt on an Ubuntu 24.04 host.
Every input the board boots is built from source by the rcar-utils build scripts, which provide one target per component:
Target |
Builds |
|---|---|
|
Kernel image, device trees and loadable kernel modules. |
|
Out-of-tree kernel modules: |
|
ARM Trusted Firmware BL31 blob, loaded by the bootable FIT configurations. |
|
|
|
|
The following figure shows the overall workflow covered in this section, from setting up the build host to deploying the FIT image and kernel modules to the board and verifying the update:
Common system configuration workflow overview
Prerequisites
Item |
Description / Link |
|---|---|
Build host |
Ubuntu 24.04, either a physical machine or a Docker container based on an Ubuntu 24.04 image. The latter also covers Windows and macOS hosts. |
Linux kernel source code for the R-Car V4H SH. |
|
Build scripts used throughout this section. |
|
Internet access |
Required to clone the sources and download the build dependencies. |
SSH and rsync access |
Between build host and target board, with |
Available AI Agent Skills
Skills for the R-Car V4H SH kernel build, located in
rcar-utils/.claude/skills/<name>/SKILL.md.
Skill |
Purpose |
Use when |
|---|---|---|
|
Entry point; orients you in the repo and dispatches to the right skill |
New to the repo, or unsure which skill applies |
|
Install host packages, clone |
Fresh host/container, or a build fails on a missing tool |
|
Build kernel, dtbs, modules, external modules, TF-A BL31, initramfs, fitImage (incl. PREEMPT_RT) |
Building or rebuilding after a source change |
|
Edit |
Enabling or disabling a driver or kernel feature |
|
Edit or add the base |
Changing the board hardware description |
|
Edit |
Controlling which overlay is selected at boot |
|
Add, patch, or re-pin out-of-tree modules: cmemdrv, qos, gles (pvrsrvkm) |
Bumping a module revision or registering a new one |
|
Edit the init script, busybox config, bundled PCIe driver and PHY firmware |
NVMe/USB boot fails, or an early-boot tool/firmware is needed |
|
Print current build state: resolved paths, artifacts, sizes, times |
Answering “what is built right now?” |
|
Verify artifacts without a board: fitImage, overlay apply,
|
After any build, before deploying |
|
Back up, rsync fitImage/modules/firmware over ssh, reboot, confirm new kernel |
Pushing a finished build to real hardware |
|
Check the live board: selected FIT config, overlay nodes, driver binding |
After deploy, or validating a device tree change on hardware |
Typical flow:
rcar-setup-workspace -> rcar-customize-* -> rcar-build ->
rcar-verify-build -> rcar-deploy-image -> rcar-verify-hardware
Setting Up the Build Environment
Install the required packages:
sudo apt update
sudo apt install \
build-essential \
gcc-aarch64-linux-gnu \
libc6-dev-arm64-cross \
bc \
bison \
flex \
cpio \
kmod \
curl \
file \
libssl-dev \
libelf-dev \
libncurses-dev \
dwarves \
u-boot-tools \
git \
rsync
Create a workspace for the build (you can choose any location and name):
mkdir -p ~/rcarv4h_workspace
cd ~/rcarv4h_workspace
Clone the build scripts:
git clone --single-branch --depth 1 --branch ubuntu/rcar-v4h-sh \
https://github.com/renesas-rdk/rcar-utils.git
The kernel source is not cloned separately. The first kernel build looks for it
in rcar-utils/linux-sh and, when it is not there, prints the repository and branch it is
about to use and asks before cloning:
No kernel source found at <rcar-utils>/linux-sh.
repository: https://github.com/renesas-rdk/linux-sh.git
branch: ubuntu/rcar-v4h-sh
Clone it now? [y/N]
Answering y clones that one branch. You can also clone it yourself beforehand:
git clone --single-branch --branch ubuntu/rcar-v4h-sh \
https://github.com/renesas-rdk/linux-sh.git rcar-utils/linux-sh
Configuring the Build Script
All build commands are driven by a single entry point, rcar-utils/local-build-scripts/main_build.sh,
and are configured through rcar-utils/local-build-scripts/config.ini.
No configuration is required. Every path is derived from the location of the scripts, so the repository is ready to build as it is cloned:
Directory |
Contents |
|---|---|
|
Kernel source. Cloned on demand, as described above. |
|
Installed kernel modules, their configuration files and the firmware that ships with them. |
|
Out-of-tree module sources, fetched at the revisions pinned in |
|
TF-A source, with |
|
busybox tree, the staged |
|
FIT image inputs and the resulting |
|
Download cache. Every file in it is verified against the checksum pinned in |
linux-sh/ and workspace/ are listed in .gitignore, so a build leaves the repository
clean.
To build somewhere else, uncomment the matching path in config.ini. KERNEL_URL and
KERNEL_BRANCH are the exception: they are not paths and are set, not commented out.
Setting |
Description |
|---|---|
|
Kernel source tree. Defaults to |
|
Repository and branch used when the kernel source has to be cloned. |
|
Parent of every output directory. Defaults to |
|
One output directory each, all under |
|
Where the BL31 artifacts and |
The remaining settings can be left at their defaults. These are the ones that are occasionally worth changing:
Setting |
Description |
|---|---|
|
Suffix appended to the kernel release string reported by |
|
ARM Trusted Firmware BL31 blob loaded by every FIT configuration. Left unset, it defaults
to the blob built by the |
|
Initramfs packaged as the |
|
Load and entry addresses written into the FIT image. They must match the U-Boot environment of the board. |
|
Memory reserved for |
|
Builds a second kernel from the same source tree with
KERNEL_VARIANT=preempt-rt ./main_build.sh kernel modules-install
|
The rest are best left as they are shipped: PLATFORM accepts only RCAR-V4H-SH on this
branch, FIT_ITS points at a hand-written image tree source instead of the generated one, and
the *_URL / *_SRCREV / *_SHA256 pairs pin the sources the build fetches itself. The
comments in config.ini describe each of them.
Important
Always run main_build.sh from the local-build-scripts directory. The scripts read
their configuration with source ./config.ini, so they fail if started from anywhere else:
cd ~/rcarv4h_workspace/rcar-utils/local-build-scripts
Because config.ini is sourced after the shell environment is set up, every setting that
it assigns overwrites the environment: to change one of those, edit config.ini. The path
settings are shipped commented out for that reason, and while a line stays commented out the
variable can also be set for a single run:
KERNEL_MODULES_OUTPUT_DIR=/tmp/mods ./main_build.sh kernel modules-install
PLATFORM is the other exception: main_build.sh also accepts it as the PLAT
variable.