[uClinux-dev] Re: uClinux-dist-test-20050808 released for testing

Robin Getz rgetz at blackfin.uclinux.org
Tue Oct 11 11:21:28 EDT 2005


According to Matt Waddel, Greg Ungerer wrote:
>  > Has anybody tried loadable modules in the 20050906
>  > 2.6.x release?
>
>The underlying mmap implementation for uClinux changed
>a couple of 2.6 kernels back. I suspect this stems from
>those changes. But I'll need to dig deeper.

We ran into this as well. And Sonic dug into it, and got a temporary
solution.

According to the description in file Documentation/nommu-mmap.txt, the mmap
infrastructure for shared memory map in NOMMU architecture was changed in
kernel 2.6.12.

To provide shareable character device support, a driver must provide a
file->f_op->get_unmapped_area() operation. It should also provide backing
device information with capabilities set to indicate the permitted types
of mapping on such devices.

But most of the filesystem drivers don't implement the necessary callback
function and configuration in kernel 2.6.12. System call to mmap with
MAP_SHARED flag will fail for most uClinux architectures (including blackfin).

So, Sonic worked around this issue in our cvs by changing flag
MAP_SHARED to MAP_PRIVATE. Then, modules work just as they were in older
kernels.

Quick and dirty hack:

uClinux-dist/linux-2.6.x/mm/nommu.c

--- nommu.c     6 Sep 2005 09:22:48 -0000       1.7
+++ nommu.c     8 Sep 2005 09:15:30 -0000       1.8
@@ -411,6 +411,15 @@


                 if (!file->f_op || !file->f_op->mmap)
                         return -ENODEV;

+               /* Most of the filesystem drivers don't implement the 
necessary callback function
+                * and configuration. System call to mmap with MAP_SHARED 
flag will fails for blackfin.
+                * Walk around it by change flag MAP_SHARED to MAP_PRIVATE,
+                */
+#ifdef CONFIG_BFIN
+               flags |= MAP_PRIVATE;
+               flags &= !MAP_SHARED;
+#endif
+
                 /* work out if what we've got could possibly be shared
                  * - we support chardevs that provide their own "memory"
                  * - we support files/blockdevs that are memory backed
=======================

The long term solution is to implement the necessary callback functions in 
the filesystem drivers.

Does anyone know if anyone is working on this?

-Robin





More information about the uClinux-dev mailing list