7
U-Boot 2013.07 (Nov 21 2013 - 18:12:40)

Memory: ECC disabled
DRAM:  1 GiB
MMC:   zynq_sdhci: 0
SF: Detected N25Q128A with page size 64 KiB, total 16 MiB
In:    serial
Out:   serial
Err:   serial
Net:   Gem.e000b000
Hit any key to stop autoboot:  0
SF: Detected N25Q128A with page size 64 KiB, total 16 MiB
SF: 11010048 bytes @ 0x520000 Read: OK
Wrong Image Format for bootm command
ERROR: can't get kernel image!
U-Boot-PetaLinux>

then I would type run sdboot, and it boots from sd card, where I have put an image for sd booting.

It shows that by default UBoot is booting from flash. What changes do I need to make in uboot and where so that the default boot device is SD card and not the flash?

Is there any environmental variable I have to set for this?

5
  • whether it boots from flash or sdcard, depends on the hardware design.
    – Peter Teoh
    Jun 9, 2014 at 17:26
  • which media a machine boots from by default depends on the machine ... for a PC it depends on the BIOS setup ... the contents of the media cannot control this nor should it .
    – Skaperen
    Apr 1, 2015 at 10:27
  • i have found that the BIOS in all my machines loses the setting to boot SD or USB by default whenever it boots up with that device not having any media
    – Skaperen
    Apr 1, 2015 at 10:30
  • one issue people sometimes have is mounting the wrong root filesystem ... make sure each media is different and is set to mount itself by UUID
    – Skaperen
    Apr 1, 2015 at 10:33
  • @How did you reboot into uboot prompt?!
    – Dr.jacky
    Jan 19, 2016 at 8:37

2 Answers 2

3

To know more about u-boot options, I suggest you do

U-Boot-PetaLinux> printenv

and look at effect of specific environment variables mentioned in UBootEnvVariables. Probably the change you would make is

U-Boot-PetaLinux> setenv bootcmd 'run sdboot' ; saveenv ; reboot

Variables bootcmd and bootargs are most important to understand. Nothing is really hard and info is out there for you.

1

If your system is already set up you can use the method described by @Joe Kul. In effect you set a environment variable with the boot options you want and save the u-boot configuration file to your media.

If you are still debugging your installation you may want to set your environment variable in the source code then recompile. After you get your u-boot commands figured out.

The file to edit depends on what board you are using. I use the mx23evk so I edit the /include/configs/mx23evk.h file. Look at the /* Extra Environments */ section.

I removed everything that was in that section and replaced it with this.

/* Extra Environments */
#define CONFIG_EXTRA_ENV_SETTINGS \
    "boot_mfg=echo Running mfgtools...; " \
        "ext2load mmc 0:6 0x40600000 /boot/uboot/mfgupdat.zIm; " \
        "ext2load mmc 0:6 0x40a00000 /boot/uboot/mfgupdat.dtb; " \
        "bootz 40600000 - 40a00000;\0" \
    "boot_pro=echo Running Production...; " \
        "ext2load mmc 0:6 0x40600000 /boot/uboot/pro_1.zIm; " \
        "ext2load mmc 0:6 0x40a00000 /boot/uboot/pro_1.dtb; " \
        "bootz 40600000 - 40a00000;\0" \
    "boot_rescue=echo Running Rescue...; " \
        "bootz 40600000 - 40a00000;\0" \

At the u-boot command line I can pick between the 3 predefined boot settings by simply: run boot_mfg OR run boot_pro ...

This allows me to quickly boot into 3 different configurations. Just set one as default when you are done with your debugging.

If I remember correctly the CONFIG_BOOTDELAY and CONFIG_BOOTCOMMAND variables have something to do with the default boot.

So first I would boot as you have been figure out what commands allow you to boot on the media in the partition with the kernel and root you want.

ext2load mmc 0:6 0x40600000 /boot/uboot/mfgupdat.zIm

Then I would change my source code to reflect this command, not auto booting yet, by running the variable you set in source code.

run my_boot_variable

If you are happy with that then change you source code again to auto boot using that variable with or without a timed delay. You can add multiple boot variables and select different ones by a key press.

I have not worked with this in a couple of months so I may be leaving out important information, but this should get you looking in the right direction.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .