sd_fusing.sh注释

#

# Copyright (C) 2010 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.

#

####################################

#这两个是写死的,应该对应着自己实际的设备进行修改

reader_type1="/dev/sdb"

reader_type2="/dev/mmcblk0"

#如果没有参数显示帮助信息

if [ -z $1 ]

then

    echo "usage: ./sd_fusing.sh <SD Reader's device file>"

    exit 0

fi

#判断类型,然后定义四个分区

if [ $1 = $reader_type1 ]

then 

    partition1="$11"

    partition2="$12"

    partition3="$13"

    partition4="$14"

elif [ $1 = $reader_type2 ]

then 

    partition1="$1p1"

    partition2="$1p2"

    partition3="$1p3"

    partition4="$1p4"

else

    echo "Unsupported SD reader"

    exit 0

fi

#存在并且判断是否是块设备

if [ -b $1 ]

then

    echo "$1 reader is identified."

else

    echo "$1 is NOT identified."

    exit 0

fi

####################################

# make partition

echo "make sd card partition"

echo "./sd_fdisk $1" 

./sd_fdisk $1 

dd iflag=dsync oflag=dsync if=sd_mbr.dat of=$1 

rm sd_mbr.dat

 

####################################

# format

umount $partition1 2> /dev/null

umount $partition2 2> /dev/null

umount $partition3 2> /dev/null

umount $partition4 2> /dev/null

echo "mkfs.vfat -F 32 $partition1"

mkfs.vfat -F 32 $partition1

#echo "mkfs.ext2 $partition2"

#mkfs.ext2 $partition2  

#echo "mkfs.ext2 $partition3"

#mkfs.ext2 $partition3  

#echo "mkfs.ext2 $partition4"

#mkfs.ext2 $partition4  

####################################

# mount 

#umount /media/sd 2> /dev/null

#mkdir -p /media/sd

#echo "mount -t vfat $partition1 /media/sd"

#mount -t vfat $partition1 /media/sd

####################################

#<BL1 fusing>

bl1_position=1

uboot_position=49

echo "BL1 fusing"

./mkbl1 ../u-boot.bin SD-bl1-8k.bin 8192

dd iflag=dsync oflag=dsync if=SD-bl1-8k.bin of=$1 seek=$bl1_position

rm SD-bl1-8k.bin

####################################

#<u-boot fusing>

echo "u-boot fusing"

dd iflag=dsync oflag=dsync if=../u-boot.bin of=$1 seek=$uboot_position

####################################

#<Message Display>

echo "U-boot image is fused successfully."

echo "Eject SD card and insert it again."

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值