From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UPBOH-0005pu-1r for mharc-grub-devel@gnu.org; Mon, 08 Apr 2013 08:41:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPBO8-0005lI-V3 for grub-devel@gnu.org; Mon, 08 Apr 2013 08:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPBO0-00089E-6D for grub-devel@gnu.org; Mon, 08 Apr 2013 08:41:32 -0400 Received: from mail-ee0-f50.google.com ([74.125.83.50]:57606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPBNz-000892-S1 for grub-devel@gnu.org; Mon, 08 Apr 2013 08:41:24 -0400 Received: by mail-ee0-f50.google.com with SMTP id e53so2361540eek.23 for ; Mon, 08 Apr 2013 05:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:x-enigmail-version:content-type; bh=WDZAeDLEiGDgRtxQYw+Lo7jZNwdB0UAnCCHg5zYsxNk=; b=eZ44T5jXpJ1XH41QownFKFZS7u8+ryZ8GZw4wgf3Aqoyvrw2ujOcxFL1OnKrPpiprI 4X7x0KNX9soknqkiT+W97mGMTama3XNoF5F2AiOvoXo0xpS6A4skwjlYGbdDS0IUa/Kl 12ScYZbQmScCEAncXds91HYo/Dha0Hzd0FtqDOObgrAeTClqkBEXy5I5ntQjZnk7U//z CQuSI1pQWzXj8GNwX5QO6eh5e0wsaNJq68NwhssXq9OkSM9R4lCyeXBGMgkoOB1ol5tO 739cRofwmUalJVyf4xiaJt+iaHtY+32EE+QvDsHTjOQA+Hw+Ufg2OpF4Em+IzxJug0Fs xLVA== X-Received: by 10.14.184.68 with SMTP id r44mr48256033eem.40.1365424883022; Mon, 08 Apr 2013 05:41:23 -0700 (PDT) Received: from debian.x201.phnet (13-234.197-178.cust.bluewin.ch. [178.197.234.13]) by mx.google.com with ESMTPS id n2sm31826384eeo.10.2013.04.08.05.41.20 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Apr 2013 05:41:22 -0700 (PDT) Message-ID: <5162A054.5090502@gmail.com> Date: Mon, 08 Apr 2013 12:47:48 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Leif Lindholm Subject: Re: [PATCH 4/7] Support for ARM/U-Boot platforms References: <5158EDA7.2040906@gmail.com> <20130403163238.GL23069@rocoto.smurfnet.nu> In-Reply-To: <20130403163238.GL23069@rocoto.smurfnet.nu> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigB1FE4A3991931CB76A2A2561" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 74.125.83.50 Cc: The development of GNU GRUB 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: Mon, 08 Apr 2013 12:41:40 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB1FE4A3991931CB76A2A2561 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03.04.2013 18:32, Leif Lindholm wrote: > On Mon, Apr 01, 2013 at 04:15:03AM +0200, Vladimir '??-coder/phcoder' S= erbinenko wrote: >>> +#define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000 >>> +#define GRUB_KERNEL_MACHINE_HEAP_SIZE (grub_size_t) (2 * 1024 * 102= 4) >> >> Why so small heap? > =20 > I copied ieee1275 HEAP_MIN_SIZE to begin with, and it was always enough= =2E > (Since U-Boot doesn't provide any memory mapping service, kernel and > initrd are not going on the heap.) On x86 we reuse heap for kernels as well > I could increase it? >=20 If we want to support any kind of graphics (gfxterm, gfxmenu) on arm as w= ell, we'll need more heap >>> =3D=3D=3D modified file 'util/grub-install.in' >>> --- util/grub-install.in 2013-01-27 15:17:21 +0000 >>> +++ util/grub-install.in 2013-03-24 13:03:31 +0000 >>> @@ -319,6 +319,8 @@ >>> target=3Di386-pc >>> fi >>> ;; >>> + x"arm"*) >>> + target=3D"arm-uboot";; >>> *) >>> gettext "Unable to determine your platform. Use --target." ; >>> echo ;; >>> @@ -338,7 +340,7 @@ >>> if [ x$disk_module =3D xunspecified ]; then >>> disk_module=3Dbiosdisk >>> fi >>> -elif [ "${grub_modinfo_platform}" =3D "ieee1275" ] || [ "${grub_modi= nfo_platform}" =3D "efi" ] || [ "${grub_modinfo_platform}" =3D "arc" ] ; = then >>> +elif [ "${grub_modinfo_platform}" =3D "ieee1275" ] || [ "${grub_modi= nfo_platform}" =3D "efi" ] || [ "${grub_modinfo_platform}" =3D "arc" ] ||= [ "${grub_modinfo_platform}" =3D "uboot" ] ; then >>> disk_module=3D >>> else >>> disk_module=3Dnative >>> @@ -854,6 +856,14 @@ >>> -L "$bootloader_id" -l "\\EFI\\$efi_distributor\\$efi_file" >>> fi >>> fi >>> +elif [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" =3D xa= rm-uboot ]; then >>> + grub_imgname=3D"${grubdir}/${grub_modinfo_target_cpu}-$grub_modi= nfo_platform/core.${imgext}" >>> + raw_imgname=3D"${uboot_imgname}.raw" >> >> Where is uboot_imgname set? >=20 > *cough* that would be a typo then - should be grub_imgname. > =20 >>> + mv "$grub_imgname" "$raw_imgname" >>> + mkimage -T kernel -A ARM -O Linux -a 0x08000000 -e 0x08000000 -C= none -d "$raw_imgname" "$grub_imgname" >> >> Is it from uboot? You need to check for its availability > =20 > Yes. >=20 the header is trivial. I added it to grub-mkimage (patch at the bottom). Trouble is that grub-install now rightfully warns about the lack of platf= orm-specific install. What do we have to do to register the image at u-boot? Put it in specific= location? Also you spoke about relocatable image but AFAICT header always specifies= load address. Do you have a way around it? =3D=3D=3D modified file 'util/grub-install.in' --- util/grub-install.in 2013-04-07 00:41:07 +0000 +++ util/grub-install.in 2013-04-08 10:42:46 +0000 @@ -833,14 +833,6 @@ -L "$bootloader_id" -l "\\EFI\\$efi_distributor\\$efi_file" fi fi -elif [ x"${grub_modinfo_target_cpu}-${grub_modinfo_platform}" =3D xarm-u= boot ]; then - grub_imgname=3D"${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_= platform/core.${imgext}" - raw_imgname=3D"${uboot_imgname}.raw" - mv "$grub_imgname" "$raw_imgname" - mkimage -T kernel -A ARM -O Linux -a 0x08000000 -e 0x08000000 -C non= e -d "$raw_imgname" "$grub_imgname" - if [ $? -eq 0 ]; then - rm -f "$raw_imgname" - fi else gettext "WARNING: no platform-specific install was performed" 1>&2 echo 1>&2 =3D=3D=3D modified file 'util/grub-mkimage.c' --- util/grub-mkimage.c 2013-04-07 00:41:07 +0000 +++ util/grub-mkimage.c 2013-04-08 09:40:18 +0000 @@ -40,6 +40,7 @@ #include #include #include +#include =20 #define _GNU_SOURCE 1 #include @@ -1499,6 +1500,42 @@ core_size =3D rom_size; } break; + + case IMAGE_UBOOT: + { + struct grub_uboot_image_header *hdr; + GRUB_PROPERLY_ALIGNED_ARRAY (crc32_context, GRUB_MD_CRC32->context= size); + + hdr =3D xmalloc (core_size + sizeof (struct grub_uboot_image_heade= r)); + memcpy (hdr + 1, core_img, core_size); + + memset (hdr, 0, sizeof (*hdr)); + hdr->ih_magic =3D grub_cpu_to_be32_compile_time (GRUB_UBOOT_IH_MAG= IC); + hdr->ih_time =3D grub_cpu_to_be32 (time (0)); + hdr->ih_size =3D grub_cpu_to_be32 (core_size); + hdr->ih_load =3D grub_cpu_to_be32 (image_target->link_addr); + hdr->ih_ep =3D grub_cpu_to_be32 (image_target->link_addr); + hdr->ih_os =3D GRUB_UBOOT_IH_OS_LINUX; + hdr->ih_arch =3D GRUB_UBOOT_IH_ARCH_ARM; + hdr->ih_type =3D GRUB_UBOOT_IH_TYPE_KERNEL; + hdr->ih_comp =3D GRUB_UBOOT_IH_COMP_NONE; + + GRUB_MD_CRC32->init(crc32_context); + GRUB_MD_CRC32->write(crc32_context, hdr + 1, core_size); + GRUB_MD_CRC32->final(crc32_context); + hdr->ih_dcrc =3D grub_get_unaligned32 (GRUB_MD_CRC32->read (crc32_= context)); + + GRUB_MD_CRC32->init(crc32_context); + GRUB_MD_CRC32->write(crc32_context, hdr, sizeof (*hdr)); + GRUB_MD_CRC32->final(crc32_context); + hdr->ih_hcrc =3D grub_get_unaligned32 (GRUB_MD_CRC32->read (crc32_= context)); + + free (core_img); + core_img =3D (char *) hdr; + core_size +=3D sizeof (struct grub_uboot_image_header); + } + break; + case IMAGE_MIPS_ARC: { char *ecoff_img; @@ -1725,9 +1762,6 @@ core_size =3D program_size + header_size + footer_size; } break; - case IMAGE_UBOOT: - /* Raw image, header added by grub-install */ - break; } =20 grub_util_write_image (core_img, core_size, out, outname); --------------enigB1FE4A3991931CB76A2A2561 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.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAlFioFQACgkQNak7dOguQgkChgD/amsrUfkIysD8iowNJvN/w1Z/ J6oYvLpR28+ajLFUWngA/1wRJAzVn2PepKt5Sm53KpYtRw+29+G2WGb83RGFqFzC =z+cg -----END PGP SIGNATURE----- --------------enigB1FE4A3991931CB76A2A2561--