Kernel Module Programming

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2021 Aug 5 11:23
Editor
Edited
Edited
2023 Oct 17 17:32
커널 모듈은 최소 두가지 entry function을 갖추고 있어야
Kernel Module Programming Notion
 
 
Kernel Module Programming Tools
커널 모듈 프로그램은 gcc 컴파일러와 표준 라이브러리 대신에 별도의 컴파일러와 헤더를 이용해야
즉, 커널 모듈을 위한 c 언어 규칙은 gcc 컴파일러를 기준으로 작성하는 일반 c 언어와 다른 부분이 있다. Makefile 규칙 역시 다르다
커널 모듈 프로그래밍시 커널 버전에 따라 커널 모듈에서 사용할 수 있는 함수나 구조체가 다르므로 각 버전에 해당하는 가이드 문서를 통해 확인해볼 것을 권장한다
컴파일된 커널 모듈은 터미널에서 sudo insmod 명령어를 통해 커널에 등록되는데, 이때 module_init()을 통해 등록된 함수가 실행된다. 커널 모듈은 터미널에서 sudo rmmod 명령어를 통해 커널에서 제거되는데, module_exit()을 통해 등록된 함수가 실행된다
 
 
 
4. Kernel Modules — Linux Kernel Workbook 1.0 documentation
We generally do not make changes directly to the core kernel code. We mostly write small modules to be added to the kernel. This way we can separate out our changes from the mainline kernel.
Linux Kernel module programming
Kernel module? 모듈은 사용자의 혹은 커널의 요구로 읽혀지거나 아니면 없어지는 코드들로 이루어진 프로그램의 어떤 한 조각을 의미한다. 커널은 하나의 큰 모듈들의 집합이라고 볼 수 있다. 모듈들을 통해서 필요할때 더 추가, 혹은 제거를 통해서 커널을 다시 컴파
Linux Kernel module programming
Linux Module to print number of CPU's
We can look at /proc/cpuinfo to find out the number of processors present in Linux from user space. What if we want to find out the nu...
Linux Module to print number of CPU's
 
 

Recommendations