element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
MicroZed Hardware Design uenv.txt file for building kernel for microzed
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Avnet Boards Forums requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 4 replies
  • Subscribers 301 subscribers
  • Views 1079 views
  • Users 0 members are here
Related

uenv.txt file for building kernel for microzed

100aditya
100aditya over 8 years ago

Dear Sir,

             From http://microzed.org/product/wilink-8-adaptor webpage i got i have got one uenv.text file. The content of this text file is as follows:-

 

boot_microZed=mmcinfo;fatload mmc 0 0x3000000 ${kernel_image}; fatload mmc 0 0x2FF0000 ${devicetree_image}; fatload mmc 0 0x2000000 ${ramdisk_image}; bootm 0x3000000 0x2000000 0x2FF0000
uenvcmd=run boot_microZed
uenv_boot=run boot_microZed

 

Upon reading from the wiki pages i got to know the this is some kind of file that will be read during boot. As i am naive to linux dvelopment environment. Can some body tell me what is meaning of each line in the above text file ,why this file is required and also suggest me  if there is any link which can give me sound information about uenv.txt file so that i can customize it for mine other purpose on the fly as if when needed.

  • Sign in to reply
  • Cancel
  • Former Member
    0 Former Member over 8 years ago

    Hi,

    U-boot is the defacto secondary boot loader for booting Linux systems on Zynq.  U-boot has a command line interface and a series of built-in commands you can enter from a serial console, plus the ability to create command scripts that can be run automatically (or manually).  The lines you have included in your post are examples of scripted commands that have been created by combining the built-in commands along with variables and parameters.

    mmcinfo initializes and reads information from the SDIO controller, typically attached to a uSD card on MicroZed.  Fatload is reading a file from the uSD (mmc 0) device and is loading it to non-volatile memory (DDR2) at 0x3000000.  The file name is held in variable $(kernel_image) and will be set earlier in the file.  The rest of the fatload commands do the same, at different locations and different files.  bootm is the boot-from-memory command, providing the addresses of the three files required by Linux to load - in this case the kernel image, the device tree and the root file system.   The boot_microZed script command will execute all the built-in command defined here.  The other two variables are used to invoke the script using the built-in run command.  

    Typically, the uenv.txt file is stored in non-volatile memory (QSPI on MZ) so that when u-boot is loaded, it first checks its environment partition to see if there is a valid command set there.   If not, it gives you a warning and uses the "default environment", set at compile time.  This sometimes causes confusion to new users, as a device that has an environment stored in QSPI will consistently use that, even as the default environment in the source is changed.  You can load new environments, typically from the uenv.txt file, or erase it, using the u-boot built-in commands.

    To see variables in the current environment (either from QSPI or the default compiled environment), run the printenv command.

    Ron

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • 100aditya
    0 100aditya over 8 years ago in reply to Former Member

    Hi Ron,

                  Thanks for reply. Many things got cleared from your answer but as i told earlier i am new to Linux development environment so it will take time to visualize these things. Whatever now i am going to write infollowing points please correct it if i am wrong.

    1- So during U-boot(boot of the linux on microzed from the SD card) it will look for any file by the name of uenv.txt and if it exixts then it will executes the tasks as per this file and if uenv,txt file does not exixst then it will boot by default option.

    2- Now suppose that if we have uenv.txt file then it will look for any uenvcmd type of variable and if it is there then it will execute the things wriiten against it. Like in mine example it will execute "run boot_microZed",  which means it will execute:-- mmcinfo;fatload mmc 0 0x3000000 ${kernel_image}; fatload mmc 0 0x2FF0000 ${devicetree_image}; fatload mmc 0 0x2000000 ${ramdisk_image}; bootm 0x3000000 0x2000000 0x2FF0000

    3- in mine uenv.txt  "boot_microZed" is simply a variable and for example i can name it ,let us say, boot_mine. So if i do this then i have to repalce boot_microZed with boot_mine at all the places only in this uenv.txt file.

    4- i did a lot of google search but one thing which is still not clear to me:- what is diiference between uenvcmd and uenv_boot in mine above given scripts as both these lines are calling the same thing i.e. run boot_microZed.

    please reply me for this and suggest me any link which talks about such kind of scripts like uenvcmd, uenv_boot etc............

     

    Regards

    Aditya

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 8 years ago

    Aditya,

    1. No, the uenv.txt file is simply a convenient place to hold commands you want to program into the non-volatile memory set aside as the u-boot environment area.  On an Avnet microZed, this area is located in the on-board QSPI.  U-boot will check the QSPI area for a default environment - if it does not exist it uses the default one set in the source code.

    2. Environment variables can be specified with a number of u-boot commands, each separated by semi-colons.  See the example you provided in the boot_microzed environment variable in your first post.  These variables can be set up in a text file and subsequently programmed to QSPI to create a default environment for the board, or they can be added to the u-boot configuration and thereby become part of the default environment.  But you are correct in that if you have such a variable specified, entering "run <my_variable>" on the command line (or in another variable) will execute the commands you have encoded there.

    3. Right.  But the uenv.txt file needs to be loaded to QSPI to actually be available.  Which you can also do from a script as well, using the flash commands built into u-boot.  It is endlessly customizable.   Type "?" at a u-boot command prompt to see the available commands.

    4. I don't see any difference.  Both of those variables would do the same thing.  And because the variables can be named anything you choose, that's why you can't google uenvcmd and find anything useful.

    If you want to learn more about u-boot, I would recommend that you download the PetaLinux BSP for your version of MicroZed.  That environment makes it very easy to customize the operation of u-boot, and all of the build process is handled under the covers with a simple makefile.   Once you see how u-boot can be configured, you can then look at the mainline versions from DENX (if you wish), although you can pretty much endlessly customize u-boot under the PetaLinux environment.  In fact, I use the PetaLinux environment to build u-boot for Wind River Pulsar Linux, just because it is so easy to use.  On the Xilinx downloads page, you will find a number of documents that go into quite a bit of detail about Petalinux and the environment.  But essentially once you install the toolchain, you can download our BSP and type make to build a working u-boot and Linux kernel for the device. 

    Ron

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • 100aditya
    0 100aditya over 8 years ago
     

    Hi,

     

          Thanks for guiding me. So after discussing with u and one gentleman on Embedded Linux at Xilinx comunity mine many things got cleared.I  have downloaded the u-boot-xilinx form github. Inside this under the folder include/configs ,i found one folder zync-common.h where all the U-BOOT environmental variables are defined and co-related your answers with that. All things got almost visible but one thing that i am asking from mine very first post:-

     

    1- Can i change the "boot_microZed"(as the script that i have shared in mine first post belongs to microzed, may be written by some one) with word  "boot_zed" and after so much discussion it is appearing to me that i can do this as i did not find any boot_microZed variable in zync-common.h file.

     

    2- Also in mine shared script the last line which is "uenv_boot= run boot_microZed".

     

         For this there is no uenv_boot variable in the zync-common.h file. Rather from your previous replies

     

         seems  that it should be "uenvboot" not the "uenv_boot". But uenvboot has been defined in an another way in

     

         the zync-common.h file. So it seems me that there is no meaning of "uenv_boot= run boot_microZed" script

     

         and i can remove this line at all for mine purpose as it is of no use.

     

        What do you say about mine above two observations.

     

     

          Regards  

        Aditya

     

      PS

     

      3- Also i have found on  ver good video on Youtube on ZYNC TRAINING SESSION 11 ,ALL THE PARTS I,II,III by Pof Mohammad S sadri   which may be very helpful for new guys working on this.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube