30 Oct, 2020

1 commit

  • To use dynamic partition feature in Android, recovery ramdisk is used to
    mount the logical partitions and boot up Android.

    Define a configuration item "CONFIG_ANDROID_DYNAMIC_PARTITION", use it
    to control the bootargs and whether ramdisk should be loaded instead of
    "CONFIG_ANDROID_AUTO" because now Android auto also use dynamic
    partition feature now.

    Move the definition of function "fastboot_setup_system_boot_args" under
    the macro "CONFIG_CMD_BOOTA" to avoid build warnings.

    Signed-off-by: faqiang.zhu
    Change-Id: I0b1cfe6120fc939e7f1a1eb600d8176c81edf129
    (cherry picked from commit 972ccff86796e2b7f9a444d09550cd5e393cd93e)

    faqiang.zhu
     

16 Jul, 2020

2 commits

  • This commit eliminate the annoying build warning logs.

    Test: builds with buildman.

    Signed-off-by: Ji Luo
    Change-Id: Ia335dafe3f4c0eab08e011215b9de5d2974b8d0c
    (cherry picked from commit 85e0d429d19b8f9a62369a5f20e088644c488b1e)

    Ji Luo
     
  • Trusty binary will be integrated into the dom0 bootloader, need to check
    rpmb keyslot for trusty. Use software sha256 calculation method in avb
    verify as we still have issues to use physical address in domu
    bootloader.

    Test: boots xen with android.

    Signed-off-by: Ji Luo
    Change-Id: Ie7da9196ad6947157111665efd420bf4381385d6
    (cherry picked from commit 4030462cb99e1dc67f7ee28f391ddd5c21938878)

    Ji Luo
     

16 Jun, 2020

4 commits

  • 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
     
  • 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
     
  • 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
     

06 May, 2020

1 commit

  • Porting the android AVB lib from imx u-boot v2018.03. Since 2019 u-boot
    has added latest AVB library, try to reuse it.

    Signed-off-by: Ye Li
    (cherry picked from commit 2105662ada738a271e12a81d775134a5821dc38f)
    (cherry picked from commit f7291d86c4183ce2e299ad271aa5618c71507ffc)
    (cherry picked from commit b871714c519e1bda3de6afbd354bee2cb246e4b7)

    Ye Li
     

06 Feb, 2020

1 commit

  • At present dm/device.h includes the linux-compatible features. This
    requires including linux/compat.h which in turn includes a lot of headers.
    One of these is malloc.h which we thus end up including in every file in
    U-Boot. Apart from the inefficiency of this, it is problematic for sandbox
    which needs to use the system malloc() in some files.

    Move the compatibility features into a separate header file.

    Signed-off-by: Simon Glass

    Simon Glass
     

18 Jan, 2020

1 commit


31 Oct, 2019

2 commits

  • After updating libavb to most recent version from AOSP/master, two new
    warnings appear:

    Warning #1:

    lib/libavb/avb_cmdline.c: In function 'avb_append_options':
    lib/libavb/avb_cmdline.c:365:15: warning: 'dm_verity_mode' may be
    used uninitialized in this function
    [-Wmaybe-uninitialized]
    new_ret = avb_replace(
    ^~~~~~~~~~~~
    slot_data->cmdline, "$(ANDROID_VERITY_MODE)", dm_verity_mode);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    lib/libavb/avb_cmdline.c:374:8: warning: 'verity_mode' may be used
    uninitialized in this function
    [-Wmaybe-uninitialized]
    if (!cmdline_append_option(
    ^~~~~~~~~~~~~~~~~~~~~~
    slot_data, "androidboot.veritymode", verity_mode)) {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Warning #2:

    lib/libavb/avb_slot_verify.c: In function 'avb_slot_verify':
    lib/libavb/avb_slot_verify.c:1349:23: warning: 'ret' may be used
    uninitialized in this function
    [-Wmaybe-uninitialized]
    AvbSlotVerifyResult ret;
    ^~~

    Fix those by providing default return values to affected functions.

    Signed-off-by: Sam Protsenko

    Sam Protsenko
     
  • Update libavb to commit 5fbb42a189aa in AOSP/master, because new version
    has support for super partition [1], which we need for implementing
    Android dynamic partitions. All changes from previous patches for libavb
    in U-Boot are accounted for in this commit:
    - commit ecc6f6bea6a2 ("libavb: Handle wrong hashtree_error_mode in
    avb_append_options()")
    - commit 897a1d947e7e ("libavb: Update SPDX tag style")
    - commit d8f9d2af96b3 ("avb2.0: add Android Verified Boot 2.0 library")

    Tested on X15:

    ## Android Verified Boot 2.0 version 1.1.0
    read_is_device_unlocked not supported yet
    read_rollback_index not supported yet
    read_is_device_unlocked not supported yet
    Verification passed successfully
    AVB verification OK.

    Unit test passes:

    $ ./test/py/test.py --bd sandbox --build -k test_avb

    test/py/tests/test_android/test_avb.py ss..s.

    [1] https://android.googlesource.com/platform/external/avb/+/49936b4c0109411fdd38bd4ba3a32a01c40439a9

    Signed-off-by: Sam Protsenko
    Reviewed-by: Eugeniu Rosca
    Acked-by: Igor Opaniuk

    Sam Protsenko
     

25 Aug, 2018

1 commit

  • Exit with AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_ARGUMENT
    when hashtree_error_mode value passed to avb_append_options()
    is unknown (not from AvbHashtreeErrorMode enum).

    Otherwise, default value is not handled in the
    switch(hashtree_error_mode), which causes below compile warning:

    lib/libavb/avb_cmdline.c: In function ‘avb_append_options’:
    lib/libavb/avb_cmdline.c:354:13: warning: ‘dm_verity_mode’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    new_ret = avb_replace(
    ~~~~~~~~^~~~~~~~~~~~~~
    slot_data->cmdline, "$(ANDROID_VERITY_MODE)", dm_verity_mode);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    lib/libavb/avb_cmdline.c:363:8: warning: ‘verity_mode’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (!cmdline_append_option(
    ^~~~~~~~~~~~~~~~~~~~~~
    slot_data, "androidboot.veritymode", verity_mode)) {

    Signed-off-by: Ievgen Maliarenko
    Signed-off-by: Eugeniu Rosca
    Reviewed-by: Igor Opaniuk

    Ievgen Maliarenko
     

19 Jun, 2018

3 commits

  • Signed-off-by: Tom Rini

    Tom Rini
     
  • Integrate libavb into the build system. Introduce CONFIG_LIBAVB
    build option.

    Signed-off-by: Igor Opaniuk

    Igor Opaniuk
     
  • Add libavb lib (3rd party library from AOSP), that implements support of
    AVB 2.0. This library is used for integrity checking of Android partitions
    on eMMC.

    libavb was added as it is and minimal changes were introduced to reduce
    maintenance cost, because it will be deviated from AOSP upstream in the future.

    Changes:
    - license headers changed to conform SPDX-style
    - avb_crc32.c dropped
    - updates in avb_sysdeps_posix.c/avb_sysdeps.h

    For additional details check [1] AVB 2.0 README.

    [1] https://android.googlesource.com/platform/external/avb/+/master/README.md

    Signed-off-by: Igor Opaniuk

    Igor Opaniuk