tar 압출 풀기

tar xfj arm-2012.03-57-arm-none-linux-gnueabi-i686-pc-linux-gnu

 

/opt/ 밑으로 옮기기

mv arm-2012.03 /opt/


환경설정

vi ~/.bashrc

export PATH=/opt/arm-2012.03/bin:$PATH
# source ~/.bashrc

 

arm-none 정도 쳐보고 tab쳐서 나오면 패스 설정은 제대로 됬음을 확인 할 수 있다.

Posted by code cat


ctrl + q를 눌러주면 된다.  자세한 내용은 아래를 참조하자.

Screen CTRL-S Bug

When switching between terminals and text editors the occasional ctrl-s gets accidentally typed into the terminal. For along time I thought that this was a bug in screen but it is a standard terminal feature. Ctrl-s calls the software flow control method XOFF which stops the character flow to the terminal, which when you did not realise what you pressed just seems to freeze the terminal.

ctrl-q calls XON and starts the terminal again.

For a more permanent fix you can add this to your .bashrc (not sure how other shells are effected).

stty ixany

Which allows any character to call XON, so the character press is sent and displayed and you will never be aware of the terminal freezing.

If this does not work for you, or you also don't seem to be able to send ctrl-s ctrl-q commands to terminal applications you can use
stty stop undef To unmap ctrl-s
stty start undef To unmap ctrl-q

Or to stop XOFF and XON being sent from the keyboard but still allowing other software to send the commands use
stty ixoff -ixon
NB: ctrl-q can now be used to shutdown rtorrent

'리눅스 > 스크립트/유틸' 카테고리의 다른 글

.svn 지우기  (0) 2012.08.05
Code Sourcery 설치하기  (0) 2012.07.31
vi 검색한 내용 copy, paste 하기  (0) 2012.07.02
samba 로그인 정보 지우기/보기  (0) 2012.06.23
SVN in conflict  (0) 2012.06.21
Posted by code cat
리눅스/커널2012. 7. 20. 21:25
cache allocator 의 핵심:
1) 메모리를 각각 다른 사이즈의 오브젝트 들끼리 모아놓은 pool 들로 나누는 것
2) 메모리 할당에 대한 request가 오면 1)에서 맞는 사이즈를 가진 pool을 리턴

이런 pool들을 cache하고 하며 kmem_cache_t 의 타입으로 선언되어 있다. kmem_cache_t에는 cache에 대한 여러가지 정보를 담을 수 있는 변수들이 준비되어 있다.
kmem_cache_create()를 통하여 cache를 생성할 수 있다.
kmem_cache_create()는 caller에서 넘겨중 사이즈만한 cache를 생성하며 cache_cache라는 생성된 cache들의 global list에 넣는다.

cache_cache는 static kmem_cache_t 타입이며 시스템 전반적으로 cache들을 가지고 있다. 따라서 pool이 속해있는 object들의 사이즈는 sizeof(kmem_cache_t) 이다. 시스템 전반에 걸친 cache들에 대한 정보는 /proc/slabinfo에서 볼 수 있다. cache_cache외에도 cache들의 array 형태로 되어있는 일반적인 cache들이 있다. array마다 2배수로 커지는 사이즈 형태이며 각 사이즈별로 2개의 cache(일반 cache, DMA용 cache)가 있다. kmalloc()은 이 일반적인 cache들에서 맞는 사이즈의 cache를 찾고 __kmem_cache_alloc()으로 cache 오브젝트을 caller에게 넘겨주는 일을 한다.
유사하게 kfree() 은 __kmem_cache_free()으로 오브젝트를 cache에 돌려준다.

iPhone 에서 작성된 글입니다.

'리눅스 > 커널' 카테고리의 다른 글

boot memory allocator 의 필요성  (0) 2012.09.04
defunct 프로세스 죽이기  (0) 2012.08.16
리눅스커널 timestamp 찍는 법  (0) 2012.07.18
__user  (0) 2012.07.01
__initcall(), module_init()  (0) 2012.07.01
Posted by code cat
리눅스/커널2012. 7. 18. 07:42
linux kenel timestamp
--------------------------------------
include
include

char tbuf[50], *tp;
unsigned tlen;
unsigned long long t;
unsigned long nanosec_rem;
int this_cpu = smp_processor_id();

t = cpu_clock(this_cpu);
nanosec_rem = do_div(t, 1000000000);
tlen = sprintf(tbuf, "[%5lu.%06lu] ",
(unsigned long) t,
nanosec_rem / 1000);

iPhone 에서 작성된 글입니다.

'리눅스 > 커널' 카테고리의 다른 글

defunct 프로세스 죽이기  (0) 2012.08.16
kmalloc, cache allocator  (0) 2012.07.20
__user  (0) 2012.07.01
__initcall(), module_init()  (0) 2012.07.01
리눅스 커널 분석 시 아키텍쳐별 tag 및 cscope생성  (0) 2012.04.16
Posted by code cat

vim에서 검색한 내용 copy & paste 하기


vim에서 search 한 내용만 골라서 copy를 하고 싶을 경우 다음과 같이 하면 된다.


qaq

:g/검색어/y A

:let @+ = @a


처음 라인에서는 레지스터 a를 비운다.  (저 명령어는 매크로를 기록할 때 쓰는 명령어이다.)

두번째 라인에서는 뭐.. 알다시피 검색어를 찾아서 A 레지스터에 넣는다.

세번째 라인에서는 레지스터 A를 클립보드에 카피한다.


vim에서 검색한 내용 지우기


이건 쉽다.


:g/검색어/d


따로 설명할 필요 없으리라 믿는다.



한가지 검색한 거를 제외하고 위의 작업을 하고 싶을 땐 어떻하면 좋을까???


inverse를 떠올리면 된다!


:v/검색어/d


알고나니 참 좋은 기능이다.

'리눅스 > 스크립트/유틸' 카테고리의 다른 글

Code Sourcery 설치하기  (0) 2012.07.31
screen에서 ctrl+s 잘못 눌러서 먹통 됐을 때...  (0) 2012.07.23
samba 로그인 정보 지우기/보기  (0) 2012.06.23
SVN in conflict  (0) 2012.06.21
cpio vs tar vs cp  (0) 2012.06.11
Posted by code cat
리눅스/커널2012. 7. 1. 11:25

__user 로 타입이 정의된 변수는 kernel space 밖에 있다는 걸 의미한다.


예를 들어,


char __user *buff


라고 하면, 이는 user space안에 char *buff라고 선언한 것이다.


이를 이용해 kernel과 user 공간 사이의 communication(예: read/write )을 할 때 편리하게 쓸 수 있다. 


이와 함께 쓰이는 함수가 대표적으로 copy_from_user 와 copy_to_user가 있겠다.



stackoverflow에 보니 아래와 같은 질문이 있었다.

http://stackoverflow.com/questions/4521551/what-are-the-implications-of-the-linux-user-macro


I was hoping someone could explain the nuances of the __user macro used in the linux kernel source.

First of all, the macro:
# define __user __attribute__((noderef, address_space(1)))

Now, after some googling I read that this macro allows one to designate a pointer as belonging to the user address space, and that it should not be dereferenced.

I may be missing some obvious facts, but could someone please explain the implications of such a macro? For instance, what is a good example of where this macro would be of use? Again, forgive me if I am missing something obvious.

To put this in some context, I came accross the macro while examining some USB code (linux/usbdevice_fs.h). I am only looking for a general understanding of this macros( or others like it) use within the kernel.

Thanks for looking!
c macros linux-kernel kernel link|edit|flag asked Dec 23 '10 at 18:46

Mr. Shickadance
1,155624

82% accept rate

2

See do_execve() source for good example. See how argv is used in count(). If you'd simply dereference (*argv[0]) or something, sparse(1) will warn about it. address_space says not all pointers are equal, requiring different (dereference) rules and should not be mixed. – adobriyan Dec 24 '10 at 17:12


2 Answers
active
oldest
votes
up vote
4
down vote
accepted
It allows tools like sparse to tell kernel developers that they're possibly using an untrusted pointer (or a pointer that may be invalid in the current virtual address mapping) improperly.link|edit|flag answered Dec 23 '10 at 18:59

Michael Burr
117k11123313




up vote
3
down vote
I think __user marks user space pointers and tells the developer/system not to trust it. If user gives you "invalid" pointer, then kernel tries to reference it (note that kernel can reference everywhere) and it can corrupt it's own space.

For example in "read"(in you usbdevice_fs.h) should provide you a (__user) buffer to write the result to. So you have to use copy_to_user, but not memcopy, strcpy or anything like this.

Note: This is not formal definition/description, but the only part I'm aware of.


__user로 선언된 변수는 dereference를 할 경우 어떤 동작을 일으킬지 모르는 것 같다.(untrusted pointer라는 문맥)  저렇게 함으로서 개발자(?)에게 __user로 선언된 변수를 deference하지 말라고 표시 하는 거 같다.

Posted by code cat
리눅스/커널2012. 7. 1. 09:23

module_init() 매크로는 모듈형태로 컴파일시 module insertion time에 불린다.

만약 모듈형태로 컴파일 되지 않았으면, module_init()은 __initcall()과 같은 동작을 하는데 이는 boot time시에 불린다.


__initcall()은 다음과 같이 정의되어 있다.


#define __initcall(fn) \
static initcall_t __initcall_##fn __init_call = fn
#define __init_call __attribute__ ((unused,__section__ ("function_ptrs")))
#define module_init(x) __initcall(x);


'리눅스 > 커널' 카테고리의 다른 글

리눅스커널 timestamp 찍는 법  (0) 2012.07.18
__user  (0) 2012.07.01
리눅스 커널 분석 시 아키텍쳐별 tag 및 cscope생성  (0) 2012.04.16
Virtual Linux Manager 정리 1  (0) 2012.03.18
GCC, typeof  (0) 2012.02.23
Posted by code cat
samba 로그인 정보를 지우기 위해서는 다음과 같이 하면 된다

'net use /delete //192.168...'

현재 저장되어 있는 정보를 보려면 다음과 같이 하면 된다.

'net use'

iPhone 에서 작성된 글입니다.
Posted by code cat

가끔 svn에서 다음과 같이 충돌이 난다고 한다.


"svn: file_name remains in conflict"


이럴 땐, 당황하지 말고,


svn resolve --accept working file_name


하면 된다.   이래도 좀 더 꼬여서 안 될때가 있는데 그 때는 상위 디렉터리로 이동 뒤,


svn resolve --accept working -R .


하면 된다.


Posted by code cat

출처: http://stackoverflow.com/questions/2966409/cpio-vs-tar-and-cp

 

cpio가 tar보다 나은 점은 뭘까?

 

우선 cpio는 하드링크를 보존한다.  또한 cpio는 파일이름길이에 대한 제한이 없다. timestamp 또한 보존한다. 

스크립트를 쓸 때 파일들에 대한 통제가 편리하다는 점도 있다. 


find . -type f -name '*.sh' -print | cpio -o | gzip >sh.cpio.gz

참고로 find를 써서 많은 파일들의 리스트를 넘기려고 하면 command-line length가 overrun될 가능성이 있다.  그래서 이럴 경우, 중간 파일을 사용해 주는게 좋다.

cp에 대해선 다음에 더 알아보자.

Posted by code cat