How to build RZ AOSP from Source Code¶
Notice
The command in this section will be executed on the Ubuntu Host PC.
Tools & Dependency packages¶
Prerequisite packages for building the Android Filesystem (Note: This is with reference to Ubuntu 20.04 64-bit). Ubuntu 64-bit is required for the cross-compilation of Android Filesystem.
Setup build environment according to Google Android setup guide (follow Installing required packages): https://source.android.com/source/initializing.html#setting-up-a-linux-build-environment
$ sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev
$ sudo apt-get install libc6-dev-i386 x11proto-core-dev libx11-dev lib32z1-dev
$ sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
| Package | Version |
|---|---|
| python-is-python3 | - |
| python-crypto | 2.6.1-13ubuntu2 |
| liblz4-tool | 1.9.2-2ubuntu0.20.04.1 |
| libssl-dev | 1.1.1f-1ubuntu2.24 |
| lzop | 1.04-1 |
To build Mesa Graphics, the following tools and development dependencies must be installed on the build host. For more details, please visit: https://docs.mesa3d.org/install.html#compiling-and-installing
Note: meson package version should be “1.1.0” or higher for building Mesa 24.3.3
Please install the following packages when users need to set up build environment by using Ubuntu 20 Docker container. This is just for reference only and note that Renesas official test is on natively-installed Ubuntu 20
Note: Recommended python3 version: 3.8.10 for Ubuntu 20.04
Please install the following package when users need to set up build environment by using Ubuntu 22.04 Docker container. This is just for reference only and note that Renesas official test is on natively-installed Ubuntu 22.04
Prepare build environment¶
Download "repo" command and update the environment variables "PATH".
$ bash
$ cd <your work directory>
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > repo
$ chmod a+x repo
$ export PATH=$(pwd):${PATH}
Get RZ AOSP source code¶
Clone android local package
$ cd <your working directory>
$ export ANDROID_BUILD_DIR=`pwd`
$ cd ${ANDROID_BUILD_DIR}
$ git clone https://github.com/renesas-rz/aosp_local_package.git -b android15-26q2
Checking the content of the source by listing items:
The result should be:
aosp_local_package/
├── additional_patches
├── buildenv.sh
├── modified-aosp-projects.xml
├── RELFILES
├── renesas-projects.xml
└── walkthrough.sh
Jumping to aosp_local_package directory
Note: Please make sure that all scripts have “execute” permission
Please confirm this message
Done : TARGET= RZV2H_EVK_VER1
Prepare additional components¶
Notice
Please download RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software.zip package that includes addtitional components.
RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software.zip
Mali Graphics module (Mandatory to boot up)¶
By default, Mali Graphics modules is not included in source tree. Because no license agreement is confirmed.
See How to extract additional components to add Mali Graphics modules to your RZ AOSP build environment before building Android images
Note:
- This repo is required to boot with Mali Graphics successfully. If users skip it, users must check how to switch to use mesa Graphics.
- Officially, All features have been tested with Mali Graphics.
- Please run
vendor/arm/gralloc/configurebefore building Android images
Hardware Codec module¶
By default, Hardware Codecs related repos are not included in source tree. Because no license agreement is confirmed.
- Software codecs are used as default.
- No additional repositories are required.
See How to extract additional components to add Hardware Codec modules to your RZ AOSP build environment before building Android images
Note: Please export ENABLE_HW_CODECS=true before building Android images
USB Wi-Fi module¶
By default, USB Wi-Fi kernel module is not included in source tree.
See How to extract additional components to add USB Wi-Fi modules to your RZ AOSP build environment before building Android images
Note: Please export USE_USB_WIFI=true before building Android images
How to extract additional components¶
Ensure that you have get RZ AOSP source code successfully. See Get RZ AOSP source code
Jump to your android build directory
Extract the RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software.zip package
$ unzip <path to proprietary software package>/RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software.zip -d .
Confirm the content of RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software
The content should be:
RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software
├── apply_package.sh
├── mydroid
├── patch_OV5645
└── README.txt
Copy the RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software package to your workspace
Jumping to RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software directory
Run below script to apply additional components to your RZ AOSP environment
MIPI Camera module¶
By default, the MIPI Camera is not enabled in the kernel. Because the CMOS sensor (OV5645) in the MIPI camera is no longer available and should not be used for mass production. Any software support provided is for evaluation purposes only.
Ensure that you have downloaded RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software.zip package from renesas.com
Jumping to kernel
Apply the MIPI Camera support patches to kernel
$ git am ${workspace}/RTK0EF0188Z76001ZJ_v15.3.0_proprietary-software/patch_OV5645/android15_6.1-cip28-base-update1/*.patch
Note: Please build new Android image after applying MIPI Camera support patches
Building Android, IPL, U-Boot, and Kernel sources¶
CAUTION: It's required to download and extract additional components to build RZ AOSP. Please refer Prepare additional components
Jumping to mydroid directory
Please set Android build environment
Please see more lunch build options at Android build options
Please set this variable to true for building Android bootloader
(Mandatory to boot up) Configure Mali graphics (See Mali Graphics module)
(Mandatory if users want to use hardware codecs) Enable hardware codecs (See Hardware Codec module)
(Optional) Support Encryption (See Enable File-Based Encryption)
(Optional) Enable optional features (See Enable optional features)
- Support USB Bluetooth
- Support USB Wi-Fi (See USB Wi-Fi module)
(Optional) Enable fastbootd for fastboot UDP (See Fastboot UDP)
(Optional) Enable MIPI Camera module support (See MIPI Camera module)
Start building RZ AOSP
CAUTION: If the host PC is not powerful enough, please replace ${NUM_JOBS} by smaller build threads. For example: make -j4Build finished. Please confirm this message
#### Build completed successfully (02:14:01 (hh:mm:ss)) ####
Please set board name build. See more android build options at Android build options. Default build option is ”Base”
$ export board_name=rzv2h_evk_ver1
# Please copy output files to <your_images_dir>
$ export images_dir=<your_images_dir>
$ cp out/target/product/${board_name}/init_boot.img ${images_dir}
$ cp out/target/product/${board_name}/boot.img ${images_dir}
$ cp out/target/product/${board_name}/vendor_boot.img ${images_dir}
$ cp out/target/product/${board_name}/dtb.img ${images_dir}
$ cp out/target/product/${board_name}/dtbo.img ${images_dir}
$ cp out/target/product/${board_name}/vbmeta.img ${images_dir}
$ cp out/target/product/${board_name}/super.img ${images_dir}
$ cp out/target/product/${board_name}/codec_bin.img ${images_dir}
$ cp out/target/product/${board_name}/bl2_bp_rzv2h_evk_ver1_esd.srec ${images_dir}
$ cp out/target/product/${board_name}/bl2_bp_rzv2h_evk_ver1_spi.srec ${images_dir}
$ cp out/target/product/${board_name}/fip_rzv2h_evk_ver1_sdhi.srec ${images_dir}
$ cp out/target/product/${board_name}/fip_rzv2h_evk_ver1_spi.srec ${images_dir}
$ cp out/target/product/${board_name}/bl2_bp_rzv2h_evk_ver1_esd.bin ${images_dir}
$ cp out/target/product/${board_name}/bl2_bp_rzv2h_evk_ver1_spi.bin ${images_dir}
$ cp out/target/product/${board_name}/fip_rzv2h_evk_ver1_sdhi.bin ${images_dir}
$ cp out/target/product/${board_name}/fip_rzv2h_evk_ver1_spi.bin ${images_dir}
$ cp vendor/renesas/utils/fastboot/fastboot.sh ${images_dir}
$ cp vendor/renesas/utils/fastboot/fastboot_functions.sh ${images_dir}
$ cp out/host/linux-x86/bin/adb ${images_dir}
$ cp out/host/linux-x86/bin/mke2fs ${images_dir}
$ cp out/host/linux-x86/bin/fastboot ${images_dir}
$ chmod a+x -R ${images_dir}
… Please read Note.
All *.srec, *.bin files are used for section Flashing bootloader. All *.img files, fastboot.sh, and fastboot are used for section Flashing images using fastboot.