summaryrefslogtreecommitdiff
path: root/usr/src/cmd/boot/bootadm
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/boot/bootadm')
-rw-r--r--usr/src/cmd/boot/bootadm/Makefile5
-rw-r--r--usr/src/cmd/boot/bootadm/bootadm.c58
-rw-r--r--usr/src/cmd/boot/bootadm/filelist.ramdisk2
3 files changed, 61 insertions, 4 deletions
diff --git a/usr/src/cmd/boot/bootadm/Makefile b/usr/src/cmd/boot/bootadm/Makefile
index fc4a370cef..c077811679 100644
--- a/usr/src/cmd/boot/bootadm/Makefile
+++ b/usr/src/cmd/boot/bootadm/Makefile
@@ -51,10 +51,7 @@ LDLIBS += -lnvpair
# behavior, which causes us to take SIGSEGV on such a write.
CFLAGS += $(XSTRCONST)
CPPFLAGS += -D_FILE_OFFSET_BITS=64
-
-# Add paths to pick up headers
-CFLAGS += -I../../../uts/common
-LINTFLAGS += -I../../../uts/common
+CPPFLAGS += -I../../../uts/common -I../../../common
all: $(PROG)
diff --git a/usr/src/cmd/boot/bootadm/bootadm.c b/usr/src/cmd/boot/bootadm/bootadm.c
index 40985595c0..770752cdc9 100644
--- a/usr/src/cmd/boot/bootadm/bootadm.c
+++ b/usr/src/cmd/boot/bootadm/bootadm.c
@@ -50,9 +50,13 @@
#include <ftw.h>
#include <fcntl.h>
#include <strings.h>
+#include <utime.h>
#include <sys/systeminfo.h>
#include <sys/dktp/fdisk.h>
#include <sys/param.h>
+#if defined(__i386)
+#include <sys/ucode.h>
+#endif
#include <pwd.h>
#include <grp.h>
@@ -246,6 +250,10 @@ static void append_to_flist(filelist_t *, char *);
static void sparc_abort(void);
#endif
+#if defined(__i386)
+static void ucode_install();
+#endif
+
/* Menu related sub commands */
static subcmd_defn_t menu_subcmds[] = {
"set_option", OPT_OPTIONAL, set_option, 0, /* PUB */
@@ -1052,6 +1060,10 @@ bam_archive(
if (strcmp(subcmd, "update_all") == 0)
bam_update_all = 1;
+#if defined(__i386)
+ ucode_install(bam_root);
+#endif
+
ret = f(bam_root, opt);
bam_update_all = 0;
@@ -4514,3 +4526,49 @@ append_to_flist(filelist_t *flistp, char *s)
flistp->tail->next = lp;
flistp->tail = lp;
}
+
+#if defined(__i386)
+
+UCODE_VENDORS;
+
+/*ARGSUSED*/
+static void
+ucode_install(char *root)
+{
+ int i;
+
+ for (i = 0; ucode_vendors[i].filestr != NULL; i++) {
+ int cmd_len = PATH_MAX + 256;
+ char cmd[PATH_MAX + 256];
+ char file[PATH_MAX];
+ char timestamp[PATH_MAX];
+ struct stat fstatus, tstatus;
+ struct utimbuf u_times;
+
+ (void) snprintf(file, PATH_MAX, "%s/%s/%s-ucode.txt",
+ bam_root, UCODE_INSTALL_PATH, ucode_vendors[i].filestr);
+
+ if (stat(file, &fstatus) != 0 || !(S_ISREG(fstatus.st_mode)))
+ continue;
+
+ (void) snprintf(timestamp, PATH_MAX, "%s.ts", file);
+
+ if (stat(timestamp, &tstatus) == 0 &&
+ fstatus.st_mtime <= tstatus.st_mtime)
+ continue;
+
+ (void) snprintf(cmd, cmd_len, "/usr/sbin/ucodeadm -i -R "
+ "%s/%s/%s %s > /dev/null 2>&1", bam_root,
+ UCODE_INSTALL_PATH, ucode_vendors[i].vendorstr, file);
+ if (system(cmd) != 0)
+ return;
+
+ if (creat(timestamp, S_IRUSR | S_IWUSR) == -1)
+ return;
+
+ u_times.actime = fstatus.st_atime;
+ u_times.modtime = fstatus.st_mtime;
+ (void) utime(timestamp, &u_times);
+ }
+}
+#endif
diff --git a/usr/src/cmd/boot/bootadm/filelist.ramdisk b/usr/src/cmd/boot/bootadm/filelist.ramdisk
index cd80071ab8..58e885f6ca 100644
--- a/usr/src/cmd/boot/bootadm/filelist.ramdisk
+++ b/usr/src/cmd/boot/bootadm/filelist.ramdisk
@@ -14,6 +14,8 @@ etc/cluster/nodeid
kernel
platform/i86pc/biosint
platform/i86pc/kernel
+platform/i86pc/ucode/GenuineIntel
+platform/i86pc/ucode/AuthenticAMD
boot/solaris/bootenv.rc
boot/solaris/devicedb/master
boot/acpi/tables