diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2011-04-26 17:33:18 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2011-04-26 17:33:18 +0000 |
commit | f4d605abf615f5874339c95f0309f824ad07577e (patch) | |
tree | 9b3fd0c482fbd1df2a42dbc67e53560e32e86c71 /sys/arch | |
parent | 2d7740a3b1a96dd7d345686c8e2c1e1277f4f5d1 (diff) |
Make amd64/i386 boot(8) pass the DUID of the selected boot device to the
kernel so that it can use it to identify the root disk. This will be
needed in order to correctly boot from a softraid volume.
ok deraadt@ marco@ krw@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 8 | ||||
-rw-r--r-- | sys/arch/amd64/include/biosvar.h | 7 | ||||
-rw-r--r-- | sys/arch/amd64/stand/boot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/exec_i386.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/i386/bios.c | 9 | ||||
-rw-r--r-- | sys/arch/i386/include/biosvar.h | 7 | ||||
-rw-r--r-- | sys/arch/i386/stand/boot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/exec_i386.c | 6 |
8 files changed, 41 insertions, 10 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 3e4c0ab6a4c..3765a5263d2 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.140 2011/04/18 21:44:55 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.141 2011/04/26 17:33:17 jsing Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -1704,6 +1704,7 @@ getbootinfo(char *bootinfo, int bootinfo_size) { bootarg32_t *q; bios_ddb_t *bios_ddb; + bios_rootduid_t *bios_rootduid; #undef BOOTINFO_DEBUG #ifdef BOOTINFO_DEBUG @@ -1790,6 +1791,11 @@ getbootinfo(char *bootinfo, int bootinfo_size) #endif break; + case BOOTARG_ROOTDUID: + bios_rootduid = (bios_rootduid_t *)q->ba_arg; + bcopy(bios_rootduid, rootduid, sizeof(rootduid)); + break; + default: #ifdef BOOTINFO_DEBUG printf(" unsupported arg (%d) %p", q->ba_type, diff --git a/sys/arch/amd64/include/biosvar.h b/sys/arch/amd64/include/biosvar.h index 583e5544148..9e1895471f0 100644 --- a/sys/arch/amd64/include/biosvar.h +++ b/sys/arch/amd64/include/biosvar.h @@ -1,5 +1,5 @@ /* XXX - DSR */ -/* $OpenBSD: biosvar.h,v 1.13 2011/03/23 16:54:34 pirofti Exp $ */ +/* $OpenBSD: biosvar.h,v 1.14 2011/04/26 17:33:17 jsing Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -208,6 +208,11 @@ typedef struct _bios_ddb { int db_console; } __packed bios_ddb_t; +#define BOOTARG_ROOTDUID 9 +typedef struct _bios_rootduid { + u_char duid[8]; +} __packed bios_rootduid_t; + #if defined(_KERNEL) || defined (_STANDALONE) #ifdef _LOCORE diff --git a/sys/arch/amd64/stand/boot/conf.c b/sys/arch/amd64/stand/boot/conf.c index 5cc5394bc47..4d9d717752b 100644 --- a/sys/arch/amd64/stand/boot/conf.c +++ b/sys/arch/amd64/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.19 2011/03/08 17:24:31 krw Exp $ */ +/* $OpenBSD: conf.c,v 1.20 2011/04/26 17:33:17 jsing Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -42,7 +42,7 @@ #include <biosdev.h> #include <dev/cons.h> -const char version[] = "3.16"; +const char version[] = "3.17"; int debug = 1; diff --git a/sys/arch/amd64/stand/libsa/exec_i386.c b/sys/arch/amd64/stand/libsa/exec_i386.c index c72a0d0a737..e5c09d4c59c 100644 --- a/sys/arch/amd64/stand/libsa/exec_i386.c +++ b/sys/arch/amd64/stand/libsa/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.6 2009/04/30 01:16:56 dlg Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.7 2011/04/26 17:33:17 jsing Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -56,6 +56,7 @@ run_loadfile(u_long *marks, int howto) extern int com_speed; /* from bioscons.c */ bios_ddb_t ddb; extern int db_console; + bios_rootduid_t rootduid; if (sa_cleanup != NULL) (*sa_cleanup)(); @@ -72,6 +73,9 @@ run_loadfile(u_long *marks, int howto) addbootarg(BOOTARG_DDB, sizeof(ddb), &ddb); } + bcopy(bootdev_dip->disklabel.d_uid, &rootduid.duid, sizeof(rootduid)); + addbootarg(BOOTARG_ROOTDUID, sizeof(rootduid), &rootduid); + /* Pass memory map to the kernel */ mem_pass(); diff --git a/sys/arch/i386/i386/bios.c b/sys/arch/i386/i386/bios.c index ff2c92a7291..cc54dfd2fef 100644 --- a/sys/arch/i386/i386/bios.c +++ b/sys/arch/i386/i386/bios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bios.c,v 1.89 2011/04/07 15:30:15 miod Exp $ */ +/* $OpenBSD: bios.c,v 1.90 2011/04/26 17:33:17 jsing Exp $ */ /* * Copyright (c) 1997-2001 Michael Shalayeff @@ -455,6 +455,7 @@ bios_getopt() { bootarg_t *q; bios_ddb_t *bios_ddb; + bios_rootduid_t *bios_rootduid; #ifdef BIOS_DEBUG printf("bootargv:"); @@ -538,6 +539,12 @@ bios_getopt() #ifdef DDB db_console = bios_ddb->db_console; #endif + break; + + case BOOTARG_ROOTDUID: + bios_rootduid = (bios_rootduid_t *)q->ba_arg; + bcopy(bios_rootduid, rootduid, sizeof(rootduid)); + break; default: #ifdef BIOS_DEBUG diff --git a/sys/arch/i386/include/biosvar.h b/sys/arch/i386/include/biosvar.h index 4e8be582aec..b70de861afc 100644 --- a/sys/arch/i386/include/biosvar.h +++ b/sys/arch/i386/include/biosvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biosvar.h,v 1.55 2011/03/23 16:54:35 pirofti Exp $ */ +/* $OpenBSD: biosvar.h,v 1.56 2011/04/26 17:33:17 jsing Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -210,6 +210,11 @@ typedef struct _bios_ddb { int db_console; } __packed bios_ddb_t; +#define BOOTARG_ROOTDUID 9 +typedef struct _bios_rootduid { + u_char duid[8]; +} __packed bios_rootduid_t; + #if defined(_KERNEL) || defined (_STANDALONE) #ifdef _LOCORE diff --git a/sys/arch/i386/stand/boot/conf.c b/sys/arch/i386/stand/boot/conf.c index 8c564ea0213..f1f3be3125f 100644 --- a/sys/arch/i386/stand/boot/conf.c +++ b/sys/arch/i386/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.45 2011/03/08 17:24:31 krw Exp $ */ +/* $OpenBSD: conf.c,v 1.46 2011/04/26 17:33:17 jsing Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -43,7 +43,7 @@ #include <dev/cons.h> #include "debug.h" -const char version[] = "3.16"; +const char version[] = "3.17"; int debug = 1; diff --git a/sys/arch/i386/stand/libsa/exec_i386.c b/sys/arch/i386/stand/libsa/exec_i386.c index bd9821d910f..80af47dfbc1 100644 --- a/sys/arch/i386/stand/libsa/exec_i386.c +++ b/sys/arch/i386/stand/libsa/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.33 2009/04/30 13:47:16 dlg Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.34 2011/04/26 17:33:17 jsing Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -54,6 +54,7 @@ run_loadfile(u_long *marks, int howto) extern int com_speed; /* from bioscons.c */ bios_ddb_t ddb; extern int db_console; + bios_rootduid_t rootduid; if (sa_cleanup != NULL) (*sa_cleanup)(); @@ -70,6 +71,9 @@ run_loadfile(u_long *marks, int howto) addbootarg(BOOTARG_DDB, sizeof(ddb), &ddb); } + bcopy(bootdev_dip->disklabel.d_uid, &rootduid.duid, sizeof(rootduid)); + addbootarg(BOOTARG_ROOTDUID, sizeof(rootduid), &rootduid); + /* Pass memory map to the kernel */ mem_pass(); |