summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2008-02-13 10:20:37 -0800
committerAaron Plattner <aplattner@nvidia.com>2008-02-13 10:20:37 -0800
commit33eac8360e0f525e84d4b820c2bfaaceb5cbdd90 (patch)
tree128b9e788fecd3a4878b612ecb7c7c2b3a8bf525
parent2b1d02c0e47da31eb995dec66bf75c3ca381eb44 (diff)
1.0-76641.0-7664
-rw-r--r--install-from-cwd.c10
-rw-r--r--kernel.c87
-rw-r--r--kernel.h4
-rw-r--r--misc.c81
-rw-r--r--misc.h2
-rw-r--r--nvLegacy.h37
-rw-r--r--nvidia-installer.c42
7 files changed, 234 insertions, 29 deletions
diff --git a/install-from-cwd.c b/install-from-cwd.c
index 514b79f..5b35b24 100644
--- a/install-from-cwd.c
+++ b/install-from-cwd.c
@@ -83,7 +83,7 @@ int install_from_cwd(Options *op)
static const char edit_your_xf86config[] =
"Please update your XF86Config or xorg.conf file as "
"appropriate; see the file /usr/share/doc/"
- "NVIDIA_GLX-1.0/README for details.";
+ "NVIDIA_GLX-1.0/README.txt for details.";
static const char suse_edit_your_xf86config[] =
"On SuSE Linux/United Linux please use SaX2 now to enable "
@@ -116,12 +116,20 @@ int install_from_cwd(Options *op)
* they really want to overwrite the existing installation
*/
+ /* print warning message if a legacy gpu is detected in the system */
+
+ check_for_legacy_gpu(op, p);
+
if (!check_for_existing_driver(op, p)) return FALSE;
/* determine where to install the kernel module */
if (!determine_kernel_module_installation_path(op)) goto failed;
+ /* check '/proc/sys/kernel/modprobe' */
+
+ if (!check_proc_modprobe_path(op)) return FALSE;
+
/*
* do nvchooser-style logic to decide if we have a prebuilt kernel
* module for their kernel
diff --git a/kernel.c b/kernel.c
index 5a3dd6e..00dc46b 100644
--- a/kernel.c
+++ b/kernel.c
@@ -34,6 +34,8 @@
#include <dirent.h>
#include <fcntl.h>
#include <sys/mman.h>
+#include <string.h>
+#include <limits.h>
#include "nvidia-installer.h"
#include "kernel.h"
@@ -43,6 +45,7 @@
#include "precompiled.h"
#include "snarf.h"
#include "crc.h"
+#include "nvLegacy.h"
/* local prototypes */
@@ -782,7 +785,10 @@ int check_kernel_module_version(Options *op, Package *p)
int eof;
fp = fopen(NVIDIA_VERSION_PROC_FILE, "r");
+ if (!fp)
+ return FALSE;
buf = fget_next_line(fp, &eof);
+ fclose(fp);
if (!nvid_version(buf, &proc_major, &proc_minor, &proc_patch)) {
free(buf);
@@ -1479,6 +1485,87 @@ int check_cc_version(Options *op, Package *p)
/*
+ * check_for_legacy_gpu() - run 'lspci -n' and check if any of the returned pci_id
+ * corresponds to a legacy gpu. If so, print a warning message for each of them,
+ * and returns TRUE.
+ * Does not print any warning message and returns FALSE if no legacy GPU has been
+ * detected.
+ */
+
+int check_for_legacy_gpu(Options *op, Package *p)
+{
+ char *cmd = NULL, *data, *tok, *file;
+ int ret;
+ unsigned int pci_id;
+ char hexdigits[] = "0123456789abcdef";
+ int hex[UCHAR_MAX];
+ int i;
+ int found=FALSE;
+
+ // lspci not being in the path should not prevent the installation
+ file=find_system_util("lspci");
+ if (file==NULL)
+ return FALSE;
+
+ cmd = nvstrcat(file, " -n | ",
+ op->utils[CUT], " -d' ' -f4", NULL);
+ ret = run_command(op, cmd, &data, FALSE, 0, TRUE);
+ free(cmd);
+ free(file);
+
+ if (ret != 0)
+ return FALSE;
+
+ /* Convert to lower case then we can do insensitive string comparison */
+ nvstrtolower(data);
+
+ /* Initialize tables for string->hex conversion */
+ for (i = 0; i < UCHAR_MAX; i++)
+ hex[i] = 0;
+ for (i = 0; hexdigits[i] != '\0'; i++)
+ hex[(int)hexdigits[i]] = i;
+
+ tok = strtok(data, "\n");
+ while(tok) {
+ if(strlen(tok)<9)
+ break;
+
+ /* Check vendor id */
+ if(strncmp(tok, "10de", 4)) {
+ tok = strtok(NULL, "\n");
+ continue;
+ }
+
+ /* Construct pci_id */
+ pci_id = (hex[(int)tok[5]] << 12) +
+ (hex[(int)tok[6]] << 8 ) +
+ (hex[(int)tok[7]] << 4 ) +
+ (hex[(int)tok[8]]);
+
+ for(i=0;i< sizeof(LegacyList) / sizeof(LEGACY_INFO); i++)
+ {
+ if(pci_id==LegacyList[i].uiDevId)
+ {
+ ui_warn(op, "The NVIDIA %s GPU installed in this system is "
+ "supported through the NVIDIA Legacy drivers. Please "
+ "visit http://www.nvidia.com/object/linux.html for more "
+ "information. The %s NVIDIA driver will ignore "
+ "this GPU. ",
+ LegacyList[i].AdapterString, p->version_string);
+ found = TRUE;
+ }
+ }
+
+ tok = strtok(NULL, "\n");
+ }
+
+ free(data);
+ return found;
+
+} /* check_for_legacy_gpu() */
+
+
+/*
* rivafb_check() - run the rivafb_sanity_check conftest; if the test
* fails, print the error message from the test and abort driver
* installation.
diff --git a/kernel.h b/kernel.h
index 686e60c..ce429ec 100644
--- a/kernel.h
+++ b/kernel.h
@@ -38,8 +38,8 @@ int test_kernel_module (Options*, Package*);
int load_kernel_module (Options*, Package*);
int check_kernel_module_version (Options*, Package*);
int check_for_unloaded_kernel_module (Options*, Package*);
-int find_precompiled_kernel_interface (Options*, Package *);
+int find_precompiled_kernel_interface (Options*, Package*);
char *get_kernel_name (Options*);
-
+int check_for_legacy_gpu (Options*, Package*);
#endif /* __NVIDIA_INSTALLER_KERNEL_H__ */
diff --git a/misc.c b/misc.c
index 6c1c505..167c441 100644
--- a/misc.c
+++ b/misc.c
@@ -49,7 +49,6 @@
static int check_symlink(Options*, const char*, const char*, const char*);
static int check_file(Options*, const char*, const mode_t, const uint32);
-static char *find_system_util(const char *util);
/*
@@ -300,7 +299,7 @@ int check_runlevel(Options *op)
"this may cause problems. For example: some "
"distributions that use devfs do not run the devfs "
"daemon in runlevel 1, making it difficult for "
- "nvidia-installer to correctly setup the kernel "
+ "`nvidia-installer` to correctly setup the kernel "
"module configuration files. It is recommended "
"that you quit installation now and switch to "
"runlevel 3 (`telinit 3`) before installing.\n\n"
@@ -683,6 +682,78 @@ int find_module_utils(Options *op)
/*
+ * check_proc_modprobe_path() - check if the modprobe path reported
+ * via /proc matches the one determined earlier; also check if it can
+ * be accessed/executed.
+ */
+
+#define PROC_MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe"
+
+int check_proc_modprobe_path(Options *op)
+{
+ FILE *fp;
+ char *buf = NULL;
+
+ fp = fopen(PROC_MODPROBE_PATH_FILE, "r");
+ if (fp) {
+ buf = fget_next_line(fp, NULL);
+ fclose(fp);
+ }
+
+ if (buf && strcmp(buf, op->utils[MODPROBE])) {
+ if (access(buf, F_OK | X_OK) == 0) {
+ ui_warn(op, "The path to the `modprobe` utility reported by "
+ "'%s', `%s`, differs from the path determined by "
+ "`nvidia-installer`, `%s`. Please verify that `%s` "
+ "works correctly and correct the path in '%s' if "
+ "it does not.",
+ PROC_MODPROBE_PATH_FILE, buf, op->utils[MODPROBE],
+ buf, PROC_MODPROBE_PATH_FILE);
+ return TRUE;
+ } else {
+ ui_error(op, "The path to the `modprobe` utility reported by "
+ "'%s', `%s`, differs from the path determined by "
+ "`nvidia-installer`, `%s`, and does not appear to "
+ "point to a valid `modprobe` binary. Please correct "
+ "the path in '%s'.",
+ PROC_MODPROBE_PATH_FILE, buf, op->utils[MODPROBE],
+ PROC_MODPROBE_PATH_FILE);
+ return FALSE;
+ }
+ } else if (!buf && strcmp("/sbin/modprobe", op->utils[MODPROBE])) {
+ if (access(buf, F_OK | X_OK) == 0) {
+ ui_warn(op, "The file '%s' is unavailable, the X server will "
+ "use `/sbin/modprobe` as the path to the `modprobe` "
+ "utility. This path differs from the one determined "
+ "by `nvidia-installer`, `%s`. Please verify that "
+ "`/sbin/modprobe` works correctly or mount the /proc "
+ "file system and verify that '%s' reports the "
+ "correct path.",
+ PROC_MODPROBE_PATH_FILE, op->utils[MODPROBE],
+ PROC_MODPROBE_PATH_FILE);
+ return TRUE;
+ } else {
+ ui_error(op, "The file '%s' is unavailable, the X server will "
+ "use `/sbin/modprobe` as the path to the `modprobe` "
+ "utility. This path differs from the one determined "
+ "by `nvidia-installer`, `%s`, and does not appear to "
+ "point to a valid `modprobe` binary. Please create "
+ "a symbolic link from `/sbin/modprobe` to `%s` or "
+ "mount the /proc file system and verify that '%s' "
+ "reports the correct path.",
+ PROC_MODPROBE_PATH_FILE, op->utils[MODPROBE],
+ op->utils[MODPROBE], PROC_MODPROBE_PATH_FILE);
+ return FALSE;
+ }
+ }
+ nvfree(buf);
+
+ return TRUE;
+
+} /* check_proc_modprobe_path() */
+
+
+/*
* check_development_tools() - check if the development tools needed
* to build custom kernel interfaces are available.
*/
@@ -705,7 +776,7 @@ int check_development_tools(Options *op)
if (!tool) {
ui_error(op, "Unable to find the development tool `%s` in "
"your path; please make sure that you have the "
- "package '%s' installed. If %s is installed on your "
+ "package '%s' installed. If %s is installed on your "
"system, then please check that `%s` is in your "
"PATH.",
needed_tools[i].tool, needed_tools[i].package,
@@ -727,7 +798,7 @@ int check_development_tools(Options *op)
* utility is returned. On failure NULL is returned.
*/
-static char *find_system_util(const char *util)
+char *find_system_util(const char *util)
{
char *buf, *path, *file, *x, *y;
@@ -1457,7 +1528,7 @@ static int rtld_test_internal(Options *op, Package *p,
"library '%s' (expected: '%s', found: '%s'). "
"The most likely reason for this is that conflicting "
"OpenGL libraries are installed in a location "
- "not inspected by nvidia-installer. Please be sure "
+ "not inspected by `nvidia-installer`. Please be sure "
"you have uninstalled any third-party OpenGL and "
"third-party graphics driver packages.",
p->entries[i].name, name,
diff --git a/misc.h b/misc.h
index 532fc5a..096ec8b 100644
--- a/misc.h
+++ b/misc.h
@@ -85,8 +85,10 @@ char *fget_next_line(FILE *fp, int *eof);
char *get_next_line(char *buf, char **e);
int run_command(Options *op, const char *cmd, char **data,
int output, int status, int redirect);
+char *find_system_util(const char *util);
int find_system_utils(Options *op);
int find_module_utils(Options *op);
+int check_proc_modprobe_path(Options *op);
int check_development_tools(Options *op);
int nvid_version (const char *str, int *major, int *minor, int *patch);
int continue_after_error(Options *op, const char *fmt, ...);
diff --git a/nvLegacy.h b/nvLegacy.h
new file mode 100644
index 0000000..c2ec23c
--- /dev/null
+++ b/nvLegacy.h
@@ -0,0 +1,37 @@
+/*
+ * nvLegacy.h
+ *
+ * Copyright (c) 2005, Nvidia Corporation. All rights reserved.
+ *
+ * THE INFORMATION CONTAINED HEREIN IS PROPRIETARY AND CONFIDENTIAL TO
+ * NVIDIA, CORPORATION. USE, REPRODUCTION OR DISCLOSURE TO ANY THIRD PARTY
+ * IS SUBJECT TO WRITTEN PRE-APPROVAL BY NVIDIA, CORPORATION.
+ */
+
+#ifndef __NV_LEGACY_H
+#define __NV_LEGACY_H
+
+typedef struct _LEGACY_INFO {
+ unsigned int uiDevId;
+ char* AdapterString;
+} LEGACY_INFO;
+
+// This is the list of the legacy GPUs
+static const LEGACY_INFO LegacyList[] = {
+// PCI-ID Marketing name
+ { 0x0020, "RIVA TNT" },
+ { 0x0028, "RIVA TNT2/TNT2 Pro" },
+ { 0x00A0, "Aladdin TNT2" },
+ { 0x002C, "Vanta/Vanta LT" },
+ { 0x0029, "RIVA TNT2 Ultra" },
+ { 0x002D, "RIVA TNT2 Model 64/Model 64 Pro" },
+ { 0x0100, "GeForce 256" },
+ { 0x0101, "GeForce DDR" },
+ { 0x0103, "Quadro" },
+ { 0x0150, "GeForce2 GTS/GeForce2 Pro" },
+ { 0x0151, "GeForce2 Ti" },
+ { 0x0152, "GeForce2 Ultra" },
+ { 0x0153, "Quadro2 Pro" }
+};
+
+#endif /* __NV_LEGACY_H */
diff --git a/nvidia-installer.c b/nvidia-installer.c
index 75c4a8d..346aa76 100644
--- a/nvidia-installer.c
+++ b/nvidia-installer.c
@@ -340,9 +340,9 @@ static void print_advanced_options_args_only(int args_only)
fmtoutp(TAB, "Disable use of color in the ncurses user interface.");
fmtout("");
- fmtout("--opengl-headers");
- fmtoutp(TAB, "Normally, installation does not install NVIDIA's OpenGL "
- "header files. This option enables installation of the NVIDIA "
+ fmtout("--no-opengl-headers");
+ fmtoutp(TAB, "Normally, installation will install NVIDIA's OpenGL "
+ "header files. This option disables installation of the NVIDIA "
"OpenGL header files.");
fmtout("");
@@ -412,7 +412,7 @@ static void print_advanced_options_args_only(int args_only)
"conflicting files, rather than back them up.");
fmtout("");
- fmtout("--no-network");
+ fmtout("-N, --no-network");
fmtoutp(TAB, "This option instructs the installer to not attempt to "
"connect to the NVIDIA ftp site (for updated precompiled kernel "
"interfaces, for example).");
@@ -472,7 +472,7 @@ Options *parse_commandline(int argc, char *argv[])
#define LOG_FILE_NAME_OPTION 8
#define HELP_ARGS_ONLY_OPTION 9
#define TMPDIR_OPTION 10
-#define OPENGL_HEADERS_OPTION 11
+#define NO_OPENGL_HEADERS_OPTION 11
#define INSTALLER_PREFIX_OPTION 12
#define FORCE_TLS_OPTION 13
#define SANITY_OPTION 14
@@ -481,16 +481,15 @@ Options *parse_commandline(int argc, char *argv[])
#define ADD_THIS_KERNEL_OPTION 17
#define RPM_FILE_LIST_OPTION 18
#define NO_RUNLEVEL_CHECK_OPTION 19
-#define NO_NETWORK_OPTION 20
-#define PRECOMPILED_KERNEL_INTERFACES_PATH 21
-#define NO_ABI_NOTE_OPTION 22
-#define KERNEL_SOURCE_PATH_OPTION 23
-#define NO_RPMS_OPTION 24
-#define X_PREFIX_OPTION 25
-#define KERNEL_OUTPUT_PATH_OPTION 26
-#define NO_RECURSION_OPTION 27
-#define FORCE_TLS_COMPAT32_OPTION 28
-#define COMPAT32_PREFIX_OPTION 29
+#define PRECOMPILED_KERNEL_INTERFACES_PATH 20
+#define NO_ABI_NOTE_OPTION 21
+#define KERNEL_SOURCE_PATH_OPTION 22
+#define NO_RPMS_OPTION 23
+#define X_PREFIX_OPTION 24
+#define KERNEL_OUTPUT_PATH_OPTION 25
+#define NO_RECURSION_OPTION 26
+#define FORCE_TLS_COMPAT32_OPTION 27
+#define COMPAT32_PREFIX_OPTION 28
static struct option long_options[] = {
@@ -528,14 +527,14 @@ Options *parse_commandline(int argc, char *argv[])
{ "log-file-name", 1, NULL, LOG_FILE_NAME_OPTION },
{ "help-args-only", 0, NULL, HELP_ARGS_ONLY_OPTION },
{ "tmpdir", 1, NULL, TMPDIR_OPTION },
- { "opengl-headers", 0, NULL, OPENGL_HEADERS_OPTION },
+ { "no-opengl-headers", 0, NULL, NO_OPENGL_HEADERS_OPTION },
{ "force-tls", 1, NULL, FORCE_TLS_OPTION },
{ "force-tls-compat32", 1, NULL, FORCE_TLS_COMPAT32_OPTION },
{ "sanity", 0, NULL, SANITY_OPTION },
{ "add-this-kernel", 0, NULL, ADD_THIS_KERNEL_OPTION },
{ "rpm-file-list", 1, NULL, RPM_FILE_LIST_OPTION },
{ "no-runlevel-check", 0, NULL, NO_RUNLEVEL_CHECK_OPTION },
- { "no-network", 0, NULL, NO_NETWORK_OPTION },
+ { "no-network", 0, NULL, 'N' },
{ "no-abi-note", 0, NULL, NO_ABI_NOTE_OPTION },
{ "no-rpms", 0, NULL, NO_RPMS_OPTION },
{ "no-recursion", 0, NULL, NO_RECURSION_OPTION },
@@ -566,10 +565,11 @@ Options *parse_commandline(int argc, char *argv[])
#endif
op->logging = TRUE; /* log by default */
+ op->opengl_headers = TRUE; /* We now install our GL headers by default */
while (1) {
- c = getopt_long(argc, argv, "afg:evdinclm:qk:shAbK",
+ c = getopt_long(argc, argv, "afg:evdinclm:qk:shAbKN",
long_options, &option_index);
if (c == -1)
break;
@@ -637,8 +637,8 @@ Options *parse_commandline(int argc, char *argv[])
print_help_args_only(TRUE); exit(0); break;
case TMPDIR_OPTION:
op->tmpdir = optarg; break;
- case OPENGL_HEADERS_OPTION:
- op->opengl_headers = TRUE; break;
+ case NO_OPENGL_HEADERS_OPTION:
+ op->opengl_headers = FALSE; break;
case FORCE_TLS_OPTION:
if (strcasecmp(optarg, "new") == 0)
op->which_tls = FORCE_NEW_TLS;
@@ -681,7 +681,7 @@ Options *parse_commandline(int argc, char *argv[])
case NO_RUNLEVEL_CHECK_OPTION:
op->no_runlevel_check = TRUE;
break;
- case NO_NETWORK_OPTION:
+ case 'N':
op->no_network = TRUE;
break;
case PRECOMPILED_KERNEL_INTERFACES_PATH: