PKGBUILDs/alarm/uboot-clearfog/sd_fusing.sh

81 lines
1.6 KiB
Bash
Raw Normal View History

2015-12-08 10:45:37 +00:00
#!/usr/bin/bash
####################################
#
# 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.
#
####################################
#
# Modified for Arch Linux ARM package uboot-clearfog
#
####################################
2016-06-06 00:53:18 +00:00
_device=$1
2016-06-06 00:42:15 +00:00
sd_fuse() {
####################################
# fusing images
echo "u-boot fusing version $1"
2016-06-06 00:53:18 +00:00
dd if=./u-boot-clearfog.$1.mmc of=$_device bs=512 seek=1
2016-06-06 00:42:15 +00:00
echo "u-boot environemnt fusing"
2016-06-06 00:53:18 +00:00
dd if=/dev/zero of=$_device bs=512 seek=1920 count=128
dd if=./clearfog.env of=$_device bs=512 seek=1920
2016-06-06 00:42:15 +00:00
####################################
#<Message Display>
echo "U-boot image is fused successfully."
}
choose_uboot() {
while :
do
cat<<EOF
Please choose uboot to flash:
<1st slot, 2nd slot>
1) PCIe, PCIe (default)
2) PCIe, mSata
3) mSata, PCIe
4) mSata, mSata
EOF
read -n1 -s
case "$REPLY" in
"1") sd_fuse pp
break
;;
"2") sd_fuse ps
break
;;
"3") sd_fuse sp
break
;;
"4") sd_fuse ss
break
;;
* ) echo "invalid option" ;;
esac
done
}
2016-06-06 00:53:18 +00:00
if [ -z $_device ]
2015-12-08 10:45:37 +00:00
then
echo "usage: ./sd_fusing.sh <SD Reader's device file>"
exit 0
fi
2016-06-06 00:53:18 +00:00
if [ -b $_device ]
2015-12-08 10:45:37 +00:00
then
2016-06-06 00:53:18 +00:00
echo "$_device reader is identified."
2015-12-08 10:45:37 +00:00
else
2016-06-06 00:53:18 +00:00
echo "$_device is NOT identified."
2015-12-08 10:45:37 +00:00
exit 0
fi
2016-06-06 00:42:15 +00:00
choose_uboot