linuxpartitionu-bootfreertosfat

How to get U-boot to automatically load from FAT partition


I have an NXP board with U-boot and Linux on it. On start up, if I don't type anything, the U-boot will automatically start Linux using a linux image. Everything is on my SD card which is plugged into the board.

The SD card has a FAT partition on it that contains a binary file with a FreeRTOS program. I can run it by doing the following: 1. turn on the board and immediately type anything on the keyboard to get into U-boot 2. type fatload mmc 0:1 0x7F8000 hello_world.bin 3. type dcache flush and then bootaux 0x7F8000

I need U-boot to automatically start the FreeRTOS binary file, and not the Linux image. How can I accomplish this? Can I make some kind of startup U-boot script that does these commands on startup? Thanks.


Solution

  • To know more about u-boot environment variables i suggest you do:

    u-boot> printenv 
    

    this command print all env variables on screen. And look at variables description mentioned in U-Boot Environment Variables

    Variable bootcmd is most important to understanding. Nothing is really hard and info is out there for you.

    Probably the change you would make is

    u-boot> setenv load_firmware 'fatload mmc 0:1 0x7F8000 hello_world.bin; dcache flush; bootaux 0x7F8000'
    u-boot> setenv bootcmd load_firmware
    

    then

    u-boot> saveenv; reboot
    

    to save changes and reboot.

    Hope this help.