Forums

Trying to compile GPIO driver as a kernel module with the Leopardboard 355

This question is not answered

Hi,

I'm trying to compile a custom gpio driver for the Leopardboard 355.  I actually got the driver from this website:

http://e2e.ti.com/support/embedded/f/354/t/7633.aspx

I'm trying to compile the driver and am getting errors with the PHYS_OFFSET not being defined.  Here is the error message:

*************************

 

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -C /home/billy/DM355SDK840402/kernel/linux-2.6.29  M=/home/billy/DM355SDK840402/kernel/linux-2.6.29/drivers/DavinciGPIOExample modules

make[1]: Entering directory `/home/billy/DM355SDK840402/kernel/linux-2.6.29'

  CC [M]  /home/billy/DM355SDK840402/kernel/linux-2.6.29/drivers/DavinciGPIOExample/user_gpio.o

In file included from /home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/page.h:189,

                 from include/linux/mmzone.h:20,

                 from include/linux/gfp.h:4,

                 from include/linux/kmod.h:22,

                 from include/linux/module.h:13,

                 from /home/billy/DM355SDK840402/kernel/linux-2.6.29/drivers/DavinciGPIOExample/user_gpio.c:11:

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h: In function ‘virt_to_phys’:

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h:160: error: ‘PHYS_OFFSET’ undeclared (first use in this function)

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h:160: error: (Each undeclared identifier is reported only once

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h:160: error: for each function it appears in.)

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h: In function ‘phys_to_virt’:

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h:165: error: ‘PHYS_OFFSET’ undeclared (first use in this function)

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h: In function ‘virt_to_bus’:

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h:188: error: ‘PHYS_OFFSET’ undeclared (first use in this function)

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h: In function ‘bus_to_virt’:

/home/billy/DM355SDK840402/kernel/linux-2.6.29/arch/arm/include/asm/memory.h:193: error: ‘PHYS_OFFSET’ undeclared (first use in this function)

make[2]: *** [/home/billy/DM355SDK840402/kernel/linux-2.6.29/drivers/DavinciGPIOExample/user_gpio.o] Error 1

make[1]: *** [_module_/home/billy/DM355SDK840402/kernel/linux-2.6.29/drivers/DavinciGPIOExample] Error 2

make[1]: Leaving directory `/home/billy/DM355SDK840402/kernel/linux-2.6.29'

make: *** [driver] Error 2

****************************************

Here is my Makefile:
***************************
obj-m   := user_gpio.o
KDIR    ?= $(DEVDIR)/kernel/linux-2.6.29
driver:
        $(MAKE) ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -C $(KDIR) M=$(PWD) modules
clean:
        rm -rf *.ko *.o *.mod.c .tmp_versions *.symvers usbtest reg led
*****************************
I'm not totally sure why the PHYS_OFFSET is not defined.  In the memory.h file, I did find a #ifdef CONFIG_MMU block of code that would #define the PHYS_OFFSET along with other stuff, but apparently CONFIG_MMU must be define somewhere since PHYS_OFFSET isn't getting defined.

Any help would be greatly appreciated.
Thanks,
Billy

 

All Replies
  • So after a lot of troubleshooting and googling, I figured something out that worked.

    I opened the file:

    $(DEVDIR)/kernel/linux-2.6.29/arch/arm/mach-davinci/include/mach/memory.h

    and then uncommented the line (line 26):

    #define PHYS_OFFSET DAVINCI_DDR_BASE

    and then I ran the Makefile again and it worked; however, you have to re-comment that line in order to be able to re-compile the RR filesystem.  I don't know how this worked, but I'm guessing this is some kind of bug.

    I hope this can help somebody.

    Billy