You can install the mainline kernel from the ppa
http://kernel.ubuntu.com/~kernel-ppa/mainline/
Or you can compile it yourself
https://help.ubuntu.com/community/Kernel/Compile
The problem you are going to have with those options is twofold
Neither the mainline kernel or compiling a newer kernel are going to have the standard set of patches Ubuntu applies, most notable is Apparmor.
Any packages that depend on the kernel, Virtualbox, nvidia, wireless, etc, might not work.
You would need to debug those things yourself or wait for the Kernel team to release an updated kernel. Support for the mainline kernel or custom kernel is limited, more so for third party packages such as virtualbox , nvidia drivers, etc.
I am not trying to either encourage or discourage you, just pointing you in the right direction. I have been using a custom kernel on gentoo for almost 2 years now, but doing so requires a moderate amount of effort on my part.
From the kernel team FAQ
The mainline kernels builds are produced for debugging purposes and therefore come with no support. Use them at your own risk.
Your other option is to build a custom kernel. This is also poorly supported and requires some advanced knowledge
See https://help.ubuntu.com/community/Kernel/Compile
Building and using a custom kernel will make it very difficult to get support for your system.
While it is a learning experience to compile your own kernel, you will not be allowed to file bugs on the custom-built kernel (if you do, they will be Rejected without further explanation).
Your best option may be to install 12.04. Be warned it is in beta at the moment, you might want to wait for the release.
- You may be better off filing a bug report
How do I report a bug?
It appears to me that it is fglrx, the proprietary ATI binary driver, that isn't compatible with the 3.4 kernel. dkms is trying to process the headers for interfacing with it. I assume its trying to compile an interface module.
This makes a certain amount of sense since Ubuntu gets new vendor drivers sometime in the development cycle for new releases and 3.4 isn't in a production Ubuntu release. I believe the Ubuntu kernel team's website mentions that binary only drivers might not be compatible with these packages.
Since you are experimenting I'd suggest that you remove the fglrx driver and use the default radeon one in your current system, and then try the updgrade again. Without fglrx installed there shouldn't be a dkms hook to rebuild anything fglrx related.
After you get it going you might look to the quantal archives for a more up to date fglrx package that would be compatible with the 3.4 kernel. Then you will really be on the cutting edge (or really out on a limb).
You might also see Nvidia drivers don't work with mainline kernel for what someone using an nvidia proprietary driver did.
If it's any encouragement I was able to upgrade to 3.5 for a while in the last week, but I don't run fglrx. I did have to reinstall a libllvm package to keep unity-3d working and never found out why.
Best Answer
These are just names.
At this time, the latest available Ubuntu kernel for 12.04 is 3.8. The mainline kernels are not suggested for installation, except if you are doing tests or you experience a major problem that it can be resolved with a specific mainline kernel. Please read more about mainline kernels here.
Because of the LTS feature of 12.04 many different kernels will be backported from newer versions of Ubuntu and X-stack as well. The 12.04.3 version (that will be released in 22 August 2013) will have 3.8 kernel and X-stack all backported from Ubuntu 13.04 (raring).
As I said, the latest available Ubuntu kernel is 3.8 and you can install it in 12.04 from a terminal. (or a GUI package manager, e.g synaptic, software center).
Open a terminal (CTRL+ALT+T) and issue the following commands
When the installation completes, reboot your system to boot from 3.8 kernel. Grub bootloader always list the newer kernel first, so it will boot from 3.8 automatically (except if you have installed a newer than 3.8).