新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > AM335x(TQ335x)學(xué)習(xí)筆記——u-boot-2014.10移植

AM335x(TQ335x)學(xué)習(xí)筆記——u-boot-2014.10移植

作者: 時間:2016-11-28 來源:網(wǎng)絡(luò) 收藏
然后添加board_is_tq335x函數(shù)的具體實現(xiàn),參考其它類似函數(shù)實現(xiàn)即可,由于我們的read_eeprom僅讀到了name,其內(nèi)容是"TQ335x",故可如下實現(xiàn),在board/ti/am335x/board.h中添加如下內(nèi)容:
  1. staticinlineintboard_is_tq335x(structam335x_baseboard_id*header)
  2. {
  3. return!strncmp(header->name,"TQ335x",HDR_NAME_LEN);
  4. }
最后是修改enable_board_pin_mux(board/ti/am335x/mux.c)函數(shù),具體的修改內(nèi)容如下:
  1. voidenable_board_pin_mux(structam335x_baseboard_id*header)
  2. {
  3. /*Doboard-specificmuxes.*/
  4. if(board_is_bone(header)||board_is_tq335x(header)){
  5. /*Beaglebonepinmux*/
  6. configure_module_pin_mux(i2c1_pin_mux);
  7. configure_module_pin_mux(mii1_pin_mux);
  8. configure_module_pin_mux(mmc0_pin_mux);
  9. #ifdefined(CONFIG_NAND)
  10. configure_module_pin_mux(nand_pin_mux);
  11. #elifdefined(CONFIG_NOR)
  12. configure_module_pin_mux(bone_norcape_pin_mux);
  13. #else
  14. configure_module_pin_mux(mmc1_pin_mux);
  15. #endif
  16. }elseif(board_is_gp_evm(header)){
  17. /*GeneralPurposeEVM*/
  18. unsignedshortprofile=detect_daughter_board_profile();
  19. configure_module_pin_mux(rgmii1_pin_mux);
  20. configure_module_pin_mux(mmc0_pin_mux);
  21. /*Inprofile#2i2c1andspi0conflict.*/
  22. if(profile&~PROFILE_2)
  23. configure_module_pin_mux(i2c1_pin_mux);
  24. /*Profiles2&3donthaveNAND*/
  25. #ifdefCONFIG_NAND
  26. if(profile&~(PROFILE_2|PROFILE_3))
  27. configure_module_pin_mux(nand_pin_mux);
  28. #endif
  29. elseif(profile==PROFILE_2){
  30. configure_module_pin_mux(mmc1_pin_mux);
  31. configure_module_pin_mux(spi0_pin_mux);
  32. }
  33. }elseif(board_is_idk(header)){
  34. /*IndustrialMotorControl(IDK)*/
  35. configure_module_pin_mux(mii1_pin_mux);
  36. configure_module_pin_mux(mmc0_no_cd_pin_mux);
  37. }elseif(board_is_evm_sk(header)){
  38. /*StarterKitEVM*/
  39. configure_module_pin_mux(i2c1_pin_mux);
  40. configure_module_pin_mux(gpio0_7_pin_mux);
  41. configure_module_pin_mux(rgmii1_pin_mux);
  42. configure_module_pin_mux(mmc0_pin_mux_sk_evm);
  43. }elseif(board_is_bone_lt(header)){
  44. /*BeagleboneLTpinmux*/
  45. configure_module_pin_mux(i2c1_pin_mux);
  46. configure_module_pin_mux(mii1_pin_mux);
  47. configure_module_pin_mux(mmc0_pin_mux);
  48. #ifdefined(CONFIG_NAND)
  49. configure_module_pin_mux(nand_pin_mux);
  50. #elifdefined(CONFIG_NOR)
  51. configure_module_pin_mux(bone_norcape_pin_mux);
  52. #else
  53. configure_module_pin_mux(mmc1_pin_mux);
  54. #endif
  55. }else{
  56. puts("Unknownboard,cannotconfigurepinmux.");
  57. hang();
  58. }
  59. }

另外,這個版本的u-boot有個bug,需要修改fat_register_device(fs/fat/fat.c)函數(shù):

本文引用地址:http://butianyuan.cn/article/201611/322817.htm
  1. intfat_register_device(block_dev_desc_t*dev_desc,intpart_no)
  2. {
  3. disk_partition_tinfo;
  4. /*FirstcloseanycurrentlyfoundFATfilesystem*/
  5. cur_dev=NULL;
  6. /*Readthepartitiontable,ifpresent*/
  7. if(get_partition_info(dev_desc,part_no,&info)){
  8. /*if(part_no!=0){
  9. printf("**Partition%dnotvalidondevice%d**",
  10. part_no,dev_desc->dev);
  11. return-1;
  12. }*/
  13. info.start=0;
  14. info.size=dev_desc->lba;
  15. info.blksz=dev_desc->blksz;
  16. info.name[0]=0;
  17. info.type[0]=0;
  18. info.bootable=0;
  19. #ifdefCONFIG_PARTITION_UUIDS
  20. info.uuid[0]=0;
  21. #endif
  22. }
  23. returnfat_set_blk_dev(dev_desc,&info);
  24. }
至此,u-boot就已經(jīng)可以啟動了,但是有多余的步驟和log,不過可以去掉,修改file_fat_read_at(fs/fat/fat.c)函數(shù):
  1. longfile_fat_read_at(constchar*filename,unsignedlongpos,void*buffer,
  2. unsignedlongmaxsize)
  3. {
  4. debug("reading%s",filename);
  5. returndo_fat_read_at(filename,pos,buffer,maxsize,LS_NO,0);
  6. }
最后,TQ335x是MLO啟動u-boot,然后u-boot去啟動內(nèi)核,故可以去掉配置項CONFIG_SPL_OS_BOOT,具體的修改文件include/configs/ti_armv7_common.h:
  1. #ifdefined(CONFIG_SPL_OS_BOOT_ENABLE)
  2. #defineCONFIG_SPL_OS_BOOT
  3. #endif

至此,u-boot的移植工作就完成了,編譯方法如下:

  1. makeARCH=armCROSS_COMPILE=arm-linux-gnueabi-am335x_evm_defconfig
  2. makeARCH=armCROSS_COMPILE=arm-linux-gnueabi--j8

其中,arm-linux-gnueabi-需要根據(jù)自己的交叉編譯工具鏈前綴進行修改。完成u-boot的移植工作后我們來研究如何啟動內(nèi)核。

源碼下載地址:

u-boot-2014.10 for TQ335x/TQ3358(SD卡啟動)


上一頁 1 2 下一頁

關(guān)鍵詞: AM335xTQ335xu-boo

評論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉