Fedora Core Linux adjustment script when installing Vmware

Source: Internet
Author: User
When installing VMWare for Linux on Fedora Core, sometimes there are some problems, such as the error when executing the vmware-config.pl:

What is the location of the directory of C header files that match your running
Kernel? [/Usr/src/linux/include]/lib/modules/2.6.15-1.1907 _ FC5/build/include

The kernel defined by this directory of header files does not have the same
Address space size as your running kernel.

Even if the correct path is given, it is still incorrect. Therefore, you have to modify some vmware files each time during installation. For convenience, I wrote a dumb script to help with trivial things, such as patching. Of course, you 'd better know what you are doing before executing the script :)

This script is only for the sake of convenience and does not take into account detection in various situations. Therefore, backup should be done in advance. In addition, when you execute more than once, the backup of the original file may be overwritten. Although it is generally not a problem. :)

This script requires the root permission for execution.

Tested environment:

VMWare
VMware Player 1.0.1 build-19317
VMware Workstation 5.5.1
Linux
Fedora Core 5
Slackware 10.2
Kernel
Kernel 2.6.16-RC4
Kernel 2.6.16-1.2122 _ fc5
Kernel BRL. 16-1.2122 _ fc5smp
Kernel BRL. 16-1.2122 _ fc5xen0

#!/bin/bash

CURDIR=`pwd`
VM_CONFIG_PATCH='vmware-config.pl.patch'
VM_CONFIG=`which vmware-config.pl`

# generate the patch
cat > $VM_CONFIG_PATCH << EOF
1972,1973c1972,1973
< /$header_page_offset =~ s/^/$pattern /(?0x([0-9a-fA-F]{8,}).*/$//$1/;
< if (/$header_page_offset =~ /[0-9a-fA-F]{8,}/) {
---
> if (/$header_page_offset =~ /^/$pattern /(?0x([0-9a-fA-F]{8,})/) {
> /$header_page_offset = /$1;
EOF

# apply the patch to vmware-config.pl
patch $VM_CONFIG $VM_CONFIG_PATCH



# Modify the compressed archives

search_base(){
# 2 level search, for increase search speed
FIRST_LEVEL=$1
FINAL_SEARCH=$2

list=`find / -name $FIRST_LEVEL -maxdepth 4 2>/dev/null`
basedir=''

for item in $list; do
file=`find $item -name $FINAL_SEARCH`
if [ ! -z $file ]; then
break;
fi
done

if [ -z $file ]; then
echo "Cannot find $FINAL_SEARCH"
return 1
else
basedir=${file%/$FINAL_SEARCH}
fi

echo $basedir
}

SOURCE_DIR=`search_base vmware vmmon.tar`
VM_SOURCE_PATCH='vm.patch'

mkdir vmtemp
cd vmtemp
tar xf $SOURCE_DIR/vmmon.tar
tar xf $SOURCE_DIR/vmnet.tar

# generate patch
cat > $VM_SOURCE_PATCH <<EOF
10c10
< /$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default //
---
> /$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default -DKBUILD_BASENAME="/$(DRIVER)" //
EOF

# apply the patch
patch vmmon-only/Makefile.kernel $VM_SOURCE_PATCH
patch vmnet-only/Makefile.kernel $VM_SOURCE_PATCH

# backup the original tar
if [ ! -f $SOURCE_DIR/vmmon.tar.bak ]; then
mv $SOURCE_DIR/vmmon.tar $SOURCE_DIR/vmmon.tar.bak
fi
if [ ! -f $SOURCE_DIR/vmnet.tar.bak ]; then
mv $SOURCE_DIR/vmnet.tar $SOURCE_DIR/vmnet.tar.bak
fi

# create new tars
tar cf $SOURCE_DIR/vmmon.tar vmmon-only/
tar cf $SOURCE_DIR/vmnet.tar vmnet-only/

cp $VM_SOURCE_PATCH $SOURCE_DIR

cd ..
rm -rf vmtemp


Reference

This script is modified by referring to the cacao74 statement.
Cacao74 at http://www.vmware.com/community/thread.jspa? Threadid = 31877 & tstart = 0

Another available script
Http://platan.vc.cvut.cz/ftp/pub/vmware/vmware-any-any-update101.tar.gz

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.