2008-01-21 Robert Millan <rmh@aybabtu.com>

* conf/i386-pc.rmk (kernel_img_HEADERS): Add `machine/kernel.h'.
        (pkglib_MODULES): Add `memdisk.mod'.
        (memdisk_mod_SOURCES): New variable.
        (memdisk_mod_CFLAGS): Likewise.
        (memdisk_mod_LDFLAGS): Likewise.

        * disk/memdisk.c: New file.

        * include/grub/disk.h (grub_disk_dev_id): Add
        `GRUB_DISK_DEVICE_MEMDISK_ID'.

        * include/grub/i386/pc/kernel.h
        (GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE): New macro.
        (GRUB_KERNEL_MACHINE_PREFIX): Increment by 4.
        (grub_kernel_image_size): New variable declaration.
        (grub_total_module_size): Likewise.
        (grub_memdisk_image_size): Likewise.

        * include/grub/i386/pc/memory.h
        (GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR): New macro.

        * include/grub/kernel.h: Include `<grub/symbol.h>'.
        (grub_arch_memdisk_addr): New variable declaration.
        (grub_arch_memdisk_size): Likewise.

        * kern/i386/pc/init.c (grub_arch_memdisk_addr): New function.
        (grub_arch_memdisk_size): Likewise.

        * kern/i386/pc/startup.S (grub_memdisk_image_size): New variable.
        (codestart): Replace hardcoded `0x100000' with
        `GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR' macro.

        * util/i386/pc/grub-mkimage.c: Include `<grub/misc.h>'.
        (generate_image): Add `memdisk_path' parameter.  When `memdisk_path' is
        not NULL, append the contents of the file it refers to, at the end of
        the compressed kernel image.  Initialize `grub_memdisk_image_size'
        variable (at `GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE' offset).
        (options): Add "memdisk"|'m' option.
        (main): Parse --memdisk|-m option, and pass user-provided path as
        parameter to generate_image().
This commit is contained in:
robertmh 2008-01-20 23:20:36 +00:00
parent 3d7f54c94d
commit 55a581dc06
11 changed files with 272 additions and 16 deletions

View file

@ -248,3 +248,19 @@ grub_arch_modules_addr (void)
{
return grub_end_addr;
}
/* Return the start of the memdisk image. */
grub_addr_t
grub_arch_memdisk_addr (void)
{
return GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR
+ (grub_kernel_image_size - GRUB_KERNEL_MACHINE_RAW_SIZE)
+ grub_total_module_size;
}
/* Return the size of the memdisk image. */
grub_off_t
grub_arch_memdisk_size (void)
{
return grub_memdisk_image_size;
}

View file

@ -95,6 +95,8 @@ VARIABLE(grub_install_dos_part)
.long 0xFFFFFFFF
VARIABLE(grub_install_bsd_part)
.long 0xFFFFFFFF
VARIABLE(grub_memdisk_image_size)
.long 0
VARIABLE(grub_prefix)
/* to be filled by grub-mkimage */
@ -196,7 +198,7 @@ codestart:
call EXT_C(grub_gate_a20)
/* decompress the compressed part and put the result at 1MB */
movl $0x100000, %esi
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %esi
movl $(START_SYMBOL + GRUB_KERNEL_MACHINE_RAW_SIZE), %edi
pushl %esi