]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
merge mainline into arm
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 11 May 2013 08:24:24 +0000 (10:24 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 11 May 2013 08:24:24 +0000 (10:24 +0200)
17 files changed:
1  2 
.bzrignore
Makefile.util.def
autogen.sh
conf/Makefile.common
configure.ac
docs/grub.texi
gentpl.py
grub-core/Makefile.am
grub-core/Makefile.core.def
grub-core/fs/hfspluscomp.c
grub-core/term/terminfo.c
grub-core/tests/setjmp_test.c
include/grub/disk.h
include/grub/offsets.h
util/grub-install.in
util/grub-mkimage.c
util/grub-mkimagexx.c

diff --cc .bzrignore
index a0cd25dd4fa1eda888a094e478e15216abaaa5b6,e33c74de4a0e4994a26bc141b7ec0e67a26f3cf0..fc20bc6983e563f6ed4760aec6e6486f9ea11baa
@@@ -174,5 -174,5 +174,7 @@@ po/*.gm
  po/LINGUAS
  include/grub/gcrypt/gcrypt.h
  include/grub/gcrypt/g10lib.h
 +grub-core/lib/dtc-grub
 +grub-core/Makefile.libfdt.def
+ po/POTFILES.in
+ po/POTFILES-shell.in
Simple merge
diff --cc autogen.sh
Simple merge
Simple merge
diff --cc configure.ac
Simple merge
diff --cc docs/grub.texi
Simple merge
diff --cc gentpl.py
index 93089bfd96db9eb0ec1707274a238c444e216142,8674622f1ae9e7b83ac0308f8fd035b977595d9e..86eca37c98dcaf391a7783053532ad6b9fb73c8b
+++ b/gentpl.py
@@@ -59,7 -57,7 +59,7 @@@ GROUPS["videomodules"]   = GRUB_PLATFOR
  for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
  
  # Similar for terminfo
- GROUPS["terminfoinkernel"] = ["mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"] + GROUPS["uboot"];
 -GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"];
++GROUPS["terminfoinkernel"] = [ "emu", "mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"] + GROUPS["uboot"];
  GROUPS["terminfomodule"]   = GRUB_PLATFORMS[:];
  for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
  
Simple merge
index 607d2179584f94e570efa7abd2f3d8c4ef5f4ad3,602b49765cf3c6aba2515c53e981e3e3622d8514..a7a0b9f36b5dfeb3090d89e04e835cfa8a9155b2
@@@ -208,13 -209,9 +225,13 @@@ kernel = 
    sparc64_ieee1275 = kern/sparc64/dl.c;
    sparc64_ieee1275 = kern/sparc64/ieee1275/ieee1275.c;
  
 +  arm = kern/arm/dl.c;
 +  arm = kern/arm/cache.S;
 +  arm = kern/arm/misc.S;
 +
    emu = disk/host.c;
    emu = gnulib/progname.c;
-   emu = gnulib/error.c;
+   emu = kern/emu/error.c;
    emu = kern/emu/cache_s.S;
    emu = kern/emu/hostdisk.c;
    emu = kern/emu/hostfs.c;
index 0000000000000000000000000000000000000000,b3434418c4182a1448ce5826d1f12e8970f412c8..13e4671e67f8f6cd4d599de431fc574d343bf124
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,302 +1,302 @@@
 -};
+ /*
+  *  GRUB  --  GRand Unified Bootloader
+  *  Copyright (C) 2012  Free Software Foundation, Inc.
+  *
+  *  GRUB is free software: you can redistribute it and/or modify
+  *  it under the terms of the GNU General Public License as published by
+  *  the Free Software Foundation, either version 3 of the License, or
+  *  (at your option) any later version.
+  *
+  *  GRUB is distributed in the hope that it will be useful,
+  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  *  GNU General Public License for more details.
+  *
+  *  You should have received a copy of the GNU General Public License
+  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+  */
+ /* HFS+ is documented at http://developer.apple.com/technotes/tn/tn1150.html */
+ #include <grub/hfsplus.h>
+ #include <grub/dl.h>
+ #include <grub/misc.h>
+ #include <grub/mm.h>
+ #include <grub/deflate.h>
+ GRUB_MOD_LICENSE ("GPLv3+");
+ /* big-endian.  */
+ struct grub_hfsplus_compress_header1
+ {
+   grub_uint32_t header_size;
+   grub_uint32_t end_descriptor_offset;
+   grub_uint32_t total_compressed_size_including_seek_blocks_and_header2;
+   grub_uint32_t value_0x32;
+   grub_uint8_t unused[0xf0];
+ } __attribute__ ((packed));
+ /* big-endian.  */
+ struct grub_hfsplus_compress_header2
+ {
+   grub_uint32_t total_compressed_size_including_seek_blocks;
+ } __attribute__ ((packed));
+ /* little-endian.  */
+ struct grub_hfsplus_compress_header3
+ {
+   grub_uint32_t num_chunks;
+ } __attribute__ ((packed));
+ /* little-endian.  */
+ struct grub_hfsplus_compress_block_descriptor
+ {
+   grub_uint32_t offset;
+   grub_uint32_t size;
+ };
+ struct grub_hfsplus_compress_end_descriptor
+ {
+   grub_uint8_t always_the_same[50];
+ } __attribute__ ((packed));
+ struct grub_hfsplus_attr_header
+ {
+   grub_uint8_t unused[3];
+   grub_uint8_t type;
+   grub_uint32_t unknown[1];
+   grub_uint64_t size;
+ } __attribute__ ((packed));
+ struct grub_hfsplus_compress_attr
+ {
+   grub_uint32_t magic;
+   grub_uint32_t type;
+   grub_uint32_t uncompressed_inline_size;
+   grub_uint32_t always_0;
++} __attribute__ ((packed));
+ enum
+   {
+     HFSPLUS_COMPRESSION_INLINE = 3,
+     HFSPLUS_COMPRESSION_RESOURCE = 4
+   };
+ static int
+ grub_hfsplus_cmp_attrkey (struct grub_hfsplus_key *keya,
+                         struct grub_hfsplus_key_internal *keyb)
+ {
+   struct grub_hfsplus_attrkey *attrkey_a = &keya->attrkey;
+   struct grub_hfsplus_attrkey_internal *attrkey_b = &keyb->attrkey;
+   grub_uint32_t aparent = grub_be_to_cpu32 (attrkey_a->cnid);
+   grub_size_t len;
+   int diff;
+   if (aparent > attrkey_b->cnid)
+     return 1;
+   if (aparent < attrkey_b->cnid)
+     return -1;
+   len = grub_be_to_cpu16 (attrkey_a->namelen);
+   if (len > attrkey_b->namelen)
+     len = attrkey_b->namelen;
+   /* Since it's big-endian memcmp gives the same result as manually comparing
+      uint16_t but may be faster.  */
+   diff = grub_memcmp (attrkey_a->name, attrkey_b->name,
+                     len * sizeof (attrkey_a->name[0]));
+   if (diff == 0)
+     diff = grub_be_to_cpu16 (attrkey_a->namelen) - attrkey_b->namelen;
+   return diff;
+ }
+ #define HFSPLUS_COMPRESS_BLOCK_SIZE 65536
+ static grub_ssize_t
+ hfsplus_read_compressed_real (struct grub_hfsplus_file *node,
+                             grub_off_t pos, grub_size_t len, char *buf)
+ {
+   char *tmp_buf = 0;
+   grub_size_t len0 = len;
+   if (node->compressed == 1)
+     {
+       grub_memcpy (buf, node->cbuf + pos, len);
+       return len;
+     }
+   while (len)
+     {
+       grub_uint32_t block = pos / HFSPLUS_COMPRESS_BLOCK_SIZE;
+       grub_size_t curlen = HFSPLUS_COMPRESS_BLOCK_SIZE
+       - (pos % HFSPLUS_COMPRESS_BLOCK_SIZE);
+       if (curlen > len)
+       curlen = len;
+       if (node->cbuf_block != block)
+       {
+         grub_uint32_t sz = grub_le_to_cpu32 (node->compress_index[block].size);
+         grub_size_t ts;
+         if (!tmp_buf)
+           tmp_buf = grub_malloc (HFSPLUS_COMPRESS_BLOCK_SIZE);
+         if (!tmp_buf)
+           return -1;
+         if (grub_hfsplus_read_file (node, 0, 0,
+                                     grub_le_to_cpu32 (node->compress_index[block].start) + 0x104,
+                                     sz, tmp_buf)
+             != (grub_ssize_t) sz)
+           {
+             grub_free (tmp_buf);
+             return -1;
+           }
+         ts = HFSPLUS_COMPRESS_BLOCK_SIZE;
+         if (ts > node->size - (pos & ~(HFSPLUS_COMPRESS_BLOCK_SIZE)))
+           ts = node->size - (pos & ~(HFSPLUS_COMPRESS_BLOCK_SIZE));
+         if (grub_zlib_decompress (tmp_buf, sz, 0,
+                                   node->cbuf, ts) < 0)
+           {
+             grub_free (tmp_buf);
+             return -1;
+           }
+         node->cbuf_block = block;
+       }
+       grub_memcpy (buf, node->cbuf + (pos % HFSPLUS_COMPRESS_BLOCK_SIZE),
+                  curlen);
+       buf += curlen;
+       pos += curlen;
+       len -= curlen;
+     }
+   grub_free (tmp_buf);
+   return len0;
+ }
+ static grub_err_t 
+ hfsplus_open_compressed_real (struct grub_hfsplus_file *node)
+ {
+   grub_err_t err;
+   struct grub_hfsplus_btnode *attr_node;
+   grub_off_t attr_off;
+   struct grub_hfsplus_key_internal key;
+   struct grub_hfsplus_attr_header *attr_head;
+   struct grub_hfsplus_compress_attr *cmp_head;
+ #define c grub_cpu_to_be16_compile_time
+   const grub_uint16_t compress_attr_name[] =
+     {
+       c('c'), c('o'), c('m'), c('.'), c('a'), c('p'), c('p'), c('l'), c('e'),
+       c('.'), c('d'), c('e'), c('c'), c('m'), c('p'), c('f'), c('s') };
+ #undef c
+   if (node->size)
+     return 0;
+   key.attrkey.cnid = node->fileid;
+   key.attrkey.namelen = sizeof (compress_attr_name) / sizeof (compress_attr_name[0]);
+   key.attrkey.name = compress_attr_name;
+   err = grub_hfsplus_btree_search (&node->data->attr_tree, &key,
+                                  grub_hfsplus_cmp_attrkey,
+                                  &attr_node, &attr_off);
+   if (err || !attr_node)
+     {
+       grub_errno = 0;
+       return 0;
+     }
+   attr_head = (struct grub_hfsplus_attr_header *)
+     ((char *) grub_hfsplus_btree_recptr (&node->data->attr_tree,
+                                        attr_node, attr_off)
+      + sizeof (struct grub_hfsplus_attrkey) + sizeof (compress_attr_name));
+   if (attr_head->type != 0x10
+       || !(attr_head->size & grub_cpu_to_be64_compile_time(~0xfULL)))
+     {
+       grub_free (attr_node);
+       return 0;
+     }
+   cmp_head = (struct grub_hfsplus_compress_attr *) (attr_head + 1);
+   if (cmp_head->magic != grub_cpu_to_be32_compile_time (0x66706d63))
+     {
+       grub_free (attr_node);
+       return 0;
+     }
+   node->size = grub_le_to_cpu32 (cmp_head->uncompressed_inline_size);
+   if (cmp_head->type == grub_cpu_to_le32_compile_time (HFSPLUS_COMPRESSION_RESOURCE))
+     {
+       grub_uint32_t index_size;
+       node->compressed = 2;
+       if (grub_hfsplus_read_file (node, 0, 0,
+                                 0x104, sizeof (index_size),
+                                 (char *) &index_size)
+         != 4)
+       {
+         node->compressed = 0;
+         grub_free (attr_node);
+         grub_errno = 0;
+         return 0;
+       }
+       node->compress_index_size = grub_le_to_cpu32 (index_size);
+       node->compress_index = grub_malloc (node->compress_index_size
+                                         * sizeof (node->compress_index[0]));
+       if (!node->compress_index)
+       {
+         node->compressed = 0;
+         grub_free (attr_node);
+         return grub_errno;
+       }
+       if (grub_hfsplus_read_file (node, 0, 0,
+                                 0x104 + sizeof (index_size),
+                                 node->compress_index_size
+                                 * sizeof (node->compress_index[0]),
+                                 (char *) node->compress_index)
+         != (grub_ssize_t) (node->compress_index_size
+                            * sizeof (node->compress_index[0])))
+       {
+         node->compressed = 0;
+         grub_free (attr_node);
+         grub_free (node->compress_index);
+         grub_errno = 0;
+         return 0;
+       }
+       node->cbuf_block = -1;
+       node->cbuf = grub_malloc (HFSPLUS_COMPRESS_BLOCK_SIZE);
+       grub_free (attr_node);
+       if (!node->cbuf)
+       {
+         node->compressed = 0;
+         grub_free (node->compress_index);
+         return grub_errno;
+       }
+       return 0;
+     }
+   if (cmp_head->type != HFSPLUS_COMPRESSION_INLINE)
+     {
+       grub_free (attr_node);
+       return 0;
+     }
+   node->cbuf = grub_malloc (node->size);
+   if (!node->cbuf)
+     return grub_errno;
+   if (grub_zlib_decompress ((char *) (cmp_head + 1),
+                           grub_cpu_to_be64 (attr_head->size)
+                           - sizeof (*cmp_head), 0,
+                           node->cbuf, node->size) < 0)
+     return grub_errno;
+   node->compressed = 1;
+   return 0;
+ }
+ GRUB_MOD_INIT(hfspluscomp)
+ {
+   grub_hfsplus_open_compressed = hfsplus_open_compressed_real;  
+   grub_hfsplus_read_compressed = hfsplus_read_compressed_real;  
+ }
+ GRUB_MOD_FINI(hfspluscomp)
+ {
+   grub_hfsplus_open_compressed = 0;
+   grub_hfsplus_read_compressed = 0;
+ }
Simple merge
index 0000000000000000000000000000000000000000,29aab25351f95c63d165d1e1adfba11a1c3ef31f..4d315115c45c87389a5f521a18e577e3dae2eaf2
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,74 +1,76 @@@
+ /*
+  *  GRUB  --  GRand Unified Bootloader
+  *  Copyright (C) 2013 Free Software Foundation, Inc.
+  *
+  *  GRUB is free software: you can redistribute it and/or modify
+  *  it under the terms of the GNU General Public License as published by
+  *  the Free Software Foundation, either version 3 of the License, or
+  *  (at your option) any later version.
+  *
+  *  GRUB is distributed in the hope that it will be useful,
+  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  *  GNU General Public License for more details.
+  *
+  *  You should have received a copy of the GNU General Public License
+  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+  */
+ #include <grub/test.h>
+ #include <grub/dl.h>
+ #include <grub/setjmp.h>
+ GRUB_MOD_LICENSE ("GPLv3+");
+ static grub_jmp_buf jmp_point;
+ static int expected, ctr;
++#pragma GCC diagnostic ignored "-Wmissing-noreturn"
++
+ static void
+ jmp0 (void)
+ {
+   grub_longjmp (jmp_point, 0);
+ }
+ static void
+ jmp1 (void)
+ {
+   grub_longjmp (jmp_point, 1);
+ }
+ static void
+ jmp2 (void)
+ {
+   grub_longjmp (jmp_point, 2);
+ }
+ static void
+ setjmp_test (void)
+ {
+   int val;
+   expected = 0;
+   val = grub_setjmp (jmp_point);
+   grub_test_assert (val == expected, "setjmp returned %d instead of %d",
+                   val, expected);
+   switch (ctr++)
+     {
+     case 0:
+       expected = 1;
+       jmp0 ();
+     case 1:
+       expected = 1;
+       jmp1 ();
+     case 2:
+       expected = 2;
+       jmp2 ();
+     case 3:
+       return;
+     }
+   grub_test_assert (0, "setjmp didn't return enough times");
+ }
+ /* Register example_test method as a functional test.  */
+ GRUB_FUNCTIONAL_TEST (setjmp_test, setjmp_test);
Simple merge
Simple merge
Simple merge
index 91386100849b2debe27bcc6739074b2c9bccd4a8,7edf77a3ffd61e5cfbdbea5574a90071d4022be5..00abb7378a37465f65e2f0345f24104871a3b851
@@@ -40,8 -40,7 +40,9 @@@
  #include <stdlib.h>
  #include <assert.h>
  #include <grub/efi/pe32.h>
 +#include <grub/uboot/image.h>
 +#include <grub/arm/reloc.h>
+ #include <grub/ia64/reloc.h>
  
  #define _GNU_SOURCE   1
  #include <argp.h>
@@@ -68,10 -67,11 +69,11 @@@ struct image_target_des
    int bigendian;
    enum {
      IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT,
-     IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_I386_IEEE1275,
+     IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_SPARC64_CDCORE,
+     IMAGE_I386_IEEE1275,
      IMAGE_LOONGSON_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
      IMAGE_FULOONG2F_FLASH, IMAGE_I386_PC_PXE, IMAGE_MIPS_ARC,
 -    IMAGE_QEMU_MIPS_FLASH
 +    IMAGE_QEMU_MIPS_FLASH, IMAGE_UBOOT
    } id;
    enum
      {
@@@ -1062,9 -1054,9 +1096,10 @@@ generate_image (const char *dir, const 
        break;
      case IMAGE_SPARC64_AOUT:
      case IMAGE_SPARC64_RAW:
+     case IMAGE_SPARC64_CDCORE:
      case IMAGE_I386_IEEE1275:
      case IMAGE_PPC:
 +    case IMAGE_UBOOT:
        break;
      }
  
Simple merge