u-boot分析与移植——基于u-boot-2011.3和FL2440

发布时间: 2024-08-29
来源: 电子工程世界

关于移植的基本方法可以先阅读u-boot的README文档


If the system board that you have is not listed, then you will need

to port U-Boot to your hardware platform. To do this, follow these

steps:


1.  Add a new configuration option for your board to the toplevel

    'Makefile' and to the 'MAKEALL' script, using the existing

    entries as examples. Note that here and at many other places

    boards and other names are listed in alphabetical sort order. Please

    keep this order.

参考已有记录,在顶层目录的Makefile和MAKEALL脚本添加新的配置项。注意这里和其它很多地方,

开发板和其它的名字都是按照字母表顺序排列。请保持此顺序。(个人注:新版本中大部分配置项已移至

一个单独的文件——boards.cfg)

 

2.  Create a new directory to hold your board specific code. Add any

    files you need. In your board directory, you will need at least

    the 'Makefile', a '.c', 'flash.c' and 'u-boot.lds'.

创建新的目录,存放开发板相关代码。添加必要的文件在开发板目录,至少包括

'Makefile'、'.c'、 'flash.c' 和'u-boot.lds'。

3. Create a new configuration file 'include/configs/.h' for your board

为目标板创建新的配置文件'include/configs/.h'


3.  If you're porting U-Boot to a new CPU, then also create a new

    directory to hold your CPU specific code. Add any files you need.

如果是为一个新的CPU移植,需要创建一个新的目录存放CPU相关代码。添加需要的文件。


4.  Run 'make _config' with your new name.

执行'make _config'。


5.  Type 'make', and you should get a working 'u-boot.srec' file

    to be installed on your target system.

6.  Debug and solve any problems that might arise.

    [Of course, this last step is much harder than it sounds.]

Debug并解决出现的问题。[当然,最后一步比听起来难得多。]

 

下面一段挺有意思:


U-Boot Porting Guide:

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


[Based on messages by Jerry Van Baren in the U-Boot-Users mailing

list, October 2002]



int main(int argc, char *argv[])

{

    sighandler_t no_more_time;


    signal(SIGALRM, no_more_time);

    alarm(PROJECT_DEADLINE - toSec (3 * WEEK));


    if (available_money > available_manpower) {

        Pay consultant to port U-Boot;

        return 0;

    }


    Download latest U-Boot source;


    Subscribe to u-boot mailing list;


    if (clueless)

        email('Hi, I am new to U-Boot, how do I get started?');


    while (learning) {

        Read the README file in the top level directory;

        Read http://www.denx.de/twiki/bin/view/DULG/Manual;

        Read applicable doc/*.README;

        Read the source, Luke;

        /* find . -name '*.[chS]' | xargs grep -i */

    }


    if (available_money > toLocalCurrency ($2500))

        Buy a BDI3000;

    else

        Add a lot of aggravation and time;


    if (a similar board exists) {    /* hopefully... */

        cp -a board/ board/

        cp include/configs/.h include/configs/.h

    } else {

        Create your own board support subdirectory;

        Create your own board include/configs/.h file;

    }

    Edit new board/ files

    Edit new include/configs/.h


    while (!accepted) {

        while (!running) {

            do {

                Add / modify source code;

            } until (compiles);

            Debug;

            if (clueless)

                email('Hi, I am having problems...');

        }

        Send patch file to the U-Boot email list;

        if (reasonable critiques)

            Incorporate improvements from email list code review;

        else

            Defend code as written;

    }


    return 0;

}


void no_more_time (int sig)

{

      hire_a_guru();

}


文章来源于: 电子工程世界 原文链接

本站所有转载文章系出于传递更多信息之目的,且明确注明来源,不希望被转载的媒体或个人可与我们联系,我们将立即进行删除处理。