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 22.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 | 3.9.2-2 |
| python3-cryptography | 3.4.8-1ubuntu2.4 |
| liblz4-tool | 1.9.3-2build2 |
| libssl-dev | 3.0.2-0ubuntu1.26 |
| lzop | 1.04-2build2 |
To build IPL, U-boot by script, the following tools must be installed on the build host.
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
Please install the following packages 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
Note
Recommended python3 version: 3.10.12 for 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 android17-26q3
Checking the content of the source by listing items:
The result should be:
aosp_local_package/
├── 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
Optional
To achieve fetch reliability and build stability, user can refer AOSP mirror from Q5. Using AOSP mirror for offline fetch
Please confirm this message
Done : TARGET= SMARC_RZG3L
Prepare additional components¶
Notice
Please download RTK0EF0188Z78001ZJ_v17.0.0_proprietary-software.zip package that includes addtitional components.
RTK0EF0188Z78001ZJ_v17.0.0_proprietary-software.zip
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
Extract Wi-Fi firmware¶
By default, Wi-Fi firmware is not included in source tree.
See How to extract additional components to add firmware for Wi-Fi to your RZ AOSP build environment before building Android images
Note
- Please export
ENABLE_WIFI_SUPPORT=truebefore building Android images - For enabling Wi-Fi support, please see Wi-Fi usage
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 RTK0EF0188Z78001ZJ_v17.0.0_proprietary-software.zip package
unzip <path to proprietary software package>/RTK0EF0188Z78001ZJ_v17.0.0_proprietary-software.zip -d .
Confirm the content of RTK0EF0188Z78001ZJ_v17.0.0_proprietary-software
The content should be:
Copy the RTK0EF0188Z78001ZJ_v17.0.0_proprietary-software package to your workspace
Jumping to RTK0EF0188Z78001ZJ_v17.0.0_proprietary-software directory
Run below script to apply additional components to your RZ AOSP environment
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
How to build IPL, U-boot by script¶
Jumping to mydroid directory
Please use below command for building Android bootloader
Build finished. Please confirm this message
====================================================
Artifacts for device SMARC_RZG3L
... Bootloader Binary List
Please confirm the output
vendor/renesas/utils/bootloaders/smarc_rzg3l_out/
├── bl2_bp_emmc.bin
├── bl2_bp_emmc.srec
├── bl2_bp_esd.bin
├── bl2_bp_esd.srec
├── bl2_bp_smarc_rzg3l_emmc.bin
├── bl2_bp_smarc_rzg3l_emmc.srec
├── bl2_bp_smarc_rzg3l_esd.bin
├── bl2_bp_smarc_rzg3l_esd.srec
├── bl2_bp_smarc_rzg3l_spi.bin
├── bl2_bp_smarc_rzg3l_spi.srec
├── bl2_bp_spi.bin
├── bl2_bp_spi.srec
├── bp_emmc.bin
├── bp_esd.bin
├── bp_spi.bin
├── fip.bin
├── fip_smarc_rzg3l.bin
├── fip_smarc_rzg3l.srec
├── fip.srec
├── host_tools.log
├── ipl.log
├── obj
├── u-boot.bin
└── u-boot.log
Building Android and Kernel sources¶
Jumping to mydroid directory
Please set Android build environment
Please see more lunch build options at Android build options
(Mandatory if users want to use hardware codecs) Enable hardware codecs (See Hardware Codec module)
(Optional) Enable Wi-Fi support (See Extract Wi-Fi firmware)
Start building RZ AOSP
CAUTION
If the host PC is not powerful enough, please replace ${NUM_JOBS} by smaller build threads. For example: make -j4
Build 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=smarc_rzg3l
# 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 vendor/renesas/utils/bootloaders/${board_name}_out/bl2_bp_smarc_rzg3l_emmc.srec ${images_dir}
cp vendor/renesas/utils/bootloaders/${board_name}_out/bl2_bp_smarc_rzg3l_emmc.bin ${images_dir}
cp vendor/renesas/utils/bootloaders/${board_name}_out/bl2_bp_smarc_rzg3l_esd.srec ${images_dir}
cp vendor/renesas/utils/bootloaders/${board_name}_out/bl2_bp_smarc_rzg3l_esd.bin ${images_dir}
cp vendor/renesas/utils/bootloaders/${board_name}_out/fip_smarc_rzg3l.srec ${images_dir}
cp vendor/renesas/utils/bootloaders/${board_name}_out/fip_smarc_rzg3l.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.
Note
Please use fastboot (out/host/linux-x86/bin/) command that you built in this procedure. If you use old fastboot command which is included in old Android SDK, you might fail to flash an image.