-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhc_fusing.sh
More file actions
executable file
·72 lines (56 loc) · 1.57 KB
/
hc_fusing.sh
File metadata and controls
executable file
·72 lines (56 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/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.
#
if [ -z $1 ]; then
echo "usage: ./hc_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
ZIMAGE=arch/arm/boot/zImage
if [ ! -f ${ZIMAGE} ]; then
echo "Error: zImage NOT found, please build it & try again."
exit -1
fi
####################################
# fusing images
let BL1_POSITION=${BDEV_SIZE}-16-2-1024
let BL2_POSITION=${BDEV_SIZE}-16-2-1024-32-512
let KERNEL_POSITION=${BL2_POSITION}-12288
#echo ${KERNEL_POSITION}
umount /dev/${DEV_NAME}* > /dev/null 2>&1
#<zImage fusing>
echo "---------------------------------------"
echo "Kernel fusing"
dd if=${ZIMAGE} of=$1 bs=512 seek=${KERNEL_POSITION}
#<flush to disk>
sync
####################################
#<Message Display>
echo "---------------------------------------"
echo "Kernel zImage is fused (at `date +%T`) successfully."
echo "Eject SD card and insert it again."