[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] Compile loadable kernel modules



My previous mail was wrong. That was for the application i wrote on
top of it. See the makefile below.

===============================================
CC = mb-gcc

CC_OPTION = -I/home/mblaze/linux/kernel/uClinux-2.4.x/include  -Wall
-Wstrict-prototypes -Wno-trigraphs -g -fno-strict-aliasing -fno-common
-DPLATFORM=uclinux-auto -O2 -fno-builtin -DNO_MM -DNO_FPU -D__ELF__
-DMAGIC_ROM_PTR -DUTS_SYSNAME="uClinux" -D__linux__
-I/opt/crosstool/microblaze-elf-tools/bin/../lib/gcc/microblaze/3.4.1/./include
-mno-xl-soft-mul -nostdinc -DKBUILD_BASENAME=test -iwithprefix include

MODULE_OPTION = -D__KERNEL__ -DMODULE

LD = mb-ld

LD_OPTION = --defsym _STACK_SIZE=0x00
STRIP = mb-strip

all:    test test.o
# all:  test.o

test.o: test.c
        ${CC} ${CC_OPTION} ${MODULE_OPTION} -c -o test.o test.c

test:   test.o test.c
        ${LD} ${LD_OPTION} -r -o test test.o
#       ${STRIP} test.o

====================================================
Used the following header files
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/init.h>


Again, sorry for the previous mail.
- Prasad



>
> On 1/22/06, Oscar Sánchez <dav18284@xxxxxxxxx> wrote:
> >
> >
> > Hi,
> > I'm trying to compile a loadable module for a char device. Here is my
> > Makefile:
> > TARGET := char_dev_ex
> >
> > WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
> >
> >
> >
> >
> > INCLUDE := -isystem
> > /home/oscar/uClinux_src/uClinux_tmp/uClinux/uClinux-dist/linux-2.4.x/include
> >
> >
> >
> >
> > CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
> >
> > CC := mb-gcc
> >
> >
> >
> > ${TARGET}.o: ${TARGET}.c
> >
> >
> >
> >
> > .PHONY: clean
> >
> >
> >
> >
> > clean:
> >
> >  rm -rf ${TARGET}.o
> >
> >  With this Makefile I have successful build some simple modules that only
> > include linux/kernel.h and linux/module.h. But when I need to include
> > linux/fs.h and asm/uaccess.h the compilation process shows a lot of warnings
> > and don't finish correctly.
> >
> > What should I add to the Makefile??Thanks...
> >
> > Oscar.
>

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/