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.
This commit is contained in:
okuji 2005-09-28 23:04:26 +00:00
parent b2499b29cd
commit b4093103f8
5 changed files with 88 additions and 3 deletions

View file

@ -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

View file

@ -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;
}

View 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

View 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! */

View 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 ();