diff --git a/usr.sbin/mkuboot/mkuboot.8 b/usr.sbin/mkuboot/mkuboot.8 index 3bfa6705be9..2a955d9d0ef 100644 --- a/usr.sbin/mkuboot/mkuboot.8 +++ b/usr.sbin/mkuboot/mkuboot.8 @@ -27,6 +27,7 @@ .Op Fl l Ar loadaddr .Op Fl n Ar name .Op Fl o Ar os +.Op Fl r .Op Fl t Ar type .Ar infile outfile .Sh DESCRIPTION @@ -56,6 +57,8 @@ can be either .Dq Linux or .Dq OpenBSD . +.It Fl r +Produce a raw binary instead of a U-Boot image. .It Fl t Ar type Sets the type of the object to be loaded. For a list of valid arguments, see below. diff --git a/usr.sbin/mkuboot/mkuboot.c b/usr.sbin/mkuboot/mkuboot.c index e339f26b0b4..62ea978532a 100644 --- a/usr.sbin/mkuboot/mkuboot.c +++ b/usr.sbin/mkuboot/mkuboot.c @@ -144,17 +144,20 @@ main(int argc, char *argv[]) const char *os = "OpenBSD"; const char *type = "kernel"; const char *imgname = "boot"; - int ifd, ofd; + int ifd, ofd, raw = 0; uint32_t fsize; u_long crc; int c, ep, load; ep = load = 0; - while ((c = getopt(argc, argv, "a:e:l:n:o:t:")) != -1) { + while ((c = getopt(argc, argv, "a:e:l:n:o:rt:")) != -1) { switch (c) { case 'a': arch = optarg; break; + case 'r': + raw = 1; + break; case 'e': sscanf(optarg, "0x%x", &ep); break; @@ -233,7 +236,7 @@ main(int argc, char *argv[]) } /* Write initial header. */ - if (write(ofd, &ih, sizeof ih) != sizeof ih) + if (!raw && write(ofd, &ih, sizeof ih) != sizeof ih) err(1, "%s", oname); /* Write data, calculating the data CRC as we go. */ @@ -270,7 +273,7 @@ main(int argc, char *argv[]) /* Write finalized header. */ if (lseek(ofd, 0, SEEK_SET) != 0) err(1, "%s", oname); - if (write(ofd, &ih, sizeof ih) != sizeof ih) + if (!raw && write(ofd, &ih, sizeof ih) != sizeof ih) err(1, "%s", oname); return(0);