에 장치 드라이버를 컴파일,하지만 난 다음 오류, 내가 사용하여 다음을 프로그램을 컴파일러
나는 장치 드라이버를 컴파일하기 위해 노력하고있어 커널
[email protected]:~/Desktop$ make
make -C /lib/modules/4.13.0-19-generic/build M=/home/ddd/Desktop modules
make[1]: Entering directory '/usr/src/linux-headers-4.13.0-19-generic'
CC [M] /home/ddd/Desktop/message_slot.o
/home/ddd/Desktop/message_slot.c:23:10: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^~~~~~~~~
compilation terminated.
scripts/Makefile.build:309: recipe for target '/home/ddd/Desktop/message_slot.o' failed
make[2]: *** [/home/ddd/Desktop/message_slot.o] Error 1
Makefile:1546: recipe for target '_module_/home/ddd/Desktop' failed
make[1]: *** [_module_/home/ddd/Desktop] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.13.0-19-generic'
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 2
[email protected]:~/Desktop$
다음의 모든 헤더 같은 하나를 얻을 메이크 :
obj-m := message_slot.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean
것은, 즉 작은 .c 인 코드를 실행하여 :
#include <stdio.h>
#include <stdli.h>
int main(){
printf("test");
}
을
gcc test.c -o test
모든 것이 컴파일됩니다. 커널 헤더가있는 것으로 의심되지만 모든 헤더를 지정된대로 다운로드했습니다. 나는 윤활유를 타고있다 17.10
내가 뭔가를 놓친가요?
덕분에 많은
가능한 [장치 드라이버 내에서 stdlib.h 사용] (https://stackoverflow.com/questions/23150611/using-stdlib-h-within-a-device-driver) 중복 가능성 있음 –
생각하지 않습니다. 중복, 왜냐하면 내가 문제를 정확하게 식별 할 수 없지만 완전히 내 문제를 해결했습니다. 고마워요. – DsCpp
[커널 오류 컴파일 : stdio.h : 해당 파일이나 디렉토리가 없습니다.] (https://stackoverflow.com/questions/10345778/compiling-kernel-error-stdio-h-no-such-file) - 또는 - 디렉토리) – Tsyvarev