본문 바로가기

Programming

Git 유용한 명령어들 commit 한 내용을 roll back 하기 local repository 에 마지막 commit 을 날릴 수 있다. git reset --hard HEAD^ git reset HEAD^^^ "^" 의 갯수만큼 back 으로 돌아가나.. 파일자체는 원본으로 남아있어서 해당 파일이 modified 상태가 된다. 위 상태에서 아래와 같이 --head 옵션을 주면, 서버의 상태로 파일이 원복된다. git reset --hard HEAD 위 두 명령어를 합치면 아래와 같다. git reset --hard HEAD^^^ git status 에서 modified file 이 붉은 색으로 표시된다면 아직, add 가 안되어 workspace 에서 stage 로 가지 못한 것이다. 아래 문구도 유심히 보면 된다. n.. 더보기
arm interrupt mask / unmask 의 의미 mask -> disable 하겠다. unmask -> enable 하겠다. 더보기
linux shell 의 sysfs에서 device-tree 뽑아내는 방법 dtc 라는 tool 을 사용하면 된다. dtc -I fs -O dts -o output.dts /proc/device-tree 더보기
arm sysmmu 와 mmu 의 차이 core ---(mmu stage 1)--> (mmu stage 2)--> DRAM peripheral --(sys mmu stage 1) --> (sysmmu stage 2) --> DRAM 더보기
find and grep on linux shell Sometimes, we want to perform 'grep' command among results of 'find' command.I'll introduce how can we do this easier. The way is very simple - magic keyword is "--include=" Example, below command find "PAGE" word among the files what has ".dts" string in file name. grep -snra --include="*.dts*" "PAGE" 더보기
linux devicetree - interrupt 원본 : liunx Documentation/devicetree/bindings/arm/gic.txt linux document 의 설명이 애매해서 좀 더 풀어서 남긴다. ex)interrupt-controller@2c001000 {compatible = "arm,cortex-a15-gic";#interrupt-cells = ;interrupt-controller;reg = , , , ;interrupts = ;}; #이 있다고 주석이 아니다. 3 이라는 숫자는 interrupts = 에 3개의 값이 들어감을 의미한다. The 1st cell is the interrupt type; 0 for SPI interrupt.. 더보기
outlook 에서 마우스 drag 로 텍스트 선택이 안되는 버그 outlook 을 2016으로 업그레이드 한 이후, 갑자기 메일 본문을 drag 해서 선택할 수 없는 버그가 발생했다.본문을 copy 할 수 없어 매우 불편했는데 아래와 같이 해결했다. 1) win+r 키를 눌러서 실행창 open2) 다음 명령어 입력outlook.exe /restartfolders Close your Outlook.Launch the Run command (e.g. by pressing the Windows logo key + R).Type the following command: outlook.exe /resetfolders (Fig. 2.), and click OK to execute it. This should repair the default Outlook folder.. 더보기
irq 와 fiq 의 차이점 원문 : http://blog.naver.com/PostView.nhn?blogId=nhi1999&logNo=100036266880&parentCategoryNo=&categoryNo=&viewDate=&isShowPopularPosts=false&from=postView 원문요약 IRQ : Interrupt ReQuestFIQ : Fast Interrupt reQuest arm 에서 FIQ 가 IRQ 보다 빠른 이유 1) 전용 register 가 많아서 mode 전환시 stack 으로 store 하는 시간 절약 ----------------------------------------------------- User FIQ Super Abort IRQ Undefined -------------------.. 더보기
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.. 더보기
patch 적용하기, diff, sdiff 원문 : https://blog.naver.com/zeta0807/220943464598 1. diff --brief간략한 폴더비교를 할 일이 자주 있다. 아래와 같이 사용하면 된다.diff --brief -r folder1/ folder2/아래 site를 참조하였으며 엄청난 option들이 있다. http://stackoverflow.com/questions/4997693/given-two-directory-trees-how-can-i-find-out-which-files-differ You said Linux, so you luck out (at least it should be available, not sure when it was added): diff --brief -r dir1/ dir2/ .. 더보기
Linux storage stack diagram https://www.thomas-krenn.com/de/wikiDE/images/2/2d/Linux-storage-stack-diagram_v4.0.pdf 더보기
MBR 혹은 partition table dump 명령어, device node 로 부터 ufs, emmc dump dd if=/dev/block/vold/disk:8,0 of=/data/local/tmp/mbr-dump bs=512 count=1 dd if=/dev/block/vold/disk:179,64 of=/data/local/tmp/mbr-dump bs=512 count=1 dd if=/dev/block/vold/disk:179,0 of=/data/local/tmp/dump bs=512 count=1 - usb storage low image 위치 /dev/block/vold/disk:8,0 혹은 /dev/block/sda => dump 뜨면 MBR 부터 떠짐 /dev/block/sda1 => dump 뜨면 partition 부터 떠짐 /data/local/tmp/mbr-dump dd if=/dev/block.. 더보기
loop device and losetup 원문 : https://cafe.naver.com/taskers/10933 loop는 이미지파일을 블록 디바이스로 인식되게 해주는 디바이스 드라이버입니다.즉, 이미지 파일을 마운트 시켜줍니다. 쉽게 말해서 윈도우즈의 데몬툴이나 시디스페이스 같은 것이라 보면 됩니다.그러나 그 기능과 성능은 훨씬 강력합니다. 아래는 loop를 이용하여 100MB짜리 vfat 이미지를 마운트하는 예제입니다. 진행하려면 비지박스와 루팅은 필수입니다.터미널이나 ADB Shell에서 진행하세요. 1. 일단 dd를 이용해서 100메가짜리 공파일을 뜹니다. dd if=/dev/zero of=/mnt/sdcard/vdrive.img bs=1000000 count=100 dd : 덤프를 뜹니다. if=[덤프대상] of=[덤프결과]/dev.. 더보기
linux partitions (sda, sda1, sda2...) # cat partitions major minor #blocks name 1 0 8192 ram0 8 0 247087104 sda -> 디스크.. 보통 여기에 파티션을 만들지는 않는다. 8 1 204800 sda1 -> 실제 파티션 8 2 1048576 sda2 8 3 1048576 sda3 8 4 1048576 sda4 8 5 30720 sda5 8 6 102400 sda6 8 7 20480 sda7 8 8 30720 sda8 8 9 614400 sda9 8 10 17039360 sda10 8 11 225898444 sda11 8 16 4096 sdb 8 32 4096 sdc = 아래는 byte 단위 일듯 # cat size 494174208 # cat /sys/block/sda/sda1/start .. 더보기
std::string c++ 활용 예제 #include #include using namespace std; int main(){string str = "my name is"; // 확장str.append(" onegun");cout 더보기
std c++ vector 와 sort 사용법 예제 #include #include "iostream" #include #include using namespace std; typedef struct point{int a;char b;} t_pos; bool cmp(t_pos &A, t_pos &B) {return A.b < B.b;} int main(){cout 더보기
dtb(device tree blob) file parser(command) on linux fdtdump dtb_file.dtb > /tmp/test.txt 더보기
balloon driver balloon driver : Hypervisor 의 메모리 관리 기법중 하나 https://theithollow.com/2012/12/26/vmware-ballooning-explained/ 이 기법은 host 가 낮은 physical memory 상에서 동작할때만 유효한 기능이다. 만약 host 가 60 GB 의 physical memory 를 가지고 있고, VM 이 30GB만 alloc 한다면 이 기법은 생각할 필요가 없다. VM 에 할당한 메모리들은 active 하게 사용되지 않는다. VMware ballooning 은 기본적으로 host 에게 메모리를 돌려달라는 요구로 구성되어 있다. host 는 기본적으로 guest OS 들이 하는일을 모르고, guest OS 는 자신이 virtual 하다는 .. 더보기
PMU - Performance Monitoring Unit 원문 : http://cares.snu.ac.kr:8000/courses/emb/2013_1/assignment/2/Assignment2.pdfPMU - Performance Monitoring Unit PMU란 Performance Monitoring Unit으로 시스템 내부에서 발생하는 하드웨어 관련 이벤트 발생을 측정하는 카운터 레지스터를 통해 성능 분석을 지원하는 컴포넌트 더보기
rootfs rootfs 란? linux kernel 을 build 할때 가장 최 상의에 위치할 filesystem 의 폴더 경로를 ramdisk로 만들고 미리 package 화 한 binary /bin/dev/etc/lib/proc/root... 더보기
irq 용어 출처 : http://jiming.tistory.com/189 [지밍이 블로그] - 인터럽트 처리 방법 - 중첩을 허용하지 않는 인터럽트 처리 방법(Nonnested Interrupt Handler) - 중첩을 허용한 인터럽트 처리 방법(Nested Interrupt Handler) - 재진입 인터럽트 처리 방법(Reentrant Interrupt Handler) - 우선순위를 적용한 간단한 인터럽트 처리 방법(Prioritized Simple Interrupt Handler) - 우선순위를 적용한 표준 인터럽트 처리 방법(Prioritized Standard Interrupt Handler) - 우선순위를 적용한 다이렉트 인터럽트 처리 방법(Prioritized Direct Interrupt Handl.. 더보기
STL sort example (c++) with class, struct #include #include #include #include using namespace std; class t_A{public:int a;int b;}; #defineMAX30 t_Ag_AA[3][MAX]; bool comp_A(const t_A& a, const t_A& b) {return a.b < b.b;} void test_A_sort(){t_A* g_A = g_AA[0]; //initfor (int i = 0; i < MAX; i++) {g_A[i].a = i;g_A[i].b = i%7;} sort(g_A, g_A + MAX, comp_A); for (int i = 0; i < MAX; i++) {printf("%d %d\n", g_A[i].a, g_A[i].b);}} ///////////.. 더보기
cpp 의 sort 사용하기 예제 #include #include #include #include using namespace std; bool cmp(int a, int b) { return a 더보기
JAVA 입출력 출처 : JAVA programming참고하면 좋은 곳 : https://m.blog.naver.com/PostView.nhn?blogId=slrkanjsepdi&logNo=90140711064&proxyReferer=https%3A%2F%2Fwww.google.co.kr%2F@ . 1byte 입/출력 자바에서 처리하는 입력과 출력은 스트림(Stream)에 의존다시말해 모든 형태의 입력과 출력은 1byte의 흐름으로 이루어져 있다는것 *. 많이쓰이는 형식 @ . 1byte 출력 1. 콘솔 출력용 FileOutputStream fos = new FileOutputStream(FileDescriptor.out); BufferedOutputStream bos = new BufferedOutputStream(f.. 더보기
makefile(.mk) flag and blank issue If your flag has [blank] end of word, "ifeq" make miss understanding. ex)CONFIG_AAA := true [blank]ifeq ($(CONFIG_AAA), true)end So we need to use "strip" sentence when we use "ifeq" ifeq ($(strip $(CONFIG_AAA)),true) 더보기
SetUID / SetGID Special File Permissions 출처 : http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=10302&docId=128463841&page=1#answer1안녕하세요.. 답변이 될지 모르겠으나 Set UID / Set GID에 대해 설명드리겠습니다. Set UID는 chmod 4000 권한으로 실행되며, Set GID는 chmod 2000 권한으로 실행합니다.둘다 설정하시려면 6000 권한으로 설정 하시면 됩니다.( 여기서 000은 일반 퍼미션 이며, 파일 실행권한은 꼭 가지고 있어야 합니다. ) 파일 퍼미션 설정이 기본적으로 rwx/rwx/rwx 로 이런 식으로 설정이 되나,Set UID설정 시 rws/rwx/rwx로 변경.Set GID설정 시 rwx/rws/rwx로 변경.둘다 설정 시 rws/r.. 더보기
Sticky broadcast intent 원문 : http://newbiehc.blogspot.kr/2011/03/sticky-intent-sticky-broadcast-intent.htmlSticky intent (또는 Sticky broadcast intent)Sticky intent 는 말 그대로 끈적끈적한 intent 를 말합니다. ^^; 끈적끈적해서 자신의 역할을 수행한 뒤에도 메모리에 딱 달라붙어서 사라지지 않고 남아있는 것이죠. 보통의 broadcast 된 intent는 자신과 관련된 모든 Broadcast receiver 를 거치고 나면 임무 완료되어 ‘즐거운 퇴근길에 올라’ 메모리 상에서 제거됩니다. 하지만 Sticky intent는 임무 완료 후에도 메모리에 남아 있는다는 사실! (정확하진 않지만 해당 event에 대한 다음 .. 더보기
The result of getmntent() function The example codeFILE* fp = setmntent("/proc/mounts", "r"); if (fp == NULL) { ALOGE("Error opening /proc/mounts: %s", strerror(errno)); return -errno; } // Some volumes can be stacked on each other, so force unmount in // reverse order to give us the best chance of success. std::list toUnmount; mntent* mentry; while ((mentry = getmntent(fp)) != NULL) { if (strncmp(mentry->mnt_dir, path, path_len).. 더보기
Android uid 위치 (linux에서의 /etc/passwd 대신) /android/system/core/include/private/android_filesystem_config.h 45#define AID_ROOT 0 /* traditional unix root user */ 46 47#define AID_SYSTEM 1000 /* system server */ 48 49#define AID_RADIO 1001 /* telephony subsystem, RIL */ 50#define AID_BLUETOOTH 1002 /* bluetooth subsystem */ 51#define AID_GRAPHICS 1003 /* graphics devices */ 52#define AID_INPUT 1004 /* input devices */ 53#define AID_AUDIO .. 더보기
Intent 보내기 제한 (restriction) of Android /android/frameworks/base/core/res/AndroidManifest.xml 72 73 protected-broadcast 로 속성을 주면 system process 만 이 intent 를 보낼 수 있음 더보기