Tiny4412 uboot

在/board/samsung/tiny4412中
u-boot.lds 文件调用 arch/arm/cpu/armv7/start.S
start.S调用cpu_init_crit,
cpu_init_crit调用/lowlevel_init.S
同时mem_init_tiny4412.S、clock_init_tiny4412.S也被编译。
iROM 把启动设备上特定位置处的程序读入片内内存(iRAM),并执行它。这个程序被称为 BL1(Bootloader 
1),BL1 是三星公司提供的,无源码。 
BL1 又把启动设备上另一个特定位置处的程序读入片内内存,并执行它。这个程序被称为 BL2(Bootloader 
2),是我们编写的源码。 
简单地说,就是先设置程序运行环境(比如关看门狗、关中断、关 MMU、设置栈、启动 PLL 等等);然后
根据 OM 引脚确定启动设备(NAND Flash/SD 卡/其他),把 BL1从里面读出存入 iRAM;最后启动 BL1。
简单地说,也是设置程序运行环境(初始化中断、设置栈等等);然后从启动设备上把 BL2 读入iRAM;最
后启动它。

韦东山的学习文档中将bl1.bin烧进去,将自己写的bin文件改名为bl2.bin.这样在系统启动的时候,会自动烧录bl2.bin。




BL1 位于 SD 卡偏移地址 512 字节处,iROM 从这个位置读入 8K 字节的数据,存在 iRAM 地址 0x02021400
位置处。所以 BL1 不能大于 8K。 
BL2位于SD卡偏移地址(512+8K)字节处, BL1从这个位置读入14K字节的数据,存在iRAM地址0x02023400
处。BL2 不能大于(14K – 4)字节,最后 4 字节用于存放较验码。 
如果我们的程序大于(14K – 4)字节,那么需要截取前面(14K – 4)字节用来制作 BL2 并烧入SD卡偏移
地址 16K 字节处。当 BL2 启动后,由它来将存放在 SD 卡另外位置的、完整的程序读入内存。

#
# Copyright (C) 2011 Samsung Electronics Co., Ltd.
#              http://www.samsung.com/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
####################################

if [ -z $1 ]
then
    echo "usage: ./sd_fusing.sh <SD Reader's device file>"
    exit 0
fi

if [ -b $1 ]
then
    echo "$1 reader is identified."
else
    echo "$1 is NOT identified."
    exit 0
fi

####################################
#<verify device>

BDEV_NAME=`basename $1`
BDEV_SIZE=`cat /sys/block/${BDEV_NAME}/size`

if [ ${BDEV_SIZE} -le 0 ]; then
	echo "Error: NO media found in card reader."
	exit 1
fi

if [ ${BDEV_SIZE} -gt 32000000 ]; then
	echo "Error: Block device size (${BDEV_SIZE}) is too large"
	exit 1
fi

####################################
# check files

E4412_UBOOT=../../u-boot.bin
MKBL2=../mkbl2

if [ ! -f ${E4412_UBOOT} ]; then
	echo "Error: u-boot.bin NOT found, please build it & try again."
	exit -1
fi

if [ ! -f ${MKBL2} ]; then
	echo "Error: can not find host tool - mkbl2, stop."
	exit -1
fi

#<make bl2>
${MKBL2} ${E4412_UBOOT} bl2.bin 14336

####################################
# fusing images

signed_bl1_position=1
bl2_position=17
uboot_position=49
tzsw_position=705
zImage_position=1057
ramdisk_position=13345

#bl2_200M_position=1000
#uboot_200M_position=1032
signed_bl1_330M_position=1025
bl2_330M_position=1041
uboot_330M_position=1073
tzsw_330M_position=1729
#bl2_400M_position=3000
#uboot_400M_position=3032

#<BL1 fusing>
echo "---------------------------------------"
echo "BL1 fusing"
dd iflag=dsync oflag=dsync if=./E4412_N.bl1.bin of=$1 seek=$signed_bl1_position
#dd iflag=dsync oflag=dsync if=./E4412_N.bl1.bin of=$1 seek=$signed_bl1_330M_position

#<BL2 fusing>
echo "---------------------------------------"
echo "BL2 fusing"
dd iflag=dsync oflag=dsync if=./bl2.bin of=$1 seek=$bl2_position
#dd iflag=dsync oflag=dsync if=./bl2_330M.bin of=$1 seek=$bl2_330M_position

#<u-boot fusing>
echo "---------------------------------------"
echo "u-boot fusing"
dd iflag=dsync oflag=dsync if=${E4412_UBOOT} of=$1 seek=$uboot_position
#dd iflag=dsync oflag=dsync if=./uboot_330M.bin of=$1 seek=$uboot_330M_position
#<TrustZone S/W fusing>
echo "---------------------------------------"
echo "TrustZone S/W fusing"
dd iflag=dsync oflag=dsync if=./E4412_tzsw.bin of=$1 seek=$tzsw_position

#dd iflag=dsync oflag=dsync if=./E4412_tzsw.bin of=$1 seek=$tzsw_330M_position

#<kernel fusing>
echo "---------------------------------------"
echo "kernel fusing"
dd iflag=dsync oflag=dsync if=./zImage of=$1 seek=$zImage_position


#<ramdisk fusing>
echo "---------------------------------------"
echo "ramdisk fusing"
dd iflag=dsync oflag=dsync if=./ramdisk-u.img of=$1 seek=$ramdisk_position

#<u-boot_0 fusing>
#<flush to disk>
sync

####################################
#<Message Display>
echo "---------------------------------------"
echo "U-boot image is fused successfully."
echo "Eject SD card and insert it again."


查看sd_fusing.sh脚本会发现:8K的bl1先被写入,接着写入14k的uboot部分程序成为bl2,接着跳转 到剩余的uboot程序执行。

在按照2440移植uboot的手册发现,现在的让自己的产品编译可以 在./boards.cfg 中添加自己的产品,这样就可以执行 make  xxx_config如图:



  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值