[External] Re: How to set boot count in U-boot for NXP iMX.6 Dual and Dual lite?

Igor Opaniuk igor.opaniuk at gmail.com
Tue Mar 10 14:15:30 CET 2020


Hi Pratik,

On Tue, Mar 10, 2020 at 2:11 PM Pratik Rajyaguru
<pratik.rajyaguru at einfochips.com> wrote:
>
> Hi Igor,
>
> I have already posted query in NXP Community. Here's thread: https://community.nxp.com/message/1270693
>
> I received suggestion to post in u-boot mailing list, because the query is specific to u-boot booting counter mechanism and commands.
> Please suggest, if any insight related to mechanism in question (ignoring outdated u-boot version).

The problem is that bootcount was re-worked (as other
subsystems/drivers, where the principal change was switching to
Driver Model and using device trees) and it might happend that
suggestions left here
can not be applicable to the version you mentioned.

Just to make long story short:
1. All bootcount-related symbols weve moved to Kconfig, so
configuration should be
provided in appropriate defconfig (instead of include/configs/*.h
header files). For example for
imx6qdl_icore_mmc_defconfig:
$ grep -e "BOOTCOUNT" -r ./configs/
...
./configs/imx6qdl_icore_mmc_defconfig:CONFIG_BOOTCOUNT_BOOTLIMIT=3
./configs/imx6qdl_icore_mmc_defconfig:CONFIG_SYS_BOOTCOUNT_ADDR=0x020D8024
./configs/imx6qdl_icore_mmc_defconfig:CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
./configs/imx6qdl_icore_mmc_defconfig:CONFIG_CMD_BOOTCOUNT=y
./configs/imx6qdl_icore_mmc_defconfig:CONFIG_BOOTCOUNT_LIMIT=y
./configs/imx6qdl_icore_mmc_defconfig:CONFIG_SYS_BOOTCOUNT_MAGIC=0x0B01C041

2. It really depends on what driver you want to use (they differ in
the way how a
boot counter value is stored: raw partition/ext2 file/RAM/U-Boot env).
If you don't have anything particular in mind, I would suggest to use U-Boot
ENV-based one (it's pretty simple to debug, and you don't need to mess with
low-level writes/reads, different partition layout etc.):
drivers/bootcount/bootcount_env.c
Check details about other drivers here: drivers/bootcount/Kconfig

3. If you finally decide to use DM-enabled driver, you should add a proper node
to the device tree of your board , check example here:
./arch/arm/dts/imx6q-bx50v3-uboot.dtsi
If not (for example, bootcount_env.c is not DM-enabled), you don't
need to add anything,
maybe some additional params in your defconfig/or even
./include/configs/<your-board.h>
header file.

4. Don't forget to handle boot counter reseting in Linux after succesful boot
(for ENV-based driver you can use fw_(printenv/setenv) tools).

Hope it helps

>
> Thank you,
> Pratik Rajyaguru
>
> -----Original Message-----
> From: Igor Opaniuk <igor.opaniuk at gmail.com>
> Sent: 10 March 2020 17:32
> To: Pratik Rajyaguru <pratik.rajyaguru at einfochips.com>
> Cc: u-boot at lists.denx.de
> Subject: [External] Re: How to set boot count in U-boot for NXP iMX.6 Dual and Dual lite?
>
>
> CAUTION: This email originated from outside of the organization. This message might not be safe, use caution in opening it. If in doubt, do not open the attachment nor links in the message.
>
>
> Hi Pratik,
>
> On Tue, Mar 10, 2020 at 12:37 PM Pratik Rajyaguru <pratik.rajyaguru at einfochips.com> wrote:
> >
> > Hello All,
> >
> > I want to set boot count to 5 for iMX.6 to set attempt counter, in case of failures at boot time. I am using both Dual and Dual lite modules.
> >
> > U-boot source code reference: Freescale's U-Boot 2014.04.
> > As I checked, CONFIG_BOOTCOUNT_LIMIT MACRO can be used to configure attempt counter, in case of failures at boot time. Then alternative booting command can be configured, if counter is exceeded.
> It's unlikely that someone can help you with NXP U-Boot fork here (especially with pretty outdated one).
> It's better to post these questions here in https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommunity.nxp.com%2F&data=02%7C01%7Cpratik.rajyaguru%40einfochips.com%7Cf99a59bbf2674a101b1608d7c4ead0b6%7C0beb0c359cbb4feb99e5589e415c7944%7C1%7C0%7C637194385109946909&sdata=BUTmx5xwl1omTy3dHuNo0vsgvUT9OklnakqGlY1phVw%3D&reserved=0.
>
> >
> > I have enabled CONFIG_BOOTCOUNT_LIMIT MACRO in u-boot file include/configs/mx6_common.h.
> > I received error as mentioned below.
> >
> > common/built-in.o: In function `process_boot_delay':
> > <path>/uboot/build_uboot/common/main.c:340: undefined reference to `bootcount_load'
> > <path>/uboot/build_uboot/common/main.c:342: undefined reference to `bootcount_store'
Basically the message you receive says that you don't have any
bootcount driver compiled.

> >
> > Can someone please guide me through expected procedure to configure / build u-boot with boot count?
> > Any insight / alternative approach suggestion will be highly useful.
> >
> >
> > Thanks in advance,
> > Pratik Rajyaguru
> >
>
>
> --
> Best regards - Freundliche Grüsse - Meilleures salutations
>
> Igor Opaniuk
>
> mailto: igor.opaniuk at gmail.com
> skype: igor.opanyuk
> +380 (93) 836 40 67
> https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fua.linkedin.com%2Fin%2Fiopaniuk&data=02%7C01%7Cpratik.rajyaguru%40einfochips.com%7Cf99a59bbf2674a101b1608d7c4ead0b6%7C0beb0c359cbb4feb99e5589e415c7944%7C1%7C0%7C637194385109946909&sdata=lvQmmCpLLWy%2FO2MeMSv%2B501wT3Ok%2BS%2F0ueyO3Jc3Ca0%3D&reserved=0



-- 
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk


More information about the U-Boot mailing list