forked from dsixda/Android-Kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchange_cmdline
More file actions
executable file
·113 lines (88 loc) · 2.2 KB
/
change_cmdline
File metadata and controls
executable file
·113 lines (88 loc) · 2.2 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
############################################################################
#
# Copyright (c) 2012 - dsixda ([email protected])
#
# 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.
#
############################################################################
clear
if [ ! -d WORKING_* ]
then
echo "No working folder found!"
exit 0
fi
cd WORKING_*
if [ ! -e boot.img ]
then
echo "No boot.img found!"
exit 0
fi
cd ..
current_cmd=`scripts/get_cmdline`
if [ "$current_cmd" == "" ]
then
current_cmd2="(None)"
else
current_cmd2=$current_cmd
fi
echo
echo "The current command line value in the boot.img is:"
echo
echo "$current_cmd2"
echo
echo
echo "NOTE: You normally should NOT change this value in your ROM."
echo "This feature is intended for *advanced* users who want to"
echo "experiment with different values."
echo
echo -n "Would you like to change it (y/n)? (default: y): "
read do_change
echo
if [ "$do_change" == "n" ]
then
echo "OK, command line will not be changed"
else
echo -n "Please enter the new command line (or press Enter to clear): "
read new_cmd
echo
if [ "$new_cmd" == "" ]
then
echo "Warning: Empty string entered for command line"
elif [ ${#new_cmd} -lt 3 ]
then
echo "Error: String must be more than 2 characters long"
echo
exit 0
fi
if [ "$new_cmd" == "$current_cmd" ]
then
echo "Your value is the same as the original command line value"
echo
exit 0
fi
base_addr=`scripts/get_kernel_base_addr`
page_size=`scripts/get_boot_img_page_size`
scripts/ensure_boot_extracted
scripts/build_boot_img $page_size $base_addr "$new_cmd"
current_cmd=`scripts/get_cmdline`
if [ "$current_cmd" == "" ]
then
current_cmd2="(None)"
else
current_cmd2=$current_cmd
fi
echo
echo "------------------------------------------------------------"
echo
echo "In boot.img, command line is now set to:"
echo
echo "$current_cmd2"
if [ "$current_cmd" != "$new_cmd" ]
then
echo
echo "Warning: Command line is not the same as specified"
fi
fi
echo