From: okuji Date: Wed, 28 Sep 2005 23:04:26 +0000 (+0000) Subject: 2005-09-29 Yoshinori K. Okuji X-Git-Tag: 1.98~2066 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4093103f875d3149f2f9dbcad22b360660eb8f4;p=thirdparty%2Fgrub.git 2005-09-29 Yoshinori K. Okuji 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. --- diff --git a/ChangeLog b/ChangeLog index dc77c3a5c..4112b5d5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2005-09-29 Yoshinori K. Okuji + + 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 Adds support for the XFS filesystem. Btrees are not supported diff --git a/fs/xfs.c b/fs/xfs.c index c882af9b0..32cbbf0ea 100644 --- 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 + /* 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; } diff --git a/include/grub/i386/pc/kernel.h b/include/grub/i386/pc/kernel.h index 0496e9645..cc2cdb05a 100644 --- a/include/grub/i386/pc/kernel.h +++ b/include/grub/i386/pc/kernel.h @@ -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 diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S index 7aa2edbb5..de35c1022 100644 --- a/kern/i386/pc/startup.S +++ b/kern/i386/pc/startup.S @@ -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! */ diff --git a/util/grub-emu.c b/util/grub-emu.c index 5a7f71d8e..b8f97acf3 100644 --- a/util/grub-emu.c +++ b/util/grub-emu.c @@ -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 ();