How do I change the u-boot environment variable using bitbake?

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

How do I change the u-boot environment variable using bitbake?

Jump to solution
16,293 Views
Takashi_Kashiwagi
Senior Contributor I

Hi all

I use "uuu.exe" to write "fsl-image-qt5-validation-imx.sdcard" in eMMc.

After writing by uuu.exe is finished, I change some env manually as follows.

  • setenv fdt_file fsl-imx8mm-evk-rm67191.dtb
  • setenv run_m4_tcm 'fatload mmc 1:1 0x7E0000 XXXX.bin; bootaux 0x7e0000'
  • setenv bootcmd "run run_m4_tcm; mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else booti ${loadaddr} - ${fdt_addr}; fi"

I want to create "fsl-image-qt5-validation-imx.sdcard" preconfigured env above.

How do I make recipe files (*.bb or *.bbappend)?

Best Regards,

T.Kashiwagi

Labels (2)
Tags (2)
1 Solution
12,791 Views
radhikasomaiya
Senior Contributor II

Hi Takashi Kashiwagi,

Can we close this thread as the question asked in main thread is answered.

You can create new tickets for your questions so we can take follow up over there.

Regards,

Radhika Somaiya.

View solution in original post

0 Kudos
12 Replies
12,791 Views
Takashi_Kashiwagi
Senior Contributor I

HI Radhika Somaiya

 

Thank you for responding.

> Can we close this thread as the question asked in main thread is answered.

> You can create new tickets for your questions so we can take follow up over there.

OK. I will ask again if there are any questions.

Best Regards,

T.Kashiwagi

0 Kudos
12,792 Views
radhikasomaiya
Senior Contributor II

Hi Takashi Kashiwagi,

Can we close this thread as the question asked in main thread is answered.

You can create new tickets for your questions so we can take follow up over there.

Regards,

Radhika Somaiya.

0 Kudos
12,790 Views
radhikasomaiya
Senior Contributor II

Hi Takashi Kashiwagi,

You can refer the attached UUU readme pdf to flash images using UUU command.

Regards,

Radhika Somaiya.

0 Kudos
12,790 Views
Takashi_Kashiwagi
Senior Contributor I

HI Radhika Somaiya

 

Thank you for responding.

I have see the file that you attached.

I write some things I understood.

  • u-boot does not seem to contain DCD table. (3.2.1 Changing the DCD table for i.MX DDR initialization)
  • imx-boot-imx8mmevk-sd.bin-flash_evk is created by "$ bitbake imx -boot"
  •  "$ bitbake imx -boot" copy the u-boot.bin as follows.
cp /home/tkashi/imx-yocto-bsp/build-xwayland/tmp/deploy/images/imx8mmevk/u-boot-imx8mmevk.bin-sd /home/tkashi/imx-yocto-bsp/build-xwayland/tmp/work/imx8mmevk-poky-linux/imx-boot/0.2-r0/git/iMX8M/u-boot.bin

The timestamp is now correct by writing the rebuilt imx-boot-imx8mmevk-sd.bin-flash_evk:smileyhappy:

U-Boot SPL 2018.03-imx_v2018.03_4.14.78_1.0.0_ga+g7ade5b407f (Jun 25 2019 - 00:12:32 +0000)
power_bd71837_init
DDRINFO: start lpddr4 ddr init
DRAM PHY training for 3000MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DRAM PHY training for 3000MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DRAM PHY training for 400MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DRAM PHY training for 100MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from MMC2


U-Boot 2018.03-imx_v2018.03_4.14.78_1.0.0_ga+g7ade5b407f (Jun 25 2019 - 00:12:32 +0000)

CPU: Freescale i.MX8MMQ rev1.0 1800 MHz (running at 1200 MHz)
CPU: Commercial temperature grade (0C to 95C) at 47C
Reset cause: POR
Model: FSL i.MX8MM EVK board
DRAM: 2 GiB
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x52]
Power supply on USB2
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x50]
MMC: FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment

However, "Warning-bad CRC, using default environment" is displayed. And "env" is not the value I intended.

I will look at the u-boot source code for a little more.

Best Regards,

T.Kashiwagi

0 Kudos
12,790 Views
radhikasomaiya
Senior Contributor II

Hi, Takashi Kashiwagi

There is no need to build the u-boot again as by using below commands, u-boot.imx image (named as u-boot-sd-2018.03-r0.bin in yocto source) is also generated and you will be able to see your custom u-boot environment variables in the u-boot.

  • bitbake -c cleansstate fsl-image-qt5-validation-imx
  • bitbake fsl-image-qt5-validation-imx

To answer your questions, please find my answers as per below:

  • The SD card image (.sdcard) contains U-Boot, the Linux image(zImage) and device trees, and the rootfs So, u-boot is included in "fsl-image-qt5-validation-imx-imx8mmevk.sdcard".
  • The default u-boot image file used by i.mx8mm-evk is "u-boot-sd-2018.03-r0.bin". "imx-boot-imx8mmevk-sd.bin-flash_evk" is a zImage.
  • Follow the below steps to build the u-boot
    • bitbake -c cleansstate u-boot-imx
    • bitbake -c compile -f u-boot-imx
    • bitbake u-boot-imx

Regards,

Radhika Somaiya.

12,790 Views
Takashi_Kashiwagi
Senior Contributor I

HI radhika.somaiya@volansystech.com

Thank you for responding.

To answer your questions, please find my answers as per below:

Thank you. I understood. And I bitbaked fsl-image-qt5-validation-imx,  The "u-boot-*.bin" files in "./tmp/deploy/images/imx8mmevk/" are as follows. 

lrwxrwxrwx 2 tkashi tkashi 24 6月 25 09:12 u-boot-imx8mmevk.bin -> u-boot-sd-2018.03-r0.bin
lrwxrwxrwx 2 tkashi tkashi 24 6月 25 09:12 u-boot-imx8mmevk.bin-sd -> u-boot-sd-2018.03-r0.bin
-rw-r--r-- 2 tkashi tkashi 663909 6月 25 09:12 u-boot-sd-2018.03-r0.bin
lrwxrwxrwx 2 tkashi tkashi 49 6月 25 09:12 u-boot-spl.bin -> u-boot-spl.bin-imx8mmevk-2018.03-r0-sd-2018.03-r0
lrwxrwxrwx 2 tkashi tkashi 49 6月 25 09:12 u-boot-spl.bin-imx8mmevk -> u-boot-spl.bin-imx8mmevk-2018.03-r0-sd-2018.03-r0
-rw-r--r-- 2 tkashi tkashi 90600 6月 25 09:12 u-boot-spl.bin-imx8mmevk-2018.03-r0-sd-2018.03-r0
lrwxrwxrwx 2 tkashi tkashi 49 6月 25 09:12 u-boot-spl.bin-imx8mmevk-sd -> u-boot-spl.bin-imx8mmevk-2018.03-r0-sd-2018.03-r0
lrwxrwxrwx 2 tkashi tkashi 49 6月 25 09:12 u-boot-spl.bin-sd -> u-boot-spl.bin-imx8mmevk-2018.03-r0-sd-2018.03-r0
lrwxrwxrwx 2 tkashi tkashi 24 6月 25 09:12 u-boot.bin -> u-boot-sd-2018.03-r0.bin
lrwxrwxrwx 2 tkashi tkashi 24 6月 25 09:12 u-boot.bin-sd -> u-boot-sd-2018.03-r0.bin

But with uuu I do not know which command to use as follows. I always use "> uuu -b emmc_all imx-boot-imx8mmevk-sd.bin-flash_evk fsl-image-qt5-validation-imx-imx8mmevk.sdcard". 

What is the method of writing * .sdcard file as it is without specifying bootloader?

>uuu fsl-image-qt5-validation-imx-imx8mmevk.sdcard
uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.2.0-0-g194351b

Wait for Known USB Device Appear
Error: fail open file: >fsl-image-qt5-validation-imx-imx8mmevk.sdcard/uuu.auto

>

>uuu fsl-image-qt5-validation-imx-imx8mmevk.sdcard.bz2
uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.2.0-0-g194351b

Success 0 Failure 1

1:3 1/ 2 [Can find validate IVT header] SDP: boot -f fsl-image-qt5-validation-imx-imx8mmevk.sdcard.bz2

>

Best Regards,

T.Kashiwagi

0 Kudos
12,790 Views
b36401
NXP Employee
NXP Employee

You can use saveenv u-boot option to save the changes you made with setenv.

0 Kudos
12,789 Views
Takashi_Kashiwagi
Senior Contributor I

Hi Victor and community.

Please let me know if you know.

 It seems that "CONFIG_EXTRA_ENV_SETTINGS“ of "~/imx-yocto-bsp/build-xwayland/tmp/work/imx8mmevk-linux/u-boot-imx/208.03-r0/git/include/configs/imx8mm_evk.h" sets environment variables, but there was no change even if I applied a patch.

I think that something like "defconfig" overwrites settings somewhere, Do you know where to apply the patch?

(I'll atach the bbappend and patch files that I used)

I checked a following u-boot recipe . 

~/imx-yocto-bsp/sources/meta-fsl-bsp-release/imx/meta-bsp/recipes-bsp/u-boot/u-boot-imx_2018.03.bb

And I'm looking following source codes.

~/imx-yocto-bsp/build-xwayland/tmp/work/imx8mmevk-poky-linux/u-boot-imx/2018.03-r0/git

Best Regards,

T.Kashiwagi

0 Kudos
12,789 Views
radhikasomaiya
Senior Contributor II

Hi, Takashi Kashiwagi

It seems that your changes are not taken into compilation as these changes are in the header file. Can you please rebuild the image after clean?

Try the following commands to rebuild the image:

  • bitbake -c cleansstate fsl-image-qt5-validation-imx
  • bitbake fsl-image-qt5-validation-imx

Regards,

Radhika Somaiya

0 Kudos
12,789 Views
Takashi_Kashiwagi
Senior Contributor I

Hi radhika.somaiya@volansystech.com

Thank you for responding!

Try the following commands to rebuild the image:

  • bitbake -c cleansstate fsl-image-qt5-validation-imx
  • bitbake fsl-image-qt5-validation-imx

I executed cleanall, cleansstate and bitbake . But I noticed that the u-boot timestamp is old.

U-Boot 2018.03-imx_v2018.03_4.14.78_1.0.0_ga+g654088c (Nov 28 2018 - 19:15:55 +0000)

CPU: Freescale i.MX8MMQ rev1.0 1800 MHz (running at 1200 MHz)
CPU: Commercial temperature grade (0C to 95C) at 48C
Reset cause: POR
Model: FSL i.MX8MM EVK board
DRAM: 2 GiB

I confirmed that "tmp/work/imx8mmevk-poky-linux/u-boot-imx/2018.03-r0/image/boot/u-boot-sd-2018.03-r0.bin" was created by "$ bitbake u-boot-imx".

However, this bin file looks like it is not included in the final disk image(fsl-image-qt5-validation-imx-imx8mmevk.sdcard).

Which u-boot.bin is  actually written?:smileycry:

Best Regards,

T.Kashiwagi

0 Kudos
12,789 Views
Takashi_Kashiwagi
Senior Contributor I

Hi radhika.somaiya@volansystech.com and community.

There are some items to check

  • "fsl-image-qt5-validation-imx-imx8mmevk.sdcard" does not include u-boot, does it?.
  • Defalut u-boot image file is "imx-boot-imx8mmevk-sd.bin-flash_evk", isn't it?
  • How can I recreate "imx-boot-imx8mmevk-sd.bin-flash_evk" after running "bitbake u-boot-imx"??

 

(I checked "u-boot-sd-2018.03-r0.bin" by binary editor. And I noticed that u-boot-sd-2018.03-r0.bin does not have IVT Header.)

 

Best Regards,

T.Kashiwagi

0 Kudos
12,789 Views
Takashi_Kashiwagi
Senior Contributor I

Hi Victor

Thank you for responding.

> You can use saveenv u-boot option to save the changes you made with setenv.

I'm sorry. The writing was bad. After I executed setenv, I also executed saveenv. Even if saveenv is executed, rewriting the disk image will initialize env of u-boot.

I do not want to execute setenv & saveenv with u-boot after writing a disk image with uuu.

So I want to include above settings to Disk Image by bitbake recipes.

Do you know any good way?

Best Regards,

T.Kashiwagi

0 Kudos