u-boot移植流程的C语言描述
来源:互联网 发布:php curl culopt 编辑:程序博客网 时间:2024/06/05 22:39
UBOOT的创始人Jerry Van Baren曾经在UBOOT的邮件列表中,使用c语言描述了如何移植UBOOT到你的新板子上去:
int main(int argc, char *argv[]) { sighandler_t no_more_time; signal(SIGALRM, no_more_time); alarm(PROJECT_DEADLINE - toSec (3 * WEEK)); //项目截止时间差3周发报警信号 //如果不差钱,雇用一个专家来移植UBoot 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 <keyword> */ } //要是有超过2500$,买一个BDI3000仿真器,否则要花掉更多的时间 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/<similar> board/<myboard> cp include/configs/<similar>.h include/configs/<myboard>.h } else { Create your own board support subdirectory; Create your own board include/configs/<myboard>.h file; } Edit new board/<myboard> files Edit new include/configs/<myboard>.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(); }