AOSP Update

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AOSP Update

18,947 Views
msingh1920
Contributor V

Hi,

I am using iMX8M Mini EVK and AOSP 9.0 version and I am able to run AOSP successfully on my EVK board.

In my current AOSP version AOSP 9.0 I added some custom code in system service layer, JNI layer, HIDL and HAL layer and it is working fine.

But suppose if in some time new AOSP version released say 10.0 and I want to update my system to this version then how can i do that ?

1. How can I update AOSP version of my device i.e. iMX8M Mini ?

2. Is it possible over OTA  ? 

3. How can I update over OTA ?

4. And after update do I need to add my changes in AOSP again for my custom code in all the layers ? or

    how it will be ? 

Please provide some help or suggestion.

Thanks,

Maneesh

18 Replies

17,985 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Maneesh,

Please do follow Shivani Patel’s recommendations. Additionally, consider the AOSP documentation, as there may be slight differences between the NXP Android BSP and AOSP:

https://source.android.com/devices/tech/ota/tools

Regards,

17,985 Views
msingh1920
Contributor V

Hi gusarambula

I am able to Execute update command but for that I need to make selinux permissive to avoid any selinux permission error

update_engine_client --payload=http://172.18.3.215/payload.bin --update --headers="FILE_HASH=EA1rY4uVUN35goXDkeNaPVWj6ueoRNmS3hfOfxL9zgk= FILE_SIZE=440383379 METADATA_HASH=R+TqI4RldiQxOQqUgxZnGXXPgBFs4EXKwXaB2esWgKE= METADATA_SIZE=58809t"

But after executing update command no error or warning or any print message comes on my debug console. 

 

So my question is - 

 

1. how can I verify if my update-engine command executed successfully or not ?

2. how I will I verify if OTA update is started or not after executing this command ?

3. Where can I find the OTA files on my board which will be downloaded by this command ?

 

 Any help or suggestions will be very helpful.

 

Thanks,

Maneesh

0 Kudos
Reply

17,985 Views
girodassoc
Contributor II

Before attempting to run update_engine_client from the command line, enter su

1. The update_engine_client does not output any status to the debug console.  To see what is happening, you must

logcat | grep update_engine.  As logcat now has your console input, you have to enter ctrl->c to get back to a command prompt when you have seen what you want to see.

2. logcat will show you the progress of the update.  If it is successful, you will see a line like this.

02-25 15:42:03.957  3192  3192 I update_engine: [0225/154203.957959:INFO:update_attempter_android.cc(439)] Update successfully applied, waiting to reboot.

3.  If you are using A/B update, you will not find your OTA files on the target as they will have been written into the appropriate partitions on the drive.

After you have seen the line in 2, and terminated logcat, enter the reboot command,  Your new update should start if everything else if correct.

Good luck,

Rod

0 Kudos
Reply

17,985 Views
msingh1920
Contributor V

Hi Rodney Girod,

Thanks for your reply and suggestions.

I am able to execute the update_engine_client command and using
logcat | grep update_engine I am able to see the progress also.

But after completing download 100%  when it is failing in verification .

As you can see in the log payload verification is failing...

but when I checked in my below command and data given in payload properties.txt is same.  

then why it is giving verification Error  ? Any suggestions what might be wrong i am doing ?

I tried this many time but every-times I get same error.

Command which I am executing => 

update_engine_client --payload=http://172.18.3.215/AOSP_OTA/evk_8mm-ota-eng.bruviti/payload.bin --update --headers="FILE_HASH=bEHNdL1MZygUIZNNK37Fz0Mm6r15X0nzWWdVYlUQlTQ=
FILE_SIZE=442112619
METADATA_HASH=4FeofGvXhP8FvOWX7zN8damMwgkJ+I/1guQFQxQoesY=
METADATA_SIZE=58814"

Logs =>

02-27 12:37:34.331  3099  3099 I update_engine: [0227/123734.331913:INFO:delta_performer.cc(126)] Caching writes.
02-27 12:37:34.332  3099  3099 I update_engine: [0227/123734.332090:INFO:delta_performer.cc(386)] Applying 1 operations to partition "vbmeta"
02-27 12:37:34.340  3099  3099 I update_engine: [0227/123734.340381:INFO:delta_performer.cc(210)] Completed 1051/1051 operations (100%), 442112619/? bytes downloaded, overall progress 100%
02-27 12:37:34.341  3099  3099 I update_engine: [0227/123734.341206:INFO:delta_performer.cc(1370)] Extracted signature data of size 264 at 442053277
02-27 12:37:34.341  3099  3099 I update_engine: [0227/123734.341742:INFO:libcurl_http_fetcher.cc(433)] HTTP response code: 200
02-27 12:37:34.342  3099  3099 I update_engine: [0227/123734.342603:INFO:libcurl_http_fetcher.cc(509)] Transfer completed (200), 442112619 bytes downloaded
02-27 12:37:34.342  3099  3099 I update_engine: [0227/123734.342755:INFO:multi_range_http_fetcher.cc(167)] Received transfer complete.
02-27 12:37:34.342  3099  3099 I update_engine: [0227/123734.342794:INFO:multi_range_http_fetcher.cc(124)] TransferEnded w/ code 200
02-27 12:37:34.342  3099  3099 I update_engine: [0227/123734.342829:INFO:multi_range_http_fetcher.cc(158)] Done w/ all transfers
02-27 12:37:34.346  3099  3099 I update_engine: [0227/123734.346613:INFO:delta_performer.cc(1549)] Verifying payload using public key: /etc/update_engine/update-payload-key.pub.pem
02-27 12:37:34.346  3099  3099 E update_engine: [0227/123734.346741:ERROR:delta_performer.cc(1556)] VerifyPayload failure: update_check_response_size == metadata_size_ + metadata_signature_size_ + buffer_offset_
02-27 12:37:34.346  3099  3099 E update_engine: [0227/123734.346781:ERROR:download_action.cc(397)] Download of http://172.18.3.215/AOSP_OTA/evk_8mm-ota-eng.bruviti/payload.bin failed due to payload verification error.
02-27 12:37:34.346  3099  3099 I update_engine: [0227/123734.346823:INFO:action_processor.cc(116)] ActionProcessor: finished DownloadAction with code ErrorCode::kPayloadSizeMismatchError
02-27 12:37:34.346  3099  3099 I update_engine: [0227/123734.346860:INFO:action_processor.cc(121)] ActionProcessor: Aborting processing due to
failure.

0 Kudos
Reply

17,985 Views
girodassoc
Contributor II

02-27 12:37:34.346  3099  3099 I update_engine: [0227/123734.346823:INFO:action_processor.cc(116)] ActionProcessor: finished DownloadAction with code ErrorCode::kPayloadSizeMismatchError

suggests that the payload_properties you used, in particular "FILE_SIZE=442112619", do not match the image you downloaded.

The values of

FILE_HASH=bEHNdL1MZygUIZNNK37Fz0Mm6r15X0nzWWdVYlUQlTQ=
FILE_SIZE=442112619
METADATA_HASH=4FeofGvXhP8FvOWX7zN8damMwgkJ+I/1guQFQxQoesY=
METADATA_SIZE=58814

must come from the payload_properties.txt that was generated with the payload.bin you are downloading.

 

0 Kudos
Reply

17,985 Views
msingh1920
Contributor V

Hi Rodney Girod,

Thanks for your reply.

I am using below command to generate Full OTA package -

        $ source build/envsetup.sh
        $ lunch evk_8mm-userdebug
        $ make otapackage -j4

After this it generate OTA package at belwo location   -

  ${MY_ANDROID}/out/target/proudct/evk_8mm/evk_8mm-ota-${date}.zip 

Now this package contain payload.bin and payload_properties.txt

I am using same payload.bin file and using payload_properties.txt  to get the values of -

FILE_HASH=
FILE_SIZE=
METADATA_HASH=
METADATA_SIZE=

But still when I am trying the  -> update_engine_client  command I am facing same issue.

Please suggest What might be causing this issue ?

Thanks,

Maneesh

0 Kudos
Reply

17,985 Views
girodassoc
Contributor II

I have had success by doing my build in three steps.

make

make target-files-package

make otapackage

The first, creates files for use with uuu

The second, creates files for creation of an incremental ota package

And the third, creates a full ota package.

I cannot say that you must do all three, but doing so has worked for me.

0 Kudos
Reply

17,985 Views
msingh1920
Contributor V

Hi Rodney Girod,

 

Thanks for your reply.

I tried same command but still I am facing this issue.

my payload properties are -

FILE_HASH=S8fV3SdO1tmUQhT12DrYIIRBOwfWBImHyCOOwvwds+I=    
FILE_SIZE=442112727
METADATA_HASH=+MmyPfN+wLRu+VT/e0NlUSziYyH4FckXkX5loUW7jVk=
METADATA_SIZE=58814

But as you can see in my log below I get  update_check_response_size : 0

and then i get error saying payload verification failed.

can you suggest what i am doing wrong ? or why i am getting update_check_response_size : 0

LOGS =>

03-05 09:56:14.595  3096  3096 I update_engine: [0305/095614.595127:INFO:multi_range_http_fetcher.cc(167)] Received transfer complete.
03-05 09:56:14.595  3096  3096 I update_engine: [0305/095614.595167:INFO:multi_range_http_fetcher.cc(124)] TransferEnded w/ code 200
03-05 09:56:14.595  3096  3096 I update_engine: [0305/095614.595204:INFO:multi_range_http_fetcher.cc(158)] Done w/ all transfers
03-05 09:56:14.600  3096  3096 I update_engine: [0305/095614.600085:INFO:delta_performer.cc(1549)] Verifying payload using public key: /etc/update_engine/update-payload-key.pub.pem
03-05 09:56:14.600  3096  3096 I update_engine: [0305/095614.600222:INFO:delta_performer.cc(1552)] update_check_response_size : 0 metadata_size_ : 58814 metadata_signature_size_ : 264 buffer_offset_ : 442053649


03-05 09:56:14.600  3096  3096 E update_engine: [0305/095614.600270:ERROR:delta_performer.cc(1557)] VerifyPayload failure: update_check_response_size == metadata_size_ + metadata_signature_size_ + buffer_offset_
03-05 09:56:14.600  3096  3096 E update_engine: [0305/095614.600308:ERROR:download_action.cc(397)] Download of http://172.18.2.95/payload.bin failed due to payload verification error.


03-05 09:56:14.600  3096  3096 I update_engine: [0305/095614.600347:INFO:action_processor.cc(116)] ActionProcessor: finished DownloadAction with code ErrorCode::kPayloadSizeMismatchError


03-05 09:56:14.600  3096  3096 I update_engine: [0305/095614.600707:INFO:action_processor.cc(121)] ActionProcessor: Aborting processing due to failure.


03-05 09:56:14.600  3096  3096 I update_engine: [0305/095614.600970:INFO:update_attempter_android.cc(431)] Processing Done.


03-05 09:56:14.601  3096  3096

Regards,

Maneesh

0 Kudos
Reply

17,985 Views
shivanipatel
Senior Contributor II

Hi, maneeshsingh1920@gmail.com

You do not need to add the "\" at the end of each line of OTA Update command.

Please try to implement the OTA update with below command:

update_engine_client --payload=http://192.168.1.1:10888/payload.bin --update \
--headers="FILE_HASH=m4RBsgXfz+0d6ACK4h+dJne38LP53pSR+6faQAZBmHs0=
FILE_SIZE=437638456
METADATA_HASH=zE6wIt6CZX5GgdTM/HEG9UvDHZqxQ2jJvUrS/dwR3dE=
METADATA_SIZE=58871"

Replace your payload properties in the above command.

Regards,

Shivani

0 Kudos
Reply

17,985 Views
girodassoc
Contributor II

For my successful execution of update_engine_client;

I set up a new build system exactly as specified in the NXP Android User's Guide, no deviation.

I downloaded the 2.3.1 source as specified and built my base for evk_8mm-eng exactly as specified.

I loaded the evk using the files of the base build from out/target/product/evk_8mm. uuu_imx_android_flash.bat -f imx8mm -e

I then modified only the model in vendor/nxp-opensource/kernel_imx/arch/arm64/boot/dts/freescale/fsl-imx8mm-evk.dts and rebuilt:

  make

  make target-files-package

  make-otapackage

I extracted payload.bin and payloadproperties from the out/target/product/evk_8mm/ota zip file and copied payload.bin to my http server.

Then I used the values in payloadproperties.txt in my update_engine_client command and successfully applied the update I created.

Anything you did different, could be the source of the problem you are having.

Rod

0 Kudos
Reply

17,985 Views
msingh1920
Contributor V

Hi gusarambula,

 

I observed that when i run update command on debug console -

 

 I tried to execute command in this way ->

update_engine_client --payload=http://192.168.1.1/payload.bin --update  \
--headers="FILE_HASH=EA1rY4uVUN35goXDkeNaPVWj6ueoRNmS3hfOfxL9zgk= \
FILE_SIZE=440383379 \
METADATA_HASH=R+TqI4RldiQxOQqUgxZnGXXPgBFs4EXKwXaB2esWgKE= \
METADATA_SIZE=58809t"

 

and by this way also -

 

update_engine_client --payload=http://172.18.3.215/payload.bin --update --headers="FILE_HASH=EA1rY4uVUN35goXDkeNaPVWj6ueoRNmS3hfOfxL9zgk= FILE_SIZE=440383379 METADATA_HASH=R+TqI4RldiQxOQqUgxZnGXXPgBFs4EXKwXaB2esWgKE= METADATA_SIZE=58809t"

 

 

 

But I always get avc_denied error like below -

 

 

[ 7715.455315] type=1400 audit(1582115439.038:73): avc: denied { read } for pid=7366 comm="update_engine_c" name="misc" dev="proc" ino=40265319
28 scontext=u:r:shell:s0 tcontext=u:object_r:proc_misc:s0 tclass=file permissive=1
[ 7715.475597] type=1400 audit(1582115439.038:73): avc: denied { read } for pid=7366 comm="update_engine_c" name="misc" dev="proc" ino=40265319
evk_8mm:/ $ su
evk_8mm:/ # setenforce 0
evk_8mm:/ #
evk_8mm:/ #
evk_8mm:/ #

 

 

and when i make selinux permissive as shown above then these errors go off . but after executing the command nothing comes.

so how can I verify if my update-engine command executed successfully or not ?

 

and where can I find the OTA files which will be downloaded by this command ?

 

 

Thanks,

Maneesh

0 Kudos
Reply

17,985 Views
msingh1920
Contributor V

Hi Gusarambula,

I followed the steps given in Section 7 of Android user guide.

 

I did following steps -

 

1. Created a full OTA update package using -
$ source build/envsetup.sh
$ lunch evk_8mm-userdebug
$ make otapackage -j4

 

it created a .zip file and it includes payload.bin and payload_properties.txt .

 

2. And kept these file to my server and able to access it from another computer over wifi.

 

3. Booted the iMX8M mini and connected the board with same wifi network.. 

 

4. connected the debug port of iMX8Mini with my laptop and open the console with putty.

 

5. Now I am executing below command -

update_engine_client --payload=http://192.168.1.1:10888/payload.bin --update --
headers="FILE_HASH=0fSBbXonyTjaAzMpwTBgM9AVtlBeyOigpCCgkoOfHKY=
FILE_SIZE=379074366
METADATA_HASH=Icrs3NqoglzyppyCZouWKbo5f08IPokhlUfHDmz77WQ/de8Dgp9zFXt8Fo
+Hxccp465uTOvKNsteWU=
METADATA_SIZE=46866"

 

NOTE : - I replaced the ip address with my server ip and other payload_properties parameters with my parameter found in
               payload_properties.txt file

But when I run this command on IMX8 (from putty console ) then I get this error and nothing happens.


[0218/140214.639666:ERROR:update_engine_client_android.cc(148)] Found a positional argument 'headers=FILE_HASH=EA1rY4uVUN35goXDkeNaPVWj6ueoRNmS3hfOfxL9zgk= FILE_SIZE=440383379 METADATA_HASH=R+TqI4RldiQxOQqUgxZnGXXPgBFs4EXKwXaB2esWgKE= METADATA_SIZE=58809t'. If you want to pass a value to a flag, pass it as --flag=value.
1|evk_8mm:/ $

 

 

 

Any help or suggestion why this issue might be coming ???

 

Thanks,

Maneesh

0 Kudos
Reply

17,985 Views
msingh1920
Contributor V

Hi Gusarambula,

 

Thanks for your reply. It is very helpful.
I will check the website.

 

Thanks,
Maneesh

0 Kudos
Reply

17,985 Views
shivanipatel
Senior Contributor II

Hi Maneesh Singh,

Please find my answers for your questions as below:

Answers to Questions 1 to 3:

  • Yes, you can change/update the AOSP version with OTA. Please refer Section 7 of the attached Android User Guide for how one can do and build the OTA update packages.

Ans.4 :

  • Yes, you need to add your custom changes in new AOSP build.

Regards,

Shivani

17,985 Views
msingh1920
Contributor V

Hi Shivani Patel

I am able to Execute update command but for that I need to make selinux permissive to avoid any selinux permission error

update_engine_client --payload=http://172.18.3.215/payload.bin --update --headers="FILE_HASH=EA1rY4uVUN35goXDkeNaPVWj6ueoRNmS3hfOfxL9zgk= FILE_SIZE=440383379 METADATA_HASH=R+TqI4RldiQxOQqUgxZnGXXPgBFs4EXKwXaB2esWgKE= METADATA_SIZE=58809t"

But after executing update command no error or warning or any print message comes on my debug console. 

 

So my question is - 

 

1. how can I verify if my update-engine command executed successfully or not ?

2. how I will I verify if OTA update is started or not after executing this command ?

3. Where can I find the OTA files on my board which will be downloaded by this command ?

 

 Any help or suggestions will be very helpful.

 

Thanks,

Maneesh

0 Kudos
Reply

17,985 Views
msingh1920
Contributor V

Hi Shivani,

I observed that when i run update command on debug console -

 I tried to execute command in this way ->

update_engine_client --payload=http://192.168.1.1/payload.bin --update  \
--headers="FILE_HASH=EA1rY4uVUN35goXDkeNaPVWj6ueoRNmS3hfOfxL9zgk= \
FILE_SIZE=440383379 \
METADATA_HASH=R+TqI4RldiQxOQqUgxZnGXXPgBFs4EXKwXaB2esWgKE= \
METADATA_SIZE=58809t"

and by this way also -

update_engine_client --payload=http://172.18.3.215/payload.bin --update --headers="FILE_HASH=EA1rY4uVUN35goXDkeNaPVWj6ueoRNmS3hfOfxL9zgk= FILE_SIZE=440383379 METADATA_HASH=R+TqI4RldiQxOQqUgxZnGXXPgBFs4EXKwXaB2esWgKE= METADATA_SIZE=58809t"

But I always get avc_denied error like below -

[ 7715.455315] type=1400 audit(1582115439.038:73): avc: denied { read } for pid=7366 comm="update_engine_c" name="misc" dev="proc" ino=40265319
28 scontext=u:r:shell:s0 tcontext=u:object_r:proc_misc:s0 tclass=file permissive=1
[ 7715.475597] type=1400 audit(1582115439.038:73): avc: denied { read } for pid=7366 comm="update_engine_c" name="misc" dev="proc" ino=40265319
evk_8mm:/ $ su
evk_8mm:/ # setenforce 0
evk_8mm:/ #
evk_8mm:/ #
evk_8mm:/ #

and when i make selinux permissive as shown above then these errors go off . but after executing the command nothing comes.

so how can I verify if my update-engine command executed successfully or not ?

and where can I find the OTA files which will be downloaded by this command ?

Thanks,

Maneesh

0 Kudos
Reply

17,985 Views
msingh1920
Contributor V

Hi Shivani,

I followed the steps given in Section 7 of Android user guide.

I did following steps -

1. Created a full OTA update package using -
$ source build/envsetup.sh
$ lunch evk_8mm-userdebug
$ make otapackage -j4

it created a .zip file and it includes payload.bin and payload_properties.txt .

2. And kept these file to my server and able to access it from another computer over wifi.

3. Booted the iMX8M mini and connected the board with same wifi network.. 

4. connected the debug port of iMX8Mini with my laptop and open the console with putty.

5. Now I am executing below command -

update_engine_client --payload=http://192.168.1.1:10888/payload.bin --update --
headers="FILE_HASH=0fSBbXonyTjaAzMpwTBgM9AVtlBeyOigpCCgkoOfHKY=
FILE_SIZE=379074366
METADATA_HASH=Icrs3NqoglzyppyCZouWKbo5f08IPokhlUfHDmz77WQ/de8Dgp9zFXt8Fo
+Hxccp465uTOvKNsteWU=
METADATA_SIZE=46866"

NOTE : - I replaced the ip address with my server ip and other payload_properties parameters with my parameter found in
               payload_properties.txt file

But when I run this command on IMX8 (from putty console ) then I get this error and nothing happens.


[0218/140214.639666:ERROR:update_engine_client_android.cc(148)] Found a positional argument 'headers=FILE_HASH=EA1rY4uVUN35goXDkeNaPVWj6ueoRNmS3hfOfxL9zgk= FILE_SIZE=440383379 METADATA_HASH=R+TqI4RldiQxOQqUgxZnGXXPgBFs4EXKwXaB2esWgKE= METADATA_SIZE=58809t'. If you want to pass a value to a flag, pass it as --flag=value.
1|evk_8mm:/ $

Any help or suggestion why this issue might be coming ???

Thanks,

Maneesh

0 Kudos
Reply

17,985 Views
msingh1920
Contributor V

Hi Shivani,

Thanks for your reply. It is very helpful.
I will check the documents and follow the steps given in documents.

Thanks,

Maneesh

0 Kudos
Reply