From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VtKqF-0001fm-RI for mharc-grub-devel@gnu.org; Wed, 18 Dec 2013 12:23:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtKq9-0001Sv-BK for grub-devel@gnu.org; Wed, 18 Dec 2013 12:23:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtKq3-0000Cl-VD for grub-devel@gnu.org; Wed, 18 Dec 2013 12:23:21 -0500 Received: from mail-ea0-x22b.google.com ([2a00:1450:4013:c01::22b]:58521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtKq3-0000CK-Kw for grub-devel@gnu.org; Wed, 18 Dec 2013 12:23:15 -0500 Received: by mail-ea0-f171.google.com with SMTP id h10so3672687eak.16 for ; Wed, 18 Dec 2013 09:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=qk+tbHDdmzxW35sDVUvsBPONP+ac6NzK6RzVmZDyTbI=; b=N72/EE/oRC4YjWOQD5K/K7Zf1S/rqv2x/SN+Q+BVV1HnO6TdVS3FXZ47x23GSmSj1C I1XTE1q28qAcmOTH/CouqEfFmrkj3CRik846tR+E55A629iIeDzagvqSRvM2kR0owSv7 DFgUiapUowGB51AIsJ1qz/X6j9tuyZhyyn4gs5WWIggxPmJgAa0Y6YpeTQuAKw4Kj/e3 1fKkB//0XCs+ykq3J1DIvZJiaymrmWukyYIdsfRtd0nQLkTjy7ONp4zFiGQVmMTYApX0 Oq1/eXomlyhwgHoX4q8Rq4lkzWYYXSVosPR7lkI6NJIifaCIWVE67rRB81IsF46S8AAA cKog== X-Received: by 10.14.207.194 with SMTP id n42mr30431390eeo.76.1387387394859; Wed, 18 Dec 2013 09:23:14 -0800 (PST) Received: from [192.168.1.16] (85-188.196-178.cust.bluewin.ch. [178.196.188.85]) by mx.google.com with ESMTPSA id 1sm1834517eeg.4.2013.12.18.09.23.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Dec 2013 09:23:07 -0800 (PST) Message-ID: <52B1D9FA.209@gmail.com> Date: Wed, 18 Dec 2013 18:23:06 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH] add arm64 UEFI Linux loader References: <20131216135551.GV22356@rocoto.smurfnet.nu> <20131216201301.24356028@opensuse.site> <20131216162403.GW22356@rocoto.smurfnet.nu> <52AF71FB.1080700@gmail.com> <20131218165439.GD22356@rocoto.smurfnet.nu> In-Reply-To: <20131218165439.GD22356@rocoto.smurfnet.nu> X-Enigmail-Version: 1.6 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="v698slt7v3kW45OCrGHgD7T48BPvRRMQl" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22b X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Dec 2013 17:23:26 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --v698slt7v3kW45OCrGHgD7T48BPvRRMQl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 18.12.2013 17:54, Leif Lindholm wrote: > On Mon, Dec 16, 2013 at 10:34:51PM +0100, Vladimir '=CF=86-coder/phcode= r' Serbinenko wrote: >>> +static void >>> +get_fdt (void) >>> +{ >>> + grub_efi_configuration_table_t *tables; >>> + unsigned int i; >>> + int fdt_loaded; >>> + int size; >>> + >>> + if (!orig_fdt) >>> + { >>> + fdt_loaded =3D 0; >>> + /* Look for FDT in UEFI config tables. */ >>> + tables =3D grub_efi_system_table->configuration_table; >>> + >>> + for (i =3D 0; i < grub_efi_system_table->num_table_entries; i+= +) >>> + if (grub_memcmp (&tables[i].vendor_guid, &fdt_guid, sizeof (fdt_gui= d)) >>> + =3D=3D 0) >>> + { >>> + orig_fdt =3D tables[i].vendor_table; >>> + grub_dprintf ("linux", "found registered FDT @ 0x%p\n", orig_fd= t); >>> + break; >>> + } >>> + } >>> + else >>> + fdt_loaded =3D 1; >>> + >>> + size =3D >>> + orig_fdt ? grub_fdt_get_totalsize (orig_fdt) : GRUB_FDT_EMPTY_TR= EE_SZ; >>> + size +=3D grub_strlen (linux_args) + 0x400; >>> + >>> + grub_dprintf ("linux", "allocating %d bytes for fdt\n", size); >>> + fdt =3D grub_efi_allocate_pages (0, BYTES_TO_PAGES (size)); >>> + if (!fdt) >>> + return; >>> + >>> + if (orig_fdt) >>> + { >>> + grub_memmove (fdt, orig_fdt, size); >>> + grub_fdt_set_totalsize (fdt, size); >>> + if (fdt_loaded) >>> + grub_free (orig_fdt); >> >> There is a problem with this: in case of failure orig_fdt isn't >> available for next try anymore. >=20 > Right. I need to also NULL orig_fdt, will do. >=20 I think that you have to keep orig_fdt as otherwise only first attempt to boot will use FDT supplied by system. Second one won't, likely resulting in another failure >>> + if (!loaded) >>> + { >>> + grub_error (GRUB_ERR_BAD_ARGUMENT, >>> + N_("you need to load the kernel first")); >>> + goto fail; >>> + } >>> + >>> + files =3D grub_zalloc (argc * sizeof (files[0])); >>> + if (!files) >>> + goto fail; >>> + >>> + for (i =3D 0; i < argc; i++) >>> + { >>> + grub_file_filter_disable_compression (); >>> + files[i] =3D grub_file_open (argv[i]); >>> + if (!files[i]) >>> + goto fail; >>> + nfiles++; >>> + size +=3D ALIGN_UP (grub_file_size (files[i]), 4); >>> + } >>> + >> Why don't you use methods from loader/linux.c ? >=20 > Umm, this entire function is quite embarassing - it is left around from= > when I included Matthew Garrett's "linuxefi" code for understanding the= > process better.. > Updated set contains the much simpler one which I meant to include. > ARM* do not even support multiple initrds. They're concatenated in memory if you use common functions and results in valid cpio which will be decompressed/parsed by Linux. >=20 >>> + if (grub_file_read (file, kernel_mem, kernel_size) >>> + !=3D (grub_int64_t) kernel_size) >>> + { >>> + grub_error (GRUB_ERR_FILE_READ_ERROR, N_("Can't read kernel %s= "), >>> + argv[0]); >> Please look at similar place in other architectures. >=20 > i386 looks near-identical, apart from the fact that their bzImage has > a size field which the ARM64 image does not. If you want me to change > something here, I'm afraid you will have to rub my nose in it. >=20 if grub_errno is set you shouldn't override it. And please use the same message verbatim (unexpected end of file): it decreases work for translat= ors > / > Leif >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20 --v698slt7v3kW45OCrGHgD7T48BPvRRMQl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlKx2foACgkQmBXlbbo5nOsMaQEAku+BOZjx4WPL51AkdIrFfFcf uiwAvKT3Q1WPiaBRH/oBAKHZhqxlylizIAZYEP1Ejp3NEGWDg6bRb55TNe72M9MQ =X4Mq -----END PGP SIGNATURE----- --v698slt7v3kW45OCrGHgD7T48BPvRRMQl--