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

[microblaze-uclinux] mmap on petalinux-v0.10-rc1



Hi Everybody!

	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
Free pages:       15740kB (     0kB HighMem)
Zone:DMA freepages: 15740kB
Zone:Normal freepages:     0kB
Zone:HighMem freepages:     0kB
( Active: 94, inactive: 1881, free: 3935 )
1*4kB 1*8kB 1*16kB 1*32kB 1*64kB 0*128kB 1*256kB 0*512kB 1*1024kB 7*2048kB = 
15740kB)
= 0kB)
= 0kB)

My call is like this:

fw_buf = (unsigned char*) mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, fw_fd, 
0);
fw_buf is a char*,
sbuf is a stat structure,
fw_fd is a integer.

My situation is exactly like Arnaud Lagger's ( 
http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/archive/2006/01/msg00064.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.
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!

Thank you!

-- 
Leonardo Pereira Santos     |_|0|_|
Engenheiro de Projetos      |_|_|0|
PD3 Tecnologia              |0|0|0|
av. Para 330/202
(51) 3337 1237

Today Fortune tells us:


... but hey, this is Linux, isn't it meant to do infinite loops in 5
seconds?
		-- Jonathan Oxer in the apt-cacher ChangeLog
___________________________
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/