본문 바로가기

Shell

linux shell 의 sysfs에서 device-tree 뽑아내는 방법 dtc 라는 tool 을 사용하면 된다. dtc -I fs -O dts -o output.dts /proc/device-tree 더보기
shell terminal 이 종료되어도 계속해서 작업 수행되도록 하기 원문 : http://dreamlog.tistory.com/470build 같이 시간이 걸리는 작업을 걸어놓으면, windows pc 를 off 할 수 없어서 곤란한 상황이 생길때가 있다. 혹은 실수로 터미널을 종료할 때도 있다. 아래와 같이 screen 을 사용하면 그런 우려를 덜 수 있다. 자세한 설명은 위 원문에 잘 설명되어 있고, 사용법만을 보관을 위해 적어 둔다. . screen 사용법screen 만들기.$ screen -S build1 screen 목록 보기.$ screen -listThere is a screen on: 3703.build1(2015년 11월 11일 01시 43분 38초)(Attached) 1 Socket in /var/run/screen/S-hyunmu. 사용 예)$ scr.. 더보기
find PID as process name and send signal using shell script #!/system/bin/shecho "sigquit.system_server.sh: start" > /dev/kmsgecho "sigquit.system_server.sh: start"sleep 10.0str=""echo "sigquit.system_server.sh: delay finish" > /dev/kmsgecho "sigquit.system_server.sh: delay finish"while [ "$str" = "" ]; do str=`ps | grep system_server` sleep 0.1donepid=${str:10:4}echo "sigquit.system_server.sh: kill -3 ${pid}" > /dev/kmsgecho "sigquit.system_server.sh: k.. 더보기
android adb 에서 sh : shell script file 이 실행 안될때 실행법 # sh ./sigquit.system_server.sh & or # /system/bin/sh ./sigquit.system_server.sh & 아래와 같이 error 가 날때는 root@gracelte:/data/local/tmp # sh ./sigquit.system_server.sh & [1] 13625'oot@gracelte:/data/local/tmp # ./sigquit.system_server.sh[3]: sleep: syntax error: Invalid argument '10.0./sigquit.system_server.sh[6]: syntax error: 'while' unmatched [1] + Done (1) sh ./sigquit.system_server.sh Ubunt.. 더보기
터미널의 컬러 text 를 클립보드로 복사하기 아직 작성중... http://www.linuxquestions.org/questions/linux-desktop-74/preserve-colors-when-copy-pasting-from-terminal-943213/ -> perl 로 html 로 변환하는 해법http://stackoverflow.com/questions/245121/a-library-to-convert-ansi-escapes-terminal-formatting-color-codes-to-html http://stackoverflow.com/questions/5505515/how-do-i-embed-source-code-or-html-in-open-office-org-presentations-without-usin 더보기
adb shell 기본 접속 권한 root 에서 shell 로 변경 방법 원본 : http://stackoverflow.com/questions/15336215/how-to-restart-adb-from-root-to-user-mode ~$ adb shell id uid=2000(shell) gid=2000(shell) ~$ adb root restarting adbd as root ~$ adb shell id uid=0(root) gid=0(root) ~$ adb shell 'setprop service.adb.root 0; setprop ctl.restart adbd' ~$ adb shell id uid=2000(shell) gid=2000(shell) 더보기
윈도우 shell 에서 linux shell command 사용하기 Gow – The lightweight alternative to Cygwin가볍고 사용이 편리함.=> Gow 는 cmd 를 실행하면 자동으로 실행되면서 윈도우 shell 상에서 gnu 명령어들이 동작하도록 해 줍니다.따라서 윈도우에서도 linux shell command 를 사용하고자 한다면,이 프로그램이 대안입니다.https://github.com/bmatzelle/gow/releases clinkwondiws cmd 에서 ctrl+v 같은 단축키가 동작하도록 해주는 프로그램입니다.clink+sygwin 방법이 있다는데 아직 시도해 보지 못했습니다.Gow 와 함께 쓰면 매우 편안한 windows shell 환경을 제공합니다. ConEmuwindows cmd 의 화룡정점이라고 해야할까..ssh 프로그램.. 더보기
linux shell script file 이 실행이 안될때. # ls -al-rwxrwxrwx shell shell 1631963 2014-07-30 21:16 mobibench_arm_3.7.11-rwxrwxrwx shell shell 232 2014-08-26 10:22 msh_dio.sh 모두 권한이 있는데도 불구하고 shell 을 실행하면 permission error 가 발생함. # ./msh_dio.sh1rm failed for /cache/test.db0*, No such file or directory./msh_dio.sh[9]: ./mobibench_arm_3.7.11_dio_0819: can't execute: Permission deniedfailed on '/cache/test.db0' - No such file or directory 정확하.. 더보기
gdb 로 Android nexus5 debugging 하기 - GDB server 를 사용해야 하는 이유.: Android local 에서 gdb 를 직접 실행하면 필요한 symbol 정보 매칭이 안되어서 attach 한 process 가 SIGV error 를 내면서 종료가 됩니다. - cross compile 로 arm 용 gdb / gdb server 구하기 http://searchme.tistory.com/37 ※ 이 디버깅 방법에서 gdb 는 사용하지 않습니다. - adb push 로 PC에서 Android device 에 gdbserver 다운로드 하기 # adb push ./gdbserver /data/local/tmp/ - arm-gnu-eabi toolchain 받기git clone https://android.googlesource.com/pl.. 더보기
[linux platform] LD_PRELOAD 를 이용한 android 에서의 library 교체 library 를 수정하는 개발을 할때,매번 package 로 묶어서 전체 이미지를 다운로드 하는것은 많은 시간을 소모하게 한다. 아래 방법을 사용하면, 내가 build 한 library 만 바꾸면서system reboot 이나 전체 image download 없이 디버깅을 할때 아주 유용한 방법이다. adb shell 에서 다음과 같이 입력하면,원래 설치되어 있는 library 파일이 아닌, 내가 지정한 library 파일을 load 해서 실행된다. - LD_PRELOAD 의 입력방법1. 모든 프로그램이 내가 만든 library 를 사용하기 원할때..LD_PRELOAD = "preload 되기 원하는 so 파일 경로" 2. 특정 프로그램만 내가 만든 library 를 사용하기 원할때..LD_PRELOA.. 더보기
linxu bash shell script 명령어 참고 사이트 : http://cybercafe.tistory.com/330http://linuxconfig.org/bash-scripting-tutorial bash : Bourne-again shell - bash 의 상태 확인# env - shell script 시작파일 첫 머리에 다음 구문 삽입#!/bin/bash - 사칙연산 : leta=10b=10 let c=a+b echo $a+$b=$c --> 출력결과 : 10+10=20 c=$a$b echo $c --> 출력결과 : 1010 a="10"b="10" let c=a+b echo $a+$b=$c --> 출력결과 : 10+10=20 c=$a$b echo $c --> 출력결과 : 1010 - 길이로 문자열 자르기 : ${var:start:length.. 더보기
Android Terminal Emulator 을 이용한 linux kernel debugging 기법 오늘은 Android Terminal Emulator App 을 소개하고자 한다. linux kernel 개발을 할때 간혹 디버깅 용도로 sysfs 를 쓰는 경우가 있다. usb 도 연결 안되서 adb shell 도 못쓰고,무언가 kernel 과 간접적으로 read / write 를 할때 이러한 방법을 사용하고 하는데,이때마다 App 을 만들어서 경로와 write data 를 변경하는 것은 매우 번거로운 짓이다. 이때 해당 App 을 이용해서, 화면에서 직접 terminal 을 접근해서 재어 할 수 있다. 단, control 하려는 sysfs node 는 미리 chmod 로 권한을 풀어두는 것이 좋을 것이다. App 은 일단 link 한다. http://www.appsapk.com/android-term.. 더보기
Linux Network proxy setting 방법 Ubuntu 환경에서는 windows 와 다르게 proxy setting 을 여러곳에 각각 해 주어야 하는 번거로움이 있다.크게 3가지 인데 아래에 정리해본다 참고 : http://xmodulo.com/how-to-set-up-proxy-auto-config-on-ubuntu-desktop.html 그래픽 UI 의 setting menu 에서 아래와 같이 설정한다. you have created this PAC file, go to "System Settings" -> "Network" -> "Proxy Settings", and choose "Automatic" method in network proxy. Then type "file://.. 더보기