Difference between revisions of "IoTGateway/BSP/Android/User Guide 11.0.0 For i.MX8"
(Created page with " == Android BSP Version == Android 11.0.0 Kernel 5.10.72 == Build Environment on Host == Currently, we adopt [https://www.docker.com/ Docker] as build environment. You ca...") |
|||
| (8 intermediate revisions by 2 users not shown) | |||
| Line 22: | Line 22: | ||
Step2 In container, change the user. (example) | Step2 In container, change the user. (example) | ||
| − | <pre>$ sudo chown adv:adv | + | <pre>$ sudo chown adv:adv BSP |
</pre> | </pre> | ||
| Line 28: | Line 28: | ||
<pre>$ cd ~/BSP | <pre>$ cd ~/BSP | ||
$ mkdir bin | $ mkdir bin | ||
| − | $ curl | + | $ curl https://storage.googleapis.com/git-repo-downloads/repo > ./bin/repo |
$ mkdir imx8_android_R11 | $ mkdir imx8_android_R11 | ||
| − | $ cd imx8_android_R11 | + | $ cd imx8_android_R11 |
| − | $ git config --global user.name | + | $ git config --global user.name "Your Name" |
$ git config --global user.email you@example.com | $ git config --global user.email you@example.com | ||
$ git config --global http.postBuffer 52428800000 | $ git config --global http.postBuffer 52428800000 | ||
$ git config --global http.maxRequestBuffer 100M | $ git config --global http.maxRequestBuffer 100M | ||
$ git config --global core.compression 0 | $ git config --global core.compression 0 | ||
| − | $ ../bin/repo init -u https://dev.azure.com/AIM-Linux/RISC-IMX-Android11/_git/android-manifest -b android-11.0.0_2.6.0 | + | $ ../bin/repo init -u https://dev.azure.com/AIM-Linux/RISC-IMX-Android11/_git/android-manifest -b android-11.0.0_2.6.0 -m default.xml |
------If you want to get the latest code, please use default.xml------ | ------If you want to get the latest code, please use default.xml------ | ||
| − | $ | + | $ ~/bin/repo sync</pre> |
| + | |||
| + | <br/> | ||
| + | |||
| + | | ||
== Getting Prebuilts (must download) == | == Getting Prebuilts (must download) == | ||
| − | [https://pan.baidu.com/ | + | Baidu:[https://pan.baidu.com/share/init?surl=0HY9dtnWlcolnPF-RyOoXg prebuilts.tar.gz] Key: 1234 DropBox: [https://www.dropbox.com/scl/fi/g2ag8wxc05vzicihb111f/prebuilts-imx8-android11-20220316.tar.gz?rlkey=o6oh2zlbfhzc07lxz4x8w4frr&dl=0 prebuilts.tar.gz] |
<pre>Exit docker and copy the file to /home/your-name/myandroid | <pre>Exit docker and copy the file to /home/your-name/myandroid | ||
$ cp prebuilts.tar.gz /home/your-name/myandroid/imx8_android_R11/android | $ cp prebuilts.tar.gz /home/your-name/myandroid/imx8_android_R11/android | ||
| Line 56: | Line 60: | ||
Prepare the build environment for U-Boot and Linux kernel.<br/> This step is mandatory because there is no GCC cross-compile tool chain in the one in AOSP codebase.An approach is provided to use the self-installed GCC cross-compile tool chain.<br/> a. Download the tool chain for the A-profile architecture on arm Developer GNU-A Downloads page. It is recommended to use the 8.3 version for this release. You can download gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz or gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz . The first one is dedicated for compiling bare-metal programs, and the second one can also be used to compile the application programs.<br/> b. Decompress the file into a path on local disk, for example, to /opt/ . Export a variable named AARCH64_GCC_CROSS_COMPILE to point to the tool as follows: | Prepare the build environment for U-Boot and Linux kernel.<br/> This step is mandatory because there is no GCC cross-compile tool chain in the one in AOSP codebase.An approach is provided to use the self-installed GCC cross-compile tool chain.<br/> a. Download the tool chain for the A-profile architecture on arm Developer GNU-A Downloads page. It is recommended to use the 8.3 version for this release. You can download gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz or gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz . The first one is dedicated for compiling bare-metal programs, and the second one can also be used to compile the application programs.<br/> b. Decompress the file into a path on local disk, for example, to /opt/ . Export a variable named AARCH64_GCC_CROSS_COMPILE to point to the tool as follows: | ||
| + | |||
| + | [https://developer.arm.com/downloads/-/gnu-a gcc-arm-8.3] | ||
<pre># if "gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz" is used | <pre># if "gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz" is used | ||
$ sudo tar -xvJf gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz -C /opt | $ sudo tar -xvJf gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz -C /opt | ||
| Line 89: | Line 95: | ||
Build RSB-3720 Android project | Build RSB-3720 Android project | ||
| − | <pre>$ source build/envsetup.sh | + | <pre>$ source build/envsetup.sh |
| + | $ lunch rsb3720_a1-userdebug | ||
$./imx-make.sh -j12 | $./imx-make.sh -j12 | ||
</pre> | </pre> | ||
Build RSB-5722 Android project | Build RSB-5722 Android project | ||
| − | <pre>$ source build/envsetup.sh | + | <pre>$ source build/envsetup.sh |
| + | $ lunch rom5722_a1-userdebug | ||
$./imx-make.sh -j12 | $./imx-make.sh -j12 | ||
</pre> | </pre> | ||
| Line 117: | Line 125: | ||
<pre>$ cd out/target/product/${Project_Name}/ | <pre>$ cd out/target/product/${Project_Name}/ | ||
$ sudo ./imx-sdcard-partition.sh -f imx8mp /dev/sdx | $ sudo ./imx-sdcard-partition.sh -f imx8mp /dev/sdx | ||
| + | |||
</pre> | </pre> | ||
| + | |||
| + | == How to flash images to eMMC == | ||
| + | <pre> Note: put the image folder and script(imx-emmc-partition.sh) into /data folder (in the system) | ||
| + | $ sudo ./imx-emmc-partition.sh -f imx8mp /dev/block/mmcblk2</pre> | ||
Latest revision as of 02:54, 3 January 2024
Contents
Android BSP Version
Android 11.0.0
Kernel 5.10.72
Build Environment on Host
Currently, we adopt Docker as build environment.
You can get the latest version of advrisc/u18.04-rk3399abv10 Docker image for developing Rockchip RK3399 and rk3568 projects.
Docker command:
docker pull advrisc/u18.04-rk3399abv10:latest;
Run Docker example
Step1 Run docker container (example)
docker run --privileged -it --name android_R11 -v /home/your-name/myandroid:/home/adv/BSP:rw advrisc/u18.04-rk3399abv10 /bin/bash
Step2 In container, change the user. (example)
$ sudo chown adv:adv BSP
Getting Android Source Code
$ cd ~/BSP $ mkdir bin $ curl https://storage.googleapis.com/git-repo-downloads/repo > ./bin/repo $ mkdir imx8_android_R11 $ cd imx8_android_R11 $ git config --global user.name "Your Name" $ git config --global user.email you@example.com $ git config --global http.postBuffer 52428800000 $ git config --global http.maxRequestBuffer 100M $ git config --global core.compression 0 $ ../bin/repo init -u https://dev.azure.com/AIM-Linux/RISC-IMX-Android11/_git/android-manifest -b android-11.0.0_2.6.0 -m default.xml ------If you want to get the latest code, please use default.xml------ $ ~/bin/repo sync
Getting Prebuilts (must download)
Baidu:prebuilts.tar.gz Key: 1234 DropBox: prebuilts.tar.gz
Exit docker and copy the file to /home/your-name/myandroid $ cp prebuilts.tar.gz /home/your-name/myandroid/imx8_android_R11/android In container and Unzip file $ docker attach android_R11 $ tar zxvf ~/BSP/imx8_android_R11/android/prebuilts.tar.gz
Compile all
i.MX Android platform needs some preparation for the first time when building the images. The image build steps are as follows:
Prepare the build environment for U-Boot and Linux kernel.
This step is mandatory because there is no GCC cross-compile tool chain in the one in AOSP codebase.An approach is provided to use the self-installed GCC cross-compile tool chain.
a. Download the tool chain for the A-profile architecture on arm Developer GNU-A Downloads page. It is recommended to use the 8.3 version for this release. You can download gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz or gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz . The first one is dedicated for compiling bare-metal programs, and the second one can also be used to compile the application programs.
b. Decompress the file into a path on local disk, for example, to /opt/ . Export a variable named AARCH64_GCC_CROSS_COMPILE to point to the tool as follows:
# if "gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz" is used $ sudo tar -xvJf gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz -C /opt $ export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/aarch64- elf- # if "gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz" is used $ sudo tar -xvJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C /opt $ export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux- gnu/bin/aarch64-linux-gnu-
The clang used to compile Linux kernel needs to be a newer version. Perform the following steps to set the clang to be used
to compile Linux kernel:
$ sudo git clone https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86 /opt/ prebuilt-android-clang -b master-kernel-build-2021 $ cd /opt/prebuilt-android-clang $ sudo git checkout bceb7274dda5bb587a5473058bd9f52e678dde98 $ export CLANG_PATH=/opt/prebuilt-android-clang
The preceding export commands can be added to /etc/profile . When the host boots up, AARCH64_GCC_CROSS_COMPILE
and CLANG_PATH are set and can be directly used.
Build U-boot
Build U-boot
$ ./imx-make.sh bootloader -j8
Build Kernel
Build Kernel
$ ./imx-make.sh kernel -j8
Build RSB-3720 Android project
$ source build/envsetup.sh $ lunch rsb3720_a1-userdebug $./imx-make.sh -j12
Build RSB-5722 Android project
$ source build/envsetup.sh $ lunch rom5722_a1-userdebug $./imx-make.sh -j12
All image in
out/target/product/${Project_Name}/
The common image files are listed below:
boot.img dtbo-imx8mp.img partition-table-28GB.img partition-table.img super.img u-boot-imx8mp.imx vbmeta.img vbmeta-imx8mp.img vendor_boot.img vendor.img
How to flash images to SDCard
$ cd out/target/product/${Project_Name}/
$ sudo ./imx-sdcard-partition.sh -f imx8mp /dev/sdx
How to flash images to eMMC
Note: put the image folder and script(imx-emmc-partition.sh) into /data folder (in the system) $ sudo ./imx-emmc-partition.sh -f imx8mp /dev/block/mmcblk2