]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2005-09-29 Yoshinori K. Okuji <okuji@enbug.org>
authorokuji <okuji@localhost>
Wed, 28 Sep 2005 23:04:26 +0000 (23:04 +0000)
committerokuji <okuji@localhost>
Wed, 28 Sep 2005 23:04:26 +0000 (23:04 +0000)
        Make GRUB's kernel compliant to Multiboot Specification.

        * kern/i386/pc/startup.S (multiboot_header): New label.
        (multiboot_entry): Likewise.
        (multiboot_trampoline): Likewise.

        * include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE):
        Increased to 0x4A0.

        * fs/xfs.c (grub_xfs_iterate_dir): Fix a syntax error. You may not
        put parentheses after a question mark.
        [!GRUB_UTIL] (my_mod): New variable.

        * util/grub-emu.c (main): Call grub_xfs_init and grub_xfs_fini.

ChangeLog
fs/xfs.c
include/grub/i386/pc/kernel.h
kern/i386/pc/startup.S
util/grub-emu.c

index dc77c3a5c78505e1d6beaae8f1a361a9b13d2be2..4112b5d5d8a2aff724e428825237c4c3b651a8ce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2005-09-29  Yoshinori K. Okuji  <okuji@enbug.org>
+
+       Make GRUB's kernel compliant to Multiboot Specification.
+       
+       * kern/i386/pc/startup.S (multiboot_header): New label.
+       (multiboot_entry): Likewise.
+       (multiboot_trampoline): Likewise.
+
+       * include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE):
+       Increased to 0x4A0.
+
+       * fs/xfs.c (grub_xfs_iterate_dir): Fix a syntax error. You may not
+       put parentheses after a question mark.
+       [!GRUB_UTIL] (my_mod): New variable.
+
+       * util/grub-emu.c (main): Call grub_xfs_init and grub_xfs_fini.
+
 2005-09-28  Marco Gerards  <mgerards@xs4all.nl>
 
        Adds support for the XFS filesystem.  Btrees are not supported
index c882af9b062477b216945bf1bbec2a33a5f34d16..32cbbf0ea69105382e6947477eae830c102b2e89 100644 (file)
--- a/fs/xfs.c
+++ b/fs/xfs.c
@@ -119,6 +119,11 @@ struct grub_xfs_data
   struct grub_fshelp_node diropen;
 
 };
+
+#ifndef GRUB_UTIL
+static grub_dl_t my_mod;
+#endif
+
 \f
 
 /* Filetype information as used in inodes.  */
@@ -300,6 +305,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
                                grub_fshelp_node_t node))
 {
   struct grub_fshelp_node *diro = (struct grub_fshelp_node *) dir;
+  auto int call_hook (grub_uint64_t ino, char *filename);
     
   int call_hook (grub_uint64_t ino, char *filename)
     {
@@ -370,8 +376,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
 
            de = ((struct grub_xfs_dir_entry *) 
                  (((char *) de)+ sizeof (struct grub_xfs_dir_entry) + de->len
-                  + (smallino ? (sizeof (grub_uint32_t)
-                                 : sizeof (grub_uint64_t))) - 1));
+                  + (smallino ? sizeof (grub_uint32_t)
+                     : sizeof (grub_uint64_t))) - 1);
          }
        break;
       }
index 0496e9645ab532ac2f16c99ba4d76e088b06680e..cc2cdb05a80eaa7dffaa34cba1678fcf26fab8d5 100644 (file)
@@ -39,7 +39,7 @@
 #define GRUB_KERNEL_MACHINE_PREFIX             0x1c
 
 /* The size of the first region which won't be compressed.  */
-#define GRUB_KERNEL_MACHINE_RAW_SIZE           0x440
+#define GRUB_KERNEL_MACHINE_RAW_SIZE           0x4A0
 
 #ifndef ASM_FILE
 
index 7aa2edbb5dd97f1ca2bd66d7d781e18aed36258d..de35c10225b46c1955fe954b146c6ea0d8610987 100644 (file)
@@ -104,6 +104,66 @@ VARIABLE(grub_prefix)
 
        . = EXT_C(start) + 0x50
 
+/*
+ * Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
+ * This uses the a.out kludge to load raw binary to the area starting at 1MB,
+ * and relocates itself after loaded.
+ */
+multiboot_header:
+       /* magic */
+       .long   0x1BADB002
+       /* flags */
+       .long   (1 << 16)
+       /* checksum */
+       .long   -0x1BADB002 - (1 << 16)
+       /* header addr */
+       .long   multiboot_header - _start + 0x100000 + 0x200
+       /* load addr */
+       .long   0x100000
+       /* load end addr */
+       .long   0
+       /* bss end addr */
+       .long   0
+       /* entry addr */
+       .long   multiboot_entry - _start + 0x100000 + 0x200
+       
+multiboot_entry:
+       .code32
+       /* obtain the boot device */
+       movl    12(%ebx), %edx
+
+       /* relocate the code */
+       movl    $(GRUB_KERNEL_MACHINE_RAW_SIZE + 0x200), %ecx
+       addl    EXT_C(grub_compressed_size) - _start + 0x100000 + 0x200, %ecx
+       movl    $0x100000, %esi
+       movl    $GRUB_BOOT_MACHINE_KERNEL_ADDR, %edi
+       cld
+       rep
+       movsb
+       /* jump to the real address */
+       movl    $multiboot_trampoline, %eax
+       jmp     *%eax
+       
+multiboot_trampoline:
+       /* fill the boot information */
+       movl    %edx, %eax
+       shrl    $8, %eax
+       xorl    %ebx, %ebx
+       cmpb    $0xFF, %al
+       je      1f
+       movb    %ah, %bl
+       movl    %ebx, EXT_C(grub_install_dos_part)
+1:
+       cmpb    $0xFF, %ah
+       je      2f
+       movb    %al, %bl
+       movl    %ebx, EXT_C(grub_install_bsd_part)
+2:
+       shrl    $24, %edx
+       /* enter the usual booting */
+       call    prot_to_real
+       .code16
+       
 /* the real mode code continues... */
 codestart:
        cli             /* we're not safe here! */
index 5a7f71d8ef2a4b7edce69071a2e9abe1b4adcb3c..b8f97acf382ff87421f84a3f551e132e6de0c1d9 100644 (file)
@@ -196,6 +196,7 @@ main (int argc, char *argv[])
 
   /* Initialize the default modules.  */
   grub_iso9660_init ();
+  grub_xfs_init ();
   grub_fat_init ();
   grub_ext2_init ();
   grub_ufs_init ();
@@ -241,6 +242,7 @@ main (int argc, char *argv[])
   grub_hfs_fini ();
   grub_jfs_fini ();
   grub_fat_fini ();
+  grub_xfs_fini ();
   grub_boot_fini ();
   grub_cmp_fini ();
   grub_cat_fini ();