查看: 1418|回复: 0

[原创] uboot 官方帮助文档 -- 移植手册部分

[复制链接]
  • TA的每日心情
    开心
    2024-1-16 17:48
  • 签到天数: 592 天

    连续签到: 1 天

    [LV.9]以坛为家II

    发表于 2019-5-27 22:25:31 | 显示全部楼层 |阅读模式
    分享到:
    本帖最后由 robe.zhang 于 2019-5-27 22:51 编辑

    uboot  READER 文档,关于如何移植,一共只有两部分信息,截取出来,第一部分如下:
    1. If the system board that you have is not listed, then you will need
    2. to port U-Boot to your hardware platform. To do this, follow these
    3. steps:

    4. 1.  Create a new directory to hold your board specific code. Add any
    5.     files you need. In your board directory, you will need at least
    6.     the "Makefile" and a "<board>.c".
    7. 2.  Create a new configuration file "include/configs/<board>.h" for
    8.     your board.
    9. 3.  If you're porting U-Boot to a new CPU, then also create a new
    10.     directory to hold your CPU specific code. Add any files you need.
    11. 4.  Run "make <board>_defconfig" with your new name.
    12. 5.  Type "make", and you should get a working "u-boot.srec" file
    13.     to be installed on your target system.
    14. 6.  Debug and solve any problems that might arise.
    15.     [Of course, this last step is much harder than it sounds.]
    复制代码
    第二部分如下:典型的 c 代码,我加了注释:

    1. U-Boot Porting Guide:
    2. ----------------------

    3. [Based on messages by Jerry Van Baren in the U-Boot-Users mailing
    4. list, October 2002]


    5. int main(int argc, char *argv[])
    6. {
    7.         sighandler_t no_more_time;

    8.         signal(SIGALRM, no_more_time);
    9.         alarm(PROJECT_DEADLINE - toSec (3 * WEEK));

    10.         if (available_money > available_manpower) {
    11.                 Pay consultant to port U-Boot;
    12.                 return 0;
    13.         }

    14.         Download latest U-Boot source;                                     # 下载源码

    15.         Subscribe to u-boot mailing list;                                  # 订阅邮件

    16.         if (clueless)
    17.                 email("Hi, I am new to U-Boot, how do I get started?");

    18.         while (learning) {
    19.                 Read the README file in the top level directory;               # 读文档
    20.                 Read http://www.denx.de/twiki/bin/view/DULG/Manual;
    21.                 Read applicable doc/*.README;
    22.                 Read the source, Luke;
    23.                 /* find . -name "*.[chS]" | xargs grep -i <keyword> */
    24.         }

    25.         if (available_money > toLocalCurrency ($2500))
    26.                 Buy a BDI3000;
    27.         else
    28.                 Add a lot of aggravation and time;

    29.         if (a similar board exists) {        /* hopefully... */
    30.                 cp -a board/<similar> board/<myboard>                           # 创建板子
    31.                 cp include/configs/<similar>.h include/configs/<myboard>.h      # 创建配置
    32.         } else {
    33.                 Create your own board support subdirectory;
    34.                 Create your own board include/configs/<myboard>.h file;
    35.         }
    36.         Edit new board/<myboard> files                                      # 编辑文件
    37.         Edit new include/configs/<myboard>.h                                # 编辑配置

    38.         while (!accepted) {
    39.                 while (!running) {               
    40.                         do {
    41.                                 Add / modify source code;                               # 改源码先编译通过
    42.                         } until (compiles);
    43.                         Debug;
    44.                         if (clueless)
    45.                                 email("Hi, I am having problems...");
    46.                 }                                                               # 改源码运行起来
    47.                 Send patch file to the U-Boot email list;
    48.                 if (reasonable critiques)
    49.                         Incorporate improvements from email list code review;
    50.                 else
    51.                         Defend code as written;
    52.         }                                                                   # 改源码直到自己满意

    53.         return 0;
    54. }

    55. void no_more_time (int sig)
    56. {
    57.       hire_a_guru();
    58. }
    复制代码
    两部分都是笼统的讲了一下,其实两部分的内容是一样的,第一部分还详细点,第二部分代入了工作场景。
    大牛看一看就知道怎么移植,小鸟看了跟没看一样,还是云里雾里。
    其实这个移植指导手册也对,只是太笼统了,细节一点没有,需要对 uboot 代码和结构等等都很熟悉,并且对单板也很熟悉,这样就容易移植了。
    官方移植文档就这么多信息,剩下的我来慢慢写,可能很久也写不完,但是不是特别特别详细的话,也很快。所以还是需要有基础。但是门槛肯定比 uboot 官方的门槛低得多了。

    以下是本人读 uboot 做的笔记,原汁原味,内容还是比较多,后续整理发帖出来可能还没有笔记全。
    https://github.com/robe-zhang/mys_y6ulx/tree/master/note_robe/note_uboot





    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-4-18 17:38 , Processed in 0.114726 second(s), 15 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.