Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Could not mmap file: vmlinux

Tags:

linux

kernel

mmap

In a newly installed virtual machine I get this error when compiling the kernel for the x86 architecture:

$ Could not mmap file: vmlinux

$ make: *** [vmlinux] Error 1

It is the first time I see it. I have increased the size of /proc/sys/kernel/shmmax to 128MB, but it does not solve the issue. Any ideas?

Thanks! :)

like image 811
user3018391 Avatar asked May 29 '14 15:05

user3018391


People also ask

What does mmap do in Linux?

The mmap() function establishes a mapping between a process' address space and a stream file. The address space of the process from the address returned to the caller, for a length of len, is mapped onto a stream file starting at offset off.

How does mmap work in C++?

What Does mmap() Function? mmap() function or system call will create a mapping in the virtual meory of the current process. The address space consist of multiple pages and each page can be mapped some resource. We can create this mapping for a resources we want to use.

What is FD in mmap?

mmap() is used for creating a memory mapping somewhere in virtual memory (somewhere which can be referenced to by the process issuing mmap). Specifying a file descriptor allows the memory to be swapped out to disk.

What does mmap return?

mmap() returns a pointer into the newly mapped memory. This pointer points into the address space seen by the program and can be used like any other pointer of type void* .


1 Answers

I had the same issue when compiling kernel in virtual box shared folder. Error comes from mmap_file() function in source file scripts/sortextable.c. Moreover, all mmap functions failed with errno EINVAL within shared folder.

I fixed it with copying linux sources into non shared folder like /home/Name/linux and compiled there.

like image 153
Jurasic Avatar answered Sep 27 '22 22:09

Jurasic