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:
parent
3d7f54c94d
commit
55a581dc06
11 changed files with 272 additions and 16 deletions
|
@ -35,7 +35,8 @@ enum grub_disk_dev_id
|
|||
GRUB_DISK_DEVICE_RAID_ID,
|
||||
GRUB_DISK_DEVICE_LVM_ID,
|
||||
GRUB_DISK_DEVICE_HOST_ID,
|
||||
GRUB_DISK_DEVICE_ATA_ID
|
||||
GRUB_DISK_DEVICE_ATA_ID,
|
||||
GRUB_DISK_DEVICE_MEMDISK_ID,
|
||||
};
|
||||
|
||||
struct grub_disk;
|
||||
|
|
|
@ -34,8 +34,11 @@
|
|||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART 0x18
|
||||
|
||||
/* The offset of GRUB_MEMDISK_IMAGE_SIZE. */
|
||||
#define GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE 0x1c
|
||||
|
||||
/* The offset of GRUB_PREFIX. */
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x1c
|
||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x20
|
||||
|
||||
/* End of the data section. */
|
||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
||||
|
@ -47,12 +50,21 @@
|
|||
|
||||
#include <grub/types.h>
|
||||
|
||||
/* The size of kernel image. */
|
||||
extern grub_int32_t grub_kernel_image_size;
|
||||
|
||||
/* The total size of module images following the kernel. */
|
||||
extern grub_int32_t grub_total_module_size;
|
||||
|
||||
/* The DOS partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_dos_part;
|
||||
|
||||
/* The BSD partition number of the installed partition. */
|
||||
extern grub_int32_t grub_install_bsd_part;
|
||||
|
||||
/* The size of memory disk image, if present. */
|
||||
extern grub_int32_t grub_memdisk_image_size;
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
#define GRUB_MEMORY_MACHINE_RESERVED_END \
|
||||
(GRUB_MEMORY_MACHINE_PROT_STACK + 0x10)
|
||||
|
||||
/* The area where GRUB is decompressed at early startup. */
|
||||
#define GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR 0x100000
|
||||
|
||||
/* The address of a partition table passed to another boot loader. */
|
||||
#define GRUB_MEMORY_MACHINE_PART_TABLE_ADDR 0x7be
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#define GRUB_KERNEL_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* The module header. */
|
||||
struct grub_module_header
|
||||
|
@ -44,6 +45,8 @@ struct grub_module_info
|
|||
};
|
||||
|
||||
extern grub_addr_t grub_arch_modules_addr (void);
|
||||
extern grub_addr_t EXPORT_FUNC(grub_arch_memdisk_addr) (void);
|
||||
extern grub_off_t EXPORT_FUNC(grub_arch_memdisk_size) (void);
|
||||
|
||||
/* The start point of the C code. */
|
||||
void grub_main (void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue