Commit c3c74bc3c32cbaf72ae64e5a6520379d05ad3225

Authored by Eric Lee
1 parent b22ddec542

Fix the name typo

Showing 3 changed files with 10 additions and 15 deletions Inline Diff

imx8m/smarc_mx8mq/.BoardConfig.mk.swp
No preview for this file type
imx8m/smarc_mx8mq/smarc_mx8mq_drm.mk
1 # This is a FSL Android Reference Design platform based on i.MX8MQ board 1 # This is a FSL Android Reference Design platform based on i.MX8MQ board
2 # It will inherit from FSL core product which in turn inherit from Google generic 2 # It will inherit from FSL core product which in turn inherit from Google generic
3 3
4 IMX_DEVICE_PATH := device/embedian/imx8m/smarc_mx8mq 4 IMX_DEVICE_PATH := device/embedian/imx8m/smarc_mx8mq
5 5
6 PRODUCT_IMX_DRM := true 6 PRODUCT_IMX_DRM := true
7 7
8 # copy drm specific files before inherit smarc_mx8mq.mk, otherwise copy is ignored 8 # copy drm specific files before inherit smarc_mx8mq.mk, otherwise copy is ignored
9 PRODUCT_COPY_FILES += \ 9 PRODUCT_COPY_FILES += \
10 $(IMX_DEVICE_PATH)/audio_policy_configuration_drm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \ 10 $(IMX_DEVICE_PATH)/audio_policy_configuration_drm.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
11 $(IMX_DEVICE_PATH)/init.imx8mq.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.freescale.imx8mq.main.rc \ 11 $(IMX_DEVICE_PATH)/init.imx8mq.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.freescale.imx8mq.main.rc \
12 $(IMX_DEVICE_PATH)/init.imx8mq.drm.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.freescale.imx8mq.rc \ 12 $(IMX_DEVICE_PATH)/init.imx8mq.drm.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.freescale.imx8mq.rc \
13 $(TOPDIR)device/fsl/imx8m/tee-supplicant.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/tee-supplicant.rc \ 13 $(TOPDIR)device/fsl/imx8m/tee-supplicant.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/tee-supplicant.rc \
14 14
15 15
16 $(call inherit-product, $(TOPDIR)device/embedian/imx8m/optee-packages.mk) 16 $(call inherit-product, $(TOPDIR)device/embedian/imx8m/optee-packages.mk)
17 $(call inherit-product, $(TOPDIR)$(IMX_DEVICE_PATH)/smarc_mx8mq.mk) 17 $(call inherit-product, $(TOPDIR)$(IMX_DEVICE_PATH)/smarc_mx8mq.mk)
18 18
19 TARGET_KERNEL_DEFCONFIG := smarcimx8m_android_defconfig 19 TARGET_KERNEL_DEFCONFIG := imx_v8_android_defconfig
20 TARGET_KERNEL_ADDITION_DEFCONF := android_addition_defconfig
20 21
21
22 # Overrides 22 # Overrides
23 PRODUCT_NAME := smarc_mx8mq_drm 23 PRODUCT_NAME := smarc_mx8mq_drm
24 24
25 CFG_DRM_SECURE_DATA_PATH ?= y 25 CFG_DRM_SECURE_DATA_PATH ?= y
26 CFG_RDC_SECURE_DATA_PATH ?= y 26 CFG_RDC_SECURE_DATA_PATH ?= y
27 27
28 ifeq ($(CFG_DRM_SECURE_DATA_PATH),y) 28 ifeq ($(CFG_DRM_SECURE_DATA_PATH),y)
29 CFG_SECURE_DATA_PATH := y 29 CFG_SECURE_DATA_PATH := y
30 CFG_TEE_SDP_MEM_BASE := 0xcc000000 30 CFG_TEE_SDP_MEM_BASE := 0xcc000000
31 CFG_TEE_SDP_MEM_SIZE := 0x02000000 31 CFG_TEE_SDP_MEM_SIZE := 0x02000000
32 ifeq ($(CFG_RDC_SECURE_DATA_PATH),y) 32 ifeq ($(CFG_RDC_SECURE_DATA_PATH),y)
33 DECRYPTED_BUFFER_START := $(CFG_TEE_SDP_MEM_BASE) 33 DECRYPTED_BUFFER_START := $(CFG_TEE_SDP_MEM_BASE)
34 DECRYPTED_BUFFER_LEN := $(CFG_TEE_SDP_MEM_SIZE) 34 DECRYPTED_BUFFER_LEN := $(CFG_TEE_SDP_MEM_SIZE)
35 DECODED_BUFFER_START := 0xCE000000 35 DECODED_BUFFER_START := 0xCE000000
36 DECODED_BUFFER_LEN := 0x30000000 36 DECODED_BUFFER_LEN := 0x30000000
37 endif 37 endif
38 endif 38 endif
39 39
40 TARGET_BOARD_DTS_CONFIG := \ 40 TARGET_BOARD_DTS_CONFIG := \
41 smarcimx8mq-dcss-lvds:imx8mq-smarc-dcss-lvds.dtb \ 41 imx8mq-smarc-dcss-lvds:imx8mq-smarc-dcss-lvds.dtb \
42 smarcimx8mq-dp:imx8mq-smarc-dp.dtb \ 42 imx8mq-smarc-dp:imx8mq-smarc-dp.dtb \
43 smarcimx8mq:imx8mq-smarc-drm.dtb \ 43 imx8mq-smarc:imx8mq-smarc.dtb \
44 smarcimx8mq-dual-display:imx8mq-smarc-dual-display.dtb \ 44 imx8mq-smarc-dual-display:imx8mq-smarc-dual-display.dtb \
45 smarcimx8mq-edp:imx8mq-smarc-edp.dtb \ 45 imx8mq-smarc-hdmi:imx8mq-smarc-hdmi.dtb \
46 smarcimx8mq-lcdif-lvds:imx8mq-smarc-lcdif-lvds.dtb \ 46 imx8mq-smarc-lcdif-lvds:imx8mq-smarc-lcdif-lvds.dtb
47 smarcimx8mq-hdmi:imx8mq-smarc-hdmi.dtb
48 47
49 # Exoplayer 48 # Exoplayer
50 PRODUCT_PACKAGES += \ 49 PRODUCT_PACKAGES += \
51 exoplayer \ 50 exoplayer \
52 51
53 # Playready 52 # Playready
54 PRODUCT_COPY_FILES += \ 53 PRODUCT_COPY_FILES += \
55 vendor/nxp/drm_artifacts/playready/Samples/devcert.dat:$(TARGET_COPY_OUT_VENDOR)/playready/devcert.dat \ 54 vendor/nxp/drm_artifacts/playready/Samples/devcert.dat:$(TARGET_COPY_OUT_VENDOR)/playready/devcert.dat \
56 vendor/nxp/drm_artifacts/playready/Samples/priv.dat:$(TARGET_COPY_OUT_VENDOR)/playready/priv.dat \ 55 vendor/nxp/drm_artifacts/playready/Samples/priv.dat:$(TARGET_COPY_OUT_VENDOR)/playready/priv.dat \
57 vendor/nxp/drm_artifacts/playready/bgroupcert.dat:$(TARGET_COPY_OUT_VENDOR)/playready/bgroupcert.dat \ 56 vendor/nxp/drm_artifacts/playready/bgroupcert.dat:$(TARGET_COPY_OUT_VENDOR)/playready/bgroupcert.dat \
58 vendor/nxp/drm_artifacts/playready/zgpriv_protected.dat:$(TARGET_COPY_OUT_VENDOR)/playready/zgpriv_protected.dat \ 57 vendor/nxp/drm_artifacts/playready/zgpriv_protected.dat:$(TARGET_COPY_OUT_VENDOR)/playready/zgpriv_protected.dat \
59 58
60 ifneq ($(CFG_BUILD_DRM_FROM_SOURCES),y) 59 ifneq ($(CFG_BUILD_DRM_FROM_SOURCES),y)
61 PRODUCT_COPY_FILES += \ 60 PRODUCT_COPY_FILES += \
62 vendor/nxp/drm_artifacts/playready/ta/82dbae9c-9ce0-47e0-a1cb4048cfdb84aa.ta:$(TARGET_COPY_OUT_VENDOR)/lib/optee_armtz/82dbae9c-9ce0-47e0-a1cb4048cfdb84aa.ta \ 61 vendor/nxp/drm_artifacts/playready/ta/82dbae9c-9ce0-47e0-a1cb4048cfdb84aa.ta:$(TARGET_COPY_OUT_VENDOR)/lib/optee_armtz/82dbae9c-9ce0-47e0-a1cb4048cfdb84aa.ta \
63 vendor/nxp/drm_artifacts/playready/libdrmplayreadyplugin.so:$(TARGET_COPY_OUT_VENDOR)/lib64/mediadrm/libdrmplayreadyplugin.so \ 62 vendor/nxp/drm_artifacts/playready/libdrmplayreadyplugin.so:$(TARGET_COPY_OUT_VENDOR)/lib64/mediadrm/libdrmplayreadyplugin.so \
64 vendor/nxp/drm_artifacts/playready/optee_playready_test:$(TARGET_COPY_OUT_VENDOR)/bin/optee_playready_test 63 vendor/nxp/drm_artifacts/playready/optee_playready_test:$(TARGET_COPY_OUT_VENDOR)/bin/optee_playready_test
65 endif 64 endif
66 65
67 ifneq ($(CFG_BUILD_DRM_FROM_SOURCES),y) 66 ifneq ($(CFG_BUILD_DRM_FROM_SOURCES),y)
68 # Widevine 67 # Widevine
69 PRODUCT_COPY_FILES += \ 68 PRODUCT_COPY_FILES += \
70 vendor/nxp/drm_artifacts/widevine/lib/liboemcrypto.so:$(TARGET_COPY_OUT_VENDOR)/lib/liboemcrypto.so \ 69 vendor/nxp/drm_artifacts/widevine/lib/liboemcrypto.so:$(TARGET_COPY_OUT_VENDOR)/lib/liboemcrypto.so \
71 vendor/nxp/drm_artifacts/widevine/lib/libwvdrmengine.so:$(TARGET_COPY_OUT_VENDOR)/lib/mediadrm/libwvdrmengine.so \ 70 vendor/nxp/drm_artifacts/widevine/lib/libwvdrmengine.so:$(TARGET_COPY_OUT_VENDOR)/lib/mediadrm/libwvdrmengine.so \
72 vendor/nxp/drm_artifacts/widevine/lib/libvtswidevine.so:$(TARGET_COPY_OUT_VENDOR)/lib/drm-vts-test-libs/libvtswidevine.so \ 71 vendor/nxp/drm_artifacts/widevine/lib/libvtswidevine.so:$(TARGET_COPY_OUT_VENDOR)/lib/drm-vts-test-libs/libvtswidevine.so \
73 vendor/nxp/drm_artifacts/widevine/lib64/liboemcrypto.so:$(TARGET_COPY_OUT_VENDOR)/lib64/liboemcrypto.so \ 72 vendor/nxp/drm_artifacts/widevine/lib64/liboemcrypto.so:$(TARGET_COPY_OUT_VENDOR)/lib64/liboemcrypto.so \
74 vendor/nxp/drm_artifacts/widevine/lib64/libwvdrmengine.so:$(TARGET_COPY_OUT_VENDOR)/lib64/mediadrm/libwvdrmengine.so \ 73 vendor/nxp/drm_artifacts/widevine/lib64/libwvdrmengine.so:$(TARGET_COPY_OUT_VENDOR)/lib64/mediadrm/libwvdrmengine.so \
75 vendor/nxp/drm_artifacts/widevine/lib64/libvtswidevine.so:$(TARGET_COPY_OUT_VENDOR)/lib64/drm-vts-test-libs/libvtswidevine.so \ 74 vendor/nxp/drm_artifacts/widevine/lib64/libvtswidevine.so:$(TARGET_COPY_OUT_VENDOR)/lib64/drm-vts-test-libs/libvtswidevine.so \
76 vendor/nxp/drm_artifacts/widevine/ta/706f6574-7765-6469-77656e6942656665.ta:$(TARGET_COPY_OUT_VENDOR)/lib/optee_armtz/706f6574-7765-6469-77656e6942656665.ta 75 vendor/nxp/drm_artifacts/widevine/ta/706f6574-7765-6469-77656e6942656665.ta:$(TARGET_COPY_OUT_VENDOR)/lib/optee_armtz/706f6574-7765-6469-77656e6942656665.ta
77 endif 76 endif
imx8m/smarc_mx8mq/uuu/uuu_android_smarc_flash.sh
1 #!/bin/bash -e 1 #!/bin/bash -e
2 2
3 help() { 3 help() {
4 4
5 bn=`basename $0` 5 bn=`basename $0`
6 cat << EOF 6 cat << EOF
7 7
8 Version: 1.5 8 Version: 1.5
9 Last change: generate super.img when flash images with dynamic partition feature 9 Last change: generate super.img when flash images with dynamic partition feature
10 10
11 eg: sudo ./fastboot_imx_flashall.sh -f imx8mm -a -D ~/android10/evk_8mm/ 11 eg: sudo ./fastboot_imx_flashall.sh -f imx8mm -a -D ~/android10/evk_8mm/
12 eg: sudo ./fastboot_imx_flashall.sh -f imx7ulp -D ~/android10/evk_7ulp/ 12 eg: sudo ./fastboot_imx_flashall.sh -f imx7ulp -D ~/android10/evk_7ulp/
13 13
14 Usage: $bn <option> 14 Usage: $bn <option>
15 15
16 options: 16 options:
17 -h displays this help message 17 -h displays this help message
18 -f soc_name flash android image file with soc_name 18 -f soc_name flash android image file with soc_name
19 -a only flash image to slot_a 19 -a only flash image to slot_a
20 -b only flash image to slot_b 20 -b only flash image to slot_b
21 -c card_size optional setting: 14 / 28 21 -c card_size optional setting: 14 / 28
22 If not set, use partition-table.img/partition-table-dual.img (default) 22 If not set, use partition-table.img/partition-table-dual.img (default)
23 If set to 14, use partition-table-14GB.img for 16GB SD card 23 If set to 14, use partition-table-14GB.img for 16GB SD card
24 If set to 28, use partition-table-28GB.img/partition-table-28GB-dual.img for 32GB SD card 24 If set to 28, use partition-table-28GB.img/partition-table-28GB-dual.img for 32GB SD card
25 Make sure the corresponding file exist for your platform 25 Make sure the corresponding file exist for your platform
26 -m flash mcu image 26 -m flash mcu image
27 -u uboot_feature flash uboot or spl&bootloader image with "uboot_feature" in their names 27 -u uboot_feature flash uboot or spl&bootloader image with "uboot_feature" in their names
28 For Standard Android: 28 For Standard Android:
29 If the parameter after "-u" option contains the string of "dual", then spl&bootloader image will be flashed, 29 If the parameter after "-u" option contains the string of "dual", then spl&bootloader image will be flashed,
30 otherwise uboot image will be flashed 30 otherwise uboot image will be flashed
31 For Android Automative: 31 For Android Automative:
32 only dual bootloader feature is supported, by default spl&bootloader image will be flashed 32 only dual bootloader feature is supported, by default spl&bootloader image will be flashed
33 Below table lists the legal value supported now based on the soc_name provided: 33 Below table lists the legal value supported now based on the soc_name provided:
34 ┌────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────┐ 34 ┌────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────┐
35 │ soc_name │ legal parameter after "-u" │ 35 │ soc_name │ legal parameter after "-u" │
36 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 36 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
37 │ imx8mm │ dual trusty-dual 4g-evk-uuu 4g ddr4-evk-uuu ddr4 evk-uuu trusty-4g trusty-secure-unlock trusty │ 37 │ imx8mm │ dual trusty-dual 4g-evk-uuu 4g ddr4-evk-uuu ddr4 evk-uuu trusty-4g trusty-secure-unlock trusty │
38 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 38 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
39 │ imx8mn │ dual trusty-dual evk-uuu trusty-secure-unlock trusty ddr4-evk-uuu ddr4 │ 39 │ imx8mn │ dual trusty-dual evk-uuu trusty-secure-unlock trusty ddr4-evk-uuu ddr4 │
40 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 40 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
41 │ imx8mp │ dual trusty-dual evk-uuu trusty-secure-unlock trusty │ 41 │ imx8mp │ dual trusty-dual evk-uuu trusty-secure-unlock trusty │
42 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 42 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
43 │ imx8mq │ smarc_2g trusty-smarc_2g trusty-dual-smarc_2g trusty-secure-unlock-smarc_2g smarc_4g trusty-smarc_4g trusty-dual-smarc_4g trusty-secure-unlock-smarc_4g │ 43 │ imx8mq │ smarc_2g trusty-smarc_2g trusty-dual-smarc_2g trusty-secure-unlock-smarc_2g smarc_4g trusty-smarc_4g trusty-dual-smarc_4g trusty-secure-unlock-smarc_4g │
44 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 44 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
45 ───────────────────────────────────────────────────────────────────┤ 45 ───────────────────────────────────────────────────────────────────┤
46 │ imx8mq │ smarc_4g-uuu smarc_4g-trusty-secure-unlock smarc_2g-uuu smarc_2g-trusty-secure-unlock │ 46 │ imx8mq │ smarc_4g-uuu smarc_4g-trusty-secure-unlock smarc_2g-uuu smarc_2g-trusty-secure-unlock │
47 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 47 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
48 │ imx8qxp │ mek-uuu trusty-secure-unlock trusty secure-unlock c0 trusty-c0 mek-c0-uuu │ 48 │ imx8qxp │ mek-uuu trusty-secure-unlock trusty secure-unlock c0 trusty-c0 mek-c0-uuu │
49 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 49 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
50 │ imx8qm │ mek-uuu trusty-secure-unlock trusty secure-unlock md hdmi │ 50 │ imx8qm │ mek-uuu trusty-secure-unlock trusty secure-unlock md hdmi │
51 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 51 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
52 │ imx7ulp │ evk-uuu │ 52 │ imx7ulp │ evk-uuu │
53 └────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────┘ 53 └────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────┘
54 54
55 -d dtb_feature flash dtbo, vbmeta and recovery image file with "dtb_feature" in their names 55 -d dtb_feature flash dtbo, vbmeta and recovery image file with "dtb_feature" in their names
56 If not set, default dtbo, vbmeta and recovery image will be flashed 56 If not set, default dtbo, vbmeta and recovery image will be flashed
57 Below table lists the legal value supported now based on the soc_name provided: 57 Below table lists the legal value supported now based on the soc_name provided:
58 ┌────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────┐ 58 ┌────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────┐
59 │ soc_name │ legal parameter after "-d" │ 59 │ soc_name │ legal parameter after "-d" │
60 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 60 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
61 │ imx8mm │ ddr4 m4 mipi-panel │ 61 │ imx8mm │ ddr4 m4 mipi-panel │
62 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 62 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
63 │ imx8mn │ mipi-panel rpmsg ddr4 ddr4-mipi-panel ddr4-rpmsg │ 63 │ imx8mn │ mipi-panel rpmsg ddr4 ddr4-mipi-panel ddr4-rpmsg │
64 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 64 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
65 │ imx8mq │ dual mipi-panel mipi │ 65 │ imx8mq │ hdmi dp dcss-lvds lcdif-lvds dual-display │
66 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 66 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
67 ───────────────────────────────────────────────────────────────────┤
68 │ smarcimx8mq │ hdmi dp dcss-lvds lcdif-lvds dual-display │
69 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
70 │ imx8mp │ rpmsg hdmi lvds-panel lvds mipi-panel basler ov5640 │ 67 │ imx8mp │ rpmsg hdmi lvds-panel lvds mipi-panel basler ov5640 │
71 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 68 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
72 │ imx8qxp │ │ 69 │ imx8qxp │ │
73 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 70 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
74 │ imx8qm │ hdmi mipi-panel md xen │ 71 │ imx8qm │ hdmi mipi-panel md xen │
75 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤ 72 ├────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
76 │ imx7ulp │ evk-mipi evk mipi │ 73 │ imx7ulp │ evk-mipi evk mipi │
77 └────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────┘ 74 └────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────┘
78 75
79 -e erase user data after all image files being flashed 76 -e erase user data after all image files being flashed
80 -l lock the device after all image files being flashed 77 -l lock the device after all image files being flashed
81 -D directory the directory of images 78 -D directory the directory of images
82 No need to use this option if images are in current working directory 79 No need to use this option if images are in current working directory
83 -s ser_num the serial number of board 80 -s ser_num the serial number of board
84 If only one board connected to computer, no need to use this option 81 If only one board connected to computer, no need to use this option
85 -super do not generate super.img when flash the images with dynamic partition feature enabled. 82 -super do not generate super.img when flash the images with dynamic partition feature enabled.
86 Under the condition that dynamic partition feature are enabled: 83 Under the condition that dynamic partition feature are enabled:
87 if this option is not used, super.img will be generated under temporary directory and flashed to the board. 84 if this option is not used, super.img will be generated under temporary directory and flashed to the board.
88 if this option is used, make sure super.img already exists together with other images. 85 if this option is used, make sure super.img already exists together with other images.
89 -tmp temp_dir specify the temporary directory. Default temporary directory is "/tmp". 86 -tmp temp_dir specify the temporary directory. Default temporary directory is "/tmp".
90 EOF 87 EOF
91 88
92 } 89 }
93 90
94 # this function checks whether the value of first parameter is in the array value of second parameter 91 # this function checks whether the value of first parameter is in the array value of second parameter
95 # pass the name of the (array)variable to this function. the first is potential element, the second one is array. 92 # pass the name of the (array)variable to this function. the first is potential element, the second one is array.
96 # make sure the first parameter is not empty 93 # make sure the first parameter is not empty
97 function whether_in_array 94 function whether_in_array
98 { 95 {
99 local potential_element=`eval echo \$\{${1}\}` 96 local potential_element=`eval echo \$\{${1}\}`
100 local array=(`eval echo \$\{${2}\[\*\]\}`) 97 local array=(`eval echo \$\{${2}\[\*\]\}`)
101 local array_length=${#array[*]} 98 local array_length=${#array[*]}
102 local last_element=${array[${array_length}-1]} 99 local last_element=${array[${array_length}-1]}
103 for arg in ${array[*]} 100 for arg in ${array[*]}
104 do 101 do
105 if [ "${arg}" = "${potential_element}" ]; then 102 if [ "${arg}" = "${potential_element}" ]; then
106 result_value=0 103 result_value=0
107 return 0 104 return 0
108 fi 105 fi
109 if [ "${arg}" = "${last_element}" ]; then 106 if [ "${arg}" = "${last_element}" ]; then
110 result_value=1 107 result_value=1
111 return 0 108 return 0
112 fi 109 fi
113 done 110 done
114 } 111 }
115 112
116 function flash_partition 113 function flash_partition
117 { 114 {
118 if [ ${support_dual_bootloader} -eq 1 ] && [ "$(echo ${1} | grep "bootloader_")" != "" ]; then 115 if [ ${support_dual_bootloader} -eq 1 ] && [ "$(echo ${1} | grep "bootloader_")" != "" ]; then
119 img_name=${uboot_proper_to_be_flashed} 116 img_name=${uboot_proper_to_be_flashed}
120 elif [ "$(echo ${1} | grep "system")" != "" ]; then 117 elif [ "$(echo ${1} | grep "system")" != "" ]; then
121 img_name=${systemimage_file} 118 img_name=${systemimage_file}
122 elif [ "$(echo ${1} | grep "vendor")" != "" ]; then 119 elif [ "$(echo ${1} | grep "vendor")" != "" ]; then
123 img_name=${vendor_file} 120 img_name=${vendor_file}
124 elif [ "$(echo ${1} | grep "product")" != "" ]; then 121 elif [ "$(echo ${1} | grep "product")" != "" ]; then
125 img_name=${product_file} 122 img_name=${product_file}
126 elif [ "$(echo ${1} | grep "bootloader")" != "" ]; then 123 elif [ "$(echo ${1} | grep "bootloader")" != "" ]; then
127 img_name=${bootloader_flashed_to_board} 124 img_name=${bootloader_flashed_to_board}
128 elif [ ${support_dtbo} -eq 1 ] && [ "$(echo ${1} | grep "boot")" != "" ]; then 125 elif [ ${support_dtbo} -eq 1 ] && [ "$(echo ${1} | grep "boot")" != "" ]; then
129 img_name="boot.img" 126 img_name="boot.img"
130 elif [ "$(echo ${1} | grep `echo ${mcu_os_partition}`)" != "" ]; then 127 elif [ "$(echo ${1} | grep `echo ${mcu_os_partition}`)" != "" ]; then
131 if [ "${soc_name}" = "imx7ulp" ]; then 128 if [ "${soc_name}" = "imx7ulp" ]; then
132 img_name="${soc_name}_m4_demo.img" 129 img_name="${soc_name}_m4_demo.img"
133 else 130 else
134 img_name="${soc_name}_mcu_demo.img" 131 img_name="${soc_name}_mcu_demo.img"
135 fi 132 fi
136 elif [ "$(echo ${1} | grep -E "dtbo|vbmeta|recovery")" != "" -a "${dtb_feature}" != "" ]; then 133 elif [ "$(echo ${1} | grep -E "dtbo|vbmeta|recovery")" != "" -a "${dtb_feature}" != "" ]; then
137 img_name="${1%_*}-${soc_name}-smarc-${dtb_feature}.img" 134 img_name="${1%_*}-${soc_name}-smarc-${dtb_feature}.img"
138 elif [ "$(echo ${1} | grep "gpt")" != "" ]; then 135 elif [ "$(echo ${1} | grep "gpt")" != "" ]; then
139 img_name=${partition_file} 136 img_name=${partition_file}
140 elif [ "$(echo ${1} | grep "super")" != "" ]; then 137 elif [ "$(echo ${1} | grep "super")" != "" ]; then
141 if [ ${dont_generate_super} -eq 0 ]; then 138 if [ ${dont_generate_super} -eq 0 ]; then
142 make_super_image 139 make_super_image
143 fi 140 fi
144 img_name=${super_file} 141 img_name=${super_file}
145 else 142 else
146 img_name="${1%_*}-${soc_name}.img" 143 img_name="${1%_*}-${soc_name}.img"
147 fi 144 fi
148 145
149 echo -e flash the file of ${GREEN}${img_name}${STD} to the partition of ${GREEN}${1}${STD} 146 echo -e flash the file of ${GREEN}${img_name}${STD} to the partition of ${GREEN}${1}${STD}
150 if [ "${img_name}" = "${super_file}" ] && [ ${dont_generate_super} -eq 0 ]; then 147 if [ "${img_name}" = "${super_file}" ] && [ ${dont_generate_super} -eq 0 ]; then
151 ${fastboot_tool} flash ${1} "${temp_dir}${img_name}" 148 ${fastboot_tool} flash ${1} "${temp_dir}${img_name}"
152 else 149 else
153 ${fastboot_tool} flash ${1} "${image_directory}${img_name}" 150 ${fastboot_tool} flash ${1} "${image_directory}${img_name}"
154 fi 151 fi
155 } 152 }
156 153
157 function flash_userpartitions 154 function flash_userpartitions
158 { 155 {
159 if [ ${support_dtbo} -eq 1 ]; then 156 if [ ${support_dtbo} -eq 1 ]; then
160 flash_partition ${dtbo_partition} 157 flash_partition ${dtbo_partition}
161 fi 158 fi
162 159
163 flash_partition ${boot_partition} 160 flash_partition ${boot_partition}
164 161
165 if [ ${support_recovery} -eq 1 ]; then 162 if [ ${support_recovery} -eq 1 ]; then
166 flash_partition ${recovery_partition} 163 flash_partition ${recovery_partition}
167 fi 164 fi
168 165
169 if [ ${support_dynamic_partition} -eq 0 ]; then 166 if [ ${support_dynamic_partition} -eq 0 ]; then
170 flash_partition ${system_partition} 167 flash_partition ${system_partition}
171 flash_partition ${vendor_partition} 168 flash_partition ${vendor_partition}
172 flash_partition ${product_partition} 169 flash_partition ${product_partition}
173 fi 170 fi
174 flash_partition ${vbmeta_partition} 171 flash_partition ${vbmeta_partition}
175 } 172 }
176 173
177 function flash_partition_name 174 function flash_partition_name
178 { 175 {
179 boot_partition="boot"${1} 176 boot_partition="boot"${1}
180 recovery_partition="recovery"${1} 177 recovery_partition="recovery"${1}
181 system_partition="system"${1} 178 system_partition="system"${1}
182 vendor_partition="vendor"${1} 179 vendor_partition="vendor"${1}
183 product_partition="product"${1} 180 product_partition="product"${1}
184 vbmeta_partition="vbmeta"${1} 181 vbmeta_partition="vbmeta"${1}
185 dtbo_partition="dtbo"${1} 182 dtbo_partition="dtbo"${1}
186 } 183 }
187 184
188 function flash_android 185 function flash_android
189 { 186 {
190 # a precondition: the location of gpt partition and the partition for uboot or spl(in dual bootloader condition) 187 # a precondition: the location of gpt partition and the partition for uboot or spl(in dual bootloader condition)
191 # should be the same for the u-boot just boot up the board and the on to be flashed to the board 188 # should be the same for the u-boot just boot up the board and the on to be flashed to the board
192 flash_partition "gpt" 189 flash_partition "gpt"
193 190
194 ${fastboot_tool} getvar all 2>${temp_dir}fastboot_var.log 191 ${fastboot_tool} getvar all 2>${temp_dir}fastboot_var.log
195 grep -q "bootloader_a" ${temp_dir}fastboot_var.log && support_dual_bootloader=1 192 grep -q "bootloader_a" ${temp_dir}fastboot_var.log && support_dual_bootloader=1
196 grep -q "dtbo" ${temp_dir}fastboot_var.log && support_dtbo=1 193 grep -q "dtbo" ${temp_dir}fastboot_var.log && support_dtbo=1
197 grep -q "recovery" ${temp_dir}fastboot_var.log && support_recovery=1 194 grep -q "recovery" ${temp_dir}fastboot_var.log && support_recovery=1
198 # use boot_b to check whether current gpt support a/b slot 195 # use boot_b to check whether current gpt support a/b slot
199 grep -q "boot_b" ${temp_dir}fastboot_var.log && support_dualslot=1 196 grep -q "boot_b" ${temp_dir}fastboot_var.log && support_dualslot=1
200 grep -q "super" ${temp_dir}fastboot_var.log && support_dynamic_partition=1 197 grep -q "super" ${temp_dir}fastboot_var.log && support_dynamic_partition=1
201 198
202 # some partitions are hard-coded in uboot, flash the uboot first and then reboot to check these partitions 199 # some partitions are hard-coded in uboot, flash the uboot first and then reboot to check these partitions
203 200
204 # uboot or spl&bootloader 201 # uboot or spl&bootloader
205 if [ ${support_dual_bootloader} -eq 1 ]; then 202 if [ ${support_dual_bootloader} -eq 1 ]; then
206 bootloader_flashed_to_board="spl-${soc_name}${uboot_feature}.bin" 203 bootloader_flashed_to_board="spl-${soc_name}${uboot_feature}.bin"
207 uboot_proper_to_be_flashed="bootloader-${soc_name}${uboot_feature}.img" 204 uboot_proper_to_be_flashed="bootloader-${soc_name}${uboot_feature}.img"
208 else 205 else
209 bootloader_flashed_to_board="u-boot-${soc_name}${uboot_feature}.imx" 206 bootloader_flashed_to_board="u-boot-${soc_name}${uboot_feature}.imx"
210 fi 207 fi
211 208
212 # in the source code, if AB slot feature is supported, uboot partition name is bootloader0, otherwise it's bootloader 209 # in the source code, if AB slot feature is supported, uboot partition name is bootloader0, otherwise it's bootloader
213 if [ ${support_dualslot} -eq 1 ]; then 210 if [ ${support_dualslot} -eq 1 ]; then
214 flash_partition "bootloader0" 211 flash_partition "bootloader0"
215 else 212 else
216 flash_partition "bootloader" 213 flash_partition "bootloader"
217 fi 214 fi
218 215
219 # if a platform doesn't support dual slot but a slot is selected, ignore it. 216 # if a platform doesn't support dual slot but a slot is selected, ignore it.
220 if [ ${support_dualslot} -eq 0 ] && [ "${slot}" != "" ]; then 217 if [ ${support_dualslot} -eq 0 ] && [ "${slot}" != "" ]; then
221 slot="" 218 slot=""
222 fi 219 fi
223 220
224 221
225 #if dual-bootloader feature is supported, we need to flash the u-boot proper then reboot to get hard-coded partition info 222 #if dual-bootloader feature is supported, we need to flash the u-boot proper then reboot to get hard-coded partition info
226 if [ ${support_dual_bootloader} -eq 1 ]; then 223 if [ ${support_dual_bootloader} -eq 1 ]; then
227 if [ "${slot}" != "" ]; then 224 if [ "${slot}" != "" ]; then
228 dual_bootloader_partition="bootloader"${slot} 225 dual_bootloader_partition="bootloader"${slot}
229 flash_partition ${dual_bootloader_partition} 226 flash_partition ${dual_bootloader_partition}
230 ${fastboot_tool} set_active ${slot#_} 227 ${fastboot_tool} set_active ${slot#_}
231 else 228 else
232 dual_bootloader_partition="bootloader_a" 229 dual_bootloader_partition="bootloader_a"
233 flash_partition ${dual_bootloader_partition} 230 flash_partition ${dual_bootloader_partition}
234 dual_bootloader_partition="bootloader_b" 231 dual_bootloader_partition="bootloader_b"
235 flash_partition ${dual_bootloader_partition} 232 flash_partition ${dual_bootloader_partition}
236 ${fastboot_tool} set_active a 233 ${fastboot_tool} set_active a
237 fi 234 fi
238 fi 235 fi
239 236
240 # full uboot is flashed to the board and active slot is set, reboot to u-boot fastboot boot command 237 # full uboot is flashed to the board and active slot is set, reboot to u-boot fastboot boot command
241 ${fastboot_tool} reboot bootloader 238 ${fastboot_tool} reboot bootloader
242 sleep 5 239 sleep 5
243 240
244 ${fastboot_tool} getvar all 2>${temp_dir}fastboot_var.log 241 ${fastboot_tool} getvar all 2>${temp_dir}fastboot_var.log
245 grep -q `echo ${mcu_os_partition}` ${temp_dir}fastboot_var.log && support_mcu_os=1 242 grep -q `echo ${mcu_os_partition}` ${temp_dir}fastboot_var.log && support_mcu_os=1
246 243
247 if [ ${flash_mcu} -eq 1 -a ${support_mcu_os} -eq 1 ]; then 244 if [ ${flash_mcu} -eq 1 -a ${support_mcu_os} -eq 1 ]; then
248 flash_partition ${mcu_os_partition} 245 flash_partition ${mcu_os_partition}
249 fi 246 fi
250 247
251 if [ "${slot}" = "" ] && [ ${support_dualslot} -eq 1 ]; then 248 if [ "${slot}" = "" ] && [ ${support_dualslot} -eq 1 ]; then
252 #flash image to a and b slot 249 #flash image to a and b slot
253 flash_partition_name "_a" 250 flash_partition_name "_a"
254 flash_userpartitions 251 flash_userpartitions
255 252
256 flash_partition_name "_b" 253 flash_partition_name "_b"
257 flash_userpartitions 254 flash_userpartitions
258 else 255 else
259 flash_partition_name ${slot} 256 flash_partition_name ${slot}
260 flash_userpartitions 257 flash_userpartitions
261 fi 258 fi
262 # super partition does not have a/b slot, handle it individually 259 # super partition does not have a/b slot, handle it individually
263 if [ ${support_dynamic_partition} -eq 1 ]; then 260 if [ ${support_dynamic_partition} -eq 1 ]; then
264 flash_partition ${super_partition} 261 flash_partition ${super_partition}
265 fi 262 fi
266 } 263 }
267 264
268 # this function will invoke lpmake to create super.img, the super.img will 265 # this function will invoke lpmake to create super.img, the super.img will
269 # be created in temporary directory, make sure that there is enouth space 266 # be created in temporary directory, make sure that there is enouth space
270 function make_super_image 267 function make_super_image
271 { 268 {
272 rm -rf ${temp_dir}${super_file} 269 rm -rf ${temp_dir}${super_file}
273 # now dynamic partition is only enabled in dual slot condition 270 # now dynamic partition is only enabled in dual slot condition
274 if [ ${support_dualslot} -eq 1 ]; then 271 if [ ${support_dualslot} -eq 1 ]; then
275 if [ "${slot}" == "_a" ]; then 272 if [ "${slot}" == "_a" ]; then
276 lpmake_system_image_a="--image system_a=${image_directory}${systemimage_file}" 273 lpmake_system_image_a="--image system_a=${image_directory}${systemimage_file}"
277 lpmake_vendor_image_a="--image vendor_a=${image_directory}${vendor_file}" 274 lpmake_vendor_image_a="--image vendor_a=${image_directory}${vendor_file}"
278 lpmake_product_image_a="--image product_a=${image_directory}${product_file}" 275 lpmake_product_image_a="--image product_a=${image_directory}${product_file}"
279 elif [ "${slot}" == "_b" ]; then 276 elif [ "${slot}" == "_b" ]; then
280 lpmake_system_image_b="--image system_b=${image_directory}${systemimage_file}" 277 lpmake_system_image_b="--image system_b=${image_directory}${systemimage_file}"
281 lpmake_vendor_image_b="--image vendor_b=${image_directory}${vendor_file}" 278 lpmake_vendor_image_b="--image vendor_b=${image_directory}${vendor_file}"
282 lpmake_product_image_b="--image product_b=${image_directory}${product_file}" 279 lpmake_product_image_b="--image product_b=${image_directory}${product_file}"
283 else 280 else
284 lpmake_system_image_a="--image system_a=${image_directory}${systemimage_file}" 281 lpmake_system_image_a="--image system_a=${image_directory}${systemimage_file}"
285 lpmake_vendor_image_a="--image vendor_a=${image_directory}${vendor_file}" 282 lpmake_vendor_image_a="--image vendor_a=${image_directory}${vendor_file}"
286 lpmake_product_image_a="--image product_a=${image_directory}${product_file}" 283 lpmake_product_image_a="--image product_a=${image_directory}${product_file}"
287 lpmake_system_image_b="--image system_b=${image_directory}${systemimage_file}" 284 lpmake_system_image_b="--image system_b=${image_directory}${systemimage_file}"
288 lpmake_vendor_image_b="--image vendor_b=${image_directory}${vendor_file}" 285 lpmake_vendor_image_b="--image vendor_b=${image_directory}${vendor_file}"
289 lpmake_product_image_b="--image product_b=${image_directory}${product_file}" 286 lpmake_product_image_b="--image product_b=${image_directory}${product_file}"
290 fi 287 fi
291 fi 288 fi
292 289
293 ${image_directory}lpmake --metadata-size 65536 --super-name super --metadata-slots 3 --device super:7516192768 \ 290 ${image_directory}lpmake --metadata-size 65536 --super-name super --metadata-slots 3 --device super:7516192768 \
294 --group nxp_dynamic_partitions_a:3747610624 --group nxp_dynamic_partitions_b:3747610624 \ 291 --group nxp_dynamic_partitions_a:3747610624 --group nxp_dynamic_partitions_b:3747610624 \
295 --partition system_a:readonly:0:nxp_dynamic_partitions_a ${lpmake_system_image_a} \ 292 --partition system_a:readonly:0:nxp_dynamic_partitions_a ${lpmake_system_image_a} \
296 --partition system_b:readonly:0:nxp_dynamic_partitions_b ${lpmake_system_image_b} \ 293 --partition system_b:readonly:0:nxp_dynamic_partitions_b ${lpmake_system_image_b} \
297 --partition vendor_a:readonly:0:nxp_dynamic_partitions_a ${lpmake_vendor_image_a} \ 294 --partition vendor_a:readonly:0:nxp_dynamic_partitions_a ${lpmake_vendor_image_a} \
298 --partition vendor_b:readonly:0:nxp_dynamic_partitions_b ${lpmake_vendor_image_b} \ 295 --partition vendor_b:readonly:0:nxp_dynamic_partitions_b ${lpmake_vendor_image_b} \
299 --partition product_a:readonly:0:nxp_dynamic_partitions_a ${lpmake_product_image_a} \ 296 --partition product_a:readonly:0:nxp_dynamic_partitions_a ${lpmake_product_image_a} \
300 --partition product_b:readonly:0:nxp_dynamic_partitions_b ${lpmake_product_image_b} \ 297 --partition product_b:readonly:0:nxp_dynamic_partitions_b ${lpmake_product_image_b} \
301 --sparse --output ${temp_dir}${super_file} 298 --sparse --output ${temp_dir}${super_file}
302 } 299 }
303 300
304 301
305 # parse command line 302 # parse command line
306 soc_name="" 303 soc_name=""
307 uboot_feature="" 304 uboot_feature=""
308 dtb_feature="" 305 dtb_feature=""
309 card_size=0 306 card_size=0
310 slot="" 307 slot=""
311 systemimage_file="system.img" 308 systemimage_file="system.img"
312 vendor_file="vendor.img" 309 vendor_file="vendor.img"
313 product_file="product.img" 310 product_file="product.img"
314 partition_file="partition-table.img" 311 partition_file="partition-table.img"
315 super_file="super.img" 312 super_file="super.img"
316 support_dtbo=0 313 support_dtbo=0
317 support_recovery=0 314 support_recovery=0
318 support_dualslot=0 315 support_dualslot=0
319 support_mcu_os=0 316 support_mcu_os=0
320 support_dual_bootloader=0 317 support_dual_bootloader=0
321 support_dynamic_partition=0 318 support_dynamic_partition=0
322 dual_bootloader_partition="" 319 dual_bootloader_partition=""
323 bootloader_flashed_to_board="" 320 bootloader_flashed_to_board=""
324 uboot_proper_to_be_flashed="" 321 uboot_proper_to_be_flashed=""
325 boot_partition="boot" 322 boot_partition="boot"
326 recovery_partition="recovery" 323 recovery_partition="recovery"
327 system_partition="system" 324 system_partition="system"
328 vendor_partition="vendor" 325 vendor_partition="vendor"
329 product_partition="product" 326 product_partition="product"
330 vbmeta_partition="vbmeta" 327 vbmeta_partition="vbmeta"
331 dtbo_partition="dtbo" 328 dtbo_partition="dtbo"
332 mcu_os_partition="mcu_os" 329 mcu_os_partition="mcu_os"
333 super_partition="super" 330 super_partition="super"
334 flash_mcu=0 331 flash_mcu=0
335 lock=0 332 lock=0
336 erase=0 333 erase=0
337 image_directory="" 334 image_directory=""
338 ser_num="" 335 ser_num=""
339 fastboot_tool="fastboot" 336 fastboot_tool="fastboot"
340 RED='\033[0;31m' 337 RED='\033[0;31m'
341 STD='\033[0;0m' 338 STD='\033[0;0m'
342 GREEN='\033[0;32m' 339 GREEN='\033[0;32m'
343 lpmake_system_image_a="" 340 lpmake_system_image_a=""
344 lpmake_system_image_b="" 341 lpmake_system_image_b=""
345 lpmake_vendor_image_a="" 342 lpmake_vendor_image_a=""
346 lpmake_vendor_image_b="" 343 lpmake_vendor_image_b=""
347 lpmake_product_image_a="" 344 lpmake_product_image_a=""
348 lpmake_product_image_b="" 345 lpmake_product_image_b=""
349 result_value=0 346 result_value=0
350 dont_generate_super=0 347 dont_generate_super=0
351 temp_dir="/tmp/" 348 temp_dir="/tmp/"
352 349
353 350
354 # We want to detect illegal feature input to some extent. Here it's based on SoC names. Since an SoC may be on a 351 # We want to detect illegal feature input to some extent. Here it's based on SoC names. Since an SoC may be on a
355 # board running different set of images(android and automative for a example), so misuse the features of one set of 352 # board running different set of images(android and automative for a example), so misuse the features of one set of
356 # images when flash another set of images can not be detect early with this scenario. 353 # images when flash another set of images can not be detect early with this scenario.
357 imx8mm_uboot_feature=(dual trusty-dual 4g-evk-uuu 4g ddr4-evk-uuu ddr4 evk-uuu trusty-4g trusty-secure-unlock trusty) 354 imx8mm_uboot_feature=(dual trusty-dual 4g-evk-uuu 4g ddr4-evk-uuu ddr4 evk-uuu trusty-4g trusty-secure-unlock trusty)
358 imx8mn_uboot_feature=(dual trusty-dual evk-uuu trusty-secure-unlock trusty ddr4-evk-uuu ddr4) 355 imx8mn_uboot_feature=(dual trusty-dual evk-uuu trusty-secure-unlock trusty ddr4-evk-uuu ddr4)
359 imx8mq_uboot_feature=(smarc_2g smarc_2g-dp trusty-smarc_2g trustu-dual-smarc_2g trusty-secure-unlock-smarc_2g smarc_4g smarc_4g-dp trusty-smarc_4g trustu-dual-smarc_4g trusty-secure-unlock-smarc_4g) 356 imx8mq_uboot_feature=(smarc_2g smarc_2g-dp trusty-smarc_2g trustu-dual-smarc_2g trusty-secure-unlock-smarc_2g smarc_4g smarc_4g-dp trusty-smarc_4g trustu-dual-smarc_4g trusty-secure-unlock-smarc_4g)
360 smarcimx8mq_uboot_feature=(smarc_4g smarc_4g-uuu smarc_4g-trusty-secure-unlock smarc_4g-trusty smarc_2g smarc_2g-uuu smarc_2g-trusty-secure-unlock smarc_2g-trusty)
361 imx8mp_uboot_feature=(dual trusty-dual evk-uuu trusty-secure-unlock trusty) 357 imx8mp_uboot_feature=(dual trusty-dual evk-uuu trusty-secure-unlock trusty)
362 imx8qxp_uboot_feature=(mek-uuu trusty-secure-unlock trusty secure-unlock c0 trusty-c0 mek-c0-uuu) 358 imx8qxp_uboot_feature=(mek-uuu trusty-secure-unlock trusty secure-unlock c0 trusty-c0 mek-c0-uuu)
363 imx8qm_uboot_feature=(mek-uuu trusty-secure-unlock trusty secure-unlock md hdmi) 359 imx8qm_uboot_feature=(mek-uuu trusty-secure-unlock trusty secure-unlock md hdmi)
364 imx7ulp_uboot_feature=(evk-uuu) 360 imx7ulp_uboot_feature=(evk-uuu)
365 361
366 imx8mm_dtb_feature=(ddr4 m4 mipi-panel) 362 imx8mm_dtb_feature=(ddr4 m4 mipi-panel)
367 imx8mn_dtb_feature=(mipi-panel rpmsg ddr4 ddr4-mipi-panel ddr4-rpmsg) 363 imx8mn_dtb_feature=(mipi-panel rpmsg ddr4 ddr4-mipi-panel ddr4-rpmsg)
368 imx8mq_dtb_feature=(hdmi dcss-lvds lcdif-lvds dp dual-display) 364 imx8mq_dtb_feature=(hdmi dcss-lvds lcdif-lvds dp dual-display)
369 imx8mp_dtb_feature=(rpmsg hdmi lvds-panel lvds mipi-panel basler ov5640) 365 imx8mp_dtb_feature=(rpmsg hdmi lvds-panel lvds mipi-panel basler ov5640)
370 imx8qxp_dtb_feature=() 366 imx8qxp_dtb_feature=()
371 imx8qm_dtb_feature=(hdmi mipi-panel md xen) 367 imx8qm_dtb_feature=(hdmi mipi-panel md xen)
372 imx7ulp_dtb_feature=(evk-mipi evk mipi) 368 imx7ulp_dtb_feature=(evk-mipi evk mipi)
373 369
374 # an array to collect the supported soc_names 370 # an array to collect the supported soc_names
375 supported_soc_names=(imx8qm imx8qxp imx8mq smarcimx8mq imx8mm imx8mn imx8mp imx7ulp) 371 supported_soc_names=(imx8qm imx8qxp imx8mq imx8mm imx8mn imx8mp imx7ulp)
376 372
377 if [ $# -eq 0 ]; then 373 if [ $# -eq 0 ]; then
378 echo -e ${RED}no parameter specified, will directly exit after displaying help message${STD} 374 echo -e ${RED}no parameter specified, will directly exit after displaying help message${STD}
379 help; exit 1; 375 help; exit 1;
380 fi 376 fi
381 while [ $# -gt 0 ]; do 377 while [ $# -gt 0 ]; do
382 case $1 in 378 case $1 in
383 -h) help; exit ;; 379 -h) help; exit ;;
384 -f) soc_name=$2; shift;; 380 -f) soc_name=$2; shift;;
385 -c) card_size=$2; shift;; 381 -c) card_size=$2; shift;;
386 -u) uboot_feature=-$2; shift;; 382 -u) uboot_feature=-$2; shift;;
387 -d) dtb_feature=$2; shift;; 383 -d) dtb_feature=$2; shift;;
388 -a) slot="_a" ;; 384 -a) slot="_a" ;;
389 -b) slot="_b" ;; 385 -b) slot="_b" ;;
390 -m) flash_mcu=1 ;; 386 -m) flash_mcu=1 ;;
391 -e) erase=1 ;; 387 -e) erase=1 ;;
392 -l) lock=1 ;; 388 -l) lock=1 ;;
393 -D) image_directory=$2; shift;; 389 -D) image_directory=$2; shift;;
394 -s) ser_num=$2; shift;; 390 -s) ser_num=$2; shift;;
395 -super) dont_generate_super=1 ;; 391 -super) dont_generate_super=1 ;;
396 -tmp) temp_dir=$2; shift;; 392 -tmp) temp_dir=$2; shift;;
397 *) echo -e ${RED}$1${STD} is not an illegal option 393 *) echo -e ${RED}$1${STD} is not an illegal option
398 help; exit;; 394 help; exit;;
399 esac 395 esac
400 shift 396 shift
401 done 397 done
402 398
403 # check whether the soc_name is legal or not 399 # check whether the soc_name is legal or not
404 if [ -n "${soc_name}" ]; then 400 if [ -n "${soc_name}" ]; then
405 whether_in_array soc_name supported_soc_names 401 whether_in_array soc_name supported_soc_names
406 if [ ${result_value} != 0 ]; then 402 if [ ${result_value} != 0 ]; then
407 echo -e >&2 ${RED}illegal soc_name \"${soc_name}\"${STD} 403 echo -e >&2 ${RED}illegal soc_name \"${soc_name}\"${STD}
408 help; exit 1; 404 help; exit 1;
409 fi 405 fi
410 else 406 else
411 echo -e >&2 ${RED}use \"-f\" option to specify the soc name${STD} 407 echo -e >&2 ${RED}use \"-f\" option to specify the soc name${STD}
412 fi 408 fi
413 409
414 410
415 # Process of the uboot_feature parameter 411 # Process of the uboot_feature parameter
416 if [[ "${uboot_feature}" = *"dual"* ]]; then 412 if [[ "${uboot_feature}" = *"dual"* ]]; then
417 support_dual_bootloader=1; 413 support_dual_bootloader=1;
418 fi 414 fi
419 415
420 # if card_size is not correctly set, exit. 416 # if card_size is not correctly set, exit.
421 if [ ${card_size} -ne 0 ] && [ ${card_size} -ne 7 ] && [ ${card_size} -ne 14 ] && [ ${card_size} -ne 28 ]; then 417 if [ ${card_size} -ne 0 ] && [ ${card_size} -ne 7 ] && [ ${card_size} -ne 14 ] && [ ${card_size} -ne 28 ]; then
422 help; exit 1; 418 help; exit 1;
423 fi 419 fi
424 420
425 # Android Automative by default support dual bootloader, no "dual" in its partition table name 421 # Android Automative by default support dual bootloader, no "dual" in its partition table name
426 if [ ${support_dual_bootloader} -eq 1 ]; then 422 if [ ${support_dual_bootloader} -eq 1 ]; then
427 if [ ${card_size} -gt 0 ]; then 423 if [ ${card_size} -gt 0 ]; then
428 partition_file="partition-table-${card_size}GB-dual.img"; 424 partition_file="partition-table-${card_size}GB-dual.img";
429 425
430 else 426 else
431 partition_file="partition-table-dual.img"; 427 partition_file="partition-table-dual.img";
432 fi 428 fi
433 else 429 else
434 if [ ${card_size} -gt 0 ]; then 430 if [ ${card_size} -gt 0 ]; then
435 partition_file="partition-table-${card_size}GB.img"; 431 partition_file="partition-table-${card_size}GB.img";
436 else 432 else
437 partition_file="partition-table.img"; 433 partition_file="partition-table.img";
438 fi 434 fi
439 fi 435 fi
440 436
441 if [[ "${temp_dir}" != "" ]]; then 437 if [[ "${temp_dir}" != "" ]]; then
442 temp_dir="${temp_dir%/}/"; 438 temp_dir="${temp_dir%/}/";
443 mkdir -p ${temp_dir} 439 mkdir -p ${temp_dir}
444 fi 440 fi
445 441
446 # if directory is specified, make sure there is a slash at the end 442 # if directory is specified, make sure there is a slash at the end
447 if [[ "${image_directory}" = "" ]]; then 443 if [[ "${image_directory}" = "" ]]; then
448 image_directory=`pwd` 444 image_directory=`pwd`
449 fi 445 fi
450 image_directory="${image_directory%/}/" 446 image_directory="${image_directory%/}/"
451 447
452 if [[ "${ser_num}" != "" ]]; then 448 if [[ "${ser_num}" != "" ]]; then
453 fastboot_tool="fastboot -s ${ser_num}" 449 fastboot_tool="fastboot -s ${ser_num}"
454 fi 450 fi
455 451
456 # check whether provided spl/bootloader/uboot feature is legal 452 # check whether provided spl/bootloader/uboot feature is legal
457 if [ -n "${uboot_feature}" ]; then 453 if [ -n "${uboot_feature}" ]; then
458 uboot_feature_no_pre_hyphen=${uboot_feature#-} 454 uboot_feature_no_pre_hyphen=${uboot_feature#-}
459 whether_in_array uboot_feature_no_pre_hyphen ${soc_name}_uboot_feature 455 whether_in_array uboot_feature_no_pre_hyphen ${soc_name}_uboot_feature
460 if [ ${result_value} != 0 ]; then 456 if [ ${result_value} != 0 ]; then
461 echo -e >&2 ${RED}illegal parameter \"${uboot_feature_no_pre_hyphen}\" for \"-u\" option${STD} 457 echo -e >&2 ${RED}illegal parameter \"${uboot_feature_no_pre_hyphen}\" for \"-u\" option${STD}
462 help; exit 1; 458 help; exit 1;
463 fi 459 fi
464 fi 460 fi
465 461
466 # check whether provided dtb feature is legal 462 # check whether provided dtb feature is legal
467 if [ -n "${dtb_feature}" ]; then 463 if [ -n "${dtb_feature}" ]; then
468 dtb_feature_no_pre_hyphen=${dtb_feature#-} 464 dtb_feature_no_pre_hyphen=${dtb_feature#-}
469 whether_in_array dtb_feature_no_pre_hyphen ${soc_name}_dtb_feature 465 whether_in_array dtb_feature_no_pre_hyphen ${soc_name}_dtb_feature
470 if [ ${result_value} != 0 ]; then 466 if [ ${result_value} != 0 ]; then
471 echo -e >&2 ${RED}illegal parameter \"${dtb_feature}\" for \"-d\" option${STD} 467 echo -e >&2 ${RED}illegal parameter \"${dtb_feature}\" for \"-d\" option${STD}
472 help; exit 1; 468 help; exit 1;
473 fi 469 fi
474 fi 470 fi
475 471
476 flash_android 472 flash_android
477 473
478 if [ ${erase} -eq 1 ]; then 474 if [ ${erase} -eq 1 ]; then
479 if [ ${support_dualslot} -eq 0 ] ; then 475 if [ ${support_dualslot} -eq 0 ] ; then
480 ${fastboot_tool} erase cache 476 ${fastboot_tool} erase cache
481 fi 477 fi
482 ${fastboot_tool} erase misc 478 ${fastboot_tool} erase misc
483 ${fastboot_tool} erase metadata 479 ${fastboot_tool} erase metadata
484 ${fastboot_tool} erase userdata 480 ${fastboot_tool} erase userdata
485 fi 481 fi
486 482
487 if [ ${lock} -eq 1 ]; then 483 if [ ${lock} -eq 1 ]; then
488 ${fastboot_tool} oem lock 484 ${fastboot_tool} oem lock
489 fi 485 fi
490 486
491 if [ ${support_dualslot} -eq 1 ] && [ "${slot}" != "" ]; then 487 if [ ${support_dualslot} -eq 1 ] && [ "${slot}" != "" ]; then
492 ${fastboot_tool} set_active ${slot#_} 488 ${fastboot_tool} set_active ${slot#_}
493 fi 489 fi
494 490
495 echo 491 echo
496 echo ">>>>>>>>>>>>>> Flashing successfully completed <<<<<<<<<<<<<<" 492 echo ">>>>>>>>>>>>>> Flashing successfully completed <<<<<<<<<<<<<<"
497 493
498 exit 0 494 exit 0
499 495
500 496