AM335x(TQ335x)學(xué)習(xí)筆記——u-boot-2014.10移植
- staticinlineintboard_is_tq335x(structam335x_baseboard_id*header)
- {
- return!strncmp(header->name,"TQ335x",HDR_NAME_LEN);
- }
- voidenable_board_pin_mux(structam335x_baseboard_id*header)
- {
- /*Doboard-specificmuxes.*/
- if(board_is_bone(header)||board_is_tq335x(header)){
- /*Beaglebonepinmux*/
- configure_module_pin_mux(i2c1_pin_mux);
- configure_module_pin_mux(mii1_pin_mux);
- configure_module_pin_mux(mmc0_pin_mux);
- #ifdefined(CONFIG_NAND)
- configure_module_pin_mux(nand_pin_mux);
- #elifdefined(CONFIG_NOR)
- configure_module_pin_mux(bone_norcape_pin_mux);
- #else
- configure_module_pin_mux(mmc1_pin_mux);
- #endif
- }elseif(board_is_gp_evm(header)){
- /*GeneralPurposeEVM*/
- unsignedshortprofile=detect_daughter_board_profile();
- configure_module_pin_mux(rgmii1_pin_mux);
- configure_module_pin_mux(mmc0_pin_mux);
- /*Inprofile#2i2c1andspi0conflict.*/
- if(profile&~PROFILE_2)
- configure_module_pin_mux(i2c1_pin_mux);
- /*Profiles2&3donthaveNAND*/
- #ifdefCONFIG_NAND
- if(profile&~(PROFILE_2|PROFILE_3))
- configure_module_pin_mux(nand_pin_mux);
- #endif
- elseif(profile==PROFILE_2){
- configure_module_pin_mux(mmc1_pin_mux);
- configure_module_pin_mux(spi0_pin_mux);
- }
- }elseif(board_is_idk(header)){
- /*IndustrialMotorControl(IDK)*/
- configure_module_pin_mux(mii1_pin_mux);
- configure_module_pin_mux(mmc0_no_cd_pin_mux);
- }elseif(board_is_evm_sk(header)){
- /*StarterKitEVM*/
- configure_module_pin_mux(i2c1_pin_mux);
- configure_module_pin_mux(gpio0_7_pin_mux);
- configure_module_pin_mux(rgmii1_pin_mux);
- configure_module_pin_mux(mmc0_pin_mux_sk_evm);
- }elseif(board_is_bone_lt(header)){
- /*BeagleboneLTpinmux*/
- configure_module_pin_mux(i2c1_pin_mux);
- configure_module_pin_mux(mii1_pin_mux);
- configure_module_pin_mux(mmc0_pin_mux);
- #ifdefined(CONFIG_NAND)
- configure_module_pin_mux(nand_pin_mux);
- #elifdefined(CONFIG_NOR)
- configure_module_pin_mux(bone_norcape_pin_mux);
- #else
- configure_module_pin_mux(mmc1_pin_mux);
- #endif
- }else{
- puts("Unknownboard,cannotconfigurepinmux.");
- hang();
- }
- }
另外,這個(gè)版本的u-boot有個(gè)bug,需要修改fat_register_device(fs/fat/fat.c)函數(shù):
本文引用地址:http://m.butianyuan.cn/article/201611/322817.htm- intfat_register_device(block_dev_desc_t*dev_desc,intpart_no)
- {
- disk_partition_tinfo;
- /*FirstcloseanycurrentlyfoundFATfilesystem*/
- cur_dev=NULL;
- /*Readthepartitiontable,ifpresent*/
- if(get_partition_info(dev_desc,part_no,&info)){
- /*if(part_no!=0){
- printf("**Partition%dnotvalidondevice%d**",
- part_no,dev_desc->dev);
- return-1;
- }*/
- info.start=0;
- info.size=dev_desc->lba;
- info.blksz=dev_desc->blksz;
- info.name[0]=0;
- info.type[0]=0;
- info.bootable=0;
- #ifdefCONFIG_PARTITION_UUIDS
- info.uuid[0]=0;
- #endif
- }
- returnfat_set_blk_dev(dev_desc,&info);
- }
- longfile_fat_read_at(constchar*filename,unsignedlongpos,void*buffer,
- unsignedlongmaxsize)
- {
- debug("reading%s",filename);
- returndo_fat_read_at(filename,pos,buffer,maxsize,LS_NO,0);
- }
- #ifdefined(CONFIG_SPL_OS_BOOT_ENABLE)
- #defineCONFIG_SPL_OS_BOOT
- #endif
至此,u-boot的移植工作就完成了,編譯方法如下:
- makeARCH=armCROSS_COMPILE=arm-linux-gnueabi-am335x_evm_defconfig
- makeARCH=armCROSS_COMPILE=arm-linux-gnueabi--j8
其中,arm-linux-gnueabi-需要根據(jù)自己的交叉編譯工具鏈前綴進(jìn)行修改。完成u-boot的移植工作后我們來(lái)研究如何啟動(dòng)內(nèi)核。
源碼下載地址:
u-boot-2014.10 for TQ335x/TQ3358(SD卡啟動(dòng))
評(píng)論