Install the new kernel to Ubuntu in the virtual machine

Source: Internet
Author: User

host operating system version: Windows ten
Virtual machine version: Workstation Pro
Virtual Machine operating system: Ubuntu 14.04
Linux kernel: 3.13.0
gcc version: 4.8.2

recently learn the Linux kernel, a lot of more classic books are 2.6.x source code to explain. So I'm going to install a 2.6.36 kernel in a Linux virtual machine. The steps are as follows:

(a) Download the source code
Kernel Download official website: www.kernel.org
Download the linux-2.6.36.tar.gz and unzip to the/USR/SRC directory
Enter the/usr/src/linux-2.6.36 directory, where future work is done under this directory
(ii) custom kernels
To save time in configuring the kernel, we copy the existing configuration in the system to the current directory
#sudo cp/boot/config-3.13.0-24-generic./.config
Execute configuration commands regardless of whether you need to customize the kernel yourself
#sudo make Menuconfig
and then save it and quit.
(c) Compile the kernel
here, there are many online articles are said to execute sudo make-j4, I compile this time without prompting error, but make install has the following message:
* * * Missing file:arch/x86/boot/bzimage
* * * need to run ' make ' before ' make install '.
instead, use #sudo make to compile
Here are a few errors that are encountered during the compilation process, where they and their workarounds are posted (but why is the compiler not prompting for errors with Make-j4?). )

Error One:
gcc:error:elf_x86_64:No such file or directory
gcc:error:unrecognized command line option '-M '
objcopy arch/x86/vdso/vdso.so
objcopy: ' arch/x86/vdso/vdso.so.dbg ': No such file
make[2]: * * * [arch/x86/vdso/vdso.so] Error 1
make[1]: * * * [ARCH/X86/VDSO] Error 2
Make : * * * [arch/x86] Error 2
Workaround: Modify the file Arch/x86/vdso/makefile, change "-M elf_x86_64" to "-m64"; change "-M elf_i386" to "-m32"

Error Two:
In file included from drivers/net/igbvf/ethtool.c:36:0:
Drivers/net/igbvf/igbvf.h:at Top level:
drivers/net/igbvf/igbvf.h:129: 15:error:duplicate member ' page '
Make[3]: * * * [DRIVERS/NET/IGBVF/ETHTOOL.O] Error 1
make[2]: * * * [DRIVERS/NET/IGBVF] Error 2
make[1]: * * * [drivers/net] Error 2
Make : * * * [drivers] Error 2
Workaround: Comment out 129 lines in drivers/net/igbvf/igbvf.h, and//struct page *page;

Error Three:
In file included from drivers/scsi/pmcraid.c:57:0:
Drivers/scsi/pmcraid.h:at Top level:
Drivers/scsi/pmcraid.h:601:8: error:duplicate member ' Sense_buffer '
drivers/scsi/pmcraid.c:in function ' pmcraid_abort_cmd ':
drivers/scsi/pmcraid.c:2940:33:warning:variable ' res ' set but not used [-wunused-but-set-variable]
drivers/scsi/pmcraid.c:in function ' Pmcraid_ioctl_passthrough ':
drivers/scsi/pmcraid.c:3745:5: warning:variable ' access ' set but not used [-wunused-but-set-variable]
drivers/scsi/pmcraid.c:in function ' pmcraid_check_ioctl_buffer ':
drivers/scsi/pmcraid.c:4052:6: warning:variable ' access ' set but not used [-wunused-but-set-variable]
Make[3]: * * * [DRIVERS/SCSI/PMCRAID.O] Error 1
make[2]: * * * [DRIVERS/SCSI] Error 2
make[1]: * * * [drivers] Error 2
make[1]: Leaving directory '/home/ashish/litmus-rt '
Make : * * * [Debian/stamp/build/kernel] Error 2
Workaround: Comment out 571 lines in Drivers/scsi/pmcraid.h, and//u8 *sense_buffer;
(iv) installation of the kernel
#sudo make modules_install Copy the kernel module to the/lib/modules/2.6.36 directory
#sudo make install copy the kernel image file and the Initrd file to the/root directory and generate the Grub configuration file
(v) Configuring GRUB
Although grub is automatically configured when you perform the make install, there is no grub selection interface when booting, and we also need some additional configuration
There are two ways to configure grub, one is to configure/boot/grub/grub.cfg directly, this way is very troublesome, the specific way Baidu, because I will not ...
Another way is to configure the/etc/default/grub file, and then run the #sudo update-grub generate the/boot/grub/grub.cfg file.
In order for the system to display the GRUB selection screen at boot, we need to add a line to the/etc/default/grub: Grub_timeout_style=menu.
for more configuration commands, check out info-f grub-n ' simple configuration '
        

Install the new kernel to Ubuntu in the virtual machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.