EmbLogic's Blog

Undefined error for .ko file !!

scull_follow pointer is defined as:

dptr=scull_follow(localptr,item);

here localptr is struct scull_dev pointer and item is an integer value giving us 1 less than the total number of qsets required.

This is the message i get,when i comment the scull_follow pointer:

make  -C /lib/modules/2.6.32.16-150.fc12.i686.PAE/build M=/project/13oct modules
make[1]: Entering directory `/usr/src/kernels/2.6.32.16-150.fc12.i686.PAE’
CC [M]  /project/13oct/asng1.o
/project/13oct/asng1.c: In function ‘scull_write’:
/project/13oct/asng1.c:220: warning: ‘dptr’ is used uninitialized in this function
/project/13oct/asng1.c: In function ‘scull_read’:
/project/13oct/asng1.c:180: warning: ‘dptr’ may be used uninitialized in this function
Building modules, stage 2.
MODPOST 1 modules
WARNING: “__moddi3″ [/project/13oct/asng1.ko] undefined!
CC      /project/13oct/asng1.mod.o
LD [M]  /project/13oct/asng1.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.32.16-150.fc12.i686.PAE’

This is the message i get when i uncomment the scull_follow pointer:

make  -C /lib/modules/2.6.32.16-150.fc12.i686.PAE/build M=/project/13oct modules
make[1]: Entering directory `/usr/src/kernels/2.6.32.16-150.fc12.i686.PAE’
CC [M]  /project/13oct/asng1.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: “__moddi3″ [/project/13oct/asng1.ko] undefined!
WARNING: “__divdi3″ [/project/13oct/asng1.ko] undefined!

CC      /project/13oct/asng1.mod.o
LD [M]  /project/13oct/asng1.ko
make[1]: Leaving directory `/usr/src/kernels/2.6.32.16-150.fc12.i686.PAE’

This is the code for scull_follow:

scull_qset* scull_follow(Scull_dev *localptr,int n)
{

scull_qset *qs;
qs=localptr->data;     /**/

if(qs==NULL)    /* means ki qs k pass address nai hai */
{
qs=localptr->data=kmalloc(sizeof(scull_qset),GFP_KERNEL);/* here we r creating a struct scull_qset */
if(qs==NULL)
{
return NULL;
}
memset(qs,”,sizeof(scull_qset));
}

while(n>0)
{
if(qs->next==NULL)
{
qs->next=kmalloc(sizeof(scull_qset),GFP_KERNEL);
if(qs->next==NULL)
{
return NULL;
}
memset(qs->next,”,sizeof(scull_qset));
}
qs=qs->next;
n–;
}
return qs;

}

One Response to Undefined error for .ko file !!

  1. sumit sharma says:

    Hello ,
    WARNING: “__moddi3? [/project/13oct/asng1.ko] undefined!
    WARNING: “__divdi3? [/project/13oct/asng1.ko] undefined!
    Error which you have mentioned in this blog is due to usage of / and % operator , u must used these operators in your scull_follow function .

Leave a Reply to sumit sharma Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>