From owner-freebsd-current@FreeBSD.ORG Sun Aug 24 15:23:39 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6AFEF4F5; Sun, 24 Aug 2014 15:23:39 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (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 20A543789; Sun, 24 Aug 2014 15:23:38 +0000 (UTC) Received: from [192.168.2.22] (atc.xcllnt.net [50.0.150.213]) (authenticated bits=0) by mail.xcllnt.net (8.14.9/8.14.9) with ESMTP id s7OFNUx7004207 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 24 Aug 2014 08:23:31 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: multipart/signed; boundary="Apple-Mail=_27D13418-8280-41EF-A4BB-5C390C423C70"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: mkimg used to create gpt image, problem booting From: Marcel Moolenaar In-Reply-To: <53F9AC50.1000000@yandex.ru> Date: Sun, 24 Aug 2014 08:23:29 -0700 Message-Id: <5003BFAC-D472-47CE-803B-F1AF8BF961B0@xcllnt.net> References: <853B0396-2C19-49DF-A8E8-8EB43D107597@xcllnt.net> <7CE168C1-6AF3-4AD2-80DB-192AEC49FD2B@xcllnt.net> <53F9AC50.1000000@yandex.ru> To: "Andrey V. Elsukov" X-Mailer: Apple Mail (2.1878.6) Cc: Craig Rodrigues , freebsd-current Current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Aug 2014 15:23:39 -0000 --Apple-Mail=_27D13418-8280-41EF-A4BB-5C390C423C70 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On Aug 24, 2014, at 2:11 AM, Andrey V. Elsukov = wrote: > On 24.08.2014 06:14, Craig Rodrigues wrote: >> I did some further debugging inside the loader by doing the = following. >> -> I added "CFLAGS +=3D -DPART_DEBUG" to = sys/boot/common/Makefile.inc >> -> I added DEBUG() statements all over sys/boot/common/part.c >>=20 >> I observed that in sys/boot/common/part.c in the ptbl_gptread() = function, >> that in this section: >>=20 >> 305 ent =3D (struct gpt_ent *)tbl; >> 306 size =3D MIN(hdr.hdr_entries * hdr.hdr_entsz, >> 307 MAXTBLSZ * table->sectorsize); >> 308 for (i =3D 0; i < size / hdr.hdr_entsz; i++, ent++) { >> 309 if (uuid_equal(&ent->ent_type, = &gpt_uuid_unused, NULL)) >> 310 continue; >>=20 >> ent->ent_type is all 0's, which matches gpt_uuid_unused, so it bails >> out of the loop and never adds the gpt partitions to the list of = partitions >> that the loader can access. >=20 > Yes, the problem is in the ptable_gptread() function. I'll commit the = fix. >=20 Actually, no. There is *a* problem in that function: The function does not respect hdr.hdr_entsz when it needs the next entry. It simply uses "ent++", which is fixed our definition of struct gpt_ent and may not match the definition of the writer. I don't see how the loader is responsible for *the* problem. All I see in qemu is that the loader, when it reads a sector, isn't getting the actual sector data that's in the image. Just do a ktrace on qemu and you'll see what I mean. YMMV of course, --=20 Marcel Moolenaar marcel@xcllnt.net --Apple-Mail=_27D13418-8280-41EF-A4BB-5C390C423C70 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlP6A3EACgkQpgWlLWHuifYgfwCeIvzM+vFk32RyHMamcWFwZXJ0 qrgAn2pnmotXNp6y41y3lZ/RaJnyLWTt =kYWo -----END PGP SIGNATURE----- --Apple-Mail=_27D13418-8280-41EF-A4BB-5C390C423C70--