如何從0編譯和移植uboot、增加串口?
添加
COBJS-$(CONFIG_S5P_M(jìn)SHC) += s5p_mshc.o
添加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_M(jìn)MC2
#endif
#ifdef CONFIG_EMMC44_CH4
#define CONFIG_S5P_M(jìn)SHC
#define CONFIG_EMMC 1
#define USE_M(jìn)MC4
#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_M(jìn)OVINAND
#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_M(jìn)MCSD 0x3
#define BOOT_EMMC43 0x6
#define BOOT_EMMC441 0x7
#define CONFIG_BOARD_LATE_INIT
7. 重新編譯u-boot
修改頂層Makefile,注釋掉spl的編譯:
623 !纾╫bj)spl/u-boot-spl.bin: $(SUBDIR_TOOLS) depend
624 # $(MAKE) -C spl all
重新編譯uboot:
$ ./build.sh
在根目錄下會(huì)生成bin文件u-boot-origen.bin。
二、SD卡制作
1. 燒寫腳本
三星公司已經(jīng)給我們提供了制作SD卡啟動(dòng)的燒寫的腳本:mkuboot.sh
#。痓in/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 #。痓in/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é)點(diǎn)是否存在
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個(gè)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.shb) 將SD卡插入電腦并被ubuntu識(shí)別c) 拷貝編譯好u-boot-origen.bin拷貝到當(dāng)前目錄下
root@ubuntu:/home/peng/uboot/sdfuse_q# ls
mkuboot.sh sd_fusing_exynos4x12.sh u-boot-origen.bin
d) 進(jìn)入sdfuse_q執(zhí)行如下操作
root@ubuntu:/home/peng/uboot/sdfuse_q#./mkuboot.sh /dev/sdb
d) 在SD卡中創(chuàng)建目錄sdupdate,并把編譯好的uboot鏡像文件u-boot-origen.bin拷貝到這個(gè)目錄。
3. 通過(guò)sd卡啟動(dòng)燒寫uboot
a) 連接串口和板子,運(yùn)行串口通信程序putty
選擇右上角的”Serial”,然后點(diǎn)擊左下角的”Serial”
按照自己的主機(jī)的情況選擇COM口其他必須一直,然后點(diǎn)擊open打開(kāi)串口
b) 關(guān)閉開(kāi)發(fā)板電源,將撥碼開(kāi)關(guān)SW1調(diào)至(1000)(SD啟動(dòng)模式)后打開(kāi)電源c) 將剛才做好的SD啟動(dòng)盤插入SD卡插槽d) 重新打開(kāi)開(kāi)發(fā)板能夠看到如下界面
在這里插入圖片描述
在讀秒倒計(jì)時(shí)時(shí)按任意鍵。由上圖所示,已經(jīng)支持EMMC和dm9000網(wǎng)卡。
e) 燒寫在終端上執(zhí)行
sdfuse flashall
注意:上面的命令把SD卡 sdupdate目錄下的u-boot-origen.bin燒寫到emmc起始位置等待終端無(wú)輸出是表示燒寫結(jié)束
f) 關(guān)閉開(kāi)發(fā)板電源,將撥碼開(kāi)關(guān)SW1調(diào)至0110(EMMC啟動(dòng)模式)后打開(kāi)電源即可以從emmc啟動(dòng)
4. 網(wǎng)絡(luò)燒寫uboot
如果板子已經(jīng)可以啟動(dòng)uboot,我們也可以通過(guò)網(wǎng)絡(luò)燒寫uboot。
步驟如下:
把編譯好的u-boot-origen.bin拷貝到/tftpboot下啟動(dòng)開(kāi)發(fā)板,在u-boot下先下載u-boot-origen.bin到41000000;再運(yùn)行movi write u-boot 41000000
若編譯后的u-boot-origen.bin 無(wú)法運(yùn)行,可參考上一節(jié),重新從SD卡引導(dǎo)燒寫。
文中資料后臺(tái)回復(fù):uboot
·················· END ··················

發(fā)表評(píng)論
請(qǐng)輸入評(píng)論內(nèi)容...
請(qǐng)輸入評(píng)論/評(píng)論長(zhǎng)度6~500個(gè)字
圖片新聞
-
機(jī)器人奧運(yùn)會(huì)戰(zhàn)報(bào):宇樹(shù)機(jī)器人摘下首金,天工Ultra搶走首位“百米飛人”
-
存儲(chǔ)圈掐架!江波龍起訴佰維,索賠121萬(wàn)
-
長(zhǎng)安汽車母公司突然更名:從“中國(guó)長(zhǎng)安”到“辰致科技”
-
豆包前負(fù)責(zé)人喬木出軌BP后續(xù):均被辭退
-
字節(jié)AI Lab負(fù)責(zé)人李航卸任后返聘,Seed進(jìn)入調(diào)整期
-
員工持股爆雷?廣汽埃安緊急回應(yīng)
-
中國(guó)“智造”背后的「關(guān)鍵力量」
-
小米汽車研發(fā)中心重磅落地,寶馬家門口“搶人”
最新活動(dòng)更多
-
10月23日火熱報(bào)名中>> 2025是德科技創(chuàng)新技術(shù)峰會(huì)
-
10月23日立即報(bào)名>> Works With 開(kāi)發(fā)者大會(huì)深圳站
-
10月24日立即參評(píng)>> 【評(píng)選】維科杯·OFweek 2025(第十屆)物聯(lián)網(wǎng)行業(yè)年度評(píng)選
-
11月27日立即報(bào)名>> 【工程師系列】汽車電子技術(shù)在線大會(huì)
-
12月18日立即報(bào)名>> 【線下會(huì)議】OFweek 2025(第十屆)物聯(lián)網(wǎng)產(chǎn)業(yè)大會(huì)
-
精彩回顧立即查看>> 【限時(shí)福利】TE 2025國(guó)際物聯(lián)網(wǎng)展·深圳站
推薦專題