Lines 1675-1824
Link Here
|
1675 |
sub check_answer_headerdir { |
1675 |
sub check_answer_headerdir { |
1676 |
my $answer = shift; |
1676 |
my $answer = shift; |
1677 |
my $source = shift; |
1677 |
my $source = shift; |
1678 |
my $pattern = '@@VMWARE@@'; |
|
|
1679 |
my $header_version_uts; |
1680 |
my $header_smp; |
1681 |
my $header_page_offset; |
1682 |
|
1683 |
$answer = dir_remove_trailing_slashes($answer); |
1684 |
|
1685 |
if (not (-d $answer)) { |
1686 |
if ($source eq 'user') { |
1687 |
print wrap('The path "' . $answer . '" is not an existing directory.' |
1688 |
. "\n\n", 0); |
1689 |
} |
1690 |
return ''; |
1691 |
} |
1692 |
|
1693 |
if ($answer =~ m|^/usr/include(/.*)?$|) { #/# Broken colorizer. |
1694 |
if ($source eq 'user') { |
1695 |
if (get_answer('The header files in /usr/include are generally for C ' |
1696 |
. 'libraries, not for the running kernel. If you do not ' |
1697 |
. 'have kernel header files in your /usr/src directory, ' |
1698 |
. 'you probably do not have the kernel-source package ' |
1699 |
. 'installed. Are you sure that /usr/include contains ' |
1700 |
. 'the header files associated with your running kernel?', |
1701 |
'yesno', 'no') eq 'no') { |
1702 |
return ''; |
1703 |
} |
1704 |
} |
1705 |
} |
1706 |
|
1707 |
if ( (not (-d $answer . '/linux')) |
1708 |
|| (not (-d $answer . '/asm')) |
1709 |
|| (not (-d $answer . '/net'))) { |
1710 |
if ($source eq 'user') { |
1711 |
print wrap('The path "' . $answer . '" is an existing directory, but it ' |
1712 |
. 'does not contain at least one of these directories ' |
1713 |
. '"linux", "asm", "net" as expected.' . "\n\n", 0); |
1714 |
} |
1715 |
return ''; |
1716 |
} |
1717 |
|
1718 |
# |
1719 |
# Check that the running kernel matches the set of header files |
1720 |
# |
1721 |
|
1722 |
if (not (-r $answer . '/linux/version.h')) { |
1723 |
if ($source eq 'user') { |
1724 |
print wrap('The path "' . $answer . '" is a kernel header file ' |
1725 |
. 'directory, but it does not contain the file ' |
1726 |
. '"linux/version.h" as expected. This can happen if the ' |
1727 |
. 'kernel has never been built, or if you have invoked the ' |
1728 |
. '"make mrproper" command in your kernel directory. In any ' |
1729 |
. 'case, you may want to rebuild your kernel.' . "\n\n", 0); |
1730 |
} |
1731 |
return ''; |
1732 |
} |
1733 |
$header_version_uts = direct_command( |
1734 |
shell_string($gHelper{'echo'}) . ' ' |
1735 |
. shell_string('#include <linux/version.h>' . "\n" . $pattern |
1736 |
. ' UTS_RELEASE') . ' | ' . shell_string($gHelper{'gcc'}) |
1737 |
. ' ' . shell_string('-I' . $answer) . ' -E - | ' |
1738 |
. shell_string($gHelper{'grep'}) . ' ' . shell_string($pattern)); |
1739 |
chomp($header_version_uts); |
1740 |
$header_version_uts =~ s/^$pattern \"([^\"]*)\".*$/$1/; |
1741 |
if (not ($header_version_uts eq $gSystem{'uts_release'})) { |
1742 |
if ($source eq 'user') { |
1743 |
print wrap('The directory of kernel headers (version ' |
1744 |
. $header_version_uts . ') does not match your running ' |
1745 |
. 'kernel (version ' . $gSystem{'uts_release'} . '). Even ' |
1746 |
. 'if the module were to compile successfully, it would not ' |
1747 |
. 'load into the running kernel.' . "\n\n", 0); |
1748 |
} |
1749 |
return ''; |
1750 |
} |
1751 |
|
1752 |
if (not (-r $answer . '/linux/autoconf.h')) { |
1753 |
if ($source eq 'user') { |
1754 |
print wrap('The path "' . $answer . '" is a kernel header file ' |
1755 |
. 'directory, but it does not contain the file ' |
1756 |
. '"linux/autoconf.h" as expected. This can happen if the ' |
1757 |
. 'kernel has never been built, or if you have invoked the ' |
1758 |
. '"make mrproper" command in your kernel directory. In any ' |
1759 |
. 'case, you may want to rebuild your kernel.' . "\n\n", 0); |
1760 |
} |
1761 |
return ''; |
1762 |
} |
1763 |
$header_smp = direct_command(shell_string($gHelper{'grep'}) . ' CONFIG_SMP ' |
1764 |
. shell_string($answer . '/linux/autoconf.h')); |
1765 |
if (not ($header_smp eq '')) { |
1766 |
# linux/autoconf.h contains the up/smp information |
1767 |
$header_smp = direct_command( |
1768 |
shell_string($gHelper{'echo'}) . ' ' |
1769 |
. shell_string('#include <linux/autoconf.h>' . "\n" . $pattern |
1770 |
. ' CONFIG_SMP') . ' | ' . shell_string($gHelper{'gcc'}) |
1771 |
. ' ' . shell_string('-I' . $answer) . ' -E - | ' |
1772 |
. shell_string($gHelper{'grep'}) . ' ' . shell_string($pattern)); |
1773 |
chomp($header_smp); |
1774 |
$header_smp =~ s/^$pattern (\S+).*$/$1/; |
1775 |
$header_smp = ($header_smp eq '1') ? 'yes' : 'no'; |
1776 |
if (not (lc($header_smp) eq lc($gSystem{'smp'}))) { |
1777 |
if ($source eq 'user') { |
1778 |
print wrap('The kernel defined by this directory of header files is ' |
1779 |
. (($header_smp eq 'yes') ? 'multiprocessor' |
1780 |
: 'uniprocessor') . ', while ' |
1781 |
. 'your running kernel is ' |
1782 |
. (($gSystem{'smp'} eq 'yes') ? 'multiprocessor' |
1783 |
: 'uniprocessor') . '.' |
1784 |
. "\n\n", 0); |
1785 |
} |
1786 |
return ''; |
1787 |
} |
1788 |
} |
1789 |
|
1790 |
if (not (-r $answer . '/asm/page.h')) { |
1791 |
if ($source eq 'user') { |
1792 |
print wrap('The path "' . $answer . '" is a kernel header file ' |
1793 |
. 'directory, but it does not contain the file "asm/page.h" ' |
1794 |
. 'as expected.' . "\n\n", 0); |
1795 |
} |
1796 |
return ''; |
1797 |
} |
1798 |
$header_page_offset = direct_command( |
1799 |
shell_string($gHelper{'echo'}) . ' ' |
1800 |
. shell_string('#define __KERNEL__' . "\n" . '#include <asm/page.h>' |
1801 |
. "\n" . $pattern . ' __PAGE_OFFSET') . ' | ' |
1802 |
. shell_string($gHelper{'gcc'}) . ' ' . shell_string('-I' . $answer) |
1803 |
. ' -E - | ' . shell_string($gHelper{'grep'}) . ' ' |
1804 |
. shell_string($pattern)); |
1805 |
chomp($header_page_offset); |
1806 |
$header_page_offset =~ s/^$pattern \(?0x([0-9a-fA-F]{8,}).*$/$1/; |
1807 |
if ($header_page_offset =~ /[0-9a-fA-F]{8,}/) { |
1808 |
# We found a valid page offset |
1809 |
if (defined($gSystem{'page_offset'}) and |
1810 |
not (lc($header_page_offset) eq lc($gSystem{'page_offset'}))) { |
1811 |
if ($source eq 'user') { |
1812 |
print wrap('The kernel defined by this directory of header files does ' |
1813 |
. 'not have the same address space size as your running ' |
1814 |
. 'kernel.' . "\n\n", 0); |
1815 |
} |
1816 |
return ''; |
1817 |
} |
1818 |
} |
1819 |
|
1820 |
return $answer; |
1678 |
return $answer; |
1821 |
} |
1679 |
} |
|
|
1680 |
|
1822 |
$gAnswerSize{'headerdir'} = 20; |
1681 |
$gAnswerSize{'headerdir'} = 20; |
1823 |
$gCheckAnswerFct{'headerdir'} = \&check_answer_headerdir; |
1682 |
$gCheckAnswerFct{'headerdir'} = \&check_answer_headerdir; |
1824 |
|
1683 |
|
Lines 2662-2696
Link Here
|
2662 |
$gcc_version = direct_command(shell_string($gHelper{'gcc'}) |
2521 |
$gcc_version = direct_command(shell_string($gHelper{'gcc'}) |
2663 |
. ' -dumpversion'); |
2522 |
. ' -dumpversion'); |
2664 |
chomp($gcc_version); |
2523 |
chomp($gcc_version); |
2665 |
if ($gcc_version =~ /^(egcs-)?(\d+(\.\d+)*)/) { |
|
|
2666 |
$gSystem{'gcc_version'} = $2; |
2667 |
} else { |
2668 |
print wrap('Your compiler "' . $gHelper{'gcc'} . '" version "' . |
2669 |
$gcc_version . '" is not supported ' . |
2670 |
'by this version of ' . vmware_product_name() . '.' . |
2671 |
"\n\n", 0); |
2672 |
return 'no'; |
2673 |
} |
2674 |
|
2675 |
if (check_gcc_version($gSystem{'gcc_version'}) eq 'no') { |
2676 |
return 'no'; |
2677 |
} |
2678 |
|
2679 |
# When installing the modules, kernels 2.4+ setup a symlink to the kernel |
2680 |
# source directory |
2681 |
$headerdir = $cKernelModuleDir . '/preferred/build/include'; |
2682 |
if (check_answer_headerdir($headerdir, 'default') eq '') { |
2683 |
$headerdir = $cKernelModuleDir . '/' . $gSystem{'uts_release'} |
2684 |
. '/build/include'; |
2685 |
if (check_answer_headerdir($headerdir, 'default') eq '') { |
2686 |
# Use a default usual location |
2687 |
$headerdir = '/usr/src/linux/include'; |
2688 |
} |
2689 |
} |
2690 |
get_persistent_answer('What is the location of the directory of C header ' |
2691 |
. 'files that match your running kernel?', |
2692 |
'HEADER_DIR', 'headerdir', $headerdir); |
2693 |
|
2524 |
|
|
|
2525 |
$headerdir = '/usr/src/linux/include'; |
2694 |
$gFirstModuleBuild = 0; |
2526 |
$gFirstModuleBuild = 0; |
2695 |
} |
2527 |
} |
2696 |
|
2528 |
|
Lines 2821-2872
Link Here
|
2821 |
|
2653 |
|
2822 |
if ($gOption{'compile'} == 1) { |
2654 |
if ($gOption{'compile'} == 1) { |
2823 |
db_add_answer('BUILDR_' . $name, 'yes'); |
2655 |
db_add_answer('BUILDR_' . $name, 'yes'); |
2824 |
} else { |
|
|
2825 |
my @mod_list; |
2826 |
|
2827 |
print wrap('Trying to find a suitable ' . $name |
2828 |
. ' module for your running kernel.' . "\n\n", 0); |
2829 |
@mod_list = get_suitable_modules($mod_dir . '/binary'); |
2830 |
while ($#mod_list > -1) { |
2831 |
my $candidate = shift(@mod_list); |
2832 |
my $modversion = shift(@mod_list); |
2833 |
|
2834 |
# Note: When using the force flag, |
2835 |
# Non-versioned modules can load into a versioned kernel. |
2836 |
# Versioned modules can load into a non-versioned kernel. |
2837 |
# |
2838 |
# Consequently, it is only safe to use the force flag if _both_ the |
2839 |
# kernel and the module are versioned. |
2840 |
# This is not always the case as demonstrated by bug 18371. |
2841 |
|
2842 |
if (try_module($name, |
2843 |
$mod_dir . '/binary/' . $candidate . '/objects/' |
2844 |
. $name . '.o', |
2845 |
($gSystem{'versioned'} eq 'yes') |
2846 |
&& ($modversion eq 'yes'), 1)) { |
2847 |
print wrap('The module ' . $candidate . ' loads perfectly in the ' |
2848 |
. 'running kernel.' . "\n\n", 0); |
2849 |
return 'yes'; |
2850 |
} |
2851 |
} |
2852 |
|
2853 |
if ($gOption{'prebuilt'} == 1) { |
2854 |
db_add_answer('BUILDR_' . $name, 'no'); |
2855 |
print wrap('None of ' . vmware_product_name() . '\'s pre-built ' |
2856 |
. $name . ' modules is suitable for your running kernel. ' |
2857 |
. "\n\n", 0); |
2858 |
return 'no'; |
2859 |
} |
2860 |
|
2861 |
if (get_persistent_answer('None of ' . vmware_product_name() . '\'s ' |
2862 |
. 'pre-built ' . $name . ' modules is suitable ' |
2863 |
. 'for your running kernel. Do you want this ' |
2864 |
. 'program to try to build the ' . $name |
2865 |
. ' module for your system (you need to have a ' |
2866 |
. 'C compiler installed on your system)?', |
2867 |
'BUILDR_' . $name, 'yesno', 'yes') eq 'no') { |
2868 |
return 'no'; |
2869 |
} |
2870 |
} |
2656 |
} |
2871 |
|
2657 |
|
2872 |
if (build_module($name, $mod_dir . '/source') eq 'no') { |
2658 |
if (build_module($name, $mod_dir . '/source') eq 'no') { |