This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM62X: AM62x Android Can not Enter Recovery Mode.

Part Number: PROCESSOR-SDK-AM62X

Hi,

I met below error log with command "reboot recovery".

How can I solve this problem?

reboot_recovery_fail_log.txt

By the way, I want to implement a method to flash AOSP image file with USB driver.

The steps of flashing image file:

  • Copy image file from USB to our board userdata partition or sd card.
  • Reboot and enter recovery mode
  • Flash itself with image file
  • Reboot and enter normal mode

Is the above steps a correct and common way to do this function?

Thanks,

Ken

  • Hi,

    if i'm not worng you flash on sdcard and not on emmc right ?

    you can try to stop uboot boot put in fastboot mode with this command in uboot : fastboot 0

    from  your pc launch :

    fastboot erase misc

    reboot and retry to see if you have same error.
    SD Card support is experimental and not fully tested so issue is possible.


  • Hi Guillaume,

    Actually,I still can't boot from SD card.

    I am able to enter recovery mode now, but I can't enter any item on the screen.

    Do I need to do any other settings?

    Could you provide some opinions regarding my ideas?

     I want to implement a method to flash AOSP image file with USB driver.

    The steps of flashing image file:

    • Copy image file from USB to our board userdata partition or sd card.
    • Reboot and enter recovery mode
    • Flash itself with image file
    • Reboot and enter normal mode

    Thanks.

  • Hi,

    Another question, I can't type and execute command on recovery mode.

    Is it a default configuration for recovery mode?

    Is it possible to do that on recovery mode?

  • Hi Ken,

    it's normally possible to use sd card to update board or with adb with adb sideload command.
    i willl provide you some instructions soon.

    To interact in recovery mode you need to use your input device (keyboard, touch , mouse) For me i have a screen with touchscreen on usb and so i can scroll and to validate command i need to do a long press 


    When you talk about a default configuration in recovery mode, can you be more specific ? 
    you want to go in recovery and automatically launch update or omething like that ?

    Guillaume

  • Hi Guillaume,

    For me i have a screen with touchscreen on usb and so i can scroll and to validate command i need to do a long press

      => It works for me.

    Actually, we want to implement a system upgrade function for our new board.

    Users only need to press an button to finish the system update without any other operation.

    The am62x android aosp supports the A/B system update. Is there a detailed introduction to this feature on the TI website?

    Could you provide the "update.zip" file used for updating in recovery mode?

     

    Thanks

  • i can provide update.zip but it's better for you to generate it yourself ,

    i will create a hwoto today and shared it.

  • Hi,

    I generated update.zip with the below link

    https://source.android.com/docs/core/ota/tools?hl=zh-cn

    I executed below command.

    #cd ${YOUR_PATH}/ti-aosp-12/

    #mkdir dist_output

    #make dist DIST_DIR=dist_output

    #ota_from_target_files dist_output/am62x-ota-eng.root.zip ota_update.zip

    But there was an error during the execution of the command.

    Is it a normal way to generate ota update.zip?

  • Hi,

    Do you have any further information?

    Thanks.

  • Hi,
    this warning is normal and not a problem .

    normally at the end you have your ota package

  • for local update i do test with adb sideload and it's working.

    i do this command :

    source build/envsetup.sh
    lunch am62x-userdebug
    mkdir dist_output
    make dist DIST_DIR=dist_output
    


    then when your board is booted do : 

    adb reboot sideload
    adb wait-for-sideload
    adb sideload dist_output/am62x-ota-eng.glaroque.zip


    Same from sdcard not working and i will debug it.

  • Hi,

    I generate ota_package.zip by your command.

    Does the filesystem of the ota_package.zip is correct?

    And I executed below command for updating android firmware

    update_engine_client --payload=file:///storage/AD29-FF8E/Download/payload.bin --update --headers="FILE_HASH=8XxPNCkV6q+RVhK4iuTgHoWOB212D/Sy6/huFQllj3w=
    FILE_SIZE=553097142
    METADATA_HASH=ws1LVWlzMhe29R1aga0cYLWon4zkynBgluiqqiucA8U=
    METADATA_SIZE=39999"

    It always stuck and reboot when boot from slot b.

    Does the problem is same as your description "Same from sdcard not working and i will debug it." ?

    Thanks.

  • not same issue.

    problem with sd card is link to no auto mount in recovery mode so android recovery dont find image for update.

    End of day for me i will try to reproduce your issue tomorrow 

  • Hi, 

    Could you reproduce my problem?

    I compared the logs between a normal boot and an abnormal boot, and it seems that there is an issue when executing snapuserd.

    Does this relate to the issue?

  • Hi Ken,

    Per my understanding, you want to be able to apply a full OTA update using the A/B scheme. The update will be on the board's eMMC.
    This can be done with the SystemUpdaterSample app with the following steps:

    1. Build the ota files

    $ source build/envsetup.sh
    $ lunch am62x-userdebug
    $ export OUT_DIR=~/linux-data/work/ti/out/ti-android-12
    $ export DIST_DIR=$OUT_DIR/dist_output
    $ m
    $ m dist


    2. Update the ota config file. Feel free to change $OUT_DIR and $DIST_DIR to match your developer environment.

    $ source build/envsetup.sh
    $ lunch am62x-userdebug
    $ export OUT_DIR=~/linux-data/work/ti/out/ti-android-12
    $ export DIST_DIR=$OUT_DIR/dist_output
    $ PYTHONPATH=$ANDROID_BUILD_TOP/build/make/tools/releasetools:$PYTHONPATH bootable/recovery/updater_sample/tools/gen_update_config.py --ab_install NON_STREAMING $DIST_DIR/am62x-ota-eng.${USER}.zip $DIST_DIR/am62x-ota-eng.${USER}.json file:///data/user/0/com.example.android.systemupdatersample/files/packages/am62x-ota-eng.${USER}.zip

    (be careful, last line is one very long line)


    3. Run the SystemUpdaterSample app once:

    $ adb root
    $ adb shell setenforce 0
    $ adb shell am start com.example.android.systemupdatersample/com.example.android.systemupdatersample.ui.MainActivity


    4. Push the files on the board:

    $ adb root
    $ adb shell mkdir /data/user/0/com.example.android.systemupdatersample/files/configs
    $ adb shell mkdir /data/user/0/com.example.android.systemupdatersample/files/packages
    $ adb push $DIST_DIR/am62x-ota-eng.${USER}.json /data/user/0/com.example.android.systemupdatersample/files/configs/
    $ adb push $DIST_DIR/am62x-ota-eng.${USER}.zip /data/user/0/com.example.android.systemupdatersample/files/packages/


    5. Change SELinux Label:

    $ adb shell chcon -R u:object_r:ota_package_file:s0 /data/user/0/com.example.android.systemupdatersample/


    6. Change Unix permisssions:

    $ adb shell chmod -R 777 /data/user/0/com.example.android.systemupdatersample/


    7. Run the update on the UI:
    - Tap on RELOAD to load the config
    - Tap on APPLY to apply the OTA
    - Tap OK to confirm application
    - Wait for progress bar to complete
    - Tap on SWITCH SLOT to finish update (scroll downwards to see the button)
    - Wait for verification

    8. Reboot the device with:

    $ adb shell svc power reboot



    9. Confirm that booting on slot b:
    A/B cmdline addition: androidboot.slot_suffix=_b                                                                                                                                                                      
    



    Please let us know this works for you.

    In case you are having problems, please let us know what did not work.


    In parallel, we are looking into snapuserd

  • Hi,

    We will develop an application on our new board and implement a system update function within this application.

    Therefore, it is necessary to program the system update functionality without requiring user operation.

    I made ota package file reference from https://source.android.com/docs/core/ota/tools and  executed the command "update_engine_client" to do system update.

    Do you think these operations are applicable to AM62x Android?

    Could you do these operations provided in the past post?

    I still want to confirm what issue I encountered.

    I will try to execute the example operations you provided.

    But I need to do that programmatically finally.

    Thanks

  • Hi Ken,

    We have looked into the problem you have reported (cannot boot onto slot _b after upgrading due to snapuserd crash).

    This happens because we attempt to run snapuserd from the vendor_boot partition, which does not exist in ti-android-12.

    The following patch should resolve your issue. Can you please confirm this resolves it?

    From 6fcc3756177680967c3134584ccee6d1b284c75b Mon Sep 17 00:00:00 2001
    From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
    Date: Fri, 26 May 2023 18:09:10 +0200
    Subject: [PATCH] device: don't use compression for virtual_ab_ota
    
    When booting on the _b slot after applying an OTA, we observe boot
    errors such as:
    
    [    3.417938] init: Created socket '/dev/socket/snapuserd', mode 660, user 1000, group 1000
    [    3.427810] init: Relaunched snapuserd with pid: 106
    [    3.428303] init: Cannot launch snapuserd; execv failed: No such file or directory
    [    3.432895] init: Creating logical partitions with snapshots as needed
    [    3.449701] random: init: uninitialized urandom read (16 bytes read)
    [    3.457566] init: [libfs_mgr]Created logical partition system_b-base on device /dev/block/dm-0
    [    3.467001] random: init: uninitialized urandom read (16 bytes read)
    [    3.472311] mmc1: new high speed SDHC card at address 0001
    [    3.474657] init: Mapped COW device for system_b at /dev/block/dm-1
    [    3.479608] mmcblk1: mmc1:0001 SD16G 7.44 GiB
    [    3.490511] random: init: uninitialized urandom read (16 bytes read)
    [    3.491968]  mmcblk1: p1 p2
    [    3.498167] init: [libfs_mgr]Created logical partition system_b-src on device /dev/block/dm-2
    [   13.520196] init: Timed out connecting to snapuserd socket: snapuserd
    [   13.526704] init: Unable to connect to snapuserd
    [   13.531336] init: Could not map dm-user device for partition system_b
    [   13.597747] init: Failed to mount required partitions early ...
    
    compression.mk will itself inherit from launch_with_vendor_ramdisk.mk
    
    To quote launch_with_vendor_ramdisk:
    
    > Devices launching with Virtual A/B and has a vendor_boot partition is
    > preferred to inherit from this makefile instead of launch.mk.
    
    We don't have a vendor_boot partition, because this is for boot image
    v3, which is not supported in our current bootloader (U-Boot 2021.01-g6bf760268e)
    
    Disable virtual_ab_ota compression to solve this while we migrate to
    boot image v3/v4.
    
    Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
    ---
     device.mk | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/device.mk b/device.mk
    index ab6ee7aa8254..f696291cafcf 100644
    --- a/device.mk
    +++ b/device.mk
    @@ -35,7 +35,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
     # Enable project quotas and casefolding for emulated storage without sdcardfs
     $(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
     
    -$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/compression.mk)
    +$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/retrofit.mk)
     # Enforce generic ramdisk allow list
     $(call inherit-product, $(SRC_TARGET_DIR)/product/generic_ramdisk.mk)
     
    -- 
    2.40.1
    
    


    Note that the patch must be applied on the source system (so slot _a) as well as on the target system (slot _b).

    We will merge this back to ti-android-12.

  • Hi,

    The solution works for me.

    Thanks for your help.