Skip to contentSkip to conversation

GRUB port for ARMv7-A U-Boot

RFC Superseded Leif Lindholm 1 participant 1 message Oct 22, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC 1/1 GRUB port for ARMv7-A U-Boot

Attached is a stripped-down version of what I have today uploaded to launchpad. The full set can be accessed through bzr branch lp:~leif-lindholm/linaro-grub/arm-uboot

Missing from this patch is libfdt and the crc32-functions I mentioned
in my previous email, although they have not been stripped from the build configuration files.

This is a port of GRUB to the ARM architecture, running on top of the U-Boot firmware. The "U-Boot API", created by Rafal Jaworowsky <[email protected]>, for the FreeBSD Loader provides the hardware interface layer. Console supported on serial port using the termios subsystem. Block device support verified with SDcard and SATA.

Usage information:
- grub-mkimage generates a kernel with a U-Boot header masquerading it as a Linux kernel.
- U-Boot Environment variable grub_bootdev can be used to specify the root device.
- Block devices must be initialized by U-Boot before calling GRUB if they are to be accessible. (By calling "mmc rescan", "ide reset" or similar.)
- New "devicetree" command for loading a .dtb from a filesystem.

This has been verified on the following platforms:
- ARM Versatile Express (4xCortex-A9)
- Marvell Armada XP DB-78460-BP.
- Trim Slice

Imported code:
- The "U-Boot API".
- aeabi_* libgcc helper functions from linux/arch/arm/lib.

Limitations:
- Dynamic linker implemented only for ARMv7-A Thumb instruction set.
- Currently runs uncached, with MMU off.
- No support for ATAG parsing or rewriting, only supports device tree as a means of passing information to the Linux kernel. (If an ATAG list is passed from U-Boot, it can be passed on unmodified, but the "linux" command will not pass on command line parameters.)
- Currently a statically linked kernel, requires RAM at 0x08000000.

TODO:
- linux.init.arm, linux-initramfs.arm, bootcheck-linux-arm, grub-mkrescue

Potential future developments:
- Implement networking support.
- Make grub kernel a fully relocateable ELF.
- Implement chainloader.
- Enable caches/MMU.

Comments welcome.

=== modified file 'Makefile.util.def'

Makefile.util.def +1 -0
@@ -469,6 +469,7 @@
   enable = mips_loongson;
   enable = ia64_efi;
   enable = powerpc_ieee1275;
+  enable = arm_uboot;
 };
 
 script = {

=== modified file 'conf/Makefile.common'

Makefile.common +14 -0
@@ -37,6 +37,12 @@
   CFLAGS_PLATFORM += -mno-app-regs
   LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
 endif
+if COND_arm
+# Image entry point always in ARM (A32) state - ensure proper functionality if
+# the rest is built for the Thumb (T32) state.
+  CFLAGS_PLATFORM += -mthumb-interwork -mno-unaligned-access
+  CCASFLAGS_PLATFORM = -Wa,-mimplicit-it=thumb
+endif
 
 # Other options
 
@@ -58,6 +64,7 @@
 if ! COND_i386_multiboot
 if ! COND_i386_ieee1275
 if ! COND_x86_64_efi
+if ! COND_arm
 LDADD_KERNEL += -lgcc
 endif
 endif
@@ -66,9 +73,14 @@
 endif
 endif
 endif
+endif
 
 CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
+if ! COND_arm
 LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -static-libgcc
+else
+LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
+endif
 CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
 CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
 if COND_CYGWIN
@@ -108,6 +120,8 @@
 CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition -Wno-unsafe-loop-optimizations
 CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
 
+CPPFLAGS_LIBFDT = -I$(top_srcdir)/grub-core/lib/libfdt
+
 CFLAGS_POSIX = -fno-builtin
 CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
 

=== modified file 'configure.ac'

configure.ac +14 -1
@@ -79,6 +79,9 @@
                 target_cpu=mips;
 		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
 		;;
+  arm*)
+		target_cpu=arm;
+		;;
 esac
 
 # Specify the platform (such as firmware).
@@ -99,6 +102,7 @@
     mipsel-*) platform=loongson ;;
     mips-*) platform=arc ;;
     ia64-*) platform=efi ;;
+    arm-*) platform=uboot ;;
     *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
   esac
 else
@@ -133,6 +137,7 @@
   mipsel-yeeloong) platform=loongson ;;
   mipsel-fuloong) platform=loongson ;;
   mipsel-loongson) ;;
+  arm-uboot) platform=uboot ;;
   *-emu) ;;
   *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
 esac
@@ -164,6 +169,7 @@
   multiboot)	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
   efi)		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
   ieee1275)	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
+  uboot)	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
   qemu)		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
   pc)		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
   emu)		machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
@@ -172,6 +178,7 @@
   arc)	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
 esac
 case "$target_cpu" in
+  arm)      	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;;
   mips |mipsel)      	machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
   sparc64)      machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
 esac
@@ -669,7 +676,8 @@
 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
 fi
 CPPFLAGS="$TARGET_CPPFLAGS"
-if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
+
+if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test x$target_cpu = xarm ; then
 LIBS=
 else
 LIBS=-lgcc
@@ -1116,6 +1124,8 @@
 AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
 AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
 AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
+AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
+AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
 
 AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
 AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
@@ -1146,6 +1156,9 @@
 if test x${cpudir} = xmipsel; then
   cpudir=mips;
 fi
+if test x${cpudir} = xarmel; then
+  cpudir=arm;
+fi
 grub_CHECK_LINK_DIR
 if test x"$link_dir" = xyes ; then
   AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])

=== modified file 'gentpl.py'

gentpl.py +7 -2
@@ -23,7 +23,7 @@
                    "i386_multiboot", "i386_ieee1275", "x86_64_efi",
                    "mips_loongson", "sparc64_ieee1275",
                    "powerpc_ieee1275", "mips_arc", "ia64_efi",
-                   "mips_qemu_mips" ]
+                   "mips_qemu_mips", "arm_uboot" ]
 
 GROUPS = {}
 
@@ -36,10 +36,12 @@
 GROUPS["mips"]     = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ]
 GROUPS["sparc64"]  = [ "sparc64_ieee1275" ]
 GROUPS["powerpc"]  = [ "powerpc_ieee1275" ]
+GROUPS["arm"]      = [ "arm_uboot" ]
 
 # Groups based on firmware
 GROUPS["efi"]  = [ "i386_efi", "x86_64_efi", "ia64_efi" ]
 GROUPS["ieee1275"]   = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
+GROUPS["uboot"] = [ "arm_uboot" ]
 
 # emu is a special case so many core functionality isn't needed on this platform
 GROUPS["noemu"]   = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
@@ -57,10 +59,13 @@
 for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
 
 # Similar for terminfo
-GROUPS["terminfoinkernel"] = ["mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"];
+GROUPS["terminfoinkernel"] = ["mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"] + GROUPS["uboot"];
 GROUPS["terminfomodule"]   = GRUB_PLATFORMS[:];
 for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
 
+# Flattened Device Trees (FDT)
+GROUPS["fdt"] = [ "arm_uboot" ]
+
 # Miscelaneous groups schedulded to disappear in future
 GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
 GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc")

=== modified file 'grub-core/Makefile.am'

Makefile.am +5 -0
@@ -143,6 +143,11 @@
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
 endif
 
+if COND_arm_uboot
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/uboot.h
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/disk.h
+endif
+
 if COND_mips
 KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
 endif

=== modified file 'grub-core/Makefile.core.def'

Makefile.core.def +38 -0
@@ -67,6 +67,9 @@
   emu_cflags = '$(CFLAGS_GNULIB)';
   emu_cppflags = '$(CPPFLAGS_GNULIB)';
 
+  arm_uboot_ldflags       = '-Wl,-Ttext=0x08000000';
+  arm_uboot_stripflags    = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
+
   i386_pc_startup = kern/i386/pc/startup.S;
   i386_efi_startup = kern/i386/efi/startup.S;
   x86_64_efi_startup = kern/x86_64/efi/startup.S;
@@ -77,6 +80,7 @@
   mips_startup = kern/mips/startup.S;
   sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S;
   powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
+  arm_uboot_startup = kern/arm/uboot/startup.S;
 
   common = kern/command.c;
   common = kern/corecmd.c;
@@ -199,6 +203,17 @@
   sparc64_ieee1275 = kern/sparc64/dl.c;
   sparc64_ieee1275 = kern/sparc64/ieee1275/ieee1275.c;
 
+  uboot = disk/uboot/ubootdisk.c;
+  uboot = kern/uboot/uboot.c;
+  uboot = kern/uboot/glue.c;
+  uboot = kern/uboot/crc32.c;
+  uboot = kern/uboot/init.c;
+  uboot = kern/uboot/hw.c;
+  uboot = term/uboot/console.c;
+
+  arm = kern/arm/dl.c;
+  arm = lib/arm/libgcc.S;
+
   emu = disk/host.c;
   emu = gnulib/progname.c;
   emu = gnulib/error.c;
@@ -595,6 +610,8 @@
 module = {
   name = cat;
   common = commands/cat.c;
+  arm = lib/arg.c;
+  arm = commands/extcmd.c;
 };
 
 module = {
@@ -665,6 +682,7 @@
   efi = lib/efi/halt.c;
   ieee1275 = lib/ieee1275/halt.c;
   emu = lib/emu/halt.c;
+  uboot = lib/uboot/halt.c;
 };
 
 module = {
@@ -678,6 +696,7 @@
   mips_arc = lib/mips/arc/reboot.c;
   mips_loongson = lib/mips/loongson/reboot.c;
   mips_qemu_mips = lib/mips/qemu_mips/reboot.c;
+  uboot = lib/uboot/reboot.c;
   common = commands/reboot.c;
 };
 
@@ -1300,6 +1319,7 @@
   name = datetime;
   cmos = lib/cmos_datetime.c;
   efi = lib/efi/datetime.c;
+  uboot = lib/uboot/datetime.c;
   sparc64_ieee1275 = lib/ieee1275/datetime.c;
   powerpc_ieee1275 = lib/ieee1275/datetime.c;
   sparc64_ieee1275 = lib/ieee1275/cmos.c;
@@ -1319,6 +1339,7 @@
   extra_dist = lib/powerpc/setjmp.S;
   extra_dist = lib/ia64/setjmp.S;
   extra_dist = lib/ia64/longjmp.S;
+  extra_dist = lib/arm/setjmp.S;
 };
 
 module = {
@@ -1389,6 +1410,19 @@
   enable = x86;
 };
 
+library = {
+  name = libfdtlib.a;
+  common = lib/libfdt/fdt.c;
+  common = lib/libfdt/fdt_ro.c;
+  common = lib/libfdt/fdt_rw.c;
+  common = lib/libfdt/fdt_strerror.c;
+  common = lib/libfdt/fdt_sw.c;
+  common = lib/libfdt/fdt_wip.c;
+  cppflags = '$(CPPFLAGS_LIBFDT)';
+
+  enable = arm;
+};
+
 module = {
   name = linux;
   x86 = loader/i386/linux.c;
@@ -1397,8 +1431,12 @@
   powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
   sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
   ia64_efi = loader/ia64/efi/linux.c;
+  arm_uboot = loader/arm/uboot/linux.c;
   common = lib/cmdline.c;
   enable = noemu;
+
+  fdt_cppflags = '$(CPPFLAGS_LIBFDT)';
+  fdt_ldadd = libfdtlib.a;
 };
 
 module = {

=== added directory 'grub-core/disk/uboot'
=== added file 'grub-core/disk/uboot/ubootdisk.c'

disk/uboot/ubootdisk.c +345 -0

345 lines not on this page · raw message

=== added directory 'grub-core/kern/arm'
=== added file 'grub-core/kern/arm/dl.c'

kern/arm/dl.c +327 -0

327 lines not on this page · raw message

=== added directory 'grub-core/kern/arm/uboot' === added file 'grub-core/kern/arm/uboot/startup.S'

kern/arm/uboot/startup.S +173 -0

173 lines not on this page · raw message

=== modified file 'grub-core/kern/main.c'

kern/main.c +4 -2
@@ -30,8 +30,10 @@
 #include <grub/reader.h>
 #include <grub/parser.h>
 
-/* This is actualy platform-independant but used only on loongson and sparc.  */
-#if defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_SPARC64)
+/* This is actualy platform-independant but used only on some platforms.  */
+#if defined (GRUB_MACHINE_MIPS_LOONGSON) || \
+  defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_SPARC64) || \
+  defined (GRUB_MACHINE_ARM)
 grub_addr_t
 grub_modules_get_end (void)
 {

=== added directory 'grub-core/kern/uboot'
=== added file 'grub-core/kern/uboot/glue.c'

kern/uboot/glue.c +475 -0

475 lines not on this page · raw message

=== added file 'grub-core/kern/uboot/hw.c'

kern/uboot/hw.c +114 -0

114 lines not on this page · raw message

=== added file 'grub-core/kern/uboot/init.c'

kern/uboot/init.c +165 -0

165 lines not on this page · raw message

=== added file 'grub-core/kern/uboot/uboot.c'

kern/uboot/uboot.c +27 -0
@@ -0,0 +1,27 @@
+/* uboot.c - generic U-Boot support */
+/*
+ *  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/>.
+ */
+
+#include <grub/misc.h>
+#include <grub/uboot/uboot.h>
+
+void
+grub_exit (void)
+{
+  uboot_return (0);
+}

=== added directory 'grub-core/lib/arm'
=== added file 'grub-core/lib/arm/libgcc.S'

lib/arm/libgcc.S +299 -0

299 lines not on this page · raw message

=== added file 'grub-core/lib/arm/setjmp.S'

lib/arm/setjmp.S +57 -0

57 lines not on this page · raw message

=== modified file 'grub-core/lib/setjmp.S'

lib/setjmp.S +2 -0
@@ -11,6 +11,8 @@
 #elif defined(__ia64__)
 #include "./ia64/setjmp.S"
 #include "./ia64/longjmp.S"
+#elif defined(__arm__)
+#include "./arm/setjmp.S"
 #else
 #error "Unknown target cpu type"
 #endif

=== added directory 'grub-core/lib/uboot'
=== added file 'grub-core/lib/uboot/datetime.c'

lib/uboot/datetime.c +41 -0

41 lines not on this page · raw message

=== added file 'grub-core/lib/uboot/halt.c'

lib/uboot/halt.c +31 -0
@@ -0,0 +1,31 @@
+/*
+ *  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/>.
+ */
+
+#include <grub/misc.h>
+#include <grub/mm.h>
+#include <grub/kernel.h>
+
+void
+grub_halt (void)
+{
+  grub_machine_fini ();
+
+  /* Just stop here */
+
+  while (1);
+}

=== added file 'grub-core/lib/uboot/reboot.c'

lib/uboot/reboot.c +30 -0
@@ -0,0 +1,30 @@
+/*
+ *  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/>.
+ */
+
+#include <grub/kernel.h>
+#include <grub/misc.h>
+#include <grub/uboot/uboot.h>
+
+void
+grub_reboot (void)
+{
+  grub_machine_fini ();
+
+  ub_reset ();
+  while (1);
+}

=== added directory 'grub-core/loader/arm' === added directory 'grub-core/loader/arm/uboot' === added file 'grub-core/loader/arm/uboot/linux.c'

loader/arm/uboot/linux.c +379 -0

379 lines not on this page · raw message

=== modified file 'grub-core/term/terminfo.c'

term/terminfo.c +3 -1
@@ -746,7 +746,9 @@
 
 static grub_extcmd_t cmd;
 
-#if defined (GRUB_MACHINE_IEEE1275) || defined (GRUB_MACHINE_MIPS_LOONGSON) || defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_ARC)
+#if defined (GRUB_MACHINE_IEEE1275) || defined (GRUB_MACHINE_MIPS_LOONGSON) || \
+  defined (GRUB_MACHINE_MIPS_QEMU_MIPS) || defined (GRUB_MACHINE_ARC) || \
+  defined (GRUB_MACHINE_UBOOT)
 void grub_terminfo_init (void)
 #else
 GRUB_MOD_INIT(terminfo)

=== added directory 'grub-core/term/uboot'
=== added file 'grub-core/term/uboot/console.c'

term/uboot/console.c +143 -0

143 lines not on this page · raw message

=== added directory 'include/grub/arm'
=== added file 'include/grub/arm/linux.h'

grub/arm/linux.h +34 -0
@@ -0,0 +1,34 @@
+/* linux.h - ARM linux specific definitions */
+/*
+ *  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/>.
+ */
+
+#ifndef GRUB_LINUX_CPU_HEADER
+#define GRUB_LINUX_CPU_HEADER 1
+
+#define LINUX_ZIMAGE_OFFSET 0x24
+#define LINUX_ZIMAGE_MAGIC  0x016f2818
+
+#define LINUX_ADDRESS        (start_of_ram + 0x8000)
+#define LINUX_INITRD_ADDRESS (start_of_ram + 0x02000000)
+#define LINUX_FDT_ADDRESS    (LINUX_INITRD_ADDRESS - 0x10000)
+
+#define FDT_ADDITIONAL_ENTRIES_SIZE	0x300
+
+typedef void (*kernel_entry_t) (int, unsigned long, void *);
+
+#endif /* ! GRUB_LINUX_CPU_HEADER */

=== added file 'include/grub/arm/time.h'

grub/arm/time.h +29 -0
@@ -0,0 +1,29 @@
+/*
+ *  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/>.
+ */
+
+#ifndef KERNEL_CPU_TIME_HEADER
+#define KERNEL_CPU_TIME_HEADER	1
+
+static __inline void
+grub_cpu_idle (void)
+{
+  /* FIXME: this can't work until we handle interrupts.  */
+/*  __asm__ __volatile__ ("wfi"); */
+}
+
+#endif /* ! KERNEL_CPU_TIME_HEADER */

=== added file 'include/grub/arm/types.h'

grub/arm/types.h +34 -0
@@ -0,0 +1,34 @@
+/*
+ *  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/>.
+ */
+
+#ifndef GRUB_TYPES_CPU_HEADER
+#define GRUB_TYPES_CPU_HEADER	1
+
+/* The size of void *.  */
+#define GRUB_TARGET_SIZEOF_VOID_P	4
+
+/* The size of long.  */
+#define GRUB_TARGET_SIZEOF_LONG		4
+
+/* currently only support little-endian.  */
+#undef GRUB_TARGET_WORDS_BIGENDIAN
+
+/* Unaligned accesses only supported if MMU enabled */
+//#define GRUB_HAVE_UNALIGNED_ACCESS 1
+
+#endif /* ! GRUB_TYPES_CPU_HEADER */

=== added directory 'include/grub/arm/uboot'
=== added file 'include/grub/arm/uboot/kernel.h'

grub/arm/uboot/kernel.h +31 -0
@@ -0,0 +1,31 @@
+/*
+ *  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
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'include/grub/disk.h'

grub/disk.h +47 -48

95 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== modified file 'include/grub/elf.h'

grub/elf.h +54 -11

65 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== modified file 'include/grub/libgcc.h'

grub/libgcc.h +45 -34

79 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== modified file 'include/grub/offsets.h'

grub/offsets.h +5 -0

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'include/grub/symbol.h'

grub/symbol.h +12 -8

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== added directory 'include/grub/uboot'
=== added file 'include/grub/uboot/api_public.h'

grub/uboot/api_public.h +175 -0

175 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== added file 'include/grub/uboot/console.h'

grub/uboot/console.h +29 -0

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== added file 'include/grub/uboot/disk.h'

grub/uboot/disk.h +44 -0

44 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== added file 'include/grub/uboot/glue.h'

grub/uboot/glue.h +86 -0

86 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== added file 'include/grub/uboot/uboot.h'

grub/uboot/uboot.h +41 -0

41 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

=== modified file 'util/grub-install.in'

grub-install.in +3 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

=== modified file 'util/grub-mkimage.c'

grub-mkimage.c +64 -4

68 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.