VAR-SOM-MX6 Android: Difference between revisions
No edit summary |
|||
(8 intermediate revisions by 3 users not shown) | |||
Line 24: | Line 24: | ||
= Hardware Requirements = | = Hardware Requirements = | ||
You will need | |||
* | * You will need the Variscite {{#var:HARDWARE_NAME}} based evaluation kit. | ||
* VAR-SOM- | * Debug UART cable - For serial Debugging | ||
* OTG {{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 | Micro B | (Type C) }} to A - For adb and fastboot | |||
== Host (PC) setup requirements == | == Host (PC) setup requirements == | ||
Line 36: | Line 37: | ||
Debian 8.4 64bit [https://www.debian.org/releases https://www.debian.org/releases] | Debian 8.4 64bit [https://www.debian.org/releases https://www.debian.org/releases] | ||
We recommend to have Physical Build machine, but if you are running Linux in a virtual machine, please make sure you allocate at least 16GB of RAM and 32 GB swap to virtual machine. | |||
<span style="color:red">Note: </span>Do not use other Ubuntu or Debian releases, than the ones recommended above. | <span style="color:red">Note: </span>Do not use other Ubuntu or Debian releases, than the ones recommended above. | ||
Line 46: | Line 47: | ||
unzip mtd-utils u-boot-tools lzop liblzo2-2 liblzo2-dev zlib1g-dev liblz-dev uuid uuid-dev android-tools-fsutils bc | unzip mtd-utils u-boot-tools lzop liblzo2-2 liblzo2-dev zlib1g-dev liblz-dev uuid uuid-dev android-tools-fsutils bc | ||
</pre> | </pre> | ||
If you are using Ubuntu 16.04 LTS latest repo tool requires Python 3.0 | |||
$ sudo add-apt-repository ppa:deadsnakes/ppa | |||
$ sudo apt-get install python3.6 | |||
$ sudo apt-get install python-is-python2 | |||
If you are using Ubuntu 20.04 LTS requires below package | |||
$ sudo apt-get install python-is-python2 | |||
=== Configure GIT account === | === Configure GIT account === | ||
Line 71: | Line 80: | ||
$ sudo update-alternatives --config java | $ sudo update-alternatives --config java | ||
$ sudo update-alternatives --config javac | $ sudo update-alternatives --config javac | ||
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 | | |||
By default Ubuntu 16.04 LTS - OpenJDK has the java security algorithms blacklisted. The jack server generates warning. | |||
Run below command to fix it | |||
sudo sed -i -e "s/ TLSv1,//g" -e "s/ TLSv1.1,//g" /etc/java-8-openjdk/security/java.security | |||
|}} | |||
<span style="color:red">Note: </span>The build process requires about 135GB of free space. | <span style="color:red">Note: </span>The build process requires about 135GB of free space. | ||
Line 96: | Line 112: | ||
{{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 | | {{#ifeq: {{#var:ANDROID_NXP_VERSION}} | O8.0.0_1.0.0 | | ||
$ cd {{#var:BUILD_FOLDER}} | $ cd {{#var:BUILD_FOLDER}} | ||
$ sed -i '/repo sync/ised -i "s+git.freescale.com/proprietary/+github.com/NXP+g" .repo/manifests/*' imx-o8.0.0_1.0.0_ga/imx_android_setup.sh | |||
$ WORKSPACE=`pwd` android_builddir=`pwd`/imx-o8.0.0_1.0.0_ga/android_build/ imx-o8.0.0_1.0.0_ga/imx_android_setup.sh | $ WORKSPACE=`pwd` android_builddir=`pwd`/imx-o8.0.0_1.0.0_ga/android_build/ imx-o8.0.0_1.0.0_ga/imx_android_setup.sh | ||
* Note: Since Oreo the distribution of Android Source code is partially hosted on Linux Foundation https://source.codeaurora.org/ | * Note: Since Oreo the distribution of Android Source code is partially hosted on Linux Foundation https://source.codeaurora.org/ | ||
Line 318: | Line 335: | ||
= Boot options= | = Boot options= | ||
The Android boot options are:<br> | |||
1. Directly from SD card<br> | 1. Directly from an SD card<br> | ||
2. U-Boot boots from NAND flash, and the rest of the Android images from on-SOM eMMC (when available) | 2. U-Boot boots from NAND flash, and the rest of the Android images from the on-SOM eMMC (when available) | ||
== Flash and boot Android from SD card == | == Flash and boot Android from SD card == |
Latest revision as of 23:29, 27 March 2022
Introduction
This Wiki describes how to build and deploy Android Nougat on the VAR-SOM-MX6. It is based on NXP's IMX6_N7.1.1_1.0.0_ANDROID release
Overview
The objective of this document is to guide VAR-SOM-MX6 Android developers to obtain Android Nougat sources, setting up host environment, compilation, and deployment.
This document contains instructions for:
- Hardware and software requirements.
- Setup the hardware.
- Setup the toolchain.
- Download & build the sources.
- Install the binaries on the VAR-SOM-MX6 SOM and variants.
Supported hardware and features
Feature |
Description |
---|---|
SOM support |
VAR-SOM-MX6 V2 VAR-SOM-SOLO VAR-SOM-DUAL DART-MX6 |
Carrier Board support |
VAR-MX6CustomBoard VAR-SOLOCustomBoard VAR-DVK-DT6 |
CPU |
i.MX6 Quad Plus |
NAND flash size support |
128MB and up |
eMMC |
up to 64GB |
DDR size support configuration |
Solo:up to 1GB. DualLite, Dual, Quad: up to 4GB |
SD card |
+ |
Wired Network |
10/100/1000 Mbps Ethernet |
Wireless Network |
Support for Wilink8, 802.11abgn STA, AP, & Wi-Fi Direct Mode SmartConfig Wilink8 page |
Bluetooth |
+ |
SPI |
+ |
I2C |
+ |
Canbus |
+ |
USB host |
+ |
USB OTG |
Host and Device |
Uarts |
x3, up to 3.6 Mbps. |
RTC |
+ |
Display | HDMI: 720P,1080P LVDS0 (On board LVDS-to-RGB bridge, 800x480 resolution), LVDS1 external display |
Audio | Line IN/ Line out and Audio over HDMI |
Camera | OV5640 camera sensor (VAR-EXT-CB402 camera board can be ordered separately) |
PCIE | + |
SATA | + |
Hardware Requirements
- You will need the Variscite VAR-SOM-MX6 based evaluation kit.
- Debug UART cable - For serial Debugging
- OTG Micro B to A - For adb and fastboot
Host (PC) setup requirements
The host development environment for Android is based on Ubuntu and Debian, please install Ubuntu version 14.04/16.04 64bit LTS http://www.ubuntu.com/download/desktop or Debian 8.4 64bit https://www.debian.org/releases
We recommend to have Physical Build machine, but if you are running Linux in a virtual machine, please make sure you allocate at least 16GB of RAM and 32 GB swap to virtual machine.
Note: Do not use other Ubuntu or Debian releases, than the ones recommended above.
Install required packages on host PC
$ sudo apt-get -y install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib \ libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc \ unzip mtd-utils u-boot-tools lzop liblzo2-2 liblzo2-dev zlib1g-dev liblz-dev uuid uuid-dev android-tools-fsutils bc
If you are using Ubuntu 16.04 LTS latest repo tool requires Python 3.0
$ sudo add-apt-repository ppa:deadsnakes/ppa $ sudo apt-get install python3.6 $ sudo apt-get install python-is-python2
If you are using Ubuntu 20.04 LTS requires below package
$ sudo apt-get install python-is-python2
Configure GIT account
$ git config --global user.name "Your Name" $ git config --global user.email "Your Email"
Install the OpenJDK
Android Nougat requires OpenJDK 8.
To install it:
$ sudo apt-get update $ sudo apt-get install openjdk-8-jdk
If your Ubuntu version is missing the package (which shouldn't happen), add the PPA repository and run the previous commands again:
$ sudo add-apt-repository ppa:openjdk-r/ppa
Update the default Java version by running:
$ sudo update-alternatives --config java $ sudo update-alternatives --config javac
Note: The build process requires about 135GB of free space.
Obtain source code
Variscite's Linux kernel and U-Boot are available through Github.
Required patches for the Android file system are under: https://variscite-public.nyc3.cdn.digitaloceanspaces.com/VAR-SOM-MX6/Software/Android/Android_IMX6_N711_100/ in Variscite's FTP
Files:
- android_N7.1.1_1.0.0_source.tar.gz - NXP's i.MX6 N7.1.1_1.0.0 original BSP patch files.
Get NXP's Android Release Package
$ mkdir ~/var_n_711_100 $ cd ~/var_n_711_100 $ curl -o ~/Downloads/android_N7.1.1_1.0.0_source.tar.gz https://variscite-public.nyc3.cdn.digitaloceanspaces.com/VAR-SOM-MX6/Software/Android/Android_IMX6_N711_100/android_N7.1.1_1.0.0_source.tar.gz $ tar xvf ~/Downloads/android_N7.1.1_1.0.0_source.tar.gz
Download Google Android N7.1.1
$ mkdir -p ~/bin $ curl -o ~/bin/repo http://commondatastorage.googleapis.com/git-repo-downloads/repo $ chmod a+x ~/bin/repo $ export PATH=~/bin:$PATH $ mkdir ~/var_n_711_100/n_711_100_build $ cd ~/var_n_711_100/n_711_100_build $ repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r13 $ repo sync -j4
Clone Variscite's U-Boot and Linux kernel sources
$ mkdir -p ~/var_n_711_100/n_711_100_build/bootable/bootloader $ cd ~/var_n_711_100/n_711_100_build/bootable/bootloader $ git clone https://github.com/varigit/uboot-imx.git -b n7.1.1_1.0.0_ga_var01 $ cd ~/var_n_711_100/n_711_100_build $ git clone https://github.com/varigit/linux-2.6-imx.git kernel_imx -b n7.1.1_1.0.0-ga-var01
Apply all the i.MX Android patches with Freescale i.MX6 support
$ cd ~/var_n_711_100/n_711_100_build $ source ../android_N7.1.1_1.0.0_source/code/N7.1.1_1.0.0/and_patch.sh **** Invoke ". and_patch.sh" from your shell to add following functions to your environment: ****-- c_gotop: Changes directory to the top of the tree ****-- c_patch: Recover working tree to base version and then applying FSL android patch $ c_patch ../android_N7.1.1_1.0.0_source/code/N7.1.1_1.0.0 imx_N7.1.1_1.0.0 If everything is OK, "c_patch" generates the following output to indicate the successful patch: ************************************************************* Success: Now you can build android code for FSL i.MX platform *************************************************************
Apply Variscite's i.MX6 platforms' patches
$ cd ~/var_n_711_100/n_711_100_build/device $ git clone https://github.com/varigit/MX6x-android.git -b n7.1.1_1.0.0-ga-var01 variscite $ variscite/scripts/install.sh
Build Android Images
Change to Android top level directory.
$ cd ~/var_n_711_100/n_711_100_build $ source build/envsetup.sh $ lunch var_mx6-eng or $ lunch var_mx6-user
Note: var_mx6-user creates a production version of Android. var_mx6-eng creates an engineering version of Android. Development mode enable and development tools are available on target.
$ export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
Switching from eMMC build to SD card build and vice versa
When you switch your target MMC device you need to remove the fstab file. This will guarantee that the make system will copy the right one into target.
$ rm out/target/product/var_mx6/recovery/root/fstab* out/target/product/var_mx6/root/fstab*
Build Android for SD card
$ make -j4 BUILD_TARGET_DEVICE=sd 2>&1 | tee build1-1.log
- Note: When running Android from an SD card, the eMMC will be detected and presented as an SD card storage.
Build Android for on-SOM eMMC
$ make -j4 BUILD_TARGET_DEVICE=emmc 2>&1 | tee build1-1.log
Special notes for DART-MX6: user builds for eMMC
Due to HW specific features, dm-verity feature has been disabled on user builds for eMMC on DART-MX6.
To enable this feature, follow next steps:
- correctly set PRODUCT_SYSTEM_VERITY_PARTITION in device/variscite/imx6/var_mx6.mk
- enable verify in device/variscite/var_mx6/fstab_emmc_dart.freescale
The comments in the files will suggest the detailed actions.
Build for NAND
Note: Due to android file system size, Android should use SD card or eMMC only
Images created by the Android build for Variscite MX6 system
If you do ls out/target/product/var_mx6/
Image |
Description |
---|---|
system.img | Android system image file. SOM agnostics. |
u-boot-var-imx6-nand.img | U-Boot for nand used in eMMC boot. SOM agnostics. |
u-boot-var-imx6-sd.img | U-Boot for SD card boot. SOM agnostics. |
boot-<name>-<touch>.img recovery-<name>-<touch>.img |
|
<name> is one of: | som-mx6q - Supports VAR-SOM-MX6Q and VAR-SOM-MX6D som-mx6dl - Supports VAR-SOM-MX6DL and VAR-SOM-MX6S som-solo - Supports VAR-SOM-SOLO and VAR-SOM-DUAL |
<touch> - is "r" or "c" | r = resistive touch display c = capacitive touch dispaly |
Setup Name |
Images Names |
SOM type |
Carrier Board type |
LCD Type |
Evaluation Kit name |
---|---|---|---|---|---|
som-mx6qp-c | boot-som-mx6qp-c.img, recovery-som-mx6qp-c.img |
VAR-SOM-MX6_V2 (Quad Plus) | VAR-MX6CustomBoard | Capacitive touch | VAR-DVK-MX6_V2-PRO, VAR-STK-MX6_V2 |
som-mx6qp-r | boot-som-mx6qp-r.img, recovery-som-mx6qp-r.img |
VAR-SOM-MX6_V2 (Quad Plus) | VAR-MX6CustomBoard | Resistive touch | VAR-DVK-MX6_V2, VAR-STK-MX6_V2 |
som-mx6qp-vsc | boot-som-mx6qp-vsc.img, recovery-som-mx6qp-vsc.img |
VAR-SOM-MX6_V2 (Quad Plus) | VAR-SOLOCustomBoard | Capacitive LVDS touch | N/A |
som-mx6q-c | boot-som-mx6q-c.img, recovery-som-mx6q-c.img |
VAR-SOM-MX6_V2 (Quad / Dual) | VAR-MX6CustomBoard | Capacitive touch | VAR-DVK-MX6_V2-PRO, VAR-STK-MX6_V2 |
som-mx6q-r | boot-som-mx6q-r.img, recovery-som-mx6q-r.img |
VAR-SOM-MX6_V2 (Quad / Dual) | VAR-MX6CustomBoard | Resistive touch | VAR-DVK-MX6_V2, VAR-STK-MX6_V2 |
som-mx6q-vsc | boot-som-mx6q-vsc.img, recovery-som-mx6q-vsc.img |
VAR-SOM-MX6_V2 (Quad / Dual) | VAR-SOLOCustomBoard | Capacitive LVDS touch | N/A |
som-mx6dl-c | boot-som-mx6dl-c.img, recovery-som-mx6dl-c.img |
VAR-SOM-MX6_V2 (DualLite/ Solo) | VAR-MX6CustomBoard | Capacitive touch | N/A |
som-mx6dl-r | boot-som-mx6dl-r.img, recovery-som-mx6dl-r.img |
VAR-SOM-MX6_V2 (DualLite/ Solo) | VAR-MX6CustomBoard | Resistive touch | N/A |
som-solo-vsc | boot-som-solo-vsc.img, recovery-som-solo-vsc.img |
VAR-SOM-SOLO / VAR-SOM-DUAL | VAR-SOLOCustomBoard | Capacitive LVDS touch | VAR-DVK-SOLO/DUAL, VAR-STK-SOLO/DUAL |
som-solo-c | boot-som-solo-c.img, recovery-som-solo-c.img |
VAR-SOM-SOLO / VAR-SOM-DUAL | VAR-MX6CustomBoard | Capacitive touch | N/A |
imx6q-var-dart | boot-imx6q-var-dart.img, recovery-imx6q-var-dart.img |
DART-MX6 | VAR-DT6CustomBoard | Capacitive touch | VAR-STK-DT6, VAR-DVK-DT6 |
Boot options
The Android boot options are:
1. Directly from an SD card
2. U-Boot boots from NAND flash, and the rest of the Android images from the on-SOM eMMC (when available)
Flash and boot Android from SD card
Create a bootable SD card
Partition and format SD card, and copy all images
$ sudo ./var-mksdcard.sh -f SETUP_NAME /dev/sdX;sync
- Replace SETUP_NAME with the actual desired setup name accrding to the second table in the "images created" section.
- Replace /dev/sdX with your true device, You can identify it with dmesg.
Boot From SD card
- Power-off the board.
- Insert the SD card into the SD card slot of the carrier board (DVK)
- Make sure the Boot Mode is set to SD card: see Setting the Boot Mode section
- Power up the board - it will boot into Linux from the SD card
Flash and boot Android from eMMC
eMMC based system consist of:
- SPL and U-Boot on NAND flash
- Rest of Android images in eMMC
Preparing images
All Android built images but system.img are ready for flashing out of the default build.
The default system.img format is suitable for flashing using fastboot, and must be modified for flashing using 'dd'.
$ cd out/target/product/var_mx6 $ simg2img system.img system_raw.img
Flashing Android from Linux shell (when the primary installation android)
An example of flashing eMMC, can be found here.
Follow the following steps instructions above:
1. Preparing a rescue SD card;
2. Flash from command line (use the install_android.sh script)
Further, follow the steps described in paragraph "Flashing Android with USB Fastboot"
Flashing Android with USB Fastboot
Install tools on host
$ sudo apt-get install android-tools-adb android-tools-fastboot
Note: Make sure you built Android for eMMC
Connect the target with host PC at fastboot mode:
- Connect a USB OTG cable from the target board OTG port to a your host machine USB HOST port.
- Power up the board and hit return/space to stop the boot at U-Boot.
- type fastboot usb0 in the U-Boot command line.
On the Host PC:
$ sudo `which fastboot` flash boot out/target/product/var_mx6/boot-SETUP_NAME.img $ sudo `which fastboot` flash recovery out/target/product/var_mx6/recovery-SETUP_NAME.img $ sudo `which fastboot` flash system out/target/product/var_mx6/system.img $ sudo `which fastboot` reboot
Replace SETUP_NAME with the actual desired setup name accrding to the second table in the "images created" section.
Android recovery mode
Enter board in Android Recovery mode
Turn on the device by holding down the "back" button must be held until the end of the boot and logged in "Android Recovery" mode.
- To switch between menu items, use a short press of any button (except RESET) or a short touch touchscreen;
- To select an item, use long press any button (except RESET) or long touch the touchscreen;
Update Android firmware
Generate OTA packages For generating "OTA" packages, use the following commands:
$ cd ~/var_n_711_100/n_711_100_build
# if Android for SD card $ make -j4 BUILD_TARGET_DEVICE=sd otapackage 2>&1 | tee build1-1.log # if Android for eMMC $ make -j4 BUILD_TARGET_DEVICE=emmc otapackage 2>&1 | tee build1-1.log
Install OTA package to device
- Enter to Android Recovery mode
- Select menu item "apply update from ADB"
- To the host system, perform the following command:
$ out/host/linux-x86/bin/adb sideload out/target/product/var_mx6/var_mx6-ota-<data>-<image-id>.zip
- reboot this device
Note: Real example name for OTA package: out/target/product/var_mx6/var_mx6-ota-20160331-som-mx6q-c.zip
Manual operations
Build boot.img
When you perform changes to the kernel, you may build boot.img solely instead of building the whole Android.
$ cd ~/var_n_711_100/n_711_100_build $ source build/envsetup.sh $ lunch var_mx6-eng or $ lunch var_mx6-user $ make bootimage
Toolchain setup for manual build kernel and U-Boot
$ export ARCH=arm Setup the toolchain path to point to arm-eabi- tools in prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin $ export CROSS_COMPILE=~/var_n_711_100/n_711_100_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-
Manual build Bootloader
Change directory to U-Boot
$ cd ~/var_n_711_100/n_711_100_build/bootable/bootloader/uboot-imx
Execute following commands:
clean tree: $ make mrproper Choose build for SD card or NAND flash: $ make mx6var_som_sd_android_defconfig or $ make mx6var_som_nand_android_defconfig Build U-Boot: $ make -j4
This command will generate the U-Boot images 'SPL' and 'u-boot.img'.
Manual build Android Linux Kernel and modules
$ cd ~/var_n_711_100/n_711_100_build/kernel_imx $ make mrproper $ make imx_v7_var_android_defconfig $ make -j4 $ make -j4 uImage LOADADDR=0x10008000
This will generate the uImage (kernel image) in the kernel/arch/arm/boot folder