# Why am I copying System.map to /boot?

## humble_programmer

After successfully building, tweaking, and installing multiple kernels on my Gentoo system, I'm left with one noobie question that I can't find a good answer to: "Why am I copying System.map to /boot?"  I can understand copying bzImage (duh) and even the .config file--so that it can be recovered after I bork up /usr/src/linux--but what's with System.map?  Does anything (other than the installation guide) use it?  What for?  Is that enough questions?

----------

## AliasXZ

System.map is a "map" of your kernel. It contains info about the entry points of the functions you compiled into your kernel, and de-bug information. The kernel itself knows the addresses and entry-points, but that file is needed for some programs which need info about kernel entry points.

----------

## Pink

Then again.....

After using many, many kernels including every final and rc candidate (with the 2.6 kernel and many with the 2.4 kernel), plus countless patchsets downloaded, plus countless of my own patchsets (I like to play  :Laughing:  ) I have never put the System.map in my boot folder and experienced zero concerns.

I have also looked and failed to find an answer as to why it is needed. 

Seen plently of posts like AliasXZ's which, in all due respect, was simply copied and pasted from here: http://www.aplawrence.com/Bofcusm/643.html and fail to answer why it is needed.

As I say, I have never, not once, had it in my boot partition and have tried, literally, hundreds of kernels, and had absolutely zero negative result from not having the System.map.

I would dearly love to see a proper explanation, with replicable examples i.e. show me what does not work correctly without System.map - my experience of searching for 'the' answer will result in posts like these two - some quoting someone else with no evidence of anything and all having a caveat (One of the first lines on the link above is 'Although there was no conclusive evidence') or people who have never used it and have seen no reason to use it.

Challenge on.....

PS I am serious, if anyone can find a real reason to use it then I will - it's just that I never have and have never seen any evidence to use it.

----------

## hielvc

Ive wondered about System.map myself  and never found a really good explaination till this morning Peter's Notes:System.map. This is an easy read with details of what it is and the several ways that it is used.

----------

## Pink

Interesting link - thanks. It does give a more concrete answer than I have seen before.

Hmmm, klogd looks in /usr/src/linux/System.map by default (amongst the other two places) and I don't use Dosemu. So that is probably why I have never run into any problems but it could be advisable to have it in /boot as a general rule.

An interesting thought though, and I may have missed when System.map is called upon by whatever prog uses it, but a default Gentoo install has a /boot partition that is not mounted.

Now, unless something unexpected is occuring, how would Dosemu get to the /boot/System.map?

Any pointers as to how something can access a file in a (deliberately) unmounted partition?

----------

## Pink

judging from the lack of response, the answer is that a programme is not able to read a file from an unmounted partition - exactly the reason a default Gentoo install does not mount /boot.

humble_programmer:

As you can see from the last 2 or 3 posts, there is absolutely no need whatsoever to have System.map in the boot partition. The only thing that could use it on bootup also searches for it in /usr/src/linux/System.map, which is another reason the symlink should always point to your working kernel, something you should always ensure occurs. Anything else is simply not able to read the file in /boot anyway.

HTH

----------

## hielvc

pink I agree its hard to read an unmounted partition. What Im curious about is why dont the progs check out /proc/ksyms or why is it there?

----------

## Pink

 *hielvc wrote:*   

> pink I agree its hard to read an unmounted partition. What Im curious about is why dont the progs check out /proc/ksyms or why is it there?

 

I honestly don't know - I'm not really into what calls what from where, if you see what I mean.

I think a more experienced programmer (which I am not) would be able to give more pointers. To be frank, my main concern these days is that it works and I'm not too concerned as to the technical details as to why. I just got into this thread as I truly believe that System.map always was a waste of space and effort (in the /boot partition).

edit: Oooh, that was my 1000th post!  :Laughing: 

----------

## pilla

Moved from IG

----------

## rowbin hod

I just assumed that it was a backup for the version in /usr/src/linux. Say you bork the source directory, then you have a backup of not only your config file (also saved in /boot) but also the system map for whatever needs it. 

And to me, /boot seems like an excellent place to keeps it for the reason that it isn't mounted by default. That way, you're never going to lose it through human error!

----------

## electrofreak

the program strace uses it. That program traces what programs do... for debugging purposes.

----------

## Jengu

 *electrofreak wrote:*   

> the program strace uses it. That program traces what programs do... for debugging purposes.

 

Does it look in /usr/src/linux first too though?

----------

## slashdevslashtty

Not first. Actually, third. But it does fall back on /usr/src/linux/System.map

----------

## Pink

 *slashdevslashtty wrote:*   

> Not first. Actually, third. But it does fall back on /usr/src/linux/System.map

 

That is the whole point - there is no need to have all these files lying around in /boot (unless you want a backup, but that's what a backup in a serperate hdd/partition is for surely?) I mean, how do you bork your entire /usr/src/linux directory? You have the same chance of 'accidentally' wiping your /etc directory or your /usr/bin directory as doing that.

So lets see:

Anything that might use it also looks in the place it is automatically put: /usr/src/linux

Nothing can see it /boot because /boot is deliberately not mounted - strace, etc cannot use it!

It comes down to a simple answer:

if you want System.map in /boot, then put it there. There is no technical reason why it should go there and no programme can access it when it is in /boot.

Not exactly compelling reasons for spending effort putting it there.

----------

