* util/grub-mkimage.c: Move backend part to ...
* util/mkimage.c: ... here.
This commit is contained in:
parent
4b4eeb3cc1
commit
ec16e02639
6 changed files with 1931 additions and 1825 deletions
|
@ -1,3 +1,8 @@
|
|||
2013-10-15 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-mkimage.c: Move backend part to ...
|
||||
* util/mkimage.c: ... here.
|
||||
|
||||
2013-10-15 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Allow compilation with mingw64 albeit with warnings due to lack of
|
||||
|
|
|
@ -160,6 +160,7 @@ program = {
|
|||
mansection = 1;
|
||||
|
||||
common = util/grub-mkimage.c;
|
||||
common = util/mkimage.c;
|
||||
common = util/resolve.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
common = grub-core/osdep/init.c;
|
||||
|
|
|
@ -25,6 +25,30 @@
|
|||
#include <grub/device.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/emu/hostfile.h>
|
||||
|
||||
typedef enum {
|
||||
GRUB_COMPRESSION_AUTO,
|
||||
GRUB_COMPRESSION_NONE,
|
||||
GRUB_COMPRESSION_XZ,
|
||||
GRUB_COMPRESSION_LZMA
|
||||
} grub_compression_t;
|
||||
|
||||
struct grub_install_image_target_desc;
|
||||
|
||||
void
|
||||
grub_install_generate_image (const char *dir, const char *prefix,
|
||||
FILE *out,
|
||||
const char *outname, char *mods[],
|
||||
char *memdisk_path, char **pubkey_paths,
|
||||
size_t npubkeys,
|
||||
char *config_path,
|
||||
const struct grub_install_image_target_desc *image_target,
|
||||
int note,
|
||||
grub_compression_t comp);
|
||||
|
||||
const struct grub_install_image_target_desc *
|
||||
grub_install_get_image_target (const char *arg);
|
||||
|
||||
void
|
||||
grub_util_bios_setup (const char *dir,
|
||||
const char *boot_file, const char *core_file,
|
||||
|
@ -36,6 +60,11 @@ grub_util_sparc_setup (const char *dir,
|
|||
const char *dest, int force,
|
||||
int fs_probe, int allow_floppy);
|
||||
|
||||
char *
|
||||
grub_install_get_image_targets_string (void);
|
||||
|
||||
const char *
|
||||
grub_util_get_target_dirname (const struct grub_install_image_target_desc *t);
|
||||
|
||||
void
|
||||
grub_install_get_blocklist (grub_device_t root_dev,
|
||||
|
|
1832
util/grub-mkimage.c
1832
util/grub-mkimage.c
File diff suppressed because it is too large
Load diff
|
@ -67,7 +67,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections,
|
|||
Elf_Shdr *symtab_section, Elf_Addr *section_addresses,
|
||||
Elf_Half section_entsize, Elf_Half num_sections,
|
||||
void *jumpers, Elf_Addr jumpers_addr,
|
||||
struct image_target_desc *image_target)
|
||||
const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
Elf_Word symtab_size, sym_size, num_syms;
|
||||
Elf_Off symtab_offset;
|
||||
|
@ -140,7 +140,7 @@ SUFFIX (relocate_symbols) (Elf_Ehdr *e, Elf_Shdr *sections,
|
|||
/* Return the address of a symbol at the index I in the section S. */
|
||||
static Elf_Addr
|
||||
SUFFIX (get_symbol_address) (Elf_Ehdr *e, Elf_Shdr *s, Elf_Word i,
|
||||
struct image_target_desc *image_target)
|
||||
const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
Elf_Sym *sym;
|
||||
|
||||
|
@ -153,7 +153,7 @@ SUFFIX (get_symbol_address) (Elf_Ehdr *e, Elf_Shdr *s, Elf_Word i,
|
|||
/* Return the address of a modified value. */
|
||||
static Elf_Addr *
|
||||
SUFFIX (get_target_address) (Elf_Ehdr *e, Elf_Shdr *s, Elf_Addr offset,
|
||||
struct image_target_desc *image_target)
|
||||
const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
return (Elf_Addr *) ((char *) e + grub_target_to_host (s->sh_offset) + offset);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ SUFFIX (get_target_address) (Elf_Ehdr *e, Elf_Shdr *s, Elf_Addr offset,
|
|||
#ifdef MKIMAGE_ELF64
|
||||
static Elf_Addr
|
||||
SUFFIX (count_funcs) (Elf_Ehdr *e, Elf_Shdr *symtab_section,
|
||||
struct image_target_desc *image_target)
|
||||
const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
Elf_Word symtab_size, sym_size, num_syms;
|
||||
Elf_Off symtab_offset;
|
||||
|
@ -195,7 +195,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
|
|||
const char *strtab,
|
||||
char *pe_target, Elf_Addr tramp_off,
|
||||
Elf_Addr got_off,
|
||||
struct image_target_desc *image_target)
|
||||
const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
Elf_Half i;
|
||||
Elf_Shdr *s;
|
||||
|
@ -472,7 +472,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
|
|||
static Elf_Addr
|
||||
SUFFIX (add_fixup_entry) (struct fixup_block_list **cblock, grub_uint16_t type,
|
||||
Elf_Addr addr, int flush, Elf_Addr current_address,
|
||||
struct image_target_desc *image_target)
|
||||
const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
struct grub_pe32_fixup_block *b;
|
||||
|
||||
|
@ -569,7 +569,7 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out,
|
|||
Elf_Half section_entsize, Elf_Half num_sections,
|
||||
const char *strtab,
|
||||
Elf_Addr jumpers, grub_size_t njumpers,
|
||||
struct image_target_desc *image_target)
|
||||
const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
unsigned i;
|
||||
Elf_Shdr *s;
|
||||
|
@ -755,7 +755,7 @@ SUFFIX (make_reloc_section) (Elf_Ehdr *e, void **out,
|
|||
/* Determine if this section is a text section. Return false if this
|
||||
section is not allocated. */
|
||||
static int
|
||||
SUFFIX (is_text_section) (Elf_Shdr *s, struct image_target_desc *image_target)
|
||||
SUFFIX (is_text_section) (Elf_Shdr *s, const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
if (image_target->id != IMAGE_EFI
|
||||
&& grub_target_to_host32 (s->sh_type) != SHT_PROGBITS)
|
||||
|
@ -768,7 +768,7 @@ SUFFIX (is_text_section) (Elf_Shdr *s, struct image_target_desc *image_target)
|
|||
BSS is also a data section, since the converter initializes BSS
|
||||
when producing PE32 to avoid a bug in EFI implementations. */
|
||||
static int
|
||||
SUFFIX (is_data_section) (Elf_Shdr *s, struct image_target_desc *image_target)
|
||||
SUFFIX (is_data_section) (Elf_Shdr *s, const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
if (image_target->id != IMAGE_EFI
|
||||
&& grub_target_to_host32 (s->sh_type) != SHT_PROGBITS)
|
||||
|
@ -779,7 +779,7 @@ SUFFIX (is_data_section) (Elf_Shdr *s, struct image_target_desc *image_target)
|
|||
|
||||
/* Return if the ELF header is valid. */
|
||||
static int
|
||||
SUFFIX (check_elf_header) (Elf_Ehdr *e, size_t size, struct image_target_desc *image_target)
|
||||
SUFFIX (check_elf_header) (Elf_Ehdr *e, size_t size, const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
if (size < sizeof (*e)
|
||||
|| e->e_ident[EI_MAG0] != ELFMAG0
|
||||
|
@ -802,7 +802,7 @@ SUFFIX (locate_sections) (Elf_Shdr *sections, Elf_Half section_entsize,
|
|||
Elf_Half num_sections, const char *strtab,
|
||||
size_t *exec_size, size_t *kernel_sz,
|
||||
size_t *all_align,
|
||||
struct image_target_desc *image_target)
|
||||
const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
int i;
|
||||
Elf_Addr current_address;
|
||||
|
@ -884,7 +884,7 @@ SUFFIX (load_image) (const char *kernel_path, size_t *exec_size,
|
|||
size_t total_module_size, grub_uint64_t *start,
|
||||
void **reloc_section, size_t *reloc_size,
|
||||
size_t *align,
|
||||
struct image_target_desc *image_target)
|
||||
const struct grub_install_image_target_desc *image_target)
|
||||
{
|
||||
char *kernel_img, *out_img;
|
||||
const char *strtab;
|
||||
|
|
1865
util/mkimage.c
Normal file
1865
util/mkimage.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue