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.

SK-AM64: enable bootcount support

Part Number: SK-AM64

Hi, 

I'm working on AM64x SKEVM board using SD card, and using Yocto to build an image. 

I'm trying to enable bootcount feature.

As I saw on this thread: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/769365/linux-beaglebk-enable-u-boot-bootcount

I've added the lines:

#define CONFIG_BOOTCOUNT_LIMIT
#define CONFIG_BOOTCOUNT_ENV

and: 

"bootlimit=4\0" \
"altbootcmd= echo Rollback to previous rootfs" \
"if test ${bootpart} = 1:2; " \
"then setenv bootpart 1:3; " \
"else setenv bootpart 1:2; " \
"fi; setenv bootcount 0; saveenv; bootcmd\0" \

to EXTRA_ENV_AM642_BOARD_SETTINGS_MMC part

in include/configs/am64x_evm.h file.

I stopped the autoboot and did see the bootcount variable was added.

Then I was trying to test the feature:

I've added the variable upgrade_available, set it to one and change the bootpart to wrong one (e.g 1:6, doesn't exist), continued the boot process and this error came out:

U-Boot SPL 2021.01-g15769936a5 (Feb 20 2023 - 18:54:55 +0000)
EEPROM not available at 80, trying to read at 81
SYSFW ABI: 3.1 (firmware rev 0x0015 '21.9.1--v2021.09a (Terrific Lla')
SPL initial stack usage: 13392 bytes
Trying to boot from MMC2
Starting ATF on ARM64 core...

NOTICE:  BL31: v2.5(release):08.03.00.002-dirty
NOTICE:  BL31: Built : 19:53:47, Mar 14 2023

U-Boot SPL 2021.01-g15769936a5 (Mar 16 2023 - 09:47:30 +0000)
SYSFW ABI: 3.1 (firmware rev 0x0015 '21.9.1--v2021.09a (Terrific Lla')
Trying to boot from MMC2


U-Boot 2021.01-g15769936a5 (Mar 16 2023 - 09:47:30 +0000)

SoC:   AM64X SR1.0
Model: Texas Instruments AM642 SK
Board: AM64-SKEVM rev E3
DRAM:  2 GiB
MMC:   mmc@fa00000: 1
In:    serial@2800000
Out:   serial@2800000
Err:   serial@2800000
Failed to lookup gpio gpio@38_0: -22
Net:   eth2: ethernet@8000000
Hit any key to stop autoboot:  0
=> setenv bootpart 1:6
=> setenv upgrade_available 1
=> saveenv
Saving Environment to FAT... OK
=> boot
switch to partitions #0, OK
mmc1 is current device
SD/MMC found on device 1
Failed to load 'boot.scr'
1011 bytes read in 2 ms (493.2 KiB/s)
Loaded env from uEnv.txt
Importing environment from mmc1 ...
** Invalid partition 6 **
** Invalid partition 6 **
** Invalid partition 6 **
Bad Linux ARM64 Image magic!
=> pri bootlimit
bootlimit=4
=> pri bootcount
bootcount=1

I'm also having trouble to see new variables or modified ones after using fw_setenv command. I'm loading the uboot.env from boot partition, and my importbootenv variable looks like this:

importbootenv=echo Importing environment from mmc${mmcdev} ...; fatload mmc ${mmcdev} ${loadaddr} uboot.env;env import -t ${loadaddr} ${filesize}

Is there something I missing to configure it right?

Thanks,

Shmulik.