From d1c1aa0d559966a6a50fa145f30e8e8ee824f334 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Fri, 10 May 2019 19:38:53 +0000 Subject: Add bsd.upgrade support to sparc64 bootloader. OK kettenis@ deraadt@ --- sys/arch/sparc64/stand/ofwboot/boot.c | 18 +++++++++++++++++- sys/arch/sparc64/stand/ofwboot/vers.c | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/sys/arch/sparc64/stand/ofwboot/boot.c b/sys/arch/sparc64/stand/ofwboot/boot.c index fdf818a0c75..8958ec0b340 100644 --- a/sys/arch/sparc64/stand/ofwboot/boot.c +++ b/sys/arch/sparc64/stand/ofwboot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.30 2018/12/31 11:44:57 claudio Exp $ */ +/* $OpenBSD: boot.c,v 1.31 2019/05/10 19:38:52 claudio Exp $ */ /* $NetBSD: boot.c,v 1.3 2001/05/31 08:55:19 mrg Exp $ */ /* * Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved. @@ -261,6 +261,16 @@ loadfile(int fd, char *args) return (rval); } +static int +upgrade(void) +{ + struct stat sb; + + if (stat("/bsd.upgrade", &sb) < 0) + return 0; + return 1; +} + int loadrandom(char *path, char *buf, size_t buflen) { @@ -414,6 +424,12 @@ main(void) just_bootline[1] = 0; bootlp = just_bootline; } + if (bootlp == kernels && upgrade()) { + just_bootline[0] = "/bsd.upgrade"; + just_bootline[1] = 0; + bootlp = just_bootline; + printf("upgrade detected: switching to %s\n", *bootlp); + } for (;;) { if (bootlp) { cp = *bootlp++; diff --git a/sys/arch/sparc64/stand/ofwboot/vers.c b/sys/arch/sparc64/stand/ofwboot/vers.c index 46d497a5426..5f171c13db2 100644 --- a/sys/arch/sparc64/stand/ofwboot/vers.c +++ b/sys/arch/sparc64/stand/ofwboot/vers.c @@ -1 +1 @@ -const char version[] = "1.12"; +const char version[] = "1.13"; -- cgit v1.2.3