19 May, 2020

8 commits

  • Current driver calls the devfdt_get_addr to get the base address
    of lpi2c controller in each sub-functions. Since the devfdt_get_addr
    accesses the DTB and translate the address, it introduces much
    overhead.
    Improve the codes to use private variable which has recorded the
    base address from probe.

    Signed-off-by: Ye Li
    Reviewed-by: Peng Fan
    (cherry picked from commit 59f728f4a2bdd6b005f7e9f3a33f84c7bce0f677)

    Ye Li
     
  • Remove the child device binding codes for clk and iomux nodes, because
    the misc uclass has added such operation in post-bind. If we keep the
    codes in scu bind, child devices will be created twices. Find the
    problem by "dm uclass" command.

    uclass 24: clk
    0 * clk @ fce22380, seq 0, (req -1)
    1 clk @ fce23110

    uclass 67: pinctrl
    0 * iomuxc @ fce22470, seq 0, (req -1)
    1 iomuxc @ fce231c0

    After the fix:

    uclass 24: clk
    0 * clk @ fce22380, seq 0, (req -1)

    uclass 67: pinctrl
    0 * iomuxc @ fce22470, seq 0, (req -1)

    Signed-off-by: Ye Li
    Reviewed-by: Peng Fan
    (cherry picked from commit 927674dd70cda8512f6bbc47a79babd9a3ec4081)

    Ye Li
     
  • Open configs to enable the avb warning logo feature for all
    standard android platforms.

    Test: Warning logo show on imx7ulp/imx8m/imx8q.

    Change-Id: I657364745ac4968394b6a7b99f47ca72be49501f
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Add board level implementation to get the ON-OFF button
    status for imx8q/imx8m.

    Test: Get ON-OFF button status on imx7ulp/imx8m/imx8q.

    Change-Id: I8e4ea61ec1c52ab7cfa20b5498756a25f3cd2f8d
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Porting the scu api 'sc_misc_get_button_status()' to get the
    ON-OFF button status.

    Test: Get the ON-OFF button status.

    Change-Id: I8e06ef4dc170750fe2dfbeeba7850b5e0dcfc774
    Signed-off-by: Ji Luo

    Ji Luo
     
  • According to the google boot flow, an orange warning should
    be displayed on UNLOCKED device to reminder the users of the
    potential risks.

    This commit will show an orange warning logo and warning text
    on the screen, it shall be dismissed after 3 seconds, users
    can also skip it by pressing the ON-OFF button.

    Config 'CONFIG_AVB_WARNING_LOGO_COLS' and 'CONFIG_AVB_WARNING_LOGO_ROWS'
    define the (x, y) position of the warning logo, its default
    value is for 1080*720 resolution display and can be overridden.

    Test: Orange warning logo show on all imx8m/imx8q platfroms.

    Change-Id: I607edb3da039b47ddfac681f855834d8da187af8
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Open configs to enable splash screen feature for standard
    android.

    Test: Splash screen show on all imx7ulp/imx8/imx8m platfroms.

    Change-Id: Ie54aa6b1fa2ff0d9a14f9b28a7bec4de5a98d422
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Some gpio pins are disabled for automotive to save boot time, but now
    we need to enable them on uboot 2020 or the display won't work.

    Test: boots with lvds-hdmi display on imx8qm.

    Change-Id: I02a77c08e2916d2c684f15be33f909f803936230
    Signed-off-by: Ji Luo

    Ji Luo
     

18 May, 2020

32 commits

  • Only check the bootloader rollback index and trusty keyslot package
    for rpmb key flashed boards.

    Test: boots on boards without rpmb key.

    Change-Id: I130e4d906c0f08d602eac820ec5612214e01ff55
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Add board level support and configs for standard android and android automotive,
    each board has android/android auto specific header files include.

    Test: boot/fastboot/avb/AB switch/trusty test.

    Change-Id: I3beb84f251451d0003f0ef44d0cba51d0d773ca3
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Include correct header files to avoid build warning:
    common/image-android.c:151:68: warning: implicit declaration
    of function ‘mmc_get_env_dev’ [-Wimplicit-function-declaration]
    " androidboot.boot_device_root=mmcblk%d", mmc_map_to_kernel_blk(mmc_get_env_dev()));

    Change-Id: I932a178500e7397f72d717efae0dd2d954a909d8
    Signed-off-by: Ji Luo

    Ji Luo
     
  • camera sometime can't been open once run M4 image.
    ISI-CH0 probe funtion is not called when meet issue.

    The root cause is:
    M4 image set assign resource SC_R_ISI_CH0 into m4 partition
    when open camera in m4 side.
    Uboot will call update_fdt_with_owned_resources to check
    the pd in current dts node. it will call sc_rm_is_resource_owned to
    check the pd whether in other partition, if yes, it will delete
    the dts node. uboot delete isi_0 node whose pd is SC_R_ISI_CH0.

    add CONFIG_SKIP_RESOURCE_CHECKING to skip checking resource when load
    dtb.

    Change-Id: Iaf9a5eda07074c45c15c43f23cb6ad6b5a77de47
    Signed-off-by: zhang sanshan

    Ji Luo
     
  • dynamic partition feature is not enabled on automotive, so there is
    system partition in GPT, uboot for automotive need to get the info of
    this partition to generate the correct bootargs.

    And also, there is no commandline descriptor as "dm=***" in vbmeta image
    for standard Android after dynamic partition feature is enabled, so
    there is no need to use "strstr" to eleminate this from the bootargs.

    Change-Id: I51b3b92f5a22550602335cfc212831b263526f42
    Signed-off-by: faqiang.zhu

    faqiang.zhu
     
  • With this patch, the macro MAX_KERNEL_LEN will be set for non-imx8
    SoC and will pass the build.

    Change-Id: I15599546127b843e171b2f177aaf3b3dc33b8baa
    Signed-off-by: Haoran.Wang
    (cherry picked from commit a72c79bc17c0ed3bd3385f8195f3cd35ee223af6)

    Haoran.Wang
     
  • boot_buf was used to point to the memory allocated in do_boota function
    to save boot partition data. now boot partition is loaded by AVB, this
    boot_buf should be removed.

    Change-Id: I614c412b5f7ed980d29106b364a8193c56db13dc
    Signed-off-by: faqiang.zhu
    (cherry picked from commit 2a27f021798e31a8bab37804b053d2b9ebaea928)

    faqiang.zhu
     
  • Android use AVB to verify the kernel, hab authentication is
    not necessary for boot image.

    For imx8m, don't authenticate the kernel image when AVB
    (CONFIG_AVB_SUPPORT) is enabled. For imx8q, as android uses
    different 'CONFIG_EXTRA_ENV_SETTINGS' and 'CONFIG_BOOTCOMMAND'
    with linux bsp, so it won't try to do kernel hab authentication.
    by default.

    Test: boot imx8mp with "CONFIG_IMX_HAB" and imx8qxp with
    'CONFIG_AHAB_BOOT'.

    Change-Id: I1b2087ce7d8f9795422a053b6b68a694c86f0b3d
    Signed-off-by: Ji Luo
    (cherry picked from commit f907e4ac090e960ba5110b8039cccc4296841595)

    Ji Luo
     
  • The Kernel image will get bigger with some debug configs,
    48MB memory is not enough to hold the kernel image and its
    .bss segment now.

    For imx8m, we will reserve 64MB for kernel, 2MB for fdt and
    16MB for ramdisk. For imx8q, we will reserve 60MB for kernel,
    1.5MB for fdt and 16MB for ramdisk.

    Test: boots with 'kasan' enabled.

    Change-Id: I79d8e76c89f4add51bea1a16486c94c0b9f017db
    Signed-off-by: Ji Luo
    (cherry picked from commit 7ee2b20c22242f61e2595dffcb525ebdd54f9257)

    Ji Luo
     
  • We use the 'second_addr' in boot image header to store the
    fdt load address which is set by '--second_offset' parameter,
    but actually we don't pass any 'second' image to it. Now the
    mkbootimg.py will check the 'second' image size and set the
    'second_addr' as 0x0 if no 'second' image is specified.

    Since we don't store dtbs in the boot.img (except recovery dtb
    for legacy platforms), so set the dtb load offset in bootloader.
    The dtb load address will be 'kernel_addr + FDT_OFFSET_TO_KERNEL'
    (48MB memory reserved).

    Test: Boots on imx8mq.

    Change-Id: Ie597731992107ec2343e5ab6db0cab0e123f009c
    Signed-off-by: Ji Luo
    (cherry picked from commit efb9b0c9322f531c15ceedccd2fa9c6c170003a2)

    Ji Luo
     
  • Android implement the userspace fastboot in Android Recovery.
    Follow Google's spec, added below 2 fastboot command support:
    * fastboot getvar is-userspace
    * fastboot reboot fastboot

    TEST: fastboot commands.

    Change-Id: Ib6047413be0a45b3c00626cdb8594809eb8a2b6b
    Signed-off-by: Haoran.Wang
    (cherry picked from commit 314bded076dfc3e544cc7094ce3f6c4c330be4dd)

    Haoran.Wang
     
  • To enable dynamic partition feature, system partition will be a logic
    parition in "super" partition, uboot can't access system partition
    anymore.

    In i.MX Android use case, only vbmeta partition is used to verify other
    imags. boot and system are not used. so there is no need to access
    system partition to get avb device info, remove system partition from
    avb lib.

    Now, standard Android will boot with ramdisk in boot.img, there is no
    need to provide root info to kernel for standard Android. so only
    Android Auto will provide this info.

    Change-Id: I99a43eb8f7aa1dc635e3937c93266f881c9b3655
    Signed-off-by: faqiang.zhu
    (cherry picked from commit 3a2418a1cc097cd956347fc12b0b4e0566652bfd)

    faqiang.zhu
     
  • Add mmc board level implementation for imx8mp, so we can support
    boot from mmc besides ROMAPI.

    Test: eMMC/SD boot.

    Change-Id: Ie3c28e5622dd819583e2146557ac75f89dbe19ef
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Only limited heap memory is available on imx8q platforms due
    to some memory is reserved for m4 image. Commit cd67414 will
    free avb verify data and thus help decrease the heap memory
    consumption.

    But when the device is locked, avb will try to verify one slot
    first, it will continue to verify another if the first slot
    returns failure. Function load_full_partition() will alloc memory
    to load boot/dtbo images from heap (which is a big and continuous
    memory region), this memory will be freed if the first slot returns
    verify failure. but because part of the continous memory region
    will be used in following verify process, even total available memory
    is enough, u-boot can't find a continous memory region to load the
    boot/dtbo image for another slot and will return error "Failed to
    allocate memory".

    Instead, this commit use fixed memory region start from 96MB offset of
    CONFIG_FASTBOOT_BUF_ADDR to load the boot/dtbo images.

    Test: slot verify and A/B slot switch.

    Change-Id: Ifc83bed5a6be37196c0fd109d942eaf9b07b6a74
    Signed-off-by: Ji Luo
    (cherry picked from commit d13752e831957fb84c71f8ca24fd1979d3605cde)

    Ji Luo
     
  • Address 0x8880_0000 is reserved for M4 image on imx8q, which
    leaves limited memory region for the malloc pool. The avb
    will consume much heap memory to verify the kernel and dtbo
    image, memory conflicts may happen as the kernel/dtbo image
    size is getting larger.

    As the avb will load kernel/dtbo in every avb_slot_verify(), but
    will only free the memory after both slots are checked(if needed).
    And for trusty enabled platforms, extra heap memory will be used
    to do the hash calculation.

    This commit will free the slot memory once it's marked as unbootable
    and will use fixed memory started from CONFIG_FASTBOOT_BUF_ADDR to
    help store the data to do the hash calculation. With above change,
    we get a chance to decrease the malloc pool size.

    Test: boot on imx8qxp and imx8mm.

    Change-Id: Ia5cdaf9962ae1cb8b8e9bee5305205ec6d90b84a
    Signed-off-by: Ji Luo
    (cherry picked from commit 0a299eb1a4c8c929d069cb4a0d58a096c04f09f7)

    Ji Luo
     
  • "is-logical" is used to check whether the partition to be flashed is
    dynamic partition, if it is, a partition resize command will be issued
    by host fastboot. this can be well processed in fastbootd.

    process this "is-logical" in uboot, now there is no logical partition,
    for every partition found in u-boot, returns "no".

    Signed-off-by: faqiang.zhu
    Change-Id: I4d93a0c7b32fed9fe5a5ac846bc4e97bfbe69e67
    (cherry picked from commit 7b27a2290aec78b49ce7c2aed497db858f436eb4)

    faqiang.zhu
     
  • Guard oem unlock permission protection feature with new config
    'CONFIG_TRUSTY_UNLOCK_PERMISSION', so we can enable or disable
    it as needed.

    Test: build and boot on imx8mm.

    Signed-off-by: Ji Luo
    (cherry picked from commit c664d8e8b94e9b6f66b2bf04d1be47e9b8a22978)

    Change-Id: If1db4b46ecac21b8f187854531704eaff2df30c4

    Ji Luo
     
  • Target mmc dev is not properly switched when the device enters
    fastboot mode via uuu "-i" parameter, which causes "erase"
    operation doesn't work.

    Get and switch the target mmc dev every time before erase operations
    happen.

    Test: "fastboot erase boot_a" in uuu fastboot mode.

    Change-Id: I4822d2b4ecfd2d874dfbe7474d6824b8fc3a7903
    Signed-off-by: Ji Luo
    (cherry picked from commit 46161b62c341139dcdbb13e00634ae8ae903c5da)

    Ji Luo
     
  • To avoid both A/B slots are marked as unbootable because
    of some random failures, we will need to reset at spl stage
    when current slot load/verify fail but already with flag
    "successful_boot" set.

    imx8q can't be reset via the psci driver because the atf
    is not avaiable at spl stage, porting the sc_pm_reboot()
    scu api so we can do reset at spl stage for imx8qm/imx8qxp
    mek boards.

    Test: reset on imx8qm_mek and imx8qxp_mek.

    Change-Id: Ifa0bdea9393e413942a8a0188a4f937fa0aa9ab8
    Signed-off-by: Ji Luo
    (cherry picked from a5c5748101c383bc3afb424a3ef2689ab2664846)

    Ji Luo
     
  • Slot will be marked as "unbootable" state if error happens during
    image load/verify process, this may cause the board never boot up
    if some random failures happen (like eMMC/DRAM access error at some
    critical temperature).

    Check the "successful_boot" flag before marking the slot as "unbootable",
    this will help ease the "no bootable slot" issue.

    Test: slot switch on imx8qm_mek.

    Signed-off-by: Ji Luo
    (cherry picked from commit 6db8ebe2224ab6656e8e798288bd1b3c0472c0c0)

    Change-Id: Ib060b11cc6687a3bacd09cecda7dd925beba6316

    Ji Luo
     
  • Add implementation to load hdmi rx/tx firmwares, use different config to
    guide the function.

    Change-Id: Ibb43c2301b5f6cdc8b5103bd04cc30baefac9b9f
    Signed-off-by: Ji Luo

    Ji Luo
     
  • Refine trusty logs output to make it more
    simple.

    Test: boots.

    Change-Id: Id94fc245206c5f78e0dbcb0baf5db6475c9f744d
    Signed-off-by: Ji Luo
    (cherry picked from commit a50b4fca22111fe7b85b5584ff317db55d664c50)

    Ji Luo
     
  • androidboot.storage_type has been replaced by androidboot.boot_device_root.

    Change-Id: Ibec80808e6ae720be128c0a2d9e2f4d325c56716
    Signed-off-by: Jindong
    (cherry picked from commit 6a5534d13b9e7fe14a457c5f4664b054382d35e3)

    Jindong
     
  • With Android10 code, to build GSI image for devices launching with
    Android10, the target should be "aosp_$arch-user". Google releases GSI
    images is so built in user mode.

    To do CTS-on-GSI test, a debug ramdisk containing .prop file to enable
    adb root permission and GSI keys to verify the GSI image is needed, this
    ramdisk is in boot image. so ramdisk in boot image need to be loaded by
    uboot even in non-recovery mode.

    To save boot time, only standard Android use ramdisk to boot up Android,
    Android Auto keeps the original way: kernel be responsible for verify
    and mount system partition. Let the customers to decide whether to use
    recovery ramdisk to boot the system. and under this condition, user-debug
    Android Auto GSI image need to be used for VTS-on-GSI test.

    when use ramdisk to bootup Android, info provided by "dm=" bootarg is
    not used by kernel to setup dm-verity, so it is removed from the
    bootargs. The 4.19 kernel used together with this uboot does not handle
    "skip_initramfs", so it's also removed.

    Change-Id: Ia8b8fa8b85a44acda2670b46504038a009ce01a8
    Signed-off-by: faqiang.zhu
    (cherry picked from commit e7d3c9ee1a713434d2948928ff0c4daea09ce3dc)

    faqiang.zhu
     
  • Add commands to read oem device unlock state from
    trusty avb app. Use the oem device unlock state to
    determine if the device can be unlocked instead of
    the state in persistdata part.

    Test: Read oem device unlock state from avb app.

    Change-Id: Ifccaa788ba0f681c2b3a47151c8474e8da5a2559
    Signed-off-by: Ji Luo
    (cherry picked from commit c6eaf8e32987f120c0c5441ea39aa0f39a65b50d)

    Ji Luo
     
  • Don't skip vbmeta public key verify for non-trusty
    platforms.

    Test: boot on imx8mm.

    Change-Id: I4712e5dd6e5c8848468e9d85c6b38eb5fb11377f
    Signed-off-by: Ji Luo
    (cherry picked from commit 9b8264c89ccb3e9179a438e428ad79d72c7efe9b)

    Ji Luo
     
  • Decrypt and verify the secure credential in keymaster TA, unlock
    operation can only be allowed after secure credential verify pass.

    Since the mppubk can only be generated on hab closed imx8q, so secure
    unlock feature can only supported when hab is closed.

    Test: secure unlock credential verify on hab closed imx8mm_evk.

    Change-Id: I1ab5e24df28d1e75ff853de3adf29f34da1d0a71
    Signed-off-by: Ji Luo
    (cherry picked from commit 631149fc0fc8ce035311949db643c2708e41435a)

    Ji Luo
     
  • Add commands to support extract serial number from device.
    Commands:
    $ fastboot oem get-serial-number
    $ fastboot get_staged

    Test: serial number upload on imx8mm.

    Change-Id: I5c905ab797d4fd28d76c8403914f191eaf2ef687
    Signed-off-by: Ji Luo
    (cherry picked from commit 250ef119c1dc02908046113893df5eeb9ef40605)

    Ji Luo
     
  • MMC device id remap function "board_mmc_get_env_dev()" was
    removed in u-boot v2019 because we add the mmc device aliases
    in dts file. But we still need to remap the mmc device id in
    spl or read/write rpmb keyslot package will fail.

    This patch adds mmc device id remap function in spl to get the
    correct device id.

    Test: boot on imx8mm with trusty enabled.

    Change-Id: I41c46494326d9eb2658d2cda692968fb895d0292
    Signed-off-by: Ji Luo
    (cherry picked from commit c079188d06b3669df7836e1b8c6126558b1fa39e)

    Ji Luo
     
  • The A/B slot selection is moved to spl, it may lead to hang
    if no bootable slots found. The only way to recover the board
    is re-flash images with uuu tool, which is quite inconvenient
    for some customers who can't enter serial download mode.

    This patch will set "spl recovery mode" which will give us a
    chance to re-flash images with fastboot commands.

    Test: Enter spl recovery mode and flash images when no bootable
    slots found.

    Change-Id: I31278f5212bde7609fe2f49e77b3849e92c0c516
    Signed-off-by: Ji Luo
    (cherry picked from commit 46cc755cf3f42422ee1d7783394e14e8125df2b6)

    Ji Luo
     
  • when conduct fastboot lock/unlock operations, erase the userdata first
    and then set lock/unlock status to improve security level.

    Change-Id: I74c571c35b88afd6fdd4c287463f7209da8c15ff
    Signed-off-by: faqiang.zhu
    (cherry picked from commit b81f0b617d23548cd30953b94aca4ff8cc4da723)

    faqiang.zhu
     
  • It can be dangerous to export some hwcrypto commands to Linux,
    add commands to limit some commands within bootloader.

    Test: hwcrypto commands can't be used after locking boot state.

    Change-Id: Ib0a96a87f661778c133178840d8dccf49f151c22
    Signed-off-by: Ji Luo
    (cherry picked from commit 3fc3f521957677b1f363624494ed866985a25505)

    Ji Luo