Commit 360e183e78ff22accc8e12d65d63940cefcbe6ed
1 parent
3207dbf81d
Exists in
master
and in
2 other branches
= Fusing & JIG 관련 README 추가 및 스크립트 별도 저장
Showing
3 changed files
with
615 additions
and
0 deletions
Show diff stats
README.md
... | ... | @@ -0,0 +1,52 @@ |
1 | + | |
2 | +## [Fusing SD] | |
3 | +--------------------------- | |
4 | + | |
5 | +* Fusing SD 만드는 법(Boot SD 겸용) | |
6 | + | |
7 | + release 폴더의 mk-fusingsd.sh 실행 ( Default DEV_NAME : /dev/mmcblk0 ) 인자로 DEV_NAME 변경 가능함 | |
8 | + | |
9 | +* Bootcmd 모드에서 아래 명령을 입력하면 Fusing Mode로 SD부팅함. | |
10 | + | |
11 | + # run fw | |
12 | + | |
13 | +* run fw 를 안하면 보통의 부팅가능한 SD카드로 사용가능하다. run fw시 bootargs_ram 에 fusing=1 이라는 값이 추가되어 커널에서 해당 내용을 파싱하여 /root/.falinux/mk-emmc-fusing.sh 실행함 | |
14 | + | |
15 | + | |
16 | +## [Fusing SD] | |
17 | +--------------------------- | |
18 | + | |
19 | +* JIG (Test 관련) | |
20 | + | |
21 | + eMMC 에 부트이미지를 Fusing 후 처음 부팅을 하게 되면 /etc/init.d/S83fusing 에서 | |
22 | + /root/.falinux/prime_jig/.complete 파일의 유무를 체크 하여 /root/.falinux/prime_jig/prime_jig.sh 스크립트를 실행하게 된다. | |
23 | + (.complete 가 없으면 Prime JIG 스크립트를 실행하며 완료되면 .complete 파일을 생성하여 다음 부팅부터는 JIG 가 실행되지 않도록 한다.) | |
24 | + JIG 결과는 /root/.falinux/prime_jig/result_log 파일로 저장된다. | |
25 | + | |
26 | + | |
27 | + | |
28 | +## [파티션] | |
29 | +--------------------------- | |
30 | + | |
31 | + start size desc | |
32 | + ---------- -------- ------------------- | |
33 | + 0-MB 128-MB raw area | |
34 | + 128-MB 128-MB partition#1, ext3 : BOOT0 | |
35 | + 256-MB 256-MB partition#2, ext4 : SYSTEM | |
36 | + 512-MB 512-MB partition#3, ext4 : FALINUX | |
37 | + 1024-MB all partition#4, ext4 : PRIME | |
38 | + | |
39 | + ------------------------------------------ | |
40 | + 00-MB 128-MB reserved area | |
41 | + ------------------------------------------ | |
42 | + start size start block size(bs = 512) | |
43 | + U-boot : 1KB 640KB ( 0x2 0x500 ) | |
44 | + Logo : 1MB 4.5MB ( 0x800 0x2400 ) | |
45 | + DTB : 5.5MB 128KB ( 0x2C00 0x100 ) | |
46 | + KERNEL : 6MB 7MB ( 0x3000 0x3800 ) | |
47 | + RAMDISK : 14MB 64MB ( 0x7000 0x20000 ) | |
48 | + | |
49 | + | |
50 | + | |
51 | + | |
52 | + | ... | ... |
scripts/prime_jig.sh
... | ... | @@ -0,0 +1,466 @@ |
1 | +#!/bin/bash | |
2 | + | |
3 | +C_LRED='\033[1;31m' | |
4 | +C_LGREEN='\033[1;32m' | |
5 | +C_LCYAN='\033[1;36m' | |
6 | +C_NC='\033[0m' | |
7 | +C_BLINK='\033[5m' | |
8 | +C_BOLD='\033[1m' | |
9 | + | |
10 | + | |
11 | +PING_ADDR="192.168.10.1" | |
12 | +MAC_ADDR="" | |
13 | +ETH_NAME="eth0" | |
14 | +SUMMARY_PATH="/tmp/list" | |
15 | +JIG_PATH="/root/.falinux/prime_jig/" | |
16 | +RESULT_LOG="${JIG_PATH}result_log" | |
17 | +THREAD_FUNC_SCRIPT="${JIG_PATH}thread_func.sh" | |
18 | +FRAM_TEST_APP="${JIG_PATH}fram_test" | |
19 | +COMPLETE_TEST_NAME="" | |
20 | + | |
21 | +function Init() | |
22 | +{ | |
23 | + | |
24 | + if [ -f "${SUMMARY_PATH}" ]; then | |
25 | + rm -rf ${SUMMARY_PATH} | |
26 | + fi | |
27 | +} | |
28 | + | |
29 | +function summary() | |
30 | +{ | |
31 | + clear | |
32 | + echo -e "" | |
33 | + echo -e "============================" | |
34 | + echo -e " Test Summary " | |
35 | + echo -e "============================" | |
36 | + cat $SUMMARY_PATH | |
37 | + echo -e "============================" | |
38 | + echo -e " MAC: ${MAC_ADDR}" | |
39 | + echo -e "============================" | |
40 | + echo -e "" | |
41 | + echo -e "" | |
42 | +} | |
43 | + | |
44 | +function save_result() | |
45 | +{ | |
46 | + echo -e "" >> ${RESULT_LOG} | |
47 | + echo -e "============================" >> ${RESULT_LOG} | |
48 | + echo -e " Test Summary " >> ${RESULT_LOG} | |
49 | + echo -e "============================" >> ${RESULT_LOG} | |
50 | + cat $SUMMARY_PATH >> ${RESULT_LOG} | |
51 | + echo -e "============================" >> ${RESULT_LOG} | |
52 | + echo -e " MAC: ${MAC_ADDR}" >> ${RESULT_LOG} | |
53 | + echo -e "============================" >> ${RESULT_LOG} | |
54 | + echo -e "" >> ${RESULT_LOG} | |
55 | + echo -e "" >> ${RESULT_LOG} | |
56 | + sync | |
57 | +} | |
58 | + | |
59 | +function error_check() | |
60 | +{ | |
61 | + if [ "$1" != "0" ]; then | |
62 | + echo -e "[${C_LRED}ERR${C_NC}]: $2" >> $SUMMARY_PATH | |
63 | + else | |
64 | + echo -e "[${C_LGREEN} OK${C_NC}]: $2" >> $SUMMARY_PATH | |
65 | + fi | |
66 | +} | |
67 | + | |
68 | + | |
69 | +function test_mac() | |
70 | +{ | |
71 | + echo "" | |
72 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
73 | + echo "" | |
74 | + | |
75 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
76 | + | |
77 | + | |
78 | + for i in 0xfa 0xfb 0xfc 0xfd 0xfe 0xff | |
79 | + do | |
80 | + if [ "$i" == "0xfa" ]; then | |
81 | + EEPROM_MAC=$(i2cget -f -y 1 0x50 $i b | sed 's/0x//') | |
82 | + else | |
83 | + EEPROM_MAC+=$(i2cget -f -y 1 0x50 $i b | sed 's/0x/:/') | |
84 | + fi | |
85 | + done | |
86 | + | |
87 | + MAC_ADDR="${EEPROM_MAC^^}" | |
88 | + | |
89 | + ETH_MAC=$(ifconfig | grep eth0 | awk {'print $5'}) | |
90 | + | |
91 | + if [ "${EEPROM_MAC^^}" = "${ETH_MAC^^}" ]; then | |
92 | + return $? | |
93 | + else | |
94 | + return -1 | |
95 | + fi | |
96 | +} | |
97 | + | |
98 | +function check_ping() | |
99 | +{ | |
100 | + for i in 1 2 3 4 | |
101 | + do | |
102 | + sleep 1 | |
103 | + ping -c 1 -w 1 $PING_ADDR > /dev/null | |
104 | + if [ "$?" = "0" ]; then | |
105 | + return $? | |
106 | + fi | |
107 | + done | |
108 | + | |
109 | + return -1 | |
110 | +} | |
111 | + | |
112 | +function check_ethernet() | |
113 | +{ | |
114 | + echo "Check Ethernet Link Up/Down" | |
115 | + if [ $(cat /sys/class/net/$1/operstate) = "up" ]; then | |
116 | + return 0 | |
117 | + else | |
118 | + ifconfig eth0 up | |
119 | + return -1 | |
120 | + fi | |
121 | +} | |
122 | + | |
123 | +function test_ethernet() | |
124 | +{ | |
125 | + echo "" | |
126 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
127 | + echo "" | |
128 | + | |
129 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
130 | + | |
131 | + # TODO Test | |
132 | + | |
133 | + IFACE="$1" | |
134 | + | |
135 | + for i in {1..10} | |
136 | + do | |
137 | + check_ethernet $IFACE | |
138 | + if [ "$?" = "0" ]; then | |
139 | + break | |
140 | + else | |
141 | + echo "$IFACE Link is down" | |
142 | + fi | |
143 | + sleep 1 | |
144 | + done | |
145 | + | |
146 | + udhcpc -i eth0 -n -q | |
147 | + if [ "$?" != 0 ]; then | |
148 | + return -1 | |
149 | + fi | |
150 | + | |
151 | + check_ping | |
152 | + if [ "$?" != 0 ]; then | |
153 | + return -1 | |
154 | + fi | |
155 | + | |
156 | + return $? | |
157 | +} | |
158 | + | |
159 | +function test_rtc() | |
160 | +{ | |
161 | + echo "" | |
162 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
163 | + echo "" | |
164 | + | |
165 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
166 | + | |
167 | + # TODO Test | |
168 | + | |
169 | + ls /dev/rtc0 | |
170 | + if [ "$?" != 0 ]; then | |
171 | + return -1 | |
172 | + fi | |
173 | + | |
174 | + return $? | |
175 | +} | |
176 | + | |
177 | +TOUCH_IC_NAME="TSC2007" | |
178 | +function test_touch() | |
179 | +{ | |
180 | + echo "" | |
181 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
182 | + echo "" | |
183 | + | |
184 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
185 | + | |
186 | + # TODO Test | |
187 | + | |
188 | + cat /proc/bus/input/devices | grep $TOUCH_IC_NAME | |
189 | + if [ "$?" != "0" ]; then | |
190 | + return -1 | |
191 | + fi | |
192 | + | |
193 | + hexdump /dev/input/event0 & | |
194 | + if [ "$?" != "0" ]; then | |
195 | + return -1 | |
196 | + fi | |
197 | + | |
198 | + echo -e "" | |
199 | + echo -e "${C_BLINK}${C_BOLD}Press any key to ${FUNCNAME} exit...${C_NC}" | |
200 | + echo -e "" | |
201 | + read -rs | |
202 | + | |
203 | + killall hexdump | |
204 | + | |
205 | + return 0 | |
206 | +} | |
207 | + | |
208 | +BACK_LIGHT="/sys/class/backlight/backlight_lvds.19/brightness" | |
209 | +function test_lcd() | |
210 | +{ | |
211 | + echo "" | |
212 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
213 | + echo "" | |
214 | + | |
215 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
216 | + | |
217 | + # TODO Test | |
218 | + | |
219 | + fb-test | |
220 | + if [ "$?" != 0 ]; then | |
221 | + return -1 | |
222 | + fi | |
223 | + | |
224 | + sleep 1 | |
225 | + echo 0 > $BACK_LIGHT | |
226 | + | |
227 | + sleep 1 | |
228 | + echo 10 > $BACK_LIGHT | |
229 | + | |
230 | + sleep 1 | |
231 | + echo 0 > $BACK_LIGHT | |
232 | + | |
233 | + sleep 1 | |
234 | + echo 10 > $BACK_LIGHT | |
235 | + | |
236 | + sleep 1 | |
237 | + echo 0 > $BACK_LIGHT | |
238 | + | |
239 | + sleep 1 | |
240 | + echo 5 > $BACK_LIGHT | |
241 | + | |
242 | + return $? | |
243 | +} | |
244 | + | |
245 | +function test_encoder() | |
246 | +{ | |
247 | + echo "" | |
248 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
249 | + echo "" | |
250 | + | |
251 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
252 | + | |
253 | + # TODO Test | |
254 | + | |
255 | + ${THREAD_FUNC_SCRIPT} evtest & | |
256 | + if [ "$?" != 0 ]; then | |
257 | + return -1 | |
258 | + fi | |
259 | + | |
260 | + echo -e "" | |
261 | + echo -e "${C_BLINK}${C_BOLD}Press any key to ${FUNCNAME} exit...${C_NC}" | |
262 | + echo -e "" | |
263 | + read -rs | |
264 | + | |
265 | + killall evtest | |
266 | + | |
267 | + return $? | |
268 | +} | |
269 | + | |
270 | +WAV_FILE="${JIG_PATH}opening.wav" | |
271 | +function test_audio() | |
272 | +{ | |
273 | + echo "" | |
274 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
275 | + echo "" | |
276 | + | |
277 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
278 | + | |
279 | + # TODO Test | |
280 | + | |
281 | + aplay $WAV_FILE | |
282 | + if [ "$?" != "0" ]; then | |
283 | + return -1 | |
284 | + fi | |
285 | + | |
286 | + return $? | |
287 | +} | |
288 | + | |
289 | +function test_usb_storage() | |
290 | +{ | |
291 | + echo "" | |
292 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
293 | + echo "" | |
294 | + | |
295 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
296 | + | |
297 | + # TODO Test | |
298 | + | |
299 | + ls /dev/sda | |
300 | + if [ "$?" != "0" ]; then | |
301 | + return -1 | |
302 | + fi | |
303 | + | |
304 | + ls /dev/sdb | |
305 | + return $? | |
306 | +} | |
307 | + | |
308 | +function test_fram() | |
309 | +{ | |
310 | + echo "" | |
311 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
312 | + echo "" | |
313 | + | |
314 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
315 | + | |
316 | + # TODO Test | |
317 | + | |
318 | + ${FRAM_TEST_APP} | |
319 | + if [ "$?" != "0" ]; then | |
320 | + return -1 | |
321 | + fi | |
322 | + | |
323 | + return $? | |
324 | +} | |
325 | + | |
326 | +function test_tty() | |
327 | +{ | |
328 | + echo "" | |
329 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
330 | + echo "" | |
331 | + | |
332 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
333 | + WRITE_MSG="FALINUX_TTY" | |
334 | + | |
335 | + # TODO Test | |
336 | + | |
337 | + DEV_TTY_PATH="/dev/ttymxc1" | |
338 | + | |
339 | + ${THREAD_FUNC_SCRIPT} tty ${DEV_TTY_PATH} ${WRITE_MSG} & | |
340 | + read -s -t 5 READ_MSG < ${DEV_TTY_PATH} | |
341 | + if [ "$?" != 0 ]; then | |
342 | + return -1 | |
343 | + fi | |
344 | + echo "Read: [${READ_MSG}]" | |
345 | + | |
346 | + if [ "${WRITE_MSG}" != "${READ_MSG}" ]; then | |
347 | + return -1 | |
348 | + fi | |
349 | + | |
350 | + return $? | |
351 | +} | |
352 | + | |
353 | +function test_rs485() | |
354 | +{ | |
355 | + echo "" | |
356 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
357 | + echo "" | |
358 | + | |
359 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
360 | + | |
361 | + # TODO Test | |
362 | + | |
363 | + DEV_RS485_PATH1="/dev/ttymxc2" | |
364 | + DEV_RS485_PATH2="/dev/ttymxc3" | |
365 | + | |
366 | + # Read : RS485_1, Write : RS485_2 | |
367 | + RS485_WRITE_MSG="FALINUX_TEST:"${DEV_RS485_PATH2} | |
368 | + ${THREAD_FUNC_SCRIPT} rs485 ${DEV_RS485_PATH2} ${RS485_WRITE_MSG} & | |
369 | + read -s -t 5 RS485_READ_MSG < ${DEV_RS485_PATH1} | |
370 | + if [ "$?" != 0 ]; then | |
371 | + return -1 | |
372 | + fi | |
373 | + echo "Read: [${RS485_READ_MSG}]" | |
374 | + | |
375 | + if [ "${RS485_WRITE_MSG}" != "${RS485_READ_MSG}" ]; then | |
376 | + return -1 | |
377 | + fi | |
378 | + | |
379 | + # Read : RS485_2, Write : RS485_1 | |
380 | + RS485_WRITE_MSG="FALINUX_TEST:"${DEV_RS485_PATH1} | |
381 | + ${THREAD_FUNC_SCRIPT} rs485 ${DEV_RS485_PATH1} ${RS485_WRITE_MSG} & | |
382 | + read -s -t 5 RS485_READ_MSG < ${DEV_RS485_PATH2} | |
383 | + if [ "$?" != 0 ]; then | |
384 | + return -1 | |
385 | + fi | |
386 | + echo "Read: [${RS485_READ_MSG}]" | |
387 | + | |
388 | + if [ "${RS485_WRITE_MSG}" != "${RS485_READ_MSG}" ]; then | |
389 | + return -1 | |
390 | + fi | |
391 | + | |
392 | + return $? | |
393 | +} | |
394 | + | |
395 | + | |
396 | +function test_default() | |
397 | +{ | |
398 | + echo "" | |
399 | + echo -e "${C_LCYAN}### [${FUNCNAME}] ###${C_NC}" | |
400 | + echo "" | |
401 | + | |
402 | + COMPLETE_TEST_NAME=${FUNCNAME} | |
403 | + | |
404 | + # TODO Test | |
405 | + | |
406 | + | |
407 | + return $? | |
408 | +} | |
409 | + | |
410 | +function main() | |
411 | +{ | |
412 | + echo "" | |
413 | + echo -e " ### Start DEV Test - [${FUNCNAME}] ###" | |
414 | + echo "" | |
415 | + | |
416 | + Init | |
417 | + | |
418 | + test_mac | |
419 | + error_check $? ${COMPLETE_TEST_NAME} | |
420 | + | |
421 | + test_ethernet ${ETH_NAME} | |
422 | + error_check $? ${COMPLETE_TEST_NAME} | |
423 | + | |
424 | + test_rtc | |
425 | + error_check $? ${COMPLETE_TEST_NAME} | |
426 | + | |
427 | + test_touch | |
428 | + error_check $? ${COMPLETE_TEST_NAME} | |
429 | + | |
430 | + test_lcd | |
431 | + error_check $? ${COMPLETE_TEST_NAME} | |
432 | + | |
433 | + test_encoder | |
434 | + error_check $? ${COMPLETE_TEST_NAME} | |
435 | + | |
436 | + test_audio | |
437 | + error_check $? ${COMPLETE_TEST_NAME} | |
438 | + | |
439 | + test_usb_storage | |
440 | + error_check $? ${COMPLETE_TEST_NAME} | |
441 | + | |
442 | + test_fram | |
443 | + error_check $? ${COMPLETE_TEST_NAME} | |
444 | + | |
445 | + test_tty | |
446 | + error_check $? ${COMPLETE_TEST_NAME} | |
447 | + | |
448 | + test_rs485 | |
449 | + error_check $? ${COMPLETE_TEST_NAME} | |
450 | + | |
451 | + summary | |
452 | + save_result | |
453 | +} | |
454 | + | |
455 | +function test_func() | |
456 | +{ | |
457 | + echo "" | |
458 | + echo -e " ### TEST Func - [${FUNCNAME}] ###" | |
459 | + echo "" | |
460 | + | |
461 | + test_encoder | |
462 | + error_check $? ${COMPLETE_TEST_NAME} | |
463 | +} | |
464 | + | |
465 | + | |
466 | +main | ... | ... |
scripts/thread_func.sh
... | ... | @@ -0,0 +1,97 @@ |
1 | +#!/bin/bash | |
2 | + | |
3 | +C_LRED='\033[1;31m' | |
4 | +C_LGREEN='\033[1;32m' | |
5 | +C_LCYAN='\033[1;36m' | |
6 | +C_NC='\033[0m' | |
7 | +C_BLINK='\033[5m' | |
8 | +C_BOLD='\033[1m' | |
9 | + | |
10 | +SUMMARY_PATH="/tmp/list" | |
11 | +THREAD_FUNC_NAME="" | |
12 | + | |
13 | +function error_check() | |
14 | +{ | |
15 | + if [ "$1" != "0" ]; then | |
16 | + echo -e "[${C_LRED}ERR${C_NC}]: $2" >> $SUMMARY_PATH | |
17 | + fi | |
18 | +} | |
19 | + | |
20 | + | |
21 | +function thread_evtest() | |
22 | +{ | |
23 | + echo "" | |
24 | + echo " @@@ [${FUNCNAME}] @@@" | |
25 | + echo "" | |
26 | + | |
27 | + THREAD_FUNC_NAME=${FUNCNAME} | |
28 | + | |
29 | + evtest << EOF | |
30 | + 1 | |
31 | +EOF | |
32 | + | |
33 | + return $? | |
34 | +} | |
35 | + | |
36 | +function thread_tty() | |
37 | +{ | |
38 | + echo "" | |
39 | + echo " @@@ [${FUNCNAME}] @@@" | |
40 | + echo "" | |
41 | + | |
42 | + DEV_TTY_PATH="$2" | |
43 | + SEND_MESSAGE="$3" | |
44 | + | |
45 | + THREAD_FUNC_NAME=${FUNCNAME} | |
46 | + | |
47 | + sleep 1 | |
48 | + echo $2 $3 | |
49 | + echo "Send: [${SEND_MESSAGE}]" | |
50 | + echo "${SEND_MESSAGE}" > ${DEV_TTY_PATH} | |
51 | + | |
52 | + return $? | |
53 | +} | |
54 | + | |
55 | +function thread_rs485() | |
56 | +{ | |
57 | + echo "" | |
58 | + echo " @@@ [${FUNCNAME}] @@@" | |
59 | + echo "" | |
60 | + | |
61 | + DEV_RS485_PATH=$2 | |
62 | + SEND_MESSAGE=$3 | |
63 | + | |
64 | + THREAD_FUNC_NAME=${FUNCNAME} | |
65 | + | |
66 | + echo $SEND_MESSAGE $DEV_RS485_PATH | |
67 | + echo ${SEND_MESSAGE} ${DEV_RS485_PATH} | |
68 | + | |
69 | + sleep 1 | |
70 | + echo "Send: [${SEND_MESSAGE}]" | |
71 | + echo "${SEND_MESSAGE}" > ${DEV_RS485_PATH} | |
72 | + | |
73 | + return $? | |
74 | +} | |
75 | + | |
76 | + | |
77 | +function main() | |
78 | +{ | |
79 | + case $1 in | |
80 | + evtest) | |
81 | + thread_evtest | |
82 | + error_check $? ${COMPLETE_TEST_NAME} | |
83 | + ;; | |
84 | + tty) | |
85 | + echo $2 $3 | |
86 | + thread_tty $@ | |
87 | + error_check $? ${COMPLETE_TEST_NAME} | |
88 | + ;; | |
89 | + rs485) | |
90 | + thread_rs485 $@ | |
91 | + error_check $? ${COMPLETE_TEST_NAME} | |
92 | + ;; | |
93 | + esac | |
94 | +} | |
95 | + | |
96 | + | |
97 | +main $@ | ... | ... |