如何從0移植uboot支持exynos4412?
本文主要目的是如何從0編譯和移植uboot,增加串口、網(wǎng)絡(luò)、emmc等功能,讓他支持exynos4412開發(fā)板。
一、移植步驟
1. Uboot配置
1.指定交叉編譯工具鏈 進入uboot代碼根目錄
- $ cd u-boot-2013.01
修改 Makefile 在
- ifeq ($(HOSTARCH),$(ARCH))
- CROSS_COMPILE ?=
- endif
下添加
- ifeq (arm,$(ARCH))
- CROSS_COMPILE ?= arm-none-linux-gnueabi-
- endif
交叉編譯工具
2.指定產(chǎn)品CPU 我們產(chǎn)品用的CPU是 exynos 4412;
查看u-boot源碼:
- arch/arm/cpu/armv7/exynos/
可見U-boot已支持該CPU。
3.指定產(chǎn)品BOARD 三星公司已經(jīng)為exynos 4412發(fā)布了初始化的程序:
origen
4.cpu硬件信息 對應(yīng)的該CPU硬件信息頭文件位于以下位置:
- include/configs/origen.h
該文件定義了uboot啟動必須關(guān)于exynos 4412必須的一些資源信息。
5.boards.cfg 在uboot-2013-01中,頂層目錄下的boards.cfs文件中查看它支持的開發(fā)板和相應(yīng)的信息,后續(xù)的編譯過程需要根據(jù)配置名檢索到相應(yīng)的信息。文件格式如下:
和以前的老版本比,配置更加規(guī)范化了,其實這些就是相關(guān)文件分類的一個文件夾的描述。依照這個層次關(guān)系,我們可以很方便地對我們開發(fā)板進行配置。
6.編譯u-boot
不同版本的uboot的配置命令可能是不同的,源碼包的文件README通常會有相應(yīng)的配置命令【其他版本的uboot會不一樣】:
配置和編譯命令如下:
- $ make distclean
- $ make origen_config
改配置命令會生成以下文件:
- include/config.h
config.h
編譯:
- $ make all
編譯完成后生成的u-boot.bin就是可執(zhí)行的鏡像文件。
但是并不會生成真正適配我們板子的uboot,只是適配參考板,該文件還不能在我們板子上運行,我們需要對u-boot源代碼進行相應(yīng)的修改。
2. 確認第一條指令有運行到 (點燈法)
在arch/arm/cpu/armv7/start.S 134 行后添加點燈程序
- #if 1
- ldr r0, =0x11000c40 @GPX2_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
因為uboot剛啟動的時候,串口沒有來得及初始化,我們可以通過點亮LED的方法來判斷程序是否執(zhí)行到此處。
代碼詳解參考《十、LED匯編、C語言驅(qū)動編寫》
3. 添加三星加密方式
exynos 需要三星提供的初始引導(dǎo)加密后,我們的u-boot,才能被引導(dǎo)運行,這其中要用到下面的幾個命令或三星提供的工具軟件,這些操作的目的就是根據(jù)三星的芯片的啟動要求對uboot.bin 進行一些處理,包括在特定長度的位置加上和校驗信息以及插入一些文件段。
- $cp sdfuse_q u-boot-2013.01 -rf
- $ chmod 777 u-boot-2013.01/sdfuse_q -R
- $cp CodeSign4SecureBoot u-boot-2013.01 -rf
注:CodeSign4SecureBoot 三星提供的安全啟動方式 ,對應(yīng)的程序由三星提供。sdfuse_q目錄下的文件是針對三星堆uboot.bin文件格式要求進行加密編寫的文件。
修改根目錄Makefile,實現(xiàn)sdfuse_q的編譯 在
- $(obj)u-boot.bin: $(obj)u-boot
- $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
- $(BOARD_SIZE_CHECK)
下添加
- @#./mkuboot
- @split -b 14336 u-boot.bin bl2
- @make -C sdfuse_q/
- @#cp u-boot.bin u-boot-4212.bin
- @#cp u-boot.bin u-boot-4412.bin
- @#./sdfuse_q/add_sign
- @./sdfuse_q/chksum
- @./sdfuse_q/add_padding
- @rm bl2a*
- @echo
注意是tab鍵縮進的,否則makefile編譯報錯 注意如果執(zhí)行了make distclean 需重新拷貝CodeSign4SecureBoot
為方便起見,在根目錄下創(chuàng)建編譯腳本build.sh,該腳本將自動完成添加加密方式。
- 1 #!/bin/sh
- 2
- 3 sec_path="CodeSign4SecureBoot/"
- 4 CPU_JOB_NUM=$(grep processor /proc/cpuinfo | awk '{field=$NF};END{print field+1}')
- 5 ROOT_DIR=$(pwd)
- 6 CUR_DIR=${ROOT_DIR##*/}
- 7
- 8 case "$1" in
- 9 clean)
- 10 echo make clean
- 11 make mrproper
- 12 ;;
- 13 *)
- 14
- 15 if [ ! -d $sec_path ]
- 16 then
- 17 echo "**********************************************"
- 18 echo "[ERR]please get the CodeSign4SecureBoot first"
- 19 echo "**********************************************"
- 20 return
- 21 fi
- 22
- 23 make origen_config
- 24
- 25 make -j$CPU_JOB_NUM
- 26
- 27 if [ ! -f checksum_bl2_14k.bin ]
- 28 then
- 29 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- 30 echo "There are some error(s) while building uboot, please use command make to check."
- 31 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
- 32 exit 0
- 33 fi
- 34
- 35 cp -rf checksum_bl2_14k.bin $sec_path
- 36 cp -rf u-boot.bin $sec_path
- 37 rm checksum_bl2_14k.bin
- 38
- 39 cd $sec_path
- 40 cat E4412_N.bl1.SCP2G.bin bl2.bin all00_padding.bin u-boot.bin tzsw_SMDK4412_SCP_2GB.bin > u-boot-origen.bin
- 41 mv u-boot-origen.bin $ROOT_DIR
- 42
- 43 rm checksum_bl2_14k.bin
- 44 rm u-boot.bin
- 45
- 46 echo
- 47 echo
- 48 ;;
- 49
- 50 esac
編譯腳本
- $ chmod 777 u-boot-2013.01/ build.sh
- $ ./buildsh
注:build.sh 腳本方式完成自動添加加密方式, 編譯生成所需文件u-boot_origen.bin
- root@ubuntu:/home/peng/uboot/u-boot-2013.01# ls
- api config.mk examples Makefile sdfuse_q u-boot.bin
- arch COPYING fs mkconfig snapshot.commit u-boot.map
- board CREDITS helper.mk nand_spl spl u-boot-origen.bin
- boards.cfg disk include net System.map u-boot.srec
- build.sh doc lib post test
- CodeSign4SecureBoot drivers MAINTAINERS README tools
- common dts MAKEALL rules.mk u-boot
u-boot_origen.bin
4. 實現(xiàn)串口輸出
修改lowlevel_init.S文件
- $vim board/samsung/origen/lowlevel_init.S
a) 添加臨時棧,在
- 41 lowlevel_init:
后添加
- ldr sp,=0x02060000 @use iRom stack in bl2
b) 添加關(guān)閉看門狗代碼: 在
- 67 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
c) 添加串口初始化代碼: 在uart_asm_init: 的
- 351 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]
d) 注釋掉trustzone初始化 注釋掉
- 104 bl uart_asm_init
下的代碼:
- #if 0
- bl tzpc_init
- #endif
5. 網(wǎng)卡移植
因為各個廠家使用的網(wǎng)卡不盡相同,所以三星公司提供的驅(qū)動程序只預(yù)留了網(wǎng)卡初始化的函數(shù)入口,針對不同的板子,我們需要針對電路自己移植網(wǎng)卡的驅(qū)動。網(wǎng)卡的驅(qū)動詳解,我們會在后一章節(jié)詳細講解。
1、 添加網(wǎng)絡(luò)初始化代碼
- $ vim board/samsung/origen/origen.c
在
- 31 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
2、 修改配置文件添加網(wǎng)絡(luò)相關(guān)配置 $ vim include/configs/origen.h 修改
- 85 #undef CONFIG_CMD_PING
為
- #define CONFIG_CMD_PING
修改
- 90 #undef CONFIG_CMD_NET
為
- #define CONFIG_CMD_NET
在文件末尾
- #endif /* __CONFIG_H */
前面添加
- #ifdef CONFIG_CMD_NET
- #define CONFIG_NET_MULTI
- #define CONFIG_DRIVER_DM9000 1
- #define CONFIG_DM9000_BASE 0x05000000 //內(nèi)存基地址
- #define DM9000_IO CONFIG_DM9000_BASE
- #define DM9000_DATA (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.6.187
- #define CONFIG_SERVERIP 192.168.6.186
- #define CONFIG_GATEWAYIP 192.168.1.1
- #define CONFIG_NETMASK 255.255.255.0
- #endif
其中CONFIG_DM9000_BASE 地址為何是0x05000000,后續(xù)章節(jié)會詳細分析。
6. FLASH移植 (EMMC)
1.移植EMMC需要添加一些源文件:
- cmd_mmc.c
- cmd_mmc_fdisk.c
- cmd_movi.c
- mmc.c
- mmc.h
- movi.c
- movi.h
- s5p_mshc.c
- s5p_mshc.h
這些文件,由三星提供。
2.添加相關(guān)驅(qū)動
- cp movi.c arch/arm/cpu/armv7/exynos/
修改文件arch/arm/cpu/armv7/exynos/Makefile在pinmux.o 后添加movi.o
修改板級文件 board/samsung/origen/origen.c,在
- #include <asm/arch/mmc.h>
后面添加
- #include <asm/arch/clk.h>
- #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)函數(shù)內(nèi)容改寫為
- 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 <movi.h>
- 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
3.添加相關(guān)命令
- $ cp cmd_movi.c common/
- $ cp cmd_mmc.c common/
- $ cp cmd_mmc_fdisk.c common/
修改common/Makefile 在
- COBJS-$(CONFIG_CMD_MMC) += cmd_mmc.o
后添加
- COBJS-$(CONFIG_CMD_MMC) += cmd_mmc_fdisk.o
- COBJS-$(CONFIG_CMD_MOVINAND) += cmd_movi.o
添加驅(qū)動
- $ cp mmc.c drivers/mmc/
- $ cp s5p_mshc.c drivers/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
4.添加EMMC相關(guān)配置
- $vim include/configs/origen.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
7. 重新編譯u-boot
修改頂層Makefile,注釋掉spl的編譯:
- 623 #$(obj)spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend
- 624 # $(MAKE) -C spl all
重新編譯uboot:
- $ ./build.sh
在根目錄下會生成bin文件u-boot-origen.bin。
二、SD卡制作
1. 燒寫腳本
三星公司已經(jīng)給我們提供了制作SD卡啟動的燒寫的腳本:mkuboot.sh
- #!/bin/bash
- #
- # This script will create a u-boot binary for movinand/mmc boot
- #
- echo "Fuse FS4412 trustzone uboot file into SD card"
- if [ -z $1 ] #判斷參數(shù)1的字符串是否為空,如果為空,則打印出幫助信息
- then
- ./sd_fusing_exynos4x12.sh /dev/sdb u-boot-origen.bin
- else
- ./sd_fusing_exynos4x12.sh $1 u-boot-origen.bin
- fi
sd_fusing_exynos4x12.sh
- 1 #!/bin/sh
- 2 #
- 3 # Copyright (C) 2010 Samsung Electronics Co., Ltd.
- 4 # http://www.samsung.com/
- 5 #
- 6 # This program is free software; you can redistribute it and/or modify
- 7 # it under the terms of the GNU General Public License version 2 as
- 8 # published by the Free Software Foundation.
- 9 #
- 10 ####################################
- 11 reader_type1="/dev/sd"
- 12 reader_type2="/dev/mmcblk0"
- 13
- 14 if [ -z $2 ] #判斷參數(shù)2的字符串是否為空,如果為空,則打印出幫助信息
- 15 then
- 16 echo "usage: ./sd_fusing.sh <SD Reader's device file> <filename>"
- 17 exit 0
- 18 fi
- 19
- 20 param1=`echo "$1" | awk '{print substr($1,1,7)}'`
- 21
- 22 if [ "$param1" = "$reader_type1" ]
- 23 then
- 24 partition1=$1"1"
- 25 partition2=$1"2"
- 26 partition3=$1"3"
- 27 partition4=$1"4"
- 28
- 29 elif [ "$1" = "$reader_type2" ]
- 30 then
- 31 partition1=$1"p1"
- 32 partition2=$1"p2"
- 33 partition3=$1"p3"
- 34 partition4=$1"p4"
- 35
- 36 else
- 37 echo "Unsupported SD reader"
- 38 exit 0
- 39 fi
- 40
- 41 if [ -b $1 ] #判斷參數(shù)1所指向的設(shè)備節(jié)點是否存在
- 42 then
- 43 echo "$1 reader is identified."
- 44 else
- 45 echo "$1 is NOT identified."
- 46 exit 0
- 47 fi
- 48
- 49 ####################################
- 50 # format
- 51 umount $partition1 2> /dev/null
- 52 umount $partition2 2> /dev/null
- 53 umount $partition3 2> /dev/null
- 54 umount $partition4 2> /dev/null
- 55
- 56 echo "$2 fusing..."
- # 燒寫u-boot-origen.bin到SD卡(512+8K)字節(jié)處, 512+8K=17x512,即第17個block
- 57 dd iflag=dsync oflag=dsync if=$2 of=$1 seek=1 && \
- 58 echo "$2 image has been fused successfully."
- 59
- 60 #echo "zImage fusing..."
- 61 #dd iflag=dsync oflag=dsync if=../../TC4_Kernel_3.0/arch/arm/boot/zImage of=$1 seek=1024 && \
- 62 # echo "zImage has been fused successfully."
- 63
- 64 #echo "ramdisk-uboot.img fusing..."
- 65 #dd iflag=dsync oflag=dsync if=../../TC4_GB_2.3.4/out/target/product/smdk4212/ramdisk-uboot.img of=$1 seek=9216 && \
- 66 # echo "ramdisk-uboot.img has been fused successfully."
- 67
- 68 ####################################
- 69 #<Message Display>
- 70 echo "Eject SD card"
- 71
2. 制作步驟
a) 創(chuàng)建文件mkuboot.sh、sd_fusing_exynos4x12.sh b) 將SD卡插入電腦并被ubuntu識別 c) 拷貝編譯好u-boot-origen.bin拷貝到當前目錄下
- root@ubuntu:/home/peng/uboot/sdfuse_q# ls
- mkuboot.sh sd_fusing_exynos4x12.sh u-boot-origen.bin
d) 進入sdfuse_q執(zhí)行如下操作
- root@ubuntu:/home/peng/uboot/sdfuse_q#./mkuboot.sh /dev/sdb
d) 在SD卡中創(chuàng)建目錄sdupdate,并把編譯好的uboot鏡像文件u-boot-origen.bin拷貝到這個目錄。
3. 通過sd卡啟動燒寫uboot
a) 連接串口和板子,運行串口通信程序putty
選擇右上角的”Serial”,然后點擊左下角的”Serial”
按照自己的主機的情況選擇COM口其他必須一直,然后點擊open打開串口
b) 關(guān)閉開發(fā)板電源,將撥碼開關(guān)SW1調(diào)至(1000)(SD啟動模式)后打開電源 c) 將剛才做好的SD啟動盤插入SD卡插槽 d) 重新打開開發(fā)板能夠看到如下界面
在這里插入圖片描述
在讀秒倒計時時按任意鍵。由上圖所示,已經(jīng)支持EMMC和dm9000網(wǎng)卡。
e) 燒寫 在終端上執(zhí)行
- sdfuse flashall
注意:上面的命令把SD卡 sdupdate目錄下的u-boot-origen.bin燒寫到emmc起始位置 等待終端無輸出是表示燒寫結(jié)束
f) 關(guān)閉開發(fā)板電源,將撥碼開關(guān)SW1調(diào)至0110(EMMC啟動模式)后打開電源即可以從emmc啟動
4. 網(wǎng)絡(luò)燒寫uboot
如果板子已經(jīng)可以啟動uboot,我們也可以通過網(wǎng)絡(luò)燒寫uboot。
步驟如下:
把編譯好的u-boot-origen.bin拷貝到/tftpboot下
啟動開發(fā)板,在u-boot下先下載u-boot-origen.bin到41000000;再運行
- movi write u-boot 41000000
若編譯后的u-boot-origen.bin 無法運行,可參考上一節(jié),重新從SD卡引導(dǎo)燒寫。