Commit 85103e50a72799269bdf4dbbe74863052f497741
1 parent
60ea7fa3df
Exists in
smarc-o8.1.0_1.3.0_8m
re-write mksdcard script
Showing 2 changed files with 163 additions and 281 deletions Side-by-side Diff
scripts/sh/smarc-mksdcard.sh
1 | 1 | #!/bin/bash |
2 | -# Meant to be called by install_android.sh | |
3 | -set -e | |
4 | 2 | |
5 | -blue_underlined_bold_echo() | |
6 | -{ | |
7 | - echo -e "\e[34m\e[4m\e[1m$@\e[0m" | |
8 | -} | |
3 | +# android-tools-fsutils should be installed as | |
4 | +# "sudo apt-get install android-tools-fsutils" | |
9 | 5 | |
10 | -blue_bold_echo() | |
11 | -{ | |
12 | - echo -e "\e[34m\e[1m$@\e[0m" | |
13 | -} | |
6 | +help() { | |
14 | 7 | |
15 | -red_bold_echo() | |
16 | -{ | |
17 | - echo -e "\e[31m\e[1m$@\e[0m" | |
18 | -} | |
8 | +bn=`basename $0` | |
9 | +cat << EOF | |
10 | +usage $bn <option> device_node | |
19 | 11 | |
20 | -# Partition sizes in MiB | |
21 | -BOOTLOAD_RESERVE=8 | |
22 | -BOOT_ROM_SIZE=32 | |
23 | -SYSTEM_ROM_SIZE=1536 | |
24 | -MISC_SIZE=4 | |
25 | -METADATA_SIZE=2 | |
26 | -PRESISTDATA_SIZE=1 | |
27 | -VENDOR_ROM_SIZE=112 | |
28 | -FBMISC_SIZE=1 | |
29 | -VBMETA_SIZE=1 | |
12 | +options: | |
13 | + -h displays this help message | |
14 | + -s only get partition size | |
15 | + -np not partition. | |
16 | + -f soc_name flash android image file with soc_name | |
17 | + -F soc_name determine the device_node's offset to flash bootloader and flash default android image file | |
18 | + soc offset(KB) | |
19 | + default 1 | |
20 | + imx8dv 16 | |
21 | + imx8qm/imx8qxp/imx8mq 33 | |
22 | + -a only flash image to slot_a | |
23 | + -b only flash image to slot_b | |
24 | + -c card_size optional setting: 7 / 14 / 28 | |
25 | + If not set, use partition-table.img | |
26 | + If set to 7, use partition-table-7GB.img for 7GB SD card | |
27 | +EOF | |
30 | 28 | |
31 | -help() { | |
32 | - | |
33 | - bn=`basename $0` | |
34 | - echo " usage $bn <option> device_node" | |
35 | - echo | |
36 | - echo " options:" | |
37 | - echo " -h displays this help message" | |
38 | - echo " -s only get partition size" | |
39 | - echo " -f soc_name flash android image." | |
40 | 29 | } |
41 | 30 | |
42 | -# Parse command line | |
31 | +# parse command line | |
43 | 32 | moreoptions=1 |
44 | 33 | node="na" |
45 | -soc_name="showoptions" | |
34 | +soc_name="" | |
46 | 35 | cal_only=0 |
47 | - | |
36 | +card_size=0 | |
37 | +bootloader_offset=1 | |
38 | +vaild_gpt_size=17 | |
39 | +not_partition=0 | |
40 | +not_format_fs=0 | |
41 | +slot="" | |
42 | +systemimage_file="system.img" | |
43 | +systemimage_raw_file="system_raw.img" | |
44 | +vendor_file="vendor.img" | |
45 | +vendor_raw_file="vendor_raw.img" | |
46 | +partition_file="partition-table.img" | |
47 | +g_sizes=0 | |
48 | +append_soc_name=0 | |
48 | 49 | while [ "$moreoptions" = 1 -a $# -gt 0 ]; do |
49 | 50 | case $1 in |
50 | - -h) help; exit ;; | |
51 | - -s) cal_only=1 ;; | |
52 | - -f) soc_name=$2; shift;; | |
53 | - *) moreoptions=0; node=$1 ;; | |
51 | + -h) help; exit ;; | |
52 | + -s) cal_only=1 ;; | |
53 | + -f) append_soc_name=1 ; soc_name=$2; shift;; | |
54 | + -F) soc_name=$2; shift;; | |
55 | + -c) card_size=$2; shift;; | |
56 | + -np) not_partition=1 ;; | |
57 | + -nf) not_format_fs=1 ;; | |
58 | + -a) slot="_a" ;; | |
59 | + -b) slot="_b" ;; | |
60 | + *) moreoptions=0; node=$1 ;; | |
54 | 61 | esac |
55 | - [ "$moreoptions" = 0 ] && [ $# -gt 2 ] && help && exit | |
62 | + [ "$moreoptions" = 0 ] && [ $# -gt 1 ] && help && exit | |
56 | 63 | [ "$moreoptions" = 1 ] && shift |
57 | 64 | done |
58 | 65 | |
59 | -imagesdir="out/target/product/smarc_mx8m" | |
60 | - | |
61 | -img_prefix="boot-" | |
62 | -img_search_str="ls ${imagesdir}/${img_prefix}* | grep sd" | |
63 | -img_list=() | |
64 | - | |
65 | -# generate options list | |
66 | -for img in $(eval $img_search_str) | |
67 | -do | |
68 | - img=$(basename $img .img) | |
69 | - img=${img#${img_prefix}} | |
70 | - img_list+=($img) | |
71 | -done | |
72 | - | |
73 | -# check for dtb | |
74 | -if [[ $soc_name != "showoptions" ]] && [[ ! ${img_list[@]} =~ $soc_name ]] ; then | |
75 | - echo; red_bold_echo "ERROR: invalid dtb $soc_name" | |
76 | - soc_name=showoptions | |
66 | +if [ ${card_size} -ne 0 ] && [ ${card_size} -ne 7 ] && [ ${card_size} -ne 14 ] && [ ${card_size} -ne 28 ]; then | |
67 | + help; exit; | |
77 | 68 | fi |
78 | 69 | |
79 | -if [[ $soc_name == "showoptions" ]] ; then | |
80 | - PS3='Please choose your configuration: ' | |
81 | - select opt in "${img_list[@]}" | |
82 | - do | |
83 | - if [[ -z "$opt" ]] ; then | |
84 | - echo invalid option | |
85 | - continue | |
86 | - else | |
87 | - soc_name=$opt | |
88 | - break | |
89 | - fi | |
90 | - done | |
70 | +if [ "${soc_name}" = "imx8dv" ]; then | |
71 | + bootloader_offset=16 | |
91 | 72 | fi |
92 | 73 | |
93 | -bootimage_file="boot-${soc_name}.img" | |
94 | -vbmeta_file="vbmeta-${soc_name}.img" | |
95 | -systemimage_file="system.img" | |
96 | -systemimage_raw_file="system_raw.img" | |
97 | -vendorimage_file="vendor.img" | |
98 | -vendorimage_raw_file="vendor_raw.img" | |
99 | 74 | |
100 | -block=`basename $node` | |
101 | -part="" | |
102 | -if [[ $block == mmcblk* ]] ; then | |
103 | - part="p" | |
75 | +if [ "${soc_name}" = "imx8qm" -o "${soc_name}" = "imx8qxp" -o "${soc_name}" = "imx8mq" -o "${soc_name}" = "fsl-smarcimx8mq" -o "${soc_name}" = "fsl-smarcimx8mq-hdmi" -o "${soc_name}" = "fsl-smarcimx8mq-hdmi-4k" -o "${soc_name}" = "fsl-smarcimx8mq-lcdif-lvds" -o "${soc_name}" = "fsl-smarcimx8mq-dcss-lvds" -o "${soc_name}" = "fsl-smarcimx8mq-dual-display" ]; then | |
76 | + bootloader_offset=33 | |
104 | 77 | fi |
105 | 78 | |
106 | -if [[ "${soc_name}" = *"mx8m"* ]]; then | |
107 | - bootloader_offset=33 | |
108 | - bootloader_file="boot-fsl-smarcimx8mq.imx" | |
109 | -fi | |
110 | - | |
111 | 79 | echo "${soc_name} bootloader offset is: ${bootloader_offset}" |
112 | -echo "${soc_name} bootloader is: ${bootloader_file}" | |
113 | 80 | |
114 | -# Get total device size | |
115 | -seprate=100 | |
116 | -total_size=`sfdisk -s ${node}` | |
117 | -total_size=`expr ${total_size} \/ 1024` | |
118 | -boot_rom_sizeb=`expr ${BOOTLOAD_RESERVE} + ${BOOT_ROM_SIZE} \* 2` | |
119 | -extend_size=`expr ${SYSTEM_ROM_SIZE} \* 2 + ${MISC_SIZE} + ${METADATA_SIZE} + ${PRESISTDATA_SIZE} + ${VENDOR_ROM_SIZE} \* 2 + ${FBMISC_SIZE} + ${VBMETA_SIZE} \* 2 + ${seprate}` | |
120 | -data_size=`expr ${total_size} - ${boot_rom_sizeb} - ${extend_size}` | |
81 | +if [ "${soc_name}" != "" ] && [ "${append_soc_name}" -eq 1 ]; then | |
82 | + soc_name="-${soc_name}" | |
83 | +else | |
84 | + soc_name="" | |
85 | +fi | |
121 | 86 | |
122 | -# Echo partitions | |
123 | -cat << EOF | |
124 | -TOTAL : ${total_size} MiB | |
125 | -U-BOOT (on eMMC) : ${BOOTLOAD_RESERVE} MiB | |
126 | -BOOT_A : ${BOOT_ROM_SIZE} MiB | |
127 | -BOOT_B : ${BOOT_ROM_SIZE} MiB | |
128 | -SYSTEM_A : ${SYSTEM_ROM_SIZE} MiB | |
129 | -SYSTEM_B : ${SYSTEM_ROM_SIZE} MiB | |
130 | -MISC : ${MISC_SIZE} MiB | |
131 | -METADATA : ${METADATA_SIZE} MiB | |
132 | -PRESISTDATA : ${PRESISTDATA_SIZE} MiB | |
133 | -VENDOR_A : ${VENDOR_ROM_SIZE} MiB | |
134 | -VENDOR_B : ${VENDOR_ROM_SIZE} MiB | |
135 | -USERDATA : ${data_size} MiB | |
136 | -FBMISC : ${FBMISC_SIZE} MiB | |
137 | -VBMETA_A : ${VBMETA_SIZE} MiB | |
138 | -VBMETA_B : ${VBMETA_SIZE} MiB | |
139 | -EOF | |
87 | +if [ ! -e ${node} ]; then | |
88 | + help | |
89 | + exit | |
90 | +fi | |
140 | 91 | |
141 | -echo | |
142 | 92 | |
143 | -if [[ $cal_only == 1 ]] ; then | |
144 | -exit 0 | |
93 | +# dump partitions | |
94 | +if [ "${cal_only}" -eq "1" ]; then | |
95 | +gdisk -l ${node} 2>/dev/null | grep -A 20 "Number " | |
96 | +exit | |
145 | 97 | fi |
146 | 98 | |
147 | -function check_images | |
99 | +function get_partition_size | |
148 | 100 | { |
149 | - if [[ ! -b $node ]] ; then | |
150 | - red_bold_echo "ERROR: \"$node\" is not a block device" | |
151 | - exit 1 | |
152 | - fi | |
153 | - | |
154 | - if [[ ! -f ${imagesdir}/${bootloader_file} ]] ; then | |
155 | - red_bold_echo "ERROR: U-Boot image does not exist" | |
156 | - exit 1 | |
157 | - fi | |
158 | - | |
159 | - if [[ ! -f ${imagesdir}/${bootimage_file} ]] ; then | |
160 | - red_bold_echo "ERROR: boot image does not exist" | |
161 | - exit 1 | |
162 | - fi | |
163 | - | |
164 | - if [[ ! -f ${imagesdir}/${systemimage_file} ]] ; then | |
165 | - red_bold_echo "ERROR: system image does not exist" | |
166 | - exit 1 | |
167 | - fi | |
168 | - | |
169 | - if [[ ! -f ${imagesdir}/${vendorimage_file} ]] ; then | |
170 | - red_bold_echo "ERROR: vendor image does not exist" | |
171 | - exit 1 | |
172 | - fi | |
173 | - | |
174 | - if [[ ! -f ${imagesdir}/${vbmeta_file} ]] ; then | |
175 | - red_bold_echo "ERROR: vbmeta image does not exist" | |
176 | - exit 1 | |
177 | - fi | |
101 | + start_sector=`gdisk -l ${node} | grep -w $1 | awk '{print $2}'` | |
102 | + end_sector=`gdisk -l ${node} | grep -w $1 | awk '{print $3}'` | |
103 | + # 1 sector = 512 bytes. This will change unit from sector to MBytes. | |
104 | + let "g_sizes=($end_sector - $start_sector + 1) / 2048" | |
178 | 105 | } |
179 | 106 | |
180 | -function delete_device | |
107 | +function format_partition | |
181 | 108 | { |
182 | - echo | |
183 | - blue_underlined_bold_echo "Deleting current partitions" | |
184 | - for partition in ${node}* | |
185 | - do | |
186 | - if [[ ${partition} = ${node} ]] ; then | |
187 | - # skip base node | |
188 | - continue | |
189 | - fi | |
190 | - if [[ ! -b ${partition} ]] ; then | |
191 | - red_bold_echo "ERROR: \"${partition}\" is not a block device" | |
192 | - exit 1 | |
193 | - fi | |
194 | - dd if=/dev/zero of=${partition} bs=1M count=1 2> /dev/null || true | |
195 | - done | |
196 | - sync | |
197 | - | |
198 | - ((echo d; echo 1; echo d; echo 2; echo d; echo 3; echo d; echo w) | fdisk $node &> /dev/null) || true | |
199 | - sync | |
200 | - | |
201 | - sgdisk -Z $node | |
202 | - sync | |
203 | - | |
204 | - dd if=/dev/zero of=$node bs=1M count=8 | |
205 | - sync; sleep 1 | |
109 | + num=`gdisk -l ${node} | grep -w $1 | awk '{print $1}'` | |
110 | + if [ ${num} -gt 0 ] 2>/dev/null; then | |
111 | + echo "format_partition: $1:${node}${num} ext4" | |
112 | + mkfs.ext4 -F ${node}${num} -L$1 | |
113 | + fi | |
206 | 114 | } |
207 | 115 | |
208 | -function create_parts | |
116 | +function erase_partition | |
209 | 117 | { |
210 | - echo | |
211 | - blue_underlined_bold_echo "Creating Android partitions" | |
212 | - | |
213 | - sgdisk -n 1:${BOOTLOAD_RESERVE}M:+${BOOT_ROM_SIZE}M -c 1:"boot_a" -t 1:8300 $node | |
214 | - sgdisk -n 2:0:+${BOOT_ROM_SIZE}M -c 2:"boot_b" -t 2:8300 $node | |
215 | - sgdisk -n 3:0:+${SYSTEM_ROM_SIZE}M -c 3:"system_a" -t 3:8300 $node | |
216 | - sgdisk -n 4:0:+${SYSTEM_ROM_SIZE}M -c 4:"system_b" -t 4:8300 $node | |
217 | - sgdisk -n 5:0:+${MISC_SIZE}M -c 5:"misc" -t 5:8300 $node | |
218 | - sgdisk -n 6:0:+${METADATA_SIZE}M -c 6:"metadata" -t 6:8300 $node | |
219 | - sgdisk -n 7:0:+${PRESISTDATA_SIZE}M -c 7:"presistdata" -t 7:8300 $node | |
220 | - sgdisk -n 8:0:+${VENDOR_ROM_SIZE}M -c 8:"vendor_a" -t 8:8300 $node | |
221 | - sgdisk -n 9:0:+${VENDOR_ROM_SIZE}M -c 9:"vendor_b" -t 9:8300 $node | |
222 | - sgdisk -n 10:0:+${data_size}M -c 10:"userdata" -t 10:8300 $node | |
223 | - sgdisk -n 11:0:+${FBMISC_SIZE}M -c 11:"fbmisc" -t 11:8300 $node | |
224 | - sgdisk -n 12:0:+${VBMETA_SIZE}M -c 12:"vbmeta_a" -t 12:8300 $node | |
225 | - sgdisk -n 13:0:+${VBMETA_SIZE}M -c 13:"vbmeta_b" -t 13:8300 $node | |
226 | - | |
227 | - sync; sleep 2 | |
228 | - | |
229 | - for i in `cat /proc/mounts | grep "${node}" | awk '{print $2}'`; do umount $i; done | |
230 | - hdparm -z $node | |
231 | - sync; sleep 3 | |
232 | - | |
233 | - # backup the GPT table to last LBA. | |
234 | - echo -e 'r\ne\nY\nw\nY\nY' | gdisk $node | |
235 | - sync; sleep 1 | |
236 | - sgdisk -p $node | |
118 | + num=`gdisk -l ${node} | grep -w $1 | awk '{print $1}'` | |
119 | + if [ ${num} -gt 0 ] 2>/dev/null; then | |
120 | + get_partition_size $1 | |
121 | + echo "erase_partition: $1 : ${node}${num} ${g_sizes}M" | |
122 | + dd if=/dev/zero of=${node}${num} bs=1048576 conv=fsync count=$g_sizes | |
123 | + fi | |
237 | 124 | } |
238 | 125 | |
239 | -function install_bootloader | |
126 | +function flash_partition | |
240 | 127 | { |
241 | - echo | |
242 | - blue_underlined_bold_echo "Installing booloader" | |
243 | - | |
244 | - dd if=${imagesdir}/${bootloader_file} of=$node bs=1k seek=${bootloader_offset}; sync | |
128 | + for num in `gdisk -l ${node} | grep -E -w "$1|$1_a|$1_b" | awk '{print $1}'` | |
129 | + do | |
130 | + if [ $? -eq 0 ]; then | |
131 | + if [ $(echo ${1} | grep "system") != "" ] 2>/dev/null; then | |
132 | + img_name=${systemimage_raw_file} | |
133 | + elif [ $(echo ${1} | grep "vendor") != "" ] 2>/dev/null; then | |
134 | + img_name=${vendor_raw_file} | |
135 | + else | |
136 | + img_name="${1%_*}${soc_name}.img" | |
137 | + fi | |
138 | + echo "flash_partition: ${img_name} ---> ${node}${num}" | |
139 | + dd if=${img_name} of=${node}${num} bs=10M conv=fsync | |
140 | + fi | |
141 | + done | |
245 | 142 | } |
246 | 143 | |
247 | 144 | function format_android |
248 | 145 | { |
249 | - echo | |
250 | - blue_underlined_bold_echo "Erasing presistdata partition" | |
251 | - dd if=/dev/zero of=${node}${part}7 bs=1M count=${PRESISTDATA_SIZE} conv=fsync | |
252 | - blue_underlined_bold_echo "Erasing fbmisc partition" | |
253 | - dd if=/dev/zero of=${node}${part}11 bs=1M count=${FBMISC_SIZE} conv=fsync | |
254 | - blue_underlined_bold_echo "Erasing misc partition" | |
255 | - dd if=/dev/zero of=${node}${part}5 bs=1M count=${MISC_SIZE} conv=fsync | |
256 | - blue_underlined_bold_echo "Erasing metadata partition" | |
257 | - dd if=/dev/zero of=${node}${part}6 bs=1M count=${METADATA_SIZE} conv=fsync | |
258 | - blue_underlined_bold_echo "Formating userdata partition" | |
259 | - mkfs.ext4 -F ${node}${part}10 -Ldata | |
260 | - sync; sleep 1 | |
146 | + echo "formating android images" | |
147 | + format_partition userdata | |
148 | + format_partition cache | |
149 | + erase_partition presistdata | |
150 | + erase_partition fbmisc | |
151 | + erase_partition misc | |
261 | 152 | } |
262 | 153 | |
263 | -function install_android | |
154 | +function make_partition | |
264 | 155 | { |
265 | - echo | |
266 | - blue_underlined_bold_echo "Installing Android boot image: $bootimage_file" | |
267 | - dd if=${imagesdir}/${bootimage_file} of=${node}${part}1 | |
268 | - dd if=${imagesdir}/${bootimage_file} of=${node}${part}2 | |
269 | - sync | |
270 | - | |
271 | - echo | |
272 | - blue_underlined_bold_echo "Installing Android system image: $systemimage_file" | |
273 | - if [[ -f ${imagesdir}/${systemimage_raw_file} ]] ; then | |
274 | - rm ${imagesdir}/${systemimage_raw_file} 2> /dev/null | |
275 | - fi | |
276 | - out/host/linux-x86/bin/simg2img ${imagesdir}/${systemimage_file} ${imagesdir}/${systemimage_raw_file} | |
277 | - dd if=${imagesdir}/${systemimage_raw_file} of=${node}${part}3 | |
278 | - dd if=${imagesdir}/${systemimage_raw_file} of=${node}${part}4 | |
279 | - sync; | |
280 | - | |
281 | - echo | |
282 | - blue_underlined_bold_echo "Installing Android vendor image: $vendorimage_file" | |
283 | - if [[ -f ${imagesdir}/${vendorimage_raw_file} ]] ; then | |
284 | - rm ${imagesdir}/${vendorimage_raw_file} 2> /dev/null | |
285 | - fi | |
286 | - out/host/linux-x86/bin/simg2img ${imagesdir}/${vendorimage_file} ${imagesdir}/${vendorimage_raw_file} | |
287 | - dd if=${imagesdir}/${vendorimage_raw_file} of=${node}${part}8 | |
288 | - dd if=${imagesdir}/${vendorimage_raw_file} of=${node}${part}9 | |
289 | - sync; | |
290 | - | |
291 | - echo | |
292 | - blue_underlined_bold_echo "Installing Android vbmeta image: $vbmeta_file" | |
293 | - dd if=${imagesdir}/${vbmeta_file} of=${node}${part}12 | |
294 | - dd if=${imagesdir}/${vbmeta_file} of=${node}${part}13 | |
295 | - sync; | |
296 | - | |
297 | - sleep 1 | |
156 | + if [ ${card_size} -gt 0 ]; then | |
157 | + partition_file="partition-table-${card_size}GB.img" | |
158 | + fi | |
159 | + echo "make gpt partition for android: ${partition_file}" | |
160 | + dd if=${partition_file} of=${node} bs=1k count=${vaild_gpt_size} conv=fsync | |
298 | 161 | } |
299 | 162 | |
300 | -function finish | |
163 | +function flash_android | |
301 | 164 | { |
302 | - echo | |
303 | - errors=0 | |
304 | - for partition in ${node}* | |
305 | - do | |
306 | - if [[ ! -b ${partition} ]] ; then | |
307 | - red_bold_echo "ERROR: \"${partition}\" is not a block device" | |
308 | - errors=$((errors+1)) | |
309 | - fi | |
310 | - done | |
165 | + boot_partition="boot"${slot} | |
166 | + recovery_partition="recovery"${slot} | |
167 | + system_partition="system"${slot} | |
168 | + vendor_partition="vendor"${slot} | |
169 | + vbmeta_partition="vbmeta"${slot} | |
311 | 170 | |
312 | - if [[ ${errors} = 0 ]] ; then | |
313 | - blue_bold_echo "Android installed successfully" | |
314 | - else | |
315 | - red_bold_echo "Android installation failed" | |
316 | - fi | |
317 | - exit ${errors} | |
171 | + #bootloader_file="u-boot${soc_name}.imx" | |
172 | + bootloader_file="u-boot-smarcimx8mq_2g.imx" | |
173 | + flash_partition ${boot_partition} | |
174 | + flash_partition ${recovery_partition} | |
175 | + simg2img ${systemimage_file} ${systemimage_raw_file} | |
176 | + flash_partition ${system_partition} | |
177 | + rm ${systemimage_raw_file} | |
178 | + simg2img ${vendor_file} ${vendor_raw_file} | |
179 | + flash_partition ${vendor_partition} | |
180 | + rm ${vendor_raw_file} | |
181 | + flash_partition ${vbmeta_partition} | |
182 | + echo "erase_partition: uboot : ${node}" | |
183 | + echo "flash_partition: ${bootloader_file} ---> ${node}" | |
184 | + first_partition_offset=`gdisk -l ${node} | grep ' 1 ' | awk '{print $2}'` | |
185 | + # the unit of first_partition_offset is sector size which is 512 Byte. | |
186 | + count_bootloader=`expr ${first_partition_offset} / 2 - ${bootloader_offset}` | |
187 | + echo "the bootloader partition size: ${count_bootloader}" | |
188 | + dd if=/dev/zero of=${node} bs=1k seek=${bootloader_offset} conv=fsync count=${count_bootloader} | |
189 | + dd if=${bootloader_file} of=${node} bs=1k seek=${bootloader_offset} conv=fsync | |
318 | 190 | } |
319 | 191 | |
320 | -check_images | |
192 | +if [ "${not_partition}" -eq "1" ] ; then | |
193 | + flash_android | |
194 | + exit | |
195 | +fi | |
321 | 196 | |
322 | -umount ${node}${part}* 2> /dev/null || true | |
197 | +make_partition | |
198 | +sleep 3 | |
199 | +for i in `cat /proc/mounts | grep "${node}" | awk '{print $2}'`; do umount $i; done | |
200 | +hdparm -z ${node} | |
323 | 201 | |
324 | -#Stop Udev for block devices while partitioning in progress | |
325 | -#/etc/init.d/udev stop | |
202 | +# backup the GPT table to last LBA for sd card. | |
203 | +echo -e 'r\ne\nY\nw\nY\nY' | gdisk ${node} | |
326 | 204 | |
327 | -delete_device | |
328 | -create_parts | |
329 | -install_bootloader | |
330 | 205 | format_android |
331 | -install_android | |
332 | -finish | |
206 | +flash_android | |
333 | 207 | |
334 | -#Start Udev back before exit | |
335 | -#/etc/init.d/udev restart | |
208 | +# For MFGTool Notes: | |
209 | +# MFGTool use mksdcard-android.tar store this script | |
210 | +# if you want change it. | |
211 | +# do following: | |
212 | +# tar xf mksdcard-android.sh.tar | |
213 | +# vi mksdcard-android.sh | |
214 | +# [ edit want you want to change ] | |
215 | +# rm mksdcard-android.sh.tar; tar cf mksdcard-android.sh.tar mksdcard-android.sh |
smarc_mx8m/BoardConfig.mk
... | ... | @@ -85,7 +85,10 @@ |
85 | 85 | ifeq ($(PRODUCT_IMX_DRM),true) |
86 | 86 | CMASIZE=736M |
87 | 87 | else |
88 | -CMASIZE=1536M | |
88 | +# if 4GB LPDDR4 | |
89 | +# CMASIZE=1536M | |
90 | +# if 2GB LPDDR4 | |
91 | +CMASIZE=736M | |
89 | 92 | endif |
90 | 93 | |
91 | 94 | BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 earlycon=imxuart,0x30860000,115200 init=/init video=HDMI-A-1:1920x1080-32@60 androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale androidboot.fbTileSupport=enable cma=$(CMASIZE) androidboot.primary_display=imx-drm firmware_class.path=/vendor/firmware |