U-boot

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://redboot.blogbus.com/logs/31807665.html

最近一段时间在读uboot的代码,看了redboot之后,感觉uboot比较简单些。
不像redboot做了很多抽象的工作,而且背后还有ecos那么个大家伙。
uboot目的很明确,就是做bootloader。所以,更简洁,代码量少,也比较容易读。

我觉得做嵌入式软件,从uboot这样的软件开刀,进行学习,比较好。
一方面,代码量少,这样不会感觉,任务量大,无处下手。
另一方面,bootloader相关的东西很多,从一般开发都需要用到的编译知识,如makefile,link script
到对cpu, 设备驱动,几乎所有相关的东西都用到了。

更重要的是,你面对的是一个裸机,你可以从它最初上电开始,看着它一点一点运行起来。
那感觉真好。

uboot现在基本上是应用最广的bootloader了,似乎比redboot用得更多些。
我主要看了两个不同的平台,一个是mips的cpu,用的是24k的core, 另一个是arm的芯片,三星的s3c2410的cpu
用的是arm 920t的core。 mips的代码基本上读完了,arm的才刚刚开始。

arm和mips也算是当下最流行的嵌入式cpu喽。应该还是有代表性的。
后面想花些时间,边读边总结一下。

uboot的文档可以访问这里
已发布源码可以在这里下载
也可以用git下载最新的代码

在源码中,还有一份README,建议porting的时候可以读读。
最后,我把这份README里面的porting guid贴出来,给大家读读。
嘿嘿,蛮有意思的。

U-Boot Porting Guide:
----------------------
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-users 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 the source, Luke;
    }

    if (available_money > toLocalCurrency ($2500)) {
        Buy a BDI2000;
    } else {
        Add a lot of aggravation and time;
    }

    Create your own board support subdirectory;

    Create your own board config file;

    while (!running) {
        do {
            Add / modify source code;
        } until (compiles);
        Debug;
        if (clueless)
            email ("Hi, I am having problems...");
    }
    Send patch file to Wolfgang;

    return 0;
}

void no_more_time (int sig)
{
      hire_a_guru();
}

------------------
好了,今天聊到这,下次准备介绍一下uboot的编译过程。

 

more:http://redboot.blogbus.com/c2237159/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值