Fix checksum calculation:
1.  Iterate over all partitions counted in the label, which can be more
   than the number of partitions given to mkimg(1).
2.  Start the checksum from the beginning of the label; not the beginning
   of the bootarea.

Tested with bsdlabel(8).

Approved by:	re@ (rodrigc)
MFC r271577:

Fix descriptors leak.

PR:		bin/191002
Reported by:	Ryan Steinmetz
Submitted by:	mjg
Approved by:	re (gjb)
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)
Update stable/10 to -BETA2 as part of the 10.1-RELEASE
cycle.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
Merge remote-tracking branch 'freebsd/stable/10' into hardened/10/aslr