From owner-svn-src-stable-10@FreeBSD.ORG Thu Sep 18 22:27:02 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C6C47770; Thu, 18 Sep 2014 22:27:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 96CB4DD3; Thu, 18 Sep 2014 22:27:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8IMR2AA003623; Thu, 18 Sep 2014 22:27:02 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8IMR212003622; Thu, 18 Sep 2014 22:27:02 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201409182227.s8IMR212003622@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 18 Sep 2014 22:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r271846 - stable/10/usr.bin/mkimg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2014 22:27:02 -0000 Author: marcel Date: Thu Sep 18 22:27:02 2014 New Revision: 271846 URL: http://svnweb.freebsd.org/changeset/base/271846 Log: Be compatible with boot code that starts right after the disk label in the second sector by only clearing the amount of bytes needed for the disklabel in the second sector. Previously we were clearing exactly 1 sector worth of bytes and as such writing over boot code that may have been there. Since we do support more than 8 partitions, make sure to set all fields in d_partitions. For the first 8 partitions this is unneeded, but for partitioons 9 and up this compensates for the fact that we don't clear an entire sector anymore. Obviously, one cannot use more than 8 partitions when using boot code that starts right after the disk label. Relevant GRNs: 107879 - Employ unused bytes after the disklabel in the second sector. 189500 - Revert the part of change 107879 that employs the unused bytes after the disklabel in the 2nd sector for boot code. Obtained from: Juniper Networks, Inc. Approved by: re@ (gjb) Modified: stable/10/usr.bin/mkimg/bsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/mkimg/bsd.c ============================================================================== --- stable/10/usr.bin/mkimg/bsd.c Thu Sep 18 22:22:14 2014 (r271845) +++ stable/10/usr.bin/mkimg/bsd.c Thu Sep 18 22:27:02 2014 (r271846) @@ -76,7 +76,7 @@ bsd_write(lba_t imgsz, void *bootcode) return (ENOMEM); if (bootcode != NULL) { memcpy(buf, bootcode, BBSIZE); - memset(buf + secsz, 0, secsz); + memset(buf + secsz, 0, sizeof(struct disklabel)); } else memset(buf, 0, BBSIZE); @@ -110,7 +110,10 @@ bsd_write(lba_t imgsz, void *bootcode) dp = &d->d_partitions[n]; le32enc(&dp->p_size, part->size); le32enc(&dp->p_offset, part->block); + le32enc(&dp->p_fsize, 0); dp->p_fstype = ALIAS_TYPE2INT(part->type); + dp->p_frag = 0; + le16enc(&dp->p_cpg, 0); } dp = &d->d_partitions[bsdparts];