#warning Using kernel header in userland 라는 메시지

ecsahn의 이미지

안녕하세요. 드바이스 드라이버를 새로 시작하는 초보입니다.

헤더파일에서 에러가 나서 헤메고 있는데요.

#include "linux경로/linux/module.h"
#include "linux경로/linux/kernel.h"
#include "linux경로/linux/malloc.h"
#include "linux경로/asm/uaccess.h"

void main()
{ }

이라는 아무 의미없는 c파일이 컴파일이 안됩니다.
레드햇9.0 배포판 gcc를 사용하면
#warning Using kernel header in userland 라는 메시지가
자주 뜨고 결국 컴파일이 안되는데요. (다른 메시지도 많습니다)

arm x-scale용 크로스컴파일gcc를 이용하면 에러없이 잘됩니다.
(헤더 물론 경로는 맞추었구요.)

gcc -D__KERNEL__ -D_LINUX -DMODULE -O2 -c test.c
라는 컴파일 옵션을 주었구요.

왜 유저모드에서 커널해더를 사용했다는 메시지가 뜨는지
모르겠네요.. 그리고 레드햇 배포판에는 asm/uaccess.h가 있고
asm-i386/uaccess.h가 있는데 pc용으로 어떤걸 사용해야 하나요?

답변 부탁드릴께요. 즐거운 주말 되세요.

pastime의 이미지

제가 레드햇을 쓰지 않아서 확신할 수는 없지만
웹 검색을 통해 찾아본 결과

/usr/include/linux 쪽의 헤더파일이
커널 소스에 있는 것과 달라서 나오는 문제라고 생각됩니다.

레드햇에서 모듈을 개발하시려면
커널 소스 패키지를 따로 설치해야 하는 것 같습니다.

그리고 include 디렉토리 및의 asm 은
현재 아키텍처의 asm 디렉토리를 가리키는 심볼릭 링크이기 때문에
asm 과 asm-i386 은 동일한 디렉토리가 됩니다.

모듈 프로그래밍 시작하시는 것 같은데
소스 내에서 include 할때 경로를 다 지정하지 마시고
#include "linux/module.h" 와 같은 형식으로 작성한 후에
gcc 의 I 옵션을 이용해서 커널의 헤더 파일이 있는 경로를 추가하시기 바랍니다.
그리고 모듈은 main 함수가 필요없답니다.. 8)

xibin의 이미지

제가 레드햇을 쓰는데 위엣분 말씀이 맏습니다.

레드햇 9.0은 이상하게도...

커널은 2.4.20-8인데... 소스 패키지는 2.4.20이라서..

모듈 컴파일해서 돌리려고 하면.. 띠릭..하구 에러가 나더라구요.

I'm a novice, guys.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.