Switching U-Boot versions on i.MX6

In our earlier post we described the what of the main-line based U-Boot sources for SABRE Lite and Nitrogen6X boards.

In this post, we’ll discuss the how.

To begin with, there’s the easy piece. We’ve published two Zip files that can upgrade or downgrade your U-Boot semi-automatically:


The reason for the term semi-automatically is that you will have to invoke the the upgrade or down-grade using the upgradeu command as discussed in our U-Boot conventions post:
U-Boot> run upgradeu


In each of these packages, you’ll see two files:

  • A boot script – named 6q_bootscript for the upgrade, and 6x_bootscript for the down-grade package, and
  • A U-Boot binary – named u-boot.imx for the upgrade, and u-boot-nopadding.bin in the down-grade.
If you look closely, you’ll see that we’re changing conventions[1]. We’re doing the same with the auto-boot script. We’re changing the name from 6q_bootscript to 6x_bootscript. The reason for the change is that these two versions have slight incompatibilities:

  • The new version contains support for the setexpr command, which prevents set from uniquely identifying setenv[2].
  • The new version has a slight difference in the syntax for sf probe. Specifically, it allows this form:
    sf probe [[bus:]cs] [hz] [mode]
    
    instead of this form:
    sf probe [bus:]cs [hz] [mode]
    
    In English: the chip-select is mandatory in U-Boot 2009.08. What’s worse is that it also has a different numbering scheme.
  • The primary outputs of the builds are different. U-Boot 2009.08 produced a file named u-boot.bin that contains the ROM header and 1024 bytes of padding at the start of the image. U-Boot 2012.10 produces a file named u-boot.imx which does not contain the header, so it needs to be burned to offset 0x400.
By changing the name along with the version bump, we can update each of our images to include support for either boot loader, and we’ll be doing that in the coming days.

In upcoming posts, we’ll fill you in on the details of how to get the sources for this latest version of U-Boot (they will be here). We’ll also add a check-list of each of the images on-line and a set of prototype boot scripts. In the mean-time, you can try these out and experience the new display and SATA support.

We can’t finish this post without referring you to the post on un-bricking your board. This process should be straightforward, but things happen and it’s always good to have the imx_usb tool handy.



Footnotes    (↵ returns to text)
  1. 6x_upgrade instead of 6q_upgrade
  2. U-Boot allows shortest-unique short-hand for command invocation. For example, fatl is normally interpreted as the full command fatload.

Tags:

19 Responses to “Switching U-Boot versions on i.MX6”

  1. ericn November 26, 2012 11:37 am #

    Quick notes on getting and building imx_usb:

    ~/$ git clone git://github.com/boundarydevices/imx_usb_loader.git
    ~/$ cd imx_usb_loader/
    ~/imx-usb-loader$ sudo apt-get install libusb-1.0-0-dev 
    ~/imx-usb-loader$ make
    
  2. Michael December 10, 2012 8:49 am #

    It appears that the upgrade does not replace the environment variables, and I no longer see the destroyenv command in the uboot help. Is there a way to make the new uboot restore the default environment variables?

    • ericn December 10, 2012 9:04 am #

      Hi Michael,

      I think you’re looking for ‘clearenv’, not ‘destroyenv’.

      And since this is itself an environment variable, it’s still there, but it probably won’t work.
      You can trash the saved environment like so:

      U-Boot> sf probe && sf erase 0xc0000 0×1000

      If you run ‘print’, you’ll see that the ‘clearenv’ command in the old U-Boot had a
      third parameter of 1, which doesn’t jive with the new implementation. In the new code base,
      the second parameter is a much more complicated combination of chip-select and GPIO number
      but thankfully defaults to the right thing.

      https://github.com/boundarydevices/u-boot-imx6/commit/c1173bd0754aa55bc52d874d5490c0c892a56ebf

      • blackdiamond December 10, 2012 9:10 am #

        It seems as though the clearenv command is not in the env.

        After do the sf probe… all the variables are still refuring to the 6q_bootscript not the 6x, did something go wrong with the upgrade of the uboot?

        this is the date if gave back, U-Boot 2013.01-rc1-00120-g7c28db0 (Nov 12 2012 – 09:15:04)

        • blackdiamond December 10, 2012 9:17 am #

          Actually after a reboot it apears to have worked fine. Thanks.

  3. Shanghui.Ye February 3, 2013 8:15 pm #

    Is there a prebuilt uboot image for imx6 sabre lite?
    I want to reversed to the version on my board: U-Boot 2013.01-rc1-02388-ga90f257 (Nov 27 2012 – 14:02:30)

    • ericn February 4, 2013 8:14 am #

      It appears that we don’t have a pre-built image on-line, but that’s easily remedied. Note that the version listed above is our current production version, matching the production branch of our Github tree.

      What in particular are you after?

      • Shanghui.Ye February 5, 2013 2:56 am #

        Thanks, I compiled the uboot image.

  4. Ari February 26, 2013 6:30 am #

    Hello,

    Firstly I unpacked [1] as sudo on a fresh formated ext3 SD.
    Secondly I loaded via USB the uboot from [2] to my target.

    After I could see via uart:

    U-Boot 2013.01-rc1-00120-g7c28db0 (Nov 12 2012 - 09:15:04)
    CPU:   Freescale i.MX6Q rev1.0 at 792 MHz
    Reset cause: POR
    Board: SABRE Lite
    DRAM:  1 GiB
    WARNING: Caches not enabled
    MMC:   FSL_SDHC: 0, FSL_SDHC: 1
    SF: Detected SST25VF016B with page size 4 KiB, total 2 MiB
    auto-detected panel Hannstar-XGA
    Display: Hannstar-XGA (1024x768)
    In:    serial
    Out:   serial
    Err:   serial
    Net:   FEC
    Warning: FEC using MAC address from net device
    Hit any key to stop autoboot:  0 
    mmc0 is current device
    ** Unrecognized filesystem type **
    255 bytes read
    ## Executing script at 10008000
    Unknown command 'set' - try 'help'
    3802076 bytes read
    ## Booting kernel from Legacy Image at 10800000 ...
       Image Name:   Linux-3.0.35-2026-geaaf30e-02064
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    3802012 Bytes = 3.6 MiB
       Load Address: 10008000
       Entry Point:  10008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK
    

    But then nothing happens !

    I think the uboot could successful load the kernel image.
    But dont understand why the system did not start.
    Any idea?

    [1] http://boundarydevices.com/eula/?file=LTIB-12.09.GA.tar.gz
    [2] http://commondatastorage.googleapis.com/boundarydevices.com/6q_upgrade-20121109.zip

    • ericn February 26, 2013 6:53 am #

      Hi Ari,

      Your message seems to hit a couple of things.

      First off, if you want to upgrade U-Boot, you’ll need to hit a key before the boot and run upgradeu at the U-Boot prompt:

      U-Boot > run upgradeu
      ...will take ~30 seconds or so, then tell you to hit **reset**
      

      The second issue is that the LTIB-12.09 image doesn’t seem to be booting for you. I’m a bit confused about this, and wonder if there’s something wrong in the image. You should at least see the kernel startup messages after the kernel load. The output you forwarded indicates that the kernel load was successful:

      ...
         Verifying Checksum ... OK
         Loading Kernel Image ... OK
      OK
      

      I’m a bit suspicious of the boot script because of this message:

      Unknown command 'set' - try 'help'
      

      Okay, I got it. Since you last ran the 2009.08 version of U-Boot, the bootcmd in your environment is still configured to load 6q_bootscript, which doesn’t have all of the automatic display detection and such. In order to clear this out, you’ll need to manually clear the environment like so:

      U-Boot > sf probe
      U-Boot > sf erase 0xc0000 0x1000
      U-Boot > reset
      

      You’ll want to run the upgradeu piece first so your machine will automatically boot to the latest U-Boot 2013.01.

  5. Ari February 26, 2013 11:45 am #

    Thank you for your reply. I will try your commands later.

    But there is still an other question for me:

    On the bootup I can see :
    CPU: Freescale i.MX6Q rev1.0 at 792 MHz
    Does this mean, that the board is only running with 792 MHz?
    Or is the board in a power on demand mode and will power up if i do more calculations?

    • ericn February 26, 2013 12:14 pm #

      Great question Ari (and one that we’ve been getting a lot lately).

      The 792MHz is just the fixed frequency used by U-Boot. As soon as Linux launches, the kernel will switch between a max of 1GHz (992 MHz to be precise) and 392MHz depending on load and temperature.

  6. hmarwan March 3, 2014 6:56 am #

    Hello,

    I have a problem with upgrading a system running U-Boot 2009.08 to U-Boot 2012.10.

    I have unzipped the zip on the SD card and I have launched the command “run upgradeu”.
    The process have succeded.

    Now when I try to start the sabre lite board, I have this error.

    U-Boot 2013.01-rc1-00120-g7c28db0 (Nov 12 2012 - 09:15:04)
    
    CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
    Reset cause: POR
    Board: SABRE Lite
    DRAM:  1 GiB
    WARNING: Caches not enabled
    MMC:   FSL_SDHC: 0, FSL_SDHC: 1
    SF: Detected SST25VF016B with page size 4 KiB, total 2 MiB
    *** Warning - bad CRC, using default environment
    
    No panel detected: default to HDMI
    unsupported panel HDMI
    In:    serial
    Out:   serial
    Err:   serial
    Net:   FEC [PRIME]
    Warning: failed to set MAC address
    
    Hit any key to stop autoboot:  0
    AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
    flags: ncq stag pm led clo only pmp pio slum part
    No port device detected!
    ** Bad device size - sata 0 **
    ** Bad device size - sata 0 **
    
    SATA device 1: unknown device
    ** Bad device sata 1 **
    ** Bad device sata 1 **
    MMC: no card present
    mmc0(part 0) is current device
    MMC: no card present
    ** Bad device mmc 0 **
    MMC: no card present
    ** Bad device mmc 0 **
    mmc1 is current device
    reading /6x_bootscript
    ** Unable to read file /6x_bootscript **
    Failed to mount ext2 filesystem...
    ** Unrecognized filesystem type **
    
    6x_bootscript not found
    
    serial console at 115200, 8N1
    
    details at http://boundarydevices.com/6q_bootscript
    
    

    Could someone help me please?

    • ericn March 3, 2014 7:08 am #

      It looks like you’ve successfully upgraded, but you’re now trying to boot with a disk that doesn’t have a Linux image.

      Do you still have the U-Boot upgrade SD card installed?

  7. Aditya Kousik March 9, 2014 2:11 am #

    Hello Eric,

    I’ve upgraded from the 2009 version to the recent production branch on the github repo. Has the ‘saveenv’ cmd overwritten somehow? It tries to save to mmc rather than flash. I’m unable to save the env variables now.

    Thanks in advance for your help,
    Aditya.

    • ericn March 9, 2014 8:19 am #

      Hi Aditya,

      Did you perhaps choose mx6qsabrelite_config? That configuration is present primarily for Freescalers to make SABRE Lite look more like Freescale boards, and overrides the normal settings.

      Most people should use nitrogen6q_config.

  8. maddilety May 22, 2014 11:03 pm #

    i am checking GPIO commands in u-boot, and when i tested its not working
    following are the steps which i used
    added at nitrogen6q_config.h file
    #define CONFIG_CMD_GPIO
    then compiled and bring up the u-boot
    u-boot#help
    gpio—

    i am able to see the gpio command
    when i tested gpio set GPIO1_IO09 pin and i probed its high
    when i clear GPIO1_IO09 still high

    even i tested toggle, status its showing high all the times,
    can any one tested GPIO commands? if yes can you provide me the procedure so that i can speed up my things

    • ericn May 23, 2014 7:20 am #

      The GPIO1 pin is muxed as USB_OTG_ID on our Nitrogen6x board.

      Are you running this on a custom board? If so, you’ll need to configure the pin-mux properly.

  9. hwmstr July 26, 2014 10:43 am #

    Hello, it looks like the download links are broken.

    NoSuchKey
    The specified key does not exist.

Leave a Reply