]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Some cleanups
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 26 Apr 2010 19:11:16 +0000 (21:11 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 26 Apr 2010 19:11:16 +0000 (21:11 +0200)
36 files changed:
conf/common.rmk
conf/i386-pc.rmk
include/grub/i386/coreboot/kernel.h [deleted file]
include/grub/i386/efi/kernel.h [deleted file]
include/grub/i386/ieee1275/kernel.h [deleted file]
include/grub/i386/kernel.h [deleted file]
include/grub/i386/pc/kernel.h
include/grub/i386/qemu/kernel.h
include/grub/kernel.h
include/grub/mips/kernel.h [deleted file]
include/grub/mips/qemu-mips/boot.h [deleted file]
include/grub/mips/qemu-mips/kernel.h
include/grub/mips/yeeloong/boot.h [deleted file]
include/grub/mips/yeeloong/kernel.h
include/grub/offsets.h
include/grub/powerpc/ieee1275/kernel.h [deleted file]
include/grub/sparc64/ieee1275/kernel.h
include/grub/sparc64/kernel.h [deleted file]
include/grub/types.h
include/grub/x86_64/efi/kernel.h [deleted file]
include/grub/x86_64/kernel.h [deleted file]
kern/efi/init.c
kern/i386/coreboot/init.c
kern/i386/coreboot/startup.S
kern/i386/ieee1275/startup.S
kern/ieee1275/cmain.c
kern/ieee1275/init.c
kern/ieee1275/openfw.c
kern/mips/init.c
kern/mips/startup.S
kern/mips/yeeloong/init.c
kern/powerpc/ieee1275/startup.S
util/elf/grub-mkimage.c [deleted file]
util/grub-mkimagexx.c
util/i386/pc/grub-setup.c
util/sparc64/ieee1275/grub-setup.c

index 98dca34f9814b7405185fec243444cf725658d14..f9e7eb194c0fa725136807484e02283a1d2bed2c 100644 (file)
@@ -118,7 +118,7 @@ kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
        list.h handler.h command.h i18n.h env_private.h libgcc.h
 
 ifneq ($(platform), emu)
-kernel_img_HEADERS += machine/memory.h machine/loader.h machine/kernel.h
+kernel_img_HEADERS += machine/memory.h machine/loader.h
 endif
 
 symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
index f0da94b4263e060a95d2c410f52cf5f35268b8f0..4c55f28f6d203900fa520e29782aa9d1168e1fd2 100644 (file)
@@ -53,7 +53,7 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
        term/i386/pc/console.c term/i386/vga_common.c \
        symlist.c
 kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \
-       machine/pxe.h i386/pit.h
+       machine/pxe.h i386/pit.h machine/kernel.h
 kernel_img_CFLAGS = $(COMMON_CFLAGS)  $(TARGET_IMG_CFLAGS)
 kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
 kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x8200 $(COMMON_CFLAGS)
diff --git a/include/grub/i386/coreboot/kernel.h b/include/grub/i386/coreboot/kernel.h
deleted file mode 100644 (file)
index fb60668..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2006,2007,2008  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
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_KERNEL_MACHINE_HEADER
-#define GRUB_KERNEL_MACHINE_HEADER     1
-
-#include <grub/symbol.h>
-
-#ifndef ASM_FILE
-extern char grub_prefix[];
-#endif
-
-#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
diff --git a/include/grub/i386/efi/kernel.h b/include/grub/i386/efi/kernel.h
deleted file mode 100644 (file)
index 0cb39a2..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2007  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
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_KERNEL_HEADER
-#define GRUB_MACHINE_KERNEL_HEADER   1
-
-/* The prefix which points to the directory where GRUB modules and its
-   configuration file are located.  */
-extern char grub_prefix[];
-
-#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
-
diff --git a/include/grub/i386/ieee1275/kernel.h b/include/grub/i386/ieee1275/kernel.h
deleted file mode 100644 (file)
index dccf8cb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <grub/powerpc/ieee1275/kernel.h>
diff --git a/include/grub/i386/kernel.h b/include/grub/i386/kernel.h
deleted file mode 100644 (file)
index 45c7abd..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2006,2007,2008,2009  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
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_KERNEL_CPU_HEADER
-#define GRUB_KERNEL_CPU_HEADER 1
-
-#endif
index f0a9d4fc28a6d82eb57eadb8774bc38f3daa042c..1de37a5d5d9167f7917ad2790bdd00b062af7ecc 100644 (file)
@@ -41,10 +41,6 @@ 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 prefix which points to the directory where GRUB modules and its
-   configuration file are located.  */
-extern char grub_prefix[];
-
 /* The boot BIOS drive number.  */
 extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
 
index e29f0aeb2a041ae738982d974e882fb23d01fb61..0aa2b3d0914910b055b1a465897cfc0ad35cebff 100644 (file)
@@ -34,10 +34,6 @@ 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 prefix which points to the directory where GRUB modules and its
-   configuration file are located.  */
-extern char grub_prefix[];
-
 #endif /* ! ASM_FILE */
 
 #endif /* ! GRUB_KERNEL_MACHINE_HEADER */
index f7740b2e3a9cd04d4ecc1e424fb5358898cf3f6b..fed875db15334ce1c9c31c789cbd3c2458c51614 100644 (file)
@@ -90,4 +90,8 @@ void grub_machine_set_prefix (void);
 /* Register all the exported symbols. This is automatically generated.  */
 void grub_register_exported_symbols (void);
 
+#if ! defined (ASM_FILE) && !defined (GRUB_MACHINE_EMU)
+extern char grub_prefix[];
+#endif
+
 #endif /* ! GRUB_KERNEL_HEADER */
diff --git a/include/grub/mips/kernel.h b/include/grub/mips/kernel.h
deleted file mode 100644 (file)
index bc4d43b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2006,2007,2008  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
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_KERNEL_CPU_HEADER
-#define GRUB_KERNEL_CPU_HEADER 1
-
-#define GRUB_MOD_ALIGN 0x1
-/* Non-zero value is only needed for PowerMacs.  */
-#define GRUB_MOD_GAP   0x0
-
-#ifndef ASM_FILE
-
-/* The prefix which points to the directory where GRUB modules and its
-   configuration file are located.  */
-extern char grub_prefix[];
-
-#endif
-
-#endif
diff --git a/include/grub/mips/qemu-mips/boot.h b/include/grub/mips/qemu-mips/boot.h
deleted file mode 100644 (file)
index e69de29..0000000
index dbf74c1b20a3adf847cd183687588d3e74fa7923..230455dbf454836971b36ea152e52d229abc27a9 100644 (file)
 void EXPORT_FUNC (grub_reboot) (void);
 void EXPORT_FUNC (grub_halt) (void);
 
-/* The prefix which points to the directory where GRUB modules and its
-   configuration file are located.  */
-extern char grub_prefix[];
-
 #endif
 
 #endif /* ! GRUB_KERNEL_MACHINE_HEADER */
diff --git a/include/grub/mips/yeeloong/boot.h b/include/grub/mips/yeeloong/boot.h
deleted file mode 100644 (file)
index e69de29..0000000
index 230455dbf454836971b36ea152e52d229abc27a9..c08405e835527ce05667bae46621ada5e64c86ce 100644 (file)
@@ -20,7 +20,6 @@
 #define GRUB_KERNEL_MACHINE_HEADER     1
 
 #include <grub/symbol.h>
-#include <grub/cpu/kernel.h>
 
 #ifndef ASM_FILE
 
index a7f252e85f5200c35fd9d97a6f040b255d575b2f..ae0b2557e8c6b47c111b03ca49f7648db5527dbe 100644 (file)
 
 #define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
 
+#define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN 0x1
+
 /* Minimal gap between _end and the start of the modules.  It's a hack
    for PowerMac to prevent "CLAIM failed" error.  The real fix is to
    rewrite grub-mkimage to generate valid ELF files.  */
diff --git a/include/grub/powerpc/ieee1275/kernel.h b/include/grub/powerpc/ieee1275/kernel.h
deleted file mode 100644 (file)
index 75d6c62..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2006,2007,2008  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
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_KERNEL_MACHINE_HEADER
-#define GRUB_KERNEL_MACHINE_HEADER     1
-
-#include <grub/symbol.h>
-#include <grub/offsets.h>
-
-#define GRUB_KERNEL_MACHINE_LINK_ADDR 0x200000
-
-#ifndef ASM_FILE
-
-/* The prefix which points to the directory where GRUB modules and its
-   configuration file are located.  */
-extern char grub_prefix[];
-
-#endif
-
-#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
index 012b5570c89a8b3ff04243fedd9e329f97c7610b..5aa50b852814c8603ed7c507e6284ed3c1b0ff12 100644 (file)
 #ifndef GRUB_KERNEL_MACHINE_HEADER
 #define GRUB_KERNEL_MACHINE_HEADER     1
 
-#define GRUB_MOD_ALIGN 0x2000
-
-/* Non-zero value is only needed for PowerMacs.  */
-#define GRUB_MOD_GAP 0x0
-
 #define GRUB_KERNEL_MACHINE_STACK_SIZE          0x40000
 
 #ifndef ASM_FILE
@@ -37,10 +32,6 @@ 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 prefix which points to the directory where GRUB modules and its
-   configuration file are located.  */
-extern char grub_prefix[];
-
 #endif /* ! ASM_FILE */
 
 #endif /* ! GRUB_KERNEL_MACHINE_HEADER */
diff --git a/include/grub/sparc64/kernel.h b/include/grub/sparc64/kernel.h
deleted file mode 100644 (file)
index 9f404b0..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2005,2006,2007,2008  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
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_KERNEL_CPU_HEADER
-#define GRUB_KERNEL_CPU_HEADER 1
-
-#define GRUB_MOD_ALIGN 0x2000
-
-/* Non-zero value is only needed for PowerMacs.  */
-#define GRUB_MOD_GAP 0x0
-
-#define GRUB_KERNEL_CPU_PREFIX 0x2
-#define GRUB_KERNEL_CPU_DATA_END       0x42
-
-#endif
index 9eaafd0c1a3c8f60964012b562321c378c8bd557..6e9461f1de581b93a60e09dd44260534e5dda77d 100644 (file)
@@ -178,21 +178,6 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
 # define grub_be_to_cpu16(x)   ((grub_uint16_t) (x))
 # define grub_be_to_cpu32(x)   ((grub_uint32_t) (x))
 # define grub_be_to_cpu64(x)   ((grub_uint64_t) (x))
-# ifdef GRUB_TARGET_WORDS_BIGENDIAN
-#  define grub_target_to_host16(x)     ((grub_uint16_t) (x))
-#  define grub_target_to_host32(x)     ((grub_uint32_t) (x))
-#  define grub_target_to_host64(x)     ((grub_uint64_t) (x))
-#  define grub_host_to_target16(x)     ((grub_uint16_t) (x))
-#  define grub_host_to_target32(x)     ((grub_uint32_t) (x))
-#  define grub_host_to_target64(x)     ((grub_uint64_t) (x))
-# else /* ! GRUB_TARGET_WORDS_BIGENDIAN */
-#  define grub_target_to_host16(x)     grub_swap_bytes16(x)
-#  define grub_target_to_host32(x)     grub_swap_bytes32(x)
-#  define grub_target_to_host64(x)     grub_swap_bytes64(x)
-#  define grub_host_to_target16(x)     grub_swap_bytes16(x)
-#  define grub_host_to_target32(x)     grub_swap_bytes32(x)
-#  define grub_host_to_target64(x)     grub_swap_bytes64(x)
-# endif
 #else /* ! WORDS_BIGENDIAN */
 # define grub_cpu_to_le16(x)   ((grub_uint16_t) (x))
 # define grub_cpu_to_le32(x)   ((grub_uint32_t) (x))
@@ -206,27 +191,6 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
 # define grub_be_to_cpu16(x)   grub_swap_bytes16(x)
 # define grub_be_to_cpu32(x)   grub_swap_bytes32(x)
 # define grub_be_to_cpu64(x)   grub_swap_bytes64(x)
-# ifdef GRUB_TARGET_WORDS_BIGENDIAN
-#  define grub_target_to_host16(x)     grub_swap_bytes16(x)
-#  define grub_target_to_host32(x)     grub_swap_bytes32(x)
-#  define grub_target_to_host64(x)     grub_swap_bytes64(x)
-#  define grub_host_to_target16(x)     grub_swap_bytes16(x)
-#  define grub_host_to_target32(x)     grub_swap_bytes32(x)
-#  define grub_host_to_target64(x)     grub_swap_bytes64(x)
-# else /* ! GRUB_TARGET_WORDS_BIGENDIAN */
-#  define grub_target_to_host16(x)     ((grub_uint16_t) (x))
-#  define grub_target_to_host32(x)     ((grub_uint32_t) (x))
-#  define grub_target_to_host64(x)     ((grub_uint64_t) (x))
-#  define grub_host_to_target16(x)     ((grub_uint16_t) (x))
-#  define grub_host_to_target32(x)     ((grub_uint32_t) (x))
-#  define grub_host_to_target64(x)     ((grub_uint64_t) (x))
-# endif
 #endif /* ! WORDS_BIGENDIAN */
 
-#if GRUB_TARGET_SIZEOF_VOID_P == 8
-#  define grub_host_to_target_addr(x) grub_host_to_target64(x)
-#else
-#  define grub_host_to_target_addr(x) grub_host_to_target32(x)
-#endif
-
 #endif /* ! GRUB_TYPES_HEADER */
diff --git a/include/grub/x86_64/efi/kernel.h b/include/grub/x86_64/efi/kernel.h
deleted file mode 100644 (file)
index 0cb39a2..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2002,2003,2007  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
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_KERNEL_HEADER
-#define GRUB_MACHINE_KERNEL_HEADER   1
-
-/* The prefix which points to the directory where GRUB modules and its
-   configuration file are located.  */
-extern char grub_prefix[];
-
-#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
-
diff --git a/include/grub/x86_64/kernel.h b/include/grub/x86_64/kernel.h
deleted file mode 100644 (file)
index 25ac57e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <grub/i386/kernel.h>
index a0b4ff77965dfcbb7831e110c3ea8d49ca2e5d63..afd21055dbf8952dd17e6060fd71c58cf826c2b7 100644 (file)
@@ -24,7 +24,6 @@
 #include <grub/misc.h>
 #include <grub/env.h>
 #include <grub/mm.h>
-#include <grub/machine/kernel.h>
 
 void
 grub_efi_init (void)
index f367269c451a9f2e963eda9a4cf19f90d3144f4f..08f2cce3a7dda478e0b457fb39dc8b81d1e6706b 100644 (file)
@@ -22,7 +22,6 @@
 #include <grub/machine/init.h>
 #include <grub/machine/memory.h>
 #include <grub/machine/console.h>
-#include <grub/machine/kernel.h>
 #include <grub/types.h>
 #include <grub/err.h>
 #include <grub/dl.h>
 #include <grub/time.h>
 #include <grub/symbol.h>
 #include <grub/cpu/io.h>
-#include <grub/cpu/kernel.h>
 #include <grub/cpu/tsc.h>
+#ifdef GRUB_MACHINE_QEMU
+#include <grub/machine/kernel.h>
+#endif
 
 #define GRUB_FLOPPY_REG_DIGITAL_OUTPUT         0x3f2
 
index ecdc0b61ce3386d766e8c2e41ca59be90ac21767..bdefb69bc5ae8a3fcd599f564f647f5f48375a83 100644 (file)
@@ -19,7 +19,7 @@
 #include <grub/symbol.h>
 #include <grub/machine/memory.h>
 #include <grub/cpu/linux.h>
-#include <grub/cpu/kernel.h>
+#include <grub/offsets.h>
 #include <multiboot.h>
 #include <multiboot2.h>
 
index ad2ef329b7631f56733893562c02733570ddbb8c..c0a08a954f037c51e5675074f0685b236a0a8c68 100644 (file)
@@ -19,7 +19,6 @@
 #include <grub/symbol.h>
 #include <grub/machine/memory.h>
 #include <grub/cpu/linux.h>
-#include <grub/cpu/kernel.h>
 #include <multiboot.h>
 #include <multiboot2.h>
 
index c1185f82c138e6aa7e70b102dd2671d0d7facc1e..cdc8ca0515c675d36b58b2d74055ab2d5093946d 100644 (file)
@@ -20,7 +20,6 @@
 #include <grub/kernel.h>
 #include <grub/misc.h>
 #include <grub/types.h>
-#include <grub/machine/kernel.h>
 #include <grub/ieee1275/ieee1275.h>
 
 int (*grub_ieee1275_entry_fn) (void *);
index db9583d8b3052502e26319ac26fc4e0bdc8e07fb..f79b827760478253a5e0f52ca447d80e8709610f 100644 (file)
 #include <grub/misc.h>
 #include <grub/time.h>
 #include <grub/machine/console.h>
-#include <grub/machine/kernel.h>
-#include <grub/cpu/kernel.h>
 #include <grub/ieee1275/ofdisk.h>
 #include <grub/ieee1275/ieee1275.h>
+#include <grub/offsets.h>
 
 /* The minimal heap size we can live with. */
 #define HEAP_MIN_SIZE          (unsigned long) (2 * 1024 * 1024)
index cf9e1a870d3d2d5b624736a724c6de76a437fb31..5693f3be0760f0f648cd3c62778a008ae89ee1f6 100644 (file)
@@ -21,7 +21,6 @@
 #include <grub/err.h>
 #include <grub/misc.h>
 #include <grub/mm.h>
-#include <grub/machine/kernel.h>
 #include <grub/ieee1275/ieee1275.h>
 
 enum grub_ieee1275_parse_type
index 5adcedcbb2865356068a59c58a2a5007a8c8a696..f220108d489b55784f359698d360e7af1dea550d 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <grub/kernel.h>
 #include <grub/env.h>
-#include <grub/mips/kernel.h>
 
 void
 grub_machine_set_prefix (void)
index 876b2df71430a2440e8a50567061bf504f4d8e17..1d18131bef077b5f64b1a132a31da9f6775bd493 100644 (file)
@@ -20,7 +20,7 @@
 #include <grub/symbol.h>
 #include <grub/offsets.h>
 #include <grub/machine/memory.h>
-#include <grub/machine/kernel.h>
+#include <grub/offsets.h>
 
 #define BASE_ADDR 8
        
@@ -177,8 +177,8 @@ cont:
        
        lui $t1, %hi(_end)
        addiu $t1, %lo(_end)
-       addiu $t1, (GRUB_MOD_ALIGN-1)
-       li $t3, (GRUB_MOD_ALIGN-1)
+       addiu $t1, (GRUB_KERNEL_MACHINE_MOD_ALIGN-1)
+       li $t3, (GRUB_KERNEL_MACHINE_MOD_ALIGN-1)
        nor $t3, $t3, $0
        and $t1, $t1, $t3
        
index 6bba27b5158e57c1246c5699ac4ef2290d481289..47aa774a07c34b26e65f36f820927de814a02a40 100644 (file)
@@ -26,7 +26,6 @@
 #include <grub/time.h>
 #include <grub/machine/kernel.h>
 #include <grub/machine/memory.h>
-#include <grub/cpu/kernel.h>
 
 extern void grub_video_sm712_init (void);
 extern void grub_video_init (void);
index 979f260f8baf2c354c34e1346257e158cb08c0c8..96d153778341bc6ff41d77b41df86d66b646d987 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #include <grub/symbol.h>
-#include <grub/machine/kernel.h>
+#include <grub/offsets.h>
 
 .extern __bss_start
 .extern _end
diff --git a/util/elf/grub-mkimage.c b/util/elf/grub-mkimage.c
deleted file mode 100644 (file)
index f37837c..0000000
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2004,2005,2006,2007,2008,2009,2010  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
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <string.h>
-#include <grub/elf.h>
-#include <grub/misc.h>
-#include <grub/util/misc.h>
-#include <grub/util/resolve.h>
-#include <grub/kernel.h>
-#include <grub/cpu/kernel.h>
-#include <grub/machine/kernel.h>
-#include <grub/i18n.h>
-
-#include "progname.h"
-
-#define GRUB_IEEE1275_NOTE_NAME "PowerPC"
-#define GRUB_IEEE1275_NOTE_TYPE 0x1275
-
-/* These structures are defined according to the CHRP binding to IEEE1275,
-   "Client Program Format" section.  */
-
-struct grub_ieee1275_note_hdr
-{
-  grub_uint32_t namesz;
-  grub_uint32_t descsz;
-  grub_uint32_t type;
-  char name[sizeof (GRUB_IEEE1275_NOTE_NAME)];
-};
-
-struct grub_ieee1275_note_desc
-{
-  grub_uint32_t real_mode;
-  grub_uint32_t real_base;
-  grub_uint32_t real_size;
-  grub_uint32_t virt_base;
-  grub_uint32_t virt_size;
-  grub_uint32_t load_base;
-};
-
-struct grub_ieee1275_note
-{
-  struct grub_ieee1275_note_hdr header;
-  struct grub_ieee1275_note_desc descriptor;
-};
-
-void
-load_note (Elf32_Phdr *phdr, FILE *out)
-{
-  struct grub_ieee1275_note note;
-  int note_size = sizeof (struct grub_ieee1275_note);
-
-  grub_util_info ("adding CHRP NOTE segment");
-
-  note.header.namesz = grub_host_to_target32 (sizeof (GRUB_IEEE1275_NOTE_NAME));
-  note.header.descsz = grub_host_to_target32 (note_size);
-  note.header.type = grub_host_to_target32 (GRUB_IEEE1275_NOTE_TYPE);
-  strcpy (note.header.name, GRUB_IEEE1275_NOTE_NAME);
-  note.descriptor.real_mode = grub_host_to_target32 (0xffffffff);
-  note.descriptor.real_base = grub_host_to_target32 (0x00c00000);
-  note.descriptor.real_size = grub_host_to_target32 (0xffffffff);
-  note.descriptor.virt_base = grub_host_to_target32 (0xffffffff);
-  note.descriptor.virt_size = grub_host_to_target32 (0xffffffff);
-  note.descriptor.load_base = grub_host_to_target32 (0x00004000);
-
-  /* Write the note data to the new segment.  */
-  grub_util_write_image_at (&note, note_size,
-                           grub_target_to_host32 (phdr->p_offset), out);
-
-  /* Fill in the rest of the segment header.  */
-  phdr->p_type = grub_host_to_target32 (PT_NOTE);
-  phdr->p_flags = grub_host_to_target32 (PF_R);
-  phdr->p_align = grub_host_to_target32 (GRUB_TARGET_SIZEOF_LONG);
-  phdr->p_vaddr = 0;
-  phdr->p_paddr = 0;
-  phdr->p_filesz = grub_host_to_target32 (note_size);
-  phdr->p_memsz = 0;
-}
-
-void
-load_modules (grub_addr_t modbase, Elf32_Phdr *phdr, const char *dir,
-             char *mods[], FILE *out, char *memdisk_path, char *config_path)
-{
-  char *module_img;
-  struct grub_util_path_list *path_list;
-  struct grub_util_path_list *p;
-  struct grub_module_info *modinfo;
-  size_t offset;
-  size_t total_module_size;
-  size_t memdisk_size = 0;
-  size_t config_size = 0;
-
-  path_list = grub_util_resolve_dependencies (dir, "moddep.lst", mods);
-
-  offset = sizeof (struct grub_module_info);
-  total_module_size = sizeof (struct grub_module_info);
-
-  if (memdisk_path)
-    {
-      memdisk_size = ALIGN_UP(grub_util_get_image_size (memdisk_path), 512);
-      grub_util_info ("the size of memory disk is 0x%x", memdisk_size);
-      total_module_size += memdisk_size + sizeof (struct grub_module_header);
-    }
-
-  if (config_path)
-    {
-      config_size = ALIGN_UP(grub_util_get_image_size (config_path), 512);
-      grub_util_info ("the size of memory disk is 0x%x", config_size);
-      total_module_size += config_size + sizeof (struct grub_module_header);
-    }
-
-  for (p = path_list; p; p = p->next)
-    {
-      total_module_size += (grub_util_get_image_size (p->name)
-         + sizeof (struct grub_module_header));
-    }
-
-  grub_util_info ("the total module size is 0x%x", total_module_size);
-
-  module_img = xmalloc (total_module_size);
-  modinfo = (struct grub_module_info *) module_img;
-  modinfo->magic = grub_host_to_target32 (GRUB_MODULE_MAGIC);
-  modinfo->offset = grub_host_to_target32 (sizeof (struct grub_module_info));
-  modinfo->size = grub_host_to_target32 (total_module_size);
-
-  /* Load all the modules, with headers, into module_img.  */
-  for (p = path_list; p; p = p->next)
-    {
-      struct grub_module_header *header;
-      size_t mod_size;
-
-      grub_util_info ("adding module %s", p->name);
-
-      mod_size = grub_util_get_image_size (p->name);
-
-      header = (struct grub_module_header *) (module_img + offset);
-      header->type = OBJ_TYPE_ELF;
-      header->size = grub_host_to_target32 (mod_size + sizeof (*header));
-
-      grub_util_load_image (p->name, module_img + offset + sizeof (*header));
-
-      offset += sizeof (*header) + mod_size;
-    }
-
-  if (memdisk_path)
-    {
-      struct grub_module_header *header;
-
-      header = (struct grub_module_header *) (module_img + offset);
-      header->type = OBJ_TYPE_MEMDISK;
-      header->size = grub_host_to_target32 (memdisk_size + sizeof (*header));
-      offset += sizeof (*header);
-
-      grub_util_load_image (memdisk_path, module_img + offset);
-      offset += memdisk_size;
-    }
-
-  if (config_path)
-    {
-      struct grub_module_header *header;
-
-      header = (struct grub_module_header *) (module_img + offset);
-      header->type = OBJ_TYPE_CONFIG;
-      header->size = grub_host_to_target32 (config_size + sizeof (*header));
-      offset += sizeof (*header);
-
-      grub_util_load_image (config_path, module_img + offset);
-      offset += config_size;
-    }
-
-
-  /* Write the module data to the new segment.  */
-  grub_util_write_image_at (module_img, total_module_size,
-                           grub_host_to_target32 (phdr->p_offset), out);
-
-  /* Fill in the rest of the segment header.  */
-  phdr->p_type = grub_host_to_target32 (PT_LOAD);
-  phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X);
-  phdr->p_align = grub_host_to_target32 (GRUB_TARGET_SIZEOF_LONG);
-  phdr->p_vaddr = grub_host_to_target32 (modbase);
-  phdr->p_paddr = grub_host_to_target32 (modbase);
-  phdr->p_filesz = grub_host_to_target32 (total_module_size);
-  phdr->p_memsz = grub_host_to_target32 (total_module_size);
-}
-
-void
-add_segments (char *dir, char *prefix, FILE *out, int chrp, char *mods[], char *memdisk_path, char *config_path)
-{
-  Elf32_Ehdr ehdr;
-  Elf32_Phdr *phdrs = NULL;
-  Elf32_Phdr *phdr;
-  FILE *in;
-  char *kernel_path;
-  grub_addr_t grub_end = 0;
-  off_t offset, first_segment;
-  int i, phdr_size;
-
-  /* Read ELF header.  */
-  kernel_path = grub_util_get_path (dir, "kernel.img");
-  in = fopen (kernel_path, "rb");
-  if (! in)
-    grub_util_error ("cannot open %s", kernel_path);
-
-  grub_util_read_at (&ehdr, sizeof (ehdr), 0, in);
-
-  offset = ALIGN_UP (sizeof (ehdr), GRUB_TARGET_SIZEOF_LONG);
-  ehdr.e_phoff = grub_host_to_target32 (offset);
-
-  phdr_size = (grub_target_to_host16 (ehdr.e_phentsize) *
-               grub_target_to_host16 (ehdr.e_phnum));
-
-  if (mods[0] != NULL)
-    phdr_size += grub_target_to_host16 (ehdr.e_phentsize);
-
-  if (chrp)
-    phdr_size += grub_target_to_host16 (ehdr.e_phentsize);
-
-  phdrs = xmalloc (phdr_size);
-  offset += ALIGN_UP (phdr_size, GRUB_TARGET_SIZEOF_LONG);
-
-  first_segment = offset;
-
-  /* Copy all existing segments.  */
-  for (i = 0; i < grub_target_to_host16 (ehdr.e_phnum); i++)
-    {
-      char *segment_img;
-      grub_size_t segment_end;
-
-      phdr = phdrs + i;
-
-      /* Read segment header.  */
-      grub_util_read_at (phdr, sizeof (Elf32_Phdr),
-                        (grub_target_to_host32 (ehdr.e_phoff)
-                         + (i * grub_target_to_host16 (ehdr.e_phentsize))),
-                        in);
-      grub_util_info ("copying segment %d, type %d", i,
-                     grub_target_to_host32 (phdr->p_type));
-
-      /* Locate _end.  */
-      segment_end = grub_target_to_host32 (phdr->p_paddr)
-                   + grub_target_to_host32 (phdr->p_memsz);
-      grub_util_info ("segment %u end 0x%lx", i, segment_end);
-      if (segment_end > grub_end)
-       grub_end = segment_end;
-
-      /* Read segment data and write it to new file.  */
-      segment_img = xmalloc (grub_target_to_host32 (phdr->p_filesz));
-
-      grub_util_read_at (segment_img, grub_target_to_host32 (phdr->p_filesz),
-                        grub_target_to_host32 (phdr->p_offset), in);
-
-      phdr->p_offset = grub_host_to_target32 (offset);
-      grub_util_write_image_at (segment_img, grub_target_to_host32 (phdr->p_filesz),
-                               offset, out);
-      offset += ALIGN_UP (grub_target_to_host32 (phdr->p_filesz),
-                         GRUB_TARGET_SIZEOF_LONG);
-
-      free (segment_img);
-    }
-
-  if (mods[0] != NULL)
-    {
-      grub_addr_t modbase;
-
-      /* Place modules just after grub segment.  */
-      modbase = ALIGN_UP(grub_end + GRUB_MOD_GAP, GRUB_MOD_ALIGN);
-
-      /* Construct new segment header for modules.  */
-      phdr = phdrs + grub_target_to_host16 (ehdr.e_phnum);
-      ehdr.e_phnum = grub_host_to_target16 (grub_target_to_host16 (ehdr.e_phnum) + 1);
-
-      /* Fill in p_offset so the callees know where to write.  */
-      phdr->p_offset = grub_host_to_target32 (ALIGN_UP (grub_util_get_fp_size (out),
-                                                       GRUB_TARGET_SIZEOF_LONG));
-
-      load_modules (modbase, phdr, dir, mods, out, memdisk_path, config_path);
-    }
-
-  if (chrp)
-    {
-      /* Construct new segment header for the CHRP note.  */
-      phdr = phdrs + grub_target_to_host16 (ehdr.e_phnum);
-      ehdr.e_phnum = grub_host_to_target16 (grub_target_to_host16 (ehdr.e_phnum) + 1);
-
-      /* Fill in p_offset so the callees know where to write.  */
-      phdr->p_offset = grub_host_to_target32 (ALIGN_UP (grub_util_get_fp_size (out),
-                                                       GRUB_TARGET_SIZEOF_LONG));
-
-      load_note (phdr, out);
-    }
-
-  /* Don't bother preserving the section headers.  */
-  ehdr.e_shoff = 0;
-  ehdr.e_shnum = 0;
-  ehdr.e_shstrndx = 0;
-
-  /* Write entire segment table to the file.  */
-  grub_util_write_image_at (phdrs, phdr_size, grub_target_to_host32 (ehdr.e_phoff), out);
-
-  /* Write ELF header.  */
-  grub_util_write_image_at (&ehdr, sizeof (ehdr), 0, out);
-
-  if (prefix)
-    {
-      if (GRUB_KERNEL_MACHINE_PREFIX + strlen (prefix) + 1 > GRUB_KERNEL_MACHINE_DATA_END)
-        grub_util_error ("prefix too long");
-      grub_util_write_image_at (prefix, strlen (prefix) + 1, first_segment + GRUB_KERNEL_MACHINE_PREFIX, out);
-    }
-
-  free (phdrs);
-  free (kernel_path);
-}
-
-static struct option options[] =
-  {
-    {"directory", required_argument, 0, 'd'},
-    {"prefix", required_argument, 0, 'p'},
-    {"memdisk", required_argument, 0, 'm'},
-    {"config", required_argument, 0, 'c'},
-    {"output", required_argument, 0, 'o'},
-    {"help", no_argument, 0, 'h'},
-    {"note", no_argument, 0, 'n'},
-    {"version", no_argument, 0, 'V'},
-    {"verbose", no_argument, 0, 'v'},
-    { 0, 0, 0, 0 },
-  };
-
-static void
-usage (int status)
-{
-  if (status)
-    fprintf (stderr, "Try `%s --help' for more information.\n", program_name);
-  else
-    printf ("\
-Usage: %s -o FILE [OPTION]... [MODULES]\n\
-\n\
-Make a bootable image of GRUB.\n\
-\n\
-  -d, --directory=DIR     use images and modules under DIR [default=%s]\n\
-  -p, --prefix=DIR        set grub_prefix directory\n\
-  -m, --memdisk=FILE      embed FILE as a memdisk image\n\
-  -c, --config=FILE       embed FILE as boot config\n\
-  -o, --output=FILE       output a generated image to FILE\n\
-  -h, --help              display this message and exit\n\
-  -n, --note              add NOTE segment for CHRP Open Firmware\n\
-  -V, --version           print version information and exit\n\
-  -v, --verbose           print verbose messages\n\
-\n\
-Report bugs to <%s>.\n\
-", program_name, GRUB_LIBDIR, PACKAGE_BUGREPORT);
-
-  exit (status);
-}
-
-int
-main (int argc, char *argv[])
-{
-  FILE *fp;
-  char *output = NULL;
-  char *dir = NULL;
-  char *prefix = NULL;
-  char *memdisk = NULL;
-  char *config = NULL;
-  int chrp = 0;
-
-  set_program_name (argv[0]);
-
-  grub_util_init_nls ();
-
-  while (1)
-    {
-      int c = getopt_long (argc, argv, "d:p:m:c:o:hVvn", options, 0);
-      if (c == -1)
-       break;
-
-      switch (c)
-       {
-         case 'd':
-           if (dir)
-             free (dir);
-           dir = xstrdup (optarg);
-           break;
-         case 'p':
-           if (prefix)
-             free (prefix);
-           prefix = xstrdup (optarg);
-           break;
-         case 'm':
-           if (memdisk)
-             free (memdisk);
-           memdisk = xstrdup (optarg);
-
-           if (prefix)
-             free (prefix);
-           prefix = xstrdup ("(memdisk)/boot/grub");
-
-           break;
-         case 'c':
-           if (config)
-             free (config);
-           config = xstrdup (optarg);
-
-           break;
-
-         case 'h':
-           usage (0);
-           break;
-         case 'n':
-           chrp = 1;
-           break;
-         case 'o':
-           if (output)
-             free (output);
-           output = xstrdup (optarg);
-           break;
-         case 'V':
-           printf ("grub-mkimage (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
-           return 0;
-         case 'v':
-           verbosity++;
-           break;
-         default:
-           usage (1);
-           break;
-       }
-  }
-
-  if (!output)
-    usage (1);
-
-  fp = fopen (output, "wb");
-  if (! fp)
-    grub_util_error ("cannot open %s", output);
-
-  add_segments (dir ? : GRUB_LIBDIR, prefix, fp, chrp, argv + optind, memdisk,
-               config);
-
-  fclose (fp);
-
-  return 0;
-}
index e9fdc74285edfebe3f6f9432b7e5db975f27b7ef..4a257e3290250c81d34228cdf1ca9734b10fb763 100644 (file)
@@ -17,6 +17,9 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#undef ELF_R_SYM
+#undef ELF_R_TYPE
+
 #if defined(MKIMAGE_ELF32)
 # define SUFFIX(x)     x ## 32
 # define ELFCLASSXX    ELFCLASS32
index 63fa8c3289d11022339ea6d553a31a2ce5382843..f479d5090e86d449b598a5958831466f0e1cca78 100644 (file)
@@ -57,6 +57,13 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P
 #define DEFAULT_BOOT_FILE      "boot.img"
 #define DEFAULT_CORE_FILE      "core.img"
 
+#define grub_target_to_host16(x)       grub_le_to_cpu16(x)
+#define grub_target_to_host32(x)       grub_le_to_cpu32(x)
+#define grub_target_to_host64(x)       grub_le_to_cpu64(x)
+#define grub_host_to_target16(x)       grub_cpu_to_le16(x)
+#define grub_host_to_target32(x)       grub_cpu_to_le32(x)
+#define grub_host_to_target64(x)       grub_cpu_to_le64(x)
+
 void
 grub_putchar (int c)
 {
index b511a96b24f369aa523ac8f2c89b9072c0d36512..fbf6ba03638f21813efb3d3febb337e1c7d65a13 100644 (file)
 #define DEFAULT_BOOT_FILE      "boot.img"
 #define DEFAULT_CORE_FILE      "core.img"
 
+#define grub_target_to_host16(x)       grub_be_to_cpu16(x)
+#define grub_target_to_host32(x)       grub_be_to_cpu32(x)
+#define grub_target_to_host64(x)       grub_be_to_cpu64(x)
+#define grub_host_to_target16(x)       grub_cpu_to_be16(x)
+#define grub_host_to_target32(x)       grub_cpu_to_be32(x)
+#define grub_host_to_target64(x)       grub_cpu_to_be64(x)
+
 /* This is the blocklist used in the diskboot image.  */
 struct boot_blocklist
 {