bug-grub
[Top][All Lists]
Advanced

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

Re: Multiboot specification for PowerPC


From: Peter Bruin
Subject: Re: Multiboot specification for PowerPC
Date: Mon, 2 Aug 2004 01:55:32 +0200
User-agent: Internet Messaging Program (IMP) 3.2.1

Marco Gerards <address@hidden> wrote:

> Peter Bruin <address@hidden> writes:
> 
> > How is the state of things on a multiboot specification for the
> > PowerPC and other architectures?  I saw there is a file
> > powerpc/ieee1275/multiboot.h in the GRUB 2 CVS source, but that's just
> > a copy of the i386 version.  If anybody has thoughts on it, I'd like
> > to hear them, otherwise I'm interested in trying something myself. 
> 
> It is on my todo.  And not just for the PPC, but something more
> generic.  It needs some discussion of course.

OK, then it's probably not such a good idea to try to invent something myself in
the meantime.  The only important idea I had on this was probably something like
this: define flags in the multiboot header for the kernel to request certain
kinds of information (memory maps, devices (OpenFirmware tree), modules) and to
have a multiboot info structure containing (pointers to) the data requested by
the multiboot header.  This seems to be somewhat like the original multiboot,
only more consistent; but since I have no experience at all with multiboot, I'm
not sure how well it would work.

> > (I would like to use GRUB 2 with multiboot for the PowerPC port of
> > the Hurd using L4; I have worked on the Mach version before, but
> > it's unlikely that that version will be ported to newer PowerPC
> > machines.)
> 
> AFAIK hurd-l4 already works on the PPC.  Just have a look at the
> l4-hurd mailinglist.  There is a patch for PPC support, it just hasn't
> been applied yet.

Ah, I had guessed Marcus had only written the PPC files that are already in CVS
(in preparation for an eventual real port), but after reading the mailing list a
bit more carefully I noticed that Johan Rydberg has already done some more work
(which I would be going to duplicate now if I didn't know about it).  All the
activity in this area seems to be in October 2003, however.  I tried to compile
Hurd-L4 yesterday, but there have been some changes in the L4 API and in the
arch-independent Hurd code in the meantime which caused the PPC code not to
compile anymore.  I'm preparing a patch for it, which I want to send to l4-hurd
tomorrow.

> As for the bootloader, AFAIK they make one big binary of the kernel
> and modules somehow.  Of course it is much nicer to use multiboot for
> this.  The main reason I had for porting GRUB 2 to the mac was as a
> preparation for the GNU/Hurd port.

Yes, from what I read on the mailing list it seems to be an adaptation of the
`piggyback' bootloader in the Pistachio source.  A day or two ago I found out
about your port of GRUB 2 to the Mac, which I found a wonderful coincidence (not
knowing about the fact that the Hurd was the very reason for the port...).  By
the way, I compiled GRUB 2, and it seems to work on my machine (eMac).  I
haven't tried to boot a Linux kernel with it yet, though.  There were two small
compilation problems, for which I have included a patch below.  (I'm not
entirely sure about the change to grub_linux_init; I remember reading a
discussion about the two functions involved on the mailing list, but
grub_rescue_cmd_linux doesn't appear to exist.)

Peter


2004-08-02  Peter Bruin  <address@hidden>

        * loader/powerpc/ieee1275/linux.c (grub_load_linux): Remove
        superfluous checks for validity of ELF header.
        (grub_linux_init): Pass grub_load_linux instead of
        grub_rescue_cmd_linux as second argument of
        grub_rescue_register_command.

        * Makefile.in (RMKFILES): Add conf/powerpc-ieee1275.rmk.


Index: Makefile.in
===================================================================
RCS file: /cvsroot/grub/grub2/Makefile.in,v
retrieving revision 1.6
diff -u -r1.6 Makefile.in
--- Makefile.in 4 Apr 2004 13:45:59 -0000       1.6
+++ Makefile.in 1 Aug 2004 23:36:48 -0000
@@ -69,7 +69,7 @@
 
 ### General variables.
 
-RMKFILES = $(addprefix conf/,i386-pc.rmk)
+RMKFILES = $(addprefix conf/,i386-pc.rmk powerpc-ieee1275.rmk)
 MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
 
 COMMON_DISTFILES = AUTHORS COPYING ChangeLog INSTALL NEWS README \
Index: loader/powerpc/ieee1275/linux.c
===================================================================
RCS file: /cvsroot/grub/grub2/loader/powerpc/ieee1275/linux.c,v
retrieving revision 1.1
diff -u -r1.1 linux.c
--- loader/powerpc/ieee1275/linux.c     27 Jul 2004 17:47:37 -0000      1.1
+++ loader/powerpc/ieee1275/linux.c     1 Aug 2004 23:36:50 -0000
@@ -139,27 +139,6 @@
       goto fail;
     }
   
-  if (ehdr.e_type != ET_EXEC)
-    {
-      grub_error (GRUB_ERR_UNKNOWN_OS,
-                 "This ELF file is not of the right type\n");
-      goto fail;
-    }
-
-  if (ehdr.e_machine != EM_PPC)
-    {
-      grub_error (GRUB_ERR_UNKNOWN_OS,
-                 "This ELF file is not for the PPC32\n");
-      goto fail;
-    }
-  
-  if (ehdr.e_version != EV_CURRENT)
-    {
-      grub_error (GRUB_ERR_UNKNOWN_OS,
-                 "Invalid ELF version\n");
-      goto fail;
-    }
-
   /* Read the sections.  */
   entry = ehdr.e_entry;
   if (entry == 0xc0000000)
@@ -272,7 +251,7 @@
 void
 grub_linux_init (void)
 {
-  grub_rescue_register_command ("linux", grub_rescue_cmd_linux,
+  grub_rescue_register_command ("linux", grub_load_linux,
                                "load a linux kernel");
 }
 





reply via email to

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