summaryrefslogtreecommitdiff
path: root/sys/arch/powerpc64/stand
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/powerpc64/stand')
-rw-r--r--sys/arch/powerpc64/stand/rdboot/cmd.h4
-rw-r--r--sys/arch/powerpc64/stand/rdboot/rdboot.c35
2 files changed, 10 insertions, 29 deletions
diff --git a/sys/arch/powerpc64/stand/rdboot/cmd.h b/sys/arch/powerpc64/stand/rdboot/cmd.h
index 1bbe0af07c9..ffd9e52ebe2 100644
--- a/sys/arch/powerpc64/stand/rdboot/cmd.h
+++ b/sys/arch/powerpc64/stand/rdboot/cmd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.h,v 1.1 2020/07/16 19:48:58 kettenis Exp $ */
+/* $OpenBSD: cmd.h,v 1.2 2020/07/18 10:23:44 kettenis Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -43,7 +43,7 @@ struct cmd_table {
struct cmd_state {
char bootdev[BOOTDEVLEN]; /* device */
char image[MAXPATHLEN - 16]; /* image */
- unsigned char bootduid[8]; /* duid of root disk */
+ u_char bootduid[8]; /* duid of root disk */
int boothowto; /* howto */
int hasduid;
char *conf; /* /etc/boot.conf normally */
diff --git a/sys/arch/powerpc64/stand/rdboot/rdboot.c b/sys/arch/powerpc64/stand/rdboot/rdboot.c
index 704e8945181..2e942b94efe 100644
--- a/sys/arch/powerpc64/stand/rdboot/rdboot.c
+++ b/sys/arch/powerpc64/stand/rdboot/rdboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rdboot.c,v 1.1 2020/07/16 19:48:58 kettenis Exp $ */
+/* $OpenBSD: rdboot.c,v 1.2 2020/07/18 10:23:44 kettenis Exp $ */
/*
* Copyright (c) 2019-2020 Visa Hankala
@@ -56,7 +56,7 @@ const char version[] = "0.1";
int
main(void)
{
- char bootduid[8];
+ u_char bootduid[8];
int fd, hasboot;
fd = open(_PATH_CONSOLE, O_RDWR);
@@ -77,16 +77,12 @@ main(void)
strlcpy(cmd.image, KERNEL, sizeof(cmd.image));
cmd.timeout = 5;
-#if 0
if (ioctl(kexecfd, KIOC_GETBOOTDUID, bootduid) == -1) {
- if (errno != ENOENT)
- fprintf(stderr, "cannot get bootduid from kernel: %s\n",
- strerror(errno));
+ fprintf(stderr, "cannot get bootduid from kernel: %s\n",
+ strerror(errno));
} else {
- snprintf(cmd.bootdev, sizeof(cmd.bootdev), "%s%sa",
- rootdev, isduid(rootdev, OPENDEV_PART) ? "." : "");
+ memcpy(cmd.bootduid, bootduid, sizeof(cmd.bootduid));
}
-#endif
disk_init();
@@ -169,13 +165,11 @@ kexec(void)
{
struct kexec_args kargs;
struct stat sb;
- char boothowtostr[32];
- char rootdev[32];
char *kimg = NULL;
const char *path;
ssize_t n;
off_t pos;
- int argc, fd = -1, ret;
+ int fd = -1, ret;
path = disk_open(cmd.path);
if (path == NULL)
@@ -209,21 +203,8 @@ kexec(void)
memset(&kargs, 0, sizeof(kargs));
kargs.kimg = kimg;
kargs.klen = sb.st_size;
- argc = 0;
- if (cmd.boothowto != 0) {
- snprintf(boothowtostr, sizeof(boothowtostr), "boothowto=%d",
- cmd.boothowto);
- kargs.argv[argc++] = boothowtostr;
- }
- if (cmd.hasduid) {
- snprintf(rootdev, sizeof(rootdev),
- "rootdev=%02x%02x%02x%02x%02x%02x%02x%02x",
- cmd.bootduid[0], cmd.bootduid[1],
- cmd.bootduid[2], cmd.bootduid[3],
- cmd.bootduid[4], cmd.bootduid[5],
- cmd.bootduid[6], cmd.bootduid[7]);
- kargs.argv[argc++] = rootdev;
- }
+ kargs.boothowto = cmd.boothowto;
+ memcpy(kargs.bootduid, cmd.bootduid, sizeof(kargs.bootduid));
printf("booting %s\n", cmd.path);
ret = ioctl(kexecfd, KIOC_KEXEC, &kargs);