• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » Linux » Linux forum » Customizing U-Boot
Share
Linux
  • Forum
Options
  • Subscribe via RSS

Customizing U-Boot

Customizing U-Boot

This question is not answered
Santhosh Ramani
Posted by Santhosh Ramani
on May 22 2012 14:50 PM
Expert1525 points

Hello,

I am currently working with the AM335x Evaluation board, and would like to know where does U-Boot get all the necessary parameters for initializing the system. I did read through few documents which indicate that there is a 2 stage loading. The X-loader which is based on a strip down version of U-Boot gets loaded first (also called the SPL) and then the U-boot is loaded by this X-loader into RAM and it executes from RAM.

1. Are there documents that clearly indicate which peripherals are initialized by the X-loader and which are initialized by the U-boot?

2. What are the specific functions of U-boot and X-loader, how to build drivers for only those peripherals that are needed?

When I go through the forum everyone seems to have already passed the first two stages, which tells me that I may be missing something trivial. Are there documents that clearly mention how to do these and I haven't read them??

Thanks in advance for your replies.

Regards

Santhosh

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Mayank Mangla
    Posted by Mayank Mangla
    on May 22 2012 18:35 PM
    Expert3845 points

    the most important job of x-load is to initialize external SDRAM because uboot is too big to fit in On Chip Memory. Other than that xload also initializes pin mux and some clock domains.

    ------------------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    ------------------------------------------------------------------------------------------------------------------

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Prabhakar Lad
    Posted by Prabhakar Lad
    on May 23 2012 02:13 AM
    Genius4675 points

    Hi Santosh,

    In general the job of Secondary stage loader (SPL/X-loader), is to setup the minimum level, like setting up the pll controllers, setting up the DDR, etc and load the U-boot Image to RAM and final jump to U-boot. Even before SPL the RBL comes up when you turn on the switch first and tries to load the second stage loader.

    And the job U-boot in general is to setup the flashes, EMAC , load the linux image to RAM and jump to this address finally. For AM335XX I can see the SPL code for it is present in the U-boot source refer this link http://processors.wiki.ti.com/index.php/AMSDK_u-boot_User%27s_Guide#Compiling_MLO_and_u-boot

    Thx,

    --Prabhakar Lad

    http://in.linkedin.com/pub/prabhakar-lad/19/92b/955

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Santhosh Ramani
    Posted by Santhosh Ramani
    on May 23 2012 09:10 AM
    Expert1525 points

    Hello Prabhakar, Mayank,

    Thank you for the quick response, I see that I should have given more information about the situation. I have read through the document links you have posted. I am mainly interested in finding out which files I need to edit and/or read through to understand how the initialization is done (in the SPL and U-Boot). I would like to make minor tweaks to the EVM code for testing and then later on make major modifications when we develop our custom board.

    Although there are documents that clearly indicate how to compile them, which I have read through and have compiled these, there are none specifying how and/or what to modify. On previous occasions of using TI's software package (namely Stellarisware) the code was well documented and the Application notes made it easier to understand and make changes as required.

    The Linux variant seems all cryptic to a relatively new user - I am not completely new to Linux - just haven't worked with TI's SDK. Is there a getting started guide - I have read through most documents on the wiki page; I am looking for something more in depth and detailed - not just how to compile and download code.

    Thank you for your patience.

    Regards

    Santhosh

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Santhosh Ramani
    Posted by Santhosh Ramani
    on May 25 2012 09:58 AM
    Expert1525 points

    Hello,

    I have been ploughing through the U-Boot code and have found most definitions for the EVM board in am335x_evm.h. I have few questions regarding some of the definitions in this file:

    1. CONFIG_SYS_NAND_U_BOOT_START - Is defined as 'CONFIG_SYS_TEXT_BASE' which in turn is defined to be 8MB from the start of the DRAM. What does this definition mean and where and how is it used??

    2. Similar question regarding CONFIG_SYS_NAND_U_BOOT_OFFS.

    There are many definitions in this file which are difficult to understand - since they are specific to the EVM and there are no specific hits in google. Is there a document that explains how and why these definitions are used as such?

    Thank you

    Regards

    Santhosh

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Prabhakar Lad
    Posted by Prabhakar Lad
    on May 26 2012 08:20 AM
    Genius4675 points

    Hi,

    The file am335x_evm.h which is found in include/configs/ is like a configuration file for your board.

    1. CONFIG_SYS_NAND_U_BOOT_START - Is defined as 'CONFIG_SYS_TEXT_BASE' which in turn is defined to be 8MB from the start of the DRAM. What does this definition mean and where and how is it used??

    'CONFIG_SYS_NAND_U_BOOT_START' This config tells that U-boot image

    is present at this address in RAM, so when SPL has done its job it

    finally jumps to this address in RAM where U-boot image is present.

    2. Similar question regarding CONFIG_SYS_NAND_U_BOOT_OFFS.

    As I have told the task performed SPL, this config

    'CONFIG_SYS_NAND_U_BOOT_OFFS' tells the SPL to Load U-Boot image from

    NAND into RAM at this addreess.

    If you notice this address is same as ''CONFIG_SYS_NAND_U_BOOT_START'

    this is just the naming convention.

    Hope that clears your doubt..

    Thx,

    --Prabhakar Lad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Santhosh Ramani
    Posted by Santhosh Ramani
    on May 30 2012 11:18 AM
    Expert1525 points

    Hello Prabhakar,

    Thank you for your response, I clearly understood the first part but have some difficulty understanding the second one. From the file it seems the value of the U-Boot offset is wrong. This is what I found in the file

    #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000

    /*
     * 8MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM.
     * 64 bytes before this address should be set aside for u-boot.img's
     * header. That is 0x807FFFC0--0x80800000 should not be used for any
     * other needs.
     */
    #define CONFIG_SYS_TEXT_BASE        0x80800000

    Could you please clarify - the U-Boot offset seems to be 512KB where as the Text Base is at 8MB. Also the comments indicate that it is the start address for the SPL's bss - this is what is confusing.

    Thank you for your patience.

    Regards

    Santhosh

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Prabhakar Lad
    Posted by Prabhakar Lad
    on May 30 2012 12:30 PM
    Genius4675 points

    Hi,

    #define CONFIG_SYS_NAND_U_BOOT_OFFS    0x80000

    /*
     * 8MB into the SDRAM to allow for SPL's bss at the beginning of SDRAM.
     * 64 bytes before this address should be set aside for u-boot.img's
     * header. That is 0x807FFFC0--0x80800000 should not be used for any
     * other needs.
     */
    #define CONFIG_SYS_TEXT_BASE        0x80800000

    Could you please clarify - the U-Boot offset seems to be 512KB where as the Text Base is at 8MB. Also the comments indicate that it is the start address for the SPL's bss - this is what is confusing.

    "CONFIG_SYS_NAND_U_BOOT_OFFS" -->> This offset indicates that your U-boot image is present in this location in NAND flash. So in your case the u-boot image is present at 512KB in NAND flash. This u-boot image is flashed ti NAND using to some tool , you can check out it writes at 0x80000 in your case.

    "CONFIG_SYS_TEXT_BASE "-->> This offset indicates, finally when SPL has read the u-boot image from some flash in you case from nand. So at this address in RAM your u-boot image is copied and finally after copying the SPL jumps to this address so now your U-boot starts executing.

    Thx,

    --Prabhakar Lad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Santhosh Ramani
    Posted by Santhosh Ramani
    on May 30 2012 13:37 PM
    Expert1525 points

    Hello Prabhakar,

    Thank you again, yes that makes sense now;  just got a little confused due to the naming convention. I read through U-Boot User's Guide and found that there are 4 copies of SPL totaling upto 512KB and then U-Boot is placed after that section. Could you please answer few more questions for me? Thank you so much for your patience.

    I was reading through the document u-boot-spl.lds and I am trying to co-relate the bss definition in the am335x_evm.h.

    U-BOOT-SPL.LDS

    MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
            LENGTH = CONFIG_SPL_BSS_MAX_SIZE }

    AM335X_EVM.H

    #define CONFIG_SPL_BSS_START_ADDR    0x80000000 
    #define CONFIG_SPL_BSS_MAX_SIZE        0x80000        /* 512 KB */

    How are these 2 related - because if there is only 512KB of bss data for the SPL - then couldn't the U-Boot image start before the 8MB boundary. Does the U-Boot copy the Linux kernel to the start of SDRAM (0x80000000) and hence is located 8MB below the starting location. I am justing trying to understand the logic and layout of the individual parts. I understand that some of the questions may be dumb - but I am not able to find any sources where I can get such basic information.

    Once again thanks for your patience.

    Thank you

    Regards

    Santhosh

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Prabhakar Lad
    Posted by Prabhakar Lad
    on May 31 2012 05:48 AM
    Genius4675 points

    Hi,

    U-BOOT-SPL.LDS

    MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
            LENGTH = CONFIG_SPL_BSS_MAX_SIZE }

    AM335X_EVM.H

    #define CONFIG_SPL_BSS_START_ADDR    0x80000000 
    #define CONFIG_SPL_BSS_MAX_SIZE        0x80000        /* 512 KB */

    How are these 2 related - because if there is only 512KB of bss data for the SPL - then couldn't the U-Boot image start before the 8MB boundary. Does the U-Boot copy the Linux kernel to the start of SDRAM (0x80000000) and hence is located 8MB below the starting location. I am justing trying to understand the logic and layout of the individual parts. I understand that some of the questions may be dumb - but I am not able to find any sources where I can get such basic information.

    Agreed the size of the BSS is only 512KB, but the size of the SPL is

    CONFIG_SPL_MAX_SIZE (46 * 1024) in your case. The U-Boot copies linux at

    CONFIG_SYS_LOAD_ADDR (0x81000000 in your case). Not sure why 8Mb is left

    never worked on this board :( May be you can find it out in AM335x boot docs.

    Thx,

    --Prabhakar Lad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Santhosh Ramani
    Posted by Santhosh Ramani
    on Jun 01 2012 10:47 AM
    Expert1525 points

    Hello Prabhakar,

    Thanks again for your reply. Do you know what is the use of the BSS segment for SPL. Also have you worked with booting from SD Card on other boards, if so, can you please explain how the following definitions work:

    #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR    0x300 /* address 0x60000 */
    #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS    0x200 /* 256 KB */

    I didn't understand the Boot_Sector definition, how is it used?

    Thanks again for your replies :)

    Regards

    Santhosh

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Prabhakar Lad
    Posted by Prabhakar Lad
    on Jun 04 2012 08:36 AM
    Genius4675 points

    Hi,

    Do you know what is the use of the BSS segment for SPL.

    Its used for the same purpose as  in general.  It  contains all global

    variables and static variables that are initialized to zero or do not have

    explicit initialization in source code.

    you please explain how the following definitions work:

    #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR    0x300 /* address 0x60000 */
    #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS    0x200 /* 256 KB */

    I didn't understand the Boot_Sector definition, how is it used?

    CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is the address in MMC/SD card

    CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS is the size.

    If you notice you can also find CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION this tells

    in which partition to look for.

    These configs are used to  load U-Boot from when the MMC is being used in raw mode.

    Thx,

    --Prabhakar Lad

    -------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------

    PSP
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Santhosh Ramani
    Posted by Santhosh Ramani
    on Jun 04 2012 08:42 AM
    Expert1525 points

    Hello Prabhakar,

    Thanks again for your reply. I understand the definitions for sector size and partition, but if the starting address of U-Boot is provided does it mean that the script which is used to generate the SD Card images (U-boot.bin, MLO, Kernel image etc.) places each of these files in a specific location? I was under the impression that the U-Boot file is picked up by file name, u-boot.img. Am I missing something?

    Also, if the starting address is defined, then where in the file generation script does it specific which sector to place it in? I tried looking at the SD Card image but I couldn't see any indications. May be I am looking at the wrong place?

    Thank you for all your replies and patience :)

    Regards

    Santhosh

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Prabhakar Lad
    Posted by Prabhakar Lad
    on Jun 04 2012 09:04 AM
    Genius4675 points

    Hi,

    I am not so sure on AM335x, but usually the case is the the flasher tool flashes to some specific address in the

    MMC/SD card and this address is given to SPL to load the U-boot image.

    Since you can any day change the address to be flashed of the U-boot image, because of which

    this is the config in your am335x configuration file.

    Thx,

    --Prabhakar Lad

    PSP
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Santhosh Ramani
    Posted by Santhosh Ramani
    on Jun 04 2012 09:44 AM
    Expert1525 points

    Hello Prabhakar,

    Can you please point me to any document that will help me find out more about this; I tried looking for the way the address is used but couldn't find any reference. If you have used this with a different device then can you point me to information about that, may be I will be able to co-relate.

    thanks

    Regards

    Santhosh

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Prabhakar Lad
    Posted by Prabhakar Lad
    on Jun 04 2012 23:43 PM
    Genius4675 points

    Hi,

    If you can point to me your script which configures the MMC card I'll help you with the same.

    Thx,

    --Prabhakar Lad

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
12
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use