如何從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 #$(obj)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è)字
最新活動(dòng)更多
-
7月8日立即報(bào)名>> 【在線會(huì)議】英飛凌新一代智能照明方案賦能綠色建筑與工業(yè)互聯(lián)
-
7月22-29日立即報(bào)名>> 【線下論壇】第三屆安富利汽車生態(tài)圈峰會(huì)
-
7.30-8.1火熱報(bào)名中>> 全數(shù)會(huì)2025(第六屆)機(jī)器人及智能工廠展
-
7月31日免費(fèi)預(yù)約>> OFweek 2025具身智能機(jī)器人產(chǎn)業(yè)技術(shù)創(chuàng)新應(yīng)用論壇
-
免費(fèi)參會(huì)立即報(bào)名>> 7月30日- 8月1日 2025全數(shù)會(huì)工業(yè)芯片與傳感儀表展
-
即日-2025.8.1立即下載>> 《2024智能制造產(chǎn)業(yè)高端化、智能化、綠色化發(fā)展藍(lán)皮書(shū)》
推薦專題
- 1 AI 眼鏡讓百萬(wàn) APP「集體失業(yè)」?
- 2 豆包前負(fù)責(zé)人喬木出軌BP后續(xù):均被辭退
- 3 一文看懂視覺(jué)語(yǔ)言動(dòng)作模型(VLA)及其應(yīng)用
- 4 “支付+”時(shí)代,支付即生態(tài) | 2025中國(guó)跨境支付十大趨勢(shì)
- 5 中國(guó)最具實(shí)力AI公司TOP10
- 6 特斯拉Robotaxi上路,馬斯克端上畫(huà)了十年的餅
- 7 國(guó)家數(shù)據(jù)局局長(zhǎng)劉烈宏調(diào)研格創(chuàng)東智
- 8 AI的夏天:第四范式VS云從科技VS地平線機(jī)器人
- 9 張勇等人退出阿里合伙人
- 10 AI視頻,攪動(dòng)1.5萬(wàn)億市場(chǎng)