首页 u-boot-2013.01移植

u-boot-2013.01移植

举报
开通vip

u-boot-2013.01移植 一、 下载源码并解压 #tar xvf u-boot-2013.01.tar.bz2 #cd u-boot-2013.01 1、 指定交叉编译工具链(在 u-boot-2013.01 目录下) #vi Makefile 在 下添加 二、 指定产品 BOARD(找一个相似的 board 配置修改,这里参照 board/samsung/origen/ ) (1) #cp -rf board/samsung/origen/ board/samsung/fs4412 (2) #mv board/s...

u-boot-2013.01移植
一、 下载源码并解压 #tar xvf u-boot-2013.01.tar.bz2 #cd u-boot-2013.01 1、 指定交叉编译工具链(在 u-boot-2013.01 目录下) #vi Makefile 在 下添加 二、 指定产品 BOARD(找一个相似的 board 配置修改,这里参照 board/samsung/origen/ ) (1) #cp -rf board/samsung/origen/ board/samsung/fs4412 (2) #mv board/samsung/fs4412 / origen.c board/samsung/fs4412 /fs4412.c (3) #vi board/samsung/fs4412 / Makefile 修改 origen.o 为 fs4412.0 (4) #cp include/configs/origen.h include/configs/fs4412.h (5) #vi include/configs/fs4412.h 修改 为 修改 为 (6)#vi boards.cfg 参考 添加 (7) #make distclean #make fs4412_config #make ARCH=arm (8)编译生成 u-boot.bin 文件就是可执行的镜像文件。 (9)由于 samsung 提供的 exynos 需要加密才能安全启动。 (sdfuse_q 与 Codesign4SecureBoot 是 samsung 的加密文件 ) #cp sdfuse_q u-boot-2013.01 –rf #cp Codesign4SecureBoot u-boot-2013.01 –rf 在 u-boot-2013.01 目录下的 Makefile 文件的 下面添加 注:必须 table 键缩进,否则编译将出错 #cp build.sh u-boot-2013.01 –rf #chmod 777 u-boot-2013.01 / build.sh #./build.sh #make fs4412_config #make ARCH=arm(编译生成 u-boot-fs4412.bin, 将 u-boot-fs4412.bin 拷贝到 tftpboot 目录下,烧 写到开发板上: #tftp 41000000 u-boot-fs4412.bin #movi write u-boot 41000000< 启动方式是 SDCARD>) 在 下面添加 1、点灯法 在 arch/arm/cpu/armv7/start.S 134 行后添加点灯程序 #if 1 ldr r0, =0x11000c40 @GPK2_7 led2 ldr r1, [r0] bic r1, r1, #0xf0000000 orr r1, r1, #0x10000000 str r1, [r0] ldr r0, =0x11000c44 mov r1,#0xff str r1, [r0] #endif 1、 添加关闭看门狗代码 在 beq wakeup_reset 后添加 #if 1 /*for close watchdog */ /* PS-Hold high */ ldr r0, =0x1002330c ldr r1, [r0] orr r1, r1, #0x300 str r1, [r0] ldr r0, =0x11000c08 ldr r1, =0x0 str r1, [r0] /* Clear MASK_WDT_RESET_REQUEST */ ldr r0, =0x1002040c ldr r1, =0x00 str r1, [r0] #endif 2、 实现串口输出 修改 lowlevel_init.S 文件 $vimboard/samsung/fs4412/lowlevel_init.S 添加临时栈 在 lowlevel_init: 后添加 ldr sp,=0x02060000 @use iRom stack in bl2 添加串口初始化代码 在 uart_asm_init: 的 str r1, [r0, #EXYNOS4_GPIO_A1_CON_OFFSET] 后添加 ldr r0, =0x10030000 ldr r1, =0x666666 ldr r2, =CLK_SRC_PERIL0_OFFSET str r1, [r0, r2] ldr r1, =0x777777 ldr r2, =CLK_DIV_PERIL0_OFFSET str r1, [r0, r2] 注释掉 trustzone 初始化 注释掉 bl uart_asm_init 下的 bl tzpc_init 重新编译 u-boot $ ./build.sh 3、 网卡移植 添加网络初始化代码 $vim board/samsung/fs4412/fs4412.c 在 struct exynos4_gpio_part2 *gpio2; 后添加 #ifdef CONFIG_DRIVER_DM9000 #define EXYNOS4412_SROMC_BASE 0X12570000 #define DM9000_Tacs (0x1) #define DM9000_Tcos (0x1) #define DM9000_Tacc (0x5) #define DM9000_Tcoh (0x1) #define DM9000_Tah (0xC) #define DM9000_Tacp (0x9) #define DM9000_PMC (0x1) struct exynos_sromc { unsigned int bw; unsigned int bc[6]; }; /* * s5p_config_sromc() - select the proper SROMC Bank and configure the * band width control and bank control registers * srom_bank - SROM * srom_bw_conf - SMC Band witdh reg configuration value * srom_bc_conf - SMC Bank Control reg configuration value */ void exynos_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf) { unsigned int tmp; struct exynos_sromc *srom = (struct exynos_sromc *)(EXYNOS4412_SROMC_BASE); /* Configure SMC_BW register to handle proper SROMC bank */ tmp = srom->bw; tmp&= ~(0xF << (srom_bank * 4)); tmp |= srom_bw_conf; srom->bw = tmp; /* Configure SMC_BC register */ srom->bc[srom_bank] = srom_bc_conf; } static void dm9000aep_pre_init(void) { unsigned int tmp; unsigned char smc_bank_num = 1; unsigned int smc_bw_conf=0; unsigned int smc_bc_conf=0; /* gpio configuration */ writel(0x00220020, 0x11000000 + 0x120); writel(0x00002222, 0x11000000 + 0x140); /* 16 Bit bus width */ 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 &= ~(0xf<<4); smc_bw_conf |= (1<<7) | (1<<6) | (1<<5) | (1<<4); smc_bc_conf = ((DM9000_Tacs << 28) | (DM9000_Tcos << 24) | (DM9000_Tacc << 16) | (DM9000_Tcoh << 12) | (DM9000_Tah << 8) | (DM9000_Tacp << 4) | (DM9000_PMC)); exynos_config_sromc(smc_bank_num,smc_bw_conf,smc_bc_conf); } #endif 在 gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL); 后添加 #ifdef CONFIG_DRIVER_DM9000 dm9000aep_pre_init(); #endif 在文件末尾添加 #ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bis) { int rc = 0; #ifdef CONFIG_DRIVER_DM9000 rc = dm9000_initialize(bis); #endif return rc; } #endif 修改配置文件添加网络相关配置 $ vim include/configs/fs4412.h 修改 #undef CONFIG_CMD_PING 为 #def ine CONFIG_CMD_PING 修改 #undef CONFIG_CMD_NET 为 #def ine CONFIG_CMD_NET 在文件末尾 #endif /* __CONFIG_H */ 前面添加 #ifdef CONFIG_CMD_NET #define CONFIG_NET_MULTI #define CONFIG_DRIVER_DM9000 1 #define CONFIG_DM9000_BASE 0x05000000 #define DM9000_IO CONFIG_DM9000_BASE #define DM9000_DA TA (CONFIG_DM9000_BASE + 4) #define CONFIG_DM9000_USE_16BIT #define CONFIG_DM9000_NO_SROM 1 #define CONFIG_ETHADDR 11:22:33:44:55:66 #define CONFIG_IPADDR 192.168.9.200 #define CONFIG_SERVERIP 192.168.9.120 #define CONFIG_GATEW AYIP 192.168.9.1 #define CONFIG_NETMASK 255.255.255.0 #endif 重新编译 u-boot $ ./build.sh 4、 FLASH 移植( EMMC ) 初始化 EMMC $cpmovi.carch/arm/cpu/armv7/exynos/ $vim arch/arm/cpu/armv7/exynos/Makefile 在 pinmux.o 后添加 movi.o 修改板级文件 $vim board/samsung/fs4412/fs4412.c 在 #include 后面添加 #include #include "origen_setup.h" 在 #ifdef CONFIG_GENERIC_MMC 后面添加 u32 sclk_mmc4; /*clock source for emmc controller*/ #define __REGMY(x) (*((volatile u32 *)(x))) #define CLK_SRC_FSYS __REGMY(EXYNOS4_CLOCK_BASE + CLK_SRC_FSYS_OFFSET) #define CLK_DIV_FSYS3 __REGMY(EXYNOS4_CLOCK_BASE + CLK_DIV_FSYS3_OFFSET) int emmc_init() { u32 tmp; u32 clock; u32 i; /* setup_hsmmc_clock */ /* MMC4 clock src = SCLKMPLL */ tmp = CLK_SRC_FSYS & ~(0x000f0000); CLK_SRC_FSYS = tmp | 0x00060000; /* MMC4 clock div */ 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<<0); break; } } emmcdbg("[mjdbg] sclk_mmc4:%d MHZ; mmc_ratio: %d\n",sclk_mmc4,i); sclk_mmc4 *= 1000000; /* * MMC4 EMMC GPIO CONFIG * * GPK0[0] SD_4_CLK * GPK0[1] SD_4_CMD * GPK0[2] SD_4_CDn * GPK0[3:6] SD_4_DATA[0:3] */ writel(readl(0x11000048)&~(0xf),0x11000048); //SD_4_CLK/SD_4_CMD pull-down enable writel(readl(0x11000040)&~(0xff),0x11000040);//cdn set to be output writel(readl(0x11000048)&~(3<<4),0x11000048); //cdn pull-down disable writel(readl(0x11000044)&~(1<<2),0x11000044); //cdn output 0 to shutdown the emmc power writel(readl(0x11000040)&~(0xf<<8)|(1<<8),0x11000040);//cdn set to be output udelay(100*1000); writel(readl(0x11000044)|(1<<2),0x11000044); //cdn output 1 writel(0x03333133, 0x11000040); writel(0x00003FF0, 0x11000048); writel(0x00002AAA, 0x1100004C); #ifdef CONFIG_EMMC_8Bit writel(0x04444000, 0x11000060); writel(0x00003FC0, 0x11000068); writel(0x00002AAA, 0x1100006C); #endif #ifdef USE_MMC4 smdk_s5p_mshc_init(); #endif } 将 int board_mmc_init(bd_t *bis) 函数内容改写为 int board_mmc_init(bd_t *bis) { int i, err; #ifdef CONFIG_EMMC err = emmc_init(); #endif return err; } 在末尾添加 #ifdef CONFIG_BOARD_LATE_INIT #include int chk_bootdev(void)//mj for boot device check { char run_cmd[100]; struct mmc *mmc; int boot_dev = 0; int cmp_off = 0x10; ulong start_blk, blkcnt; mmc = find_mmc_device(0); if (mmc == NULL) { printf("There is no eMMC card, Booting device is SD card\n"); boot_dev = 1; return boot_dev; } start_blk = (24*1024/MOVI_BLKSIZE); blkcnt = 0x10; sprintf(run_cmd,"emmc open 0"); run_command(run_cmd, 0); sprintf(run_cmd,"mmc read 0 %lx %lx %lx",CFG_PHY_KERNEL_BASE,start_blk,blkcnt); run_command(run_cmd, 0); /* switch mmc to normal paritition */ sprintf(run_cmd,"emmc close 0"); run_command(run_cmd, 0); return 0; } int board_late_init (void) { int boot_dev =0 ; char boot_cmd[100]; boot_dev = chk_bootdev(); if(!boot_dev) { printf("\n\nChecking Boot Mode ... EMMC4.41\n"); } return 0; } #endif 添加相关命令 $ cp cmd_movi.c common/ $ cp cmd_mmc.c common/ $ cp cmd_mmc_fdisk.c common/ 修改 Makefile $ vim common/Makefile 在 COBJS-$(CONFIG_CMD_MMC) += cmd_mmc.o 后添加 COBJS-$(CONFIG_CMD_MMC) += cmd_mmc_fdisk.o COBJS-$(CONFIG_CMD_MOVINAND) += cmd_movi.o 添加驱动 $ cpmmc.cdrivers/mmc/ $ cp s5p_mshc.cdrivers/mmc/ $ cp mmc.h include/ $ cp movi.h include/ $ cp s5p_mshc.h include/ 修改 Makefile $vim drivers/mmc/Makefile 添加 COBJS-$(CONFIG_S5P_MSHC) += s5p_mshc.o 添加 EMMC 相关配置 $vim include/configs/fs4412.h 添加 #define CONFIG_EVT1 1 /* EVT1 */ #ifdef CONFIG_EVT1 #define CONFIG_EMMC44_CH4 //eMMC44_CH4 (OMPIN[5:1] = 4) #ifdef CONFIG_SDMMC_CH2 #define CONFIG_S3C_HSMMC #undef DEBUG_S3C_HSMMC #define USE_MMC2 #endif #ifdef CONFIG_EMMC44_CH4 #define CONFIG_S5P_MSHC #define CONFIG_EMMC 1 #define USE_MMC4 /* #define CONFIG_EMMC_8Bit */ #define CONFIG_EMMC_EMERGENCY /*#define emmcdbg(fmt,args...) printf(fmt ,##args) *///for emmc debug #define emmcdbg(fmt,args...) #endif #endif /*end CONFIG_EVT1*/ #define CONFIG_CMD_MOVINAND #define CONFIG_CLK_1000_400_200 #define CFG_PHY_UBOOT_BASE CONFIG_SYS_SDRAM_BASE + 0x3e00000 #define CFG_PHY_KERNEL_BASE CONFIG_SYS_SDRAM_BASE + 0x8000 #define BOOT_MMCSD 0x3 #define BOOT_EMMC43 0x6 #define BOOT_EMMC441 0x7 #define CONFIG_BOARD_LATE_INIT 重新编译 u-boot $ ./build.sh
本文档为【u-boot-2013.01移植】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_829858
暂无简介~
格式:pdf
大小:447KB
软件:PDF阅读器
页数:0
分类:军事
上传时间:2017-05-12
浏览量:44