Android Customizing IMX8 U-Boot: Difference between revisions

From Variscite Wiki
 
(8 intermediate revisions by 3 users not shown)
Line 20: Line 20:
Clean the u-boot source code as Android build the u-boot in out/target/product/{{#var:ANDROID_MACHINE_NAME}}/obj/UBOOT_OBJ/
Clean the u-boot source code as Android build the u-boot in out/target/product/{{#var:ANDROID_MACHINE_NAME}}/obj/UBOOT_OBJ/


===Edit U-Boot command line arguments to kernel===
==Edit U-Boot command line arguments to kernel==
https://github.com/varigit/uboot-imx/blob/{{#var:U-BOOT_BRANCH}}/{{#var:U-BOOT_ANDROID_CONFIG_FILE}}
https://github.com/varigit/uboot-imx/blob/{{#var:U-BOOT_BRANCH}}/{{#var:U-BOOT_ANDROID_CONFIG_FILE}}
Change following macro <br>
Change following macro <br>
Line 26: Line 26:
  #define CONFIG_EXTRA_ENV_SETTINGS \
  #define CONFIG_EXTRA_ENV_SETTINGS \
  "bootargs=" \
  "bootargs=" \
  .......
  ...
        ....\0"  
...\0"  
And append "androidboot.selinux=permissive\0" to the kernel
And append "androidboot.selinux=permissive\0" to the kernel


  #define CONFIG_EXTRA_ENV_SETTINGS \
  #define CONFIG_EXTRA_ENV_SETTINGS \
  "bootargs=" \
  "bootargs=" \
  .......
  ...
        androidboot.selinux=permissive\0"
androidboot.selinux=permissive\0"
Here above is example adding "androidboot.selinux=permissive" to the kernel command line,  
Here above is example adding "androidboot.selinux=permissive" to the kernel command line,


===Compile U-Boot===
==Compile U-Boot==
Compile the new U-Boot  
Compile the new U-Boot  
When you perform changes to the u-boot, you may build {{#var:U-BOOT_SD_IMAGE_NAME}} solely instead of building the whole Android.
When you perform changes to the u-boot, you may build {{#var:U-BOOT_SD_IMAGE_NAME}} solely instead of building the whole Android.
Line 46: Line 46:
After build is complete it should generate {{#var:U-BOOT_SD_IMAGE_NAME}} in out/target/product/{{#var:ANDROID_MACHINE_NAME}}
After build is complete it should generate {{#var:U-BOOT_SD_IMAGE_NAME}} in out/target/product/{{#var:ANDROID_MACHINE_NAME}}
  $ ls -l out/target/product/{{#var:ANDROID_MACHINE_NAME}}/*.imx
  $ ls -l out/target/product/{{#var:ANDROID_MACHINE_NAME}}/*.imx
You should see {{#var:U-BOOT_SD_IMAGE_NAME}} correctly.  
You should see {{#var:U-BOOT_SD_IMAGE_NAME}} correctly.


===Update U-Boot===
==Update U-Boot==
There are two methods from which you can update bootloader,  
There are two methods from which you can update bootloader,  
Flash the binaries following {{Varlink|Android_Recovery_SD_card|{{#var:RELEASE_LINK}}|Android Recovery SD card}} and replacing your binaries in /opt/images/Android/ <br>
Flash the binaries following {{Varlink|Android_Recovery_SD_card|{{#var:RELEASE_LINK}}|Android Recovery SD card}} and replacing your binaries in /opt/images/Android/ <br>
Boot from Yocto, and run install_android.sh.  
Boot from Yocto, and run install_android.sh.  
* Note: This erases everything and installs everything <br>
* Note: This erases everything and installs everything <br>
or
or <br>
If you wish to just update u-boot, and your platform already has the bootloader and adb running use below commands.  
If you wish to just update u-boot, and your platform already has the bootloader and adb running use below commands to flash directly to eMMC.  
  $ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
  $ cd {{#var:BUILD_FOLDER}}/{{#var:BUILD_FOLDER_ANDROID}}
$ adb root;sleep 3;
  $ adb push out/target/product/{{#var:ANDROID_MACHINE_NAME}}/{{#var:U-BOOT_SD_IMAGE_NAME}} /data/
  $ adb push out/target/product/{{#var:ANDROID_MACHINE_NAME}}/{{#var:U-BOOT_SD_IMAGE_NAME}} /data/
  $ adb shell 'dd if=/data/{{#var:U-BOOT_SD_IMAGE_NAME}} of=/dev/block/{{#var:EMMC_ROOTFS_DEV}} bs=1k seek={{#var:U-BOOT_OFFSET}}'
  $ adb shell 'dd if=/data/{{#var:U-BOOT_SD_IMAGE_NAME}} of=/dev/block/{{#var:EMMC_ROOTFS_DEV}} bs=1k seek={{#var:U-BOOT_OFFSET}} conv=fsync'
  $ adb shell sync
  $ adb shell sync
  $ adb reboot
  $ adb reboot

Latest revision as of 15:39, 11 September 2023

Android - Customizing U-boot

Overview

This section explains how to customize bootloader and update it on VAR-SOM-MX6 platform via adb.

Making changes to U-boot

Making Changes to U-boot config

$ cd ~/var_n_711_100/n_711_100_build/vendor/variscite/uboot-imx/
$ make mrproper
$ make mx6var_som_sd_android_defconfig
$ make menuconfig

Navigate the menu and select the desired u-boot functionalities, save the new configuration and exit.
Then, save the new configuration as the default configuration:

$ make savedefconfig
$ cp configs/mx6var_som_sd_android_defconfig cp configs/mx6var_som_sd_android_defconfig.orig 
$ cp defconfig configs/mx6var_som_sd_android_defconfig

Clean the u-boot source code as Android build the u-boot in out/target/product//obj/UBOOT_OBJ/

Edit U-Boot command line arguments to kernel

https://github.com/varigit/uboot-imx/blob/n7.1.1_1.0.0_ga_var01/ Change following macro

#define CONFIG_EXTRA_ENV_SETTINGS \
	"bootargs=" \
	...
	...\0" 

And append "androidboot.selinux=permissive\0" to the kernel

#define CONFIG_EXTRA_ENV_SETTINGS \
	"bootargs=" \
	...
	androidboot.selinux=permissive\0"

Here above is example adding "androidboot.selinux=permissive" to the kernel command line,

Compile U-Boot

Compile the new U-Boot When you perform changes to the u-boot, you may build u-boot.img-sd solely instead of building the whole Android.

$ cd ~/var_n_711_100/n_711_100_build
$ source build/envsetup.sh
$ lunch -userdebug
$ make bootloader

After build is complete it should generate u-boot.img-sd in out/target/product/

$ ls -l out/target/product//*.imx

You should see u-boot.img-sd correctly.

Update U-Boot

There are two methods from which you can update bootloader, Flash the binaries following Android Recovery SD card and replacing your binaries in /opt/images/Android/
Boot from Yocto, and run install_android.sh.

  • Note: This erases everything and installs everything

or
If you wish to just update u-boot, and your platform already has the bootloader and adb running use below commands to flash directly to eMMC.

$ cd ~/var_n_711_100/n_711_100_build
$ adb root;sleep 3;
$ adb push out/target/product//u-boot.img-sd /data/
$ adb shell 'dd if=/data/u-boot.img-sd of=/dev/block/mmcblk0 bs=1k seek= conv=fsync'
$ adb shell sync
$ adb reboot