--- sbin/bsdlabel/bsdlabel.c
+++ sbin/bsdlabel/bsdlabel.c
@@ -64,6 +64,7 @@
 #define DKTYPENAMES
 #define FSTYPENAMES
 #include <sys/disklabel.h>
+#include <sys/diskmbr.h>
 
 #include <unistd.h>
 #include <string.h>
@@ -375,6 +376,8 @@
 	struct gctl_req *grq;
 	char const *errstr;
 	struct disklabel *lp = &lab;
+	char *tmpbuf;
+	int found;
 
 	if (disable_write) {
 		warnx("write to disk label supressed - label was as follows:");
@@ -386,8 +389,21 @@
 	lp->d_magic2 = DISKMAGIC;
 	lp->d_checksum = 0;
 	lp->d_checksum = dkcksum(lp);
-	if (installboot)
+	if (installboot) {
+		if ((tmpbuf = (char *)malloc((int)lp->d_secsize)) == 0)
+                	err(4, "%s", xxboot);
+		memcpy((void *)tmpbuf, (void *)bootarea, (int)lp->d_secsize);
 		readboot();
+		for (i = DOSPARTOFF, found = 0;
+		     !found && i < DOSPARTOFF + NDOSPART * DOSPARTSIZE;
+		     i++)
+			found = tmpbuf[i] != 0;
+		if (found)
+			memcpy((void *)&bootarea[DOSPARTOFF],
+				(void *)&tmpbuf[DOSPARTOFF],
+				NDOSPART * DOSPARTSIZE);
+		free(tmpbuf);
+	}
 	for (i = 0; i < lab.d_npartitions; i++)
 		if (lab.d_partitions[i].p_size)
 			lab.d_partitions[i].p_offset += mbroffset;

