Ubuntu compiles and installs the Linux 4.0.5 kernel, and fixes the vmware network kernel module compilation error, ubuntu4.0.5

Source: Internet
Author: User

Ubuntu compiles and installs the Linux 4.0.5 kernel, and fixes the vmware network kernel module compilation error, ubuntu4.0.5

.

.

.

.

.

I upgraded Ubuntu 14.04 to the latest 4.0.5 kernel version. I didn't plan to record it, But I encountered some problems during the upgrade, So I recorded it, share it with yuanyou who have encountered the same problem.

Go to the official website to download the latest kernel compressed package: https://www.kernel.org/

The network speed is not good. You can only download it from the VM and copy it again.

LZ copies the source code package to/usr/src and compiles and installs the package directly here:

# Switch to the root identity> $ su # decompress the source code, get the folder/usr/src/linux-4.0.5> # tar xvf linux-4.0.5.tar.xz> # cd linux-4.0.5 # make mrproper command to clear the temporary files left at previous compilation # Because LZ is the new package for decompression, so this step is not required> # make mrproper # copy the currently used kernel compilation configuration file as the template> # cp/boot/config-'uname-R '. config # Start the graphic configuration interface drawn based on the ncurse library. The related options have been selected according to the current Kernel configuration, enable some new features> # make menuconfig # normally, you need to execute the following three commands, but on Ubuntu, you don't have to worry about it.> # make install> # make modules> # make modules_install # Ubu Ntu can use the Package Manager to compile the kernel and related modules into a deb package. Do you think it is much easier to get familiar with Ubuntu? # If you are prompted that the make-kpkg command is not available, you can install the command with apt-get> # apt-get install kernel-package #> make-kpkg clean # the same as the make command, the j8 parameter can be compiled by eight threads at the same time #> make-kpkg -- initrd kernel-image kernel-headers-j8 # After compilation is completed, two deb packages will be generated in the preceding directory, next install them:> # dpkg-I linux-image-4.0.5_4.0.5-10.00.Custom_amd64.deb> # dpkg-I linux-headers-4.0.5_4.0.5-10.00.Custom_amd64.deb
# Grub does not need to be updated. It is automatically updated when deb is installed.
> # Update-grub
# Restart the system and enter the new kernel.
> # Reboot

Compilation, installation, and restart are all successful, but we found that we had to update the kernel module when starting vmware in the new kernel. However, when compiling the network module, we couldn't go through it, LZ probably guessed that some interfaces in the kernel were modified, but the source code of the vmware driver does not match the latest kernel interface. Therefore, some syntax errors were reported, and no way was found, it can only be manually modified.

Start vmware in shell and let it compile and install the module by itself. After compilation fails, an error message indicating compilation failure will be left in shell, prompting you to modify the code.

> $ Vmware/tmp/modconfig-WpjYEn/vmnet-only/userif. c: In function 'vnetcopydatate':/tmp/modconfig-WpjYEn/vmnet-only/userif. c: 526: 4: error: implicit declaration of function 'skb _ copy_1_ram_iovec '[-Werror = implicit-function-declaration] return skb_copy_1_ram_iovec (skb, 0, & iov, len ); ^/tmp/modconfig-WpjYEn/vmnet-only/driver. c: In function 'vnetfileopunlockedioctl ':/tmp/modconfig-WpjYEn/vmnet-only/driver. c: 1194: 20: error: 'struct file' has no member named 'f _ dentry 'if (filp & filp-> f_dentry) {^/tmp/modconfig-WpjYEn/vmnet-only/driver. c: 1195: 19: error: 'struct file' has no member named 'f _ dentry 'inode = filp-> f_dentry-> d_inode ;... one thousand rows are omitted here

 

The error is obvious. The error occurs in rows 526 and 1194 of userif. c and driver. c.

However, the reported file path cannot be found, and the Error Path is changed during each compilation. It should be decompressed during compilation and automatically deleted after compilation, therefore, you need to find out where the packages of the two source files are.

After some Google operations, I finally found the location of the source code package, and then I can modify it.

# Switch to the root identity> $ su # enter the source code directory> # cd/usr/lib/vmware/modules/source/# unlock the source code package related to the network. Note that it is only a tar package, it is not a compressed package, so do not add the-z parameter> # tar xvf vmnet.tar # Get the vmnet-only/folder after unpacking, go to> # cd vmnet-only/# clean up one by one> # vim userif. c + 526 // directly replace this sentence with the following return skb_copy_datagram_iovec (skb, 0, & iov, len); # if LINUX_VERSION_CODE <KERNEL_VERSION (3, 19, 0) return skb_copy_1_ram_iovec (skb, 0, & iov, len); # else struct iov_iter to; iov_iter_init (& to, READ, & iov, 1, len); return skb_copy_1_ram_iter (skb, len, 0, & to, len); # endif> # vim driver. c + 1194 // directly comment out the original code and use the file_inode () function to obtain inode # if 0 if (filp & filp-> f_dentry) {inode = filp-> f_dentry-> d_inode;} # endif inode = file_inode (filp ); # backup source package> # mv vmnet.tar vmnet_bak.tar # re-package> # tar cf vmnet.tar vmnet-only # Run vmware again and check that the compilation is successful, oh yeah> $ vmware # cleanup> # rm-rf vmnet-only/vmnet_bak.tar> # exit> $

 

This problem is solved in this way ..

 

The first time I found that the original Ubuntu kernel can be packaged into a deb format ..

The new kernel will continue to experience it, And then uninstall the original kernel after it feels stable.

In fact, the uninstallation is also very simple:

# First check which kernels are installed> $ sudo dpkg -- get-selections | grep linux # Check the kernel currently in use, don't detach the kernel in use> $ uname-r # detach the old kernel> $ sudo apt-get purge linux-image-3.13.0-24-generic # Check if the old kernel has disappeared> $ sudo dpkg -- get-selections | grep linux # update grub menu> $ sudo update-grub

 

 

Refer:

Ubuntu kernel Compilation

VMware-Backward-Compatible 3.19 Fix ..

Linux host-Kernel 3.19 breaks VMware (vmnet)

 

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.