Android OTA 系统升级 笔记

时间:2022-09-07 11:21:06

一、编译内核
进入lichee
1、选择配置
root@ceshi-web:/opt/android-source/T3/lichee# ./build.sh config

Welcome to mkscript setup progress
All available chips:
0. sun8iw11p1
Choice: 0
All available platforms:
0. android
1. androidm
2. dragonboard
3. linux
4. camdroid
Choice: 1
All available kernel:
0. linux-3.10
Choice: 0
All available boards:
0. t3-mp1
1. t3-mp3
2. t3-p1
3. t3-p2
4. t3-p3
Choice: 4

2、开始编译。得等段时间
root@ceshi-web:/opt/android-source/T3/lichee# ./build.sh
INFO: —————————————-
INFO: build lichee …
INFO: chip: sun8iw11p1
INFO: platform: androidm
INFO: kernel: linux-3.10
INFO: board: t3-p3
INFO: output: out/sun8iw11p1/androidm/t3-p3
INFO: —————————————-
INFO: build buildroot …
external toolchain has been installed
INFO: build buildroot OK.
INFO: build kernel …
INFO: prepare toolchain of sun8iw11p1…

二、编译源码
进入android源码目录
1、配置编译需要的环境变量
root@ceshi-web:/opt/android-source/T3/androidm# source build/envsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/fugu/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/htc/flounder/vendorsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including device/moto/shamu/vendorsetup.sh
including device/softwinner/common/vendorsetup.sh
including device/softwinner/t3-p1/vendorsetup.sh
including device/softwinner/t3-p3/vendorsetup.sh
including sdk/bash_completion/adb.bash

2、选择要编译的类型
root@ceshi-web:/opt/android-source/T3/androidm# lunch

You’re building on Linux

Lunch menu… pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_mips-eng
4. aosp_mips64-eng
5. aosp_x86-eng
6. aosp_x86_64-eng
7. aosp_deb-userdebug
8. aosp_flo-userdebug
9. full_fugu-userdebug
10. aosp_fugu-userdebug
11. mini_emulator_arm64-userdebug
12. m_e_arm-userdebug
13. mini_emulator_mips-userdebug
14. mini_emulator_x86_64-userdebug
15. mini_emulator_x86-userdebug
16. aosp_flounder-userdebug
17. aosp_hammerhead-userdebug
18. aosp_hammerhead_fp-userdebug
19. aosp_shamu-userdebug
20. t3_p1-eng
21. t3_p1-user
22. t3_p3-eng
23. t3_p3-user

Which would you like? [aosp_arm-eng] ^C
root@ceshi-web:/opt/android-source/T3/androidm# lunch

You’re building on Linux

Lunch menu… pick a combo:
1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_mips-eng
4. aosp_mips64-eng
5. aosp_x86-eng
6. aosp_x86_64-eng
7. aosp_deb-userdebug
8. aosp_flo-userdebug
9. full_fugu-userdebug
10. aosp_fugu-userdebug
11. mini_emulator_arm64-userdebug
12. m_e_arm-userdebug
13. mini_emulator_mips-userdebug
14. mini_emulator_x86_64-userdebug
15. mini_emulator_x86-userdebug
16. aosp_flounder-userdebug
17. aosp_hammerhead-userdebug
18. aosp_hammerhead_fp-userdebug
19. aosp_shamu-userdebug
20. t3_p1-eng
21. t3_p1-user
22. t3_p3-eng
23. t3_p3-user

Which would you like? [aosp_arm-eng] 23

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0.1
TARGET_PRODUCT=t3_p3
TARGET_BUILD_VARIANT=user
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.13.0-32-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=MMB29M

3、拷贝之前在lichee中编译好的bImage、modules。
root@ceshi-web:/opt/android-source/T3/androidm# extract-bsp
/opt/android-source/T3/androidm/device/softwinner/t3-p3/bImage copied!
/opt/android-source/T3/androidm/device/softwinner/t3-p3/modules copied!

4、开始编译(第一次编译大概要3、4个小时,可以去做其他的事情了~~~)
root@ceshi-web:/opt/android-source/T3/androidm# make -j8

PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0.1
TARGET_PRODUCT=t3_p3
TARGET_BUILD_VARIANT=user
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.13.0-32-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=MMB29M
OUT_DIR=out
。。。等待一段时间后。。。
Creating filesystem with parameters:
Size: 1610612736
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 6144
Label: system
Blocks: 393216
Block groups: 12
Reserved block group size: 95
Created filesystem with 2000/98304 inodes and 133410/393216 blocks
Install system fs image: out/target/product/t3-p3/system.img
out/target/product/t3-p3/system.img+out/target/product/t3-p3/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=1644331392 blocksize=4224 total=521892559 reserve=16612992
make completed successfully (05:12 (mm:ss))

5、制作升级包
root@ceshi-web:/opt/android-source/T3/androidm/build# get_uboot
No kernel param, parse it from .buildconfig
copying tools file
copying configs file
。。。省略。。。
root@ceshi-web:/opt/android-source/T3/androidm# make otapackage
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0.1
TARGET_PRODUCT=t3_p3
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=cortex-a7
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.13.0-32-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=MMB29M
OUT_DIR=out
。。。等待一段时间后。。。
Merge verity_block
Dm-Verity hash tree and metadata ready !
running: openssl pkcs8 -in build/target/product/security/testkey.pk8 -inform DER -nocrypt
running: java -Xmx2048m -jar out/host/linux-x86/framework/signapk.jar -w build/target/product/security/testkey.x509.pem build/target/product/security/testkey.pk8 /tmp/tmpeaT07m out/target/product/t3-p3/t3_p3-ota-20171214.zip
done.

make completed successfully (05:35 (mm:ss))