mirror of
https://github.com/NVIDIA/nvidia-installer.git
synced 2025-07-23 10:23:00 +02:00
346.16
This commit is contained in:
7
Makefile
7
Makefile
@@ -103,7 +103,6 @@ OPTIONS_1_INC = $(OUTPUTDIR)/options.1.inc
|
|||||||
ifeq ($(TARGET_OS)-$(TARGET_ARCH), Linux-x86_64)
|
ifeq ($(TARGET_OS)-$(TARGET_ARCH), Linux-x86_64)
|
||||||
TLS_MODEL = initial-exec
|
TLS_MODEL = initial-exec
|
||||||
PIC = -fPIC
|
PIC = -fPIC
|
||||||
CFLAGS += -DNV_X86_64
|
|
||||||
# Only Linux-x86_64 needs the tls_test_32 files
|
# Only Linux-x86_64 needs the tls_test_32 files
|
||||||
COMPAT_32_SRC = $(TLS_TEST_32_C) $(TLS_TEST_DSO_32_C) \
|
COMPAT_32_SRC = $(TLS_TEST_32_C) $(TLS_TEST_DSO_32_C) \
|
||||||
$(RTLD_TEST_32_C)
|
$(RTLD_TEST_32_C)
|
||||||
@@ -308,9 +307,9 @@ tls_test: tls_test.c
|
|||||||
# rule to rebuild rtld_test; a precompiled rtld_test is distributed with
|
# rule to rebuild rtld_test; a precompiled rtld_test is distributed with
|
||||||
# nvidia-installer to simplify x86-64 builds.
|
# nvidia-installer to simplify x86-64 builds.
|
||||||
|
|
||||||
rebuild_rtld_test: rtld_test.c
|
rebuild_rtld_test: rtld_test.c $(CONFIG_H)
|
||||||
gcc -Wall -O2 -fomit-frame-pointer -o $(RTLD_TEST) -lGL $<
|
$(call quiet_cmd,LINK) $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) -o $(RTLD_TEST) -lGL $<
|
||||||
strip $(RTLD_TEST)
|
$(call quiet_cmd,STRIP_CMD) $(RTLD_TEST)
|
||||||
|
|
||||||
# dummy rule to override implicit rule that builds dls_test from
|
# dummy rule to override implicit rule that builds dls_test from
|
||||||
# rtld_test.c
|
# rtld_test.c
|
||||||
|
107
backup.c
107
backup.c
@@ -141,7 +141,7 @@ int init_backup(Options *op, Package *p)
|
|||||||
|
|
||||||
/* remove the directory, if it already exists */
|
/* remove the directory, if it already exists */
|
||||||
|
|
||||||
if (directory_exists(op, BACKUP_DIRECTORY)) {
|
if (directory_exists(BACKUP_DIRECTORY)) {
|
||||||
if (!remove_directory(op, BACKUP_DIRECTORY)) {
|
if (!remove_directory(op, BACKUP_DIRECTORY)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ int do_backup(Options *op, const char *filename)
|
|||||||
{
|
{
|
||||||
int len, ret, ret_val;
|
int len, ret, ret_val;
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
char *tmp;
|
char *tmp = NULL;
|
||||||
FILE *log;
|
FILE *log;
|
||||||
uint32 crc;
|
uint32 crc;
|
||||||
|
|
||||||
@@ -251,7 +251,6 @@ int do_backup(Options *op, const char *filename)
|
|||||||
fprintf(log, "%u %04o %d %d\n", crc, stat_buf.st_mode,
|
fprintf(log, "%u %04o %d %d\n", crc, stat_buf.st_mode,
|
||||||
stat_buf.st_uid, stat_buf.st_gid);
|
stat_buf.st_uid, stat_buf.st_gid);
|
||||||
|
|
||||||
free(tmp);
|
|
||||||
backup_file_number++;
|
backup_file_number++;
|
||||||
} else if (S_ISLNK(stat_buf.st_mode)) {
|
} else if (S_ISLNK(stat_buf.st_mode)) {
|
||||||
tmp = get_symlink_target(op, filename);
|
tmp = get_symlink_target(op, filename);
|
||||||
@@ -267,7 +266,6 @@ int do_backup(Options *op, const char *filename)
|
|||||||
fprintf(log, "%s\n", tmp);
|
fprintf(log, "%s\n", tmp);
|
||||||
fprintf(log, "%04o %d %d\n", stat_buf.st_mode,
|
fprintf(log, "%04o %d %d\n", stat_buf.st_mode,
|
||||||
stat_buf.st_uid, stat_buf.st_gid);
|
stat_buf.st_uid, stat_buf.st_gid);
|
||||||
free(tmp);
|
|
||||||
} else if (S_ISDIR(stat_buf.st_mode)) {
|
} else if (S_ISDIR(stat_buf.st_mode)) {
|
||||||
|
|
||||||
/* XXX IMPLEMENT ME: recursive moving of a directory */
|
/* XXX IMPLEMENT ME: recursive moving of a directory */
|
||||||
@@ -284,6 +282,8 @@ int do_backup(Options *op, const char *filename)
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
|
nvfree(tmp);
|
||||||
|
|
||||||
/* close the log file */
|
/* close the log file */
|
||||||
|
|
||||||
if (fclose(log) != 0) {
|
if (fclose(log) != 0) {
|
||||||
@@ -506,7 +506,7 @@ int log_mkdir(Options *op, const char *dirs)
|
|||||||
* is within BACKUP_DIRECTORY, so the below fopen(3) call depends on
|
* is within BACKUP_DIRECTORY, so the below fopen(3) call depends on
|
||||||
* the existence of BACKUP_DIRECTORY
|
* the existence of BACKUP_DIRECTORY
|
||||||
*/
|
*/
|
||||||
if (!directory_exists(op, BACKUP_DIRECTORY) &&
|
if (!directory_exists(BACKUP_DIRECTORY) &&
|
||||||
!mkdir_recursive(op, BACKUP_DIRECTORY, BACKUP_DIRECTORY_PERMS, FALSE)) {
|
!mkdir_recursive(op, BACKUP_DIRECTORY, BACKUP_DIRECTORY_PERMS, FALSE)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -832,28 +832,30 @@ static int do_uninstall(Options *op, const char *version)
|
|||||||
/* XXX what to do if this fails?... nothing */
|
/* XXX what to do if this fails?... nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (!op->skip_module_unload) {
|
||||||
* attempt to unload the kernel module(s), but don't abort if this fails:
|
/*
|
||||||
* the kernel may not have been configured with support for module
|
* attempt to unload the kernel module(s), but don't abort if this
|
||||||
* unloading or the user might have unloaded it themselves or the module
|
* fails: the kernel may not have been configured with support for
|
||||||
* might not have existed at all.
|
* module unloading or the user might have unloaded it themselves or the
|
||||||
*/
|
* module might not have existed at all.
|
||||||
|
*/
|
||||||
|
|
||||||
unload_nvidia_module(op, "-uvm");
|
unload_nvidia_module(op, "-uvm");
|
||||||
|
|
||||||
unload_nvidia_module(op, "");
|
unload_nvidia_module(op, "");
|
||||||
|
|
||||||
for (i = 0; i < NV_MAX_MODULE_INSTANCES; i++) {
|
for (i = 0; i < NV_MAX_MODULE_INSTANCES; i++) {
|
||||||
char num[5];
|
char num[5];
|
||||||
memset(num, 0, sizeof(num));
|
memset(num, 0, sizeof(num));
|
||||||
snprintf(num, sizeof(num), "%d", i);
|
snprintf(num, sizeof(num), "%d", i);
|
||||||
num[sizeof(num) - 1] = '\0';
|
num[sizeof(num) - 1] = '\0';
|
||||||
|
|
||||||
unload_nvidia_module(op, num);
|
unload_nvidia_module(op, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
unload_nvidia_module(op, "-frontend");
|
||||||
}
|
}
|
||||||
|
|
||||||
unload_nvidia_module(op, "-frontend");
|
|
||||||
|
|
||||||
run_distro_hook(op, "post-uninstall");
|
run_distro_hook(op, "post-uninstall");
|
||||||
|
|
||||||
free_backup_info(b);
|
free_backup_info(b);
|
||||||
@@ -902,13 +904,13 @@ static BackupInfo *read_backup_log_file(Options *op)
|
|||||||
if (fstat(fd, &stat_buf) == -1) {
|
if (fstat(fd, &stat_buf) == -1) {
|
||||||
ui_error(op, "Failure getting file properties for %s (%s).",
|
ui_error(op, "Failure getting file properties for %s (%s).",
|
||||||
BACKUP_LOG, strerror(errno));
|
BACKUP_LOG, strerror(errno));
|
||||||
return NULL;
|
goto pre_map_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stat_buf.st_mode & PERM_MASK) != BACKUP_LOG_PERMS) {
|
if ((stat_buf.st_mode & PERM_MASK) != BACKUP_LOG_PERMS) {
|
||||||
ui_error(op, "The file permissions of %s have been changed since "
|
ui_error(op, "The file permissions of %s have been changed since "
|
||||||
"the file was written!", BACKUP_LOG);
|
"the file was written!", BACKUP_LOG);
|
||||||
return NULL;
|
goto pre_map_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* map the file */
|
/* map the file */
|
||||||
@@ -1033,11 +1035,14 @@ static BackupInfo *read_backup_log_file(Options *op)
|
|||||||
ui_status_end(op, "error.");
|
ui_status_end(op, "error.");
|
||||||
|
|
||||||
munmap(buf, stat_buf.st_size);
|
munmap(buf, stat_buf.st_size);
|
||||||
close(fd);
|
|
||||||
|
|
||||||
ui_error(op, "Error while parsing line %d of '%s'.", line_num, BACKUP_LOG);
|
ui_error(op, "Error while parsing line %d of '%s'.", line_num, BACKUP_LOG);
|
||||||
|
|
||||||
if (b) free(b);
|
nvfree(b);
|
||||||
|
|
||||||
|
pre_map_fail:
|
||||||
|
|
||||||
|
close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
} /* read_backup_log_file() */
|
} /* read_backup_log_file() */
|
||||||
@@ -1376,18 +1381,15 @@ int uninstall_existing_driver(Options *op, const int interactive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (interactive && op->uninstall) {
|
if (interactive && op->uninstall) {
|
||||||
ret = ui_yes_no(op, FALSE,
|
const char *msg = "If you plan to no longer use the NVIDIA driver, you "
|
||||||
"If you plan to no longer use the NVIDIA driver, you "
|
"should make sure that no X screens are configured to "
|
||||||
"should make sure that no X screens are configured to "
|
"use the NVIDIA X driver in your X configuration file. "
|
||||||
"use the NVIDIA X driver in your X configuration file. "
|
"If you used nvidia-xconfig to configure X, it may have "
|
||||||
"If you used nvidia-xconfig to configure X, it may have "
|
"created a backup of your original configuration. Would "
|
||||||
"created a backup of your original configuration. Would "
|
"you like to run `nvidia-xconfig --restore-original-"
|
||||||
"you like to run `nvidia-xconfig --restore-original-"
|
"backup` to attempt restoration of the original X "
|
||||||
"backup` to attempt restoration of the original X "
|
"configuration file?";
|
||||||
"configuration file?");
|
run_nvidia_xconfig(op, TRUE, msg, FALSE);
|
||||||
if (ret) {
|
|
||||||
run_nvidia_xconfig(op, TRUE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = do_uninstall(op, version);
|
ret = do_uninstall(op, version);
|
||||||
@@ -1426,13 +1428,40 @@ int run_existing_uninstaller(Options *op)
|
|||||||
* uninstall log location: older installers may not do so implicitly. */
|
* uninstall log location: older installers may not do so implicitly. */
|
||||||
char *uninstall_cmd = nvstrcat(uninstaller, " -s --log-file-name="
|
char *uninstall_cmd = nvstrcat(uninstaller, " -s --log-file-name="
|
||||||
DEFAULT_UNINSTALL_LOG_FILE_NAME, NULL);
|
DEFAULT_UNINSTALL_LOG_FILE_NAME, NULL);
|
||||||
char *data;
|
char *data = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ui_log(op, "Uninstalling the previous installation with %s.",
|
ui_log(op, "Uninstalling the previous installation with %s.",
|
||||||
uninstaller);
|
uninstaller);
|
||||||
|
|
||||||
ret = run_command(op, uninstall_cmd, &data, FALSE, 0, TRUE);
|
if (!op->no_kernel_module && !op->kernel_name) {
|
||||||
|
/*
|
||||||
|
* Attempt to run the uninstaller with the --skip-module-unload
|
||||||
|
* option first. If that fails, fall back to running it without
|
||||||
|
* that option.
|
||||||
|
*
|
||||||
|
* We don't want the uninstaller to unload the module because this
|
||||||
|
* instance of the installer already unloaded the old module and
|
||||||
|
* loaded the new one.
|
||||||
|
*/
|
||||||
|
char *uninstall_skip_unload_cmd =
|
||||||
|
nvstrcat(uninstall_cmd, " --skip-module-unload", NULL);
|
||||||
|
ret = run_command(op, uninstall_skip_unload_cmd, NULL, FALSE, 0, TRUE);
|
||||||
|
nvfree(uninstall_skip_unload_cmd);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* If installing the kernel module was skipped or we're
|
||||||
|
* building/installing for a different kernel, then the new kernel
|
||||||
|
* module wasn't automatically loaded and we should unload whichever
|
||||||
|
* one is loaded now.
|
||||||
|
*/
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
/* Try again without --skip-module-unload */
|
||||||
|
ret = run_command(op, uninstall_cmd, &data, FALSE, 0, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
nvfree(uninstall_cmd);
|
nvfree(uninstall_cmd);
|
||||||
|
|
||||||
|
497
command-list.c
497
command-list.c
@@ -47,18 +47,6 @@
|
|||||||
|
|
||||||
static void free_file_list(FileList* l);
|
static void free_file_list(FileList* l);
|
||||||
|
|
||||||
static void find_conflicting_xfree86_libraries(Options *,
|
|
||||||
const char *,
|
|
||||||
FileList *);
|
|
||||||
|
|
||||||
static void find_conflicting_xfree86_libraries_fullpath(Options *op,
|
|
||||||
char *,
|
|
||||||
FileList *l);
|
|
||||||
|
|
||||||
static void find_conflicting_opengl_libraries(Options *,
|
|
||||||
const char *,
|
|
||||||
FileList *);
|
|
||||||
|
|
||||||
static void find_conflicting_kernel_modules(Options *op,
|
static void find_conflicting_kernel_modules(Options *op,
|
||||||
Package *p,
|
Package *p,
|
||||||
FileList *l);
|
FileList *l);
|
||||||
@@ -84,6 +72,110 @@ typedef struct {
|
|||||||
char *name; /* name to find: NULL to end the list */
|
char *name; /* name to find: NULL to end the list */
|
||||||
} NoRecursionDirectory;
|
} NoRecursionDirectory;
|
||||||
|
|
||||||
|
static void find_conflicting_files(Options *op,
|
||||||
|
char *path,
|
||||||
|
ConflictingFileInfo *files,
|
||||||
|
FileList *l,
|
||||||
|
const NoRecursionDirectory *skipdirs);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if a path already exists in the path list, or is a subdirectory of
|
||||||
|
* a path that exists in the path list, or is a symlink to or symlink target
|
||||||
|
* of a directory that exists in the path list.
|
||||||
|
*/
|
||||||
|
static int path_already_exists(char ***paths, int count, const char *path)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
int is_subdir = FALSE;
|
||||||
|
|
||||||
|
is_subdirectory((*paths)[i], path, &is_subdir);
|
||||||
|
|
||||||
|
if (is_subdir) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add a new path to the list of paths to search, provided that it exists
|
||||||
|
* and is not redundant.
|
||||||
|
* XXX we only check to see if the new directory is a subdirectory of any
|
||||||
|
* existing directory, and not the other way around.
|
||||||
|
*/
|
||||||
|
static void add_search_path(char ***paths, int *count, const char *path)
|
||||||
|
{
|
||||||
|
if (directory_exists(path) && !path_already_exists(paths, *count, path)) {
|
||||||
|
*paths = nvrealloc(*paths, sizeof(char *) * (*count + 1));
|
||||||
|
(*paths)[*count] = nvstrdup(path);
|
||||||
|
(*count)++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Given a path, add the subdirectories "/lib", "/lib32", and "/lib64" to the
|
||||||
|
* list of paths to search.
|
||||||
|
*/
|
||||||
|
static void add_search_paths(char ***paths, int *count, const char *pathbase)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
const char *subdirs[] = {
|
||||||
|
"/lib",
|
||||||
|
"/lib32",
|
||||||
|
"/lib64",
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LEN(subdirs); i++) {
|
||||||
|
char *path = nvstrcat(pathbase, subdirs[i], NULL);
|
||||||
|
add_search_path(paths, count, path);
|
||||||
|
nvfree(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Build the list of paths under which to search for conflicting files.
|
||||||
|
* Returns the number of paths added to the search list.
|
||||||
|
*/
|
||||||
|
static int get_conflicting_search_paths(const Options *op, char ***paths)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
*paths = NULL;
|
||||||
|
|
||||||
|
add_search_paths(paths, &ret, DEFAULT_X_PREFIX);
|
||||||
|
add_search_paths(paths, &ret, XORG7_DEFAULT_X_PREFIX);
|
||||||
|
add_search_paths(paths, &ret, op->x_prefix);
|
||||||
|
add_search_paths(paths, &ret, DEFAULT_OPENGL_PREFIX);
|
||||||
|
add_search_paths(paths, &ret, op->opengl_prefix);
|
||||||
|
add_search_path(paths, &ret, op->x_module_path);
|
||||||
|
add_search_path(paths, &ret, op->x_library_path);
|
||||||
|
|
||||||
|
#if defined(NV_X86_64)
|
||||||
|
if (op->compat32_chroot != NULL) {
|
||||||
|
int i;
|
||||||
|
char *subdirs[] = {
|
||||||
|
DEFAULT_X_PREFIX,
|
||||||
|
op->x_prefix,
|
||||||
|
DEFAULT_OPENGL_PREFIX,
|
||||||
|
op->opengl_prefix,
|
||||||
|
op->compat32_prefix,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_LEN(subdirs); i++) {
|
||||||
|
char *path = nvstrcat(op->compat32_chroot, "/", subdirs[i], NULL);
|
||||||
|
add_search_paths(paths, &ret, path);
|
||||||
|
nvfree(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* build_command_list() - construct a list of all the things to do
|
* build_command_list() - construct a list of all the things to do
|
||||||
@@ -149,70 +241,30 @@ CommandList *build_command_list(Options *op, Package *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!op->kernel_module_only) {
|
if (!op->kernel_module_only) {
|
||||||
|
char **paths;
|
||||||
|
int numpaths, i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note that searching the various paths may produce duplicate
|
* stop recursing into any "nvidia-cg-toolkit"
|
||||||
* entries for conflicting files; this is OK because we will take
|
* directory to prevent libGL.so.1 from being deleted
|
||||||
* care of these duplicates in condense_file_list().
|
* (see bug 843595).
|
||||||
*/
|
*/
|
||||||
|
static const NoRecursionDirectory skipdirs[] = {
|
||||||
|
{ -1, "nvidia-cg-toolkit" },
|
||||||
|
{ 0, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
ui_status_begin(op, "Searching for conflicting X files:", "Searching");
|
numpaths = get_conflicting_search_paths(op, &paths);
|
||||||
|
|
||||||
ui_status_update(op, 0.16f, DEFAULT_X_PREFIX);
|
ui_status_begin(op, "Searching for conflicting files:", "Searching");
|
||||||
find_conflicting_xfree86_libraries(op, DEFAULT_X_PREFIX, l);
|
|
||||||
ui_status_update(op, 0.32f, XORG7_DEFAULT_X_PREFIX);
|
|
||||||
find_conflicting_xfree86_libraries(op, XORG7_DEFAULT_X_PREFIX, l);
|
|
||||||
ui_status_update(op, 0.48f, "%s", op->x_prefix);
|
|
||||||
find_conflicting_xfree86_libraries(op, op->x_prefix, l);
|
|
||||||
|
|
||||||
ui_status_update(op, 0.64f, "%s", op->x_module_path);
|
for (i = 0; i < numpaths; i++) {
|
||||||
find_conflicting_xfree86_libraries_fullpath(op, op->x_module_path, l);
|
ui_status_update(op, (i + 1.0f) / numpaths, "Searching: %s", paths[i]);
|
||||||
ui_status_update(op, 0.80f, "%s", op->x_library_path);
|
find_conflicting_files(op, paths[i], p->conflicting_files, l,
|
||||||
find_conflicting_xfree86_libraries_fullpath(op, op->x_library_path, l);
|
skipdirs);
|
||||||
|
|
||||||
ui_status_end(op, "done.");
|
|
||||||
|
|
||||||
ui_status_begin(op, "Searching for conflicting OpenGL files:", "Searching");
|
|
||||||
|
|
||||||
ui_status_update(op, 0.20f, DEFAULT_X_PREFIX);
|
|
||||||
find_conflicting_opengl_libraries(op, DEFAULT_X_PREFIX, l);
|
|
||||||
ui_status_update(op, 0.40f, "%s", op->x_prefix);
|
|
||||||
find_conflicting_opengl_libraries(op, op->x_prefix, l);
|
|
||||||
ui_status_update(op, 0.60f, DEFAULT_OPENGL_PREFIX);
|
|
||||||
find_conflicting_opengl_libraries(op, DEFAULT_OPENGL_PREFIX, l);
|
|
||||||
ui_status_update(op, 0.80f, "%s", op->opengl_prefix);
|
|
||||||
find_conflicting_opengl_libraries(op, op->opengl_prefix, l);
|
|
||||||
|
|
||||||
ui_status_end(op, "done.");
|
|
||||||
|
|
||||||
#if defined(NV_X86_64)
|
|
||||||
if (op->compat32_chroot != NULL) {
|
|
||||||
char *prefix;
|
|
||||||
|
|
||||||
ui_status_begin(op, "Searching for conflicting compat32 files:", "Searching");
|
|
||||||
|
|
||||||
prefix = nvstrcat(op->compat32_chroot, DEFAULT_X_PREFIX, NULL);
|
|
||||||
ui_status_update(op, 0.20f, "%s", prefix);
|
|
||||||
find_conflicting_opengl_libraries(op, prefix, l);
|
|
||||||
nvfree(prefix);
|
|
||||||
|
|
||||||
prefix = nvstrcat(op->compat32_chroot, op->x_prefix, NULL);
|
|
||||||
ui_status_update(op, 0.40f, "%s", prefix);
|
|
||||||
find_conflicting_opengl_libraries(op, prefix, l);
|
|
||||||
nvfree(prefix);
|
|
||||||
|
|
||||||
prefix = nvstrcat(op->compat32_chroot, DEFAULT_OPENGL_PREFIX, NULL);
|
|
||||||
ui_status_update(op, 0.60f, "%s", prefix);
|
|
||||||
find_conflicting_opengl_libraries(op, prefix, l);
|
|
||||||
nvfree(prefix);
|
|
||||||
|
|
||||||
prefix = nvstrcat(op->compat32_chroot, op->compat32_prefix, NULL);
|
|
||||||
ui_status_update(op, 0.80f, "%s", prefix);
|
|
||||||
find_conflicting_opengl_libraries(op, prefix, l);
|
|
||||||
nvfree(prefix);
|
|
||||||
|
|
||||||
ui_status_end(op, "done.");
|
|
||||||
}
|
}
|
||||||
#endif /* NV_X86_64 */
|
|
||||||
|
ui_status_end(op, "done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -369,16 +421,6 @@ CommandList *build_command_list(Options *op, Package *p)
|
|||||||
nvfree(tmp);
|
nvfree(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* if on SuSE or United Linux, also do `/usr/bin/chrc.config
|
|
||||||
* SCRIPT_3D no`
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (((op->distro == SUSE) || (op->distro == UNITED_LINUX)) &&
|
|
||||||
(access("/usr/bin/chrc.config", X_OK) == 0)) {
|
|
||||||
add_command(c, RUN_CMD, "/usr/bin/chrc.config SCRIPT_3D no");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* free the FileList */
|
/* free the FileList */
|
||||||
free_file_list(l);
|
free_file_list(l);
|
||||||
|
|
||||||
@@ -569,197 +611,6 @@ int execute_command_list(Options *op, CommandList *c,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CONFLICT_ARCH_ALL: file always conflicts, regardless of arch
|
|
||||||
* CONFLICT_ARCH_32: file only conflicts if its arch is 32 bit
|
|
||||||
* CONFLICT_ARCH_64: file only conflicts if its arch is 64 bit
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
CONFLICT_ARCH_ALL,
|
|
||||||
CONFLICT_ARCH_32,
|
|
||||||
CONFLICT_ARCH_64,
|
|
||||||
} ConflictArch;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const char *name;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* if requiredString is non-NULL, then a file must have this
|
|
||||||
* string in order to be considered a conflicting file; we use
|
|
||||||
* this to only consider "libglx.*" files conflicts if they have
|
|
||||||
* the string "glxModuleData".
|
|
||||||
*/
|
|
||||||
|
|
||||||
const char *requiredString;
|
|
||||||
|
|
||||||
ConflictArch conflictArch;
|
|
||||||
} ConflictingFileInfo;
|
|
||||||
|
|
||||||
static void find_conflicting_files(Options *op,
|
|
||||||
char *path,
|
|
||||||
ConflictingFileInfo *files,
|
|
||||||
FileList *l,
|
|
||||||
const NoRecursionDirectory *skipdirs);
|
|
||||||
|
|
||||||
static void find_conflicting_libraries(Options *op,
|
|
||||||
const char *prefix,
|
|
||||||
ConflictingFileInfo *libs,
|
|
||||||
FileList *l);
|
|
||||||
|
|
||||||
static ConflictingFileInfo __xfree86_opengl_libs[] = {
|
|
||||||
|
|
||||||
/* Conflicting OpenGL libraries */
|
|
||||||
|
|
||||||
{ "libnvidia-glcore.", 17, /* strlen("libnvidia-glcore.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libGL.", 6, /* strlen("libGL.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libGLwrapper.", 13, /* strlen("libGLwrapper.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
|
|
||||||
/* Conflicting X extensions */
|
|
||||||
|
|
||||||
{ "libglx.", 7, /* strlen("libglx.") */
|
|
||||||
"glxModuleData", CONFLICT_ARCH_ALL },
|
|
||||||
{ "libglamoregl.", 13, /* strlen("libglamoregl.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
|
|
||||||
/* Conflicting EGL libraries: */
|
|
||||||
|
|
||||||
{ "libEGL.", 7, /* strlen("libEGL.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libGLESv1_CM.", 13, /* strlen("libGLESv1_CM." */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libGLESv2.", 10, /* strlen("libGLESv2." */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ NULL, 0, NULL, CONFLICT_ARCH_ALL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static ConflictingFileInfo __xfree86_non_opengl_libs[] = {
|
|
||||||
{ "nvidia_drv.", 11, /* strlen("nvidia_drv.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libvdpau_nvidia.", 16, /* strlen("libvdpau_nvidia.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-cfg.", 14, /* strlen("libnvidia-cfg.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libcuda.", 8, /* strlen("libcuda.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-compiler.", 19, /* strlen("libnvidia-compiler.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvcuvid.", 11, /* strlen("libnvcuvid.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-ml.", 13, /* strlen("libnvidia-ml.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-encode.", 17, /* strlen("libnvidia-encode.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-vgx.", 14, /* strlen("libnvidia-vgx.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-ifr.", 14, /* strlen("libnvidia-ifr.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-vgxcfg.", 17, /* strlen("libnvidia-vgxcfg.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ NULL, 0, NULL, CONFLICT_ARCH_ALL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static ConflictingFileInfo __xfree86_vdpau_wrapper_libs[] = {
|
|
||||||
{ "libvdpau.", 9, /* strlen("libvdpau.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libvdpau_trace.", 15, /* strlen("libvdpau_trace.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ NULL, 0, NULL, CONFLICT_ARCH_ALL }
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* find_conflicting_xfree86_libraries() - search for conflicting
|
|
||||||
* libraries under the XFree86 installation prefix, for all possible
|
|
||||||
* libdirs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void find_conflicting_xfree86_libraries(Options *op,
|
|
||||||
const char *xprefix,
|
|
||||||
FileList *l)
|
|
||||||
{
|
|
||||||
if (!op->no_opengl_files) {
|
|
||||||
find_conflicting_libraries(op, xprefix, __xfree86_opengl_libs, l);
|
|
||||||
}
|
|
||||||
find_conflicting_libraries(op, xprefix, __xfree86_non_opengl_libs, l);
|
|
||||||
if (op->install_vdpau_wrapper == NV_OPTIONAL_BOOL_TRUE) {
|
|
||||||
find_conflicting_libraries(op, xprefix, __xfree86_vdpau_wrapper_libs, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* find_conflicting_xfree86_libraries() */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* find_conflicting_xfree86_libraries_fullpath() - same as
|
|
||||||
* find_conflicting_xfree86_libraries, but bypasses the
|
|
||||||
* find_conflicting_libraries step, which appends "lib", "lib64", and
|
|
||||||
* "lib32" to the path name. Use this when you have the fullpath that
|
|
||||||
* you want searched.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void find_conflicting_xfree86_libraries_fullpath(Options *op,
|
|
||||||
char *path,
|
|
||||||
FileList *l)
|
|
||||||
{
|
|
||||||
if (!op->no_opengl_files) {
|
|
||||||
find_conflicting_files(op, path, __xfree86_opengl_libs, l, NULL);
|
|
||||||
}
|
|
||||||
find_conflicting_files(op, path, __xfree86_non_opengl_libs, l, NULL);
|
|
||||||
if (op->install_vdpau_wrapper == NV_OPTIONAL_BOOL_TRUE) {
|
|
||||||
find_conflicting_files(op, path, __xfree86_vdpau_wrapper_libs, l, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* find_conflicting_xfree86_libraries_fullpath() */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ConflictingFileInfo __opengl_libs[] = {
|
|
||||||
{ "libnvidia-glcore.", 17, /* strlen("libnvidia-glcore.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libGL.", 6, /* strlen("libGL.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-tls.", 14, /* strlen("libnvidia-tls.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libGLwrapper.", 13, /* strlen("libGLwrapper.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ NULL, 0, NULL, CONFLICT_ARCH_ALL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static ConflictingFileInfo __non_opengl_libs[] = {
|
|
||||||
{ "libnvidia-cfg.", 14, /* strlen("libnvidia-cfg.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libcuda.", 8, /* strlen("libcuda.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-compiler.", 19, /* strlen("libnvidia-compiler.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ "libnvidia-ml.", 13, /* strlen("libnvidia-ml.") */
|
|
||||||
NULL, CONFLICT_ARCH_ALL },
|
|
||||||
{ NULL, 0, NULL, CONFLICT_ARCH_ALL }
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* find_conflicting_opengl_libraries() - search for conflicting
|
|
||||||
* libraries under the OpenGL installation prefix, for all possible
|
|
||||||
* libdirs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void find_conflicting_opengl_libraries(Options *op,
|
|
||||||
const char *glprefix,
|
|
||||||
FileList *l)
|
|
||||||
{
|
|
||||||
if (!op->no_opengl_files) {
|
|
||||||
find_conflicting_libraries(op, glprefix, __opengl_libs, l);
|
|
||||||
}
|
|
||||||
find_conflicting_libraries(op, glprefix, __non_opengl_libs, l);
|
|
||||||
|
|
||||||
} /* find_conflicting_opengl_libraries() */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find_conflicting_kernel_modules() - search for conflicting kernel
|
* find_conflicting_kernel_modules() - search for conflicting kernel
|
||||||
@@ -857,38 +708,7 @@ static int ignore_conflicting_file(Options *op,
|
|||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
char *file = MAP_FAILED;
|
char *file = MAP_FAILED;
|
||||||
int ret = FALSE;
|
int ret = FALSE;
|
||||||
int i, len;
|
int i, len, size = 0;
|
||||||
|
|
||||||
/* check if the file only conflicts on certain architectures */
|
|
||||||
|
|
||||||
if (info.conflictArch != CONFLICT_ARCH_ALL) {
|
|
||||||
ElfFileType elftype = get_elf_architecture(filename);
|
|
||||||
|
|
||||||
switch (elftype) {
|
|
||||||
case ELF_ARCHITECTURE_32:
|
|
||||||
ret = info.conflictArch != CONFLICT_ARCH_32;
|
|
||||||
break;
|
|
||||||
case ELF_ARCHITECTURE_64:
|
|
||||||
ret = info.conflictArch != CONFLICT_ARCH_64;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/*
|
|
||||||
* XXX ignore symlinks with indeterminate architectures: their
|
|
||||||
* targets may have already been deleted, and they'll be reused
|
|
||||||
* or replaced as part of the installation, anyway.
|
|
||||||
*/
|
|
||||||
if (lstat(filename, &stat_buf) == -1) {
|
|
||||||
ui_warn(op, "Unable to stat '%s'.", filename);
|
|
||||||
} else if ((stat_buf.st_mode & S_IFLNK) == S_IFLNK) {
|
|
||||||
ret = TRUE;
|
|
||||||
} else {
|
|
||||||
ui_warn(op, "Unable to determine the architecture of the "
|
|
||||||
"file '%s', which has an architecture-specific "
|
|
||||||
"conflict.", filename);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if no requiredString, do not check for the required string */
|
/* if no requiredString, do not check for the required string */
|
||||||
|
|
||||||
@@ -908,11 +728,13 @@ static int ignore_conflicting_file(Options *op,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stat_buf.st_size) {
|
size = stat_buf.st_size;
|
||||||
|
|
||||||
|
if (!size) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((file = mmap(0, stat_buf.st_size, PROT_READ,
|
if ((file = mmap(0, size, PROT_READ,
|
||||||
MAP_FILE | MAP_SHARED, fd, 0)) == MAP_FAILED) {
|
MAP_FILE | MAP_SHARED, fd, 0)) == MAP_FAILED) {
|
||||||
ui_error(op, "Unable to map file '%s' for reading (%s)",
|
ui_error(op, "Unable to map file '%s' for reading (%s)",
|
||||||
filename, strerror(errno));
|
filename, strerror(errno));
|
||||||
@@ -930,9 +752,9 @@ static int ignore_conflicting_file(Options *op,
|
|||||||
|
|
||||||
len = strlen(info.requiredString);
|
len = strlen(info.requiredString);
|
||||||
|
|
||||||
for (i = 0; (i + len) <= stat_buf.st_size; i++) {
|
for (i = 0; (i + len) <= size; i++) {
|
||||||
if ((strncmp(&file[i], info.requiredString, len) == 0) &&
|
if ((strncmp(&file[i], info.requiredString, len) == 0) &&
|
||||||
(((i + len) == stat_buf.st_size) || (file[i+len] == '\0'))) {
|
(((i + len) == size) || (file[i+len] == '\0'))) {
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -943,7 +765,7 @@ static int ignore_conflicting_file(Options *op,
|
|||||||
cleanup:
|
cleanup:
|
||||||
|
|
||||||
if (file != MAP_FAILED) {
|
if (file != MAP_FAILED) {
|
||||||
munmap(file, stat_buf.st_size);
|
munmap(file, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
@@ -1027,65 +849,6 @@ static void find_conflicting_files(Options *op,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* find_conflicting_libraries() - search for any conflicting
|
|
||||||
* libraries in all relevant libdirs within the hierarchy under
|
|
||||||
* the given prefix.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void find_conflicting_libraries(Options *op,
|
|
||||||
const char *prefix,
|
|
||||||
ConflictingFileInfo *files,
|
|
||||||
FileList *l)
|
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
char *paths[4];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* stop recursing into any "nvidia-cg-toolkit"
|
|
||||||
* directory to prevent libGL.so.1 from being deleted
|
|
||||||
* (see bug 843595).
|
|
||||||
*/
|
|
||||||
static const NoRecursionDirectory skipdirs[] = {
|
|
||||||
{ -1, "nvidia-cg-toolkit" },
|
|
||||||
{ 0, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
paths[0] = nvstrcat(prefix, "/", "lib", NULL);
|
|
||||||
paths[1] = nvstrcat(prefix, "/", "lib64", NULL);
|
|
||||||
paths[2] = nvstrcat(prefix, "/", "lib32", NULL);
|
|
||||||
paths[3] = NULL;
|
|
||||||
|
|
||||||
for (i = 0; paths[i]; i++) {
|
|
||||||
for (j = 0; (j < 3) && paths[i]; j++) {
|
|
||||||
/*
|
|
||||||
* XXX Check if any one of the 'paths' entries really
|
|
||||||
* is a symbolic link pointing to one of the other
|
|
||||||
* entries. The logic could be made smarter, since it's
|
|
||||||
* unlikely that ../lib32 would be a symbolic link to
|
|
||||||
* ../lib64 or vice versa.
|
|
||||||
*/
|
|
||||||
if (!paths[j] || (i == j)) continue;
|
|
||||||
|
|
||||||
if (is_symbolic_link_to(paths[i], paths[j])) {
|
|
||||||
ui_expert(op, "The conflicting library search path "
|
|
||||||
"'%s' is a symbolic link to the library "
|
|
||||||
"search path '%s'; skipping '%s'.",
|
|
||||||
paths[i], paths[j], paths[i]);
|
|
||||||
free(paths[i]); paths[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (paths[i]) find_conflicting_files(op, paths[i], files, l, skipdirs);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
|
||||||
nvfree(paths[i]);
|
|
||||||
|
|
||||||
} /* find_conflicting_libraries() */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* condense_file_list() - Take a FileList stucture and delete any
|
* condense_file_list() - Take a FileList stucture and delete any
|
||||||
* duplicate entries in the list. This is a pretty brain dead
|
* duplicate entries in the list. This is a pretty brain dead
|
||||||
|
@@ -522,6 +522,68 @@ char *nv_basename(const char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nv_mkdir_recursive() - make a directory and all parent directories as needed.
|
||||||
|
* dir_list is an optional arguments that if not empty, will be set to a string
|
||||||
|
* containing a newline separated list of all directories created.
|
||||||
|
*/
|
||||||
|
int nv_mkdir_recursive(const char *path, const mode_t mode,
|
||||||
|
char **error_str, char **dir_list)
|
||||||
|
{
|
||||||
|
char *c, *tmp, ch, *list;
|
||||||
|
int success = FALSE;
|
||||||
|
|
||||||
|
if (!path || !path[0]) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = nvstrdup(path);
|
||||||
|
remove_trailing_slashes(tmp);
|
||||||
|
|
||||||
|
list = NULL;
|
||||||
|
|
||||||
|
c = tmp;
|
||||||
|
do {
|
||||||
|
c++;
|
||||||
|
if ((*c == '/') || (*c == '\0')) {
|
||||||
|
ch = *c;
|
||||||
|
*c = '\0';
|
||||||
|
if (!directory_exists(tmp)) {
|
||||||
|
char *tmplist;
|
||||||
|
if (mkdir(tmp, mode) != 0) {
|
||||||
|
*error_str =
|
||||||
|
nvasprintf("Failure creating directory '%s' : (%s)",
|
||||||
|
tmp, strerror(errno));
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
/* Prepend the created directory path to a running list */
|
||||||
|
if (dir_list) {
|
||||||
|
tmplist = list;
|
||||||
|
list = nvstrcat(tmp, "\n", tmplist, NULL);
|
||||||
|
free(tmplist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*c = ch;
|
||||||
|
}
|
||||||
|
} while (*c);
|
||||||
|
|
||||||
|
/* Log any created directories */
|
||||||
|
if (dir_list && list) {
|
||||||
|
*dir_list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
success = TRUE;
|
||||||
|
|
||||||
|
done:
|
||||||
|
|
||||||
|
if (!dir_list) {
|
||||||
|
free(list);
|
||||||
|
}
|
||||||
|
free(tmp);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* string helper functions */
|
/* string helper functions */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@@ -611,3 +673,39 @@ char *nv_trim_char_strict(char *string, char trim) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* directory_exists() - test whether the given directory exists
|
||||||
|
*/
|
||||||
|
|
||||||
|
int directory_exists(const char *dir)
|
||||||
|
{
|
||||||
|
struct stat stat_buf;
|
||||||
|
|
||||||
|
if ((stat (dir, &stat_buf) == -1) || (!S_ISDIR(stat_buf.st_mode))) {
|
||||||
|
return FALSE;
|
||||||
|
} else {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* remove_trailing_slashes() - begin at the end of the given string,
|
||||||
|
* and overwrite slashes with NULL as long as we find slashes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void remove_trailing_slashes(char *string)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (string == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = strlen(string);
|
||||||
|
|
||||||
|
while (string[len-1] == '/') {
|
||||||
|
string[--len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -62,10 +62,15 @@ int nv_get_file_length(const char *filename);
|
|||||||
void nv_set_file_length(const char *filename, int fd, int len);
|
void nv_set_file_length(const char *filename, int fd, int len);
|
||||||
void *nv_mmap(const char *filename, size_t len, int prot, int flags, int fd);
|
void *nv_mmap(const char *filename, size_t len, int prot, int flags, int fd);
|
||||||
char *nv_basename(const char *path);
|
char *nv_basename(const char *path);
|
||||||
|
int nv_mkdir_recursive(const char *path, const mode_t mode,
|
||||||
|
char **error_str, char **log_str);
|
||||||
|
|
||||||
char *nv_trim_space(char *string);
|
char *nv_trim_space(char *string);
|
||||||
char *nv_trim_char(char *string, char trim);
|
char *nv_trim_char(char *string, char trim);
|
||||||
char *nv_trim_char_strict(char *string, char trim);
|
char *nv_trim_char_strict(char *string, char trim);
|
||||||
|
void remove_trailing_slashes(char *string);
|
||||||
|
|
||||||
|
int directory_exists(const char *dir);
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
# define NV_INLINE __inline__
|
# define NV_INLINE __inline__
|
||||||
|
@@ -42,6 +42,7 @@ int nvgetopt(int argc,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
int negate = NVGETOPT_FALSE;
|
int negate = NVGETOPT_FALSE;
|
||||||
int disable = NVGETOPT_FALSE;
|
int disable = NVGETOPT_FALSE;
|
||||||
|
int double_dash = NVGETOPT_FALSE;
|
||||||
const NVGetoptOption *o = NULL;
|
const NVGetoptOption *o = NULL;
|
||||||
static int argv_index = 0;
|
static int argv_index = 0;
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ int nvgetopt(int argc,
|
|||||||
|
|
||||||
if ((arg[0] == '-') && (arg[1] == '-')) {
|
if ((arg[0] == '-') && (arg[1] == '-')) {
|
||||||
name = arg + 2;
|
name = arg + 2;
|
||||||
|
double_dash = NVGETOPT_TRUE;
|
||||||
} else if (arg[0] == '-') {
|
} else if (arg[0] == '-') {
|
||||||
name = arg + 1;
|
name = arg + 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -80,16 +82,26 @@ int nvgetopt(int argc,
|
|||||||
|
|
||||||
c = name;
|
c = name;
|
||||||
while (*c) {
|
while (*c) {
|
||||||
if (*c == '=') { argument = c + 1; *c = '\0'; break; }
|
if (*c == '=') {
|
||||||
|
argument = c + 1;
|
||||||
|
*c = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* if there is no character after '--' then stop processing options.
|
||||||
* if the string is terminated after one character, interpret it
|
* if the string is terminated after one character, interpret it
|
||||||
* as a short option. Otherwise, interpret it as a long option.
|
* as a short option. Otherwise, interpret it as a long option.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (name[1] == '\0') { /* short option */
|
if (name[0] == '\0') {
|
||||||
|
if (double_dash && argument == NULL) { /* option list terminator */
|
||||||
|
ret = -1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
} else if (name[1] == '\0') { /* short option */
|
||||||
for (i = 0; options[i].name; i++) {
|
for (i = 0; options[i].name; i++) {
|
||||||
if (options[i].val == name[0]) {
|
if (options[i].val == name[0]) {
|
||||||
o = &options[i];
|
o = &options[i];
|
||||||
|
36
crc.c
36
crc.c
@@ -94,31 +94,41 @@ uint32 compute_crc_from_buffer(const uint8 *buf, int len)
|
|||||||
uint32 compute_crc(Options *op, const char *filename)
|
uint32 compute_crc(Options *op, const char *filename)
|
||||||
{
|
{
|
||||||
uint32 cword = ~0;
|
uint32 cword = ~0;
|
||||||
uint8 *buf;
|
uint8 *buf = MAP_FAILED;
|
||||||
|
int success = FALSE;
|
||||||
int fd;
|
int fd;
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
size_t len;
|
size_t len = 0;
|
||||||
|
|
||||||
if ((fd = open(filename, O_RDONLY)) == -1) goto fail;
|
if ((fd = open(filename, O_RDONLY)) == -1) goto done;
|
||||||
if (fstat(fd, &stat_buf) == -1) goto fail;
|
if (fstat(fd, &stat_buf) == -1) goto done;
|
||||||
|
|
||||||
if (stat_buf.st_size == 0) return 0;
|
if (stat_buf.st_size == 0) {
|
||||||
|
cword = 0;
|
||||||
|
success = TRUE;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
len = stat_buf.st_size;
|
len = stat_buf.st_size;
|
||||||
|
|
||||||
buf = mmap(0, len, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
|
buf = mmap(0, len, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
|
||||||
if (buf == (void *) -1) goto fail;
|
if (buf == MAP_FAILED) goto done;
|
||||||
|
|
||||||
cword = compute_crc_from_buffer(buf, len);
|
cword = compute_crc_from_buffer(buf, len);
|
||||||
|
|
||||||
if (munmap(buf, len) == -1) goto fail;
|
success = TRUE;
|
||||||
if (close(fd) == -1) goto fail;
|
|
||||||
|
|
||||||
return cword;
|
done:
|
||||||
|
if (!success) {
|
||||||
|
ui_warn(op, "Unable to compute CRC for file '%s' (%s).",
|
||||||
|
filename, strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
fail:
|
if (buf != MAP_FAILED) {
|
||||||
|
munmap(buf, len);
|
||||||
ui_warn(op, "Unable to compute CRC for file '%s' (%s).",
|
}
|
||||||
filename, strerror(errno));
|
if (fd >= 0) {
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
return cword;
|
return cword;
|
||||||
|
|
||||||
|
@@ -73,11 +73,9 @@ DIST_FILES += rtld_test_Linux-x86_64
|
|||||||
DIST_FILES += rtld_test_Linux-armv7l-gnueabi
|
DIST_FILES += rtld_test_Linux-armv7l-gnueabi
|
||||||
DIST_FILES += rtld_test_Linux-armv7l-gnueabihf
|
DIST_FILES += rtld_test_Linux-armv7l-gnueabihf
|
||||||
|
|
||||||
DIST_FILES += tls_test_Linux-ia64
|
|
||||||
DIST_FILES += tls_test_Linux-x86
|
DIST_FILES += tls_test_Linux-x86
|
||||||
DIST_FILES += tls_test_Linux-x86_64
|
DIST_FILES += tls_test_Linux-x86_64
|
||||||
|
|
||||||
DIST_FILES += tls_test_dso_Linux-ia64.so
|
|
||||||
DIST_FILES += tls_test_dso_Linux-x86.so
|
DIST_FILES += tls_test_dso_Linux-x86.so
|
||||||
DIST_FILES += tls_test_dso_Linux-x86_64.so
|
DIST_FILES += tls_test_dso_Linux-x86_64.so
|
||||||
|
|
||||||
|
5
files.h
5
files.h
@@ -38,10 +38,8 @@ int get_prefixes(Options *op); /* XXX move? */
|
|||||||
int add_kernel_modules_to_package(Options *op, Package *p);
|
int add_kernel_modules_to_package(Options *op, Package *p);
|
||||||
void remove_non_kernel_module_files_from_package(Options *op, Package *p);
|
void remove_non_kernel_module_files_from_package(Options *op, Package *p);
|
||||||
void remove_opengl_files_from_package(Options *op, Package *p);
|
void remove_opengl_files_from_package(Options *op, Package *p);
|
||||||
void remove_trailing_slashes(char *s);
|
|
||||||
int mode_string_to_mode(Options *op, char *s, mode_t *mode);
|
int mode_string_to_mode(Options *op, char *s, mode_t *mode);
|
||||||
char *mode_to_permission_string(mode_t mode);
|
char *mode_to_permission_string(mode_t mode);
|
||||||
int directory_exists(Options *op, const char *dir);
|
|
||||||
int confirm_path(Options *op, const char *path);
|
int confirm_path(Options *op, const char *path);
|
||||||
int mkdir_recursive(Options *op, const char *path, const mode_t mode, int log);
|
int mkdir_recursive(Options *op, const char *path, const mode_t mode, int log);
|
||||||
int mkdir_with_log(Options *op, const char *path, const mode_t mode);
|
int mkdir_with_log(Options *op, const char *path, const mode_t mode);
|
||||||
@@ -66,9 +64,12 @@ void process_libGL_la_files(Options *op, Package *p);
|
|||||||
void process_dot_desktop_files(Options *op, Package *p);
|
void process_dot_desktop_files(Options *op, Package *p);
|
||||||
int set_security_context(Options *op, const char *filename);
|
int set_security_context(Options *op, const char *filename);
|
||||||
void get_default_prefixes_and_paths(Options *op);
|
void get_default_prefixes_and_paths(Options *op);
|
||||||
|
void get_compat32_path(Options *op);
|
||||||
char *nv_strreplace(char *src, char *orig, char *replace);
|
char *nv_strreplace(char *src, char *orig, char *replace);
|
||||||
char *get_filename(Options *op, const char *def, const char *msg);
|
char *get_filename(Options *op, const char *def, const char *msg);
|
||||||
int secure_delete(Options *op, const char *file);
|
int secure_delete(Options *op, const char *file);
|
||||||
void invalidate_package_entry(PackageEntry *entry);
|
void invalidate_package_entry(PackageEntry *entry);
|
||||||
|
int is_subdirectory(const char *dir, const char *subdir, int *is_subdir);
|
||||||
|
void add_libgl_abi_symlink(Options *op, Package *p);
|
||||||
|
|
||||||
#endif /* __NVIDIA_INSTALLER_FILES_H__ */
|
#endif /* __NVIDIA_INSTALLER_FILES_H__ */
|
||||||
|
@@ -76,12 +76,11 @@ int install_from_cwd(Options *op)
|
|||||||
{
|
{
|
||||||
Package *p;
|
Package *p;
|
||||||
CommandList *c;
|
CommandList *c;
|
||||||
const char *msg;
|
|
||||||
int ret;
|
int ret;
|
||||||
int ran_pre_install_hook = FALSE;
|
int ran_pre_install_hook = FALSE;
|
||||||
HookScriptStatus res;
|
HookScriptStatus res;
|
||||||
|
|
||||||
static const char edit_your_xf86config[] =
|
static const char* edit_your_xf86config =
|
||||||
"Please update your XF86Config or xorg.conf file as "
|
"Please update your XF86Config or xorg.conf file as "
|
||||||
"appropriate; see the file /usr/share/doc/"
|
"appropriate; see the file /usr/share/doc/"
|
||||||
"NVIDIA_GLX-1.0/README.txt for details.";
|
"NVIDIA_GLX-1.0/README.txt for details.";
|
||||||
@@ -93,6 +92,10 @@ int install_from_cwd(Options *op)
|
|||||||
|
|
||||||
if ((p = parse_manifest(op)) == NULL) goto failed;
|
if ((p = parse_manifest(op)) == NULL) goto failed;
|
||||||
|
|
||||||
|
if (!op->x_files_packaged) {
|
||||||
|
edit_your_xf86config = "";
|
||||||
|
}
|
||||||
|
|
||||||
ui_set_title(op, "%s (%s)", p->description, p->version);
|
ui_set_title(op, "%s (%s)", p->description, p->version);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -248,6 +251,15 @@ int install_from_cwd(Options *op)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!set_destinations(op, p)) goto failed;
|
if (!set_destinations(op, p)) goto failed;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if we are installing OpenGL libraries, ensure that a symlink gets
|
||||||
|
* installed to /usr/lib/libGL.so.1. add_libgl_abi_symlink() sets its own
|
||||||
|
* destination, so it must be called after set_destinations().
|
||||||
|
*/
|
||||||
|
if (!op->kernel_module_only && !op->no_opengl_files) {
|
||||||
|
add_libgl_abi_symlink(op, p);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* uninstall the existing driver; this needs to be done before
|
* uninstall the existing driver; this needs to be done before
|
||||||
@@ -296,6 +308,23 @@ int install_from_cwd(Options *op)
|
|||||||
if (op->dkms && !dkms_install_module(op, p->version, get_kernel_name(op)))
|
if (op->dkms && !dkms_install_module(op, p->version, get_kernel_name(op)))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
|
/* Make sure the RM is loaded */
|
||||||
|
|
||||||
|
if (!op->no_kernel_module || op->dkms) {
|
||||||
|
/*
|
||||||
|
* If a kernel module was installed the normal way, it should have been
|
||||||
|
* left loaded by test_kernel_module(). However, older versions of
|
||||||
|
* nvidia-uninstall don't honor the --skip-module-unload option, so
|
||||||
|
* uninstalling a previous driver may have unloaded the module that
|
||||||
|
* test_kernel_module() loaded. Just in case that happened, modprobe it
|
||||||
|
* again here.
|
||||||
|
*
|
||||||
|
* When installing the module via DKMS, the module is not loaded to
|
||||||
|
* begin with.
|
||||||
|
*/
|
||||||
|
if (!load_kernel_module(op, p)) goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
/* run the distro postinstall script */
|
/* run the distro postinstall script */
|
||||||
|
|
||||||
run_distro_hook(op, "post-install");
|
run_distro_hook(op, "post-install");
|
||||||
@@ -307,7 +336,6 @@ int install_from_cwd(Options *op)
|
|||||||
|
|
||||||
check_installed_files_from_package(op, p);
|
check_installed_files_from_package(op, p);
|
||||||
|
|
||||||
if (!check_sysvipc(op)) goto failed;
|
|
||||||
if (!check_runtime_configuration(op, p)) goto failed;
|
if (!check_runtime_configuration(op, p)) goto failed;
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
@@ -321,28 +349,22 @@ int install_from_cwd(Options *op)
|
|||||||
|
|
||||||
/* ask the user if they would like to run nvidia-xconfig */
|
/* ask the user if they would like to run nvidia-xconfig */
|
||||||
|
|
||||||
ret = ui_yes_no(op, op->run_nvidia_xconfig,
|
const char *msg = "Would you like to run the nvidia-xconfig utility "
|
||||||
"Would you like to run the nvidia-xconfig utility "
|
"to automatically update your X configuration file "
|
||||||
"to automatically update your X configuration file "
|
"so that the NVIDIA X driver will be used when you "
|
||||||
"so that the NVIDIA X driver will be used when you "
|
"restart X? Any pre-existing X configuration "
|
||||||
"restart X? Any pre-existing X configuration "
|
"file will be backed up.";
|
||||||
"file will be backed up.");
|
|
||||||
|
|
||||||
if (ret) {
|
ret = run_nvidia_xconfig(op, FALSE, msg, op->run_nvidia_xconfig);
|
||||||
ret = run_nvidia_xconfig(op, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ui_message(op, "Your X configuration file has been successfully "
|
ui_message(op, "Your X configuration file has been successfully "
|
||||||
"updated. Installation of the %s (version: %s) is now "
|
"updated. Installation of the %s (version: %s) is now "
|
||||||
"complete.", p->description, p->version);
|
"complete.", p->description, p->version);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
msg = edit_your_xf86config;
|
|
||||||
|
|
||||||
ui_message(op, "Installation of the %s (version: %s) is now "
|
ui_message(op, "Installation of the %s (version: %s) is now "
|
||||||
"complete. %s", p->description,
|
"complete. %s", p->description,
|
||||||
p->version, msg);
|
p->version, edit_your_xf86config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +475,7 @@ dkmscatfailed:
|
|||||||
* will be installed somewhere. Don't offer DKMS as an option if module
|
* will be installed somewhere. Don't offer DKMS as an option if module
|
||||||
* signing was requested. */
|
* signing was requested. */
|
||||||
|
|
||||||
if (find_system_util("dkms") && !op->no_kernel_module_source &&
|
if (op->utils[DKMS] && !op->no_kernel_module_source &&
|
||||||
!(op->module_signing_secret_key && op->module_signing_public_key)) {
|
!(op->module_signing_secret_key && op->module_signing_public_key)) {
|
||||||
op->dkms = ui_yes_no(op, op->dkms,
|
op->dkms = ui_yes_no(op, op->dkms,
|
||||||
"Would you like to register the kernel module "
|
"Would you like to register the kernel module "
|
||||||
@@ -492,14 +514,15 @@ dkmscatfailed:
|
|||||||
|
|
||||||
if ((precompiled_info = find_precompiled_kernel_interface(op, p))) {
|
if ((precompiled_info = find_precompiled_kernel_interface(op, p))) {
|
||||||
|
|
||||||
int i;
|
int i, precompiled_success = TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* make sure the required development tools are present on
|
* make sure the required development tools are present on
|
||||||
* this system before trying to link the kernel interface.
|
* this system before trying to link the kernel interface.
|
||||||
*/
|
*/
|
||||||
if (!check_precompiled_kernel_interface_tools(op)) {
|
if (!check_precompiled_kernel_interface_tools(op)) {
|
||||||
return FALSE;
|
precompiled_success = FALSE;
|
||||||
|
goto precompiled_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -515,10 +538,15 @@ dkmscatfailed:
|
|||||||
for (i = 0; i < precompiled_info->num_files; i++) {
|
for (i = 0; i < precompiled_info->num_files; i++) {
|
||||||
if (!link_kernel_module(op, p, p->kernel_module_build_directory,
|
if (!link_kernel_module(op, p, p->kernel_module_build_directory,
|
||||||
&(precompiled_info->files[i]))) {
|
&(precompiled_info->files[i]))) {
|
||||||
return FALSE;
|
precompiled_success = FALSE;
|
||||||
|
goto precompiled_done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
precompiled_done:
|
||||||
|
free_precompiled(precompiled_info);
|
||||||
|
if (!precompiled_success) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* make sure the required development tools are present on
|
* make sure the required development tools are present on
|
||||||
@@ -624,6 +652,49 @@ int add_this_kernel(Options *op)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void add_conflicting_file(Package *p, int *index, const char *file)
|
||||||
|
{
|
||||||
|
char *c;
|
||||||
|
|
||||||
|
p->conflicting_files = nvrealloc(p->conflicting_files,
|
||||||
|
sizeof(ConflictingFileInfo) * (*index+1));
|
||||||
|
|
||||||
|
p->conflicting_files[*index].name = file;
|
||||||
|
|
||||||
|
if (file == NULL) {
|
||||||
|
/* Adding a terminator to the list. Pretend that the name is
|
||||||
|
* actually an empty string to avoid crashing later. */
|
||||||
|
file = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* match the names of DSOs with "libfoo.so*" by stopping any comparisons
|
||||||
|
* after ".so".
|
||||||
|
*/
|
||||||
|
|
||||||
|
c = strstr(file, ".so.");
|
||||||
|
if (c) {
|
||||||
|
p->conflicting_files[*index].len = (c - file) + 3;
|
||||||
|
} else {
|
||||||
|
p->conflicting_files[*index].len = strlen(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX avoid conflicting with libglx.so if it doesn't include the string
|
||||||
|
* "glxModuleData" to avoid removing the wrong libglx.so (bug 489316)
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (strncmp(file, "libglx.so", p->conflicting_files[*index].len) == 0) {
|
||||||
|
p->conflicting_files[*index].requiredString = "glxModuleData";
|
||||||
|
} else {
|
||||||
|
p->conflicting_files[*index].requiredString = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*index)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* parse_manifest() - open and read the .manifest file in the current
|
* parse_manifest() - open and read the .manifest file in the current
|
||||||
* directory.
|
* directory.
|
||||||
@@ -656,13 +727,14 @@ int add_this_kernel(Options *op)
|
|||||||
|
|
||||||
static Package *parse_manifest (Options *op)
|
static Package *parse_manifest (Options *op)
|
||||||
{
|
{
|
||||||
char *buf, *c, *flag, *tmpstr, *module_suffix = "";
|
char *buf, *c, *tmpstr, *module_suffix = "", *interface_suffix = "";
|
||||||
int done, n, line;
|
int n, line;
|
||||||
int fd, ret, len = 0;
|
int fd, ret, len = 0;
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
Package *p;
|
Package *p;
|
||||||
char *manifest = MAP_FAILED, *ptr;
|
char *manifest = MAP_FAILED, *ptr;
|
||||||
int opengl_files_packaged = FALSE;
|
int opengl_files_packaged = FALSE;
|
||||||
|
int num_conflicting_files = 0;
|
||||||
|
|
||||||
p = (Package *) nvalloc(sizeof (Package));
|
p = (Package *) nvalloc(sizeof (Package));
|
||||||
|
|
||||||
@@ -707,21 +779,22 @@ static Package *parse_manifest (Options *op)
|
|||||||
|
|
||||||
if (op->multiple_kernel_modules) {
|
if (op->multiple_kernel_modules) {
|
||||||
module_suffix = "0";
|
module_suffix = "0";
|
||||||
|
interface_suffix = "-0";
|
||||||
}
|
}
|
||||||
|
|
||||||
p->kernel_module_name = nvstrcat(tmpstr, module_suffix, NULL);
|
p->kernel_module_name = nvstrcat(tmpstr, module_suffix, NULL);
|
||||||
p->kernel_module_filename = nvstrcat(p->kernel_module_name, ".ko", NULL);
|
p->kernel_module_filename = nvstrcat(p->kernel_module_name, ".ko", NULL);
|
||||||
p->kernel_interface_filename = nvstrcat("nv-linux", module_suffix, ".o", NULL);
|
p->kernel_interface_filename = nvstrcat("nv-linux", interface_suffix, ".o", NULL);
|
||||||
|
|
||||||
p->kernel_frontend_module_name = nvstrcat(tmpstr, "-frontend", NULL);
|
p->kernel_frontend_module_name = nvstrcat(tmpstr, "-frontend", NULL);
|
||||||
p->kernel_frontend_module_filename = nvstrcat(p->kernel_frontend_module_name,
|
p->kernel_frontend_module_filename = nvstrcat(p->kernel_frontend_module_name,
|
||||||
".ko", NULL);
|
".ko", NULL);
|
||||||
p->kernel_frontend_interface_filename = "nv-linuxfrontend.o";
|
p->kernel_frontend_interface_filename = "nv-linux-frontend.o";
|
||||||
|
|
||||||
p->uvm_kernel_module_name = nvstrcat(tmpstr, "-uvm", NULL);
|
p->uvm_kernel_module_name = nvstrcat(tmpstr, "-uvm", NULL);
|
||||||
p->uvm_kernel_module_filename = nvstrcat(p->uvm_kernel_module_name, ".ko",
|
p->uvm_kernel_module_filename = nvstrcat(p->uvm_kernel_module_name, ".ko",
|
||||||
NULL);
|
NULL);
|
||||||
p->uvm_interface_filename = "nv-linuxuvm.o";
|
p->uvm_interface_filename = "nv-linux-uvm.o";
|
||||||
|
|
||||||
nvfree(tmpstr);
|
nvfree(tmpstr);
|
||||||
|
|
||||||
@@ -790,166 +863,195 @@ static Package *parse_manifest (Options *op)
|
|||||||
|
|
||||||
/* the rest of the file is file entries */
|
/* the rest of the file is file entries */
|
||||||
|
|
||||||
done = FALSE;
|
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
do {
|
for (; (buf = get_next_line(ptr, &ptr, manifest, len)); line++) {
|
||||||
buf = get_next_line(ptr, &ptr, manifest, len);
|
char *flag = NULL;
|
||||||
if (!buf) {
|
PackageEntry entry;
|
||||||
done = TRUE;
|
int entry_success = FALSE;
|
||||||
} else if (buf[0] == '\0') {
|
|
||||||
free(buf);
|
if (buf[0] == '\0') {
|
||||||
done = TRUE;
|
|
||||||
} else {
|
|
||||||
PackageEntry entry;
|
|
||||||
|
|
||||||
/* initialize the new entry */
|
|
||||||
|
|
||||||
memset(&entry, 0, sizeof(PackageEntry));
|
|
||||||
|
|
||||||
/* read the file name and permissions */
|
|
||||||
|
|
||||||
c = buf;
|
|
||||||
|
|
||||||
entry.file = read_next_word(buf, &c);
|
|
||||||
|
|
||||||
if (!entry.file) goto invalid_manifest_file;
|
|
||||||
|
|
||||||
tmpstr = read_next_word(c, &c);
|
|
||||||
|
|
||||||
if (!tmpstr) goto invalid_manifest_file;
|
|
||||||
|
|
||||||
/* translate the mode string into an octal mode */
|
|
||||||
|
|
||||||
ret = mode_string_to_mode(op, tmpstr, &entry.mode);
|
|
||||||
|
|
||||||
free(tmpstr);
|
|
||||||
|
|
||||||
if (!ret) goto invalid_manifest_file;
|
|
||||||
|
|
||||||
/* every file has a type field */
|
|
||||||
|
|
||||||
entry.type = FILE_TYPE_NONE;
|
|
||||||
|
|
||||||
flag = read_next_word(c, &c);
|
|
||||||
if (!flag) goto invalid_manifest_file;
|
|
||||||
|
|
||||||
entry.type = parse_manifest_file_type(flag, &entry.caps);
|
|
||||||
|
|
||||||
if (entry.type == FILE_TYPE_NONE) {
|
|
||||||
nvfree(flag);
|
|
||||||
goto invalid_manifest_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if any UVM files have been packaged, set uvm_files_packaged. */
|
|
||||||
|
|
||||||
if (entry.type == FILE_TYPE_UVM_MODULE_SRC) {
|
|
||||||
op->uvm_files_packaged = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set opengl_files_packaged if any OpenGL files were packaged */
|
|
||||||
|
|
||||||
if (entry.caps.is_opengl) {
|
|
||||||
opengl_files_packaged = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nvfree(flag);
|
|
||||||
|
|
||||||
/* some libs/symlinks have an arch field */
|
|
||||||
|
|
||||||
entry.compat_arch = FILE_COMPAT_ARCH_NONE;
|
|
||||||
|
|
||||||
if (entry.caps.has_arch) {
|
|
||||||
flag = read_next_word(c, &c);
|
|
||||||
if (!flag) goto invalid_manifest_file;
|
|
||||||
|
|
||||||
if (strcmp(flag, "COMPAT32") == 0)
|
|
||||||
entry.compat_arch = FILE_COMPAT_ARCH_COMPAT32;
|
|
||||||
else if (strcmp(flag, "NATIVE") == 0)
|
|
||||||
entry.compat_arch = FILE_COMPAT_ARCH_NATIVE;
|
|
||||||
else {
|
|
||||||
nvfree(flag);
|
|
||||||
goto invalid_manifest_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
nvfree(flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* some libs/symlinks have a class field */
|
|
||||||
|
|
||||||
entry.tls_class = FILE_TLS_CLASS_NONE;
|
|
||||||
|
|
||||||
if (entry.caps.has_tls_class) {
|
|
||||||
flag = read_next_word(c, &c);
|
|
||||||
if (!flag) goto invalid_manifest_file;
|
|
||||||
|
|
||||||
if (strcmp(flag, "CLASSIC") == 0)
|
|
||||||
entry.tls_class = FILE_TLS_CLASS_CLASSIC;
|
|
||||||
else if (strcmp(flag, "NEW") == 0)
|
|
||||||
entry.tls_class = FILE_TLS_CLASS_NEW;
|
|
||||||
else {
|
|
||||||
nvfree(flag);
|
|
||||||
goto invalid_manifest_file;
|
|
||||||
}
|
|
||||||
|
|
||||||
nvfree(flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* libs and documentation have a path field */
|
|
||||||
|
|
||||||
if (entry.caps.has_path) {
|
|
||||||
entry.path = read_next_word(c, &c);
|
|
||||||
if (!entry.path) goto invalid_manifest_file;
|
|
||||||
} else {
|
|
||||||
entry.path = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* symlinks have a target */
|
|
||||||
|
|
||||||
if (entry.caps.is_symlink) {
|
|
||||||
entry.target = read_next_word(c, &c);
|
|
||||||
if (!entry.target) goto invalid_manifest_file;
|
|
||||||
} else {
|
|
||||||
entry.target = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* as a convenience for later, set the 'name' pointer to
|
|
||||||
* the basename contained in 'file' (ie the portion of
|
|
||||||
* 'file' without any leading directory components
|
|
||||||
*/
|
|
||||||
|
|
||||||
entry.name = strrchr(entry.file, '/');
|
|
||||||
if (entry.name) entry.name++;
|
|
||||||
|
|
||||||
if (!entry.name) entry.name = entry.file;
|
|
||||||
|
|
||||||
add_package_entry(p,
|
|
||||||
entry.file,
|
|
||||||
entry.path,
|
|
||||||
entry.name,
|
|
||||||
entry.target,
|
|
||||||
entry.dst,
|
|
||||||
entry.type,
|
|
||||||
entry.tls_class,
|
|
||||||
entry.compat_arch,
|
|
||||||
entry.mode);
|
|
||||||
|
|
||||||
/* free the line */
|
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
line++;
|
|
||||||
|
|
||||||
} while (!done);
|
/* initialize the new entry */
|
||||||
|
|
||||||
|
memset(&entry, 0, sizeof(PackageEntry));
|
||||||
|
|
||||||
|
/* read the file name and permissions */
|
||||||
|
|
||||||
|
c = buf;
|
||||||
|
|
||||||
|
entry.file = read_next_word(buf, &c);
|
||||||
|
|
||||||
|
if (!entry.file) goto entry_done;
|
||||||
|
|
||||||
|
tmpstr = read_next_word(c, &c);
|
||||||
|
|
||||||
|
if (!tmpstr) goto entry_done;
|
||||||
|
|
||||||
|
/* translate the mode string into an octal mode */
|
||||||
|
|
||||||
|
ret = mode_string_to_mode(op, tmpstr, &entry.mode);
|
||||||
|
|
||||||
|
free(tmpstr);
|
||||||
|
|
||||||
|
if (!ret) goto entry_done;
|
||||||
|
|
||||||
|
/* every file has a type field */
|
||||||
|
|
||||||
|
entry.type = FILE_TYPE_NONE;
|
||||||
|
|
||||||
|
flag = read_next_word(c, &c);
|
||||||
|
if (!flag) goto entry_done;
|
||||||
|
|
||||||
|
entry.type = parse_manifest_file_type(flag, &entry.caps);
|
||||||
|
|
||||||
|
if (entry.type == FILE_TYPE_NONE) {
|
||||||
|
goto entry_done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Track whether certain file types were packaged */
|
||||||
|
|
||||||
|
switch (entry.type) {
|
||||||
|
case FILE_TYPE_UVM_MODULE_SRC:
|
||||||
|
op->uvm_files_packaged = TRUE;
|
||||||
|
break;
|
||||||
|
case FILE_TYPE_XMODULE_SHARED_LIB:
|
||||||
|
op->x_files_packaged = TRUE;
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set opengl_files_packaged if any OpenGL files were packaged */
|
||||||
|
|
||||||
|
if (entry.caps.is_opengl) {
|
||||||
|
opengl_files_packaged = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* some libs/symlinks have an arch field */
|
||||||
|
|
||||||
|
entry.compat_arch = FILE_COMPAT_ARCH_NONE;
|
||||||
|
|
||||||
|
if (entry.caps.has_arch) {
|
||||||
|
nvfree(flag);
|
||||||
|
flag = read_next_word(c, &c);
|
||||||
|
if (!flag) goto entry_done;
|
||||||
|
|
||||||
|
if (strcmp(flag, "COMPAT32") == 0)
|
||||||
|
entry.compat_arch = FILE_COMPAT_ARCH_COMPAT32;
|
||||||
|
else if (strcmp(flag, "NATIVE") == 0)
|
||||||
|
entry.compat_arch = FILE_COMPAT_ARCH_NATIVE;
|
||||||
|
else {
|
||||||
|
goto entry_done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if compat32 files are packaged, set compat32_files_packaged */
|
||||||
|
|
||||||
|
if (entry.compat_arch == FILE_COMPAT_ARCH_COMPAT32) {
|
||||||
|
op->compat32_files_packaged = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* some libs/symlinks have a class field */
|
||||||
|
|
||||||
|
entry.tls_class = FILE_TLS_CLASS_NONE;
|
||||||
|
|
||||||
|
if (entry.caps.has_tls_class) {
|
||||||
|
nvfree(flag);
|
||||||
|
flag = read_next_word(c, &c);
|
||||||
|
if (!flag) goto entry_done;
|
||||||
|
|
||||||
|
if (strcmp(flag, "CLASSIC") == 0)
|
||||||
|
entry.tls_class = FILE_TLS_CLASS_CLASSIC;
|
||||||
|
else if (strcmp(flag, "NEW") == 0)
|
||||||
|
entry.tls_class = FILE_TLS_CLASS_NEW;
|
||||||
|
else {
|
||||||
|
goto entry_done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* libs and documentation have a path field */
|
||||||
|
|
||||||
|
if (entry.caps.has_path) {
|
||||||
|
entry.path = read_next_word(c, &c);
|
||||||
|
if (!entry.path) goto invalid_manifest_file;
|
||||||
|
} else {
|
||||||
|
entry.path = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* symlinks have a target */
|
||||||
|
|
||||||
|
if (entry.caps.is_symlink) {
|
||||||
|
entry.target = read_next_word(c, &c);
|
||||||
|
if (!entry.target) goto invalid_manifest_file;
|
||||||
|
} else {
|
||||||
|
entry.target = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* as a convenience for later, set the 'name' pointer to
|
||||||
|
* the basename contained in 'file' (ie the portion of
|
||||||
|
* 'file' without any leading directory components
|
||||||
|
*/
|
||||||
|
|
||||||
|
entry.name = strrchr(entry.file, '/');
|
||||||
|
if (entry.name) entry.name++;
|
||||||
|
|
||||||
|
if (!entry.name) entry.name = entry.file;
|
||||||
|
|
||||||
|
add_package_entry(p,
|
||||||
|
entry.file,
|
||||||
|
entry.path,
|
||||||
|
entry.name,
|
||||||
|
entry.target,
|
||||||
|
entry.dst,
|
||||||
|
entry.type,
|
||||||
|
entry.tls_class,
|
||||||
|
entry.compat_arch,
|
||||||
|
entry.mode);
|
||||||
|
|
||||||
|
|
||||||
|
/* Conflict with any non-wrapper shared libs. Don't conflict with
|
||||||
|
* OpenGL files if we won't be installing any. */
|
||||||
|
if (entry.caps.is_shared_lib && !entry.caps.is_wrapper &&
|
||||||
|
(!entry.caps.is_opengl || !op->no_opengl_files)) {
|
||||||
|
add_conflicting_file(p, &num_conflicting_files, entry.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
entry_success = TRUE;
|
||||||
|
|
||||||
|
entry_done:
|
||||||
|
/* clean up */
|
||||||
|
|
||||||
|
nvfree(buf);
|
||||||
|
nvfree(flag);
|
||||||
|
if (!entry_success) {
|
||||||
|
goto invalid_manifest_file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If no OpenGL files were packaged, we can't install them. Set the
|
||||||
|
* no_opengl_files flag so that everything we skip when explicitly
|
||||||
|
* excluding OpenGL is also skipped when OpenGL is not packaged. */
|
||||||
|
|
||||||
/* If the package does not contain any OpenGL files, do not install
|
|
||||||
* OpenGL files */
|
|
||||||
if (!opengl_files_packaged) {
|
if (!opengl_files_packaged) {
|
||||||
op->no_opengl_files = TRUE;
|
op->no_opengl_files = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX always conflict with these files if OpenGL files will be installed
|
||||||
|
* libglamoregl.so: prevent X from loading libGL and libglx simultaneously
|
||||||
|
* (bug 1299091)
|
||||||
|
* libGLwrapper.so: this library has an SONAME of libGL.so.1 (bug 74761) */
|
||||||
|
if (!op->no_opengl_files) {
|
||||||
|
add_conflicting_file(p, &num_conflicting_files, "libglamoregl.so");
|
||||||
|
add_conflicting_file(p, &num_conflicting_files, "libGLwrapper.so");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* terminate the conflicting files list */
|
||||||
|
add_conflicting_file(p, &num_conflicting_files, NULL);
|
||||||
|
|
||||||
munmap(manifest, len);
|
munmap(manifest, len);
|
||||||
if (fd != -1) close(fd);
|
if (fd != -1) close(fd);
|
||||||
|
|
||||||
@@ -1327,13 +1429,13 @@ generate_done:
|
|||||||
|
|
||||||
if (op->multiple_kernel_modules) {
|
if (op->multiple_kernel_modules) {
|
||||||
if (!sign_kernel_module(op, p->kernel_module_build_directory,
|
if (!sign_kernel_module(op, p->kernel_module_build_directory,
|
||||||
"frontend", TRUE)) {
|
"-frontend", TRUE)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op->install_uvm) {
|
if (op->install_uvm) {
|
||||||
if (!sign_kernel_module(op, p->uvm_module_build_directory, "uvm",
|
if (!sign_kernel_module(op, p->uvm_module_build_directory, "-uvm",
|
||||||
TRUE)) {
|
TRUE)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1391,7 +1493,7 @@ generate_done:
|
|||||||
} else {
|
} else {
|
||||||
/* Remove any ':' characters from fingerprint and truncate */
|
/* Remove any ':' characters from fingerprint and truncate */
|
||||||
char *tmp = nv_strreplace(fingerprint, ":", "");
|
char *tmp = nv_strreplace(fingerprint, ":", "");
|
||||||
strncpy(short_fingerprint, tmp, sizeof(fingerprint));
|
strncpy(short_fingerprint, tmp, sizeof(short_fingerprint));
|
||||||
nvfree(tmp);
|
nvfree(tmp);
|
||||||
}
|
}
|
||||||
short_fingerprint[sizeof(short_fingerprint) - 1] = '\0';
|
short_fingerprint[sizeof(short_fingerprint) - 1] = '\0';
|
||||||
|
130
kernel.c
130
kernel.c
@@ -220,7 +220,7 @@ int determine_kernel_source_path(Options *op, Package *p)
|
|||||||
result = ui_get_input(op, op->kernel_source_path,
|
result = ui_get_input(op, op->kernel_source_path,
|
||||||
"Kernel source path");
|
"Kernel source path");
|
||||||
if (result && result[0]) {
|
if (result && result[0]) {
|
||||||
if (!directory_exists(op, result)) {
|
if (!directory_exists(result)) {
|
||||||
ui_warn(op, "Kernel source path '%s' does not exist.",
|
ui_warn(op, "Kernel source path '%s' does not exist.",
|
||||||
result);
|
result);
|
||||||
free(result);
|
free(result);
|
||||||
@@ -272,7 +272,7 @@ int determine_kernel_source_path(Options *op, Package *p)
|
|||||||
|
|
||||||
/* check that the kernel source path exists */
|
/* check that the kernel source path exists */
|
||||||
|
|
||||||
if (!directory_exists(op, op->kernel_source_path)) {
|
if (!directory_exists(op->kernel_source_path)) {
|
||||||
ui_error (op, "The kernel source path '%s' does not exist. %s",
|
ui_error (op, "The kernel source path '%s' does not exist. %s",
|
||||||
op->kernel_source_path, install_your_kernel_source);
|
op->kernel_source_path, install_your_kernel_source);
|
||||||
op->kernel_source_path = NULL;
|
op->kernel_source_path = NULL;
|
||||||
@@ -364,7 +364,7 @@ int determine_kernel_output_path(Options *op)
|
|||||||
"'--kernel-output-path' commandline option.",
|
"'--kernel-output-path' commandline option.",
|
||||||
op->kernel_output_path);
|
op->kernel_output_path);
|
||||||
|
|
||||||
if (!directory_exists(op, op->kernel_output_path)) {
|
if (!directory_exists(op->kernel_output_path)) {
|
||||||
ui_error(op, "The kernel output path '%s' does not exist.",
|
ui_error(op, "The kernel output path '%s' does not exist.",
|
||||||
op->kernel_output_path);
|
op->kernel_output_path);
|
||||||
op->kernel_output_path = NULL;
|
op->kernel_output_path = NULL;
|
||||||
@@ -382,7 +382,7 @@ int determine_kernel_output_path(Options *op)
|
|||||||
"SYSOUT environment variable.", str);
|
"SYSOUT environment variable.", str);
|
||||||
op->kernel_output_path = str;
|
op->kernel_output_path = str;
|
||||||
|
|
||||||
if (!directory_exists(op, op->kernel_output_path)) {
|
if (!directory_exists(op->kernel_output_path)) {
|
||||||
ui_error(op, "The kernel output path '%s' does not exist.",
|
ui_error(op, "The kernel output path '%s' does not exist.",
|
||||||
op->kernel_output_path);
|
op->kernel_output_path);
|
||||||
op->kernel_output_path = NULL;
|
op->kernel_output_path = NULL;
|
||||||
@@ -404,7 +404,7 @@ int determine_kernel_output_path(Options *op)
|
|||||||
nvfree(str);
|
nvfree(str);
|
||||||
str = nvstrcat("/lib/modules/", tmp, "/build", NULL);
|
str = nvstrcat("/lib/modules/", tmp, "/build", NULL);
|
||||||
|
|
||||||
if (directory_exists(op, str)) {
|
if (directory_exists(str)) {
|
||||||
op->kernel_output_path = str;
|
op->kernel_output_path = str;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -450,13 +450,9 @@ static int attach_signature(Options *op, Package *p,
|
|||||||
if (module_file && fileInfo->signature_size) {
|
if (module_file && fileInfo->signature_size) {
|
||||||
command_ret = fwrite(fileInfo->signature, 1,
|
command_ret = fwrite(fileInfo->signature, 1,
|
||||||
fileInfo->signature_size, module_file);
|
fileInfo->signature_size, module_file);
|
||||||
if (command_ret != fileInfo->signature_size) {
|
if (command_ret == fileInfo->signature_size) {
|
||||||
goto attach_done;
|
op->kernel_module_signed = ret = !ferror(module_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
op->kernel_module_signed = ret = !ferror(module_file);
|
|
||||||
attach_done:
|
|
||||||
fclose(module_file);
|
|
||||||
} else {
|
} else {
|
||||||
ret = (ui_multiple_choice(op, choices, 2, 1,
|
ret = (ui_multiple_choice(op, choices, 2, 1,
|
||||||
"A detached signature was included with "
|
"A detached signature was included with "
|
||||||
@@ -467,6 +463,10 @@ attach_done:
|
|||||||
"still like to install the unsigned "
|
"still like to install the unsigned "
|
||||||
"kernel module?") == 0);
|
"kernel module?") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (module_file) {
|
||||||
|
fclose(module_file);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = (ui_multiple_choice(op, choices, 2, 1,
|
ret = (ui_multiple_choice(op, choices, 2, 1,
|
||||||
"A detached signature was included with the "
|
"A detached signature was included with the "
|
||||||
@@ -578,22 +578,25 @@ static int build_kernel_module_helper(Options *op, const char *dir,
|
|||||||
const char *module, int num_instances)
|
const char *module, int num_instances)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char *instances = NULL, *cmd, *tmp;
|
char *instances = NULL, *cmd, *tmp, *concurrency;
|
||||||
|
|
||||||
tmp = op->multiple_kernel_modules && num_instances ?
|
tmp = op->multiple_kernel_modules && num_instances ?
|
||||||
nvasprintf("%d", num_instances) : NULL;
|
nvasprintf("%d", num_instances) : NULL;
|
||||||
instances = nvstrcat(" NV_BUILD_MODULE_INSTANCES=", tmp, NULL);
|
instances = nvstrcat(" NV_BUILD_MODULE_INSTANCES=", tmp, NULL);
|
||||||
nvfree(tmp);
|
nvfree(tmp);
|
||||||
|
|
||||||
|
concurrency = nvasprintf(" -j%d ", op->concurrency_level);
|
||||||
|
|
||||||
tmp = nvasprintf("Building %s kernel module:", module);
|
tmp = nvasprintf("Building %s kernel module:", module);
|
||||||
ui_status_begin(op, tmp, "Building");
|
ui_status_begin(op, tmp, "Building");
|
||||||
nvfree(tmp);
|
nvfree(tmp);
|
||||||
|
|
||||||
cmd = nvstrcat("cd ", dir, "; ", op->utils[MAKE], " module",
|
cmd = nvstrcat("cd ", dir, "; ", op->utils[MAKE], " module",
|
||||||
" SYSSRC=", op->kernel_source_path,
|
" SYSSRC=", op->kernel_source_path,
|
||||||
" SYSOUT=", op->kernel_output_path,
|
" SYSOUT=", op->kernel_output_path, concurrency,
|
||||||
instances, NULL);
|
instances, NULL);
|
||||||
nvfree(instances);
|
nvfree(instances);
|
||||||
|
nvfree(concurrency);
|
||||||
|
|
||||||
ret = run_command(op, cmd, NULL, TRUE, 25, TRUE);
|
ret = run_command(op, cmd, NULL, TRUE, 25, TRUE);
|
||||||
|
|
||||||
@@ -736,7 +739,7 @@ int sign_kernel_module(Options *op, const char *build_directory,
|
|||||||
const char *module_suffix, int status) {
|
const char *module_suffix, int status) {
|
||||||
char *cmd, *mod_sign_cmd, *mod_sign_hash;
|
char *cmd, *mod_sign_cmd, *mod_sign_hash;
|
||||||
int ret, success;
|
int ret, success;
|
||||||
char *build_module_instances_parameter;
|
char *build_module_instances_parameter, *concurrency;
|
||||||
|
|
||||||
/* if module_signing_script isn't set, then set mod_sign_cmd below to end
|
/* if module_signing_script isn't set, then set mod_sign_cmd below to end
|
||||||
* the nvstrcat() that builds cmd early. */
|
* the nvstrcat() that builds cmd early. */
|
||||||
@@ -762,15 +765,17 @@ int sign_kernel_module(Options *op, const char *build_directory,
|
|||||||
build_module_instances_parameter = nvstrdup("");
|
build_module_instances_parameter = nvstrdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
concurrency = nvasprintf(" -j%d ", op->concurrency_level);
|
||||||
cmd = nvstrcat("cd ", build_directory, "; ", op->utils[MAKE], " module-sign"
|
cmd = nvstrcat("cd ", build_directory, "; ", op->utils[MAKE], " module-sign"
|
||||||
" SYSSRC=", op->kernel_source_path,
|
" SYSSRC=", op->kernel_source_path,
|
||||||
" SYSOUT=", op->kernel_output_path,
|
" SYSOUT=", op->kernel_output_path,
|
||||||
" MODSECKEY=", op->module_signing_secret_key,
|
" MODSECKEY=", op->module_signing_secret_key,
|
||||||
" MODPUBKEY=", op->module_signing_public_key,
|
" MODPUBKEY=", op->module_signing_public_key,
|
||||||
" NV_MODULE_SUFFIX=", module_suffix,
|
" BUILD_MODULES_LIST=\"nvidia", module_suffix, "\" ",
|
||||||
build_module_instances_parameter,
|
build_module_instances_parameter,
|
||||||
mod_sign_cmd ? mod_sign_cmd : "",
|
mod_sign_cmd ? mod_sign_cmd : "",
|
||||||
mod_sign_hash ? mod_sign_hash : "", NULL);
|
mod_sign_hash ? mod_sign_hash : "", concurrency, NULL);
|
||||||
|
nvfree(concurrency);
|
||||||
|
|
||||||
ret = run_command(op, cmd, NULL, TRUE, 20 /* XXX */, TRUE);
|
ret = run_command(op, cmd, NULL, TRUE, 20 /* XXX */, TRUE);
|
||||||
success = ret == 0;
|
success = ret == 0;
|
||||||
@@ -878,11 +883,11 @@ done:
|
|||||||
|
|
||||||
static int build_kernel_interface_file(Options *op, const char *tmpdir,
|
static int build_kernel_interface_file(Options *op, const char *tmpdir,
|
||||||
PrecompiledFileInfo *fileInfo,
|
PrecompiledFileInfo *fileInfo,
|
||||||
const char *kernel_interface_filename,
|
const char *kernel_interface_filename)
|
||||||
const char *module_suffix)
|
|
||||||
{
|
{
|
||||||
char *cmd;
|
char *cmd;
|
||||||
char *kernel_interface, *build_module_instances_parameter = NULL;
|
char *kernel_interface, *build_module_instances_parameter = NULL;
|
||||||
|
char *concurrency;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (op->multiple_kernel_modules) {
|
if (op->multiple_kernel_modules) {
|
||||||
@@ -890,14 +895,16 @@ static int build_kernel_interface_file(Options *op, const char *tmpdir,
|
|||||||
nvasprintf(" NV_BUILD_MODULE_INSTANCES=%d", NV_MAX_MODULE_INSTANCES);
|
nvasprintf(" NV_BUILD_MODULE_INSTANCES=%d", NV_MAX_MODULE_INSTANCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
concurrency = nvasprintf(" -j%d ", op->concurrency_level);
|
||||||
|
|
||||||
cmd = nvstrcat("cd ", tmpdir, "; ", op->utils[MAKE], " ",
|
cmd = nvstrcat("cd ", tmpdir, "; ", op->utils[MAKE], " ",
|
||||||
kernel_interface_filename,
|
kernel_interface_filename,
|
||||||
" SYSSRC=", op->kernel_source_path,
|
" SYSSRC=", op->kernel_source_path,
|
||||||
" SYSOUT=", op->kernel_output_path,
|
" SYSOUT=", op->kernel_output_path, concurrency,
|
||||||
" NV_MODULE_SUFFIX=", module_suffix,
|
|
||||||
build_module_instances_parameter, NULL);
|
build_module_instances_parameter, NULL);
|
||||||
|
|
||||||
nvfree(build_module_instances_parameter);
|
nvfree(build_module_instances_parameter);
|
||||||
|
nvfree(concurrency);
|
||||||
|
|
||||||
ret = run_command(op, cmd, NULL, TRUE, 25 /* XXX */, TRUE);
|
ret = run_command(op, cmd, NULL, TRUE, 25 /* XXX */, TRUE);
|
||||||
|
|
||||||
@@ -978,7 +985,7 @@ static int build_and_pack_interface(Options *op, Package *p, const char *tmpdir,
|
|||||||
interface);
|
interface);
|
||||||
|
|
||||||
dir = nvstrcat(tmpdir, "/", subdir, NULL);
|
dir = nvstrcat(tmpdir, "/", subdir, NULL);
|
||||||
ret = build_kernel_interface_file(op, dir, fileInfo, interface, suffix);
|
ret = build_kernel_interface_file(op, dir, fileInfo, interface);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
goto done;
|
goto done;
|
||||||
@@ -1020,7 +1027,6 @@ int build_kernel_interface(Options *op, Package *p,
|
|||||||
PrecompiledFileInfo ** fileInfos)
|
PrecompiledFileInfo ** fileInfos)
|
||||||
{
|
{
|
||||||
char *tmpdir = NULL;
|
char *tmpdir = NULL;
|
||||||
char *dstfile = NULL;
|
|
||||||
int files_packaged = 0, i;
|
int files_packaged = 0, i;
|
||||||
int num_files = 1, ret = FALSE;
|
int num_files = 1, ret = FALSE;
|
||||||
char *uvmdir = NULL;
|
char *uvmdir = NULL;
|
||||||
@@ -1119,7 +1125,7 @@ interface_done:
|
|||||||
ret = build_and_pack_interface(op, p, tmpdir, "", *fileInfos + num_files,
|
ret = build_and_pack_interface(op, p, tmpdir, "", *fileInfos + num_files,
|
||||||
p->kernel_frontend_interface_filename,
|
p->kernel_frontend_interface_filename,
|
||||||
p->kernel_frontend_module_filename,
|
p->kernel_frontend_module_filename,
|
||||||
"frontend", "");
|
"-frontend", "");
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
@@ -1131,7 +1137,7 @@ interface_done:
|
|||||||
ret = build_and_pack_interface(op, p, tmpdir, UVM_SUBDIR,
|
ret = build_and_pack_interface(op, p, tmpdir, UVM_SUBDIR,
|
||||||
*fileInfos + files_packaged,
|
*fileInfos + files_packaged,
|
||||||
p->uvm_interface_filename,
|
p->uvm_interface_filename,
|
||||||
p->uvm_kernel_module_filename, "uvm", "");
|
p->uvm_kernel_module_filename, "-uvm", "");
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
goto failed;
|
goto failed;
|
||||||
@@ -1153,8 +1159,6 @@ failed:
|
|||||||
nvfree(tmpdir);
|
nvfree(tmpdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dstfile) nvfree(dstfile);
|
|
||||||
|
|
||||||
return files_packaged;
|
return files_packaged;
|
||||||
|
|
||||||
} /* build_kernel_interface() */
|
} /* build_kernel_interface() */
|
||||||
@@ -1449,8 +1453,8 @@ static int ignore_load_error(Options *op, Package *p,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* test_kernel_module() - attempt to insmod the kernel module and then
|
* test_kernel_module() - attempt to insmod the kernel modules and then rmmod
|
||||||
* rmmod it. Return TRUE if the insmod succeeded, or FALSE otherwise.
|
* nvidia-uvm. Return TRUE if the insmod succeeded, or FALSE otherwise.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int test_kernel_module(Options *op, Package *p)
|
int test_kernel_module(Options *op, Package *p)
|
||||||
@@ -1559,9 +1563,14 @@ int test_kernel_module(Options *op, Package *p)
|
|||||||
check_for_warning_messages(op);
|
check_for_warning_messages(op);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* attempt to unload the kernel module, but don't abort if
|
* attempt to unload the UVM kernel module, but don't abort if this fails:
|
||||||
* this fails: the kernel may not have been configured with
|
* the kernel may not have been configured with support for module unloading
|
||||||
* support for module unloading (Linux 2.6).
|
* (Linux 2.6).
|
||||||
|
*
|
||||||
|
* The nvidia module is left loaded in case an X server with
|
||||||
|
* OutputClass-based driver matching is being used. UVM is unloaded to make
|
||||||
|
* it easier to roll back to older versions of the driver whose installers
|
||||||
|
* didn't know how to unload the nvidia-uvm module.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (op->install_uvm) {
|
if (op->install_uvm) {
|
||||||
@@ -1570,17 +1579,6 @@ int test_kernel_module(Options *op, Package *p)
|
|||||||
nvfree(cmd);
|
nvfree(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = nvstrcat(op->utils[RMMOD], " ", p->kernel_module_name, NULL);
|
|
||||||
run_command(op, cmd, NULL, FALSE, 0, TRUE);
|
|
||||||
nvfree(cmd);
|
|
||||||
|
|
||||||
if (op->multiple_kernel_modules) {
|
|
||||||
cmd = nvstrcat(op->utils[RMMOD], " ",
|
|
||||||
p->kernel_frontend_module_name, NULL);
|
|
||||||
run_command(op, cmd, NULL, FALSE, 0, TRUE);
|
|
||||||
nvfree(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
test_exit:
|
test_exit:
|
||||||
@@ -1811,12 +1809,12 @@ PrecompiledInfo *find_precompiled_kernel_interface(Options *op, Package *p)
|
|||||||
|
|
||||||
proc_version_string = read_proc_version(op, op->proc_mount_point);
|
proc_version_string = read_proc_version(op, op->proc_mount_point);
|
||||||
|
|
||||||
if (!proc_version_string) goto failed;
|
if (!proc_version_string) goto done;
|
||||||
|
|
||||||
/* make sure the target directory exists */
|
/* make sure the target directory exists */
|
||||||
|
|
||||||
if (!mkdir_recursive(op, p->kernel_module_build_directory, 0755, FALSE))
|
if (!mkdir_recursive(op, p->kernel_module_build_directory, 0755, FALSE))
|
||||||
goto failed;
|
goto done;
|
||||||
|
|
||||||
memset(search_filelist, 0, sizeof(search_filelist));
|
memset(search_filelist, 0, sizeof(search_filelist));
|
||||||
|
|
||||||
@@ -1883,7 +1881,7 @@ PrecompiledInfo *find_precompiled_kernel_interface(Options *op, Package *p)
|
|||||||
"to compile a kernel interface for your kernel.",
|
"to compile a kernel interface for your kernel.",
|
||||||
op->precompiled_kernel_interfaces_url);
|
op->precompiled_kernel_interfaces_url);
|
||||||
free_search_filelist(search_filelist);
|
free_search_filelist(search_filelist);
|
||||||
return NULL;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1907,21 +1905,18 @@ PrecompiledInfo *find_precompiled_kernel_interface(Options *op, Package *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info) {
|
done:
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
failed:
|
nvfree(proc_version_string);
|
||||||
|
|
||||||
if (op->expert) {
|
if (!info && op->expert) {
|
||||||
ui_message(op, "No precompiled kernel interface was found to match "
|
ui_message(op, "No precompiled kernel interface was found to match "
|
||||||
"your kernel; this means that the installer will need to "
|
"your kernel; this means that the installer will need to "
|
||||||
"compile a new kernel interface.");
|
"compile a new kernel interface.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return info;
|
||||||
|
}
|
||||||
} /* find_precompiled_kernel_interface() */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2022,7 +2017,7 @@ static char *default_kernel_module_installation_path(Options *op)
|
|||||||
|
|
||||||
str = nvstrcat("/lib/modules/", tmp, "/kernel", NULL);
|
str = nvstrcat("/lib/modules/", tmp, "/kernel", NULL);
|
||||||
|
|
||||||
if (directory_exists(op, str)) {
|
if (directory_exists(str)) {
|
||||||
free(str);
|
free(str);
|
||||||
str = nvstrcat("/lib/modules/", tmp, "/kernel/drivers/video", NULL);
|
str = nvstrcat("/lib/modules/", tmp, "/kernel/drivers/video", NULL);
|
||||||
return str;
|
return str;
|
||||||
@@ -2114,7 +2109,7 @@ static char *default_kernel_source_path(Options *op)
|
|||||||
if (tmp) {
|
if (tmp) {
|
||||||
str = nvstrcat("/lib/modules/", tmp, "/source", NULL);
|
str = nvstrcat("/lib/modules/", tmp, "/source", NULL);
|
||||||
|
|
||||||
if (directory_exists(op, str)) {
|
if (directory_exists(str)) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2122,7 +2117,7 @@ static char *default_kernel_source_path(Options *op)
|
|||||||
|
|
||||||
str = nvstrcat("/lib/modules/", tmp, "/build", NULL);
|
str = nvstrcat("/lib/modules/", tmp, "/build", NULL);
|
||||||
|
|
||||||
if (directory_exists(op, str)) {
|
if (directory_exists(str)) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2134,7 +2129,7 @@ static char *default_kernel_source_path(Options *op)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
str = nvstrcat("/usr/src/linux-", tmp, NULL);
|
str = nvstrcat("/usr/src/linux-", tmp, NULL);
|
||||||
if (directory_exists(op, str)) {
|
if (directory_exists(str)) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2143,7 +2138,7 @@ static char *default_kernel_source_path(Options *op)
|
|||||||
|
|
||||||
/* finally, try /usr/src/linux */
|
/* finally, try /usr/src/linux */
|
||||||
|
|
||||||
if (directory_exists(op, "/usr/src/linux")) {
|
if (directory_exists("/usr/src/linux")) {
|
||||||
return "/usr/src/linux";
|
return "/usr/src/linux";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2294,12 +2289,12 @@ download_updated_kernel_interface(Options *op, Package *p,
|
|||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int dst_fd = -1;
|
int dst_fd = -1;
|
||||||
int length, i;
|
int length = 0, i;
|
||||||
char *url = NULL;
|
char *url = NULL;
|
||||||
char *tmpfile = NULL;
|
char *tmpfile = NULL;
|
||||||
char *dstfile = NULL;
|
char *dstfile = NULL;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
char *str = (void *) -1;
|
char *str = MAP_FAILED;
|
||||||
char *ptr, *s;
|
char *ptr, *s;
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
PrecompiledInfo *info = NULL;
|
PrecompiledInfo *info = NULL;
|
||||||
@@ -2334,7 +2329,7 @@ download_updated_kernel_interface(Options *op, Package *p,
|
|||||||
/* map the file into memory for easier reading */
|
/* map the file into memory for easier reading */
|
||||||
|
|
||||||
str = mmap(0, length, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
|
str = mmap(0, length, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
|
||||||
if (str == (void *) -1) goto done;
|
if (str == MAP_FAILED) goto done;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* loop over each line of the updates file: each line should be of
|
* loop over each line of the updates file: each line should be of
|
||||||
@@ -2431,19 +2426,18 @@ download_updated_kernel_interface(Options *op, Package *p,
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
if (dstfile) nvfree(dstfile);
|
nvfree(dstfile);
|
||||||
if (buf) nvfree(buf);
|
nvfree(buf);
|
||||||
if (str != (void *) -1) munmap(str, stat_buf.st_size);
|
if (str != MAP_FAILED) munmap(str, length);
|
||||||
if (dst_fd > 0) close(dst_fd);
|
if (dst_fd > 0) close(dst_fd);
|
||||||
if (fd > 0) close(fd);
|
if (fd > 0) close(fd);
|
||||||
|
|
||||||
unlink(tmpfile);
|
unlink(tmpfile);
|
||||||
if (tmpfile) nvfree(tmpfile);
|
nvfree(tmpfile);
|
||||||
if (url) nvfree(url);
|
nvfree(url);
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
}
|
||||||
} /* get_updated_kernel_interfaces() */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
124
manifest.c
124
manifest.c
@@ -32,7 +32,8 @@
|
|||||||
_is_symlink, \
|
_is_symlink, \
|
||||||
_is_shared_lib, \
|
_is_shared_lib, \
|
||||||
_is_opengl, \
|
_is_opengl, \
|
||||||
_is_temporary) \
|
_is_temporary, \
|
||||||
|
_is_wrapper) \
|
||||||
#_name , FILE_TYPE_ ## _name , \
|
#_name , FILE_TYPE_ ## _name , \
|
||||||
{ \
|
{ \
|
||||||
.has_arch = _has_arch, \
|
.has_arch = _has_arch, \
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
.is_shared_lib = _is_shared_lib, \
|
.is_shared_lib = _is_shared_lib, \
|
||||||
.is_opengl = _is_opengl, \
|
.is_opengl = _is_opengl, \
|
||||||
.is_temporary = _is_temporary, \
|
.is_temporary = _is_temporary, \
|
||||||
|
.is_wrapper = _is_wrapper, \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -56,62 +58,65 @@ static const struct {
|
|||||||
} packageEntryFileTypeTable[] = {
|
} packageEntryFileTypeTable[] = {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* is_temporary ------------------------------------+
|
* is_wrapper ---------------------------------------+
|
||||||
* is_opengl ---------------------------------+ |
|
* is_temporary ------------------------------------+ |
|
||||||
* is_shared_lib ------------------------------+ | |
|
* is_opengl ---------------------------------+ | |
|
||||||
* is_symlink ---------------------------+ | | |
|
* is_shared_lib ------------------------------+ | | |
|
||||||
* has_path ------------------------+ | | | |
|
* is_symlink ---------------------------+ | | | |
|
||||||
* installable ---------------------+ | | | | |
|
* has_path ------------------------+ | | | | |
|
||||||
* has_tls_class ------------------+ | | | | | |
|
* installable ---------------------+ | | | | | |
|
||||||
* has_arch ---------------+ | | | | | | |
|
* has_tls_class ------------------+ | | | | | | |
|
||||||
* | | | | | | | |
|
* has_arch ---------------+ | | | | | | | |
|
||||||
|
* | | | | | | | | |
|
||||||
*/
|
*/
|
||||||
{ ENTRY(KERNEL_MODULE_SRC, F, F, T, F, F, F, F, F ) },
|
{ ENTRY(KERNEL_MODULE_SRC, F, F, T, F, F, F, F, F, F) },
|
||||||
{ ENTRY(KERNEL_MODULE_CMD, F, F, F, F, F, F, F, F ) },
|
{ ENTRY(KERNEL_MODULE_CMD, F, F, F, F, F, F, F, F, F) },
|
||||||
{ ENTRY(KERNEL_MODULE, F, F, T, F, F, F, F, F ) },
|
{ ENTRY(KERNEL_MODULE, F, F, T, F, F, F, F, F, F) },
|
||||||
{ ENTRY(OPENGL_HEADER, F, F, T, T, F, F, T, F ) },
|
{ ENTRY(OPENGL_HEADER, F, F, T, T, F, F, T, F, F) },
|
||||||
{ ENTRY(CUDA_ICD, F, F, T, F, F, F, F, F ) },
|
{ ENTRY(CUDA_ICD, F, F, T, F, F, F, F, F, F) },
|
||||||
{ ENTRY(OPENGL_LIB, T, F, T, F, F, T, T, F ) },
|
{ ENTRY(OPENGL_LIB, T, F, T, F, F, T, T, F, F) },
|
||||||
{ ENTRY(CUDA_LIB, T, F, T, T, F, T, F, F ) },
|
{ ENTRY(CUDA_LIB, T, F, T, T, F, T, F, F, F) },
|
||||||
{ ENTRY(LIBGL_LA, T, F, T, F, F, F, T, T ) },
|
{ ENTRY(OPENCL_LIB, T, F, T, T, F, T, F, F, F) },
|
||||||
{ ENTRY(XLIB_STATIC_LIB, F, F, T, F, F, F, F, F ) },
|
{ ENTRY(OPENCL_WRAPPER_LIB, T, F, T, T, F, T, F, F, T) },
|
||||||
{ ENTRY(XLIB_SHARED_LIB, F, F, T, F, F, T, F, F ) },
|
{ ENTRY(OPENCL_LIB_SYMLINK, T, F, F, T, T, F, F, F, F) },
|
||||||
{ ENTRY(TLS_LIB, T, T, T, T, F, T, T, F ) },
|
{ ENTRY(OPENCL_WRAPPER_SYMLINK, T, F, F, T, T, F, F, F, T) },
|
||||||
{ ENTRY(UTILITY_LIB, T, F, T, F, F, T, F, F ) },
|
{ ENTRY(LIBGL_LA, T, F, T, F, F, F, T, T, F) },
|
||||||
{ ENTRY(DOCUMENTATION, F, F, T, T, F, F, F, F ) },
|
{ ENTRY(TLS_LIB, T, T, T, T, F, T, T, F, F) },
|
||||||
{ ENTRY(APPLICATION_PROFILE, F, F, T, T, F, F, F, F ) },
|
{ ENTRY(UTILITY_LIB, T, F, T, F, F, T, F, F, F) },
|
||||||
{ ENTRY(MANPAGE, F, F, T, T, F, F, F, F ) },
|
{ ENTRY(DOCUMENTATION, F, F, T, T, F, F, F, F, F) },
|
||||||
{ ENTRY(EXPLICIT_PATH, F, F, T, T, F, F, F, F ) },
|
{ ENTRY(APPLICATION_PROFILE, F, F, T, T, F, F, F, F, F) },
|
||||||
{ ENTRY(OPENGL_SYMLINK, T, F, F, F, T, F, T, F ) },
|
{ ENTRY(MANPAGE, F, F, T, T, F, F, F, F, F) },
|
||||||
{ ENTRY(CUDA_SYMLINK, T, F, F, T, T, F, F, F ) },
|
{ ENTRY(EXPLICIT_PATH, F, F, T, T, F, F, F, F, F) },
|
||||||
{ ENTRY(XLIB_SYMLINK, F, F, F, F, T, F, F, F ) },
|
{ ENTRY(OPENGL_SYMLINK, T, F, F, F, T, F, T, F, F) },
|
||||||
{ ENTRY(TLS_SYMLINK, T, T, F, T, T, F, T, F ) },
|
{ ENTRY(CUDA_SYMLINK, T, F, F, T, T, F, F, F, F) },
|
||||||
{ ENTRY(UTILITY_LIB_SYMLINK, T, F, F, F, T, F, F, F ) },
|
{ ENTRY(TLS_SYMLINK, T, T, F, T, T, F, T, F, F) },
|
||||||
{ ENTRY(INSTALLER_BINARY, F, F, T, F, F, F, F, F ) },
|
{ ENTRY(UTILITY_LIB_SYMLINK, T, F, F, F, T, F, F, F, F) },
|
||||||
{ ENTRY(UTILITY_BINARY, F, F, T, F, F, F, F, F ) },
|
{ ENTRY(INSTALLER_BINARY, F, F, T, F, F, F, F, F, F) },
|
||||||
{ ENTRY(UTILITY_BIN_SYMLINK, F, F, F, F, T, F, F, F ) },
|
{ ENTRY(UTILITY_BINARY, F, F, T, F, F, F, F, F, F) },
|
||||||
{ ENTRY(DOT_DESKTOP, F, F, T, T, F, F, F, T ) },
|
{ ENTRY(UTILITY_BIN_SYMLINK, F, F, F, F, T, F, F, F, F) },
|
||||||
{ ENTRY(XMODULE_SHARED_LIB, F, F, T, T, F, T, F, F ) },
|
{ ENTRY(DOT_DESKTOP, F, F, T, T, F, F, F, T, F) },
|
||||||
{ ENTRY(XMODULE_SYMLINK, F, F, F, T, T, F, F, F ) },
|
{ ENTRY(XMODULE_SHARED_LIB, F, F, T, T, F, T, F, F, F) },
|
||||||
{ ENTRY(GLX_MODULE_SHARED_LIB, F, F, T, T, F, T, T, F ) },
|
{ ENTRY(XMODULE_SYMLINK, F, F, F, T, T, F, F, F, F) },
|
||||||
{ ENTRY(GLX_MODULE_SYMLINK, F, F, F, T, T, F, T, F ) },
|
{ ENTRY(GLX_MODULE_SHARED_LIB, F, F, T, T, F, T, T, F, F) },
|
||||||
{ ENTRY(XMODULE_NEWSYM, F, F, F, T, T, F, F, F ) },
|
{ ENTRY(GLX_MODULE_SYMLINK, F, F, F, T, T, F, T, F, F) },
|
||||||
{ ENTRY(VDPAU_LIB, T, F, T, T, F, T, F, F ) },
|
{ ENTRY(XMODULE_NEWSYM, F, F, F, T, T, F, F, F, F) },
|
||||||
{ ENTRY(VDPAU_WRAPPER_LIB, T, F, T, T, F, T, F, F ) },
|
{ ENTRY(VDPAU_LIB, T, F, T, T, F, T, F, F, F) },
|
||||||
{ ENTRY(VDPAU_SYMLINK, T, F, F, T, T, F, F, F ) },
|
{ ENTRY(VDPAU_WRAPPER_LIB, T, F, T, T, F, T, F, F, T) },
|
||||||
{ ENTRY(VDPAU_WRAPPER_SYMLINK, T, F, F, T, T, F, F, F ) },
|
{ ENTRY(VDPAU_SYMLINK, T, F, F, T, T, F, F, F, F) },
|
||||||
{ ENTRY(NVCUVID_LIB, T, F, T, F, F, T, F, F ) },
|
{ ENTRY(VDPAU_WRAPPER_SYMLINK, T, F, F, T, T, F, F, F, T) },
|
||||||
{ ENTRY(NVCUVID_LIB_SYMLINK, T, F, F, F, T, F, F, F ) },
|
{ ENTRY(NVCUVID_LIB, T, F, T, F, F, T, F, F, F) },
|
||||||
{ ENTRY(ENCODEAPI_LIB, T, F, T, F, F, T, F, F ) },
|
{ ENTRY(NVCUVID_LIB_SYMLINK, T, F, F, F, T, F, F, F, F) },
|
||||||
{ ENTRY(ENCODEAPI_LIB_SYMLINK, T, F, F, F, T, F, F, F ) },
|
{ ENTRY(ENCODEAPI_LIB, T, F, T, F, F, T, F, F, F) },
|
||||||
{ ENTRY(VGX_LIB, F, F, T, F, F, T, F, F ) },
|
{ ENTRY(ENCODEAPI_LIB_SYMLINK, T, F, F, F, T, F, F, F, F) },
|
||||||
{ ENTRY(VGX_LIB_SYMLINK, F, F, F, F, T, F, F, F ) },
|
{ ENTRY(VGX_LIB, F, F, T, F, F, T, F, F, F) },
|
||||||
{ ENTRY(NVIDIA_MODPROBE, F, F, T, T, F, F, F, F ) },
|
{ ENTRY(VGX_LIB_SYMLINK, F, F, F, F, T, F, F, F, F) },
|
||||||
{ ENTRY(NVIDIA_MODPROBE_MANPAGE,F, F, T, T, F, F, F, F ) },
|
{ ENTRY(NVIDIA_MODPROBE, F, F, T, T, F, F, F, F, F) },
|
||||||
{ ENTRY(MODULE_SIGNING_KEY, F, F, T, F, F, F, F, T ) },
|
{ ENTRY(NVIDIA_MODPROBE_MANPAGE,F, F, T, T, F, F, F, F, F) },
|
||||||
{ ENTRY(NVIFR_LIB, T, F, T, F, F, T, F, F ) },
|
{ ENTRY(MODULE_SIGNING_KEY, F, F, T, F, F, F, F, T, F) },
|
||||||
{ ENTRY(NVIFR_LIB_SYMLINK, T, F, F, F, T, F, F, F ) },
|
{ ENTRY(NVIFR_LIB, T, F, T, F, F, T, F, F, F) },
|
||||||
{ ENTRY(UVM_MODULE_SRC, F, F, T, F, F, F, F, F ) },
|
{ ENTRY(NVIFR_LIB_SYMLINK, T, F, F, F, T, F, F, F, F) },
|
||||||
|
{ ENTRY(UVM_MODULE_SRC, F, F, T, F, F, F, F, F, F) },
|
||||||
|
{ ENTRY(XORG_OUTPUTCLASS_CONFIG,F, F, T, F, F, F, F, F, F) },
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -123,7 +128,7 @@ PackageEntryFileCapabilities get_file_type_capabilities(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
PackageEntryFileCapabilities nullCaps = { F, F, F, F, F, F, F, F };
|
PackageEntryFileCapabilities nullCaps = { F, F, F, F, F, F, F, F, F };
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LEN(packageEntryFileTypeTable); i++) {
|
for (i = 0; i < ARRAY_LEN(packageEntryFileTypeTable); i++) {
|
||||||
if (type == packageEntryFileTypeTable[i].type) {
|
if (type == packageEntryFileTypeTable[i].type) {
|
||||||
@@ -192,6 +197,11 @@ void get_installable_file_type_list(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((type == FILE_TYPE_XORG_OUTPUTCLASS_CONFIG) &&
|
||||||
|
!op->xorg_supports_output_class) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
installable_file_types->types[type] = 1;
|
installable_file_types->types[type] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
395
misc.c
395
misc.c
@@ -127,16 +127,19 @@ int check_euid(Options *op)
|
|||||||
|
|
||||||
int adjust_cwd(Options *op, const char *program_name)
|
int adjust_cwd(Options *op, const char *program_name)
|
||||||
{
|
{
|
||||||
char *c, *path;
|
char *c;
|
||||||
int len;
|
int success = TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* extract any pathname portion out of the program_name and chdir
|
* extract any pathname portion out of the program_name and chdir
|
||||||
* to it
|
* to it
|
||||||
*/
|
*/
|
||||||
|
|
||||||
c = strrchr(program_name, '/');
|
c = strrchr(program_name, '/');
|
||||||
if (c) {
|
if (c) {
|
||||||
|
int len;
|
||||||
|
char *path;
|
||||||
|
|
||||||
len = c - program_name + 1;
|
len = c - program_name + 1;
|
||||||
path = (char *) nvalloc(len + 1);
|
path = (char *) nvalloc(len + 1);
|
||||||
strncpy(path, program_name, len);
|
strncpy(path, program_name, len);
|
||||||
@@ -145,14 +148,13 @@ int adjust_cwd(Options *op, const char *program_name)
|
|||||||
if (chdir(path)) {
|
if (chdir(path)) {
|
||||||
fprintf(stderr, "Unable to chdir to %s (%s)",
|
fprintf(stderr, "Unable to chdir to %s (%s)",
|
||||||
path, strerror(errno));
|
path, strerror(errno));
|
||||||
return FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
free(path);
|
free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return success;
|
||||||
|
}
|
||||||
} /* adjust_cwd() */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -292,13 +294,14 @@ int run_command(Options *op, const char *cmd, char **data, int output,
|
|||||||
* command.
|
* command.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((stream = popen(cmd2, "r")) == NULL) {
|
stream = popen(cmd2, "r");
|
||||||
|
nvfree(cmd2);
|
||||||
|
|
||||||
|
if (stream == NULL) {
|
||||||
ui_error(op, "Failure executing command '%s' (%s).",
|
ui_error(op, "Failure executing command '%s' (%s).",
|
||||||
cmd, strerror(errno));
|
cmd, strerror(errno));
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cmd2);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read from the stream, filling and growing buf, until we hit
|
* read from the stream, filling and growing buf, until we hit
|
||||||
@@ -459,6 +462,7 @@ static const Util __utils[] = {
|
|||||||
[PKG_CONFIG] = { "pkg-config", "pkg-config" },
|
[PKG_CONFIG] = { "pkg-config", "pkg-config" },
|
||||||
[XSERVER] = { "X", "xserver" },
|
[XSERVER] = { "X", "xserver" },
|
||||||
[OPENSSL] = { "openssl", "openssl" },
|
[OPENSSL] = { "openssl", "openssl" },
|
||||||
|
[DKMS] = { "dkms", "dkms" },
|
||||||
|
|
||||||
/* ModuleUtils */
|
/* ModuleUtils */
|
||||||
[INSMOD] = { "insmod", "module-init-tools' or 'kmod" },
|
[INSMOD] = { "insmod", "module-init-tools' or 'kmod" },
|
||||||
@@ -592,6 +596,8 @@ int check_proc_modprobe_path(Options *op)
|
|||||||
char *target = get_resolved_symlink_target(op, found_modprobe);
|
char *target = get_resolved_symlink_target(op, found_modprobe);
|
||||||
if (target && access(target, F_OK | X_OK) == 0) {
|
if (target && access(target, F_OK | X_OK) == 0) {
|
||||||
found_modprobe = target;
|
found_modprobe = target;
|
||||||
|
} else {
|
||||||
|
nvfree(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,6 +612,8 @@ int check_proc_modprobe_path(Options *op)
|
|||||||
if (target && access(target, F_OK | X_OK) == 0) {
|
if (target && access(target, F_OK | X_OK) == 0) {
|
||||||
nvfree(proc_modprobe);
|
nvfree(proc_modprobe);
|
||||||
proc_modprobe = target;
|
proc_modprobe = target;
|
||||||
|
} else {
|
||||||
|
nvfree(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1115,54 +1123,35 @@ void should_install_opengl_headers(Options *op, Package *p)
|
|||||||
void should_install_compat32_files(Options *op, Package *p)
|
void should_install_compat32_files(Options *op, Package *p)
|
||||||
{
|
{
|
||||||
#if defined(NV_X86_64)
|
#if defined(NV_X86_64)
|
||||||
int i, have_compat32_files = FALSE, install_compat32_files;
|
|
||||||
|
|
||||||
/*
|
/* If there are no compat32 files, there is nothing to do */
|
||||||
* first, scan through the package to see if we have any
|
if (!op->compat32_files_packaged) {
|
||||||
* 32bit compatibility files to install.
|
op->install_compat32_libs = NV_OPTIONAL_BOOL_FALSE;
|
||||||
*/
|
|
||||||
|
|
||||||
for (i = 0; i < p->num_entries; i++) {
|
|
||||||
if (p->entries[i].compat_arch == FILE_COMPAT_ARCH_COMPAT32) {
|
|
||||||
have_compat32_files = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!have_compat32_files)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
|
||||||
* Ask the user if the 32-bit compatibility libraries are
|
|
||||||
* to be installed. If yes, check if the chosen prefix
|
|
||||||
* exists. If not, notify the user and ask him/her if the
|
|
||||||
* files are to be installed anyway.
|
|
||||||
*/
|
|
||||||
install_compat32_files = ui_yes_no(op, TRUE,
|
|
||||||
"Install NVIDIA's 32-bit compatibility libraries?");
|
|
||||||
|
|
||||||
if (install_compat32_files && (op->compat32_chroot != NULL) &&
|
|
||||||
access(op->compat32_chroot, F_OK) < 0) {
|
|
||||||
|
|
||||||
const char *choices[2] = {
|
|
||||||
"Install compatibility libraries",
|
|
||||||
"Do not install compatibility libraries"
|
|
||||||
};
|
|
||||||
|
|
||||||
install_compat32_files = (ui_multiple_choice(op, choices, 2, 1,
|
|
||||||
"The NVIDIA 32-bit compatibility libraries "
|
|
||||||
"are to be installed relative to the "
|
|
||||||
"top-level prefix (chroot) '%s'; however, "
|
|
||||||
"this directory does not exist. Please "
|
|
||||||
"consult your distribution's documentation "
|
|
||||||
"to confirm the correct top-level "
|
|
||||||
"installation prefix for 32-bit compatiblity "
|
|
||||||
"libraries.\n\nWould you like to install "
|
|
||||||
"NVIDIA 32-bit compatibility libraries "
|
|
||||||
"anyway?", op->compat32_chroot) == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!install_compat32_files) {
|
/* Determine where the compatibility libraries should be installed */
|
||||||
|
get_compat32_path(op);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the user hasn't explicitly specified whether to install compat32
|
||||||
|
* files, ask if the 32-bit compatibility libraries are to be installed.
|
||||||
|
* If yes, check if the chosen prefix exists. If not, notify the user and
|
||||||
|
* ask him/her if the files are to be installed anyway.
|
||||||
|
*/
|
||||||
|
if (op->install_compat32_libs == NV_OPTIONAL_BOOL_DEFAULT) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = ui_yes_no(op, TRUE,
|
||||||
|
"Install NVIDIA's 32-bit compatibility libraries?");
|
||||||
|
|
||||||
|
op->install_compat32_libs = ret ? NV_OPTIONAL_BOOL_TRUE :
|
||||||
|
NV_OPTIONAL_BOOL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (op->install_compat32_libs == NV_OPTIONAL_BOOL_FALSE) {
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < p->num_entries; i++) {
|
for (i = 0; i < p->num_entries; i++) {
|
||||||
if (p->entries[i].compat_arch == FILE_COMPAT_ARCH_COMPAT32) {
|
if (p->entries[i].compat_arch == FILE_COMPAT_ARCH_COMPAT32) {
|
||||||
/* invalidate file */
|
/* invalidate file */
|
||||||
@@ -1343,6 +1332,7 @@ void check_installed_files_from_package(Options *op, Package *p)
|
|||||||
static int check_symlink(Options *op, const char *target, const char *link,
|
static int check_symlink(Options *op, const char *target, const char *link,
|
||||||
const char *descr)
|
const char *descr)
|
||||||
{
|
{
|
||||||
|
int success = TRUE;
|
||||||
char *actual_target;
|
char *actual_target;
|
||||||
|
|
||||||
actual_target = get_symlink_target(op, link);
|
actual_target = get_symlink_target(op, link);
|
||||||
@@ -1375,12 +1365,12 @@ static int check_symlink(Options *op, const char *target, const char *link,
|
|||||||
actual_target,
|
actual_target,
|
||||||
target,
|
target,
|
||||||
link);
|
link);
|
||||||
free(actual_target);
|
success = FALSE;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
|
nvfree(actual_target);
|
||||||
} /* check_symlink() */
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1681,15 +1671,6 @@ static int tls_test_internal(Options *op, int which_tls,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
} /* test_tls_internal() */
|
} /* test_tls_internal() */
|
||||||
|
|
||||||
#else /* defined(NV_TLS_TEST) */
|
|
||||||
|
|
||||||
int tls_test(Options *op, int compat_32_libs)
|
|
||||||
{
|
|
||||||
/* Assume the TLS test passed. */
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(NV_TLS_TEST) */
|
#endif /* defined(NV_TLS_TEST) */
|
||||||
|
|
||||||
|
|
||||||
@@ -1730,19 +1711,27 @@ static int rtld_test_internal(Options *op, Package *p,
|
|||||||
|
|
||||||
int check_runtime_configuration(Options *op, Package *p)
|
int check_runtime_configuration(Options *op, Package *p)
|
||||||
{
|
{
|
||||||
int ret = TRUE;
|
int ret = TRUE, which_tls, which_tls_compat32;
|
||||||
|
|
||||||
|
#if defined(NV_TLS_TEST)
|
||||||
|
which_tls = op->which_tls;
|
||||||
|
which_tls_compat32 = op->which_tls_compat32;
|
||||||
|
#else
|
||||||
|
/* Platforms that don't need the TLS test only support "new" ELF TLS. */
|
||||||
|
which_tls = which_tls_compat32 = TLS_LIB_NEW_TLS;
|
||||||
|
#endif /* NV_TLS_TEST */
|
||||||
|
|
||||||
ui_status_begin(op, "Running runtime sanity check:", "Checking");
|
ui_status_begin(op, "Running runtime sanity check:", "Checking");
|
||||||
|
|
||||||
#if defined(NV_X86_64)
|
#if defined(NV_X86_64)
|
||||||
ret = rtld_test_internal(op, p, op->which_tls_compat32,
|
ret = rtld_test_internal(op, p, which_tls_compat32,
|
||||||
rtld_test_array_32,
|
rtld_test_array_32,
|
||||||
rtld_test_array_32_size,
|
rtld_test_array_32_size,
|
||||||
TRUE);
|
TRUE);
|
||||||
#endif /* NV_X86_64 */
|
#endif /* NV_X86_64 */
|
||||||
|
|
||||||
if (ret == TRUE) {
|
if (ret == TRUE) {
|
||||||
ret = rtld_test_internal(op, p, op->which_tls,
|
ret = rtld_test_internal(op, p, which_tls,
|
||||||
rtld_test_array,
|
rtld_test_array,
|
||||||
rtld_test_array_size,
|
rtld_test_array_size,
|
||||||
FALSE);
|
FALSE);
|
||||||
@@ -2015,68 +2004,16 @@ static int rtld_test_internal(Options *op, Package *p,
|
|||||||
} /* rtld_test_internal() */
|
} /* rtld_test_internal() */
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* get_distribution() - determine what distribution this is; only used
|
|
||||||
* for several bits of distro-specific behavior requested by
|
|
||||||
* distribution maintainers.
|
|
||||||
*
|
|
||||||
* XXX should we provide a commandline option to override this
|
|
||||||
* detection?
|
|
||||||
*/
|
|
||||||
|
|
||||||
Distribution get_distribution(Options *op)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
char *line = NULL, *ptr;
|
|
||||||
int eof = FALSE;
|
|
||||||
|
|
||||||
if (access("/etc/SuSE-release", F_OK) == 0) return SUSE;
|
|
||||||
if (access("/etc/UnitedLinux-release", F_OK) == 0) return UNITED_LINUX;
|
|
||||||
if (access("/etc/gentoo-release", F_OK) == 0) return GENTOO;
|
|
||||||
if (access("/etc/arch-release", F_OK) == 0) return ARCH;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Attempt to determine if the host system is 'Ubuntu Linux'
|
|
||||||
* based by checking for a line matching DISTRIB_ID=Ubuntu in
|
|
||||||
* the file /etc/lsb-release.
|
|
||||||
*/
|
|
||||||
fp = fopen("/etc/lsb-release", "r");
|
|
||||||
if (fp != NULL) {
|
|
||||||
while (((line = fget_next_line(fp, &eof))
|
|
||||||
!= NULL) && !eof) {
|
|
||||||
ptr = strstr(line, "DISTRIB_ID");
|
|
||||||
if (ptr != NULL) {
|
|
||||||
fclose(fp);
|
|
||||||
while (ptr != NULL && *ptr != '=') ptr++;
|
|
||||||
if (ptr != NULL && *ptr == '=') ptr++;
|
|
||||||
if (ptr != NULL && *ptr != '\0')
|
|
||||||
if (!strcasecmp(ptr, "Ubuntu")) return UBUNTU;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (access("/etc/debian_version", F_OK) == 0) return DEBIAN;
|
|
||||||
|
|
||||||
return OTHER;
|
|
||||||
|
|
||||||
} /* get_distribution() */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get_xserver_information() - parse the versionString (from `X
|
* get_xserver_information() - parse the versionString (from `X
|
||||||
* -version`) and assign relevant information that we infer from the X
|
* -version`) and assign relevant information that we infer from the X
|
||||||
* server version.
|
* server version.
|
||||||
*
|
|
||||||
* Note: this implementation should be shared with nvidia-xconfig
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int get_xserver_information(const char *versionString,
|
static int get_xserver_information(const char *versionString,
|
||||||
int *isXorg,
|
|
||||||
int *isModular,
|
int *isModular,
|
||||||
int *autoloadsGLX,
|
int *supportsOutputClassSection)
|
||||||
int *supportsExtensionSection)
|
|
||||||
{
|
{
|
||||||
#define XSERVER_VERSION_FORMAT_1 "X Window System Version"
|
#define XSERVER_VERSION_FORMAT_1 "X Window System Version"
|
||||||
#define XSERVER_VERSION_FORMAT_2 "X.Org X Server"
|
#define XSERVER_VERSION_FORMAT_2 "X.Org X Server"
|
||||||
@@ -2087,18 +2024,15 @@ static int get_xserver_information(const char *versionString,
|
|||||||
/* check if this is an XFree86 X server */
|
/* check if this is an XFree86 X server */
|
||||||
|
|
||||||
if (strstr(versionString, "XFree86 Version")) {
|
if (strstr(versionString, "XFree86 Version")) {
|
||||||
*isXorg = FALSE;
|
|
||||||
*isModular = FALSE;
|
*isModular = FALSE;
|
||||||
*autoloadsGLX = FALSE;
|
|
||||||
*supportsExtensionSection = FALSE;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this must be an X.Org X server */
|
|
||||||
|
|
||||||
*isXorg = TRUE;
|
/*
|
||||||
|
* This must be an X.Org X server. Attempt to parse the major.minor version
|
||||||
/* attempt to parse the major.minor version out of the string */
|
* out of the string
|
||||||
|
*/
|
||||||
|
|
||||||
found = FALSE;
|
found = FALSE;
|
||||||
|
|
||||||
@@ -2129,30 +2063,13 @@ static int get_xserver_information(const char *versionString,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* supportsExtensionSection: support for the "Extension" xorg.conf
|
* support for using OutputClass sections to automatically match drivers to
|
||||||
* section was added between X.Org 6.7 and 6.8. To account for
|
* platform devices was added in X.Org xserver 1.16.
|
||||||
* the X server version wrap, it is easier to check for X servers
|
|
||||||
* that do not support the Extension section: 6.x (x < 8) X
|
|
||||||
* servers.
|
|
||||||
*/
|
*/
|
||||||
|
if ((major == 6) || (major == 7) || ((major == 1) && (minor < 16))) {
|
||||||
if ((major == 6) && (minor < 8)) {
|
*supportsOutputClassSection = FALSE;
|
||||||
*supportsExtensionSection = FALSE;
|
|
||||||
} else {
|
} else {
|
||||||
*supportsExtensionSection = TRUE;
|
*supportsOutputClassSection = TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* support for autoloading GLX was added in X.Org 1.5. To account
|
|
||||||
* for the X server version wrap, it is easier to check for X
|
|
||||||
* servers that do not support GLX autoloading: 6.x, 7.x, or < 1.5
|
|
||||||
* X servers.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ((major == 6) || (major == 7) || ((major == 1) && (minor < 5))) {
|
|
||||||
*autoloadsGLX = FALSE;
|
|
||||||
} else {
|
|
||||||
*autoloadsGLX = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -2162,23 +2079,23 @@ static int get_xserver_information(const char *versionString,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check_for_modular_xorg() - run the X binary with the '-version'
|
* query_xorg_version() - run the X binary with the '-version'
|
||||||
* command line option and extract the version in an attempt to
|
* command line option and extract the version.
|
||||||
* determine if it's part of a modular Xorg release. If the version
|
|
||||||
* can't be determined, we assume it's not.
|
|
||||||
*
|
*
|
||||||
* This should eventually get collapsed with xconfigGetXServerInUse()
|
* Using the version, try to infer if it's part of a modular Xorg release. If
|
||||||
* in nvidia-xconfig.
|
* the version can't be determined, we assume it's not.
|
||||||
|
*
|
||||||
|
* This function assigns the following fields:
|
||||||
|
* op->modular_xorg
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define OLD_VERSION_FORMAT "(protocol Version %d, revision %d, vendor release %d)"
|
#define OLD_VERSION_FORMAT "(protocol Version %d, revision %d, vendor release %d)"
|
||||||
#define NEW_VERSION_FORMAT "X Protocol Version %d, Revision %d, Release %d."
|
#define NEW_VERSION_FORMAT "X Protocol Version %d, Revision %d, Release %d."
|
||||||
|
|
||||||
int check_for_modular_xorg(Options *op)
|
void query_xorg_version(Options *op)
|
||||||
{
|
{
|
||||||
char *cmd = NULL, *data = NULL;
|
char *cmd = NULL, *data = NULL;
|
||||||
int modular_xorg = FALSE;
|
int ret = FALSE;
|
||||||
int dummy, ret;
|
|
||||||
|
|
||||||
if (!op->utils[XSERVER])
|
if (!op->utils[XSERVER])
|
||||||
goto done;
|
goto done;
|
||||||
@@ -2195,30 +2112,27 @@ int check_for_modular_xorg(Options *op)
|
|||||||
* modular
|
* modular
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = get_xserver_information(data,
|
ret = get_xserver_information(data, &op->modular_xorg,
|
||||||
&dummy, /* isXorg */
|
&op->xorg_supports_output_class);
|
||||||
&modular_xorg, /* isModular */
|
|
||||||
&dummy, /* autoloadsGLX */
|
|
||||||
&dummy); /* supportsExtensionSection */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* if get_xserver_information() failed, assume the X server is not
|
|
||||||
* modular
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!ret) {
|
|
||||||
modular_xorg = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if no X server was found, or querying the version on the command line
|
||||||
|
* failed, or get_xserver_information() failed, assume the X server is
|
||||||
|
* modular, but does not support OutputClass sections
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
op->modular_xorg = TRUE;
|
||||||
|
op->xorg_supports_output_class = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
nvfree(data);
|
nvfree(data);
|
||||||
nvfree(cmd);
|
nvfree(cmd);
|
||||||
|
}
|
||||||
return modular_xorg;
|
|
||||||
|
|
||||||
} /* check_for_modular_xorg() */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2252,8 +2166,12 @@ int check_for_running_x(Options *op)
|
|||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
snprintf(path, 14, "/tmp/.X%1d-lock", i);
|
snprintf(path, 14, "/tmp/.X%1d-lock", i);
|
||||||
if (read_text_file(path, &buf) == TRUE) {
|
if (read_text_file(path, &buf) == TRUE) {
|
||||||
sscanf(buf, "%d", &pid);
|
int num = sscanf(buf, "%d", &pid);
|
||||||
nvfree(buf);
|
nvfree(buf);
|
||||||
|
if (num != 1) {
|
||||||
|
ui_warn(op, "Failed to read a pid from X lock file '%s'", path);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
snprintf(procpath, 17, "/proc/%d", pid);
|
snprintf(procpath, 17, "/proc/%d", pid);
|
||||||
if (access(procpath, F_OK) == 0) {
|
if (access(procpath, F_OK) == 0) {
|
||||||
ui_log(op, "The file '%s' exists and appears to contain the "
|
ui_log(op, "The file '%s' exists and appears to contain the "
|
||||||
@@ -2491,40 +2409,58 @@ int check_selinux(Options *op)
|
|||||||
/*
|
/*
|
||||||
* run_nvidia_xconfig() - run the `nvidia-xconfig` utility. Without
|
* run_nvidia_xconfig() - run the `nvidia-xconfig` utility. Without
|
||||||
* any options, this will just make sure the X config file uses the
|
* any options, this will just make sure the X config file uses the
|
||||||
* NVIDIA driver by default. The restore parameter controls whether
|
* NVIDIA driver by default.
|
||||||
* the --restore-original-backup option is added, which attempts to
|
*
|
||||||
* restore the original backed up X config file.
|
* Parameters:
|
||||||
|
*
|
||||||
|
* restore: controls whether the --restore-original-backup option is added,
|
||||||
|
* which attempts to restore the original backed up X config file.
|
||||||
|
* question: if this is non-NULL, the user will be asked 'question' as a
|
||||||
|
* yes or no question, to determine whether to run nvidia-xconfig.
|
||||||
|
* answer: the default answer to 'question'.
|
||||||
|
*
|
||||||
|
* Returns TRUE if nvidia-xconfig ran successfully; returns FALSE if
|
||||||
|
* nvidia-xconfig ran unsuccessfully, or did not run at all.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int run_nvidia_xconfig(Options *op, int restore)
|
int run_nvidia_xconfig(Options *op, int restore, const char *question,
|
||||||
|
int default_answer)
|
||||||
{
|
{
|
||||||
int ret, bRet = TRUE;
|
int ret = FALSE;
|
||||||
char *data = NULL, *cmd = NULL, *args, *nvidia_xconfig;
|
char *nvidia_xconfig;
|
||||||
|
|
||||||
nvidia_xconfig = find_system_util("nvidia-xconfig");
|
nvidia_xconfig = find_system_util("nvidia-xconfig");
|
||||||
|
|
||||||
if (nvidia_xconfig == NULL) {
|
if (nvidia_xconfig == NULL) {
|
||||||
|
/* nvidia-xconfig not found: don't run it or ask any questions */
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
args = restore ? " --restore-original-backup" : "";
|
ret = question ? ui_yes_no(op, default_answer, "%s", question) : TRUE;
|
||||||
|
|
||||||
cmd = nvstrcat(nvidia_xconfig, args, NULL);
|
if (ret) {
|
||||||
|
int cmd_ret;
|
||||||
ret = run_command(op, cmd, &data, FALSE, 0, TRUE);
|
char *data, *cmd, *args;
|
||||||
|
|
||||||
if (ret != 0) {
|
args = restore ? " --restore-original-backup" : "";
|
||||||
ui_error(op, "Failed to run `%s`:\n%s", cmd, data);
|
|
||||||
bRet = FALSE;
|
cmd = nvstrcat(nvidia_xconfig, args, NULL);
|
||||||
|
|
||||||
|
cmd_ret = run_command(op, cmd, &data, FALSE, 0, TRUE);
|
||||||
|
|
||||||
|
if (cmd_ret != 0) {
|
||||||
|
ui_error(op, "Failed to run `%s`:\n%s", cmd, data);
|
||||||
|
ret = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
nvfree(cmd);
|
||||||
|
nvfree(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
nvfree(cmd);
|
|
||||||
nvfree(data);
|
|
||||||
nvfree(nvidia_xconfig);
|
nvfree(nvidia_xconfig);
|
||||||
|
|
||||||
return bRet;
|
return ret;
|
||||||
|
|
||||||
} /* run_nvidia_xconfig() */
|
} /* run_nvidia_xconfig() */
|
||||||
|
|
||||||
@@ -2987,14 +2923,13 @@ int check_for_nouveau(Options *op)
|
|||||||
static int run_dkms(Options *op, const char* verb, const char *version,
|
static int run_dkms(Options *op, const char* verb, const char *version,
|
||||||
const char *kernel, char** out)
|
const char *kernel, char** out)
|
||||||
{
|
{
|
||||||
char *cmd, *cmdline, *veropt, *kernopt = NULL, *kernopt_all = "";
|
char *cmdline, *veropt, *kernopt = NULL, *kernopt_all = "";
|
||||||
const char *modopt = " -m nvidia"; /* XXX real name is in the Package */
|
const char *modopt = " -m nvidia"; /* XXX real name is in the Package */
|
||||||
char *output;
|
char *output;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Fail if DKMS not found */
|
/* Fail if DKMS not found */
|
||||||
cmd = find_system_util("dkms");
|
if (!op->utils[DKMS]) {
|
||||||
if (!cmd) {
|
|
||||||
if (strcmp(verb, DKMS_STATUS) != 0) {
|
if (strcmp(verb, DKMS_STATUS) != 0) {
|
||||||
ui_error(op, "Failed to find dkms on the system!");
|
ui_error(op, "Failed to find dkms on the system!");
|
||||||
}
|
}
|
||||||
@@ -3012,9 +2947,8 @@ static int run_dkms(Options *op, const char* verb, const char *version,
|
|||||||
kernopt = kernel ? nvstrcat(" -k ", kernel, NULL) : NULL;
|
kernopt = kernel ? nvstrcat(" -k ", kernel, NULL) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdline = nvstrcat(cmd, verb, modopt, veropt, kernopt_all, kernopt, NULL);
|
cmdline = nvstrcat(op->utils[DKMS], verb, modopt, veropt,
|
||||||
|
kernopt_all, kernopt, NULL);
|
||||||
nvfree(cmd);
|
|
||||||
|
|
||||||
/* Run DKMS */
|
/* Run DKMS */
|
||||||
ret = run_command(op, cmdline, &output, FALSE, 0, TRUE);
|
ret = run_command(op, cmdline, &output, FALSE, 0, TRUE);
|
||||||
@@ -3190,3 +3124,48 @@ ElfFileType get_elf_architecture(const char *filename)
|
|||||||
default: return ELF_INVALID_FILE;
|
default: return ELF_INVALID_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set_concurrency_level() - automatically determine the concurrency level,
|
||||||
|
* if the user has not specified it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void set_concurrency_level(Options *op)
|
||||||
|
{
|
||||||
|
int detected_cpus;
|
||||||
|
|
||||||
|
if (op->concurrency_level) {
|
||||||
|
ui_log(op, "Concurrency level set to %d on the command line.",
|
||||||
|
op->concurrency_level);
|
||||||
|
} else {
|
||||||
|
#if defined _SC_NPROCESSORS_ONLN
|
||||||
|
detected_cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
|
|
||||||
|
if (detected_cpus >= 1) {
|
||||||
|
ui_log(op, "Detected %d CPUs online; setting concurrency level "
|
||||||
|
"to %d.", detected_cpus, detected_cpus);
|
||||||
|
} else
|
||||||
|
#else
|
||||||
|
#warning _SC_NPROCESSORS_ONLN not defined; nvidia-installer will not be able \
|
||||||
|
to detect the number of processors.
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
ui_log(op, "Unable to detect the number of processors: setting "
|
||||||
|
"concurrency level to 1.");
|
||||||
|
detected_cpus = 1;
|
||||||
|
}
|
||||||
|
op->concurrency_level = detected_cpus;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (op->expert) {
|
||||||
|
int val = op->concurrency_level;
|
||||||
|
do {
|
||||||
|
char *strval = nvasprintf("%d", val);
|
||||||
|
val = atoi(ui_get_input(op, strval, "Concurrency level"));
|
||||||
|
nvfree(strval);
|
||||||
|
} while (val < 1);
|
||||||
|
op->concurrency_level = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
6
misc.h
6
misc.h
@@ -79,11 +79,10 @@ int tls_test(Options *op, int compat_32_libs);
|
|||||||
int check_runtime_configuration(Options *op, Package *p);
|
int check_runtime_configuration(Options *op, Package *p);
|
||||||
void collapse_multiple_slashes(char *s);
|
void collapse_multiple_slashes(char *s);
|
||||||
int is_symbolic_link_to(const char *path, const char *dest);
|
int is_symbolic_link_to(const char *path, const char *dest);
|
||||||
Distribution get_distribution(Options *op);
|
|
||||||
int check_for_running_x(Options *op);
|
int check_for_running_x(Options *op);
|
||||||
int check_for_modular_xorg(Options *op);
|
void query_xorg_version(Options *op);
|
||||||
int check_for_nvidia_graphics_devices(Options *op, Package *p);
|
int check_for_nvidia_graphics_devices(Options *op, Package *p);
|
||||||
int run_nvidia_xconfig(Options *op, int restore);
|
int run_nvidia_xconfig(Options *op, int restore, const char *question, int answer);
|
||||||
HookScriptStatus run_distro_hook(Options *op, const char *hook);
|
HookScriptStatus run_distro_hook(Options *op, const char *hook);
|
||||||
int check_for_alternate_install(Options *op);
|
int check_for_alternate_install(Options *op);
|
||||||
int check_for_nouveau(Options *op);
|
int check_for_nouveau(Options *op);
|
||||||
@@ -94,5 +93,6 @@ int verify_crc(Options *op, const char *filename, unsigned int crc,
|
|||||||
unsigned int *actual_crc);
|
unsigned int *actual_crc);
|
||||||
int secure_boot_enabled(void);
|
int secure_boot_enabled(void);
|
||||||
ElfFileType get_elf_architecture(const char *filename);
|
ElfFileType get_elf_architecture(const char *filename);
|
||||||
|
void set_concurrency_level(Options *op);
|
||||||
|
|
||||||
#endif /* __NVIDIA_INSTALLER_MISC_H__ */
|
#endif /* __NVIDIA_INSTALLER_MISC_H__ */
|
||||||
|
@@ -898,7 +898,7 @@ static void nv_ncurses_status_update(Options *op, const float percent,
|
|||||||
*/
|
*/
|
||||||
if (ch == NV_NCURSES_CTRL('L')) {
|
if (ch == NV_NCURSES_CTRL('L')) {
|
||||||
nv_ncurses_check_resize(d, TRUE);
|
nv_ncurses_check_resize(d, TRUE);
|
||||||
if (d->message) nv_ncurses_destroy_region(d->message);
|
nv_ncurses_destroy_region(d->message);
|
||||||
nv_ncurses_do_progress_bar_region(d);
|
nv_ncurses_do_progress_bar_region(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -134,7 +134,6 @@ static Options *load_default_options(void)
|
|||||||
op->ftp_site = DEFAULT_FTP_SITE;
|
op->ftp_site = DEFAULT_FTP_SITE;
|
||||||
|
|
||||||
op->tmpdir = get_tmpdir(op);
|
op->tmpdir = get_tmpdir(op);
|
||||||
op->distro = get_distribution(op);
|
|
||||||
|
|
||||||
op->logging = TRUE; /* log by default */
|
op->logging = TRUE; /* log by default */
|
||||||
op->opengl_headers = FALSE; /* do not install our GL headers by default */
|
op->opengl_headers = FALSE; /* do not install our GL headers by default */
|
||||||
@@ -150,6 +149,7 @@ static Options *load_default_options(void)
|
|||||||
op->check_for_alternate_installs = TRUE;
|
op->check_for_alternate_installs = TRUE;
|
||||||
op->num_kernel_modules = 1;
|
op->num_kernel_modules = 1;
|
||||||
op->install_uvm = TRUE;
|
op->install_uvm = TRUE;
|
||||||
|
op->install_compat32_libs = NV_OPTIONAL_BOOL_DEFAULT;
|
||||||
|
|
||||||
return op;
|
return op;
|
||||||
|
|
||||||
@@ -206,7 +206,6 @@ static void parse_commandline(int argc, char *argv[], Options *op)
|
|||||||
op->driver_info = TRUE;
|
op->driver_info = TRUE;
|
||||||
op->ui_str = "none";
|
op->ui_str = "none";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n': op->no_precompiled_interface = TRUE; break;
|
case 'n': op->no_precompiled_interface = TRUE; break;
|
||||||
case 'c': op->no_ncurses_color = TRUE; break;
|
case 'c': op->no_ncurses_color = TRUE; break;
|
||||||
case 'l': op->latest = TRUE; break;
|
case 'l': op->latest = TRUE; break;
|
||||||
@@ -230,12 +229,20 @@ static void parse_commandline(int argc, char *argv[], Options *op)
|
|||||||
break;
|
break;
|
||||||
case 'z': op->no_nouveau_check = TRUE; break;
|
case 'z': op->no_nouveau_check = TRUE; break;
|
||||||
case 'Z': op->disable_nouveau = TRUE; break;
|
case 'Z': op->disable_nouveau = TRUE; break;
|
||||||
|
|
||||||
case 'k':
|
case 'k':
|
||||||
op->kernel_name = strval;
|
op->kernel_name = strval;
|
||||||
op->no_precompiled_interface = TRUE;
|
op->no_precompiled_interface = TRUE;
|
||||||
op->ignore_cc_version_check = TRUE;
|
op->ignore_cc_version_check = TRUE;
|
||||||
break;
|
break;
|
||||||
|
case 'j':
|
||||||
|
if (intval < 1) {
|
||||||
|
nv_error_msg("Invalid concurrency level %d: nvidia-installer "
|
||||||
|
"will attempt to autodetect the number of CPUs.",
|
||||||
|
intval);
|
||||||
|
intval = 0;
|
||||||
|
}
|
||||||
|
op->concurrency_level = intval;
|
||||||
|
break;
|
||||||
|
|
||||||
case XFREE86_PREFIX_OPTION:
|
case XFREE86_PREFIX_OPTION:
|
||||||
case X_PREFIX_OPTION:
|
case X_PREFIX_OPTION:
|
||||||
@@ -244,6 +251,8 @@ static void parse_commandline(int argc, char *argv[], Options *op)
|
|||||||
op->x_library_path = strval; break;
|
op->x_library_path = strval; break;
|
||||||
case X_MODULE_PATH_OPTION:
|
case X_MODULE_PATH_OPTION:
|
||||||
op->x_module_path = strval; break;
|
op->x_module_path = strval; break;
|
||||||
|
case X_SYSCONFIG_PATH_OPTION:
|
||||||
|
op->x_sysconfig_path = strval; break;
|
||||||
case OPENGL_PREFIX_OPTION:
|
case OPENGL_PREFIX_OPTION:
|
||||||
op->opengl_prefix = strval; break;
|
op->opengl_prefix = strval; break;
|
||||||
case OPENGL_LIBDIR_OPTION:
|
case OPENGL_LIBDIR_OPTION:
|
||||||
@@ -255,6 +264,10 @@ static void parse_commandline(int argc, char *argv[], Options *op)
|
|||||||
op->compat32_prefix = strval; break;
|
op->compat32_prefix = strval; break;
|
||||||
case COMPAT32_LIBDIR_OPTION:
|
case COMPAT32_LIBDIR_OPTION:
|
||||||
op->compat32_libdir = strval; break;
|
op->compat32_libdir = strval; break;
|
||||||
|
case INSTALL_COMPAT32_LIBS_OPTION:
|
||||||
|
op->install_compat32_libs = boolval ? NV_OPTIONAL_BOOL_TRUE :
|
||||||
|
NV_OPTIONAL_BOOL_FALSE;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case DOCUMENTATION_PREFIX_OPTION:
|
case DOCUMENTATION_PREFIX_OPTION:
|
||||||
op->documentation_prefix = strval; break;
|
op->documentation_prefix = strval; break;
|
||||||
@@ -276,6 +289,8 @@ static void parse_commandline(int argc, char *argv[], Options *op)
|
|||||||
op->kernel_module_installation_path = strval; break;
|
op->kernel_module_installation_path = strval; break;
|
||||||
case UNINSTALL_OPTION:
|
case UNINSTALL_OPTION:
|
||||||
op->uninstall = TRUE; break;
|
op->uninstall = TRUE; break;
|
||||||
|
case SKIP_MODULE_UNLOAD_OPTION:
|
||||||
|
op->skip_module_unload = TRUE; break;
|
||||||
case PROC_MOUNT_POINT_OPTION:
|
case PROC_MOUNT_POINT_OPTION:
|
||||||
op->proc_mount_point = strval; break;
|
op->proc_mount_point = strval; break;
|
||||||
case USER_INTERFACE_OPTION:
|
case USER_INTERFACE_OPTION:
|
||||||
@@ -291,6 +306,7 @@ static void parse_commandline(int argc, char *argv[], Options *op)
|
|||||||
op->opengl_headers = TRUE; break;
|
op->opengl_headers = TRUE; break;
|
||||||
case NO_NVIDIA_MODPROBE_OPTION:
|
case NO_NVIDIA_MODPROBE_OPTION:
|
||||||
op->nvidia_modprobe = FALSE; break;
|
op->nvidia_modprobe = FALSE; break;
|
||||||
|
#if defined(NV_TLS_TEST)
|
||||||
case FORCE_TLS_OPTION:
|
case FORCE_TLS_OPTION:
|
||||||
if (strcasecmp(strval, "new") == 0)
|
if (strcasecmp(strval, "new") == 0)
|
||||||
op->which_tls = FORCE_NEW_TLS;
|
op->which_tls = FORCE_NEW_TLS;
|
||||||
@@ -312,7 +328,8 @@ static void parse_commandline(int argc, char *argv[], Options *op)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif /* NV_X86_64 */
|
||||||
|
#endif /* NV_TLS_TEST */
|
||||||
case SANITY_OPTION:
|
case SANITY_OPTION:
|
||||||
op->sanity = TRUE;
|
op->sanity = TRUE;
|
||||||
break;
|
break;
|
||||||
@@ -555,6 +572,11 @@ int main(int argc, char *argv[])
|
|||||||
/* initialize the user interface */
|
/* initialize the user interface */
|
||||||
|
|
||||||
if (!ui_init(op)) return 1;
|
if (!ui_init(op)) return 1;
|
||||||
|
|
||||||
|
/* determine the concurrency level: do this early on, to allow for
|
||||||
|
* parallelization of as much of the install as possible. */
|
||||||
|
|
||||||
|
set_concurrency_level(op);
|
||||||
|
|
||||||
/* check that we're running as root */
|
/* check that we're running as root */
|
||||||
|
|
||||||
@@ -571,11 +593,10 @@ int main(int argc, char *argv[])
|
|||||||
if (!find_module_utils(op)) goto done;
|
if (!find_module_utils(op)) goto done;
|
||||||
if (!check_selinux(op)) goto done;
|
if (!check_selinux(op)) goto done;
|
||||||
|
|
||||||
/* check if we need to worry about modular Xorg */
|
/* check for X server properties based on the version of the server */
|
||||||
|
|
||||||
|
query_xorg_version(op);
|
||||||
|
|
||||||
op->modular_xorg =
|
|
||||||
check_for_modular_xorg(op);
|
|
||||||
|
|
||||||
/* get the default installation prefixes/paths */
|
/* get the default installation prefixes/paths */
|
||||||
|
|
||||||
get_default_prefixes_and_paths(op);
|
get_default_prefixes_and_paths(op);
|
||||||
|
@@ -57,6 +57,7 @@ typedef enum {
|
|||||||
PKG_CONFIG,
|
PKG_CONFIG,
|
||||||
XSERVER,
|
XSERVER,
|
||||||
OPENSSL,
|
OPENSSL,
|
||||||
|
DKMS,
|
||||||
MAX_SYSTEM_OPTIONAL_UTILS
|
MAX_SYSTEM_OPTIONAL_UTILS
|
||||||
} SystemOptionalUtils;
|
} SystemOptionalUtils;
|
||||||
|
|
||||||
@@ -92,22 +93,6 @@ typedef enum {
|
|||||||
|
|
||||||
#define MAX_UTILS MAX_DEVELOP_UTILS
|
#define MAX_UTILS MAX_DEVELOP_UTILS
|
||||||
|
|
||||||
/*
|
|
||||||
* Enumerated type of distributions; this isn't an exhaustive list of
|
|
||||||
* supported distributions... just distributions that have asked for
|
|
||||||
* special behavior.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SUSE,
|
|
||||||
UNITED_LINUX,
|
|
||||||
DEBIAN,
|
|
||||||
UBUNTU,
|
|
||||||
GENTOO,
|
|
||||||
ARCH,
|
|
||||||
OTHER
|
|
||||||
} Distribution;
|
|
||||||
|
|
||||||
|
|
||||||
typedef uint32_t uint32;
|
typedef uint32_t uint32;
|
||||||
typedef uint16_t uint16;
|
typedef uint16_t uint16;
|
||||||
@@ -128,6 +113,7 @@ typedef struct __options {
|
|||||||
int update;
|
int update;
|
||||||
int expert;
|
int expert;
|
||||||
int uninstall;
|
int uninstall;
|
||||||
|
int skip_module_unload;
|
||||||
int driver_info;
|
int driver_info;
|
||||||
int debug;
|
int debug;
|
||||||
int logging;
|
int logging;
|
||||||
@@ -139,8 +125,10 @@ typedef struct __options {
|
|||||||
int nvidia_modprobe;
|
int nvidia_modprobe;
|
||||||
int no_questions;
|
int no_questions;
|
||||||
int silent;
|
int silent;
|
||||||
|
#if defined(NV_TLS_TEST)
|
||||||
int which_tls;
|
int which_tls;
|
||||||
int which_tls_compat32;
|
int which_tls_compat32;
|
||||||
|
#endif /* NV_TLS_TEST */
|
||||||
int sanity;
|
int sanity;
|
||||||
int add_this_kernel;
|
int add_this_kernel;
|
||||||
int no_backup;
|
int no_backup;
|
||||||
@@ -167,8 +155,12 @@ typedef struct __options {
|
|||||||
int num_kernel_modules;
|
int num_kernel_modules;
|
||||||
int install_uvm;
|
int install_uvm;
|
||||||
int uvm_files_packaged;
|
int uvm_files_packaged;
|
||||||
|
int compat32_files_packaged;
|
||||||
|
int x_files_packaged;
|
||||||
|
int concurrency_level;
|
||||||
|
|
||||||
NVOptionalBool install_vdpau_wrapper;
|
NVOptionalBool install_vdpau_wrapper;
|
||||||
|
NVOptionalBool install_compat32_libs;
|
||||||
|
|
||||||
char *opengl_prefix;
|
char *opengl_prefix;
|
||||||
char *opengl_libdir;
|
char *opengl_libdir;
|
||||||
@@ -179,6 +171,7 @@ typedef struct __options {
|
|||||||
char *x_moddir;
|
char *x_moddir;
|
||||||
char *x_module_path;
|
char *x_module_path;
|
||||||
char *x_library_path;
|
char *x_library_path;
|
||||||
|
char *x_sysconfig_path;
|
||||||
|
|
||||||
char *compat32_chroot;
|
char *compat32_chroot;
|
||||||
char *compat32_prefix;
|
char *compat32_prefix;
|
||||||
@@ -198,6 +191,7 @@ typedef struct __options {
|
|||||||
char *application_profile_path;
|
char *application_profile_path;
|
||||||
|
|
||||||
int modular_xorg;
|
int modular_xorg;
|
||||||
|
int xorg_supports_output_class;
|
||||||
|
|
||||||
char *kernel_source_path;
|
char *kernel_source_path;
|
||||||
char *kernel_output_path;
|
char *kernel_output_path;
|
||||||
@@ -231,8 +225,6 @@ typedef struct __options {
|
|||||||
|
|
||||||
int kernel_module_signed;
|
int kernel_module_signed;
|
||||||
|
|
||||||
Distribution distro;
|
|
||||||
|
|
||||||
void *ui_priv; /* for use by the ui's */
|
void *ui_priv; /* for use by the ui's */
|
||||||
|
|
||||||
int ignore_cc_version_check;
|
int ignore_cc_version_check;
|
||||||
@@ -249,11 +241,8 @@ typedef enum {
|
|||||||
FILE_TYPE_KERNEL_MODULE_CMD,
|
FILE_TYPE_KERNEL_MODULE_CMD,
|
||||||
FILE_TYPE_OPENGL_HEADER,
|
FILE_TYPE_OPENGL_HEADER,
|
||||||
FILE_TYPE_OPENGL_LIB,
|
FILE_TYPE_OPENGL_LIB,
|
||||||
FILE_TYPE_XLIB_STATIC_LIB,
|
|
||||||
FILE_TYPE_XLIB_SHARED_LIB,
|
|
||||||
FILE_TYPE_DOCUMENTATION,
|
FILE_TYPE_DOCUMENTATION,
|
||||||
FILE_TYPE_OPENGL_SYMLINK,
|
FILE_TYPE_OPENGL_SYMLINK,
|
||||||
FILE_TYPE_XLIB_SYMLINK,
|
|
||||||
FILE_TYPE_KERNEL_MODULE,
|
FILE_TYPE_KERNEL_MODULE,
|
||||||
FILE_TYPE_INSTALLER_BINARY,
|
FILE_TYPE_INSTALLER_BINARY,
|
||||||
FILE_TYPE_UTILITY_BINARY,
|
FILE_TYPE_UTILITY_BINARY,
|
||||||
@@ -269,7 +258,11 @@ typedef enum {
|
|||||||
FILE_TYPE_MANPAGE,
|
FILE_TYPE_MANPAGE,
|
||||||
FILE_TYPE_EXPLICIT_PATH,
|
FILE_TYPE_EXPLICIT_PATH,
|
||||||
FILE_TYPE_CUDA_LIB,
|
FILE_TYPE_CUDA_LIB,
|
||||||
|
FILE_TYPE_OPENCL_LIB,
|
||||||
|
FILE_TYPE_OPENCL_WRAPPER_LIB,
|
||||||
FILE_TYPE_CUDA_SYMLINK,
|
FILE_TYPE_CUDA_SYMLINK,
|
||||||
|
FILE_TYPE_OPENCL_LIB_SYMLINK,
|
||||||
|
FILE_TYPE_OPENCL_WRAPPER_SYMLINK,
|
||||||
FILE_TYPE_VDPAU_LIB,
|
FILE_TYPE_VDPAU_LIB,
|
||||||
FILE_TYPE_VDPAU_WRAPPER_LIB,
|
FILE_TYPE_VDPAU_WRAPPER_LIB,
|
||||||
FILE_TYPE_VDPAU_SYMLINK,
|
FILE_TYPE_VDPAU_SYMLINK,
|
||||||
@@ -291,6 +284,7 @@ typedef enum {
|
|||||||
FILE_TYPE_NVIFR_LIB,
|
FILE_TYPE_NVIFR_LIB,
|
||||||
FILE_TYPE_NVIFR_LIB_SYMLINK,
|
FILE_TYPE_NVIFR_LIB_SYMLINK,
|
||||||
FILE_TYPE_UVM_MODULE_SRC,
|
FILE_TYPE_UVM_MODULE_SRC,
|
||||||
|
FILE_TYPE_XORG_OUTPUTCLASS_CONFIG,
|
||||||
FILE_TYPE_MAX
|
FILE_TYPE_MAX
|
||||||
} PackageEntryFileType;
|
} PackageEntryFileType;
|
||||||
|
|
||||||
@@ -315,6 +309,7 @@ typedef struct {
|
|||||||
unsigned int is_shared_lib : 1;
|
unsigned int is_shared_lib : 1;
|
||||||
unsigned int is_opengl : 1;
|
unsigned int is_opengl : 1;
|
||||||
unsigned int is_temporary : 1;
|
unsigned int is_temporary : 1;
|
||||||
|
unsigned int is_wrapper : 1;
|
||||||
} PackageEntryFileCapabilities;
|
} PackageEntryFileCapabilities;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -374,6 +369,25 @@ typedef struct __package_entry {
|
|||||||
*/
|
*/
|
||||||
} PackageEntry;
|
} PackageEntry;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Information about a conflicting file; nvidia-installer searches for existing
|
||||||
|
* files that conflict with files that are to be installed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const char *name;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if requiredString is non-NULL, then a file must have this
|
||||||
|
* string in order to be considered a conflicting file; we use
|
||||||
|
* this to only consider "libglx.*" files conflicts if they have
|
||||||
|
* the string "glxModuleData".
|
||||||
|
*/
|
||||||
|
|
||||||
|
const char *requiredString;
|
||||||
|
} ConflictingFileInfo;
|
||||||
|
|
||||||
|
|
||||||
typedef struct __package {
|
typedef struct __package {
|
||||||
|
|
||||||
@@ -397,6 +411,7 @@ typedef struct __package {
|
|||||||
PackageEntry *entries; /* array of filename/checksum/bytesize entries */
|
PackageEntry *entries; /* array of filename/checksum/bytesize entries */
|
||||||
int num_entries;
|
int num_entries;
|
||||||
|
|
||||||
|
ConflictingFileInfo *conflicting_files;
|
||||||
} Package;
|
} Package;
|
||||||
|
|
||||||
|
|
||||||
@@ -439,16 +454,25 @@ typedef struct __package {
|
|||||||
#define DEFAULT_APPLICATION_PROFILE_PATH "/usr/share/nvidia"
|
#define DEFAULT_APPLICATION_PROFILE_PATH "/usr/share/nvidia"
|
||||||
|
|
||||||
#define DEFAULT_LIBDIR "lib"
|
#define DEFAULT_LIBDIR "lib"
|
||||||
|
#define DEFAULT_32BIT_LIBDIR "lib32"
|
||||||
#define DEFAULT_64BIT_LIBDIR "lib64"
|
#define DEFAULT_64BIT_LIBDIR "lib64"
|
||||||
|
#define DEFAULT_IA32_TRIPLET_LIBDIR "lib/i386-linux-gnu"
|
||||||
|
#define DEFAULT_AMD64_TRIPLET_LIBDIR "lib/x86_64-linux-gnu"
|
||||||
|
#define DEFAULT_ARMV7_TRIPLET_LIBDIR "lib/arm-linux-gnueabi"
|
||||||
|
#define DEFAULT_ARMV7HF_TRIPLET_LIBDIR "lib/arm-linux-gnueabihf"
|
||||||
|
#define DEFAULT_AARCH64_TRIPLET_LIBDIR "lib/aarch64-linux-gnu"
|
||||||
|
#define DEFAULT_PPC64LE_TRIPLET_LIBDIR "lib/powerpc64le-linux-gnu"
|
||||||
#define DEFAULT_BINDIR "bin"
|
#define DEFAULT_BINDIR "bin"
|
||||||
#define DEFAULT_INCDIR "include"
|
#define DEFAULT_INCDIR "include"
|
||||||
#define DEFAULT_X_MODULEDIR "modules"
|
#define DEFAULT_X_MODULEDIR "modules"
|
||||||
#define DEFAULT_DOT_DESKTOPDIR "share/applications"
|
#define DEFAULT_DOT_DESKTOPDIR "share/applications"
|
||||||
#define DEFAULT_DOCDIR "share/doc"
|
#define DEFAULT_DOCDIR "share/doc"
|
||||||
#define DEFAULT_MANDIR "share/man"
|
#define DEFAULT_MANDIR "share/man"
|
||||||
|
#define DEFAULT_CONFDIR "X11/xorg.conf.d"
|
||||||
|
|
||||||
#define DEFAULT_MODULE_SIGNING_KEY_PATH "/usr/share/nvidia"
|
#define DEFAULT_MODULE_SIGNING_KEY_PATH "/usr/share/nvidia"
|
||||||
#define DEFAULT_KERNEL_MODULE_SRC_PREFIX "/usr/src"
|
#define DEFAULT_KERNEL_MODULE_SRC_PREFIX "/usr/src"
|
||||||
|
#define DEFAULT_X_DATAROOT_PATH "/usr/share"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As of Xorg 7.x, X components need not be installed relative
|
* As of Xorg 7.x, X components need not be installed relative
|
||||||
@@ -467,29 +491,6 @@ typedef struct __package {
|
|||||||
*/
|
*/
|
||||||
#define DEBIAN_DEFAULT_COMPAT32_CHROOT "/emul/ia32-linux"
|
#define DEBIAN_DEFAULT_COMPAT32_CHROOT "/emul/ia32-linux"
|
||||||
|
|
||||||
/*
|
|
||||||
* Debian GNU/Linux and Ubuntu do not follow the lib64 library
|
|
||||||
* path naming convention used by other distributors. 64-bit
|
|
||||||
* libraries are placed under ../lib.
|
|
||||||
*/
|
|
||||||
#define DEBIAN_DEFAULT_64BIT_LIBDIR "lib"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ubuntu GNU/Linux and Gentoo Linux do not follow the "lib"
|
|
||||||
* library path naming convention used for 32-bit compatibility
|
|
||||||
* libraries by other distributors. These libraries are
|
|
||||||
* placed under ../lib32.
|
|
||||||
*/
|
|
||||||
#define UBUNTU_DEFAULT_COMPAT32_LIBDIR "lib32"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Newer versions of Debian GNU/Linux may install 32-bit
|
|
||||||
* compatibility libraries to ../lib/i386-linux-gnu instead
|
|
||||||
* of ../lib32.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DEBIAN_DEFAULT_COMPAT32_LIBDIR "lib/i386-linux-gnu"
|
|
||||||
|
|
||||||
#define DEFAULT_PROC_MOUNT_POINT "/proc"
|
#define DEFAULT_PROC_MOUNT_POINT "/proc"
|
||||||
|
|
||||||
#define DEFAULT_FTP_SITE "ftp://download.nvidia.com"
|
#define DEFAULT_FTP_SITE "ftp://download.nvidia.com"
|
||||||
|
@@ -41,6 +41,7 @@ enum {
|
|||||||
KERNEL_INCLUDE_PATH_OPTION,
|
KERNEL_INCLUDE_PATH_OPTION,
|
||||||
KERNEL_INSTALL_PATH_OPTION,
|
KERNEL_INSTALL_PATH_OPTION,
|
||||||
UNINSTALL_OPTION,
|
UNINSTALL_OPTION,
|
||||||
|
SKIP_MODULE_UNLOAD_OPTION,
|
||||||
PROC_MOUNT_POINT_OPTION,
|
PROC_MOUNT_POINT_OPTION,
|
||||||
USER_INTERFACE_OPTION,
|
USER_INTERFACE_OPTION,
|
||||||
LOG_FILE_NAME_OPTION,
|
LOG_FILE_NAME_OPTION,
|
||||||
@@ -96,6 +97,8 @@ enum {
|
|||||||
NO_CHECK_FOR_ALTERNATE_INSTALLS_OPTION,
|
NO_CHECK_FOR_ALTERNATE_INSTALLS_OPTION,
|
||||||
MULTIPLE_KERNEL_MODULES_OPTION,
|
MULTIPLE_KERNEL_MODULES_OPTION,
|
||||||
NO_UVM_OPTION,
|
NO_UVM_OPTION,
|
||||||
|
INSTALL_COMPAT32_LIBS_OPTION,
|
||||||
|
X_SYSCONFIG_PATH_OPTION,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NVGetoptOption __options[] = {
|
static const NVGetoptOption __options[] = {
|
||||||
@@ -138,6 +141,11 @@ static const NVGetoptOption __options[] = {
|
|||||||
{ "uninstall", UNINSTALL_OPTION, 0, NULL,
|
{ "uninstall", UNINSTALL_OPTION, 0, NULL,
|
||||||
"Uninstall the currently installed NVIDIA driver." },
|
"Uninstall the currently installed NVIDIA driver." },
|
||||||
|
|
||||||
|
{ "skip-module-unload", SKIP_MODULE_UNLOAD_OPTION,
|
||||||
|
NVGETOPT_OPTION_APPLIES_TO_NVIDIA_UNINSTALL, NULL,
|
||||||
|
"When uninstalling the driver, skip unloading of the NVIDIA kernel "
|
||||||
|
"module. This option is ignored when the driver is being installed." },
|
||||||
|
|
||||||
{ "sanity", SANITY_OPTION, 0, NULL,
|
{ "sanity", SANITY_OPTION, 0, NULL,
|
||||||
"Perform basic sanity tests on an existing NVIDIA "
|
"Perform basic sanity tests on an existing NVIDIA "
|
||||||
"driver installation." },
|
"driver installation." },
|
||||||
@@ -192,6 +200,13 @@ static const NVGetoptOption __options[] = {
|
|||||||
DEFAULT_64BIT_LIBDIR "' or '" DEFAULT_LIBDIR "' on 64bit systems, "
|
DEFAULT_64BIT_LIBDIR "' or '" DEFAULT_LIBDIR "' on 64bit systems, "
|
||||||
"depending on the installed Linux distribution." },
|
"depending on the installed Linux distribution." },
|
||||||
|
|
||||||
|
{ "x-sysconfig-path", X_SYSCONFIG_PATH_OPTION, NVGETOPT_STRING_ARGUMENT, NULL,
|
||||||
|
"The path under which X system configuration files will be installed. "
|
||||||
|
"If this option is not specified, nvidia-installer uses the following "
|
||||||
|
"search order and selects the first valid directory it finds: 1) "
|
||||||
|
"`pkg-config --variable=sysconfigdir xorg-server`, or 2) "
|
||||||
|
DEFAULT_X_DATAROOT_PATH "/" DEFAULT_CONFDIR "." },
|
||||||
|
|
||||||
{ "opengl-prefix", OPENGL_PREFIX_OPTION, NVGETOPT_STRING_ARGUMENT, NULL,
|
{ "opengl-prefix", OPENGL_PREFIX_OPTION, NVGETOPT_STRING_ARGUMENT, NULL,
|
||||||
"The prefix under which the OpenGL components of the "
|
"The prefix under which the OpenGL components of the "
|
||||||
"NVIDIA driver will be installed; the default is: '" DEFAULT_OPENGL_PREFIX
|
"NVIDIA driver will be installed; the default is: '" DEFAULT_OPENGL_PREFIX
|
||||||
@@ -229,9 +244,16 @@ static const NVGetoptOption __options[] = {
|
|||||||
"The path relative to the 32bit compatibility prefix under which the "
|
"The path relative to the 32bit compatibility prefix under which the "
|
||||||
"32bit compatibility components of the NVIDIA driver will "
|
"32bit compatibility components of the NVIDIA driver will "
|
||||||
"be installed. The default is '" DEFAULT_LIBDIR "' or '"
|
"be installed. The default is '" DEFAULT_LIBDIR "' or '"
|
||||||
UBUNTU_DEFAULT_COMPAT32_LIBDIR "', depending on the installed Linux "
|
DEFAULT_32BIT_LIBDIR "', depending on the installed Linux "
|
||||||
"distribution. Only under very rare circumstances should this "
|
"distribution. Only under very rare circumstances should this "
|
||||||
"option be used." },
|
"option be used." },
|
||||||
|
|
||||||
|
{ "install-compat32-libs", INSTALL_COMPAT32_LIBS_OPTION,
|
||||||
|
NVGETOPT_IS_BOOLEAN, NULL,
|
||||||
|
"32-bit compatibility libraries may be optionally installed. Setting "
|
||||||
|
"--install-compat32-libs will install these libraries. Setting "
|
||||||
|
"--no-install-compat32-libs will skip installation of these libraries. "
|
||||||
|
"Note: this option will have no effect on -no-compat32.run packages." },
|
||||||
#endif /* NV_X86_64 */
|
#endif /* NV_X86_64 */
|
||||||
|
|
||||||
{ "installer-prefix", INSTALLER_PREFIX_OPTION, NVGETOPT_STRING_ARGUMENT,
|
{ "installer-prefix", INSTALLER_PREFIX_OPTION, NVGETOPT_STRING_ARGUMENT,
|
||||||
@@ -366,6 +388,7 @@ static const NVGetoptOption __options[] = {
|
|||||||
"needed if other means of loading the NVIDIA kernel module and creating "
|
"needed if other means of loading the NVIDIA kernel module and creating "
|
||||||
"the NVIDIA device files are unavailable." },
|
"the NVIDIA device files are unavailable." },
|
||||||
|
|
||||||
|
#if defined(NV_TLS_TEST)
|
||||||
{ "force-tls", FORCE_TLS_OPTION, NVGETOPT_STRING_ARGUMENT, NULL,
|
{ "force-tls", FORCE_TLS_OPTION, NVGETOPT_STRING_ARGUMENT, NULL,
|
||||||
"NVIDIA's OpenGL libraries are compiled with one of two "
|
"NVIDIA's OpenGL libraries are compiled with one of two "
|
||||||
"different thread local storage (TLS) mechanisms: 'classic tls' "
|
"different thread local storage (TLS) mechanisms: 'classic tls' "
|
||||||
@@ -383,6 +406,7 @@ static const NVGetoptOption __options[] = {
|
|||||||
"32bit compatibility OpenGL TLS library; further details "
|
"32bit compatibility OpenGL TLS library; further details "
|
||||||
"can be found in the description of the '--force-tls' option." },
|
"can be found in the description of the '--force-tls' option." },
|
||||||
#endif /* NV_X86_64 */
|
#endif /* NV_X86_64 */
|
||||||
|
#endif
|
||||||
|
|
||||||
{ "kernel-name", 'k', NVGETOPT_STRING_ARGUMENT, NULL,
|
{ "kernel-name", 'k', NVGETOPT_STRING_ARGUMENT, NULL,
|
||||||
"Build and install the NVIDIA kernel module for the "
|
"Build and install the NVIDIA kernel module for the "
|
||||||
@@ -620,16 +644,22 @@ static const NVGetoptOption __options[] = {
|
|||||||
NVGETOPT_INTEGER_ARGUMENT, NULL,
|
NVGETOPT_INTEGER_ARGUMENT, NULL,
|
||||||
"Build and install multiple NVIDIA kernel modules. The maximum number "
|
"Build and install multiple NVIDIA kernel modules. The maximum number "
|
||||||
"of NVIDIA kernel modules that may be built is 8. '--multiple-kernel-"
|
"of NVIDIA kernel modules that may be built is 8. '--multiple-kernel-"
|
||||||
"modules' implies '--no-unified-memory'."},
|
"modules' implies '--no-unified-memory'." },
|
||||||
|
|
||||||
{ "no-unified-memory", NO_UVM_OPTION, 0, NULL,
|
{ "no-unified-memory", NO_UVM_OPTION, 0, NULL,
|
||||||
"Do not install the NVIDIA Unified Memory kernel module. This kernel "
|
"Do not install the NVIDIA Unified Memory kernel module. This kernel "
|
||||||
"module is required for CUDA, and if it is not installed, the CUDA "
|
"module is required for CUDA on 64-bit systems, and if it is not "
|
||||||
"driver and CUDA applications will not be able to run. The "
|
"installed, the CUDA driver and CUDA applications will not be able to "
|
||||||
"'--no-unified-memory' option should only be used to work around "
|
"run. The '--no-unified-memory' option should only be used to work "
|
||||||
"failures to build or install the Unified Memory kernel module on "
|
"around failures to build or install the Unified Memory kernel module on "
|
||||||
"systems that do not need to run CUDA." },
|
"systems that do not need to run CUDA." },
|
||||||
|
|
||||||
|
{ "concurrency-level", 'j', NVGETOPT_INTEGER_ARGUMENT, NULL,
|
||||||
|
"Set the concurrency level for operations such as building the kernel "
|
||||||
|
"module which may be parallelized on SMP systems. By default, this will "
|
||||||
|
"be set to the number of detected CPUs, or to '1', if nvidia-installer "
|
||||||
|
"fails to detect the number of CPUs." },
|
||||||
|
|
||||||
/* Orphaned options: These options were in the long_options table in
|
/* Orphaned options: These options were in the long_options table in
|
||||||
* nvidia-installer.c but not in the help. */
|
* nvidia-installer.c but not in the help. */
|
||||||
{ "debug", 'd', 0, NULL,NULL },
|
{ "debug", 'd', 0, NULL,NULL },
|
||||||
|
@@ -81,7 +81,7 @@ static uint32 read_uint32(const char *buf, int *offset)
|
|||||||
|
|
||||||
char *read_proc_version(Options *op, const char *proc_mount_point)
|
char *read_proc_version(Options *op, const char *proc_mount_point)
|
||||||
{
|
{
|
||||||
int fd, ret, len, version_len;
|
int fd, len, version_len;
|
||||||
char *version, *c = NULL;
|
char *version, *c = NULL;
|
||||||
char *proc_verson_filename;
|
char *proc_verson_filename;
|
||||||
|
|
||||||
@@ -105,6 +105,8 @@ char *read_proc_version(Options *op, const char *proc_mount_point)
|
|||||||
version = NULL;
|
version = NULL;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (version_len == len) {
|
if (version_len == len) {
|
||||||
version_len += NV_LINE_LEN;
|
version_len += NV_LINE_LEN;
|
||||||
version = nvrealloc(version, version_len);
|
version = nvrealloc(version, version_len);
|
||||||
@@ -114,8 +116,9 @@ char *read_proc_version(Options *op, const char *proc_mount_point)
|
|||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
ui_warn(op, "Error reading %s (%s).",
|
ui_warn(op, "Error reading %s (%s).",
|
||||||
proc_verson_filename, strerror(errno));
|
proc_verson_filename, strerror(errno));
|
||||||
free(version);
|
nvfree(version);
|
||||||
return NULL;
|
version = NULL;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
@@ -131,11 +134,12 @@ char *read_proc_version(Options *op, const char *proc_mount_point)
|
|||||||
while ((*c != '\0') && (*c != '\n')) c++;
|
while ((*c != '\0') && (*c != '\n')) c++;
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
|
|
||||||
free(proc_verson_filename);
|
done:
|
||||||
|
nvfree(proc_verson_filename);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
return version;
|
return version;
|
||||||
|
}
|
||||||
} /* read_proc_version() */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -160,7 +164,7 @@ PrecompiledInfo *get_precompiled_info(Options *op,
|
|||||||
PrecompiledFileInfo *fileInfos = NULL;
|
PrecompiledFileInfo *fileInfos = NULL;
|
||||||
|
|
||||||
fd = size = 0;
|
fd = size = 0;
|
||||||
buf = description = proc_version_string = NULL;
|
buf = description = proc_version_string = version = NULL;
|
||||||
|
|
||||||
/* open the file to be unpacked */
|
/* open the file to be unpacked */
|
||||||
|
|
||||||
@@ -233,7 +237,7 @@ PrecompiledInfo *get_precompiled_info(Options *op,
|
|||||||
/* check if this precompiled kernel interface is the right driver
|
/* check if this precompiled kernel interface is the right driver
|
||||||
version */
|
version */
|
||||||
|
|
||||||
if (package_version && (strcmp(version, package_version) != 0)) {
|
if (!version || !package_version || strcmp(version, package_version) != 0) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,11 +336,11 @@ PrecompiledInfo *get_precompiled_info(Options *op,
|
|||||||
info->files = fileInfos;
|
info->files = fileInfos;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX so that the proc version and description strings, and the
|
* XXX so that the proc version, description, and version strings, and the
|
||||||
* PrecompiledFileInfo array aren't freed below
|
* PrecompiledFileInfo array aren't freed below
|
||||||
*/
|
*/
|
||||||
|
|
||||||
proc_version_string = description = NULL;
|
proc_version_string = description = version = NULL;
|
||||||
fileInfos = NULL;
|
fileInfos = NULL;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
@@ -344,10 +348,11 @@ done:
|
|||||||
/* cleanup whatever needs cleaning up */
|
/* cleanup whatever needs cleaning up */
|
||||||
|
|
||||||
if (buf) munmap(buf, size);
|
if (buf) munmap(buf, size);
|
||||||
if (fd > 0) close(fd);
|
if (fd >= 0) close(fd);
|
||||||
if (description) free(description);
|
nvfree(description);
|
||||||
if (proc_version_string) free(proc_version_string);
|
nvfree(proc_version_string);
|
||||||
if (fileInfos) free(fileInfos);
|
nvfree(fileInfos);
|
||||||
|
nvfree(version);
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
|
||||||
@@ -942,11 +947,17 @@ const char **precompiled_file_attribute_names(uint32 attribute_mask)
|
|||||||
"linked module crc",
|
"linked module crc",
|
||||||
"embedded signature",
|
"embedded signature",
|
||||||
};
|
};
|
||||||
|
static const char *unknown_attribute = "unknown attribute";
|
||||||
|
|
||||||
ret = nvalloc((ARRAY_LEN(file_attribute_names) + 1) * sizeof(char *));
|
const int max_file_attribute_names = sizeof(attribute_mask) * 8;
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
/* leave room for a NULL terminator */
|
||||||
if (attribute_mask & (1 << i)) {
|
ret = nvalloc((max_file_attribute_names + 1) * sizeof(char *));
|
||||||
|
|
||||||
|
for (i = 0; i < max_file_attribute_names; i++) {
|
||||||
|
if (i >= ARRAY_LEN(file_attribute_names)) {
|
||||||
|
ret[attr++] = unknown_attribute;
|
||||||
|
} else if (attribute_mask & (1 << i)) {
|
||||||
ret[attr++] = file_attribute_names[i];
|
ret[attr++] = file_attribute_names[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -997,6 +1008,8 @@ int byte_tail(const char *infile, int start, char **buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
fclose(in);
|
if (in) {
|
||||||
|
fclose(in);
|
||||||
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
48
sanity.c
48
sanity.c
@@ -21,18 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nvidia-installer.h"
|
#include "nvidia-installer.h"
|
||||||
#include "command-list.h"
|
|
||||||
#include "user-interface.h"
|
#include "user-interface.h"
|
||||||
#include "backup.h"
|
#include "backup.h"
|
||||||
#include "misc.h"
|
|
||||||
#include "sanity.h"
|
#include "sanity.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/shm.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sanity() - perform sanity tests on an existing installation
|
* sanity() - perform sanity tests on an existing installation
|
||||||
@@ -68,10 +60,6 @@ int sanity(Options *op)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check that shared memory works */
|
|
||||||
|
|
||||||
if (!check_sysvipc(op)) return FALSE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX There are lots of additional tests that could be added:
|
* XXX There are lots of additional tests that could be added:
|
||||||
*
|
*
|
||||||
@@ -95,39 +83,3 @@ int sanity(Options *op)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} /* sanity() */
|
} /* sanity() */
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* check_sysvipc() - test that shmat() and friends work
|
|
||||||
*/
|
|
||||||
|
|
||||||
int check_sysvipc(Options *op)
|
|
||||||
{
|
|
||||||
int shmid = -1;
|
|
||||||
int ret = FALSE;
|
|
||||||
int size = sysconf(_SC_PAGESIZE);
|
|
||||||
void *address = (void *) -1;
|
|
||||||
|
|
||||||
shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
|
|
||||||
if (shmid == -1) goto done;
|
|
||||||
|
|
||||||
address = shmat(shmid, 0, 0);
|
|
||||||
if (address == (void *) -1) goto done;
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
|
|
||||||
done:
|
|
||||||
|
|
||||||
if (shmid != -1) shmctl(shmid, IPC_RMID, 0);
|
|
||||||
if (address != (void *) -1) shmdt(address);
|
|
||||||
|
|
||||||
if (ret) {
|
|
||||||
ui_log(op, "Shared memory test passed.");
|
|
||||||
} else {
|
|
||||||
ui_message(op, "Shared memory test failed (%s): please check that "
|
|
||||||
"your kernel has CONFIG_SYSVIPC enabled.", strerror(errno));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
} /* check_sysvipc() */
|
|
||||||
|
1
sanity.h
1
sanity.h
@@ -24,6 +24,5 @@
|
|||||||
#define __NVIDIA_INSTALLER_SANITY_H__
|
#define __NVIDIA_INSTALLER_SANITY_H__
|
||||||
|
|
||||||
int sanity(Options *);
|
int sanity(Options *);
|
||||||
int check_sysvipc(Options *op);
|
|
||||||
|
|
||||||
#endif /* __NVIDIA_INSTALLER_SANITY_H__ */
|
#endif /* __NVIDIA_INSTALLER_SANITY_H__ */
|
||||||
|
@@ -317,8 +317,8 @@ int ftp_transfer(UrlResource *rsrc)
|
|||||||
/* do the password dance */
|
/* do the password dance */
|
||||||
if (!check_numeric("230", line)) {
|
if (!check_numeric("230", line)) {
|
||||||
if (!check_numeric("331", line)) {
|
if (!check_numeric("331", line)) {
|
||||||
nvfree(line);
|
|
||||||
ui_error(rsrc->op, "bad/unexpected response: %s", line);
|
ui_error(rsrc->op, "bad/unexpected response: %s", line);
|
||||||
|
nvfree(line);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
nvfree(line);
|
nvfree(line);
|
||||||
|
Binary file not shown.
Binary file not shown.
11
update.c
11
update.c
@@ -265,11 +265,11 @@ static int get_latest_driver_version_and_filename(Options *op,
|
|||||||
char **pFileName)
|
char **pFileName)
|
||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int length;
|
int length = 0;
|
||||||
int ret = FALSE;
|
int ret = FALSE;
|
||||||
char *tmpfile = NULL;
|
char *tmpfile = NULL;
|
||||||
char *url = NULL;
|
char *url = NULL;
|
||||||
char *str = (void *) -1;
|
char *str = MAP_FAILED;
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
char *buf2 = NULL;
|
char *buf2 = NULL;
|
||||||
@@ -311,7 +311,7 @@ static int get_latest_driver_version_and_filename(Options *op,
|
|||||||
length = stat_buf.st_size;
|
length = stat_buf.st_size;
|
||||||
|
|
||||||
str = mmap(0, length, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
|
str = mmap(0, length, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
|
||||||
if (str == (void *) -1) {
|
if (str == MAP_FAILED) {
|
||||||
ui_error(op, "Unable to determine most recent NVIDIA %s-%s driver "
|
ui_error(op, "Unable to determine most recent NVIDIA %s-%s driver "
|
||||||
"version (%s).", INSTALLER_OS, INSTALLER_ARCH,
|
"version (%s).", INSTALLER_OS, INSTALLER_ARCH,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
@@ -354,7 +354,7 @@ static int get_latest_driver_version_and_filename(Options *op,
|
|||||||
|
|
||||||
nvfree(buf);
|
nvfree(buf);
|
||||||
nvfree(buf2);
|
nvfree(buf2);
|
||||||
if (str != (void *) -1) munmap(str, stat_buf.st_size);
|
if (str != MAP_FAILED) munmap(str, length);
|
||||||
if (fd != -1) close(fd);
|
if (fd != -1) close(fd);
|
||||||
|
|
||||||
unlink(tmpfile);
|
unlink(tmpfile);
|
||||||
@@ -364,5 +364,4 @@ static int get_latest_driver_version_and_filename(Options *op,
|
|||||||
nvfree(version);
|
nvfree(version);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
} /* get_latest_driver_version() */
|
|
||||||
|
@@ -126,7 +126,7 @@ int ui_init(Options *op)
|
|||||||
i = 1;
|
i = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; ui_list[i].descr && !__ui; i++) {
|
for (; i < ARRAY_LEN(ui_list) && ui_list[i].descr && !__ui; i++) {
|
||||||
|
|
||||||
if (!extract_user_interface(op, &ui_list[i])) continue;
|
if (!extract_user_interface(op, &ui_list[i])) continue;
|
||||||
|
|
||||||
@@ -605,7 +605,7 @@ static int extract_user_interface(Options *op, user_interface_attribute_t *ui)
|
|||||||
|
|
||||||
if (dst != (void *) -1) munmap(dst, ui->data_array_size);
|
if (dst != (void *) -1) munmap(dst, ui->data_array_size);
|
||||||
if (fd != -1) { close(fd); unlink(ui->filename); }
|
if (fd != -1) { close(fd); unlink(ui->filename); }
|
||||||
if (ui->filename) free(ui->filename);
|
free(ui->filename);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
90
utils.mk
90
utils.mk
@@ -55,6 +55,7 @@ endif
|
|||||||
|
|
||||||
INSTALL ?= install
|
INSTALL ?= install
|
||||||
INSTALL_BIN_ARGS ?= -m 755
|
INSTALL_BIN_ARGS ?= -m 755
|
||||||
|
INSTALL_LIB_ARGS ?= -m 644
|
||||||
INSTALL_DOC_ARGS ?= -m 644
|
INSTALL_DOC_ARGS ?= -m 644
|
||||||
|
|
||||||
M4 ?= m4
|
M4 ?= m4
|
||||||
@@ -98,6 +99,26 @@ ifndef TARGET_ARCH
|
|||||||
TARGET_ARCH := $(subst i686,x86,$(TARGET_ARCH))
|
TARGET_ARCH := $(subst i686,x86,$(TARGET_ARCH))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH),x86)
|
||||||
|
CFLAGS += -DNV_X86 -DNV_ARCH_BITS=32
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH),x86_64)
|
||||||
|
CFLAGS += -DNV_X86_64 -DNV_ARCH_BITS=64
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH),armv7l)
|
||||||
|
CFLAGS += -DNV_ARMV7 -DNV_ARCH_BITS=32
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH),aarch64)
|
||||||
|
CFLAGS += -DNV_AARCH64 -DNV_ARCH_BITS=64
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH),ppc64le)
|
||||||
|
CFLAGS += -DNV_PPC64LE -DNV_ARCH_BITS=64
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(TARGET_OS),Linux)
|
ifeq ($(TARGET_OS),Linux)
|
||||||
LIBDL_LIBS = -ldl
|
LIBDL_LIBS = -ldl
|
||||||
else
|
else
|
||||||
@@ -113,6 +134,14 @@ ifeq ($(TARGET_ARCH),armv7l)
|
|||||||
endif
|
endif
|
||||||
TARGET_ARCH_ABI ?=
|
TARGET_ARCH_ABI ?=
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH_ABI),gnueabi)
|
||||||
|
CFLAGS += -DNV_GNUEABI
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH_ABI),gnueabihf)
|
||||||
|
CFLAGS += -DNV_GNUEABIHF
|
||||||
|
endif
|
||||||
|
|
||||||
OUTPUTDIR ?= _out/$(TARGET_OS)_$(TARGET_ARCH)
|
OUTPUTDIR ?= _out/$(TARGET_OS)_$(TARGET_ARCH)
|
||||||
OUTPUTDIR_ABSOLUTE ?= $(CURDIR)/$(OUTPUTDIR)
|
OUTPUTDIR_ABSOLUTE ?= $(CURDIR)/$(OUTPUTDIR)
|
||||||
|
|
||||||
@@ -143,6 +172,7 @@ endif
|
|||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
|
|
||||||
BINDIR = $(DESTDIR)$(PREFIX)/bin
|
BINDIR = $(DESTDIR)$(PREFIX)/bin
|
||||||
|
LIBDIR = $(DESTDIR)$(PREFIX)/lib
|
||||||
MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1
|
MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1
|
||||||
|
|
||||||
|
|
||||||
@@ -230,7 +260,7 @@ NV_MODULE_LOGGING_NAME ?=
|
|||||||
|
|
||||||
ifeq ($(NV_VERBOSE),0)
|
ifeq ($(NV_VERBOSE),0)
|
||||||
quiet_cmd = @$(PRINTF) \
|
quiet_cmd = @$(PRINTF) \
|
||||||
" $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ],%s) $(quiet_$(1))\n" \
|
" $(if $(NV_MODULE_LOGGING_NAME),[ %-17.17s ],%s) $(quiet_$(1))\n" \
|
||||||
"$(NV_MODULE_LOGGING_NAME)" && $($(1))
|
"$(NV_MODULE_LOGGING_NAME)" && $($(1))
|
||||||
else
|
else
|
||||||
quiet_cmd = $($(1))
|
quiet_cmd = $($(1))
|
||||||
@@ -262,32 +292,49 @@ quiet_STRIP_CMD = $(call define_quiet_cmd,STRIP ,$@)
|
|||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# function to generate a list of object files from their corresponding
|
# function to generate a list of object files from their corresponding
|
||||||
# source files; example usage:
|
# source files using the specified path. The _WITH_DIR variant takes an
|
||||||
|
# output path as the second argument while the BUILD_OBJECT_LIST defaults
|
||||||
|
# to using the value of OUTPUTDIR as the output path. example usage:
|
||||||
#
|
#
|
||||||
# OBJS = $(call BUILD_OBJECT_LIST,$(SRC))
|
# OBJS = $(call BUILD_OBJECT_LIST_WITH_DIR,$(SRC),$(DIR))
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
BUILD_OBJECT_LIST_WITH_DIR = \
|
||||||
|
$(addprefix $(2)/,$(notdir $(addsuffix .o,$(basename $(1)))))
|
||||||
|
|
||||||
BUILD_OBJECT_LIST = \
|
BUILD_OBJECT_LIST = \
|
||||||
$(addprefix $(OUTPUTDIR)/,$(notdir $(addsuffix .o,$(basename $(1)))))
|
$(call BUILD_OBJECT_LIST_WITH_DIR,$(1),$(OUTPUTDIR))
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# function to generate a list of dependency files from their
|
# function to generate a list of dependency files from their
|
||||||
# corresponding source files; example usage:
|
# corresponding source files using the specified path. The _WITH_DIR
|
||||||
|
# variant takes an output path as the second argument while the
|
||||||
|
# BUILD_DEPENDENCY_LIST default to using the value of OUTPUTDIR as the
|
||||||
|
# output path. example usage:
|
||||||
#
|
#
|
||||||
# DEPS = $(call BUILD_DEPENDENCY_LIST,$(SRC))
|
# DEPS = $(call BUILD_DEPENDENCY_LIST_WITH_DIR,$(SRC),$(DIR))
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
BUILD_DEPENDENCY_LIST_WITH_DIR = \
|
||||||
|
$(addprefix $(2)/,$(notdir $(addsuffix .d,$(basename $(1)))))
|
||||||
|
|
||||||
BUILD_DEPENDENCY_LIST = \
|
BUILD_DEPENDENCY_LIST = \
|
||||||
$(addprefix $(OUTPUTDIR)/,$(notdir $(addsuffix .d,$(basename $(1)))))
|
$(call BUILD_DEPENDENCY_LIST_WITH_DIR,$(1),$(OUTPUTDIR))
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# functions to define a rule to build an object file; the first
|
# functions to define a rule to build an object file; the first
|
||||||
# argument whether the rule is for the target or host platform ("HOST"
|
# argument for all functions is whether the rule is for the target or
|
||||||
# or "TARGET"), the second argument is the source file to compile, and
|
# host platform ("HOST" or "TARGET"), the second argument for all
|
||||||
# the third argument (_WITH_OBJECT_NAME-only) is the object filename
|
# functions is the source file to compile.
|
||||||
# to produce. Example usage:
|
#
|
||||||
|
# The _WITH_OBJECT_NAME and _WITH_DIR function name suffixes describe
|
||||||
|
# the third and possibly fourth arguments based on order. The
|
||||||
|
# _WITH_OBJECT_NAME argument is the object filename to produce while
|
||||||
|
# the _WITH_DIR argument is the destination path for the object file.
|
||||||
|
#
|
||||||
|
# Example usage:
|
||||||
#
|
#
|
||||||
# $(eval $(call DEFINE_OBJECT_RULE,TARGET,foo.c))
|
# $(eval $(call DEFINE_OBJECT_RULE,TARGET,foo.c))
|
||||||
#
|
#
|
||||||
@@ -299,26 +346,35 @@ BUILD_DEPENDENCY_LIST = \
|
|||||||
# from the source file name (this is normally what you want).
|
# from the source file name (this is normally what you want).
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
define DEFINE_OBJECT_RULE_WITH_OBJECT_NAME
|
define DEFINE_OBJECT_RULE_WITH_OBJECT_NAME_WITH_DIR
|
||||||
$(3): $(2)
|
$(3): $(2)
|
||||||
@$(MKDIR) $(OUTPUTDIR)
|
@$(MKDIR) $(4)
|
||||||
$$(call quiet_cmd,$(call host_target_cc,$(1))) \
|
$$(call quiet_cmd,$(call host_target_cc,$(1))) \
|
||||||
$$($(call host_target_cflags,$(1))) -c $$< -o $$@ \
|
$$($(call host_target_cflags,$(1))) -c $$< -o $$@ \
|
||||||
$(call AUTO_DEP_CMD,$(1),$(2),$(3))
|
$(call AUTO_DEP_CMD,$(1),$(2),$(3))
|
||||||
|
|
||||||
-include $$(call BUILD_DEPENDENCY_LIST,$(3))
|
-include $$(call BUILD_DEPENDENCY_LIST_WITH_DIR,$(3),$(4))
|
||||||
|
|
||||||
# declare empty rule for generating dependency file; we generate the
|
# declare empty rule for generating dependency file; we generate the
|
||||||
# dependency files implicitly when compiling the source file (see
|
# dependency files implicitly when compiling the source file (see
|
||||||
# AUTO_DEP_CMD above), so we don't want gmake to spend time searching
|
# AUTO_DEP_CMD above), so we don't want gmake to spend time searching
|
||||||
# for an explicit rule to generate the dependency file
|
# for an explicit rule to generate the dependency file
|
||||||
$$(call BUILD_DEPENDENCY_LIST,$(3)): ;
|
$$(call BUILD_DEPENDENCY_LIST_WITH_DIR,$(3),$(4)): ;
|
||||||
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define DEFINE_OBJECT_RULE_WITH_OBJECT_NAME
|
||||||
|
$$(eval $$(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME_WITH_DIR,$(1),$(2),\
|
||||||
|
$(3),$(OUTPUTDIR)))
|
||||||
|
endef
|
||||||
|
|
||||||
|
define DEFINE_OBJECT_RULE_WITH_DIR
|
||||||
|
$$(eval $$(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME_WITH_DIR,$(1),$(2),\
|
||||||
|
$$(call BUILD_OBJECT_LIST_WITH_DIR,$(2),$(3)),$(3)))
|
||||||
|
endef
|
||||||
|
|
||||||
define DEFINE_OBJECT_RULE
|
define DEFINE_OBJECT_RULE
|
||||||
$$(eval $$(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME,$(1),$(2),\
|
$$(eval $$(call DEFINE_OBJECT_RULE_WITH_DIR,$(1),$(2),$(OUTPUTDIR)))
|
||||||
$$(call BUILD_OBJECT_LIST,$(2))))
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
NVIDIA_VERSION = 343.22
|
NVIDIA_VERSION = 346.16
|
||||||
|
Reference in New Issue
Block a user