All of lore.kernel.org
 help / color / mirror / Atom feed
* RISC OS/ARM port
@ 2004-05-22 15:21 Timothy Baldwin
  2004-05-23 17:03 ` Yoshinori K. Okuji
  0 siblings, 1 reply; 9+ messages in thread
From: Timothy Baldwin @ 2004-05-22 15:21 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1: Type: text/plain, Size: 1615 bytes --]


I am working on a port to (ex-Acorn) RISC OS, which currently gets as far as 
rescue mode.

RISC OS is supplied in ROM or flash with many systems, including desktop 
systems made by Acorn and it's sucessors, various set-top boxes, and the Bush 
Internet TV.  I have used upper case thoughout for RISC OS as riscos is a 
different operating system.

Things to do:
Discs and partitions.
RISC OS native filesystem access.
Network support (using BSD sockets).
Colour and graphic console support.
An interface for writing to files.
A file copy command, to use when upgrading grub.
Serial port support.
Security (disabling keyboard drivers during boot)
Access to RISC OS commands.
A memory defragmenter.
And some OS loaders of course.


How should console errors be handled? Currently they are fatal, and won't 
happen unless the console is redirected (assuming USB drivers don't 
complain).

Currently in the design of GRUB 2 there is an incorrect asumption that filing 
systems are either based on disks or networks. I propose to rectify this 
whilst keeping code size down by:

Creating a struct grub_fs_device_driver, which contains a pointer to either 
struct grub_disk_dev or struct grub_net_dev, and maintain a single linked 
list of disk drivers, net drivers, and standalone filing systems.

Convert struct grub_device from pointers to a unoin to simplify the code by 
removing memory allocations.

-- 
Member AFFS, WYLUG, SWP (UK), ANL, RESPECT, Leeds SA, Leeds Anti-war coalition
No to software patents!    No to DRM/EUCD - hands off our computers!











[-- Attachment #1.2: patch1.diff --]
[-- Type: text/x-diff, Size: 66327 bytes --]

--- grub2.orig/configure.ac     2004-05-21 12:14:37.000000000 +0100
+++ grub2.patch1/configure.ac   2004-05-19 00:26:16.000000000 +0100
@@ -23,12 +23,14 @@
 case "$host_cpu" in
   i[[3456]]86) host_cpu=i386 ;;
   powerpc) ;;
+  arm) ;;
   *) AC_MSG_ERROR([unsupported CPU type]) ;;
 esac
 
 case "$host_cpu"-"$host_vendor" in
   i386-*) host_vendor=pc ;;
   powerpc-*) host_vendor=ieee1275 ;;
+  arm-*) host_vendor=RISC_OS ;;
   *) AC_MSG_ERROR([unsupported machine type]) ;;
 esac
 
diff -urN grub2.orig/conf/arm-RISC_OS.mk grub2.patch1/conf/arm-RISC_OS.mk
--- grub2.orig/conf/arm-RISC_OS.mk	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/conf/arm-RISC_OS.mk	2004-05-21 12:00:01.000000000 +0100
@@ -0,0 +1,696 @@
+# -*- makefile -*-
+
+COMMON_ASFLAGS = -nostdinc -fno-builtin
+COMMON_CFLAGS = -fno-builtin
+
+# Images.
+pkgdata_IMAGES = grub_RISC_OS.img
+
+
+# For grub_RISC_OS.img.
+grub_RISC_OS_img_SOURCES = kern/arm/aif_header.S kern/main.c kern/device.c \
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
+	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
+	kern/i386/dl.c kern/arm/RISC_OS/startup.S kern/arm/setjmp.S\
+	kern/env.c kern/arm/RISC_OS/init.c disk/i386/pc/partition.c\
+	term/arm/RISC_OS/console.c term/arm/RISC_OS/console-asm.S\
+	symlist.c
+CLEANFILES += grub_RISC_OS.img grub_RISC_OS.exec grub_RISC_OS_img-kern_arm_aif_header.o grub_RISC_OS_img-kern_main.o grub_RISC_OS_img-kern_device.o grub_RISC_OS_img-kern_disk.o grub_RISC_OS_img-kern_dl.o grub_RISC_OS_img-kern_file.o grub_RISC_OS_img-kern_fs.o grub_RISC_OS_img-kern_err.o grub_RISC_OS_img-kern_misc.o grub_RISC_OS_img-kern_mm.o grub_RISC_OS_img-kern_loader.o grub_RISC_OS_img-kern_rescue.o grub_RISC_OS_img-kern_term.o grub_RISC_OS_img-kern_i386_dl.o grub_RISC_OS_img-kern_arm_RISC_OS_startup.o grub_RISC_OS_img-kern_arm_setjmp.o grub_RISC_OS_img-kern_env.o grub_RISC_OS_img-kern_arm_RISC_OS_init.o grub_RISC_OS_img-disk_i386_pc_partition.o grub_RISC_OS_img-term_arm_RISC_OS_console.o grub_RISC_OS_img-term_arm_RISC_OS_console_asm.o grub_RISC_OS_img-symlist.o
+MOSTLYCLEANFILES += grub_RISC_OS_img-kern_arm_aif_header.d grub_RISC_OS_img-kern_main.d grub_RISC_OS_img-kern_device.d grub_RISC_OS_img-kern_disk.d grub_RISC_OS_img-kern_dl.d grub_RISC_OS_img-kern_file.d grub_RISC_OS_img-kern_fs.d grub_RISC_OS_img-kern_err.d grub_RISC_OS_img-kern_misc.d grub_RISC_OS_img-kern_mm.d grub_RISC_OS_img-kern_loader.d grub_RISC_OS_img-kern_rescue.d grub_RISC_OS_img-kern_term.d grub_RISC_OS_img-kern_i386_dl.d grub_RISC_OS_img-kern_arm_RISC_OS_startup.d grub_RISC_OS_img-kern_arm_setjmp.d grub_RISC_OS_img-kern_env.d grub_RISC_OS_img-kern_arm_RISC_OS_init.d grub_RISC_OS_img-disk_i386_pc_partition.d grub_RISC_OS_img-term_arm_RISC_OS_console.d grub_RISC_OS_img-term_arm_RISC_OS_console_asm.d grub_RISC_OS_img-symlist.d
+
+grub_RISC_OS.img: grub_RISC_OS.exec
+	$(OBJCOPY) -O binary -R .note -R .comment $< $@
+
+grub_RISC_OS.exec: grub_RISC_OS_img-kern_arm_aif_header.o grub_RISC_OS_img-kern_main.o grub_RISC_OS_img-kern_device.o grub_RISC_OS_img-kern_disk.o grub_RISC_OS_img-kern_dl.o grub_RISC_OS_img-kern_file.o grub_RISC_OS_img-kern_fs.o grub_RISC_OS_img-kern_err.o grub_RISC_OS_img-kern_misc.o grub_RISC_OS_img-kern_mm.o grub_RISC_OS_img-kern_loader.o grub_RISC_OS_img-kern_rescue.o grub_RISC_OS_img-kern_term.o grub_RISC_OS_img-kern_i386_dl.o grub_RISC_OS_img-kern_arm_RISC_OS_startup.o grub_RISC_OS_img-kern_arm_setjmp.o grub_RISC_OS_img-kern_env.o grub_RISC_OS_img-kern_arm_RISC_OS_init.o grub_RISC_OS_img-disk_i386_pc_partition.o grub_RISC_OS_img-term_arm_RISC_OS_console.o grub_RISC_OS_img-term_arm_RISC_OS_console_asm.o grub_RISC_OS_img-symlist.o
+	$(CC) -o $@ $^ $(LDFLAGS) $(grub_RISC_OS_img_LDFLAGS)
+
+grub_RISC_OS_img-kern_arm_aif_header.o: kern/arm/aif_header.S
+	$(CC) -Ikern/arm -I$(srcdir)/kern/arm $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_arm_aif_header.d: kern/arm/aif_header.S
+	set -e; 	  $(CC) -Ikern/arm -I$(srcdir)/kern/arm $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -M $< 	  | sed 's,aif_header\.o[ :]*,grub_RISC_OS_img-kern_arm_aif_header.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_arm_aif_header.d
+
+grub_RISC_OS_img-kern_main.o: kern/main.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_main.d: kern/main.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,main\.o[ :]*,grub_RISC_OS_img-kern_main.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_main.d
+
+grub_RISC_OS_img-kern_device.o: kern/device.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_device.d: kern/device.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,device\.o[ :]*,grub_RISC_OS_img-kern_device.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_device.d
+
+grub_RISC_OS_img-kern_disk.o: kern/disk.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_disk.d: kern/disk.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,disk\.o[ :]*,grub_RISC_OS_img-kern_disk.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_disk.d
+
+grub_RISC_OS_img-kern_dl.o: kern/dl.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_dl.d: kern/dl.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,dl\.o[ :]*,grub_RISC_OS_img-kern_dl.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_dl.d
+
+grub_RISC_OS_img-kern_file.o: kern/file.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_file.d: kern/file.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,file\.o[ :]*,grub_RISC_OS_img-kern_file.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_file.d
+
+grub_RISC_OS_img-kern_fs.o: kern/fs.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_fs.d: kern/fs.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,fs\.o[ :]*,grub_RISC_OS_img-kern_fs.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_fs.d
+
+grub_RISC_OS_img-kern_err.o: kern/err.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_err.d: kern/err.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,err\.o[ :]*,grub_RISC_OS_img-kern_err.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_err.d
+
+grub_RISC_OS_img-kern_misc.o: kern/misc.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_misc.d: kern/misc.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,misc\.o[ :]*,grub_RISC_OS_img-kern_misc.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_misc.d
+
+grub_RISC_OS_img-kern_mm.o: kern/mm.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_mm.d: kern/mm.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,mm\.o[ :]*,grub_RISC_OS_img-kern_mm.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_mm.d
+
+grub_RISC_OS_img-kern_loader.o: kern/loader.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_loader.d: kern/loader.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,loader\.o[ :]*,grub_RISC_OS_img-kern_loader.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_loader.d
+
+grub_RISC_OS_img-kern_rescue.o: kern/rescue.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_rescue.d: kern/rescue.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,rescue\.o[ :]*,grub_RISC_OS_img-kern_rescue.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_rescue.d
+
+grub_RISC_OS_img-kern_term.o: kern/term.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_term.d: kern/term.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,term\.o[ :]*,grub_RISC_OS_img-kern_term.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_term.d
+
+grub_RISC_OS_img-kern_i386_dl.o: kern/i386/dl.c
+	$(CC) -Ikern/i386 -I$(srcdir)/kern/i386 $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_i386_dl.d: kern/i386/dl.c
+	set -e; 	  $(CC) -Ikern/i386 -I$(srcdir)/kern/i386 $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,dl\.o[ :]*,grub_RISC_OS_img-kern_i386_dl.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_i386_dl.d
+
+grub_RISC_OS_img-kern_arm_RISC_OS_startup.o: kern/arm/RISC_OS/startup.S
+	$(CC) -Ikern/arm/RISC_OS -I$(srcdir)/kern/arm/RISC_OS $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_arm_RISC_OS_startup.d: kern/arm/RISC_OS/startup.S
+	set -e; 	  $(CC) -Ikern/arm/RISC_OS -I$(srcdir)/kern/arm/RISC_OS $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -M $< 	  | sed 's,startup\.o[ :]*,grub_RISC_OS_img-kern_arm_RISC_OS_startup.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_arm_RISC_OS_startup.d
+
+grub_RISC_OS_img-kern_arm_setjmp.o: kern/arm/setjmp.S
+	$(CC) -Ikern/arm -I$(srcdir)/kern/arm $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_arm_setjmp.d: kern/arm/setjmp.S
+	set -e; 	  $(CC) -Ikern/arm -I$(srcdir)/kern/arm $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -M $< 	  | sed 's,setjmp\.o[ :]*,grub_RISC_OS_img-kern_arm_setjmp.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_arm_setjmp.d
+
+grub_RISC_OS_img-kern_env.o: kern/env.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_env.d: kern/env.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,env\.o[ :]*,grub_RISC_OS_img-kern_env.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_env.d
+
+grub_RISC_OS_img-kern_arm_RISC_OS_init.o: kern/arm/RISC_OS/init.c
+	$(CC) -Ikern/arm/RISC_OS -I$(srcdir)/kern/arm/RISC_OS $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_arm_RISC_OS_init.d: kern/arm/RISC_OS/init.c
+	set -e; 	  $(CC) -Ikern/arm/RISC_OS -I$(srcdir)/kern/arm/RISC_OS $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,init\.o[ :]*,grub_RISC_OS_img-kern_arm_RISC_OS_init.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_arm_RISC_OS_init.d
+
+grub_RISC_OS_img-disk_i386_pc_partition.o: disk/i386/pc/partition.c
+	$(CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-disk_i386_pc_partition.d: disk/i386/pc/partition.c
+	set -e; 	  $(CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,partition\.o[ :]*,grub_RISC_OS_img-disk_i386_pc_partition.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-disk_i386_pc_partition.d
+
+grub_RISC_OS_img-term_arm_RISC_OS_console.o: term/arm/RISC_OS/console.c
+	$(CC) -Iterm/arm/RISC_OS -I$(srcdir)/term/arm/RISC_OS $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-term_arm_RISC_OS_console.d: term/arm/RISC_OS/console.c
+	set -e; 	  $(CC) -Iterm/arm/RISC_OS -I$(srcdir)/term/arm/RISC_OS $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,console\.o[ :]*,grub_RISC_OS_img-term_arm_RISC_OS_console.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-term_arm_RISC_OS_console.d
+
+grub_RISC_OS_img-term_arm_RISC_OS_console_asm.o: term/arm/RISC_OS/console-asm.S
+	$(CC) -Iterm/arm/RISC_OS -I$(srcdir)/term/arm/RISC_OS $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-term_arm_RISC_OS_console_asm.d: term/arm/RISC_OS/console-asm.S
+	set -e; 	  $(CC) -Iterm/arm/RISC_OS -I$(srcdir)/term/arm/RISC_OS $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -M $< 	  | sed 's,console\-asm\.o[ :]*,grub_RISC_OS_img-term_arm_RISC_OS_console_asm.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-term_arm_RISC_OS_console_asm.d
+
+grub_RISC_OS_img-symlist.o: symlist.c
+	$(CC) -I. -I$(srcdir)/. $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-symlist.d: symlist.c
+	set -e; 	  $(CC) -I. -I$(srcdir)/. $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,symlist\.o[ :]*,grub_RISC_OS_img-symlist.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-symlist.d
+
+grub_RISC_OS_img_HEADERS = boot.h device.h disk.h dl.h elf.h err.h \
+	file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \
+	term.h types.h arg.h env.h
+grub_RISC_OS_img_CFLAGS = $(COMMON_CFLAGS)
+grub_RISC_OS_img_ASFLAGS = $(COMMON_ASFLAGS)
+grub_RISC_OS_img_LDFLAGS =  `$(CC) -print-libgcc-file-name` $(srcdir)/kern/arm/aif_header.lds -nostdlib -Wl,-N,-Ttext,8000
+
+MOSTLYCLEANFILES += symlist.c grub_RISC_OS_syms.lst
+DEFSYMFILES += grub_RISC_OS_syms.lst
+
+symlist.c: $(addprefix include/grub/,$(grub_RISC_OS_img_HEADERS)) gensymlist.sh
+	sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
+
+grub_RISC_OS_syms.lst: $(addprefix include/grub/,$(grub_RISC_OS_img_HEADERS)) genkernsyms.sh
+	sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
+
+# Utilities.
+#bin_UTILITIES = grub-mkimage
+#sbin_UTILITIES = grub-setup grub-emu
+noinst_UTILITIES = genmoddep
+
+# For grub-mkimage.
+grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
+	util/resolve.c
+grub_mkimage_LDFLAGS = -llzo
+
+# For grub-setup.
+grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
+	util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
+	kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \
+	kern/file.c kern/fs.c kern/env.c
+
+# For grub
+grub_emu_SOURCES = kern/main.c kern/device.c				\
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c		\
+        kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
+	disk/i386/pc/partition.c kern/env.c commands/ls.c		\
+	commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c		\
+	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c			\
+	normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c	\
+	util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c
+grub_emu_LDFLAGS = -lncurses
+
+# For genmoddep.
+genmoddep_SOURCES = util/genmoddep.c
+CLEANFILES += genmoddep genmoddep-util_genmoddep.o
+MOSTLYCLEANFILES += genmoddep-util_genmoddep.d
+
+genmoddep: genmoddep-util_genmoddep.o
+	$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(genmoddep_LDFLAGS)
+
+genmoddep-util_genmoddep.o: util/genmoddep.c
+	$(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -c -o $@ $<
+
+genmoddep-util_genmoddep.d: util/genmoddep.c
+	set -e; 	  $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -M $< 	  | sed 's,genmoddep\.o[ :]*,genmoddep-util_genmoddep.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include genmoddep-util_genmoddep.d
+
+
+# Modules.
+pkgdata_MODULES = fat.mod ext2.mod normal.mod hello.mod \
+	 font.mod ls.mod boot.mod cmp.mod cat.mod terminal.mod
+
+# For fat.mod.
+fat_mod_SOURCES = fs/fat.c
+CLEANFILES += fat.mod mod-fat.o mod-fat.c pre-fat.o fat_mod-fs_fat.o def-fat.lst und-fat.lst
+MOSTLYCLEANFILES += fat_mod-fs_fat.d
+DEFSYMFILES += def-fat.lst
+UNDSYMFILES += und-fat.lst
+
+fat.mod: pre-fat.o mod-fat.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-fat.o: fat_mod-fs_fat.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-fat.o: mod-fat.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(fat_mod_CFLAGS) -c -o $@ $<
+
+mod-fat.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'fat' $< > $@ || (rm -f $@; exit 1)
+
+def-fat.lst: pre-fat.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 fat/' > $@
+
+und-fat.lst: pre-fat.o
+	echo 'fat' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+fat_mod-fs_fat.o: fs/fat.c
+	$(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(fat_mod_CFLAGS) -c -o $@ $<
+
+fat_mod-fs_fat.d: fs/fat.c
+	set -e; 	  $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(fat_mod_CFLAGS) -M $< 	  | sed 's,fat\.o[ :]*,fat_mod-fs_fat.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include fat_mod-fs_fat.d
+
+fat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ext2.mod.
+ext2_mod_SOURCES = fs/ext2.c
+CLEANFILES += ext2.mod mod-ext2.o mod-ext2.c pre-ext2.o ext2_mod-fs_ext2.o def-ext2.lst und-ext2.lst
+MOSTLYCLEANFILES += ext2_mod-fs_ext2.d
+DEFSYMFILES += def-ext2.lst
+UNDSYMFILES += und-ext2.lst
+
+ext2.mod: pre-ext2.o mod-ext2.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-ext2.o: ext2_mod-fs_ext2.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-ext2.o: mod-ext2.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(ext2_mod_CFLAGS) -c -o $@ $<
+
+mod-ext2.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'ext2' $< > $@ || (rm -f $@; exit 1)
+
+def-ext2.lst: pre-ext2.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ext2/' > $@
+
+und-ext2.lst: pre-ext2.o
+	echo 'ext2' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+ext2_mod-fs_ext2.o: fs/ext2.c
+	$(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(ext2_mod_CFLAGS) -c -o $@ $<
+
+ext2_mod-fs_ext2.d: fs/ext2.c
+	set -e; 	  $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(ext2_mod_CFLAGS) -M $< 	  | sed 's,ext2\.o[ :]*,ext2_mod-fs_ext2.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include ext2_mod-fs_ext2.d
+
+ext2_mod_CFLAGS = $(COMMON_CFLAGS)
+
+
+# For normal.mod.
+normal_mod_SOURCES = normal/cmdline.c normal/command.c normal/main.c \
+	normal/menu.c normal/arg.c 
+CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_arg.o def-normal.lst und-normal.lst
+MOSTLYCLEANFILES += normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_arg.d
+DEFSYMFILES += def-normal.lst
+UNDSYMFILES += und-normal.lst
+
+normal.mod: pre-normal.o mod-normal.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-normal.o: normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_arg.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-normal.o: mod-normal.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+mod-normal.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'normal' $< > $@ || (rm -f $@; exit 1)
+
+def-normal.lst: pre-normal.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 normal/' > $@
+
+und-normal.lst: pre-normal.o
+	echo 'normal' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+normal_mod-normal_cmdline.o: normal/cmdline.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_cmdline.d: normal/cmdline.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,cmdline\.o[ :]*,normal_mod-normal_cmdline.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_cmdline.d
+
+normal_mod-normal_command.o: normal/command.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_command.d: normal/command.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,command\.o[ :]*,normal_mod-normal_command.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_command.d
+
+normal_mod-normal_main.o: normal/main.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_main.d: normal/main.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,main\.o[ :]*,normal_mod-normal_main.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_main.d
+
+normal_mod-normal_menu.o: normal/menu.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_menu.d: normal/menu.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,menu\.o[ :]*,normal_mod-normal_menu.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_menu.d
+
+normal_mod-normal_arg.o: normal/arg.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_arg.d: normal/arg.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,arg\.o[ :]*,normal_mod-normal_arg.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_arg.d
+
+normal_mod_CFLAGS = $(COMMON_CFLAGS)
+normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
+
+# For hello.mod.
+hello_mod_SOURCES = hello/hello.c
+CLEANFILES += hello.mod mod-hello.o mod-hello.c pre-hello.o hello_mod-hello_hello.o def-hello.lst und-hello.lst
+MOSTLYCLEANFILES += hello_mod-hello_hello.d
+DEFSYMFILES += def-hello.lst
+UNDSYMFILES += und-hello.lst
+
+hello.mod: pre-hello.o mod-hello.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-hello.o: hello_mod-hello_hello.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-hello.o: mod-hello.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(hello_mod_CFLAGS) -c -o $@ $<
+
+mod-hello.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'hello' $< > $@ || (rm -f $@; exit 1)
+
+def-hello.lst: pre-hello.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hello/' > $@
+
+und-hello.lst: pre-hello.o
+	echo 'hello' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+hello_mod-hello_hello.o: hello/hello.c
+	$(CC) -Ihello -I$(srcdir)/hello $(CPPFLAGS) $(CFLAGS) $(hello_mod_CFLAGS) -c -o $@ $<
+
+hello_mod-hello_hello.d: hello/hello.c
+	set -e; 	  $(CC) -Ihello -I$(srcdir)/hello $(CPPFLAGS) $(CFLAGS) $(hello_mod_CFLAGS) -M $< 	  | sed 's,hello\.o[ :]*,hello_mod-hello_hello.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include hello_mod-hello_hello.d
+
+hello_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For boot.mod.
+boot_mod_SOURCES = commands/boot.c
+CLEANFILES += boot.mod mod-boot.o mod-boot.c pre-boot.o boot_mod-commands_boot.o def-boot.lst und-boot.lst
+MOSTLYCLEANFILES += boot_mod-commands_boot.d
+DEFSYMFILES += def-boot.lst
+UNDSYMFILES += und-boot.lst
+
+boot.mod: pre-boot.o mod-boot.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-boot.o: boot_mod-commands_boot.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-boot.o: mod-boot.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(boot_mod_CFLAGS) -c -o $@ $<
+
+mod-boot.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'boot' $< > $@ || (rm -f $@; exit 1)
+
+def-boot.lst: pre-boot.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 boot/' > $@
+
+und-boot.lst: pre-boot.o
+	echo 'boot' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+boot_mod-commands_boot.o: commands/boot.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(boot_mod_CFLAGS) -c -o $@ $<
+
+boot_mod-commands_boot.d: commands/boot.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(boot_mod_CFLAGS) -M $< 	  | sed 's,boot\.o[ :]*,boot_mod-commands_boot.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include boot_mod-commands_boot.d
+
+boot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For terminal.mod.
+terminal_mod_SOURCES = commands/terminal.c
+CLEANFILES += terminal.mod mod-terminal.o mod-terminal.c pre-terminal.o terminal_mod-commands_terminal.o def-terminal.lst und-terminal.lst
+MOSTLYCLEANFILES += terminal_mod-commands_terminal.d
+DEFSYMFILES += def-terminal.lst
+UNDSYMFILES += und-terminal.lst
+
+terminal.mod: pre-terminal.o mod-terminal.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-terminal.o: terminal_mod-commands_terminal.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-terminal.o: mod-terminal.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(terminal_mod_CFLAGS) -c -o $@ $<
+
+mod-terminal.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'terminal' $< > $@ || (rm -f $@; exit 1)
+
+def-terminal.lst: pre-terminal.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 terminal/' > $@
+
+und-terminal.lst: pre-terminal.o
+	echo 'terminal' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+terminal_mod-commands_terminal.o: commands/terminal.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(terminal_mod_CFLAGS) -c -o $@ $<
+
+terminal_mod-commands_terminal.d: commands/terminal.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(terminal_mod_CFLAGS) -M $< 	  | sed 's,terminal\.o[ :]*,terminal_mod-commands_terminal.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include terminal_mod-commands_terminal.d
+
+terminal_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ls.mod.
+ls_mod_SOURCES = commands/ls.c
+CLEANFILES += ls.mod mod-ls.o mod-ls.c pre-ls.o ls_mod-commands_ls.o def-ls.lst und-ls.lst
+MOSTLYCLEANFILES += ls_mod-commands_ls.d
+DEFSYMFILES += def-ls.lst
+UNDSYMFILES += und-ls.lst
+
+ls.mod: pre-ls.o mod-ls.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-ls.o: ls_mod-commands_ls.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-ls.o: mod-ls.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(ls_mod_CFLAGS) -c -o $@ $<
+
+mod-ls.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'ls' $< > $@ || (rm -f $@; exit 1)
+
+def-ls.lst: pre-ls.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ls/' > $@
+
+und-ls.lst: pre-ls.o
+	echo 'ls' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+ls_mod-commands_ls.o: commands/ls.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(ls_mod_CFLAGS) -c -o $@ $<
+
+ls_mod-commands_ls.d: commands/ls.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(ls_mod_CFLAGS) -M $< 	  | sed 's,ls\.o[ :]*,ls_mod-commands_ls.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include ls_mod-commands_ls.d
+
+ls_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cmp.mod.
+cmp_mod_SOURCES = commands/cmp.c
+CLEANFILES += cmp.mod mod-cmp.o mod-cmp.c pre-cmp.o cmp_mod-commands_cmp.o def-cmp.lst und-cmp.lst
+MOSTLYCLEANFILES += cmp_mod-commands_cmp.d
+DEFSYMFILES += def-cmp.lst
+UNDSYMFILES += und-cmp.lst
+
+cmp.mod: pre-cmp.o mod-cmp.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-cmp.o: cmp_mod-commands_cmp.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-cmp.o: mod-cmp.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(cmp_mod_CFLAGS) -c -o $@ $<
+
+mod-cmp.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'cmp' $< > $@ || (rm -f $@; exit 1)
+
+def-cmp.lst: pre-cmp.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 cmp/' > $@
+
+und-cmp.lst: pre-cmp.o
+	echo 'cmp' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+cmp_mod-commands_cmp.o: commands/cmp.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(cmp_mod_CFLAGS) -c -o $@ $<
+
+cmp_mod-commands_cmp.d: commands/cmp.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(cmp_mod_CFLAGS) -M $< 	  | sed 's,cmp\.o[ :]*,cmp_mod-commands_cmp.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include cmp_mod-commands_cmp.d
+
+cmp_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cat.mod.
+cat_mod_SOURCES = commands/cat.c
+CLEANFILES += cat.mod mod-cat.o mod-cat.c pre-cat.o cat_mod-commands_cat.o def-cat.lst und-cat.lst
+MOSTLYCLEANFILES += cat_mod-commands_cat.d
+DEFSYMFILES += def-cat.lst
+UNDSYMFILES += und-cat.lst
+
+cat.mod: pre-cat.o mod-cat.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-cat.o: cat_mod-commands_cat.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-cat.o: mod-cat.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(cat_mod_CFLAGS) -c -o $@ $<
+
+mod-cat.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'cat' $< > $@ || (rm -f $@; exit 1)
+
+def-cat.lst: pre-cat.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 cat/' > $@
+
+und-cat.lst: pre-cat.o
+	echo 'cat' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+cat_mod-commands_cat.o: commands/cat.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(cat_mod_CFLAGS) -c -o $@ $<
+
+cat_mod-commands_cat.d: commands/cat.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(cat_mod_CFLAGS) -M $< 	  | sed 's,cat\.o[ :]*,cat_mod-commands_cat.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include cat_mod-commands_cat.d
+
+cat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For font.mod.
+font_mod_SOURCES = font/manager.c
+CLEANFILES += font.mod mod-font.o mod-font.c pre-font.o font_mod-font_manager.o def-font.lst und-font.lst
+MOSTLYCLEANFILES += font_mod-font_manager.d
+DEFSYMFILES += def-font.lst
+UNDSYMFILES += und-font.lst
+
+font.mod: pre-font.o mod-font.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-font.o: font_mod-font_manager.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-font.o: mod-font.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(font_mod_CFLAGS) -c -o $@ $<
+
+mod-font.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'font' $< > $@ || (rm -f $@; exit 1)
+
+def-font.lst: pre-font.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 font/' > $@
+
+und-font.lst: pre-font.o
+	echo 'font' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+font_mod-font_manager.o: font/manager.c
+	$(CC) -Ifont -I$(srcdir)/font $(CPPFLAGS) $(CFLAGS) $(font_mod_CFLAGS) -c -o $@ $<
+
+font_mod-font_manager.d: font/manager.c
+	set -e; 	  $(CC) -Ifont -I$(srcdir)/font $(CPPFLAGS) $(CFLAGS) $(font_mod_CFLAGS) -M $< 	  | sed 's,manager\.o[ :]*,font_mod-font_manager.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include font_mod-font_manager.d
+
+font_mod_CFLAGS = $(COMMON_CFLAGS)
+
+CLEANFILES += moddep.lst
+pkgdata_DATA += moddep.lst
+moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
+	cat $(DEFSYMFILES) /dev/null | ./genmoddep $(UNDSYMFILES) > $@ \
+	  || (rm -f $@; exit 1)
diff -urN grub2.orig/conf/arm-RISC_OS.rmk grub2.patch1/conf/arm-RISC_OS.rmk
--- grub2.orig/conf/arm-RISC_OS.rmk	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/conf/arm-RISC_OS.rmk	2004-05-21 11:59:58.000000000 +0100
@@ -0,0 +1,110 @@
+# -*- makefile -*-
+
+COMMON_ASFLAGS = -nostdinc -fno-builtin
+COMMON_CFLAGS = -fno-builtin
+
+# Images.
+pkgdata_IMAGES = grub_RISC_OS.img
+
+
+# For grub_RISC_OS.img.
+grub_RISC_OS_img_SOURCES = kern/arm/aif_header.S kern/main.c kern/device.c \
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
+	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
+	kern/i386/dl.c kern/arm/RISC_OS/startup.S kern/arm/setjmp.S\
+	kern/env.c kern/arm/RISC_OS/init.c disk/i386/pc/partition.c\
+	term/arm/RISC_OS/console.c term/arm/RISC_OS/console-asm.S\
+	symlist.c
+grub_RISC_OS_img_HEADERS = boot.h device.h disk.h dl.h elf.h err.h \
+	file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \
+	term.h types.h arg.h env.h
+grub_RISC_OS_img_CFLAGS = $(COMMON_CFLAGS)
+grub_RISC_OS_img_ASFLAGS = $(COMMON_ASFLAGS)
+grub_RISC_OS_img_LDFLAGS =  `$(CC) -print-libgcc-file-name` $(srcdir)/kern/arm/aif_header.lds -nostdlib -Wl,-N,-Ttext,8000
+
+MOSTLYCLEANFILES += symlist.c grub_RISC_OS_syms.lst
+DEFSYMFILES += grub_RISC_OS_syms.lst
+
+symlist.c: $(addprefix include/grub/,$(grub_RISC_OS_img_HEADERS)) gensymlist.sh
+	sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
+
+grub_RISC_OS_syms.lst: $(addprefix include/grub/,$(grub_RISC_OS_img_HEADERS)) genkernsyms.sh
+	sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
+
+# Utilities.
+#bin_UTILITIES = grub-mkimage
+#sbin_UTILITIES = grub-setup grub-emu
+noinst_UTILITIES = genmoddep
+
+# For grub-mkimage.
+grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
+	util/resolve.c
+grub_mkimage_LDFLAGS = -llzo
+
+# For grub-setup.
+grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
+	util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
+	kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \
+	kern/file.c kern/fs.c kern/env.c
+
+# For grub
+grub_emu_SOURCES = kern/main.c kern/device.c				\
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c		\
+        kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
+	disk/i386/pc/partition.c kern/env.c commands/ls.c		\
+	commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c		\
+	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c			\
+	normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c	\
+	util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c
+grub_emu_LDFLAGS = -lncurses
+
+# For genmoddep.
+genmoddep_SOURCES = util/genmoddep.c
+
+# Modules.
+pkgdata_MODULES = fat.mod ext2.mod normal.mod hello.mod \
+	 font.mod ls.mod boot.mod cmp.mod cat.mod terminal.mod
+
+# For fat.mod.
+fat_mod_SOURCES = fs/fat.c
+fat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ext2.mod.
+ext2_mod_SOURCES = fs/ext2.c
+ext2_mod_CFLAGS = $(COMMON_CFLAGS)
+
+
+# For normal.mod.
+normal_mod_SOURCES = normal/cmdline.c normal/command.c normal/main.c \
+	normal/menu.c normal/arg.c 
+normal_mod_CFLAGS = $(COMMON_CFLAGS)
+normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
+
+# For hello.mod.
+hello_mod_SOURCES = hello/hello.c
+hello_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For boot.mod.
+boot_mod_SOURCES = commands/boot.c
+boot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For terminal.mod.
+terminal_mod_SOURCES = commands/terminal.c
+terminal_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ls.mod.
+ls_mod_SOURCES = commands/ls.c
+ls_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cmp.mod.
+cmp_mod_SOURCES = commands/cmp.c
+cmp_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cat.mod.
+cat_mod_SOURCES = commands/cat.c
+cat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For font.mod.
+font_mod_SOURCES = font/manager.c
+font_mod_CFLAGS = $(COMMON_CFLAGS)
+
diff -urN grub2.orig/include/grub/arm/RISC_OS/console.h grub2.patch1/include/grub/arm/RISC_OS/console.h
--- grub2.orig/include/grub/arm/RISC_OS/console.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/RISC_OS/console.h	2004-05-20 19:56:35.000000000 +0100
@@ -0,0 +1,57 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002  Free Software Foundation, Inc.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_CONSOLE_MACHINE_HEADER
+#define GRUB_CONSOLE_MACHINE_HEADER	1
+
+/* Define scan codes.  */
+#define GRUB_CONSOLE_KEY_LEFT		0x4B00
+#define GRUB_CONSOLE_KEY_RIGHT		0x4D00
+#define GRUB_CONSOLE_KEY_UP		0x4800
+#define GRUB_CONSOLE_KEY_DOWN		0x5000
+#define GRUB_CONSOLE_KEY_IC		0x5200
+#define GRUB_CONSOLE_KEY_DC		0x5300
+#define GRUB_CONSOLE_KEY_BACKSPACE	0x0008
+#define GRUB_CONSOLE_KEY_HOME		0x4700
+#define GRUB_CONSOLE_KEY_END		0x4F00
+#define GRUB_CONSOLE_KEY_NPAGE		0x4900
+#define GRUB_CONSOLE_KEY_PPAGE		0x5100
+
+#ifndef ASM_FILE
+
+#include <grub/types.h>
+#include <grub/symbol.h>
+#include <grub/term.h>
+
+/* These are global to share code between C and asm.  */
+void grub_console_real_putchar (int c);
+int EXPORT_FUNC(grub_console_checkkey) (void);
+int EXPORT_FUNC(grub_console_getkey) (void);
+grub_uint16_t grub_console_getxy (void);
+void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y);
+void grub_console_cls (void);
+void grub_console_setcursor (int on);
+void grub_console_setcolourstate (grub_term_color_state state);
+
+/* Initialize the console system.  */
+void grub_console_init (void);
+
+#endif
+
+#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
diff -urN grub2.orig/include/grub/arm/RISC_OS/partition.h grub2.patch1/include/grub/arm/RISC_OS/partition.h
--- grub2.orig/include/grub/arm/RISC_OS/partition.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/RISC_OS/partition.h	2004-04-04 14:46:01.000000000 +0100
@@ -0,0 +1,242 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002  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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_PARTITION_HEADER
+#define GRUB_PARTITION_HEADER	1
+
+#include <grub/symbol.h>
+#include <grub/types.h>
+#include <grub/err.h>
+
+/* The signature.  */
+#define GRUB_PARTITION_SIGNATURE	0xaa55
+
+/* This is not a flag actually, but used as if it were a flag.  */
+#define GRUB_PARTITION_TYPE_HIDDEN_FLAG		0x10
+
+/* DOS partition types.  */
+#define GRUB_PARTITION_TYPE_NONE		0
+#define GRUB_PARTITION_TYPE_FAT12		1
+#define GRUB_PARTITION_TYPE_FAT16_LT32M		4
+#define GRUB_PARTITION_TYPE_EXTENDED		5
+#define GRUB_PARTITION_TYPE_FAT16_GT32M		6
+#define GRUB_PARTITION_TYPE_FAT32		0xb
+#define GRUB_PARTITION_TYPE_FAT32_LBA		0xc
+#define GRUB_PARTITION_TYPE_FAT16_LBA		0xe
+#define GRUB_PARTITION_TYPE_WIN95_EXTENDED	0xf
+#define GRUB_PARTITION_TYPE_EZD			0x55
+#define GRUB_PARTITION_TYPE_MINIX		0x80
+#define GRUB_PARTITION_TYPE_LINUX_MINIX		0x81
+#define GRUB_PARTITION_TYPE_EXT2FS		0x83
+#define GRUB_PARTITION_TYPE_LINUX_EXTENDED	0x85
+#define GRUB_PARTITION_TYPE_VSTAFS		0x9e
+#define GRUB_PARTITION_TYPE_FREEBSD		0xa5
+#define GRUB_PARTITION_TYPE_OPENBSD		0xa6
+#define GRUB_PARTITION_TYPE_NETBSD		0xa9
+#define GRUB_PARTITION_TYPE_LINUX_RAID		0xfd
+
+/* Constants for BSD disk label.  */
+#define GRUB_PARTITION_BSD_LABEL_SECTOR		1
+#define GRUB_PARTITION_BSD_LABEL_MAGIC		0x82564557
+#define GRUB_PARTITION_BSD_MAX_ENTRIES		8
+
+/* BSD partition types.  */
+#define GRUB_PARTITION_BSD_TYPE_UNUSED		0
+#define GRUB_PARTITION_BSD_TYPE_SWAP		1
+#define GRUB_PARTITION_BSD_TYPE_V6		2
+#define GRUB_PARTITION_BSD_TYPE_V7		3
+#define GRUB_PARTITION_BSD_TYPE_SYSV		4
+#define GRUB_PARTITION_BSD_TYPE_V71K		5
+#define GRUB_PARTITION_BSD_TYPE_V8		6
+#define GRUB_PARTITION_BSD_TYPE_BSDFFS		7
+#define GRUB_PARTITION_BSD_TYPE_MSDOS		8
+#define GRUB_PARTITION_BSD_TYPE_BSDLFS		9
+#define GRUB_PARTITION_BSD_TYPE_OTHER		10
+#define GRUB_PARTITION_BSD_TYPE_HPFS		11
+#define GRUB_PARTITION_BSD_TYPE_ISO9660		12
+#define GRUB_PARTITION_BSD_TYPE_BOOT		13
+
+/* FreeBSD-specific types.  */
+#define GRUB_PARTITION_FREEBSD_TYPE_VINUM	14
+#define GRUB_PARTITION_FREEBSD_TYPE_RAID	15
+#define GRUB_PARTITION_FREEBSD_TYPE_JFS2	21
+
+/* NetBSD-specific types.  */
+#define	GRUB_PARTITION_NETBSD_TYPE_ADOS		14
+#define	GRUB_PARTITION_NETBSD_TYPE_HFS		15
+#define	GRUB_PARTITION_NETBSD_TYPE_FILECORE	16
+#define	GRUB_PARTITION_NETBSD_TYPE_EXT2FS	17
+#define	GRUB_PARTITION_NETBSD_TYPE_NTFS		18
+#define	GRUB_PARTITION_NETBSD_TYPE_RAID		19
+#define	GRUB_PARTITION_NETBSD_TYPE_CCD		20
+#define	GRUB_PARTITION_NETBSD_TYPE_JFS2		21
+#define	GRUB_PARTITION_NETBSD_TYPE_APPLEUFS	22
+
+/* OpenBSD-specific types.  */
+#define	GRUB_PARTITION_OPENBSD_TYPE_ADOS	14
+#define	GRUB_PARTITION_OPENBSD_TYPE_HFS		15
+#define	GRUB_PARTITION_OPENBSD_TYPE_FILECORE	16
+#define	GRUB_PARTITION_OPENBSD_TYPE_EXT2FS	17
+#define	GRUB_PARTITION_OPENBSD_TYPE_NTFS	18
+#define	GRUB_PARTITION_OPENBSD_TYPE_RAID	19
+
+/* The BSD partition entry.  */
+struct grub_partition_bsd_entry
+{
+  grub_uint32_t size;
+  grub_uint32_t offset;
+  grub_uint32_t fragment_size;
+  grub_uint8_t fs_type;
+  grub_uint8_t fs_fragments;
+  grub_uint16_t fs_cylinders;
+} __attribute__ ((packed));
+
+/* The BSD disk label. Only define members useful for GRUB.  */
+struct grub_partition_disk_label
+{
+  grub_uint32_t magic;
+  grub_uint8_t padding[128];
+  grub_uint32_t magic2;
+  grub_uint16_t checksum;
+  grub_uint16_t num_partitions;
+  grub_uint32_t boot_size;
+  grub_uint32_t superblock_size;
+  struct grub_partition_bsd_entry entries[GRUB_PARTITION_BSD_MAX_ENTRIES];
+} __attribute__ ((packed));
+
+/* The partition entry.  */
+struct grub_partition_entry
+{
+  /* If active, 0x80, otherwise, 0x00.  */
+  grub_uint8_t flag;
+
+  /* The head of the start.  */
+  grub_uint8_t start_head;
+
+  /* (S | ((C >> 2) & 0xC0)) where S is the sector of the start and C
+     is the cylinder of the start. Note that S is counted from one.  */
+  grub_uint8_t start_sector;
+
+  /* (C & 0xFF) where C is the cylinder of the start.  */
+  grub_uint8_t start_cylinder;
+
+  /* The partition type.  */
+  grub_uint8_t type;
+
+  /* The end versions of start_head, start_sector and start_cylinder,
+     respectively.  */
+  grub_uint8_t end_head;
+  grub_uint8_t end_sector;
+  grub_uint8_t end_cylinder;
+
+  /* The start sector. Note that this is counted from zero.  */
+  grub_uint32_t start;
+
+  /* The length in sector units.  */
+  grub_uint32_t length;
+} __attribute__ ((packed));
+
+/* The structure of MBR.  */
+struct grub_partition_mbr
+{
+  /* The code area (actually, including BPB).  */
+  grub_uint8_t code[446];
+
+  /* Four partition entries.  */
+  struct grub_partition_entry entries[4];
+
+  /* The signature 0xaa55.  */
+  grub_uint16_t signature;
+} __attribute__ ((packed));
+
+/* Partition description.  */
+struct grub_partition
+{
+  /* The start sector.  */
+  unsigned long start;
+
+  /* The length in sector units.  */
+  unsigned long len;
+
+  /* The offset of the partition table.  */
+  unsigned long offset;
+
+  /* The offset of the extended partition.  */
+  unsigned long ext_offset;
+
+  /* The index of this partition in the partition table.  */
+  int index;
+  
+  /* The DOS partition number.  */
+  int dos_part;
+
+  /* The BSD partition number (a == 0).  */
+  int bsd_part;
+
+  /* The DOS partition type.  */
+  int dos_type;
+
+  /* The BSD partition type.  */
+  int bsd_type;
+};
+typedef struct grub_partition *grub_partition_t;
+
+struct grub_disk;
+
+grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
+						    const char *str);
+grub_err_t EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
+						int (*hook) (const grub_partition_t partition));
+char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
+
+static inline unsigned long
+grub_partition_get_start (const grub_partition_t p)
+{
+  return p->start;
+}
+
+static inline unsigned long
+grub_partition_get_len (const grub_partition_t p)
+{
+  return p->len;
+}
+
+static inline int
+grub_partition_is_empty (int type)
+{
+  return (type == GRUB_PARTITION_TYPE_NONE);
+}
+
+static inline int
+grub_partition_is_extended (int type)
+{
+  return (type == GRUB_PARTITION_TYPE_EXTENDED
+	  || type == GRUB_PARTITION_TYPE_WIN95_EXTENDED
+	  || type == GRUB_PARTITION_TYPE_LINUX_EXTENDED);
+}
+
+static inline int
+grub_partition_is_bsd (int type)
+{
+  return (type == GRUB_PARTITION_TYPE_FREEBSD
+	  || type == GRUB_PARTITION_TYPE_OPENBSD
+	  || type == GRUB_PARTITION_TYPE_NETBSD);
+}
+
+#endif /* ! GRUB_PARTITION_HEADER */
diff -urN grub2.orig/include/grub/arm/RISC_OS/time.h grub2.patch1/include/grub/arm/RISC_OS/time.h
--- grub2.orig/include/grub/arm/RISC_OS/time.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/RISC_OS/time.h	2004-05-19 10:55:26.000000000 +0100
@@ -0,0 +1,33 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2003  Free Software Foundation, Inc.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef KERNEL_TIME_HEADER
+#define KERNEL_TIME_HEADER	1
+
+#ifdef GRUB_UTIL
+# include <time.h>
+# define GRUB_TICKS_PER_SECOND	CLOCKS_PER_SEC
+#else
+# define GRUB_TICKS_PER_SECOND	100
+#endif
+
+/* Return the real time in ticks.  */
+grub_uint32_t grub_get_rtc (void);
+
+#endif /* ! KERNEL_TIME_HEADER */
diff -urN grub2.orig/include/grub/arm/setjmp.h grub2.patch1/include/grub/arm/setjmp.h
--- grub2.orig/include/grub/arm/setjmp.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/setjmp.h	2004-05-19 00:39:16.000000000 +0100
@@ -0,0 +1,25 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2003  Free Software Foundation, Inc.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_SETJMP_CPU_HEADER
+#define GRUB_SETJMP_CPU_HEADER	1
+
+typedef unsigned long grub_jmp_buf[11];
+
+#endif /* ! GRUB_SETJMP_CPU_HEADER */
diff -urN grub2.orig/include/grub/arm/types.h grub2.patch1/include/grub/arm/types.h
--- grub2.orig/include/grub/arm/types.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/types.h	2004-05-19 00:41:04.000000000 +0100
@@ -0,0 +1,32 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002  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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_TYPES_CPU_HEADER
+#define GRUB_TYPES_CPU_HEADER	1
+
+/* The size of void *.  */
+#define GRUB_HOST_SIZEOF_VOID_P	4
+
+/* The size of long.  */
+#define GRUB_HOST_SIZEOF_LONG	4
+
+/* ARM is little-endian. (Or big-endian!! - but we don't support that yet) */
+#undef GRUB_HOST_WORDS_BIGENDIAN
+
+#endif /* ! GRUB_TYPES_CPU_HEADER */
diff -urN grub2.orig/include/grub/symbol.h grub2.patch1/include/grub/symbol.h
--- grub2.orig/include/grub/symbol.h	2004-05-21 12:14:37.000000000 +0100
+++ grub2.patch1/include/grub/symbol.h	2004-05-18 22:48:26.000000000 +0100
@@ -29,8 +29,8 @@
 # define EXT_C(sym)	sym
 #endif
 
-#define FUNCTION(x)	.globl EXT_C(x) ; .type EXT_C(x), @function ; EXT_C(x):
-#define VARIABLE(x)	.globl EXT_C(x) ; .type EXT_C(x), @object ; EXT_C(x):
+#define FUNCTION(x)	.globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
+#define VARIABLE(x)	.globl EXT_C(x) ; .type EXT_C(x), "object" ; EXT_C(x):
 
 /* Mark an exported symbol.  */
 #define EXPORT_FUNC(x)	x
diff -urN grub2.orig/kern/arm/aif_header.lds grub2.patch1/kern/arm/aif_header.lds
--- grub2.orig/kern/arm/aif_header.lds	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/aif_header.lds	2004-05-21 11:55:49.000000000 +0100
@@ -0,0 +1,23 @@
+/* aif_header.lds - Calculate values for AIF header */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+grub_aif_text_size = __data_start - 0x8000;
+grub_aif_data_size = _edata - __data_start;
+grub_aif_bss_size = _end - _edata;
diff -urN grub2.orig/kern/arm/aif_header.S grub2.patch1/kern/arm/aif_header.S
--- grub2.orig/kern/arm/aif_header.S	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/aif_header.S	2004-05-21 11:55:54.000000000 +0100
@@ -0,0 +1,68 @@
+/* aif_header.S - AIF header */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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
+ *  aword with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+
+	.global	_start
+_start:	nop
+	nop
+	bl	zeroinit
+	bl	grub_arm_startup
+lock:	b	lock	@ "Program exit instruction" (never reached)
+	.word	grub_aif_text_size
+	.word	grub_aif_data_size
+	.word	0	@ Debug data size
+zisize:	.word	grub_aif_bss_size
+	.word	0	@ No Debug data
+	.word	_start
+	.word	0	@ Workspace for self-moving image (not used)
+	.word	32	@ Yes, we work in 32bit PC modes.
+	.word	__data_start
+	.word	0, 0 	@ Unused
+	nop		@ Initialise debugger (NOT!!)
+	
+zeroinit:
+	ldr	r0, =__bss_start
+	ldr	r4, zisize
+	
+	@ Move appended modules out of the way
+	add	r1, r0, r4
+	ldr	r2, EXT_C(grub_total_module_size)
+1:	ldr	r3, [r0, r2]
+	str	r3, [r1, r2]
+	subs	r2, r2, #4
+	bcs	1b
+	
+	@ Zero BSS area
+	mov	r1, #0	
+1:	str	r1, [r0], #4	
+	subs	r4, r4, #4
+	bcs	1b
+	mov	pc, lr
+
+	.ltorg
+	.org	_start + 128
+	
+	@ Size of appended modules
+VARIABLE(grub_total_module_size)
+	.word	0	
+VARIABLE(grub_end_addr)
+	.word	_end
diff -urN grub2.orig/kern/arm/RISC_OS/init.c grub2.patch1/kern/arm/RISC_OS/init.c
--- grub2.orig/kern/arm/RISC_OS/init.c	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/RISC_OS/init.c	2004-05-21 11:38:09.000000000 +0100
@@ -0,0 +1,40 @@
+/* init.c - RISC OS Initialisation */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/kernel.h>
+#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/machine/console.h>
+#include <grub/env.h>
+
+extern grub_addr_t grub_RISC_OS_memory_limit;
+
+void
+grub_machine_init ()
+{
+  //grub_RISC_OS_message("Hello World!\n\r");
+  grub_console_init ();
+  grub_mm_init_region ((void *) grub_end_addr + grub_total_module_size,
+		       grub_RISC_OS_memory_limit - (grub_end_addr +
+						    grub_total_module_size));
+  grub_env_set ("prefix", "(native)ADFS::0/$");
+  grub_printf ("Hello World!\n");
+  //grub_stop();
+}
diff -urN grub2.orig/kern/arm/RISC_OS/startup.S grub2.patch1/kern/arm/RISC_OS/startup.S
--- grub2.orig/kern/arm/RISC_OS/startup.S	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/RISC_OS/startup.S	2004-05-21 11:59:14.000000000 +0100
@@ -0,0 +1,119 @@
+/* startup.S - RISC OS Initialisation*/
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+
+#define OS_ChangeEnvironment 0x40
+#define OS_GenerateError 0x2B
+#define OS_Exit 0x11
+#define OS_CLI 0x05
+#define OS_ReadMonotonicTime 0x42
+
+
+	.data
+handlers:
+	.word	0
+VARIABLE(grub_RISC_OS_memory_limit)
+	.word	0, 0, 0
+	.word	6, error_handler, 0, error_buffer
+	.word	11, grub_stop, 0, 0
+	.word	13, exception_registers, 0, 0
+	.word	14
+VARIABLE(grub_RISC_OS_application_space)
+	.word	0, 0, 0
+	.word	16, upcall_handler, 0, 0
+	
+	.text
+swap_handlers:
+	mov	r5, lr
+	ldr	r4, =handlers
+1:	ldmia	r4, {r0-r3}
+	swi	OS_ChangeEnvironment
+	stmia	r4!, {r0-r3}
+	teq	r0, #16
+	bne	1b
+	mov	pc, r5
+	
+error_handler:
+	@ TODO: do longjmp
+	mov	r6, r0
+	bl	swap_handlers
+	add	r0, r6, #4
+	swi	OS_GenerateError
+	
+upcall_handler:
+	subs	r0, r0, #256
+	moveq	pc, lr
+	@beq	upcall_newapp
+	teq	r0, #1
+	add	r0, r0, #256
+	@beq	upcall_movemem
+	movne	pc, lr
+upcall_movemem:
+	movs	r1, r1
+	movpl	r0, #0
+	mov	pc, lr
+	
+upcall_newapp:
+	@stmfd	sp!, {r0-r5, lr}
+	@bl	swap_handlers
+	@ldmfd	sp!, {r0-r5, pc}
+	
+	.globl	grub_arm_startup
+grub_arm_startup:
+	ldr	sp, =stack_end
+	bl	swap_handlers
+	mov	fp, #0
+	bl	grub_main
+FUNCTION(grub_stop)
+	@ TODO: at_exit
+	ldr	sp, =stack_end
+	bl	swap_handlers
+	mov	r0, #0
+	swi	OS_Exit
+	
+FUNCTION(grub_RISC_OS_chain)
+	mov	r6, r0
+	ldr	sp, =stack_end
+	bl	swap_handlers
+	mov	r0, r5
+	mov	r1, #0
+	swi	OS_CLI
+	swi	OS_Exit
+	
+FUNCTION(grub_get_rtc)
+	swi	OS_ReadMonotonicTime
+	mov	pc, lr
+	
+
+	.bss
+stack_limit:
+	.space	0x4000
+stack_end:
+exception_registers:
+	.space	17 * 4
+error_buffer:
+	.space	260
+	
+VARIABLE(grub_os_area_addr)
+VARIABLE(grub_os_area_size)
+colourstate:
+	.space	4
diff -urN grub2.orig/kern/arm/setjmp.S grub2.patch1/kern/arm/setjmp.S
--- grub2.orig/kern/arm/setjmp.S	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/setjmp.S	2004-05-21 11:55:46.000000000 +0100
@@ -0,0 +1,31 @@
+/* aif_header.S - setjmp and longjmp */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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
+ *  aword with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+ 
+FUNCTION(grub_setjmp)
+	stmia	r0, {r4-r14}
+	mov	pc, lr
+	
+FUNCTION(grub_longjmp)
+	ldmia	r0, {r4-r14}
+	mov	r0, r1
+	mov	pc, lr
diff -urN grub2.orig/term/arm/RISC_OS/console-asm.S grub2.patch1/term/arm/RISC_OS/console-asm.S
--- grub2.orig/term/arm/RISC_OS/console-asm.S	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/term/arm/RISC_OS/console-asm.S	2004-05-21 11:59:12.000000000 +0100
@@ -0,0 +1,92 @@
+/* startup.S - RISC OS Console*/
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+
+#define OS_Write0 0x02
+#define OS_WriteC 0x00
+#define OS_WriteI 0x100
+#define OS_WriteN 0x46
+#define OS_Byte 0x06
+#define OS_ReadC 0x04
+
+FUNCTION(grub_RISC_OS_message)
+	swi	OS_Write0
+	mov	pc, lr
+	
+FUNCTION(grub_console_gotoxy)
+	swi	OS_WriteI + 31
+	swi	OS_WriteC
+	mov	r0, r1
+FUNCTION(grub_console_real_putchar)
+	swi	OS_WriteC
+	mov	pc, lr
+	
+FUNCTION(grub_console_getxy)
+	mov	r0, #165
+	swi	OS_Byte
+	orr	r0, r2, r1, lsl #8
+	mov	pc, lr
+
+FUNCTION(grub_console_setcursor)
+	swi	OS_WriteI + 23
+	swi	OS_WriteI + 1
+	swi	OS_WriteC
+pnulls:	adr	r0, nulls
+	mov	r1, #8
+	swi	OS_WriteN
+	mov	pc, lr
+	
+FUNCTION(grub_console_setcolourstate)
+	ldr	r2, =colourstate
+	and	r0, r0, #2
+	ldrb	r1, [r2]
+	teq	r0, r1
+	moveq	pc, lr
+	strb	r0, [r2]
+	swi	OS_WriteI + 23	@ Swap text foreground/background colours
+	swi	OS_WriteI + 17
+	swi	OS_WriteI + 5
+	b	pnulls
+	
+	
+FUNCTION(grub_console_cls)
+	swi	OS_WriteI + 12
+	mov	pc, lr
+	
+FUNCTION(grub_console_getkey)
+	swi	OS_ReadC
+	mov	pc, lr
+
+FUNCTION(grub_console_checkkey)
+	mov	r0, #129	@ Read key with time limit
+	mov	r1, #0		@ Timeout low byte
+	mov	r2, #0		@ Timeout high byte ( < 0x80 )
+	swi	OS_Byte
+	movs	r2, r2		@ r2 = 0 if key read
+	moveq	r0, r1		@ r1 = key if read
+	mvnne	r0, #0
+	mov	pc, lr
+
+	.bss
+colourstate:
+	.space	4
+	
\ No newline at end of file
diff -urN grub2.orig/term/arm/RISC_OS/console.c grub2.patch1/term/arm/RISC_OS/console.c
--- grub2.orig/term/arm/RISC_OS/console.c	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/term/arm/RISC_OS/console.c	2004-05-20 19:38:23.000000000 +0100
@@ -0,0 +1,97 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002,2003  Free Software Foundation, Inc.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/machine/console.h>
+#include <grub/term.h>
+#include <grub/types.h>
+
+
+static void
+grub_console_putchar (grub_uint32_t c)
+{
+  if (c > 0x7f)
+    {
+      /* Map some unicode characters to the VGA font, if possible.  */
+      switch (c)
+	{
+	case 0x2190:	/* left arrow */
+	  c = 0x1b;
+	  break;
+	case 0x2191:	/* up arrow */
+	  c = 0x18;
+	  break;
+	case 0x2192:	/* right arrow */
+	  c = 0x1a;
+	  break;
+	case 0x2193:	/* down arrow */
+	  c = 0x19;
+	  break;
+	case 0x2501:	/* horizontal line */
+	  c = 0xc4;
+	  break;
+	case 0x2503:	/* vertical line */
+	  c = 0xb3;
+	  break;
+	case 0x250F:	/* upper-left corner */
+	  c = 0xda;
+	  break;
+	case 0x2513:	/* upper-right corner */
+	  c = 0xbf;
+	  break;
+	case 0x2517:	/* lower-left corner */
+	  c = 0xc0;
+	  break;
+	case 0x251B:	/* lower-right corner */
+	  c = 0xd9;
+	  break;
+
+	default:
+	  c = '?';
+	  break;
+	}
+    }
+
+  grub_console_real_putchar (c);
+}
+
+
+static struct grub_term grub_console_term =
+  {
+    .name = "console",
+    .init = 0,
+    .fini = 0,
+    .putchar = grub_console_putchar,
+    .checkkey = grub_console_checkkey,
+    .getkey = grub_console_getkey,
+    .getxy = grub_console_getxy,
+    .gotoxy = grub_console_gotoxy,
+    .cls = grub_console_cls,
+    .setcolorstate = grub_console_setcolourstate,
+    .setcolor = 0,
+    .setcursor = grub_console_setcursor,
+    .flags = 0,
+    .next = 0
+  };
+
+void
+grub_console_init (void)
+{
+  grub_term_register (&grub_console_term);
+  grub_term_set_current (&grub_console_term);
+}

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RISC OS/ARM port
@ 2004-05-22 12:46 Timothy Baldwin
  0 siblings, 0 replies; 9+ messages in thread
From: Timothy Baldwin @ 2004-05-22 12:46 UTC (permalink / raw)
  To: grub-devel


[-- Attachment #1.1: Type: text/plain, Size: 1603 bytes --]


I am working on a port to (ex-Acorn) RISC OS, which currently gets as far as 
rescue mode.

RISC OS is supplied in ROM or flash with many systems, including desktop 
systems made by Acorn and it's sucessors, various set-top boxes, and the Bush 
Internet TV.  I have used upper case thoughout for RISC OS as riscos is a 
different operating system.

Things to do:
Discs and partitions.
RISC OS native filesystem access.
Network support (using BSD sockets).
Colour and graphic console support.
An interface for writing to files.
A file copy command, to use when upgrading grub.
Serial port support.
Security (disabling keyboard drivers during boot)
Access to RISC OS commands.
A memory defragmenter.
And some OS loaders of course.


How should console errors be handled? Currently they are fatal, and won't 
happen unless the console is redirected (assuming USB drivers don't 
complain).

Currently in the design of GRUB 2 there is an incorrect asumption that filing 
systems are either based on disks or networks. I propose to rectify this 
whilst keeping code size down by:

Creating a struct grub_fs_device_driver, which contains a pointer to either 
struct grub_disk_dev or struct grub_net_dev, and maintain a single linked 
list of disk drivers, net drivers, and standalone filing systems.

Convert struct grub_device from pointers to a unoin to simplify the code by 
removing memory allocations.

-- 
Member AFFS, WYLUG, SWP (UK), ANL, RESPECT, Leeds SA, Leeds Anti-war coalition
No to software patents!    No to DRM/EUCD - hands off our computers!





[-- Attachment #1.2: patch1.diff --]
[-- Type: text/x-diff, Size: 66327 bytes --]

--- grub2.orig/configure.ac     2004-05-21 12:14:37.000000000 +0100
+++ grub2.patch1/configure.ac   2004-05-19 00:26:16.000000000 +0100
@@ -23,12 +23,14 @@
 case "$host_cpu" in
   i[[3456]]86) host_cpu=i386 ;;
   powerpc) ;;
+  arm) ;;
   *) AC_MSG_ERROR([unsupported CPU type]) ;;
 esac
 
 case "$host_cpu"-"$host_vendor" in
   i386-*) host_vendor=pc ;;
   powerpc-*) host_vendor=ieee1275 ;;
+  arm-*) host_vendor=RISC_OS ;;
   *) AC_MSG_ERROR([unsupported machine type]) ;;
 esac
 
diff -urN grub2.orig/conf/arm-RISC_OS.mk grub2.patch1/conf/arm-RISC_OS.mk
--- grub2.orig/conf/arm-RISC_OS.mk	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/conf/arm-RISC_OS.mk	2004-05-21 12:00:01.000000000 +0100
@@ -0,0 +1,696 @@
+# -*- makefile -*-
+
+COMMON_ASFLAGS = -nostdinc -fno-builtin
+COMMON_CFLAGS = -fno-builtin
+
+# Images.
+pkgdata_IMAGES = grub_RISC_OS.img
+
+
+# For grub_RISC_OS.img.
+grub_RISC_OS_img_SOURCES = kern/arm/aif_header.S kern/main.c kern/device.c \
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
+	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
+	kern/i386/dl.c kern/arm/RISC_OS/startup.S kern/arm/setjmp.S\
+	kern/env.c kern/arm/RISC_OS/init.c disk/i386/pc/partition.c\
+	term/arm/RISC_OS/console.c term/arm/RISC_OS/console-asm.S\
+	symlist.c
+CLEANFILES += grub_RISC_OS.img grub_RISC_OS.exec grub_RISC_OS_img-kern_arm_aif_header.o grub_RISC_OS_img-kern_main.o grub_RISC_OS_img-kern_device.o grub_RISC_OS_img-kern_disk.o grub_RISC_OS_img-kern_dl.o grub_RISC_OS_img-kern_file.o grub_RISC_OS_img-kern_fs.o grub_RISC_OS_img-kern_err.o grub_RISC_OS_img-kern_misc.o grub_RISC_OS_img-kern_mm.o grub_RISC_OS_img-kern_loader.o grub_RISC_OS_img-kern_rescue.o grub_RISC_OS_img-kern_term.o grub_RISC_OS_img-kern_i386_dl.o grub_RISC_OS_img-kern_arm_RISC_OS_startup.o grub_RISC_OS_img-kern_arm_setjmp.o grub_RISC_OS_img-kern_env.o grub_RISC_OS_img-kern_arm_RISC_OS_init.o grub_RISC_OS_img-disk_i386_pc_partition.o grub_RISC_OS_img-term_arm_RISC_OS_console.o grub_RISC_OS_img-term_arm_RISC_OS_console_asm.o grub_RISC_OS_img-symlist.o
+MOSTLYCLEANFILES += grub_RISC_OS_img-kern_arm_aif_header.d grub_RISC_OS_img-kern_main.d grub_RISC_OS_img-kern_device.d grub_RISC_OS_img-kern_disk.d grub_RISC_OS_img-kern_dl.d grub_RISC_OS_img-kern_file.d grub_RISC_OS_img-kern_fs.d grub_RISC_OS_img-kern_err.d grub_RISC_OS_img-kern_misc.d grub_RISC_OS_img-kern_mm.d grub_RISC_OS_img-kern_loader.d grub_RISC_OS_img-kern_rescue.d grub_RISC_OS_img-kern_term.d grub_RISC_OS_img-kern_i386_dl.d grub_RISC_OS_img-kern_arm_RISC_OS_startup.d grub_RISC_OS_img-kern_arm_setjmp.d grub_RISC_OS_img-kern_env.d grub_RISC_OS_img-kern_arm_RISC_OS_init.d grub_RISC_OS_img-disk_i386_pc_partition.d grub_RISC_OS_img-term_arm_RISC_OS_console.d grub_RISC_OS_img-term_arm_RISC_OS_console_asm.d grub_RISC_OS_img-symlist.d
+
+grub_RISC_OS.img: grub_RISC_OS.exec
+	$(OBJCOPY) -O binary -R .note -R .comment $< $@
+
+grub_RISC_OS.exec: grub_RISC_OS_img-kern_arm_aif_header.o grub_RISC_OS_img-kern_main.o grub_RISC_OS_img-kern_device.o grub_RISC_OS_img-kern_disk.o grub_RISC_OS_img-kern_dl.o grub_RISC_OS_img-kern_file.o grub_RISC_OS_img-kern_fs.o grub_RISC_OS_img-kern_err.o grub_RISC_OS_img-kern_misc.o grub_RISC_OS_img-kern_mm.o grub_RISC_OS_img-kern_loader.o grub_RISC_OS_img-kern_rescue.o grub_RISC_OS_img-kern_term.o grub_RISC_OS_img-kern_i386_dl.o grub_RISC_OS_img-kern_arm_RISC_OS_startup.o grub_RISC_OS_img-kern_arm_setjmp.o grub_RISC_OS_img-kern_env.o grub_RISC_OS_img-kern_arm_RISC_OS_init.o grub_RISC_OS_img-disk_i386_pc_partition.o grub_RISC_OS_img-term_arm_RISC_OS_console.o grub_RISC_OS_img-term_arm_RISC_OS_console_asm.o grub_RISC_OS_img-symlist.o
+	$(CC) -o $@ $^ $(LDFLAGS) $(grub_RISC_OS_img_LDFLAGS)
+
+grub_RISC_OS_img-kern_arm_aif_header.o: kern/arm/aif_header.S
+	$(CC) -Ikern/arm -I$(srcdir)/kern/arm $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_arm_aif_header.d: kern/arm/aif_header.S
+	set -e; 	  $(CC) -Ikern/arm -I$(srcdir)/kern/arm $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -M $< 	  | sed 's,aif_header\.o[ :]*,grub_RISC_OS_img-kern_arm_aif_header.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_arm_aif_header.d
+
+grub_RISC_OS_img-kern_main.o: kern/main.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_main.d: kern/main.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,main\.o[ :]*,grub_RISC_OS_img-kern_main.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_main.d
+
+grub_RISC_OS_img-kern_device.o: kern/device.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_device.d: kern/device.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,device\.o[ :]*,grub_RISC_OS_img-kern_device.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_device.d
+
+grub_RISC_OS_img-kern_disk.o: kern/disk.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_disk.d: kern/disk.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,disk\.o[ :]*,grub_RISC_OS_img-kern_disk.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_disk.d
+
+grub_RISC_OS_img-kern_dl.o: kern/dl.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_dl.d: kern/dl.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,dl\.o[ :]*,grub_RISC_OS_img-kern_dl.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_dl.d
+
+grub_RISC_OS_img-kern_file.o: kern/file.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_file.d: kern/file.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,file\.o[ :]*,grub_RISC_OS_img-kern_file.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_file.d
+
+grub_RISC_OS_img-kern_fs.o: kern/fs.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_fs.d: kern/fs.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,fs\.o[ :]*,grub_RISC_OS_img-kern_fs.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_fs.d
+
+grub_RISC_OS_img-kern_err.o: kern/err.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_err.d: kern/err.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,err\.o[ :]*,grub_RISC_OS_img-kern_err.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_err.d
+
+grub_RISC_OS_img-kern_misc.o: kern/misc.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_misc.d: kern/misc.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,misc\.o[ :]*,grub_RISC_OS_img-kern_misc.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_misc.d
+
+grub_RISC_OS_img-kern_mm.o: kern/mm.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_mm.d: kern/mm.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,mm\.o[ :]*,grub_RISC_OS_img-kern_mm.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_mm.d
+
+grub_RISC_OS_img-kern_loader.o: kern/loader.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_loader.d: kern/loader.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,loader\.o[ :]*,grub_RISC_OS_img-kern_loader.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_loader.d
+
+grub_RISC_OS_img-kern_rescue.o: kern/rescue.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_rescue.d: kern/rescue.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,rescue\.o[ :]*,grub_RISC_OS_img-kern_rescue.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_rescue.d
+
+grub_RISC_OS_img-kern_term.o: kern/term.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_term.d: kern/term.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,term\.o[ :]*,grub_RISC_OS_img-kern_term.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_term.d
+
+grub_RISC_OS_img-kern_i386_dl.o: kern/i386/dl.c
+	$(CC) -Ikern/i386 -I$(srcdir)/kern/i386 $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_i386_dl.d: kern/i386/dl.c
+	set -e; 	  $(CC) -Ikern/i386 -I$(srcdir)/kern/i386 $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,dl\.o[ :]*,grub_RISC_OS_img-kern_i386_dl.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_i386_dl.d
+
+grub_RISC_OS_img-kern_arm_RISC_OS_startup.o: kern/arm/RISC_OS/startup.S
+	$(CC) -Ikern/arm/RISC_OS -I$(srcdir)/kern/arm/RISC_OS $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_arm_RISC_OS_startup.d: kern/arm/RISC_OS/startup.S
+	set -e; 	  $(CC) -Ikern/arm/RISC_OS -I$(srcdir)/kern/arm/RISC_OS $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -M $< 	  | sed 's,startup\.o[ :]*,grub_RISC_OS_img-kern_arm_RISC_OS_startup.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_arm_RISC_OS_startup.d
+
+grub_RISC_OS_img-kern_arm_setjmp.o: kern/arm/setjmp.S
+	$(CC) -Ikern/arm -I$(srcdir)/kern/arm $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_arm_setjmp.d: kern/arm/setjmp.S
+	set -e; 	  $(CC) -Ikern/arm -I$(srcdir)/kern/arm $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -M $< 	  | sed 's,setjmp\.o[ :]*,grub_RISC_OS_img-kern_arm_setjmp.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_arm_setjmp.d
+
+grub_RISC_OS_img-kern_env.o: kern/env.c
+	$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_env.d: kern/env.c
+	set -e; 	  $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,env\.o[ :]*,grub_RISC_OS_img-kern_env.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_env.d
+
+grub_RISC_OS_img-kern_arm_RISC_OS_init.o: kern/arm/RISC_OS/init.c
+	$(CC) -Ikern/arm/RISC_OS -I$(srcdir)/kern/arm/RISC_OS $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-kern_arm_RISC_OS_init.d: kern/arm/RISC_OS/init.c
+	set -e; 	  $(CC) -Ikern/arm/RISC_OS -I$(srcdir)/kern/arm/RISC_OS $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,init\.o[ :]*,grub_RISC_OS_img-kern_arm_RISC_OS_init.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-kern_arm_RISC_OS_init.d
+
+grub_RISC_OS_img-disk_i386_pc_partition.o: disk/i386/pc/partition.c
+	$(CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-disk_i386_pc_partition.d: disk/i386/pc/partition.c
+	set -e; 	  $(CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,partition\.o[ :]*,grub_RISC_OS_img-disk_i386_pc_partition.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-disk_i386_pc_partition.d
+
+grub_RISC_OS_img-term_arm_RISC_OS_console.o: term/arm/RISC_OS/console.c
+	$(CC) -Iterm/arm/RISC_OS -I$(srcdir)/term/arm/RISC_OS $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-term_arm_RISC_OS_console.d: term/arm/RISC_OS/console.c
+	set -e; 	  $(CC) -Iterm/arm/RISC_OS -I$(srcdir)/term/arm/RISC_OS $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,console\.o[ :]*,grub_RISC_OS_img-term_arm_RISC_OS_console.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-term_arm_RISC_OS_console.d
+
+grub_RISC_OS_img-term_arm_RISC_OS_console_asm.o: term/arm/RISC_OS/console-asm.S
+	$(CC) -Iterm/arm/RISC_OS -I$(srcdir)/term/arm/RISC_OS $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-term_arm_RISC_OS_console_asm.d: term/arm/RISC_OS/console-asm.S
+	set -e; 	  $(CC) -Iterm/arm/RISC_OS -I$(srcdir)/term/arm/RISC_OS $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(grub_RISC_OS_img_ASFLAGS) -M $< 	  | sed 's,console\-asm\.o[ :]*,grub_RISC_OS_img-term_arm_RISC_OS_console_asm.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-term_arm_RISC_OS_console_asm.d
+
+grub_RISC_OS_img-symlist.o: symlist.c
+	$(CC) -I. -I$(srcdir)/. $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -c -o $@ $<
+
+grub_RISC_OS_img-symlist.d: symlist.c
+	set -e; 	  $(CC) -I. -I$(srcdir)/. $(CPPFLAGS)  $(CFLAGS) $(grub_RISC_OS_img_CFLAGS) -M $< 	  | sed 's,symlist\.o[ :]*,grub_RISC_OS_img-symlist.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include grub_RISC_OS_img-symlist.d
+
+grub_RISC_OS_img_HEADERS = boot.h device.h disk.h dl.h elf.h err.h \
+	file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \
+	term.h types.h arg.h env.h
+grub_RISC_OS_img_CFLAGS = $(COMMON_CFLAGS)
+grub_RISC_OS_img_ASFLAGS = $(COMMON_ASFLAGS)
+grub_RISC_OS_img_LDFLAGS =  `$(CC) -print-libgcc-file-name` $(srcdir)/kern/arm/aif_header.lds -nostdlib -Wl,-N,-Ttext,8000
+
+MOSTLYCLEANFILES += symlist.c grub_RISC_OS_syms.lst
+DEFSYMFILES += grub_RISC_OS_syms.lst
+
+symlist.c: $(addprefix include/grub/,$(grub_RISC_OS_img_HEADERS)) gensymlist.sh
+	sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
+
+grub_RISC_OS_syms.lst: $(addprefix include/grub/,$(grub_RISC_OS_img_HEADERS)) genkernsyms.sh
+	sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
+
+# Utilities.
+#bin_UTILITIES = grub-mkimage
+#sbin_UTILITIES = grub-setup grub-emu
+noinst_UTILITIES = genmoddep
+
+# For grub-mkimage.
+grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
+	util/resolve.c
+grub_mkimage_LDFLAGS = -llzo
+
+# For grub-setup.
+grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
+	util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
+	kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \
+	kern/file.c kern/fs.c kern/env.c
+
+# For grub
+grub_emu_SOURCES = kern/main.c kern/device.c				\
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c		\
+        kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
+	disk/i386/pc/partition.c kern/env.c commands/ls.c		\
+	commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c		\
+	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c			\
+	normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c	\
+	util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c
+grub_emu_LDFLAGS = -lncurses
+
+# For genmoddep.
+genmoddep_SOURCES = util/genmoddep.c
+CLEANFILES += genmoddep genmoddep-util_genmoddep.o
+MOSTLYCLEANFILES += genmoddep-util_genmoddep.d
+
+genmoddep: genmoddep-util_genmoddep.o
+	$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(genmoddep_LDFLAGS)
+
+genmoddep-util_genmoddep.o: util/genmoddep.c
+	$(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -c -o $@ $<
+
+genmoddep-util_genmoddep.d: util/genmoddep.c
+	set -e; 	  $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -M $< 	  | sed 's,genmoddep\.o[ :]*,genmoddep-util_genmoddep.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include genmoddep-util_genmoddep.d
+
+
+# Modules.
+pkgdata_MODULES = fat.mod ext2.mod normal.mod hello.mod \
+	 font.mod ls.mod boot.mod cmp.mod cat.mod terminal.mod
+
+# For fat.mod.
+fat_mod_SOURCES = fs/fat.c
+CLEANFILES += fat.mod mod-fat.o mod-fat.c pre-fat.o fat_mod-fs_fat.o def-fat.lst und-fat.lst
+MOSTLYCLEANFILES += fat_mod-fs_fat.d
+DEFSYMFILES += def-fat.lst
+UNDSYMFILES += und-fat.lst
+
+fat.mod: pre-fat.o mod-fat.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-fat.o: fat_mod-fs_fat.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-fat.o: mod-fat.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(fat_mod_CFLAGS) -c -o $@ $<
+
+mod-fat.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'fat' $< > $@ || (rm -f $@; exit 1)
+
+def-fat.lst: pre-fat.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 fat/' > $@
+
+und-fat.lst: pre-fat.o
+	echo 'fat' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+fat_mod-fs_fat.o: fs/fat.c
+	$(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(fat_mod_CFLAGS) -c -o $@ $<
+
+fat_mod-fs_fat.d: fs/fat.c
+	set -e; 	  $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(fat_mod_CFLAGS) -M $< 	  | sed 's,fat\.o[ :]*,fat_mod-fs_fat.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include fat_mod-fs_fat.d
+
+fat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ext2.mod.
+ext2_mod_SOURCES = fs/ext2.c
+CLEANFILES += ext2.mod mod-ext2.o mod-ext2.c pre-ext2.o ext2_mod-fs_ext2.o def-ext2.lst und-ext2.lst
+MOSTLYCLEANFILES += ext2_mod-fs_ext2.d
+DEFSYMFILES += def-ext2.lst
+UNDSYMFILES += und-ext2.lst
+
+ext2.mod: pre-ext2.o mod-ext2.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-ext2.o: ext2_mod-fs_ext2.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-ext2.o: mod-ext2.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(ext2_mod_CFLAGS) -c -o $@ $<
+
+mod-ext2.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'ext2' $< > $@ || (rm -f $@; exit 1)
+
+def-ext2.lst: pre-ext2.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ext2/' > $@
+
+und-ext2.lst: pre-ext2.o
+	echo 'ext2' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+ext2_mod-fs_ext2.o: fs/ext2.c
+	$(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(ext2_mod_CFLAGS) -c -o $@ $<
+
+ext2_mod-fs_ext2.d: fs/ext2.c
+	set -e; 	  $(CC) -Ifs -I$(srcdir)/fs $(CPPFLAGS) $(CFLAGS) $(ext2_mod_CFLAGS) -M $< 	  | sed 's,ext2\.o[ :]*,ext2_mod-fs_ext2.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include ext2_mod-fs_ext2.d
+
+ext2_mod_CFLAGS = $(COMMON_CFLAGS)
+
+
+# For normal.mod.
+normal_mod_SOURCES = normal/cmdline.c normal/command.c normal/main.c \
+	normal/menu.c normal/arg.c 
+CLEANFILES += normal.mod mod-normal.o mod-normal.c pre-normal.o normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_arg.o def-normal.lst und-normal.lst
+MOSTLYCLEANFILES += normal_mod-normal_cmdline.d normal_mod-normal_command.d normal_mod-normal_main.d normal_mod-normal_menu.d normal_mod-normal_arg.d
+DEFSYMFILES += def-normal.lst
+UNDSYMFILES += und-normal.lst
+
+normal.mod: pre-normal.o mod-normal.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-normal.o: normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_arg.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-normal.o: mod-normal.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+mod-normal.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'normal' $< > $@ || (rm -f $@; exit 1)
+
+def-normal.lst: pre-normal.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 normal/' > $@
+
+und-normal.lst: pre-normal.o
+	echo 'normal' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+normal_mod-normal_cmdline.o: normal/cmdline.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_cmdline.d: normal/cmdline.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,cmdline\.o[ :]*,normal_mod-normal_cmdline.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_cmdline.d
+
+normal_mod-normal_command.o: normal/command.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_command.d: normal/command.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,command\.o[ :]*,normal_mod-normal_command.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_command.d
+
+normal_mod-normal_main.o: normal/main.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_main.d: normal/main.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,main\.o[ :]*,normal_mod-normal_main.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_main.d
+
+normal_mod-normal_menu.o: normal/menu.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_menu.d: normal/menu.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,menu\.o[ :]*,normal_mod-normal_menu.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_menu.d
+
+normal_mod-normal_arg.o: normal/arg.c
+	$(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -c -o $@ $<
+
+normal_mod-normal_arg.d: normal/arg.c
+	set -e; 	  $(CC) -Inormal -I$(srcdir)/normal $(CPPFLAGS) $(CFLAGS) $(normal_mod_CFLAGS) -M $< 	  | sed 's,arg\.o[ :]*,normal_mod-normal_arg.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include normal_mod-normal_arg.d
+
+normal_mod_CFLAGS = $(COMMON_CFLAGS)
+normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
+
+# For hello.mod.
+hello_mod_SOURCES = hello/hello.c
+CLEANFILES += hello.mod mod-hello.o mod-hello.c pre-hello.o hello_mod-hello_hello.o def-hello.lst und-hello.lst
+MOSTLYCLEANFILES += hello_mod-hello_hello.d
+DEFSYMFILES += def-hello.lst
+UNDSYMFILES += und-hello.lst
+
+hello.mod: pre-hello.o mod-hello.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-hello.o: hello_mod-hello_hello.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-hello.o: mod-hello.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(hello_mod_CFLAGS) -c -o $@ $<
+
+mod-hello.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'hello' $< > $@ || (rm -f $@; exit 1)
+
+def-hello.lst: pre-hello.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 hello/' > $@
+
+und-hello.lst: pre-hello.o
+	echo 'hello' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+hello_mod-hello_hello.o: hello/hello.c
+	$(CC) -Ihello -I$(srcdir)/hello $(CPPFLAGS) $(CFLAGS) $(hello_mod_CFLAGS) -c -o $@ $<
+
+hello_mod-hello_hello.d: hello/hello.c
+	set -e; 	  $(CC) -Ihello -I$(srcdir)/hello $(CPPFLAGS) $(CFLAGS) $(hello_mod_CFLAGS) -M $< 	  | sed 's,hello\.o[ :]*,hello_mod-hello_hello.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include hello_mod-hello_hello.d
+
+hello_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For boot.mod.
+boot_mod_SOURCES = commands/boot.c
+CLEANFILES += boot.mod mod-boot.o mod-boot.c pre-boot.o boot_mod-commands_boot.o def-boot.lst und-boot.lst
+MOSTLYCLEANFILES += boot_mod-commands_boot.d
+DEFSYMFILES += def-boot.lst
+UNDSYMFILES += und-boot.lst
+
+boot.mod: pre-boot.o mod-boot.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-boot.o: boot_mod-commands_boot.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-boot.o: mod-boot.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(boot_mod_CFLAGS) -c -o $@ $<
+
+mod-boot.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'boot' $< > $@ || (rm -f $@; exit 1)
+
+def-boot.lst: pre-boot.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 boot/' > $@
+
+und-boot.lst: pre-boot.o
+	echo 'boot' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+boot_mod-commands_boot.o: commands/boot.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(boot_mod_CFLAGS) -c -o $@ $<
+
+boot_mod-commands_boot.d: commands/boot.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(boot_mod_CFLAGS) -M $< 	  | sed 's,boot\.o[ :]*,boot_mod-commands_boot.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include boot_mod-commands_boot.d
+
+boot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For terminal.mod.
+terminal_mod_SOURCES = commands/terminal.c
+CLEANFILES += terminal.mod mod-terminal.o mod-terminal.c pre-terminal.o terminal_mod-commands_terminal.o def-terminal.lst und-terminal.lst
+MOSTLYCLEANFILES += terminal_mod-commands_terminal.d
+DEFSYMFILES += def-terminal.lst
+UNDSYMFILES += und-terminal.lst
+
+terminal.mod: pre-terminal.o mod-terminal.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-terminal.o: terminal_mod-commands_terminal.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-terminal.o: mod-terminal.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(terminal_mod_CFLAGS) -c -o $@ $<
+
+mod-terminal.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'terminal' $< > $@ || (rm -f $@; exit 1)
+
+def-terminal.lst: pre-terminal.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 terminal/' > $@
+
+und-terminal.lst: pre-terminal.o
+	echo 'terminal' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+terminal_mod-commands_terminal.o: commands/terminal.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(terminal_mod_CFLAGS) -c -o $@ $<
+
+terminal_mod-commands_terminal.d: commands/terminal.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(terminal_mod_CFLAGS) -M $< 	  | sed 's,terminal\.o[ :]*,terminal_mod-commands_terminal.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include terminal_mod-commands_terminal.d
+
+terminal_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ls.mod.
+ls_mod_SOURCES = commands/ls.c
+CLEANFILES += ls.mod mod-ls.o mod-ls.c pre-ls.o ls_mod-commands_ls.o def-ls.lst und-ls.lst
+MOSTLYCLEANFILES += ls_mod-commands_ls.d
+DEFSYMFILES += def-ls.lst
+UNDSYMFILES += und-ls.lst
+
+ls.mod: pre-ls.o mod-ls.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-ls.o: ls_mod-commands_ls.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-ls.o: mod-ls.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(ls_mod_CFLAGS) -c -o $@ $<
+
+mod-ls.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'ls' $< > $@ || (rm -f $@; exit 1)
+
+def-ls.lst: pre-ls.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 ls/' > $@
+
+und-ls.lst: pre-ls.o
+	echo 'ls' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+ls_mod-commands_ls.o: commands/ls.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(ls_mod_CFLAGS) -c -o $@ $<
+
+ls_mod-commands_ls.d: commands/ls.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(ls_mod_CFLAGS) -M $< 	  | sed 's,ls\.o[ :]*,ls_mod-commands_ls.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include ls_mod-commands_ls.d
+
+ls_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cmp.mod.
+cmp_mod_SOURCES = commands/cmp.c
+CLEANFILES += cmp.mod mod-cmp.o mod-cmp.c pre-cmp.o cmp_mod-commands_cmp.o def-cmp.lst und-cmp.lst
+MOSTLYCLEANFILES += cmp_mod-commands_cmp.d
+DEFSYMFILES += def-cmp.lst
+UNDSYMFILES += und-cmp.lst
+
+cmp.mod: pre-cmp.o mod-cmp.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-cmp.o: cmp_mod-commands_cmp.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-cmp.o: mod-cmp.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(cmp_mod_CFLAGS) -c -o $@ $<
+
+mod-cmp.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'cmp' $< > $@ || (rm -f $@; exit 1)
+
+def-cmp.lst: pre-cmp.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 cmp/' > $@
+
+und-cmp.lst: pre-cmp.o
+	echo 'cmp' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+cmp_mod-commands_cmp.o: commands/cmp.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(cmp_mod_CFLAGS) -c -o $@ $<
+
+cmp_mod-commands_cmp.d: commands/cmp.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(cmp_mod_CFLAGS) -M $< 	  | sed 's,cmp\.o[ :]*,cmp_mod-commands_cmp.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include cmp_mod-commands_cmp.d
+
+cmp_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cat.mod.
+cat_mod_SOURCES = commands/cat.c
+CLEANFILES += cat.mod mod-cat.o mod-cat.c pre-cat.o cat_mod-commands_cat.o def-cat.lst und-cat.lst
+MOSTLYCLEANFILES += cat_mod-commands_cat.d
+DEFSYMFILES += def-cat.lst
+UNDSYMFILES += und-cat.lst
+
+cat.mod: pre-cat.o mod-cat.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-cat.o: cat_mod-commands_cat.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-cat.o: mod-cat.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(cat_mod_CFLAGS) -c -o $@ $<
+
+mod-cat.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'cat' $< > $@ || (rm -f $@; exit 1)
+
+def-cat.lst: pre-cat.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 cat/' > $@
+
+und-cat.lst: pre-cat.o
+	echo 'cat' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+cat_mod-commands_cat.o: commands/cat.c
+	$(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(cat_mod_CFLAGS) -c -o $@ $<
+
+cat_mod-commands_cat.d: commands/cat.c
+	set -e; 	  $(CC) -Icommands -I$(srcdir)/commands $(CPPFLAGS) $(CFLAGS) $(cat_mod_CFLAGS) -M $< 	  | sed 's,cat\.o[ :]*,cat_mod-commands_cat.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include cat_mod-commands_cat.d
+
+cat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For font.mod.
+font_mod_SOURCES = font/manager.c
+CLEANFILES += font.mod mod-font.o mod-font.c pre-font.o font_mod-font_manager.o def-font.lst und-font.lst
+MOSTLYCLEANFILES += font_mod-font_manager.d
+DEFSYMFILES += def-font.lst
+UNDSYMFILES += und-font.lst
+
+font.mod: pre-font.o mod-font.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+	$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@
+
+pre-font.o: font_mod-font_manager.o
+	-rm -f $@
+	$(LD) -r -o $@ $^
+
+mod-font.o: mod-font.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(font_mod_CFLAGS) -c -o $@ $<
+
+mod-font.c: moddep.lst genmodsrc.sh
+	sh $(srcdir)/genmodsrc.sh 'font' $< > $@ || (rm -f $@; exit 1)
+
+def-font.lst: pre-font.o
+	$(NM) -g --defined-only -P -p $< | sed 's/^\([^ ]*\).*/\1 font/' > $@
+
+und-font.lst: pre-font.o
+	echo 'font' > $@
+	$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
+
+font_mod-font_manager.o: font/manager.c
+	$(CC) -Ifont -I$(srcdir)/font $(CPPFLAGS) $(CFLAGS) $(font_mod_CFLAGS) -c -o $@ $<
+
+font_mod-font_manager.d: font/manager.c
+	set -e; 	  $(CC) -Ifont -I$(srcdir)/font $(CPPFLAGS) $(CFLAGS) $(font_mod_CFLAGS) -M $< 	  | sed 's,manager\.o[ :]*,font_mod-font_manager.o $@ : ,g' > $@; 	  [ -s $@ ] || rm -f $@
+
+-include font_mod-font_manager.d
+
+font_mod_CFLAGS = $(COMMON_CFLAGS)
+
+CLEANFILES += moddep.lst
+pkgdata_DATA += moddep.lst
+moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
+	cat $(DEFSYMFILES) /dev/null | ./genmoddep $(UNDSYMFILES) > $@ \
+	  || (rm -f $@; exit 1)
diff -urN grub2.orig/conf/arm-RISC_OS.rmk grub2.patch1/conf/arm-RISC_OS.rmk
--- grub2.orig/conf/arm-RISC_OS.rmk	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/conf/arm-RISC_OS.rmk	2004-05-21 11:59:58.000000000 +0100
@@ -0,0 +1,110 @@
+# -*- makefile -*-
+
+COMMON_ASFLAGS = -nostdinc -fno-builtin
+COMMON_CFLAGS = -fno-builtin
+
+# Images.
+pkgdata_IMAGES = grub_RISC_OS.img
+
+
+# For grub_RISC_OS.img.
+grub_RISC_OS_img_SOURCES = kern/arm/aif_header.S kern/main.c kern/device.c \
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
+	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
+	kern/i386/dl.c kern/arm/RISC_OS/startup.S kern/arm/setjmp.S\
+	kern/env.c kern/arm/RISC_OS/init.c disk/i386/pc/partition.c\
+	term/arm/RISC_OS/console.c term/arm/RISC_OS/console-asm.S\
+	symlist.c
+grub_RISC_OS_img_HEADERS = boot.h device.h disk.h dl.h elf.h err.h \
+	file.h fs.h kernel.h loader.h misc.h mm.h net.h rescue.h symbol.h \
+	term.h types.h arg.h env.h
+grub_RISC_OS_img_CFLAGS = $(COMMON_CFLAGS)
+grub_RISC_OS_img_ASFLAGS = $(COMMON_ASFLAGS)
+grub_RISC_OS_img_LDFLAGS =  `$(CC) -print-libgcc-file-name` $(srcdir)/kern/arm/aif_header.lds -nostdlib -Wl,-N,-Ttext,8000
+
+MOSTLYCLEANFILES += symlist.c grub_RISC_OS_syms.lst
+DEFSYMFILES += grub_RISC_OS_syms.lst
+
+symlist.c: $(addprefix include/grub/,$(grub_RISC_OS_img_HEADERS)) gensymlist.sh
+	sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
+
+grub_RISC_OS_syms.lst: $(addprefix include/grub/,$(grub_RISC_OS_img_HEADERS)) genkernsyms.sh
+	sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
+
+# Utilities.
+#bin_UTILITIES = grub-mkimage
+#sbin_UTILITIES = grub-setup grub-emu
+noinst_UTILITIES = genmoddep
+
+# For grub-mkimage.
+grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
+	util/resolve.c
+grub_mkimage_LDFLAGS = -llzo
+
+# For grub-setup.
+grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
+	util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
+	kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \
+	kern/file.c kern/fs.c kern/env.c
+
+# For grub
+grub_emu_SOURCES = kern/main.c kern/device.c				\
+	kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c		\
+        kern/misc.c kern/loader.c kern/rescue.c kern/term.c		\
+	disk/i386/pc/partition.c kern/env.c commands/ls.c		\
+	commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c		\
+	util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c			\
+	normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c	\
+	util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c
+grub_emu_LDFLAGS = -lncurses
+
+# For genmoddep.
+genmoddep_SOURCES = util/genmoddep.c
+
+# Modules.
+pkgdata_MODULES = fat.mod ext2.mod normal.mod hello.mod \
+	 font.mod ls.mod boot.mod cmp.mod cat.mod terminal.mod
+
+# For fat.mod.
+fat_mod_SOURCES = fs/fat.c
+fat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ext2.mod.
+ext2_mod_SOURCES = fs/ext2.c
+ext2_mod_CFLAGS = $(COMMON_CFLAGS)
+
+
+# For normal.mod.
+normal_mod_SOURCES = normal/cmdline.c normal/command.c normal/main.c \
+	normal/menu.c normal/arg.c 
+normal_mod_CFLAGS = $(COMMON_CFLAGS)
+normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
+
+# For hello.mod.
+hello_mod_SOURCES = hello/hello.c
+hello_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For boot.mod.
+boot_mod_SOURCES = commands/boot.c
+boot_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For terminal.mod.
+terminal_mod_SOURCES = commands/terminal.c
+terminal_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For ls.mod.
+ls_mod_SOURCES = commands/ls.c
+ls_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cmp.mod.
+cmp_mod_SOURCES = commands/cmp.c
+cmp_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For cat.mod.
+cat_mod_SOURCES = commands/cat.c
+cat_mod_CFLAGS = $(COMMON_CFLAGS)
+
+# For font.mod.
+font_mod_SOURCES = font/manager.c
+font_mod_CFLAGS = $(COMMON_CFLAGS)
+
diff -urN grub2.orig/include/grub/arm/RISC_OS/console.h grub2.patch1/include/grub/arm/RISC_OS/console.h
--- grub2.orig/include/grub/arm/RISC_OS/console.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/RISC_OS/console.h	2004-05-20 19:56:35.000000000 +0100
@@ -0,0 +1,57 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002  Free Software Foundation, Inc.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_CONSOLE_MACHINE_HEADER
+#define GRUB_CONSOLE_MACHINE_HEADER	1
+
+/* Define scan codes.  */
+#define GRUB_CONSOLE_KEY_LEFT		0x4B00
+#define GRUB_CONSOLE_KEY_RIGHT		0x4D00
+#define GRUB_CONSOLE_KEY_UP		0x4800
+#define GRUB_CONSOLE_KEY_DOWN		0x5000
+#define GRUB_CONSOLE_KEY_IC		0x5200
+#define GRUB_CONSOLE_KEY_DC		0x5300
+#define GRUB_CONSOLE_KEY_BACKSPACE	0x0008
+#define GRUB_CONSOLE_KEY_HOME		0x4700
+#define GRUB_CONSOLE_KEY_END		0x4F00
+#define GRUB_CONSOLE_KEY_NPAGE		0x4900
+#define GRUB_CONSOLE_KEY_PPAGE		0x5100
+
+#ifndef ASM_FILE
+
+#include <grub/types.h>
+#include <grub/symbol.h>
+#include <grub/term.h>
+
+/* These are global to share code between C and asm.  */
+void grub_console_real_putchar (int c);
+int EXPORT_FUNC(grub_console_checkkey) (void);
+int EXPORT_FUNC(grub_console_getkey) (void);
+grub_uint16_t grub_console_getxy (void);
+void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y);
+void grub_console_cls (void);
+void grub_console_setcursor (int on);
+void grub_console_setcolourstate (grub_term_color_state state);
+
+/* Initialize the console system.  */
+void grub_console_init (void);
+
+#endif
+
+#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
diff -urN grub2.orig/include/grub/arm/RISC_OS/partition.h grub2.patch1/include/grub/arm/RISC_OS/partition.h
--- grub2.orig/include/grub/arm/RISC_OS/partition.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/RISC_OS/partition.h	2004-04-04 14:46:01.000000000 +0100
@@ -0,0 +1,242 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 1999,2000,2001,2002  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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_PARTITION_HEADER
+#define GRUB_PARTITION_HEADER	1
+
+#include <grub/symbol.h>
+#include <grub/types.h>
+#include <grub/err.h>
+
+/* The signature.  */
+#define GRUB_PARTITION_SIGNATURE	0xaa55
+
+/* This is not a flag actually, but used as if it were a flag.  */
+#define GRUB_PARTITION_TYPE_HIDDEN_FLAG		0x10
+
+/* DOS partition types.  */
+#define GRUB_PARTITION_TYPE_NONE		0
+#define GRUB_PARTITION_TYPE_FAT12		1
+#define GRUB_PARTITION_TYPE_FAT16_LT32M		4
+#define GRUB_PARTITION_TYPE_EXTENDED		5
+#define GRUB_PARTITION_TYPE_FAT16_GT32M		6
+#define GRUB_PARTITION_TYPE_FAT32		0xb
+#define GRUB_PARTITION_TYPE_FAT32_LBA		0xc
+#define GRUB_PARTITION_TYPE_FAT16_LBA		0xe
+#define GRUB_PARTITION_TYPE_WIN95_EXTENDED	0xf
+#define GRUB_PARTITION_TYPE_EZD			0x55
+#define GRUB_PARTITION_TYPE_MINIX		0x80
+#define GRUB_PARTITION_TYPE_LINUX_MINIX		0x81
+#define GRUB_PARTITION_TYPE_EXT2FS		0x83
+#define GRUB_PARTITION_TYPE_LINUX_EXTENDED	0x85
+#define GRUB_PARTITION_TYPE_VSTAFS		0x9e
+#define GRUB_PARTITION_TYPE_FREEBSD		0xa5
+#define GRUB_PARTITION_TYPE_OPENBSD		0xa6
+#define GRUB_PARTITION_TYPE_NETBSD		0xa9
+#define GRUB_PARTITION_TYPE_LINUX_RAID		0xfd
+
+/* Constants for BSD disk label.  */
+#define GRUB_PARTITION_BSD_LABEL_SECTOR		1
+#define GRUB_PARTITION_BSD_LABEL_MAGIC		0x82564557
+#define GRUB_PARTITION_BSD_MAX_ENTRIES		8
+
+/* BSD partition types.  */
+#define GRUB_PARTITION_BSD_TYPE_UNUSED		0
+#define GRUB_PARTITION_BSD_TYPE_SWAP		1
+#define GRUB_PARTITION_BSD_TYPE_V6		2
+#define GRUB_PARTITION_BSD_TYPE_V7		3
+#define GRUB_PARTITION_BSD_TYPE_SYSV		4
+#define GRUB_PARTITION_BSD_TYPE_V71K		5
+#define GRUB_PARTITION_BSD_TYPE_V8		6
+#define GRUB_PARTITION_BSD_TYPE_BSDFFS		7
+#define GRUB_PARTITION_BSD_TYPE_MSDOS		8
+#define GRUB_PARTITION_BSD_TYPE_BSDLFS		9
+#define GRUB_PARTITION_BSD_TYPE_OTHER		10
+#define GRUB_PARTITION_BSD_TYPE_HPFS		11
+#define GRUB_PARTITION_BSD_TYPE_ISO9660		12
+#define GRUB_PARTITION_BSD_TYPE_BOOT		13
+
+/* FreeBSD-specific types.  */
+#define GRUB_PARTITION_FREEBSD_TYPE_VINUM	14
+#define GRUB_PARTITION_FREEBSD_TYPE_RAID	15
+#define GRUB_PARTITION_FREEBSD_TYPE_JFS2	21
+
+/* NetBSD-specific types.  */
+#define	GRUB_PARTITION_NETBSD_TYPE_ADOS		14
+#define	GRUB_PARTITION_NETBSD_TYPE_HFS		15
+#define	GRUB_PARTITION_NETBSD_TYPE_FILECORE	16
+#define	GRUB_PARTITION_NETBSD_TYPE_EXT2FS	17
+#define	GRUB_PARTITION_NETBSD_TYPE_NTFS		18
+#define	GRUB_PARTITION_NETBSD_TYPE_RAID		19
+#define	GRUB_PARTITION_NETBSD_TYPE_CCD		20
+#define	GRUB_PARTITION_NETBSD_TYPE_JFS2		21
+#define	GRUB_PARTITION_NETBSD_TYPE_APPLEUFS	22
+
+/* OpenBSD-specific types.  */
+#define	GRUB_PARTITION_OPENBSD_TYPE_ADOS	14
+#define	GRUB_PARTITION_OPENBSD_TYPE_HFS		15
+#define	GRUB_PARTITION_OPENBSD_TYPE_FILECORE	16
+#define	GRUB_PARTITION_OPENBSD_TYPE_EXT2FS	17
+#define	GRUB_PARTITION_OPENBSD_TYPE_NTFS	18
+#define	GRUB_PARTITION_OPENBSD_TYPE_RAID	19
+
+/* The BSD partition entry.  */
+struct grub_partition_bsd_entry
+{
+  grub_uint32_t size;
+  grub_uint32_t offset;
+  grub_uint32_t fragment_size;
+  grub_uint8_t fs_type;
+  grub_uint8_t fs_fragments;
+  grub_uint16_t fs_cylinders;
+} __attribute__ ((packed));
+
+/* The BSD disk label. Only define members useful for GRUB.  */
+struct grub_partition_disk_label
+{
+  grub_uint32_t magic;
+  grub_uint8_t padding[128];
+  grub_uint32_t magic2;
+  grub_uint16_t checksum;
+  grub_uint16_t num_partitions;
+  grub_uint32_t boot_size;
+  grub_uint32_t superblock_size;
+  struct grub_partition_bsd_entry entries[GRUB_PARTITION_BSD_MAX_ENTRIES];
+} __attribute__ ((packed));
+
+/* The partition entry.  */
+struct grub_partition_entry
+{
+  /* If active, 0x80, otherwise, 0x00.  */
+  grub_uint8_t flag;
+
+  /* The head of the start.  */
+  grub_uint8_t start_head;
+
+  /* (S | ((C >> 2) & 0xC0)) where S is the sector of the start and C
+     is the cylinder of the start. Note that S is counted from one.  */
+  grub_uint8_t start_sector;
+
+  /* (C & 0xFF) where C is the cylinder of the start.  */
+  grub_uint8_t start_cylinder;
+
+  /* The partition type.  */
+  grub_uint8_t type;
+
+  /* The end versions of start_head, start_sector and start_cylinder,
+     respectively.  */
+  grub_uint8_t end_head;
+  grub_uint8_t end_sector;
+  grub_uint8_t end_cylinder;
+
+  /* The start sector. Note that this is counted from zero.  */
+  grub_uint32_t start;
+
+  /* The length in sector units.  */
+  grub_uint32_t length;
+} __attribute__ ((packed));
+
+/* The structure of MBR.  */
+struct grub_partition_mbr
+{
+  /* The code area (actually, including BPB).  */
+  grub_uint8_t code[446];
+
+  /* Four partition entries.  */
+  struct grub_partition_entry entries[4];
+
+  /* The signature 0xaa55.  */
+  grub_uint16_t signature;
+} __attribute__ ((packed));
+
+/* Partition description.  */
+struct grub_partition
+{
+  /* The start sector.  */
+  unsigned long start;
+
+  /* The length in sector units.  */
+  unsigned long len;
+
+  /* The offset of the partition table.  */
+  unsigned long offset;
+
+  /* The offset of the extended partition.  */
+  unsigned long ext_offset;
+
+  /* The index of this partition in the partition table.  */
+  int index;
+  
+  /* The DOS partition number.  */
+  int dos_part;
+
+  /* The BSD partition number (a == 0).  */
+  int bsd_part;
+
+  /* The DOS partition type.  */
+  int dos_type;
+
+  /* The BSD partition type.  */
+  int bsd_type;
+};
+typedef struct grub_partition *grub_partition_t;
+
+struct grub_disk;
+
+grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
+						    const char *str);
+grub_err_t EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
+						int (*hook) (const grub_partition_t partition));
+char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
+
+static inline unsigned long
+grub_partition_get_start (const grub_partition_t p)
+{
+  return p->start;
+}
+
+static inline unsigned long
+grub_partition_get_len (const grub_partition_t p)
+{
+  return p->len;
+}
+
+static inline int
+grub_partition_is_empty (int type)
+{
+  return (type == GRUB_PARTITION_TYPE_NONE);
+}
+
+static inline int
+grub_partition_is_extended (int type)
+{
+  return (type == GRUB_PARTITION_TYPE_EXTENDED
+	  || type == GRUB_PARTITION_TYPE_WIN95_EXTENDED
+	  || type == GRUB_PARTITION_TYPE_LINUX_EXTENDED);
+}
+
+static inline int
+grub_partition_is_bsd (int type)
+{
+  return (type == GRUB_PARTITION_TYPE_FREEBSD
+	  || type == GRUB_PARTITION_TYPE_OPENBSD
+	  || type == GRUB_PARTITION_TYPE_NETBSD);
+}
+
+#endif /* ! GRUB_PARTITION_HEADER */
diff -urN grub2.orig/include/grub/arm/RISC_OS/time.h grub2.patch1/include/grub/arm/RISC_OS/time.h
--- grub2.orig/include/grub/arm/RISC_OS/time.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/RISC_OS/time.h	2004-05-19 10:55:26.000000000 +0100
@@ -0,0 +1,33 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2003  Free Software Foundation, Inc.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef KERNEL_TIME_HEADER
+#define KERNEL_TIME_HEADER	1
+
+#ifdef GRUB_UTIL
+# include <time.h>
+# define GRUB_TICKS_PER_SECOND	CLOCKS_PER_SEC
+#else
+# define GRUB_TICKS_PER_SECOND	100
+#endif
+
+/* Return the real time in ticks.  */
+grub_uint32_t grub_get_rtc (void);
+
+#endif /* ! KERNEL_TIME_HEADER */
diff -urN grub2.orig/include/grub/arm/setjmp.h grub2.patch1/include/grub/arm/setjmp.h
--- grub2.orig/include/grub/arm/setjmp.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/setjmp.h	2004-05-19 00:39:16.000000000 +0100
@@ -0,0 +1,25 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2003  Free Software Foundation, Inc.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_SETJMP_CPU_HEADER
+#define GRUB_SETJMP_CPU_HEADER	1
+
+typedef unsigned long grub_jmp_buf[11];
+
+#endif /* ! GRUB_SETJMP_CPU_HEADER */
diff -urN grub2.orig/include/grub/arm/types.h grub2.patch1/include/grub/arm/types.h
--- grub2.orig/include/grub/arm/types.h	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/include/grub/arm/types.h	2004-05-19 00:41:04.000000000 +0100
@@ -0,0 +1,32 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002  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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef GRUB_TYPES_CPU_HEADER
+#define GRUB_TYPES_CPU_HEADER	1
+
+/* The size of void *.  */
+#define GRUB_HOST_SIZEOF_VOID_P	4
+
+/* The size of long.  */
+#define GRUB_HOST_SIZEOF_LONG	4
+
+/* ARM is little-endian. (Or big-endian!! - but we don't support that yet) */
+#undef GRUB_HOST_WORDS_BIGENDIAN
+
+#endif /* ! GRUB_TYPES_CPU_HEADER */
diff -urN grub2.orig/include/grub/symbol.h grub2.patch1/include/grub/symbol.h
--- grub2.orig/include/grub/symbol.h	2004-05-21 12:14:37.000000000 +0100
+++ grub2.patch1/include/grub/symbol.h	2004-05-18 22:48:26.000000000 +0100
@@ -29,8 +29,8 @@
 # define EXT_C(sym)	sym
 #endif
 
-#define FUNCTION(x)	.globl EXT_C(x) ; .type EXT_C(x), @function ; EXT_C(x):
-#define VARIABLE(x)	.globl EXT_C(x) ; .type EXT_C(x), @object ; EXT_C(x):
+#define FUNCTION(x)	.globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
+#define VARIABLE(x)	.globl EXT_C(x) ; .type EXT_C(x), "object" ; EXT_C(x):
 
 /* Mark an exported symbol.  */
 #define EXPORT_FUNC(x)	x
diff -urN grub2.orig/kern/arm/aif_header.lds grub2.patch1/kern/arm/aif_header.lds
--- grub2.orig/kern/arm/aif_header.lds	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/aif_header.lds	2004-05-21 11:55:49.000000000 +0100
@@ -0,0 +1,23 @@
+/* aif_header.lds - Calculate values for AIF header */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+grub_aif_text_size = __data_start - 0x8000;
+grub_aif_data_size = _edata - __data_start;
+grub_aif_bss_size = _end - _edata;
diff -urN grub2.orig/kern/arm/aif_header.S grub2.patch1/kern/arm/aif_header.S
--- grub2.orig/kern/arm/aif_header.S	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/aif_header.S	2004-05-21 11:55:54.000000000 +0100
@@ -0,0 +1,68 @@
+/* aif_header.S - AIF header */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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
+ *  aword with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+
+	.global	_start
+_start:	nop
+	nop
+	bl	zeroinit
+	bl	grub_arm_startup
+lock:	b	lock	@ "Program exit instruction" (never reached)
+	.word	grub_aif_text_size
+	.word	grub_aif_data_size
+	.word	0	@ Debug data size
+zisize:	.word	grub_aif_bss_size
+	.word	0	@ No Debug data
+	.word	_start
+	.word	0	@ Workspace for self-moving image (not used)
+	.word	32	@ Yes, we work in 32bit PC modes.
+	.word	__data_start
+	.word	0, 0 	@ Unused
+	nop		@ Initialise debugger (NOT!!)
+	
+zeroinit:
+	ldr	r0, =__bss_start
+	ldr	r4, zisize
+	
+	@ Move appended modules out of the way
+	add	r1, r0, r4
+	ldr	r2, EXT_C(grub_total_module_size)
+1:	ldr	r3, [r0, r2]
+	str	r3, [r1, r2]
+	subs	r2, r2, #4
+	bcs	1b
+	
+	@ Zero BSS area
+	mov	r1, #0	
+1:	str	r1, [r0], #4	
+	subs	r4, r4, #4
+	bcs	1b
+	mov	pc, lr
+
+	.ltorg
+	.org	_start + 128
+	
+	@ Size of appended modules
+VARIABLE(grub_total_module_size)
+	.word	0	
+VARIABLE(grub_end_addr)
+	.word	_end
diff -urN grub2.orig/kern/arm/RISC_OS/init.c grub2.patch1/kern/arm/RISC_OS/init.c
--- grub2.orig/kern/arm/RISC_OS/init.c	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/RISC_OS/init.c	2004-05-21 11:38:09.000000000 +0100
@@ -0,0 +1,40 @@
+/* init.c - RISC OS Initialisation */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/kernel.h>
+#include <grub/mm.h>
+#include <grub/misc.h>
+#include <grub/machine/console.h>
+#include <grub/env.h>
+
+extern grub_addr_t grub_RISC_OS_memory_limit;
+
+void
+grub_machine_init ()
+{
+  //grub_RISC_OS_message("Hello World!\n\r");
+  grub_console_init ();
+  grub_mm_init_region ((void *) grub_end_addr + grub_total_module_size,
+		       grub_RISC_OS_memory_limit - (grub_end_addr +
+						    grub_total_module_size));
+  grub_env_set ("prefix", "(native)ADFS::0/$");
+  grub_printf ("Hello World!\n");
+  //grub_stop();
+}
diff -urN grub2.orig/kern/arm/RISC_OS/startup.S grub2.patch1/kern/arm/RISC_OS/startup.S
--- grub2.orig/kern/arm/RISC_OS/startup.S	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/RISC_OS/startup.S	2004-05-21 11:59:14.000000000 +0100
@@ -0,0 +1,119 @@
+/* startup.S - RISC OS Initialisation*/
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+
+#define OS_ChangeEnvironment 0x40
+#define OS_GenerateError 0x2B
+#define OS_Exit 0x11
+#define OS_CLI 0x05
+#define OS_ReadMonotonicTime 0x42
+
+
+	.data
+handlers:
+	.word	0
+VARIABLE(grub_RISC_OS_memory_limit)
+	.word	0, 0, 0
+	.word	6, error_handler, 0, error_buffer
+	.word	11, grub_stop, 0, 0
+	.word	13, exception_registers, 0, 0
+	.word	14
+VARIABLE(grub_RISC_OS_application_space)
+	.word	0, 0, 0
+	.word	16, upcall_handler, 0, 0
+	
+	.text
+swap_handlers:
+	mov	r5, lr
+	ldr	r4, =handlers
+1:	ldmia	r4, {r0-r3}
+	swi	OS_ChangeEnvironment
+	stmia	r4!, {r0-r3}
+	teq	r0, #16
+	bne	1b
+	mov	pc, r5
+	
+error_handler:
+	@ TODO: do longjmp
+	mov	r6, r0
+	bl	swap_handlers
+	add	r0, r6, #4
+	swi	OS_GenerateError
+	
+upcall_handler:
+	subs	r0, r0, #256
+	moveq	pc, lr
+	@beq	upcall_newapp
+	teq	r0, #1
+	add	r0, r0, #256
+	@beq	upcall_movemem
+	movne	pc, lr
+upcall_movemem:
+	movs	r1, r1
+	movpl	r0, #0
+	mov	pc, lr
+	
+upcall_newapp:
+	@stmfd	sp!, {r0-r5, lr}
+	@bl	swap_handlers
+	@ldmfd	sp!, {r0-r5, pc}
+	
+	.globl	grub_arm_startup
+grub_arm_startup:
+	ldr	sp, =stack_end
+	bl	swap_handlers
+	mov	fp, #0
+	bl	grub_main
+FUNCTION(grub_stop)
+	@ TODO: at_exit
+	ldr	sp, =stack_end
+	bl	swap_handlers
+	mov	r0, #0
+	swi	OS_Exit
+	
+FUNCTION(grub_RISC_OS_chain)
+	mov	r6, r0
+	ldr	sp, =stack_end
+	bl	swap_handlers
+	mov	r0, r5
+	mov	r1, #0
+	swi	OS_CLI
+	swi	OS_Exit
+	
+FUNCTION(grub_get_rtc)
+	swi	OS_ReadMonotonicTime
+	mov	pc, lr
+	
+
+	.bss
+stack_limit:
+	.space	0x4000
+stack_end:
+exception_registers:
+	.space	17 * 4
+error_buffer:
+	.space	260
+	
+VARIABLE(grub_os_area_addr)
+VARIABLE(grub_os_area_size)
+colourstate:
+	.space	4
diff -urN grub2.orig/kern/arm/setjmp.S grub2.patch1/kern/arm/setjmp.S
--- grub2.orig/kern/arm/setjmp.S	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/kern/arm/setjmp.S	2004-05-21 11:55:46.000000000 +0100
@@ -0,0 +1,31 @@
+/* aif_header.S - setjmp and longjmp */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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
+ *  aword with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+ 
+FUNCTION(grub_setjmp)
+	stmia	r0, {r4-r14}
+	mov	pc, lr
+	
+FUNCTION(grub_longjmp)
+	ldmia	r0, {r4-r14}
+	mov	r0, r1
+	mov	pc, lr
diff -urN grub2.orig/term/arm/RISC_OS/console-asm.S grub2.patch1/term/arm/RISC_OS/console-asm.S
--- grub2.orig/term/arm/RISC_OS/console-asm.S	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/term/arm/RISC_OS/console-asm.S	2004-05-21 11:59:12.000000000 +0100
@@ -0,0 +1,92 @@
+/* startup.S - RISC OS Console*/
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2004 Timothy Baldwin.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <grub/symbol.h>
+
+#define OS_Write0 0x02
+#define OS_WriteC 0x00
+#define OS_WriteI 0x100
+#define OS_WriteN 0x46
+#define OS_Byte 0x06
+#define OS_ReadC 0x04
+
+FUNCTION(grub_RISC_OS_message)
+	swi	OS_Write0
+	mov	pc, lr
+	
+FUNCTION(grub_console_gotoxy)
+	swi	OS_WriteI + 31
+	swi	OS_WriteC
+	mov	r0, r1
+FUNCTION(grub_console_real_putchar)
+	swi	OS_WriteC
+	mov	pc, lr
+	
+FUNCTION(grub_console_getxy)
+	mov	r0, #165
+	swi	OS_Byte
+	orr	r0, r2, r1, lsl #8
+	mov	pc, lr
+
+FUNCTION(grub_console_setcursor)
+	swi	OS_WriteI + 23
+	swi	OS_WriteI + 1
+	swi	OS_WriteC
+pnulls:	adr	r0, nulls
+	mov	r1, #8
+	swi	OS_WriteN
+	mov	pc, lr
+	
+FUNCTION(grub_console_setcolourstate)
+	ldr	r2, =colourstate
+	and	r0, r0, #2
+	ldrb	r1, [r2]
+	teq	r0, r1
+	moveq	pc, lr
+	strb	r0, [r2]
+	swi	OS_WriteI + 23	@ Swap text foreground/background colours
+	swi	OS_WriteI + 17
+	swi	OS_WriteI + 5
+	b	pnulls
+	
+	
+FUNCTION(grub_console_cls)
+	swi	OS_WriteI + 12
+	mov	pc, lr
+	
+FUNCTION(grub_console_getkey)
+	swi	OS_ReadC
+	mov	pc, lr
+
+FUNCTION(grub_console_checkkey)
+	mov	r0, #129	@ Read key with time limit
+	mov	r1, #0		@ Timeout low byte
+	mov	r2, #0		@ Timeout high byte ( < 0x80 )
+	swi	OS_Byte
+	movs	r2, r2		@ r2 = 0 if key read
+	moveq	r0, r1		@ r1 = key if read
+	mvnne	r0, #0
+	mov	pc, lr
+
+	.bss
+colourstate:
+	.space	4
+	
\ No newline at end of file
diff -urN grub2.orig/term/arm/RISC_OS/console.c grub2.patch1/term/arm/RISC_OS/console.c
--- grub2.orig/term/arm/RISC_OS/console.c	1970-01-01 01:00:00.000000000 +0100
+++ grub2.patch1/term/arm/RISC_OS/console.c	2004-05-20 19:38:23.000000000 +0100
@@ -0,0 +1,97 @@
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2002,2003  Free Software Foundation, Inc.
+ *
+ *  This program 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 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <grub/machine/console.h>
+#include <grub/term.h>
+#include <grub/types.h>
+
+
+static void
+grub_console_putchar (grub_uint32_t c)
+{
+  if (c > 0x7f)
+    {
+      /* Map some unicode characters to the VGA font, if possible.  */
+      switch (c)
+	{
+	case 0x2190:	/* left arrow */
+	  c = 0x1b;
+	  break;
+	case 0x2191:	/* up arrow */
+	  c = 0x18;
+	  break;
+	case 0x2192:	/* right arrow */
+	  c = 0x1a;
+	  break;
+	case 0x2193:	/* down arrow */
+	  c = 0x19;
+	  break;
+	case 0x2501:	/* horizontal line */
+	  c = 0xc4;
+	  break;
+	case 0x2503:	/* vertical line */
+	  c = 0xb3;
+	  break;
+	case 0x250F:	/* upper-left corner */
+	  c = 0xda;
+	  break;
+	case 0x2513:	/* upper-right corner */
+	  c = 0xbf;
+	  break;
+	case 0x2517:	/* lower-left corner */
+	  c = 0xc0;
+	  break;
+	case 0x251B:	/* lower-right corner */
+	  c = 0xd9;
+	  break;
+
+	default:
+	  c = '?';
+	  break;
+	}
+    }
+
+  grub_console_real_putchar (c);
+}
+
+
+static struct grub_term grub_console_term =
+  {
+    .name = "console",
+    .init = 0,
+    .fini = 0,
+    .putchar = grub_console_putchar,
+    .checkkey = grub_console_checkkey,
+    .getkey = grub_console_getkey,
+    .getxy = grub_console_getxy,
+    .gotoxy = grub_console_gotoxy,
+    .cls = grub_console_cls,
+    .setcolorstate = grub_console_setcolourstate,
+    .setcolor = 0,
+    .setcursor = grub_console_setcursor,
+    .flags = 0,
+    .next = 0
+  };
+
+void
+grub_console_init (void)
+{
+  grub_term_register (&grub_console_term);
+  grub_term_set_current (&grub_console_term);
+}

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-06-09  8:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-22 15:21 RISC OS/ARM port Timothy Baldwin
2004-05-23 17:03 ` Yoshinori K. Okuji
2004-05-23 17:24   ` Stefan Reinauer
2004-05-27 22:22   ` Timothy Baldwin
2004-05-28 14:48     ` Marco Gerards
2004-05-31 11:09       ` Timothy Baldwin
2004-06-01 17:30         ` Yoshinori K. Okuji
2004-06-08 15:21           ` Timothy Baldwin
  -- strict thread matches above, loose matches on Subject: below --
2004-05-22 12:46 Timothy Baldwin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.