element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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
Avnet Boards General Bootgen vs mkimage with U-Boot SPL
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 3 replies
  • Subscribers 337 subscribers
  • Views 2294 views
  • Users 0 members are here
Related

Bootgen vs mkimage with U-Boot SPL

Former Member
Former Member over 9 years ago
I have created a U-Boot bootloader and Linux operating system using Buildroot
 
    git clone git://git.buildroot.net/buildroot
    cd buildroot
    make zynq_zed_defconfig
    make
 
This was successful, and I am able to boot Linux on my ZedBoard using a microSD as the boot device and using the BOOT.BIN that buildroot/U-Boot created from the U-Boot SPL binary.
 
The latest buildroot version uses U-Boot's mkimage to create a Zynq-compatible first stage bootloader from the U-Boot SPL binary (u-boot-spl.bin). I think this used to require a special python tool, but now mkimage has been given the ability to generate this binary itself.
 
However, I would like to experiment with the Xilinx bootgen tool instead of mkimage. Unfortunately, when I use bootgen, the resulting BOOT.BIN does not work.
 
I am using a BIF file (boot.bif) as follows:
 
    image:
    {
        [bootloader] u-boot-spl.bin
    }
 
I am invoking bootgen like this:
 
    bootgen -arch zynq -image boot.bif -o BOOT.BIN
 
The resulting BOOT.BIN file is 90600 bytes, which is larger than what I create using mkimage (86952 bytes):
 
    $ mkimage -A arm -T zynqimage -d u-boot-spl.bin BOOT.BIN
    Image Type   : Xilinx Zynq Boot Image support
    Image Offset : 0x000008c0
    Image Size   : 86952 bytes (86952 bytes packed)
    Image Load   : 0x00000000
    User Field   : 0x00000000
    Checksum     : 0xfd17ac31
 
Can anyone tell me how to get bootgen to generate a bootable binary from my u-boot-spl.bin? I noticed that if I specify zynqmp instead of zynq for -arch, the file size is exactly 256 bytes larger, but it still does not work.
 
Thanks,
 
Gregg
 
  • Sign in to reply
  • Cancel
  • Former Member
    0 Former Member over 8 years ago

    Hi Gregg,

      I'm not a user of buildroot, but it seems to follow a slightly different procedure to generate a boot.bin file for Zynq than bootgen does.  The normal procedure for using bootgen is to supply (in the .bif) a first-stage bootloader program (zynq-fsbl.elf), and optional bitstream (if you are loading the PL) and an executable (in this case, u-boot.elf).   The FSBL can be generated automatically from the application template in the Xilinx SDK.  It looks like buildroot takes some of the PS7 initialization files and puts them directly into the u-boot image it creates, which is perfectly fine as it doesn't matter where the initialization is done, it just has to be done.  

    I suspect the problem you are having is trying to take components from two similar but different processes for accomplishing the same task, and there are some differences in the way the components are generated.  Bootgen expects the FSBL to be an ELF file.  If you can convert the output of the self-contained u-boot image generated by buildroot to an ELF, then it should be possible to simply generate a boot.bin that contains only that file, as it contains the initialization required for the PS.  

    Ron

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

    It seems that bootgen leaves the length fields in the boot header set to zero when the input file is a raw binary. It must rely on the elf headers for length information. I was able to make this work by converting the bin file to an elf using objcopy (search for bin2elf), which it turns out is exactly what you suggested above. Thanks.

    Gregg

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • alamyliu
    0 alamyliu over 7 years ago

    .BIF file

    •   [bootloader] is not U-Boot, it's FSBL
    •   U-Boot is an application to bootgen

     

    BOOT.bif (example)

    image : {

    [bootloader]fsbl/microzed_fsbl.dumpmem.elf

    u-boot.elf

    }

     
    $ bootgen -image boot.bif -o i BOOT.bin
     
    • 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