[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] mmap on petalinux-v0.10-rc1
Hi Everybody!
John, thanks for the answer! Well, I at least found out why my kernel
couldn't allocate the memory: I did not enable CONFIG_NO_MMU_LARGE_ALLOCS. On
my previous kernel this wasn't necessary, do you know why's that ?
Well, as you pointed on your answer, if I use MAP_PRIVATE on mmap, the kernel
will allocate memory, which is exactly what I'm trying to avoid. I already
implemented my function reading small chunks of the file, but I'd like to
know how to use mmap properly on uClinux. Thanks!
On Thursday 26 April 2007 02:15, John Williams wrote:
> Hi Leonardo,
>
> Leonardo Pereira Santos wrote:
> > I'm having some trouble using the mmap function on petalinux-v0.10-rc1.
> > I googled around but only found references to mmap not working with the
> > MAP_SHARED on uClinux-2.4.31-uc0 (
> > http://mailman.uclinux.org/pipermail/uclinux-dev/2005-August/034004.html
> > ) and the kernel version on petalinux-v0.10-rc1 is 2.4.32-uc0, so I tried
> > mmap with MAP_PRIVATE, but then I get
> >
> > Allocation of length 3319166 from process 54 failed
>
> In uClinux, a MAP_PRIVATE will cause the kernel to allocate a memory
> buffer of the desired size, and read the file into that buffer. This
> has resulted in an attempted memory allocation of approx 3mbyte, and
> that has failed in your example.
>
> > My situation is exactly like Arnaud Lagger's (
> > http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/archive/2006/01/ms
> >g00064.html ), I have a file sitting on a RAMFS dir and I want to write it
> > to flash directly. Reading uClinux for Linux Programmers, I found out
> > that the only filesystem that mmap actually does what I expect it to do
> > is ROMFS, which is not my case.
>
> Even on ROMFS, it requires the use of the MAGIC_ROM_PTR hack - I'll
> check to see if it is enabled, or what is required to get it going for
> MicroBlaze.
>
> > So I guess I'll have to find a workaround so not to allocate a buffer to
> > the file, as I don't have the memory to have the file twice in RAM, like
> > reading the file in small chunks. That's it ? Any suggestions are
> > welcome!
>
> Certainly spliting up your file reads is one solution. Not as
> convenient as an mmap() but workable.
>
> Regards,
>
> John
> ___________________________
> 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/
--
This is Linux country.
On a quiet night, you can hear Windows reboot.
Leonardo Pereira Santos |_|0|_|
Engenheiro de Projetos |_|_|0|
PD3 Tecnologia |0|0|0|
av. Para 330/202
(51) 3337 1237
Today Fortune tells us:
Maryel brought her bat into Exit once and started whacking people on
the dance floor. Now everyone's doing it. It's called grand slam dancing.
-- Ransford, Chicago Reader 10/7/83
___________________________
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/