一、下载源码并解压#tarxvfu-boot-2013.01.tar.bz2#cdu-boot-2013.011、指定交叉编译工具链(在u-boot-2013.01目录下)#viMakefile在下添加二、指定产品BOARD(找一个相似的board配置修改,这里参照board/samsung/origen/)(1)#cp-rfboard/samsung/origen/board/samsung/fs4412(2)#mvboard/samsung/fs4412/origen.cboard/samsung/fs4412/fs4412.c(3)#viboard/samsung/fs4412/Makefile修改origen.o为fs4412.0(4)#cpinclude/configs/origen.hinclude/configs/fs4412.h(5)#viinclude/configs/fs4412.h修改为修改为(6)#viboards.cfg参考添加(7)#makedistclean#makefs4412_config#makeARCH=arm(8)编译生成u-boot.bin文件就是可执行的镜像文件。(9)由于samsung提供的exynos需要加密才能安全启动。(sdfuse_q与Codesign4SecureBoot是samsung的加密文件)#cpsdfuse_qu-boot-2013.01–rf#cpCodesign4SecureBootu-boot-2013.01–rf在u-boot-2013.01目录下的Makefile文件的下面添加注:必须table键缩进,否则编译将出错#cpbuild.shu-boot-2013.01–rf#chmod777u-boot-2013.01/build.sh#./build.sh#makefs4412_config#makeARCH=arm(编译生成u-boot-fs4412.bin,将u-boot-fs4412.bin拷贝到tftpboot目录下,烧写到开发板上:#tftp41000000u-boot-fs4412.bin#moviwriteu-boot41000000启动方式是SDCARD)在下面添加1、点灯法在arch/arm/cpu/armv7/start.S134行后添加点灯程序#if1ldrr0,=0x11000c40@GPK2_7led2ldrr1,[r0]bicr1,r1,#0xf0000000orrr1,r1,#0x10000000strr1,[r0]ldrr0,=0x11000c44movr1,#0xffstrr1,[r0]#endif1、添加关闭看门狗代码在beqwakeup_reset后添加#if1/*forclosewatchdog*//*PS-Holdhigh*/ldrr0,=0x1002330cldrr1,[r0]orrr1,r1,#0x300strr1,[r0]ldrr0,=0x11000c08ldrr1,=0x0strr1,[r0]/*ClearMASK_WDT_RESET_REQUEST*/ldrr0,=0x1002040cldrr1,=0x00strr1,[r0]#endif2、实现串口输出修改lowlevel_init.S文件$vimboard/samsung/fs4412/lowlevel_init.S添加临时栈在lowlevel_init:后添加ldrsp,=0x02060000@useiRomstackinbl2添加串口初始化代码在uart_asm_init:的strr1,[r0,#EXYNOS4_GPIO_A1_CON_OFFSET]后添加ldrr0,=0x10030000ldrr1,=0x666666ldrr2,=CLK_SRC_PERIL0_OFFSETstrr1,[r0,r2]ldrr1,=0x777777ldrr2,=CLK_DIV_PERIL0_OFFSETstrr1,[r0,r2]注释掉trustzone初始化注释掉bluart_asm_init下的bltzpc_init重新编译u-boot$./build.sh3、网卡移植添加网络初始化代码$vimboard/samsung/fs4412/fs4412.c在structexynos4_gpio_part2*gpio2;后添加#ifdefCONFIG_DRIVER_DM9000#defineEXYNOS4412_SROMC_BASE0X12570000#defineDM9000_Tacs(0x1)#defineDM9000_Tcos(0x1)#defineDM9000_Tacc(0x5)#defineDM9000_Tcoh(0x1)#defineDM9000_Tah(0xC)#defineDM9000_Tacp(0x9)#defineDM9000_PMC(0x1)structexynos_sromc{unsignedintbw;unsignedintbc[6];};/**s5p_config_sromc()-selecttheproperSROMCBankandconfigurethe*bandwidthcontrolandbankcontrolregisters*srom_bank-SROM*srom_bw_conf-SMCBandwitdhregconfigurationvalue*srom_bc_conf-SMCBankControlregconfigurationvalue*/voidexynos_config_sromc(u32srom_bank,u32srom_bw_conf,u32srom_bc_conf){unsignedinttmp;structexynos_sromc*srom=(structexynos_sromc*)(EXYNOS4412_SROMC_BASE);/*ConfigureSMC_BWregistertohandleproperSROMCbank*/tmp=srom-bw;tmp&=~(0xF(srom_bank*4));tmp|=srom_bw_conf;srom-bw=tmp;/*ConfigureSMC_BCregister*/srom-bc[srom_bank]=srom_bc_conf;}staticvoiddm9000aep_pre_init(void){unsignedinttmp;unsignedcharsmc_bank_num=1;unsignedintsmc_bw_conf=0;unsignedintsmc_bc_conf=0;/*gpioconfiguration*/writel(0x00220020,0x11000000+0x120);writel(0x00002222,0x11000000+0x140);/*16Bitbuswidth*/writel(0x22222222,0x11000000+0x180);writel(0x0000FFFF,0x11000000+0x188);writel(0x22222222,0x11000000+0x1C0);writel(0x0000FFFF,0x11000000+0x1C8);writel(0x22222222,0x11000000+0x1E0);writel(0x0000FFFF,0x11000000+0x1E8);smc_bw_conf&=~(0xf4);smc_bw_conf|=(17)|(16)|(15)|(14);smc_bc_conf=((DM9000_Tacs28)|(DM9000_Tcos24)|(DM9000_Tacc16)|(DM9000_Tcoh12)|(DM9000_Tah8)|(DM9000_Tacp4)|(DM9000_PMC));exynos_config_sromc(smc_bank_num,smc_bw_conf,smc_bc_conf);}#endif在gd-bd-bi_boot_params=(PHYS_SDRAM_1+0x100UL);后添加#ifdefCONFIG_DRIVER_DM9000dm9000aep_pre_init();#endif在文件末尾添加#ifdefCONFIG_CMD_NETintboard_eth_init(bd_t*bis){intrc=0;#ifdefCONFIG_DRIVER_DM9000rc=dm9000_initialize(bis);#endifreturnrc;}#endif修改配置文件添加网络相关配置$viminclude/configs/fs4412.h修改#undefCONFIG_CMD_PING为#defineCONFIG_CMD_PING修改#undefCONFIG_CMD_NET为#defineCONFIG_CMD_NET在文件末尾#endif/*__CONFIG_H*/前面添加#ifdefCONFIG_CMD_NET#defineCONFIG_NET_MULTI#defineCONFIG_DRIVER_DM90001#defineCONFIG_DM9000_BASE0x05000000#defineDM9000_IOCONFIG_DM9000_BASE#defineDM9000_DATA(CONFIG_DM9000_BASE+4)#defineCONFIG_DM9000_USE_16BIT#defineCONFIG_DM9000_NO_SROM1#defineCONFIG_ETHADDR11:22:33:44:55:66#defineCONFIG_IPADDR192.168.9.200#defineCONFIG_SERVERIP192.168.9.120#defineCONFIG_GATEWAYIP192.168.9.1#defineCONFIG_NETMASK255.255.255.0#endif重新编译u-boot$./build.sh4、FLASH移植(EMMC)初始化EMMC$cpmovi.carch/arm/cpu/armv7/exynos/$vimarch/arm/cpu/armv7/exynos/Makefile在pinmux.o后添加movi.o修改板级文件$vimboard/samsung/fs4412/fs4412.c在#includeasm/arch/mmc.h后面添加#includeasm/arch/clk.h#includeorigen_setup.h在#ifdefCONFIG_GENERIC_MMC后面添加u32sclk_mmc4;/*clocksourceforemmccontroller*/#define__REGMY(x)(*((volatileu32*)(x)))#defineCLK_SRC_FSYS__REGMY(EXYNOS4_CLOCK_BASE+CLK_SRC_FSYS_OFFSET)#defineCLK_DIV_FSYS3__REGMY(EXYNOS4_CLOCK_BASE+CLK_DIV_FSYS3_OFFSET)intemmc_init(){u32tmp;u32clock;u32i;/*setup_hsmmc_clock*//*MMC4clocksrc=SCLKMPLL*/tmp=CLK_SRC_FSYS&~(0x000f0000);CLK_SRC_FSYS=tmp|0x00060000;/*MMC4clockdiv*/tmp=CLK_DIV_FSYS3&~(0x0000ff0f);clock=get_pll_clk(MPLL)/1000000;for(i=0;i=0xf;i++){sclk_mmc4=(clock/(i+1));if(sclk_mmc4=160)//200{CLK_DIV_FSYS3=tmp|(i