cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
910 Views
Registered: ‎09-06-2019

Adding custom environments variables and kernel offsets in Petalinux (platform-auto.h)

Jump to solution

Hi I'm attempting to create different boot arguments to load different kernel images in a Zynq Ultrscale+ based on a preset value. The 2 kernel/rootfs images are stored in QSPI. The images are generated in buildroot while the u-boot image is created using petalinux 2018.3.

I would like to modify and add envirnment variables, mainly updating kernel size/offsets as well as changing the boot argumemnts. The flow being that our u-boot image would boot up using a the desired kernel. So if I wanted to overwrite the default bootcmd from:

bootcmd=run default_bootcmd 

to something like:

bootcmd=if test $bootpart = 1; then run kernelImage1; else run kernelImage2;

where kernelImage1 and kernelImage2 both does an sf probe to to load the bitstream and kernel + rootfs of images stored at different offsets.

Would the ideal place to change these variables be in platform-top.h using the information from platform-auto.h as documented here:

https://www.xilinx.com/support/answers/69780.html

If not, where would one change/add environment variables for custom configurations and designs?

Thanks!

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
842 Views
Registered: ‎09-06-2019

Re: Adding custom environments variables and kernel offsets in Petalinux (platform-auto.h)

Jump to solution

To be clear, if I wanted to add extra custom environment variables I would need to add them as a part of CONFIG_EXTRA_ENV_SETTINGS in which I would first have to copy the entire value of CONFIG_EXTRA_ENV_SETTINGS  found in platform-auto.h into platform-top.h and add the new variable there, correct? This is the method explained in AR#60780 (for 2016.4-2017.4) still apply to 2018.3?

For reference:

https://www.xilinx.com/support/answers/69780.html

 

View solution in original post

0 Kudos
4 Replies
Highlighted
Moderator
Moderator
861 Views
Registered: ‎12-04-2016

Re: Adding custom environments variables and kernel offsets in Petalinux (platform-auto.h)

Jump to solution

Hi 

In petalinux, platform-top.h file is the ideal one to make any uboot environment changes. platform-auto.h is autogenerated by tool and is not recommended to edit

 

Best Regards

Shabbir

0 Kudos
Highlighted
Explorer
Explorer
843 Views
Registered: ‎09-06-2019

Re: Adding custom environments variables and kernel offsets in Petalinux (platform-auto.h)

Jump to solution

To be clear, if I wanted to add extra custom environment variables I would need to add them as a part of CONFIG_EXTRA_ENV_SETTINGS in which I would first have to copy the entire value of CONFIG_EXTRA_ENV_SETTINGS  found in platform-auto.h into platform-top.h and add the new variable there, correct? This is the method explained in AR#60780 (for 2016.4-2017.4) still apply to 2018.3?

For reference:

https://www.xilinx.com/support/answers/69780.html

 

View solution in original post

0 Kudos
Highlighted
Moderator
Moderator
824 Views
Registered: ‎04-24-2017

Re: Adding custom environments variables and kernel offsets in Petalinux (platform-auto.h)

Jump to solution

Hi @badFITimage ,

Yes as I mentioned in AR #60780 you need to copy the CONFIG_EXTRA_ENV_SETTINGS from platform-auto.h to platform-top.h and then append your additional variables. This concept applies to all version of petalinux(2016.4 onwards)

The content of CONFIG_EXTRA_ENV_SETTINGS in platform-auto.h is generated based on your "petalinux-config" settings + default xilinx zynqmp env variables.

 

Note: If you don't copy CONFIG_EXTRA_ENV_SETTINGS from platform-auto.h to platform-top.h then you lose your "petalinux-config" settings.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Adventurer
Adventurer
751 Views
Registered: ‎10-02-2018

Re: Adding custom environments variables and kernel offsets in Petalinux (platform-auto.h)

Jump to solution

Hi,

I plan to boot from different paration BOOT.BIN, image.ub, rootfs.jffs2 storeed in QSPI flash the same as you. But i feel confused. I only see bootstart, kernelstart. I don't see rootfsstart in environment variable. How to u-boot know where offset of rootfs.jffs2

Have you try to boot from 2 paration BOOT.BIN, image.ub, rootfs.jffs2 storeed in QSPI flash?

How to impliment it?

Thanks and brgs.

0 Kudos