SWupdate for IMX8MN

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

SWupdate for IMX8MN

1,139 Views
razriel
Contributor II

Hi,

I have followed the SWupdate article from Kknowladge base.

https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/SWUpdate-OTA-i-MX8MM-EVK-i-MX8QXP-MEK/ta...

modified it to IMX8MN based on imx8mn-ddr4-evk 

I was able to create demo image containing imx-boot, rescue image (kernel,device tree, and ramsidk rootfs) boot partition with kernel and device tree, operational rootfs partition.

also created a swu image with boot partition and rootfs and was able to upgrade using mongoose.

I am using a single image strategy.

I am experiasing few problems:

1. fw_setenv is not working from operational rootfs although /etc/fw_env.config exists and directs to the expected address. the error message is:

Cannot read environment, using default

it works well from ramdisk image. but the goal is to run it from operational rootfs (for user to initiate). can you sugget why is it not working from operational rootfs ? 

2. single image full demo has capababilty to replace the imx-boot image also. it uses emmc_bootpart.sh

and wants to write to /dev/mmcblk1boot0 partition in offset of 32k. when tried this version it failed to find this partition. maybe its something related to imx8mm-evk only? in my bsp there is no partition for the imx-boot it is located on known offset. how can I replace the imx-boot image located on /dev/mmcblk1 offset 32K ? will swupdate support it ?

 

 

 

 

0 Kudos
5 Replies

1,108 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi  @razriel ,

I hope you are doing well.
 
1. Please make sure  /etc/fw_env.config and u-boot board configuration header contains the correct offset and partition for the environment file.
    One can refer to Linux fw_printenv fw_setenv to access U-Boot's environment variables for fw_printenv-related issues.
 
2. Please make sure that you have configured the correct partition and mmc in emmc_bootpart.sh
    one can use padding_file_create.sh to create an Image with a 32k offset. 
    Please refer to SWUpdate OTA for more details.
 
   SW update OTA i.MX8MM EVK / i.MX8QXP MEK post only contains yocto patches for i.MX8MM and i.MX8QXP only.
   For i.MX8MN you need to make changes according to your requirements.
 
Thanks & Regards,
Sanket Parekh
0 Kudos

1,072 Views
razriel
Contributor II

see below hex dump of the redundant env variavble address.

same info is in /etc/fw_env.config

/dev/mmcblk2 0x402000 0x4000

still when trying to run fw_printenv it complains the 

oot@TigoGateway-0000:~# fw_printenv
Cannot read environment, using default
Cannot read default environment from file

 

what else can cause this error ?

 

root@TigoGateway-0000:~# hexdump /dev/mmcblk2 -s 0x402000 -n 1000 -C
00402000 c4 07 84 c2 01 61 64 6a 75 73 74 62 6f 6f 74 73 |.....adjustboots|
00402010 6f 75 72 63 65 3d 69 66 20 74 65 73 74 20 24 7b |ource=if test ${|
00402020 62 6f 6f 74 73 6c 6f 74 7d 20 3d 20 64 75 61 6c |bootslot} = dual|
00402030 41 20 7c 7c 20 74 65 73 74 20 24 7b 62 6f 6f 74 |A || test ${boot|
00402040 73 6c 6f 74 7d 20 3d 20 73 69 6e 67 6c 65 6e 6f |slot} = singleno|
00402050 72 6d 61 6c 3b 20 74 68 65 6e 20 72 75 6e 20 61 |rmal; then run a|
00402060 64 6a 75 73 74 62 6f 6f 74 73 6f 75 72 63 65 41 |djustbootsourceA|
00402070 3b 20 66 69 3b 69 66 20 74 65 73 74 20 24 7b 62 |; fi;if test ${b|
00402080 6f 6f 74 73 6c 6f 74 7d 20 3d 20 64 75 61 6c 42 |ootslot} = dualB|
00402090 3b 20 74 68 65 6e 20 72 75 6e 20 61 64 6a 75 73 |; then run adjus|
004020a0 74 62 6f 6f 74 73 6f 75 72 63 65 42 3b 20 66 69 |tbootsourceB; fi|
004020b0 00 61 64 6a 75 73 74 62 6f 6f 74 73 6f 75 72 63 |.adjustbootsourc|
004020c0 65 41 3d 65 63 68 6f 20 52 6f 6f 74 46 73 20 53 |eA=echo RootFs S|
004020d0 6c 6f 74 20 41 3b 20 73 65 74 65 6e 76 20 6d 6d |lot A; setenv mm|
004020e0 63 70 61 72 74 20 31 3b 20 73 65 74 65 6e 76 20 |cpart 1; setenv |
004020f0 6d 6d 63 72 6f 6f 74 20 2f 64 65 76 2f 6d 6d 63 |mmcroot /dev/mmc|
00402100 62 6c 6b 24 7b 6d 6d 63 64 65 76 7d 70 32 20 72 |blk${mmcdev}p2 r|
00402110 6f 6f 74 77 61 69 74 20 72 77 00 61 64 6a 75 73 |ootwait rw.adjus|
00402120 74 62 6f 6f 74 73 6f 75 72 63 65 42 3d 65 63 68 |tbootsourceB=ech|
00402130 6f 20 52 6f 6f 74 46 73 20 53 6c 6f 74 20 42 3b |o RootFs Slot B;|
00402140 20 73 65 74 65 6e 76 20 6d 6d 63 70 61 72 74 20 | setenv mmcpart |
00402150 33 3b 20 73 65 74 65 6e 76 20 6d 6d 63 72 6f 6f |3; setenv mmcroo|
00402160 74 20 2f 64 65 76 2f 6d 6d 63 62 6c 6b 24 7b 6d |t /dev/mmcblk${m|
00402170 6d 63 64 65 76 7d 70 34 20 72 6f 6f 74 77 61 69 |mcdev}p4 rootwai|
00402180 74 20 72 77 00 61 6c 74 62 6f 6f 74 52 6f 6c 6c |t rw.altbootRoll|
00402190 62 61 63 6b 41 3d 65 63 68 6f 20 52 6f 6c 6c 69 |backA=echo Rolli|
004021a0 6e 67 20 62 61 63 6b 20 74 6f 20 73 6c 6f 74 20 |ng back to slot |
004021b0 64 75 61 6c 41 3b 73 65 74 65 6e 76 20 62 6f 6f |dualA;setenv boo|
004021c0 74 73 6c 6f 74 20 64 75 61 6c 41 3b 72 75 6e 20 |tslot dualA;run |
004021d0 70 6f 73 74 5f 6f 70 74 3b 72 75 6e 20 62 6f 6f |post_opt;run boo|
004021e0 74 63 6d 64 00 61 6c 74 62 6f 6f 74 52 6f 6c 6c |tcmd.altbootRoll|
004021f0 62 61 63 6b 42 3d 65 63 68 6f 20 52 6f 6c 6c 69 |backB=echo Rolli|
00402200 6e 67 20 62 61 63 6b 20 74 6f 20 73 6c 6f 74 20 |ng back to slot |
00402210 64 75 61 6c 42 3b 73 65 74 65 6e 76 20 62 6f 6f |dualB;setenv boo|
00402220 74 73 6c 6f 74 20 64 75 61 6c 42 3b 72 75 6e 20 |tslot dualB;run |
00402230 70 6f 73 74 5f 6f 70 74 3b 72 75 6e 20 62 6f 6f |post_opt;run boo|
00402240 74 63 6d 64 00 61 6c 74 62 6f 6f 74 63 6d 64 3d |tcmd.altbootcmd=|
00402250 69 66 20 74 65 73 74 20 24 7b 62 6f 6f 74 73 6c |if test ${bootsl|
00402260 6f 74 7d 20 3d 20 73 69 6e 67 6c 65 72 65 73 63 |ot} = singleresc|
00402270 75 65 20 7c 7c 20 20 74 65 73 74 20 24 7b 62 6f |ue || test ${bo|
00402280 6f 74 73 6c 6f 74 7d 20 3d 20 73 69 6e 67 6c 65 |otslot} = single|
00402290 6e 6f 72 6d 61 6c 3b 20 74 68 65 6e 20 72 75 6e |normal; then run|
004022a0 20 61 6c 74 62 6f 6f 74 73 69 6e 67 6c 65 3b 20 | altbootsingle; |
004022b0 66 69 3b 69 66 20 74 65 73 74 20 24 7b 62 6f 6f |fi;if test ${boo|
004022c0 74 73 6c 6f 74 7d 20 3d 20 64 75 61 6c 41 20 7c |tslot} = dualA ||
004022d0 7c 20 20 74 65 73 74 20 24 7b 62 6f 6f 74 73 6c || test ${bootsl|
004022e0 6f 74 7d 20 3d 20 64 75 61 6c 42 3b 20 74 68 65 |ot} = dualB; the|
004022f0 6e 20 72 75 6e 20 61 6c 74 62 6f 6f 74 64 75 61 |n run altbootdua|
00402300 6c 3b 20 66 69 00 61 6c 74 62 6f 6f 74 64 75 61 |l; fi.altbootdua|
00402310 6c 3d 69 66 20 74 65 73 74 20 24 7b 62 6f 6f 74 |l=if test ${boot|
00402320 73 6c 6f 74 7d 20 3d 20 64 75 61 6c 41 20 3b 20 |slot} = dualA ; |
00402330 74 68 65 6e 20 72 75 6e 20 61 6c 74 62 6f 6f 74 |then run altboot|
00402340 52 6f 6c 6c 62 61 63 6b 42 3b 20 66 69 3b 20 69 |RollbackB; fi; i|
00402350 66 20 74 65 73 74 20 24 7b 62 6f 6f 74 73 6c 6f |f test ${bootslo|
00402360 74 7d 20 3d 20 64 75 61 6c 42 20 3b 20 74 68 65 |t} = dualB ; the|
00402370 6e 20 72 75 6e 20 61 6c 74 62 6f 6f 74 52 6f 6c |n run altbootRol|
00402380 6c 62 61 63 6b 41 3b 20 66 69 3b 00 61 6c 74 62 |lbackA; fi;.altb|
00402390 6f 6f 74 73 69 6e 67 6c 65 3d 69 66 20 74 65 73 |ootsingle=if tes|
004023a0 74 20 24 7b 62 6f 6f 74 73 6c 6f 74 7d 20 3d 20 |t ${bootslot} = |
004023b0 73 69 6e 67 6c 65 72 65 73 63 75 65 3b 20 74 68 |singlerescue; th|
004023c0 65 6e 20 72 75 6e 20 61 6c 74 62 6f 6f 74 75 73 |en run altbootus|
004023d0 62 3b 20 66 69 3b 20 69 66 20 74 65 73 74 20 24 |b; fi; if test $|
004023e0 7b 62 6f 6f 74 73 6c 6f |{bootslo|
004023e8

0 Kudos

1,054 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @razriel 

I hope you are doing well.
 
Please make sure CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET in defconfig, and CONFIG_SYS_MMC_ENV_DEV in include/configs/imx8mm_evk.h
match the content of  /etc/fw_env.config.
 
Please make sure include/configs/imx8mm_evk.h contains  #define CONFIG_SYS_MMC_ENV_PART 0.
 
Note: CONFIG_SYS_MMC_ENV_PART does not refer to software partitions, such as /dev/mmcblk2p1.
          Here, Partition 0 refers to user area.
 
Thanks & Regards,
Sanket Parekh

0 Kudos

741 Views
razriel
Contributor II

Thanks Sanket.

Just tested what you suggested.

1. CONFIG_SYS_MMC_ENV_DEV was set to 1 while I am trying to  use 2. so I changed it.

2. #define CONFIG_SYS_MMC_ENV_PART 0 was missing.

added them. still not able to use fw_printenv, fw_setenv

I can see the data is saved to 0x402000 after I do saveenv in boot.

what else can be missing ? I have done the changes only in u-boot do I have to do them somehow in the linux kernel ?

0 Kudos

738 Views
razriel
Contributor II

I had some progress.
it was not clear I needed to copy the u-boot-initial-env into /etc.
now I have done it.
still having problem. u-boot reads the env varailble from 0x402000 redundant and when i write from rootfs it goes to the 0x400000 so it is not actually changed. how exactly it works ?

BR,

Roy

0 Kudos