Skip to contentSkip to conversation

RISC OS/ARM port

PATCH Timothy Baldwin 1 participant 1 message May 23, 2004

lore
Share & tools
lore
#0 lore raw

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.

Signature · 2 lines
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!
configure.ac 2004-05-19 00:26:16.000000000 +0100 renamed from configure.ac 2004-05-21 12:14:37.000000000 +0100 +2 -0
@@ -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
 
conf/arm-RISC_OS.mk +696 -0

696 lines not on this page · raw message

conf/arm-RISC_OS.rmk +110 -0

110 lines not on this page · raw message

include/grub/arm/RISC_OS/console.h +57 -0

57 lines not on this page · raw message

include/grub/arm/RISC_OS/partition.h +242 -0

242 lines not on this page · raw message

include/grub/arm/RISC_OS/time.h +33 -0
diff -urN grub2.orig/include/grub/arm/RISC_OS/time.h grub2.patch1/include/grub/arm/RISC_OS/time.h
@@ -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 */
include/grub/arm/setjmp.h +25 -0
diff -urN grub2.orig/include/grub/arm/setjmp.h grub2.patch1/include/grub/arm/setjmp.h
@@ -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 */
include/grub/arm/types.h +32 -0
diff -urN grub2.orig/include/grub/arm/types.h grub2.patch1/include/grub/arm/types.h
@@ -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 */
include/grub/symbol.h +2 -2
diff -urN grub2.orig/include/grub/symbol.h grub2.patch1/include/grub/symbol.h
@@ -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
kern/arm/aif_header.lds +23 -0
diff -urN grub2.orig/kern/arm/aif_header.lds grub2.patch1/kern/arm/aif_header.lds
@@ -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;
kern/arm/aif_header.S +68 -0

68 lines not on this page · raw message

kern/arm/RISC_OS/init.c +40 -0
diff -urN grub2.orig/kern/arm/RISC_OS/init.c grub2.patch1/kern/arm/RISC_OS/init.c
@@ -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();
+}
kern/arm/RISC_OS/startup.S +119 -0

119 lines not on this page · raw message

kern/arm/setjmp.S +31 -0
diff -urN grub2.orig/kern/arm/setjmp.S grub2.patch1/kern/arm/setjmp.S
@@ -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
term/arm/RISC_OS/console-asm.S +92 -0

93 lines not on this page · raw message

term/arm/RISC_OS/console.c +97 -0

97 lines not on this page · raw message