작업 환경
-메인 OS : Windows 8.1K(Intel Core i5-4590)
-작업 OS : Ubuntu 14.04.5 LTS 64bit(VirtualBox)
-장 비 명 : Hybus-Smart4412
1. 초기설정
- cd ~/Smart4412/Development/Source/Kernel/kernel_4412/kernel
- hellocall.c를 만든다
hellocall.c
2. Kernel에 코드 등록
- cd /Smart4412/Development/Source/Kernel/kernel_4412/kernel
- vim Makefile
- obj-y 끝에 hellocall.o 추가
- cd /Smart4412/Development/Source/Kernel/kernel_4412/arch/arm/include/asm/
- vi unistd.h
- #define __NR_hellocall (__NR_SYSCALL_BASE+376) 추가
- cd /Smart4412/Development/Source/Kernel/kernel_4412/include/linux
- cd /Smart4412/Development/Source/Kernel/kernel_4412/arch/arm/kernel
- calls.S ->커널 시작시 가장 먼저 시작하는 파일
3. Kernel 파일 생성 및 Porting
- cd /Smart4412/Development/Source/Kernel/kernel_4412
- make distclean
- ./build_kernel
- 만들어진 zImage만 다시 올린다 (http://cccding.tistory.com/56 (5.Kernel Porting) 참조)
4. syshello.c 작성 후 H-Smart4412에서 실행
- mkdir device(device 디렉토리에 syshello.c를 만든다)
syshello.c
#include<stdio.h> #include</home/cjs/Smart4412/Development/Source/Kernel/kernel_4412/arch/arm/include/asm/unistd.h> int main() { syscall(__NR_hellocall); return 0; } |
- /opt/gnueabi/opt/ext-toolchain/bin/arm-linux-gnueabihf-gcc syshello.c -o syshello (해당 디렉토리에서 컴파일)
- 위에서 수정한 unistd.h를 include 시켜줘야 정상 작동.
- Tera term으로 이동 (http://cccding.tistory.com/58 에서 1) 참조)
- 해당 파일 업로드 후 실행시키면 Hello ~ sys call 출력
'Embedded > Device Driver' 카테고리의 다른 글
[Device Driver] 대소문자 변환 Device Driver 만들기 (0) | 2016.12.28 |
---|---|
[Device Driver] A~Z 출력 (0) | 2016.12.27 |
[Device Driver] 커널에 Device Driver 등록 및 실행 (1) | 2016.12.26 |
[Device Driver] Kernel에 hello.c 등록 (0) | 2016.12.26 |