九鼎开发板Uboot开发问题——sd_fusing运行异常

在学习朱有鹏老师的嵌入式Linux——Uboot移植,运行sd_fusing.sh脚本出现mkfs.fat命令参数问题,一直提示"No device specified."

九鼎开发板Uboot开发问题——sd_fusing运行异常_第1张图片

脚本内容:

#
# 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 "
    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_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

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

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

通过查看sd_fusing.sh脚本源代码,发现是$partition1变量值一直为空。尝试直接用变量值来替换变量引用。

九鼎开发板Uboot开发问题——sd_fusing运行异常_第2张图片

専次运行脚本,成功了没有那个错误了。

九鼎开发板Uboot开发问题——sd_fusing运行异常_第3张图片

想着为了更加优雅的解决,人家写的脚本逻辑没有问题,只是在变量的引用上出现了问题,所以想着应该是解析的问题,所以使用bash解析器来运行sd_fusing.sh脚本。如下图,成功了,没有任何问题。

九鼎开发板Uboot开发问题——sd_fusing运行异常_第4张图片

你可能感兴趣的:(Linux,linux)