export_module 꼭이요!

iimec2의 이미지

void reg_write32(struct isp1762_dev *dev,__u16 reg,__u32 data)
{ 
        /* Write the 32bit to the register address given to us*/
        writel(data,dev->baseaddress+reg);
}/*Endof write32 */



__u32 reg_read32(struct isp1762_dev *dev,__u16 reg,__u32 data)
{ 

	data = readl(dev->baseaddress + reg);
        return data;
}/*End of reg_read32 */



__u16 reg_read16(struct isp1762_dev *dev,__u16 reg,__u16 data)
{ 
        data = readw(dev->baseaddress+reg);
	return data;
}


void reg_write16(struct isp1762_dev *dev,__u16 reg,__u16 data)
{ 
	writew(data,dev->baseaddress+reg);

}


__u8 reg_read8(struct isp1762_dev *dev,__u16 reg,__u8 data)
{ 

        data = readb(dev->baseaddress+reg);
       	return data;
}


void reg_write8(struct isp1762_dev *dev,__u16 reg,__u8 data)
{ 

        writeb(data,dev->baseaddress+reg);
       
}/

이런 함수가 있고요..
이 파일에 마지막에
EXPORT_SYMBOL(reg_write16);
EXPORT_SYMBOL(reg_read16);
EXPORT_SYMBOL(reg_read32);
EXPORT_SYMBOL(reg_write32);

EXPORT 하는 부분이 있는데
컴파일 하면
다음과 같은 에러가 나는데 ..어떻게 해야 할까요?
알려주세요!꼭이요!!!!

reg.c: At top level:
reg.c:1156: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1156: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1156: warning: data definition has no type or storage class
reg.c:1157: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1157: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1157: warning: data definition has no type or storage class
reg.c:1158: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1158: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1158: warning: data definition has no type or storage class
reg.c:1159: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1159: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1159: warning: data definition has no type or storage class
reg.c:1160: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1160: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1160: warning: data definition has no type or storage class
reg.c:1161: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1161: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1161: warning: data definition has no type or storage class
reg.c:1162: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1162: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
regc:1162: warning: data definition has no type or storage class
reg.c:1163: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1163: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1163: warning: data definition has no type or storage class
reg.c:1164: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1164: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1164: warning: data definition has no type or storage class
reg.c:1165: parse error before `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1165: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
reg.c:1165: warning: data definition has no type or storage class
pastime의 이미지

2.4 대의 커널인가요?
Makefile 에서 export-objs 항목에 reg.o 를 추가하세요.
없으면 만들어 주시면 됩니다.

gangyu의 이미지

export-objs 에 reg.o를 하고 싶지만
커널 컴파일 해서 make modules 하면 reg.o가 나오거든요..
그런데 make modules 하면 위에 같은 에러가 나오니까..
어떻게 해야될지..

pastime의 이미지

Makefile 을 보여주시면 도움이 될지도 모르겠군요..

gangyu의 이미지

TOPDIR := $(shell cd ..; pwd)

include $(TOPDIR)/Rules.make



SRC = reg.c





CFLAGS = -D__KERNEL__ -I$(INCLUDEDIR) -DOTG  -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common	 -O2 -DEXPORT_SYMTAB  



ifdef HAL_DEBUG

CFLAGS += $(DEBUG_FLAG) 

endif



#	DMA related flags

#	Use of this for data transfer between CPU and ISP1362 might not find

# 	improvement in speed under this implementation for ISA (needs to copy

#	the data from buffer to/from DMA buffer). Could be used as a sample code.

#CFLAGS += -DCONFIG_USB_PHCD_DMA







OBJ = $(SRC:.c=.o)



TARGET = reg.o



all: .depend $(TARGET)



$(TARGET): $(OBJ)

	$(LD) -r $^ -o $@

	

install: 

#	install -d $(KERN_INSTALL_DIR)

#	install -c $(TARGET) $(KERN_INSTALL_DIR)

	cp $(TARGET) $(OBJ_INSTALL_DIR)

clean:

	rm -f $(TARGET) $(OBJ) core .depend





depend .depend dep:

	$(CC) $(CFLAGS) -M *.c > $@





ifeq (.depend,$(wildcard .depend))

include .depend

endif

makefile입니다.
pastime의 이미지

커널에 포함되지 않는 별도의 Makefile 로 관리하시는 것 같네요.
EXPORT_SYMTAB 이 정의되어 있는데도 위와 같은 에러 메시지가 나오는 건 좀 이상하군요..
뭔가 내부적으로 빠진 부분이 있을수도 있으니
커널에서 사용하는 방식의 Makefile 을 아래와 같이 작성하셔서 컴파일 해보시기 바랍니다.

O_TARGET := misc.o

export-objs := reg.o

CFLAGS_reg.o := -DOTG -O2

#obj-$(CONFIG_REGDRIVER) += reg.o 
obj-m += reg.o

include $(TOPDIR)/Rules.make

fastdep:

reg.c 파일이 drivers/misc 밑에 있다고 가정하면 다음과 같이 해보세요.

Quote:
make SUBDIRS=drivers/misc modules
iimec2의 이미지

네 커널에 포함되지 않은 makefile입니다. 보드에 포팅하려고 하는데
보드에 커널에서 제공하지 않는 드라이버를 사용해야 되기 때문에 이 드라이버를 추가 시켜서 컴파일 해야합니다. 소스는 제공되었구요..makefile또한 위와 같습니다. 처음에는 많은 에러가 있었는데,, 이제는 이것만 해결하면 되는데 잘 안되네요..

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.