Repository navigation
Expand file tree
/
Copy pathcreate_edify_def
More file actions
executable file
·144 lines (117 loc) · 3.95 KB
/
Copy pathcreate_edify_def
File metadata and controls
executable file
·144 lines (117 loc) · 3.95 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
############################################################################
#
# Copyright (c) 2012 - dsixda (dislam@rocketmail.com)
#
# Android Kitchen is 100% free. This script file is intended for personal
# and/or educational use only. It may not be duplicated for monetary
# benefit or any other purpose without the permission of the developer.
#
############################################################################
device=`scripts/get_variant_or_device_name`
if [ ! -e "tools/edify_defs/$device" ] && [ "$device" != "UNKNOWN" ]
then
cd WORKING_*
out=(`grep ^mount META-INF/com/google/android/updater-script | grep block`)
if [ "$out" == "" ]
then
out=(`grep "^run_program(\"/sbin/mount\"" META-INF/com/google/android/updater-script | grep block`)
fi
if [ "$out" != "" ]
then
echo
echo "======================================================================"
echo
echo "WARNING! Device '$device' is not defined under tools/edify_defs"
echo
echo "The kitchen will now try to create a very basic definition file based"
echo "on the mount points specified in your updater-script; however, it may"
echo "not be 100% accurate ..."
file_path=../tools/edify_defs/$device
echo "change_mnt=yes" >> $file_path
echo >> $file_path
mnt_name_list=( system cache data sdcard )
var_name_list=( sys_mnt cache_mnt data_mnt sdcard_mnt )
got_block_id=0
found_param1=0
for item in ${out[@]}
do
# Look for ext3/ext4 etc.
if [ "`echo $item | grep -c \"mount(\\\"ext\"`" != 0 ] && [ $found_param1 == 0 ]
then
param1=`echo $item | sed -e 's/mount(\"\(.*\)\",/\1/g'`
echo >> $file_path
echo "param1=$param1" >> $file_path
echo "param2=EMMC" >> $file_path
echo >> $file_path
found_param1=1
echo "param1_sdcard=vfat" >> $file_path
echo "param2_sdcard=MTD" >> $file_path
echo >> $file_path
# Look for /dev/block/mmcblock etc.
elif [ "`echo $item | grep -c block`" != 0 ]
then
got_block_id=1
slash=\\\\
block_id=`echo $item | sed -e 's/\"//g' -e 's/,//g' -e 's/\(\/\)/'$slash'\1/g'`
elif [ $got_block_id == 1 ]
then
# Look for mount name
if [ "`echo $item | grep -c /`" == "1" ]
then
for (( i = 0 ; i < ${#mnt_name_list[@]} ; i++ ))
do
mnt=${mnt_name_list[$i]}
if [ "`echo $item | grep $mnt`" != "" ]
then
var=${var_name_list[$i]}
echo "$var=$block_id" >> $file_path
got_block_id=0
fi
done
fi
fi
done
# Default ext type
if [ $found_param1 == 0 ]
then
echo >> $file_path
echo "param1=ext4" >> $file_path
echo "param2=EMMC" >> $file_path
echo >> $file_path
echo "param1_sdcard=vfat" >> $file_path
echo "param2_sdcard=MTD" >> $file_path
echo >> $file_path
fi
# Look for boot image mount - for the boot_mnt and fix_boot2 parameters
boot_out=(`grep write_raw_image META-INF/com/google/android/updater-script \
| grep boot.img | grep block`)
if [ "$boot_out" != "" ]
then
slash=\\\\
boot_mnt=`echo ${boot_out[1]} | sed -e 's/\"\(.*\)\"),/\1/g' -e 's/\(\/\)/'$slash'\1/g'`
if [ "`echo $boot_mnt | grep block`" != "" ]
then
echo "boot_mnt=$boot_mnt" >> $file_path
echo "fix_boot2=yes" >> $file_path
fi
fi
for (( i = 0 ; i < ${#var_name_list[@]} ; i++ ))
do
var=${var_name_list[$i]}
if [ "`grep $var $file_path`" == "" ]
then
echo "$var=???" >> $file_path
fi
done
echo
echo "tools/edify_defs/$device:"
echo "-------------------------------------------------"
echo
cat $file_path
echo
echo "-------------------------------------------------"
echo
echo
fi
cd ..
fi