mirror of
https://github.com/NVIDIA/nvidia-installer.git
synced 2025-07-23 02:13:00 +02:00
550.40.07
This commit is contained in:
54
Makefile
54
Makefile
@@ -41,8 +41,6 @@ NCURSES6_CFLAGS ?=
|
||||
NCURSES6_LDFLAGS ?=
|
||||
NCURSESW6_CFLAGS ?=
|
||||
NCURSESW6_LDFLAGS ?=
|
||||
PCIACCESS_CFLAGS ?=
|
||||
PCIACCESS_LDFLAGS ?=
|
||||
|
||||
BUILD_NCURSES6 = $(if $(NCURSES6_CFLAGS)$(NCURSES6_LDFLAGS),1,)
|
||||
BUILD_NCURSESW6 = $(if $(NCURSESW6_CFLAGS)$(NCURSESW6_LDFLAGS),1,)
|
||||
@@ -63,15 +61,23 @@ NVIDIA_INSTALLER_VERSION := $(NVIDIA_VERSION)
|
||||
NCURSES_UI_C = ncurses-ui.c
|
||||
NCURSES_UI_O = $(call BUILD_OBJECT_LIST,$(NCURSES_UI_C))
|
||||
NCURSES_UI_SO = $(OUTPUTDIR)/nvidia-installer-ncurses-ui.so
|
||||
NCURSES_UI_SO_C = $(OUTPUTDIR)/g_$(notdir $(NCURSES_UI_SO:.so=.c))
|
||||
NCURSES6_UI_O = $(OUTPUTDIR)/ncurses6-ui.o
|
||||
NCURSES6_UI_SO = $(OUTPUTDIR)/nvidia-installer-ncurses6-ui.so
|
||||
NCURSES6_UI_SO_C = $(OUTPUTDIR)/g_$(notdir $(NCURSES6_UI_SO:.so=.c))
|
||||
NCURSESW6_UI_O = $(OUTPUTDIR)/ncursesw6-ui.o
|
||||
NCURSESW6_UI_SO = $(OUTPUTDIR)/nvidia-installer-ncursesw6-ui.so
|
||||
NCURSESW6_UI_SO_C = $(OUTPUTDIR)/g_$(notdir $(NCURSESW6_UI_SO:.so=.c))
|
||||
|
||||
GEN_UI_ARRAY = $(OUTPUTDIR)/gen-ui-array
|
||||
# user-interface.o depends on the generated UI headers
|
||||
NCURSES_UI_HEADERS = $(NCURSES_UI_SO).h
|
||||
NCURSES_UI_HEADERS += $(if $(BUILD_NCURSES6),$(NCURSES6_UI_SO).h,)
|
||||
NCURSES_UI_HEADERS += $(if $(BUILD_NCURSESW6),$(NCURSESW6_UI_SO).h,)
|
||||
$(call BUILD_OBJECT_LIST,user-interface.c): $(NCURSES_UI_HEADERS)
|
||||
|
||||
UI_SOS = $(NCURSES_UI_SO)
|
||||
UI_SOS += $(if $(BUILD_NCURSES6),$(NCURSES6_UI_SO),)
|
||||
UI_SOS += $(if $(BUILD_NCURSESW6),$(NCURSESW6_UI_SO),)
|
||||
|
||||
UI_OBJS = $(addprefix $(OUTPUTDIR)/,$(addsuffix .o,$(notdir $(UI_SOS))))
|
||||
|
||||
CONFIG_H = $(OUTPUTDIR)/config.h
|
||||
|
||||
MANPAGE = $(OUTPUTDIR)/nvidia-installer.1.gz
|
||||
@@ -108,16 +114,10 @@ include dist-files.mk
|
||||
include $(COMMON_UTILS_DIR)/src.mk
|
||||
SRC += $(addprefix $(COMMON_UTILS_DIR)/,$(COMMON_UTILS_SRC))
|
||||
|
||||
NCURSES_UI_SO_SRC = $(NCURSES_UI_SO_C)
|
||||
|
||||
NCURSES_UI_SO_SRC += $(if $(BUILD_NCURSES6),$(NCURSES6_UI_SO_C),)
|
||||
NCURSES_UI_SO_SRC += $(if $(BUILD_NCURSESW6),$(NCURSESW6_UI_SO_C),)
|
||||
CFLAGS += $(if $(BUILD_NCURSES6),-DNV_INSTALLER_NCURSES6,)
|
||||
CFLAGS += $(if $(BUILD_NCURSESW6),-DNV_INSTALLER_NCURSESW6,)
|
||||
|
||||
INSTALLER_SRC = $(SRC) $(NCURSES_UI_SO_SRC)
|
||||
|
||||
INSTALLER_OBJS = $(call BUILD_OBJECT_LIST,$(INSTALLER_SRC))
|
||||
INSTALLER_OBJS = $(call BUILD_OBJECT_LIST,$(SRC)) $(UI_OBJS)
|
||||
|
||||
common_cflags = -I.
|
||||
common_cflags += -imacros $(CONFIG_H)
|
||||
@@ -148,10 +148,7 @@ BUILD_MAKESELF_OBJECT_LIST = \
|
||||
MAKESELF_HELP_SCRIPT_OBJS = \
|
||||
$(call BUILD_MAKESELF_OBJECT_LIST,$(MAKESELF_HELP_SCRIPT_SRC))
|
||||
|
||||
ALL_SRC = $(sort $(INSTALLER_SRC) $(NCURSES_UI_C) $(MKPRECOMPILED_SRC))
|
||||
|
||||
# define a quiet rule for GEN-UI-ARRAY
|
||||
quiet_GEN_UI_ARRAY = GEN-UI-ARRAY $@
|
||||
ALL_SRC = $(sort $(SRC) $(NCURSES_UI_C) $(MKPRECOMPILED_SRC))
|
||||
|
||||
|
||||
##############################################################################
|
||||
@@ -197,13 +194,9 @@ $(MAKESELF_HELP_SCRIPT): $(MAKESELF_HELP_SCRIPT_OBJS)
|
||||
|
||||
$(eval $(call DEBUG_INFO_RULES, $(NVIDIA_INSTALLER)))
|
||||
$(NVIDIA_INSTALLER).unstripped: $(INSTALLER_OBJS)
|
||||
$(call quiet_cmd,LINK) $(CFLAGS) $(LDFLAGS) $(PCIACCESS_LDFLAGS) \
|
||||
$(call quiet_cmd,LINK) $(CFLAGS) $(LDFLAGS) \
|
||||
$(BIN_LDFLAGS) $(INSTALLER_OBJS) -o $@ \
|
||||
$(LIBS) -Bstatic -lpciaccess -Bdynamic
|
||||
|
||||
$(GEN_UI_ARRAY): gen-ui-array.c $(CONFIG_H)
|
||||
$(call quiet_cmd,HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) \
|
||||
$(HOST_BIN_LDFLAGS) $< -o $@
|
||||
$(PCIACCESS_LDFLAGS) $(LIBS)
|
||||
|
||||
$(NCURSES_UI_SO): $(NCURSES_UI_O)
|
||||
$(call quiet_cmd,LINK) -shared $(NCURSES_LDFLAGS) \
|
||||
@@ -217,15 +210,6 @@ $(NCURSESW6_UI_SO): $(NCURSESW6_UI_O)
|
||||
$(call quiet_cmd,LINK) -shared $(NCURSESW6_LDFLAGS) \
|
||||
$(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) $^ -o $@ -lncursesw $(LIBS)
|
||||
|
||||
$(NCURSES_UI_SO_C): $(GEN_UI_ARRAY) $(NCURSES_UI_SO)
|
||||
$(call quiet_cmd,GEN_UI_ARRAY) $(NCURSES_UI_SO) ncurses_ui_array > $@
|
||||
|
||||
$(NCURSES6_UI_SO_C): $(GEN_UI_ARRAY) $(NCURSES6_UI_SO)
|
||||
$(call quiet_cmd,GEN_UI_ARRAY) $(NCURSES6_UI_SO) ncurses6_ui_array > $@
|
||||
|
||||
$(NCURSESW6_UI_SO_C): $(GEN_UI_ARRAY) $(NCURSESW6_UI_SO)
|
||||
$(call quiet_cmd,GEN_UI_ARRAY) $(NCURSESW6_UI_SO) ncursesw6_ui_array > $@
|
||||
|
||||
# misc.c includes pciaccess.h
|
||||
$(call BUILD_OBJECT_LIST,misc.c): CFLAGS += $(PCIACCESS_CFLAGS)
|
||||
|
||||
@@ -242,6 +226,12 @@ $(foreach src,$(ALL_SRC),$(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))
|
||||
$(eval $(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME,TARGET,$(NCURSES_UI_C),$(NCURSES6_UI_O)))
|
||||
$(eval $(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME,TARGET,$(NCURSES_UI_C),$(NCURSESW6_UI_O)))
|
||||
|
||||
# define the rules to pack the UI .so files into .o arrays
|
||||
$(foreach so,$(UI_SOS), \
|
||||
$(eval $(call READ_ONLY_OBJECT_FROM_FILE_RULE,$(so))))
|
||||
$(foreach so,$(UI_SOS), \
|
||||
$(eval $(call BINARY_DATA_HEADER_RULE,$(so))))
|
||||
|
||||
# define a rule to build each makeself-help-script object file
|
||||
$(foreach src,$(MAKESELF_HELP_SCRIPT_SRC),\
|
||||
$(eval $(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME,HOST,$(src),\
|
||||
|
@@ -16,9 +16,19 @@ COMMON_UTILS_EXTRA_DIST += src.mk
|
||||
# prevent other programs from needing to set the right CFLAGS/LDFLAGS for code
|
||||
# they won't use. Otherwise, just package it in the source tarball.
|
||||
ifneq ($(COMMON_UTILS_PCIACCESS),)
|
||||
COMMON_UTILS_SRC += nvpci-utils.c
|
||||
COMMON_UTILS_SRC += nvpci-utils.c
|
||||
|
||||
ifndef PCIACCESS_CFLAGS
|
||||
PCIACCESS_CFLAGS := $(shell $(PKG_CONFIG) --cflags pciaccess)
|
||||
endif
|
||||
|
||||
ifndef PCIACCESS_LDFLAGS
|
||||
PCIACCESS_LDFLAGS := $(shell $(PKG_CONFIG) --libs pciaccess)
|
||||
endif
|
||||
|
||||
$(call BUILD_OBJECT_LIST,nvpci-utils.c): CFLAGS += $(PCIACCESS_CFLAGS)
|
||||
else
|
||||
COMMON_UTILS_EXTRA_DIST += nvpci-utils.c
|
||||
COMMON_UTILS_EXTRA_DIST += nvpci-utils.c
|
||||
endif
|
||||
COMMON_UTILS_EXTRA_DIST += nvpci-utils.h
|
||||
|
||||
|
@@ -71,6 +71,5 @@ DIST_FILES += nvidia-installer.1.m4
|
||||
DIST_FILES += gen-manpage-opts.c
|
||||
DIST_FILES += makeself-help-script.c
|
||||
|
||||
DIST_FILES += gen-ui-array.c
|
||||
DIST_FILES += ncurses-ui.c
|
||||
DIST_FILES += mkprecompiled.c
|
||||
|
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* This C program takes a filename and an array name, and prints to
|
||||
* stdout an array of the data contained in the file.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *arrayname, *filename;
|
||||
unsigned char *src;
|
||||
struct stat stat_buf;
|
||||
int length, fd, i, n;
|
||||
|
||||
if (argc != 3) {
|
||||
fprintf(stderr, "usage: %s [filename] [arrayname]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
filename = argv[1];
|
||||
arrayname = argv[2];
|
||||
|
||||
/* open the file */
|
||||
|
||||
fd = open(filename, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "unable to open(2) %s (%s)\n",
|
||||
filename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* get the length of the file */
|
||||
|
||||
if (fstat(fd, &stat_buf) != 0) {
|
||||
fprintf(stderr, "unable to stat(2) %s (%s)\n",
|
||||
filename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
length = stat_buf.st_size;
|
||||
|
||||
/* map the file */
|
||||
|
||||
src = mmap(0, length, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (src == (void *) -1) {
|
||||
fprintf(stderr, "unable to mmap(2) %s (%s)\n",
|
||||
filename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* print the header */
|
||||
|
||||
printf("/*\n");
|
||||
printf( " * THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT\n");
|
||||
printf( " *\n");
|
||||
printf( " * This file contains the contents of the file \"%s\"\n",
|
||||
filename);
|
||||
printf( " * as the byte array %s[].\n", arrayname);
|
||||
printf( " */\n\n");
|
||||
|
||||
/* print a separate variable that stores the size */
|
||||
|
||||
printf("const int %s_size = %d;\n\n", arrayname, length);
|
||||
|
||||
/* print the array name */
|
||||
|
||||
printf("const unsigned char %s[%d] = {\n", arrayname, length);
|
||||
|
||||
for (i = 0, n = 0; i < length; i++, n++) {
|
||||
if (n == 0) printf(" ");
|
||||
printf("0x%02x, ", src[i]);
|
||||
if (n >= 11) { printf("\n"); n = -1; }
|
||||
}
|
||||
|
||||
printf("\n};\n\n");
|
||||
|
||||
/* unmap the file */
|
||||
|
||||
munmap(src, length);
|
||||
|
||||
/* close the file */
|
||||
|
||||
close(fd);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
186
initramfs.c
186
initramfs.c
@@ -26,46 +26,47 @@
|
||||
#include "conflicting-kernel-modules.h"
|
||||
|
||||
/*
|
||||
* find_initramfs_images() - Locate initramfs image files whose names conform
|
||||
* to well-known patterns. Returns the number of located image files. If the
|
||||
* caller supplies a pointer to an array of strings, the list of found images
|
||||
* will be returned in a heap-allocated NULL-terminated list via that pointer.
|
||||
* get_initramfs_path() - Test well-known locations for the existence of
|
||||
* candidate initramfs files. If there is more than one candidate, prompt the
|
||||
* user to select one of them. Returns the found (if one) or selected (if more
|
||||
* than one found) file, or NULL if no file is found or the user declines to
|
||||
* select one.
|
||||
*/
|
||||
static int find_initramfs_images(Options *op, char ***found_paths)
|
||||
{
|
||||
char *kernel_name = get_kernel_name(op);
|
||||
int num_found_paths = 0;
|
||||
|
||||
if (found_paths) {
|
||||
*found_paths = NULL;
|
||||
static char *get_initramfs_path(Options *op)
|
||||
{
|
||||
static char *path_ret;
|
||||
static int attempted;
|
||||
char *kernel_name;
|
||||
|
||||
if (attempted) {
|
||||
/* This function has already been called: return the cached path value
|
||||
* (which may be NULL if no path was found previously). */
|
||||
|
||||
return path_ret;
|
||||
}
|
||||
|
||||
kernel_name = get_kernel_name(op);
|
||||
if (kernel_name) {
|
||||
/* This must be at least two more than the number of times the
|
||||
* __TEST_INITRAMFS_FILE macro is invoked below. One for a NULL
|
||||
* terminator, and another for a "none of the above" option that
|
||||
* may be added by a caller. */
|
||||
const int found_paths_size = 8;
|
||||
int num_found_paths = 0, found_paths_size = 8;
|
||||
int i;
|
||||
char **found_paths = nvalloc(found_paths_size * sizeof(char*));
|
||||
char *tmp;
|
||||
|
||||
if (found_paths) {
|
||||
*found_paths = nvalloc(found_paths_size * sizeof(char*));
|
||||
}
|
||||
|
||||
#define __TEST_INITRAMFS_FILE(format, str) { \
|
||||
char *path = nvasprintf("/boot/" format, str); \
|
||||
if (access(path, F_OK) == 0) { \
|
||||
if (found_paths && num_found_paths < found_paths_size - 2) { \
|
||||
(*found_paths)[num_found_paths] = path; \
|
||||
if (num_found_paths + 2 > found_paths_size) { \
|
||||
found_paths_size *= 2; \
|
||||
found_paths = nvrealloc(found_paths, \
|
||||
found_paths_size * sizeof(char*)); \
|
||||
} \
|
||||
num_found_paths++; \
|
||||
found_paths[num_found_paths++] = path; \
|
||||
} else { \
|
||||
nvfree(path); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Don't forget to increase found_paths_size, if necessary, when
|
||||
* adding additional templates. */
|
||||
__TEST_INITRAMFS_FILE("initramfs-%s.img", kernel_name);
|
||||
__TEST_INITRAMFS_FILE("initramfs-%s.img", "linux");
|
||||
__TEST_INITRAMFS_FILE("initramfs-%s.img", "linux-lts");
|
||||
@@ -94,67 +95,35 @@ static int find_initramfs_images(Options *op, char ***found_paths)
|
||||
|
||||
nvfree(kernel_name_copy);
|
||||
}
|
||||
}
|
||||
|
||||
return num_found_paths;
|
||||
}
|
||||
if (num_found_paths == 1) {
|
||||
path_ret = found_paths[0];
|
||||
} else if (num_found_paths > 1) {
|
||||
int answer;
|
||||
|
||||
/*
|
||||
* get_initramfs_path() - Test well-known locations for the existence of
|
||||
* candidate initramfs files. If there is more than one candidate, optionally
|
||||
* prompt the user to select one of them. Returns the found (if one) or
|
||||
* selected (if more than one found, and function is run interactively) file,
|
||||
* or NULL if no file is found or multiple candidates exist and the user does
|
||||
* not select one (either because the function is run non-interactively or the
|
||||
* user declines to select one when prompted.
|
||||
*/
|
||||
/* We ensured we have enough space in __TEST_INITRAMFS_FILE() */
|
||||
found_paths[num_found_paths] = "Use none of these";
|
||||
|
||||
static char *get_initramfs_path(Options *op, int interactive)
|
||||
{
|
||||
static char *path_ret = NULL;
|
||||
static int attempted = FALSE;
|
||||
int num_found_paths;
|
||||
char **found_paths;
|
||||
int i;
|
||||
|
||||
if (attempted) {
|
||||
/* This function has already been called: return the cached path value
|
||||
* (which may be NULL if no path was found previously). */
|
||||
|
||||
return path_ret;
|
||||
}
|
||||
|
||||
num_found_paths = find_initramfs_images(op, &found_paths);
|
||||
|
||||
if (num_found_paths == 1) {
|
||||
path_ret = found_paths[0];
|
||||
} else if (num_found_paths > 1 && interactive) {
|
||||
int answer;
|
||||
|
||||
/* We ensured we have enough space in find_initramfs_images() */
|
||||
found_paths[num_found_paths] = "Use none of these";
|
||||
|
||||
answer = ui_multiple_choice(op, (const char * const*)found_paths,
|
||||
num_found_paths + 1, num_found_paths,
|
||||
"More than one initramfs file found. "
|
||||
"Which file would you like to use?");
|
||||
if (answer < num_found_paths) {
|
||||
/* answer == found_paths means the user opted out */
|
||||
path_ret = found_paths[answer];
|
||||
answer = ui_multiple_choice(op, (const char * const*)found_paths,
|
||||
num_found_paths + 1, num_found_paths,
|
||||
"More than one initramfs file found. "
|
||||
"Which file would you like to use?");
|
||||
if (answer < num_found_paths) {
|
||||
/* answer == found_paths means the user opted out */
|
||||
path_ret = found_paths[answer];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up the paths that we're not returning */
|
||||
for (i = 0; i < num_found_paths; i++) {
|
||||
if (found_paths[i] != path_ret) {
|
||||
nvfree(found_paths[i]);
|
||||
/* Clean up the paths that we're not returning */
|
||||
for (i = 0; i < num_found_paths; i++) {
|
||||
if (found_paths[i] != path_ret) {
|
||||
nvfree(found_paths[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
nvfree(found_paths);
|
||||
nvfree(found_paths);
|
||||
|
||||
/* If a path is not found in non-interactive mode, allow trying again in
|
||||
* interactive mode later. */
|
||||
attempted = path_ret || interactive;
|
||||
}
|
||||
attempted = TRUE;
|
||||
|
||||
return path_ret;
|
||||
}
|
||||
@@ -255,7 +224,7 @@ static int get_tool_index(Options *op, const InitramfsTool *tool)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (tool->requires_path && find_initramfs_images(op, NULL) == 0) {
|
||||
if (tool->requires_path && get_initramfs_path(op) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -447,12 +416,10 @@ static int run_initramfs_tool(Options *op, int tool, char **data,
|
||||
|
||||
/* Run with only the initramfs path, if a kernel is not required. */
|
||||
if (ret != 0 && !kernel_required) {
|
||||
char *initramfs_path = get_initramfs_path(op, interactive);
|
||||
|
||||
if (data) {
|
||||
nvfree(*data);
|
||||
}
|
||||
ret = initramfs_tool_helper(op, tool, NULL, initramfs_path,
|
||||
ret = initramfs_tool_helper(op, tool, NULL, get_initramfs_path(op),
|
||||
data, interactive);
|
||||
}
|
||||
|
||||
@@ -467,13 +434,11 @@ static int run_initramfs_tool(Options *op, int tool, char **data,
|
||||
|
||||
/* Run with both the kernel and initramfs path. */
|
||||
if (ret != 0) {
|
||||
char *initramfs_path = get_initramfs_path(op, interactive);
|
||||
|
||||
if (data) {
|
||||
nvfree(*data);
|
||||
}
|
||||
ret = initramfs_tool_helper(op, tool, get_kernel_name(op),
|
||||
initramfs_path, data, interactive);
|
||||
get_initramfs_path(op), data, interactive);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -482,31 +447,18 @@ static int run_initramfs_tool(Options *op, int tool, char **data,
|
||||
static pthread_t scan_thread;
|
||||
|
||||
typedef struct {
|
||||
/* Index into initramfs_tools[] for the initramfs scanning tool. A negative
|
||||
* index indicates that no suitable tool was found. The index should be
|
||||
* initialized with either the return value of find_initramfs_tool() or a
|
||||
* negative value. */
|
||||
int tool;
|
||||
|
||||
/* Flags to indicate the reults of an attempted initramfs scan. These flags
|
||||
* should all be zero-initialized before the first scan attempt. */
|
||||
|
||||
/* Initramfs scan detected Nouveau in the initramfs */
|
||||
int nouveau_ko_detected;
|
||||
/* Initramfs scan detected NVIDIA kernel modules in the initramfs */
|
||||
int nvidia_ko_detected;
|
||||
/* A non-interactive scan was attempted, but interaction is required to
|
||||
* complete the scan (e.g. because the user needs to make a choice between
|
||||
* more than one available candidate tool). */
|
||||
int try_scan_again;
|
||||
/* The initramfs was successfully scanned and the *_ko_detected flags can
|
||||
* be trusted to accurately reflect the contents of the initramfs. */
|
||||
int scan_complete;
|
||||
int scan_attempted;
|
||||
int scan_succeeded;
|
||||
} ScanThreadData;
|
||||
|
||||
static void scan_initramfs(Options *op, ScanThreadData *data, int interactive)
|
||||
{
|
||||
if (data->tool >= 0) {
|
||||
if (data->tool < 0) {
|
||||
ui_log(op, "Unable to scan initramfs: no tool found");
|
||||
} else {
|
||||
char *listing;
|
||||
int ret;
|
||||
|
||||
@@ -514,7 +466,8 @@ static void scan_initramfs(Options *op, ScanThreadData *data, int interactive)
|
||||
initramfs_tools[data->tool].name);
|
||||
|
||||
ret = run_initramfs_tool(op, data->tool, &listing, interactive);
|
||||
data->scan_complete = FALSE;
|
||||
data->scan_attempted = TRUE;
|
||||
data->scan_succeeded = FALSE;
|
||||
|
||||
if (ret == 0) {
|
||||
int i;
|
||||
@@ -541,22 +494,17 @@ static void scan_initramfs(Options *op, ScanThreadData *data, int interactive)
|
||||
}
|
||||
}
|
||||
|
||||
data->scan_complete = TRUE;
|
||||
data->scan_succeeded = TRUE;
|
||||
}
|
||||
nvfree(listing);
|
||||
|
||||
/* If the scan failed in non-interactive mode, we'll want to try again
|
||||
* in interactive mode later. */
|
||||
data->try_scan_again = !interactive && !data->scan_complete;
|
||||
ui_log(op, "Initramfs scan %s.", ret == 0 ? "complete" : "failed");
|
||||
} else {
|
||||
ui_log(op, "Unable to scan initramfs: no tool found");
|
||||
}
|
||||
}
|
||||
|
||||
static void *initramfs_scan_worker(void *arg)
|
||||
{
|
||||
static ScanThreadData data = {};
|
||||
static ScanThreadData data;
|
||||
Options *op = arg;
|
||||
|
||||
data.tool = find_initramfs_tool(op, INITRAMFS_LIST_TOOL, NON_INTERACTIVE);
|
||||
@@ -629,7 +577,7 @@ int update_initramfs(Options *op)
|
||||
data_pointer = &data;
|
||||
}
|
||||
|
||||
if (data_pointer->try_scan_again) {
|
||||
if (!data_pointer->scan_attempted) {
|
||||
data_pointer->tool = find_initramfs_tool(op, INITRAMFS_LIST_TOOL,
|
||||
INTERACTIVE);
|
||||
|
||||
@@ -663,13 +611,13 @@ int update_initramfs(Options *op)
|
||||
"condition(s):\n%s\n"
|
||||
"Would you like to rebuild the "
|
||||
"initramfs?", reason);
|
||||
} else if (data_pointer->scan_complete) {
|
||||
ui_log(op, "No NVIDIA modules detected in the initramfs.");
|
||||
ret = TRUE;
|
||||
} else {
|
||||
} else if (data_pointer->tool < 0 || !data_pointer->scan_succeeded) {
|
||||
rebuild = ui_multiple_choice(op, choices, 2, 0,
|
||||
"%s Would you like to rebuild "
|
||||
"the initramfs?", no_listing);
|
||||
} else {
|
||||
ui_log(op, "No NVIDIA modules detected in the initramfs.");
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
if (rebuild) {
|
||||
@@ -690,10 +638,10 @@ int update_initramfs(Options *op)
|
||||
"due to the following condition(s):\n%s\n"
|
||||
"Please consult your distribution's documentation for "
|
||||
"instructions on how to rebuild the initramfs.", reason);
|
||||
ret = TRUE;
|
||||
} else if (!data_pointer->scan_complete) {
|
||||
ret = TRUE;
|
||||
} else if (data_pointer->tool < 0 || !data_pointer->scan_succeeded) {
|
||||
ui_message(op, "%s", no_listing);
|
||||
ret = TRUE;
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
nvfree(reason);
|
||||
|
89
misc.c
89
misc.c
@@ -1662,6 +1662,84 @@ int check_for_running_x(Options *op)
|
||||
|
||||
} /* check_for_running_x() */
|
||||
|
||||
/*
|
||||
* nvpci_dev_is_vgpu_gsp() - Check if 'is_vgpu_host_package.txt' file is present
|
||||
* in the package. File 'is_vgpu_host_package.txt' is present in vGPU host
|
||||
* packages only. Environment variables VGX_BUILD and VGX_KVM_BUILD are used to
|
||||
* install vGPU host driver using *-internal.run on Xenserver and KVM
|
||||
* respectively.
|
||||
* If device_id is present in the list of devIDs of pGPUs that don't support GSP
|
||||
* on vGPU then return FALSE, else return TRUE.
|
||||
*/
|
||||
static int nvpci_dev_is_vgpu_gsp(Package *p, unsigned int device_id)
|
||||
{
|
||||
unsigned short vgpu_non_gsp_dev_ids[] = {
|
||||
0x13bd, // Tesla M10,
|
||||
0x13f2, // Tesla M60
|
||||
0x13f3, // Tesla M6
|
||||
0x15f7, // Tesla P100-PCIE-12GB
|
||||
0x15f8, // Tesla P100-PCIE-16GB
|
||||
0x15f9, // Tesla P100-SXM2-16GB
|
||||
0x1b38, // Tesla P40
|
||||
0x1bb3, // Tesla P4
|
||||
0x1bb4, // Tesla P6
|
||||
0x1db1, // Tesla V100-SXM2-16GB
|
||||
0x1db3, // Tesla V100-FHHL-16GB
|
||||
0x1db4, // Tesla V100-PCIE-16GB
|
||||
0x1db5, // Tesla V100-SXM2-32GB
|
||||
0x1db6, // Tesla V100-PCIE-32GB
|
||||
0x1df6, // Tesla V100S-PCIE-32GB,
|
||||
0x1e30, // Quadro RTX 8000, Quadro RTX 6000,
|
||||
0x1e37, // PG150 SKU220, PG150 SKU215,
|
||||
0x1e78, // Quadro RTX 8000, Quadro RTX 6000,
|
||||
0x1eb8, // Tesla T4
|
||||
0x20b0, // NVIDIA A100-SXM4-40GB
|
||||
0x20b2, // NVIDIA A100-SXM4-80GB
|
||||
0x20b5, // NVIDIA A100-PCIE-80GB, A100-PCIe-80GB LC,
|
||||
0x20b7, // NVIDIA A30
|
||||
0x20b8, // NVIDIA A100X,
|
||||
0x20b9, // NVIDIA A30X,
|
||||
0x20f1, // NVIDIA A100-PCIE-40GB
|
||||
0x20f3, // NVIDIA A800-SXM4-80GB
|
||||
0x20f5, // NVIDIA A800 80GB PCIe
|
||||
0x20f6, // NVIDIA A800 PCIe 40GB Active,
|
||||
0x20fd, // NVIDIA AX800,
|
||||
0x2230, // NVIDIA RTX A6000
|
||||
0x2231, // NVIDIA RTX A5000
|
||||
0x2233, // NVIDIA RTX A5500,
|
||||
0x2235, // NVIDIA A40
|
||||
0x2236, // NVIDIA A10
|
||||
0x2237, // NVIDIA A10G
|
||||
0x2238, // NVIDIA A10M,
|
||||
0x25b6, // NVIDIA A16, NVIDIA A2
|
||||
};
|
||||
|
||||
int i, is_vgx_kvm_build = 0, is_vgx_build = 0;
|
||||
const char *vgx_build = getenv("VGX_BUILD");
|
||||
const char *vgx_kvm_build = getenv("VGX_KVM_BUILD");
|
||||
|
||||
if (vgx_build != NULL) {
|
||||
is_vgx_build = 1;
|
||||
}
|
||||
|
||||
if (vgx_kvm_build != NULL) {
|
||||
is_vgx_kvm_build = 1;
|
||||
}
|
||||
|
||||
/* Check if this is vGPU host package */
|
||||
if ((access("./is_vgpu_host_package.txt", F_OK) == 0) || (is_vgx_build == 1) ||
|
||||
(is_vgx_kvm_build == 1)) {
|
||||
|
||||
/* If device_id is present in the non-gsp devId list, return FALSE */
|
||||
for (i = 0; i < ARRAY_LEN(vgpu_non_gsp_dev_ids); i++) {
|
||||
if (device_id == vgpu_non_gsp_dev_ids[i]) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* check_for_nvidia_graphics_devices() - check if there are supported
|
||||
@@ -1677,7 +1755,7 @@ void check_for_nvidia_graphics_devices(Options *op, Package *p)
|
||||
struct pci_device_iterator *iter;
|
||||
struct pci_device *dev;
|
||||
int i, found_supported_device = FALSE, found_self_hosted = FALSE;
|
||||
int found_vga_device = FALSE;
|
||||
int found_vga_device = FALSE, found_vgpu_gsp = FALSE, count = 0;
|
||||
|
||||
if (pci_system_init()) {
|
||||
return;
|
||||
@@ -1685,7 +1763,7 @@ void check_for_nvidia_graphics_devices(Options *op, Package *p)
|
||||
|
||||
iter = nvpci_find_gpu_by_vendor(NV_PCI_VENDOR_ID);
|
||||
|
||||
for (dev = pci_device_next(iter); dev; dev = pci_device_next(iter)) {
|
||||
for (dev = pci_device_next(iter); dev; dev = pci_device_next(iter), count++) {
|
||||
if (dev->device_id >= 0x0020 /* TNT or later */) {
|
||||
/*
|
||||
* First check if this GPU is a "legacy" GPU; if it is, print a
|
||||
@@ -1753,6 +1831,11 @@ void check_for_nvidia_graphics_devices(Options *op, Package *p)
|
||||
if (pci_devid_is_self_hosted(dev->device_id)) {
|
||||
found_self_hosted = TRUE;
|
||||
}
|
||||
|
||||
/* Check the first device in the system is vGPU GSP supported device */
|
||||
if ((count == 0) && nvpci_dev_is_vgpu_gsp(p, dev->device_id)) {
|
||||
found_vgpu_gsp = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1773,7 +1856,7 @@ void check_for_nvidia_graphics_devices(Options *op, Package *p)
|
||||
if (!found_vga_device)
|
||||
op->no_nvidia_xconfig_question = TRUE;
|
||||
|
||||
if (found_self_hosted && !op->kernel_module_build_directory_override) {
|
||||
if ((found_self_hosted || found_vgpu_gsp) && !op->kernel_module_build_directory_override) {
|
||||
ui_log(op, "This system requires use of the NVIDIA open kernel "
|
||||
"modules; these will be selected by default.");
|
||||
nvfree(p->kernel_module_build_directory);
|
||||
|
@@ -319,6 +319,8 @@ static void parse_commandline(int argc, char *argv[], Options *op)
|
||||
op->uninstall = TRUE; break;
|
||||
case SKIP_MODULE_UNLOAD_OPTION:
|
||||
op->skip_module_unload = TRUE; break;
|
||||
case SKIP_MODULE_LOAD_OPTION:
|
||||
op->skip_module_load = TRUE; break;
|
||||
case PROC_MOUNT_POINT_OPTION:
|
||||
op->proc_mount_point = strval; break;
|
||||
case USER_INTERFACE_OPTION:
|
||||
|
@@ -44,6 +44,7 @@ enum {
|
||||
KERNEL_INSTALL_PATH_OPTION,
|
||||
UNINSTALL_OPTION,
|
||||
SKIP_MODULE_UNLOAD_OPTION,
|
||||
SKIP_MODULE_LOAD_OPTION,
|
||||
PROC_MOUNT_POINT_OPTION,
|
||||
USER_INTERFACE_OPTION,
|
||||
LOG_FILE_NAME_OPTION,
|
||||
@@ -159,6 +160,10 @@ static const NVGetoptOption __options[] = {
|
||||
"When uninstalling the driver, skip unloading of the NVIDIA kernel "
|
||||
"module. This option is ignored when the driver is being installed." },
|
||||
|
||||
{ "skip-module-load", SKIP_MODULE_LOAD_OPTION, 0, NULL,
|
||||
"Skip the test load of the NVIDIA kernel modules after the modules are "
|
||||
"built, and skip loading them after installation is complete."},
|
||||
|
||||
{ "sanity", SANITY_OPTION, 0, NULL,
|
||||
"Perform basic sanity tests on an existing NVIDIA "
|
||||
"driver installation." },
|
||||
|
@@ -40,6 +40,14 @@
|
||||
#include "user-interface.h"
|
||||
#include "ui-status-indeterminate.h"
|
||||
|
||||
#include "nvidia-installer-ncurses-ui.so.h"
|
||||
#if defined(NV_INSTALLER_NCURSES6)
|
||||
#include "nvidia-installer-ncurses6-ui.so.h"
|
||||
#endif
|
||||
#if defined(NV_INSTALLER_NCURSESW6)
|
||||
#include "nvidia-installer-ncursesw6-ui.so.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* global user interface pointer
|
||||
*/
|
||||
@@ -56,19 +64,6 @@ char *__extracted_user_interface_filename = NULL;
|
||||
|
||||
extern InstallerUI stream_ui_dispatch_table;
|
||||
|
||||
/* pull in the user interface data arrays and sizes */
|
||||
|
||||
extern const char ncurses_ui_array[];
|
||||
extern const int ncurses_ui_array_size;
|
||||
#if defined(NV_INSTALLER_NCURSES6)
|
||||
extern const char ncurses6_ui_array[];
|
||||
extern const int ncurses6_ui_array_size;
|
||||
#endif
|
||||
#if defined(NV_INSTALLER_NCURSESW6)
|
||||
extern const char ncursesw6_ui_array[];
|
||||
extern const int ncursesw6_ui_array_size;
|
||||
#endif
|
||||
|
||||
/* struct describing the ui data */
|
||||
|
||||
typedef struct {
|
||||
@@ -109,13 +104,20 @@ int ui_init(Options *op)
|
||||
/* { "nvidia-installer GTK+ user interface", NULL, NULL, 0 }, */
|
||||
#if defined(NV_INSTALLER_NCURSES6)
|
||||
{ "ncurses6", "nvidia-installer ncurses v6 user interface", NULL,
|
||||
ncurses6_ui_array, ncurses6_ui_array_size },
|
||||
_binary_nvidia_installer_ncurses6_ui_so_start,
|
||||
_binary_nvidia_installer_ncurses6_ui_so_end - _binary_nvidia_installer_ncurses6_ui_so_start
|
||||
},
|
||||
#endif
|
||||
{ "ncurses", "nvidia-installer ncurses user interface", NULL,
|
||||
ncurses_ui_array, ncurses_ui_array_size },
|
||||
_binary_nvidia_installer_ncurses_ui_so_start,
|
||||
_binary_nvidia_installer_ncurses_ui_so_end - _binary_nvidia_installer_ncurses_ui_so_start
|
||||
},
|
||||
#if defined(NV_INSTALLER_NCURSESW6)
|
||||
{ "ncursesw6", "nvidia-installer ncurses v6 user interface (widechar)",
|
||||
NULL, ncursesw6_ui_array, ncursesw6_ui_array_size },
|
||||
NULL,
|
||||
_binary_nvidia_installer_ncursesw6_ui_so_start,
|
||||
_binary_nvidia_installer_ncursesw6_ui_so_end - _binary_nvidia_installer_ncursesw6_ui_so_start
|
||||
},
|
||||
#endif
|
||||
{ "none", NULL, NULL, NULL, 0 }
|
||||
};
|
||||
|
22
utils.mk
22
utils.mk
@@ -110,6 +110,7 @@ CHMOD ?= chmod
|
||||
OBJCOPY ?= objcopy
|
||||
XZ ?= xz
|
||||
WHOAMI ?= whoami
|
||||
PKG_CONFIG ?= pkg-config
|
||||
|
||||
ifndef HOSTNAME
|
||||
HOSTNAME = $(shell hostname)
|
||||
@@ -136,11 +137,16 @@ ifeq ($(TARGET_OS),SunOS)
|
||||
endif
|
||||
|
||||
ifndef TARGET_ARCH
|
||||
TARGET_ARCH := $(shell uname -m)
|
||||
ifneq ($(TARGET_OS),SunOS)
|
||||
TARGET_ARCH := $(shell uname -m)
|
||||
else
|
||||
TARGET_ARCH := $(shell isainfo -n)
|
||||
endif
|
||||
TARGET_ARCH := $(subst i386,x86,$(TARGET_ARCH))
|
||||
TARGET_ARCH := $(subst i486,x86,$(TARGET_ARCH))
|
||||
TARGET_ARCH := $(subst i586,x86,$(TARGET_ARCH))
|
||||
TARGET_ARCH := $(subst i686,x86,$(TARGET_ARCH))
|
||||
TARGET_ARCH := $(subst amd64,x86_64,$(TARGET_ARCH))
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH),x86)
|
||||
@@ -196,9 +202,6 @@ NV_QUIET_COMMAND_REMOVED_TARGET_PREFIX ?=
|
||||
|
||||
NV_GENERATED_HEADERS ?=
|
||||
|
||||
PCIACCESS_CFLAGS ?=
|
||||
PCIACCESS_LDFLAGS ?=
|
||||
|
||||
##############################################################################
|
||||
# This makefile uses the $(eval) builtin function, which was added in
|
||||
# GNU make 3.80. Check that the current make version recognizes it.
|
||||
@@ -404,8 +407,6 @@ BUILD_OBJECT_LIST_WITH_DIR = \
|
||||
BUILD_OBJECT_LIST = \
|
||||
$(call BUILD_OBJECT_LIST_WITH_DIR,$(1),$(OUTPUTDIR))
|
||||
|
||||
$(call BUILD_OBJECT_LIST,nvpci-utils.c): CFLAGS += $(PCIACCESS_CFLAGS)
|
||||
|
||||
##############################################################################
|
||||
# function to generate a list of dependency files from their
|
||||
# corresponding source files using the specified path. The _WITH_DIR
|
||||
@@ -596,3 +597,12 @@ define READ_ONLY_OBJECT_FROM_FILE_RULE
|
||||
--rename-section .data=.rodata,contents,alloc,load,data,readonly \
|
||||
$$@
|
||||
endef
|
||||
|
||||
define BINARY_DATA_HEADER_RULE
|
||||
$$(OUTPUTDIR)/$(notdir $(1)).h:
|
||||
$(at_if_quiet)$(MKDIR) $$(OUTPUTDIR)
|
||||
$(at_if_quiet){ \
|
||||
$$(PRINTF) "extern const char _binary_$(subst -,_,$(subst .,_,$(notdir $(1))))_start[];\n"; \
|
||||
$$(PRINTF) "extern const char _binary_$(subst -,_,$(subst .,_,$(notdir $(1))))_end[];\n"; \
|
||||
} > $$@
|
||||
endef
|
||||
|
@@ -1,4 +1,4 @@
|
||||
NVIDIA_VERSION = 545.29.06
|
||||
NVIDIA_VERSION = 550.40.07
|
||||
|
||||
# This file.
|
||||
VERSION_MK_FILE := $(lastword $(MAKEFILE_LIST))
|
||||
|
Reference in New Issue
Block a user