2005-01-04 Hollis Blanchard <hollis@penguinppc.org>
* TODO: Add note about endianness in grub-mkimage. * boot/powerpc/ieee1275/crt0.S (note): Remove unused .note section. * conf/powerpc-ieee1275.rmk (bin_UTILITIES): Add grub-mkimage. (grub_mkimage_SOURCES): New target. * include/grub/kernel.h (grub_start_addr): Remove variable. (grub_end_addr): Likewise. (grub_total_module_size): Likewise. (grub_kernel_image_size): Likewise. (GRUB_MODULE_MAGIC): New constant. (grub_module_info): New structure. (grub_arch_modules_addr): New prototype. (grub_get_end_addr): Remove prototype. * include/grub/i386/pc/kernel.h (grub_end_addr): New prototype. * include/grub/powerpc/ieee1275/kernel.h: New file. * include/grub/util/misc.h (grub_util_get_fp_size): New prototype. (grub_util_read_at): Likewise. (grub_util_write_image_at): Likewise. * kern/main.c (grub_get_end_addr): Remove function. (grub_load_modules): Call grub_arch_modules_addr instead of using grub_end_addr. Look for a grub_module_info struct in memory. Use the grub_module_info fields instead of calling grub_get_end_addr as loop conditions. Move grub_add_unused_region code here. (grub_add_unused_region): Remove function. * kern/i386/pc/init.c: Include grub/cache.h. (grub_machine_init): Remove call to grub_get_end_addr. Remove one call to add_mem_region. (grub_arch_modules_addr): New function. * kern/powerpc/ieee1275/init.c (grub_end_addr): Remove variable. (grub_total_module_size): Likewise. Include grub/machine/kernel.h. (grub_arch_modules_addr): New function. * util/grub-emu.c (grub_end_addr): Remove variable. (grub_total_module_size): Likewise. (grub_arch_modules_addr): New function. * util/misc.c: Include unistd.h. (grub_util_get_fp_size): New function. (grub_util_read_at): Likewise. (grub_util_write_image_at): Likewise. (grub_util_read_image): Call grub_util_read_at. (grub_util_write_image): Call grub_util_write_image_at. * util/i386/pc/grub-mkimage.c (generate_image): Allocate additional memory in kernel_img for a struct grub_module_info. Fill in that grub_module_info. * util/powerpc/ieee1275/grub-mkimage.c: New file.
This commit is contained in:
parent
458786f8fc
commit
0b412211b3
15 changed files with 488 additions and 70 deletions
|
@ -58,6 +58,9 @@ extern char grub_prefix[];
|
|||
/* The boot BIOS drive number. */
|
||||
extern grub_int32_t grub_boot_drive;
|
||||
|
||||
/* The end address of the kernel. */
|
||||
extern grub_addr_t grub_end_addr;
|
||||
|
||||
#endif /* ! ASM_FILE */
|
||||
|
||||
#endif /* ! KERNEL_MACHINE_HEADER */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -31,17 +31,20 @@ struct grub_module_header
|
|||
grub_size_t size;
|
||||
};
|
||||
|
||||
/* The start address of the kernel. */
|
||||
extern grub_addr_t grub_start_addr;
|
||||
/* "gmim" (GRUB Module Info Magic). */
|
||||
#define GRUB_MODULE_MAGIC 0x676d696d
|
||||
|
||||
/* The end address of the kernel. */
|
||||
extern grub_addr_t grub_end_addr;
|
||||
struct grub_module_info
|
||||
{
|
||||
/* Magic number so we know we have modules present. */
|
||||
grub_uint32_t magic;
|
||||
/* The offset of the modules. */
|
||||
grub_off_t offset;
|
||||
/* The size of all modules plus this header. */
|
||||
grub_size_t size;
|
||||
};
|
||||
|
||||
/* The total size of modules including their headers. */
|
||||
extern grub_size_t grub_total_module_size;
|
||||
|
||||
/* The size of the kernel image. */
|
||||
extern grub_size_t grub_kernel_image_size;
|
||||
extern grub_addr_t grub_arch_modules_addr (void);
|
||||
|
||||
/* The start point of the C code. */
|
||||
void grub_main (void);
|
||||
|
@ -49,9 +52,6 @@ void grub_main (void);
|
|||
/* The machine-specific initialization. This must initialize memory. */
|
||||
void grub_machine_init (void);
|
||||
|
||||
/* Return the end address of the core image. */
|
||||
grub_addr_t grub_get_end_addr (void);
|
||||
|
||||
/* Register all the exported symbols. This is automatically generated. */
|
||||
void grub_register_exported_symbols (void);
|
||||
|
||||
|
|
26
include/grub/powerpc/ieee1275/kernel.h
Normal file
26
include/grub/powerpc/ieee1275/kernel.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
/* Where grub-mkimage places the core modules in memory. */
|
||||
#define GRUB_IEEE1275_MODULE_BASE 0x0300000
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -34,9 +34,13 @@ void *xrealloc (void *ptr, size_t size);
|
|||
char *xstrdup (const char *str);
|
||||
|
||||
char *grub_util_get_path (const char *dir, const char *file);
|
||||
size_t grub_util_get_fp_size (FILE *fp);
|
||||
size_t grub_util_get_image_size (const char *path);
|
||||
void grub_util_read_at (void *img, size_t len, off_t offset, FILE *fp);
|
||||
char *grub_util_read_image (const char *path);
|
||||
void grub_util_load_image (const char *path, char *buf);
|
||||
void grub_util_write_image (const char *img, size_t size, FILE *out);
|
||||
void grub_util_write_image_at (const void *img, size_t size, off_t offset,
|
||||
FILE *out);
|
||||
|
||||
#endif /* ! GRUB_UTIL_MISC_HEADER */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue