grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RISC OS/ARM port


From: Timothy Baldwin
Subject: Re: RISC OS/ARM port
Date: Thu, 27 May 2004 23:22:28 +0100
User-agent: KMail/1.6.2

On Sunday 23 May 2004 18:03, Yoshinori K. Okuji wrote:
> On Saturday 22 May 2004 17:21, Timothy Baldwin wrote:

> > 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.
>
> Could you elaborate on your idea more? What is "standalone filing
> systems"? How do they work?

By "standalone filing systems" I was refering to filing systems which do not 
use the Grub disk or network interfaces, the example which concerns me at 
present is an interface to the filing system API of a (ROM-resident) host 
operating system. 

Currently Grub supports it own filing systems on disks supported by external 
drivers, with paths such as:
(fd0)/boot/grub/normal.mod
(ADFS::0)/normal.mod

The structure is there to support network filing system, again with paths 
identifying network devices, with filing systems determined by the network 
device. It may make more sense to have the filing system in the path.

I intend to add to the RISC OS port I am working on support for the native 
RISC OS filing system API, with paths such as:

(native)ADFS::0/$/boot/grub/normal.mod
(native_untranslated)ADFS::0.$.boot.grub.normal/mod
(native)<foobar$Dir>/boot/grub/normal.mod
(native_untranslated)<foobar$Dir>.boot.grub.normal/mod

I propose that instead of having seperate lists of network device drivers and 
disk drivers, we would have a unified list. 

The name and next members are removed from struct grub_disk_dev and struct 
grub_net_dev. A linked list is keep of a new sructure:

struct grub_dev_driver
{
  const char *name;

  /* Open the device named NAME, and set up DEV.  */
  grub_err_t (*open) (const char *name, struct grub_dev *dev);

  struct grub_dev_driver *next;
  union
  {
    struct grub_disk_dev disk;
    struct grub_net_dev net;
    void *data;
  };
};

Disk drivers would have a modified grub_disk_open as their open function. The 
list list walking code in grub_disk_open would be moved to grub_device_open, 
and the register/dergister functions moved from disk.c to device.c.

struct grub_device
{
  /* The binding filesystem.  */
  struct grub_fs *fs;

  struct grub_disk *disk;
  struct grub_net *net;
};

The member "fs" is moved from "struct grub_net" to "struct grub_device", to 
allow for filing systems which don't use grub's disk or network support.

My RISC OS port now has support for discs, modules and both rescue mode and 
normal mode command prompts work, except some console problems.

To deal with variable console sizes I propose creating a new member in "struct 
grub_term", and removing asumptions:

grub_uint16_t (*getsize) (void);

The width of the terminal croodinates should be increased as they are in 
danger of overflowing, I suggest to 16 bits.


And finally a fix for a couple of (almost) null pointer derefrences, patch 
attached.

        * kern/dl.c (grub_dl_load_file): Check for null pointer returned
        from grub_dl_load_core.
        * genmk.rb (PModule): Allocate storage to common symbols
        when linking modules.


-- 
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!
--- grub2.orig/kern/dl.c        2004-04-04 14:46:01.000000000 +0100
+++ grub2/kern/dl.c     2004-05-26 21:09:44.000000000 +0100
@@ -548,6 +548,8 @@
     goto failed;
 
   mod = grub_dl_load_core (core, size);
+  if (! mod) goto failed;
+  
   mod->ref_count = 0;
 
  failed:
--- grub2.orig/genmk.rb 2004-04-04 14:45:59.000000000 +0100
+++ grub2/genmk.rb      2004-05-27 00:37:19.000000000 +0100
@@ -117,7 +117,7 @@
 
 address@hidden: #{pre_obj} #{mod_obj}
        -rm -f $@
-       $(LD) -r -o $@ $^
+       $(LD) -r -d -o $@ $^
        $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment $@
 
 #{pre_obj}: #{objs_str}

Attachment: pgp40Li59TwCM.pgp
Description: signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]