IA64 port
Hi,
here is the patch to add support for ia64. This is mostly new files (as well as new commands used to debug), and a few fixes in kern/efi/mm.c and fs/fat.c.
Ia64 uses EFI so this port leverage on the already existing EFI support.
This port deviate from other grub ports in modules: I currently use a trick to provide basic module support: they are prelinked during installation. This makes the initial port easier (and possible other ports too).
I'd really like to improve the situation in the next future, but the current module framework doesn't work as-is for ia64. Loading partially linked object files (-r) is not easy on ia64 (large number of relocations, new segments to be added: the GOT, the function descriptors). I will try to use shared libraries instead but there are changes to do in the generic code.
On the other hand, having pre-linked modules is a nice alternative on EFI systems where the on-demand module load feature is not required and doesn't fit well in net booting process. So maybe I will first try to make to improve this feature.
Comments are of course well-come.
Tristan.
2008-01-28 Tristan Gingold <[email protected]>
* geninit.sh: Call _init with a null argument.
* configure.ac: Add ia64-efi target.
* Makefile.in (STRIP_FLAGS): Declare (overriden on ia64). (RMKFILES): Add ia64-efi.rmk
* genmk.rb: Use STRIP_FLAGS for strip.
* util/ia64/efi/grub-install.in: New file.
* util/ia64/efi/pe32.h: New file.
* util/ia64/efi/elf2pe.c: New file.
* normal/ia64/setjmp.S: New file (from glibc).
* normal/ia64/longjmp.S: New file (from glibc).
* loader/ia64/efi/linux_normal.c: New file.
* loader/ia64/efi/linux.c: New file.
* conf/ia64-efi.rmk: New file.
* commands/efi/systab.c: New file.
* commands/efi/memmap.c: New file.
* commands/efi/acpi.c: New file.
* fs/fat.c (grub_fat_find_dir): Use case insensitive string compare as filenames are not case sensitive.
* include/grub/efi/efi.h: Declare grub_efi_allocate_boot_pages and grub_efi_free_boot_pages.
* include/grub/misc.h: Declare grub_strcasecmp.
* include/grub/kernel.h: Export grub_machine_fini.
* include/grub/dl.h: Use attribute instead of raw asm statement. Use grub_module as prefix to make identification easier.
* include/grub/ia64/efi/time.h: New file.
* include/grub/ia64/efi/misc.h: New file.
* include/grub/ia64/efi/loader.h: New file.
* include/grub/ia64/efi/kernel.h: New file.
* include/grub/ia64/time.h: New file.
* include/grub/ia64/setjmp.h: New file.
* include/grub/ia64/types.h: New file.
* kern/efi/mm.c (BYTES_TO_PAGES): Round instead of truncating. (grub_efi_allocate_boot_pages): Low level interface to allocate_pages. (grub_efi_free_boot_pages): Low level interface to free_pages. (grub_efi_allocate_pages): Call grub_efi_allocate_boot_pages. (grub_efi_free_pages): Call grubèefi_free_boot_pages. (add_memory_regions): Add debug message in ifdef. (add_memory_regions): Add debug message in ifdef. (grub_efi_mm_init): Do not constraint memory map length, add space for a few more entries.
* kern/rescue.c: Silently accept empty lines.
* kern/misc.c (grub_strcasecmp): New function.
* kern/dl.c (grub_init_module): New function. Register an already linked module.
* kern/ia64/efi/elf_ia64_efi.lds: New file.
* kern/ia64/efi/startup.S: New file.
* kern/ia64/efi/init.c: New file.
* kern/ia64/trampoline.S: New file.
Makefile.in +2 -1
@@ -67,6 +67,7 @@ TARGET_CFLAGS = @TARGET_CFLAGS@ TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I. -Iinclude -I$(srcdir)/include \ -Wall -W TARGET_LDFLAGS = @TARGET_LDFLAGS@ +STRIP_FLAGS=--strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment OBJCOPY = @OBJCOPY@ STRIP = @STRIP@ NM = @NM@
@@ -83,7 +84,7 @@ enable_grub_emu = @enable_grub_emu@ ### General variables. RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \ - sparc64-ieee1275.rmk i386-efi.rmk) + sparc64-ieee1275.rmk i386-efi.rmk ia64-efi.rmk) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) PKGLIB = $(pkglib_IMAGES) $(pkglib_MODULES) $(pkglib_PROGRAMS) \
commands/efi/acpi.c +193 -0
193 lines not on this page · raw message
commands/efi/memmap.c +143 -0
143 lines not on this page · raw message
commands/efi/systab.c +258 -0
258 lines not on this page · raw message
conf/ia64-efi.rmk +122 -0
122 lines not on this page · raw message
configure.ac +4 -1
@@ -53,7 +53,8 @@ case "$target_cpu" in powerpc) ;; powerpc64) target_cpu=powerpc target_m32=1;; sparc64) ;; - *) AC_MSG_ERROR([unsupported CPU type]) ;; + ia64) ;; + *) AC_MSG_ERROR([unsupported CPU type $target_cpu]) ;; esac # Specify the platform (such as firmware).
@@ -68,6 +69,7 @@ if test "x$with_platform" = x; then i386-*) platform=pc ;; powerpc-*) platform=ieee1275 ;; sparc64-*) platform=ieee1275 ;; + ia64*) platform=efi ;; *) AC_MSG_ERROR([unsupported machine type]) ;; esac else
@@ -82,6 +84,7 @@ case "$target_cpu"-"$platform" in i386-ieee1275) ;; powerpc-ieee1275) ;; sparc64-ieee1275) ;; + ia64-efi) ;; *) AC_MSG_ERROR([unsupported machine type]) ;; esac
fs/fat.c +2 -2
@@ -568,7 +568,7 @@ grub_fat_find_dir (grub_disk_t disk, strcontinue ; } -if (grub_strcmp (dirname, filename) ==0 ) +if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );
@@ -601,7 +601,7 @@ grub_fat_find_dir (grub_disk_t disk, strif (hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY ))break ; } -else if (grub_strcmp (dirname, filename) ==0 ) +else if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );
geninit.sh +1 -1
@@ -49,7 +49,7 @@ EOF while read line; do file=`echo $line | cut -f1 -d:` if echo $@ | grep $file >/dev/null; then - echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init ();/' + echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init (0);/' fi done < ${lst}
genmk.rb +1 -1
@@ -115,7 +115,7 @@ UNDSYMFILES += #{undsym} #{@name}: #{pre_obj} #{mod_obj} -rm -f $@ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^ - $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + $(STRIP) $(STRIP_FLAGS) $@ #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} -rm -f $@
include/grub/dl.h +8 -6
@@ -26,25 +26,27 @@#define GRUB_MOD_INIT (name) \ static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \ -void grub_##name##_init (void); \ +void grub_module_##name##_init (grub_dl_t); \ void \ -grub_##name##_init (void) { grub_mod_init (0); } \ +grub_module_##name##_init (grub_dl_t mod) { grub_mod_init (mod); } \ static void \ grub_mod_init (grub_dl_t mod __attribute__ ((unused)))#define GRUB_MOD_FINI (name) \ static void grub_mod_fini (void) __attribute__ ((used)); \ -void grub_##name##_fini (void); \ +void grub_module_##name##_fini (void); \ void \ -grub_##name##_fini (void) { grub_mod_fini (); } \ +grub_module_##name##_fini (void) { grub_mod_fini (); } \ static void \ grub_mod_fini (void)#define GRUB_MOD_NAME (name) \ -__asm__ (".section .modname,\"S\"\n.string \"" #name "\"\n.previous") +static const char grub_module_name_##name[] \ + __attribute__((section(".modname"), __used__)) = #name#define GRUB_MOD_DEP (name) \ -__asm__ (".section .moddeps,\"S\"\n.string \"" #name "\"\n.previous") +static const char grub_module_depend_##name[] \ + __attribute__((section(".moddeps"), __used__)) = #namestruct grub_dl_segment {
include/grub/efi/efi.h +7 -0
@@ -42,6 +42,13 @@ EXPORT_FUNC(grub_efi_allocate_pages) (gr grub_efi_uintn_t pages);void EXPORT_FUNC (grub_efi_free_pages ) (grub_efi_physical_address_t address,grub_efi_uintn_t pages); +void * +EXPORT_FUNC (grub_efi_allocate_boot_pages ) (grub_efi_physical_address_t address, +grub_efi_uintn_t pages); +void +EXPORT_FUNC (grub_efi_free_boot_pages ) (grub_efi_physical_address_t address, +grub_efi_uintn_t pages); + int EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size, grub_efi_memory_descriptor_t *memory_map,
include/grub/ia64/efi/kernel.h +33 -0
@@ -0,0 +1,33 @@ +/* +* 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[]; + +/* The offset of GRUB_PREFIX. */ +#define GRUB_KERNEL_MACHINE_PREFIX 0x8 + +/* End of the data section. */ +#define GRUB_KERNEL_MACHINE_DATA_END 0x50 + +#endif /* ! GRUB_MACHINE_KERNEL_HEADER */ +
include/grub/ia64/efi/loader.h +30 -0
@@ -0,0 +1,30 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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_LOADER_MACHINE_HEADER +#define GRUB_LOADER_MACHINE_HEADER 1 + +/* It is necessary to export these functions, because normal mode commands +reuse rescue mode commands. */ +void grub_rescue_cmd_linux (int argc,char *argv[]); +void grub_rescue_cmd_initrd (int argc,char *argv[]); +void grub_rescue_cmd_module (int argc,char *argv[]); +void grub_rescue_cmd_relocate (int argc,char *argv[]); +void grub_rescue_cmd_fpswa (int argc,char *argv[]); + +#endif /* ! GRUB_LOADER_MACHINE_HEADER */
include/grub/ia64/efi/misc.h +24 -0
@@ -0,0 +1,24 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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/>. +*/ + +void EXPORT_FUNC (memset ) (void ); +void EXPORT_FUNC (__ia64_trampoline ) (void ); +void EXPORT_FUNC (grub_init_modules ) (void ); + +extern unsigned long EXPORT_VAR (__gp ); +
include/grub/ia64/efi/time.h +23 -0
@@ -0,0 +1,23 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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_MACHINE_TIME_HEADER +#define GRUB_MACHINE_TIME_HEADER 1 + +#include <grub/efi/time.h> + +#endif /* ! GRUB_MACHINE_TIME_HEADER */
include/grub/ia64/setjmp.h +31 -0
@@ -0,0 +1,31 @@ +/* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version. +Copyright (C) 1999, 2000 Free Software Foundation, Inc. +Contributed by David Mosberger-Tang <[email protected]>. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* User code must not depend on the internal representation of jmp_buf. */ + +#define _JBLEN 70 + +/* the __jmp_buf element type should be __float80 per ABI... */ +typedef long grub_jmp_buf [_JBLEN] __attribute__ ((aligned (16 )));/* guarantees 128-bit alignment! */ + +#define grub_setjmp setjmp +#define grub_longjmp longjmp + +int grub_setjmp (grub_jmp_buf env); +void grub_longjmp (grub_jmp_buf env,int val) __attribute__ ((noreturn));
include/grub/ia64/time.h +28 -0
@@ -0,0 +1,28 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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 KERNEL_CPU_TIME_HEADER +#define KERNEL_CPU_TIME_HEADER 1 + +static __inlinevoid +grub_cpu_idle (void ) +{ +/* FIXME: not implemented */ +} + +#endif /* ! KERNEL_CPU_TIME_HEADER */
include/grub/ia64/types.h +32 -0
@@ -0,0 +1,32 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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_TYPES_CPU_HEADER +#define GRUB_TYPES_CPU_HEADER 1 + +/* The size of void *. */ +#define GRUB_TARGET_SIZEOF_VOID_P 8 + +/* The size of long. */ +#define GRUB_TARGET_SIZEOF_LONG 8 + +/* ia64 is little-endian (usually). */ +#undef GRUB_TARGET_WORDS_BIGENDIAN + + +#endif /* ! GRUB_TYPES_CPU_HEADER */
include/grub/kernel.h +1 -1
@@ -53,7 +53,7 @@ void grub_main (void);void grub_machine_init (void );/* The machine-specific finalization. */ -void grub_machine_fini (void ); +void EXPORT_FUNC (grub_machine_fini ) (void );/* The machine-specific prefix initialization. */ void grub_machine_set_prefix (void );
include/grub/misc.h +1 -0
@@ -46,6 +46,7 @@ int EXPORT_FUNC(grub_memcmp) (const voidint EXPORT_FUNC (grub_strcmp ) (const char *s1,const char *s2);int EXPORT_FUNC (grub_strncmp ) (const char *s1,const char *s2,grub_size_t n);int EXPORT_FUNC (grub_strncasecmp ) (const char *s1,const char *s2,int c); +int EXPORT_FUNC (grub_strcasecmp ) (const char *s1,const char *s2);char *EXPORT_FUNC (grub_strchr ) (const char *s,int c);char *EXPORT_FUNC (grub_strrchr ) (const char *s,int c);int EXPORT_FUNC (grub_strword ) (const char *s,const char *w);
kern/dl.c +23 -0
@@ -579,6 +579,29 @@ grub_dl_load_core (void *addr, grub_sizereturn mod; } +void +grub_init_module (const char *name, +void (*init)(grub_dl_t ),void (*fini)(void )) +{ +grub_dl_t mod; + + mod = (grub_dl_t )grub_malloc (sizeof (*mod)); +if (! mod) +return ; + + mod->name = name; + mod->ref_count =1 ; + mod->dep =0 ; + mod->segment =0 ; + mod->init = init; + mod->fini = fini; + +grub_dl_call_init (mod); + +/* Can't fail. */ +grub_dl_add (mod); +} +/* Load a module from the file FILENAME. */ grub_dl_t grub_dl_load_file (const char *filename)
kern/efi/mm.c +63 -27
190 lines not on this page · raw message
kern/ia64/efi/elf_ia64_efi.lds +84 -0
84 lines not on this page · raw message
kern/ia64/efi/init.c +59 -0
59 lines not on this page · raw message
kern/ia64/efi/startup.S +40 -0
@@ -0,0 +1,40 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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/>. + */ + .text + .psr abi64 + .psr lsb + .lsb + + .global _start + .proc _start +_start: + alloc loc0=ar.pfs,2,4,0,0 + mov loc1=rp + addl loc2=@gprel(grub_efi_image_handle),gp + addl loc3=@gprel(grub_efi_system_table),gp + ;; + st8 [loc2]=in0 + st8 [loc3]=in1 + br.call.sptk.few rp=grub_main + ;; + mov ar.pfs=loc0 + mov rp=loc1 + ;; + br.ret.sptk.few rp + + .endp _start
kern/ia64/trampoline.S +38 -0
@@ -0,0 +1,38 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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/>. + */ + .text + .psr abi64 + .psr lsb + .lsb + + .proc __ia64_trampoline + .global __ia64_trampoline +__ia64_trampoline: + // Read address of the real descriptor + ld8 r2=[r1],8 + ;; + // Read chain + ld8 r15=[r1] + // Read pc + ld8 r3=[r2],8 + ;; + // Read gp + ld8 r1=[r2] + mov b6=r3 + br.many b6 + .endp __ia64_trampoline
kern/misc.c +20 -0
@@ -193,6 +193,26 @@ grub_strcmp (const char *s1, const char }int +grub_strcasecmp (const char *s1,const char *s2) +{ +char c1, c2; + +while (*s1 && *s2) + { + c1 =grub_tolower (*s1); + c2 =grub_tolower (*s2); +if (c1 != c2) +return (int ) c1 - (int ) c2; + + s1++; + s2++; + } + +/* One of these is 0! */ +return (int ) *s1 - (int ) *s2; +} + +int grub_strncmp (const char *s1,const char *s2,grub_size_t n) {if (n ==0 )
kern/rescue.c +2 -0
@@ -659,6 +659,8 @@ grub_enter_rescue_mode (void)/* Get a command line. */ grub_rescue_get_command_line ("grub rescue> " ); +if (line[0 ] ==0 ) +continue ;if (grub_parser_split_cmdline (line, getline, &n, &args) || n <0 )continue ;
loader/ia64/efi/linux.c +776 -0
776 lines not on this page · raw message
loader/ia64/efi/linux_normal.c +107 -0
107 lines not on this page · raw message
normal/ia64/longjmp.S +162 -0
162 lines not on this page · raw message
normal/ia64/setjmp.S +171 -0
171 lines not on this page · raw message
util/ia64/efi/elf2pe.c +812 -0
262 lines not on this page · raw message
util/ia64/efi/grub-install.in +233 -0
233 lines not on this page · raw message
util/ia64/efi/pe32.h +237 -0
237 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Hi Tristan!
Quoted 11 lines · Tristan Gingold
Hi,
here is the patch to add support for ia64. This is mostly new files (as well as new commands used to debug), and a few fixes in
kern/efi/mm.candfs/fat.c.Ia64 uses EFI so this port leverage on the already existing EFI support.
This port deviate from other grub ports in modules: I currently use a trick to provide basic module support: they are prelinked during installation. This makes the initial port easier (and possible other ports too).
Have you checked if this trick works on other ports? Maybe it'd be a good idea to merge this first.
Quoted 1 line
+STRIP_FLAGS=--strip-unneeded -K
grub_mod_init-Kgrub_mod_fini-R .note -R .comment
Why this? I recall strip was already run with those parameters.
Makefile.in enable_grub_emu = @enable_grub_emu@ · line 87
Quoted 3 lines
RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \
Makefile.in +1
-1- sparc64-ieee1275.rmk i386-efi.rmk) + sparc64-ieee1275.rmk i386-efi.rmk ia64-efi.rmk)
Oops, the two last ports I added are missing here. I wonder if there's any way to automate this part. conf/*.rmk ?
Quoted 7 lines
commands/efi/acpi.c +7
-0+static grub_uint32_t read16 (grub_uint8_t *p) +{ +return p[0 ] | (p[1 ] <<8 ); +} + +static grub_uint32_t read32 (grub_uint8_t *p) +{
commands/efi/acpi.c line 40
Quoted 10 lines
commands/efi/acpi.c +10
-0+return p[0 ] | (p[1 ] <<8 ) | (p[2 ] <<16 ) | (p[3 ] <<24 ); +} + +static grub_uint64_t read64 (grub_uint8_t *p) +{ +grub_uint32_t l, h; + l =read32 (p); + h =read32 (p +4 ); +return l | (((grub_uint64_t )h) <<32 ); +}
You could use the endian conversion macros from grub/types.h
conf/ia64-efi.rmk line 31
Quoted 8 lines
conf/ia64-efi.rmk +8
-0+# For grub-emu. +grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ + commands/configfile.c commands/help.c \ + commands/terminal.c commands/ls.c commands/test.c \ + commands/search.c commands/blocklist.c \ + disk/loopback.c \ + fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \ + fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c \
Please could you resync the filesystem chunk to have the (recently changed) same layout as the other ports? This will ease maintainance and prevent future mistakes.
conf/ia64-efi.rmk line 120
Quoted 9 lines
conf/ia64-efi.rmk +9
-0+# For memmap.mod. +memmap_mod_SOURCES = commands/efi/memmap.c +memmap_mod_CFLAGS = $(COMMON_CFLAGS) +memmap_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For systab.mod. +systab_mod_SOURCES = commands/efi/systab.c commands/efi/acpi.c +systab_mod_CFLAGS = $(COMMON_CFLAGS) +systab_mod_LDFLAGS = $(COMMON_LDFLAGS)
Does this work on i386-efi ?
Quoted 13 lines
diff -ruNp -x '*~' -x CVS
grub2.orig/fs/fat.cgrub2/fs/fat.cfs/fat.c +1
-1@@ -568,7 +568,7 @@ grub_fat_find_dir (grub_disk_t disk, strcontinue ; } -if (grub_strcmp (dirname, filename) ==0 ) +if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );
fs/fat.c grub_fat_find_dir (grub_disk_t disk, str · line 607
Quoted 8 lines
fs/fat.c +1
-1@@ -601,7 +601,7 @@ grub_fat_find_dir (grub_disk_t disk, strif (hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY ))break ; } -else if (grub_strcmp (dirname, filename) ==0 ) +else if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );
Why is this needed? I'm not sure if it's good to exploit this "unreliability" feature that fat provides us ;-)
Quoted 2 lines
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.
Please remember to update copyright years (in new or modified files).
fs/fat.c
Quoted 2 lines
fs/fat.c +2
-0+__ia64_trampoline: +// Read address of the real descriptor
I think the consensus is to use /**/ comments in GRUB.
kern/rescue.c grub_enter_rescue_mode (void) · line 663
Quoted 9 lines
diff -ruNp -x '*~' -x CVS
grub2.orig/kern/rescue.cgrub2/kern/rescue.ckern/rescue.c +2
-0@@ -659,6 +659,8 @@ grub_enter_rescue_mode (void)/* Get a command line. */ grub_rescue_get_command_line ("grub rescue> " ); +if (line[0 ] ==0 ) +continue ;
Great! Finally somebody found that annoying bug ;-)
kern/rescue.c grub_enter_rescue_mode (void) · line 664
Quoted 1 line
kern/rescue.c +1
-0+struct ia64_boot_param {
Please add a newline before opening brackets.
Quoted 10 lines
kern/rescue.c +10
-0+GRUB_MOD_INIT (linux_normal) +{ + (void ) mod;/* To stop warning. */ +grub_register_command + ("linux" , grub_normal_linux_command, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"linux FILE [ARGS...]" , +"Load a linux kernel." ,0 ); + + grub_register_command
kern/rescue.c grub_enter_rescue_mode (void)
Quoted 10 lines
kern/rescue.c +10
-0+ ("initrd" , grub_normal_initrd_command, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"initrd FILE" , +"Load an initrd." ,0 ); + +grub_register_command + ("module" , grub_normal_cmd_module, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"module FILE [ARGS...]" , +"Load a Multiboot module." ,0 );
Multiboot module loader in linux_normal.mod ?
Btw, this command is not unregistered.
Quoted 32 lines
diff -ruNp -x '*~' -x CVS
grub2.orig/util/ia64/efi/elf2pe.cgrub2/util/ia64/efi/elf2pe.cutil/ia64/efi/elf2pe.c +28
-0@@ -0,0 +1,812 @@ +/* elf2pe.c - convert elf binary to PE/Coff. */ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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/>. +*/ +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <elf.h> + +#if defined(i386) +#define USE_ELF32 +#define USE_PE32
util/ia64/efi/elf2pe.c line 38
Quoted 10 lines
util/ia64/efi/elf2pe.c +10
-0+#define ELF_MACHINE EM_386 +#define EFI_MACHINE PE32_MACHINE_I386 +#elif defined(__ia64__) +#define USE_ELF64 +#define USE_PE32PLUS +#define ELF_MACHINE EM_IA_64 +#define EFI_MACHINE PE32_MACHINE_IA64 +#else +#error "unknown architecture" +#endif
This utility seems to be usable on i386 too? In that case, better to put it outside ia64/ dir?
util/ia64/efi/pe32.h
Quoted 2 lines
util/ia64/efi/pe32.h +0
-0
(same here, I assume)
util/ia64/efi/grub-install.in
Quoted 3 lines
diff -ruNp -x '*~' -x CVS grub2.orig/util/ia64/efi/grub-install.in grub2/util/ia64/efi/grub-install.in
util/ia64/efi/grub-install.in +0
-0
Any ia64-isms here, or just improvements (the module hack you described?) that could be shared with i386/efi/grub-install.in ?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 2 lines · Robert Millan
Hi Tristan!
[...]
Quoted 6 lines
Quoted 3 lines
This port deviate from other grub ports in modules: I currently use a trick to provide basic module support: they are prelinked during installation. This makes the initial port easier (and possible other ports too).
Have you checked if this trick works on other ports? Maybe it'd be a good idea to merge this first.
I don't really understand what do you mean by 'works on other ports'. It is designed to be an optionnal feature used only by ia64. Nothing IA64 specific and other ports may use it. If we go this way, it would be good to slightly improve it.
Quoted 3 lines
Quoted 1 line
+STRIP_FLAGS=--strip-unneeded -K
grub_mod_init-Kgrub_mod_fini-R .note -R .commentWhy this? I recall strip was already run with those parameters.
This is the default value, overriden by ia64. Maybe each port should define it but I'd prefer not to touch other port (as I can't test all of them).
Quoted 6 lines
Makefile.in enable_grub_emu = @enable_grub_emu@ · line 87
Quoted 3 lines
RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \
Makefile.in +1
-1- sparc64-ieee1275.rmk i386-efi.rmk) + sparc64-ieee1275.rmk i386-efi.rmk ia64-efi.rmk)Oops, the two last ports I added are missing here. I wonder if there's any way to automate this part. conf/*.rmk ?
Ok for *.rmk.
Quoted 11 lines
Quoted 11 lines
commands/efi/acpi.c +11
-0+static grub_uint32_t read16 (grub_uint8_t *p) +{ +return p[0 ] | (p[1 ] <<8 ); +} + +static grub_uint32_t read32 (grub_uint8_t *p) +{ +return p[0 ] | (p[1 ] <<8 ) | (p[2 ] <<16 ) | (p[3 ] <<24 ); +} + +static grub_uint64_t read64 (grub_uint8_t *p)
Quoted 8 lines
commands/efi/acpi.c line 40
Quoted 6 lines
commands/efi/acpi.c +6
-0+{ +grub_uint32_t l, h; + l =read32 (p); + h =read32 (p +4 ); +return l | (((grub_uint64_t )h) <<32 ); +}You could use the endian conversion macros from
grub/types.h
Ok.
Quoted 4 lines
Quoted 4 lines
conf/ia64-efi.rmk +4
-0+# For grub-emu. +grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ + commands/configfile.c commands/help.c \ + commands/terminal.c commands/ls.c commands/test.c \
Quoted 8 lines
conf/ia64-efi.rmk line 31
Quoted 4 lines
conf/ia64-efi.rmk +4
-0+ commands/search.c commands/blocklist.c \ + disk/loopback.c \ + fs/affs.c fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c \ + fs/jfs.c fs/minix.c fs/sfs.c fs/ufs.c fs/xfs.c fs/hfsplus.c \Please could you resync the filesystem chunk to have the (recently changed) same layout as the other ports? This will ease maintainance and prevent future mistakes.
Ok.
Quoted 11 lines
conf/ia64-efi.rmk line 120
Quoted 9 lines
conf/ia64-efi.rmk +9
-0+# For memmap.mod. +memmap_mod_SOURCES = commands/efi/memmap.c +memmap_mod_CFLAGS = $(COMMON_CFLAGS) +memmap_mod_LDFLAGS = $(COMMON_LDFLAGS) + +# For systab.mod. +systab_mod_SOURCES = commands/efi/systab.c commands/efi/acpi.c +systab_mod_CFLAGS = $(COMMON_CFLAGS) +systab_mod_LDFLAGS = $(COMMON_LDFLAGS)Does this work on i386-efi ?
Nothing IA64 specific and useless there are bugs it should work as is on i386-efi. That's mostly debug commands, not that useful.
Quoted 16 lines
Quoted 16 lines
diff -ruNp -x '*~' -x CVS
grub2.orig/fs/fat.cgrub2/fs/fat.cfs/fat.c +1
-1@@ -568,7 +568,7 @@ grub_fat_find_dir (grub_disk_t disk, strcontinue ; } -if (grub_strcmp (dirname, filename) ==0 ) +if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );@@ -601,7 +601,7 @@ grub_fat_find_dir (grub_disk_t disk, strif (hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY ))break ; }
Quoted 8 lines
fs/fat.c grub_fat_find_dir (grub_disk_t disk, str · line 607
Quoted 5 lines
fs/fat.c +1
-1-else if (grub_strcmp (dirname, filename) ==0 ) +else if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );Why is this needed? I'm not sure if it's good to exploit this "unreliability" feature that fat provides us ;-)
On EFI, the prefix is extracted from an EFI path, whose case may not match the FAT entries. Without case insensitive comparaison, grub may not find the prefix and thus refuses to go to normal mode. Quiet boring and not easy to understand for a beginner.
Quoted 4 lines
Quoted 2 lines
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.Please remember to update copyright years (in new or modified files).
Ok.
Quoted 4 lines
fs/fat.c
Quoted 2 lines
fs/fat.c +2
-0+__ia64_trampoline: +// Read address of the real descriptor I think the consensus is to use /**/ comments in GRUB.
Ok.
Quoted 11 lines
kern/rescue.c grub_enter_rescue_mode (void) · line 663
Quoted 9 lines
diff -ruNp -x '*~' -x CVS
grub2.orig/kern/rescue.cgrub2/kern/rescue.ckern/rescue.c +2
-0@@ -659,6 +659,8 @@ grub_enter_rescue_mode (void)/* Get a command line. */ grub_rescue_get_command_line ("grub rescue> " ); +if (line[0 ] ==0 ) +continue ;Great! Finally somebody found that annoying bug ;-)
I can make a separate patch for this one, if you prefer.
Quoted 3 lines
kern/rescue.c grub_enter_rescue_mode (void) · line 664
Quoted 1 line
kern/rescue.c +1
-0+struct ia64_boot_param {Please add a newline before opening brackets.
Ok.
Quoted 14 lines
Quoted 14 lines
kern/rescue.c +14
-0+GRUB_MOD_INIT (linux_normal) +{ + (void ) mod;/* To stop warning. */ +grub_register_command + ("linux" , grub_normal_linux_command, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"linux FILE [ARGS...]" , +"Load a linux kernel." ,0 ); + +grub_register_command + ("initrd" , grub_normal_initrd_command, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"initrd FILE" , +"Load an initrd." ,0 );
Quoted 8 lines
kern/rescue.c
Quoted 6 lines
kern/rescue.c +6
-0+ +grub_register_command + ("module" , grub_normal_cmd_module, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"module FILE [ARGS...]" , +"Load a Multiboot module." ,0 );Multiboot module loader in linux_normal.mod ?
Well, well well. Long question :-)
Ia64 doesn't really fit in multiboot: it's a full 64 bits processor, there may be no room for an header in the 8KB (or you have to waste a lot of memory to keep alignment), no room for EFI pointers in the header and no Ia64 OS uses it. Well this were my conclusion when I read MB specs.
On the other hand I really need to have modules for Xen.
Quoted 1 line
Btw, this command is not unregistered.
Ok.
Quoted 3 lines
Quoted 3 lines
diff -ruNp -x '*~' -x CVS
grub2.orig/util/ia64/efi/elf2pe.cgrub2/util/ia64/efi/elf2pe.cutil/ia64/efi/elf2pe.c +0
-0
[...]
Quoted 3 lines
This utility seems to be usable on i386 too? In that case, better to put it outside ia64/ dir?
It should work on i386 too, but not tested.
I have written this utility for my port of EFI and adapted the style for grub. It may be nice to share this code with i386 but not really required now IMHO.
Quoted 6 lines
util/ia64/efi/grub-install.in
Quoted 3 lines
diff -ruNp -x '*~' -x CVS grub2.orig/util/ia64/efi/grub-install.in grub2/util/ia64/efi/grub-install.in
util/ia64/efi/grub-install.in +0
-0Any ia64-isms here, or just improvements (the module hack you described?) that could be shared with i386/efi/grub-install.in ?
Yes, the module hack makes ia64/grub-install.in very different from the i386 one.
Tristan.
Hi,
here is my new version of the patch. I think all the comments have been addressed.
(There are still // comments in the .S files I copied from glibc. I suppose this is OK as the files come as-is from glibc).
Tristan.
2008-01-28 Tristan Gingold <[email protected]>
* geninit.sh: Call _init with a null argument.
* configure.ac: Add ia64-efi target.
* Makefile.in (STRIP_FLAGS): Declare (overriden on ia64). (RMKFILES): Use a wildcard.
* genmk.rb: Use STRIP_FLAGS for strip.
* util/ia64/efi/grub-install.in: New file.
* util/ia64/efi/pe32.h: New file.
* util/ia64/efi/elf2pe.c: New file.
* normal/ia64/setjmp.S: New file (from glibc).
* normal/ia64/longjmp.S: New file (from glibc).
* loader/ia64/efi/linux_normal.c: New file.
* loader/ia64/efi/linux.c: New file.
* conf/ia64-efi.rmk: New file.
* commands/efi/systab.c: New file.
* commands/efi/memmap.c: New file.
* commands/efi/acpi.c: New file.
* fs/fat.c (grub_fat_find_dir): Use case insensitive string compare as filenames are not case sensitive.
* include/grub/efi/efi.h: Declare grub_efi_allocate_boot_pages and grub_efi_free_boot_pages.
* include/grub/misc.h: Declare grub_strcasecmp.
* include/grub/kernel.h: Export grub_machine_fini.
* include/grub/dl.h: Use attribute instead of raw asm statement. Use grub_module as prefix to make identification easier.
* include/grub/ia64/efi/time.h: New file.
* include/grub/ia64/efi/misc.h: New file.
* include/grub/ia64/efi/loader.h: New file.
* include/grub/ia64/efi/kernel.h: New file.
* include/grub/ia64/time.h: New file.
* include/grub/ia64/setjmp.h: New file.
* include/grub/ia64/types.h: New file.
* kern/efi/mm.c (BYTES_TO_PAGES): Round instead of truncating. (grub_efi_allocate_boot_pages): Low level interface to allocate_pages. (grub_efi_free_boot_pages): Low level interface to free_pages. (grub_efi_allocate_pages): Call grub_efi_allocate_boot_pages. (grub_efi_free_pages): Call grubèefi_free_boot_pages. (add_memory_regions): Add debug message in ifdef. (add_memory_regions): Add debug message in ifdef. (grub_efi_mm_init): Do not constraint memory map length, add space for a few more entries.
* kern/misc.c (grub_strcasecmp): New function.
* kern/dl.c (grub_init_module): New function. Register an already linked module.
* kern/ia64/efi/elf_ia64_efi.lds: New file.
* kern/ia64/efi/startup.S: New file.
* kern/ia64/efi/init.c: New file.
* kern/ia64/trampoline.S: New file.
Makefile.in +4 -4
@@ -67,6 +67,7 @@ TARGET_CFLAGS = @TARGET_CFLAGS@ TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I. -Iinclude -I$(srcdir)/include \ -Wall -W TARGET_LDFLAGS = @TARGET_LDFLAGS@ +STRIP_FLAGS=--strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment OBJCOPY = @OBJCOPY@ STRIP = @STRIP@ NM = @NM@
@@ -82,8 +83,7 @@ enable_grub_emu = @enable_grub_emu@ ### General variables. -RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \ - sparc64-ieee1275.rmk i386-efi.rmk) +RMKFILES = $(wildcard $(srcdir)/conf/*.rmk) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) PKGLIB = $(pkglib_IMAGES) $(pkglib_MODULES) $(pkglib_PROGRAMS) \
@@ -97,13 +97,13 @@ MOSTLYCLEANFILES = DISTCLEANFILES = config.status config.cache config.log config.h \ Makefile stamp-h include/grub/cpu include/grub/machine \ gensymlist.sh genkernsyms.sh -MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) +MAINTAINER_CLEANFILES = $(srcdir)/configure $(MKFILES) # The default target. all: all-local ### Include an arch-specific Makefile. -$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb +$(MKFILES): %.mk: %.rmk genmk.rb if test "x$(RUBY)" = x; then \ touch $@; \ else \
commands/efi/acpi.c +190 -0
190 lines not on this page · raw message
commands/efi/memmap.c +143 -0
143 lines not on this page · raw message
commands/efi/systab.c +258 -0
258 lines not on this page · raw message
conf/ia64-efi.rmk +127 -0
127 lines not on this page · raw message
config.h.in +2 -2
@@ -88,10 +88,10 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of `long', as computed by sizeof. */ +/* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of `void *', as computed by sizeof. */ +/* The size of a `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P /* Define it to either start or _start */
configure.ac +4 -1
@@ -53,7 +53,8 @@ case "$target_cpu" in powerpc) ;; powerpc64) target_cpu=powerpc target_m32=1;; sparc64) ;; - *) AC_MSG_ERROR([unsupported CPU type]) ;; + ia64) ;; + *) AC_MSG_ERROR([unsupported CPU type $target_cpu]) ;; esac # Specify the platform (such as firmware).
@@ -68,6 +69,7 @@ if test "x$with_platform" = x; then i386-*) platform=pc ;; powerpc-*) platform=ieee1275 ;; sparc64-*) platform=ieee1275 ;; + ia64*) platform=efi ;; *) AC_MSG_ERROR([unsupported machine type]) ;; esac else
@@ -82,6 +84,7 @@ case "$target_cpu"-"$platform" in i386-ieee1275) ;; powerpc-ieee1275) ;; sparc64-ieee1275) ;; + ia64-efi) ;; *) AC_MSG_ERROR([unsupported machine type]) ;; esac
fs/fat.c +2 -2
@@ -568,7 +568,7 @@ grub_fat_find_dir (grub_disk_t disk, strcontinue ; } -if (grub_strcmp (dirname, filename) ==0 ) +if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );
@@ -601,7 +601,7 @@ grub_fat_find_dir (grub_disk_t disk, strif (hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY ))break ; } -else if (grub_strcmp (dirname, filename) ==0 ) +else if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );
geninit.sh +1 -1
@@ -49,7 +49,7 @@ EOF while read line; do file=`echo $line | cut -f1 -d:` if echo $@ | grep $file >/dev/null; then - echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init ();/' + echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init (0);/' fi done < ${lst}
genmk.rb +1 -1
@@ -115,7 +115,7 @@ UNDSYMFILES += #{undsym} #{@name}: #{pre_obj} #{mod_obj} -rm -f $@ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^ - $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + $(STRIP) $(STRIP_FLAGS) $@ #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} -rm -f $@
include/grub/dl.h +8 -6
@@ -26,25 +26,27 @@#define GRUB_MOD_INIT (name) \ static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \ -void grub_##name##_init (void); \ +void grub_module_##name##_init (grub_dl_t); \ void \ -grub_##name##_init (void) { grub_mod_init (0); } \ +grub_module_##name##_init (grub_dl_t mod) { grub_mod_init (mod); } \ static void \ grub_mod_init (grub_dl_t mod __attribute__ ((unused)))#define GRUB_MOD_FINI (name) \ static void grub_mod_fini (void) __attribute__ ((used)); \ -void grub_##name##_fini (void); \ +void grub_module_##name##_fini (void); \ void \ -grub_##name##_fini (void) { grub_mod_fini (); } \ +grub_module_##name##_fini (void) { grub_mod_fini (); } \ static void \ grub_mod_fini (void)#define GRUB_MOD_NAME (name) \ -__asm__ (".section .modname,\"S\"\n.string \"" #name "\"\n.previous") +static const char grub_module_name_##name[] \ + __attribute__((section(".modname"), __used__)) = #name#define GRUB_MOD_DEP (name) \ -__asm__ (".section .moddeps,\"S\"\n.string \"" #name "\"\n.previous") +static const char grub_module_depend_##name[] \ + __attribute__((section(".moddeps"), __used__)) = #namestruct grub_dl_segment {
include/grub/efi/efi.h +7 -0
@@ -42,6 +42,13 @@ EXPORT_FUNC(grub_efi_allocate_pages) (gr grub_efi_uintn_t pages);void EXPORT_FUNC (grub_efi_free_pages ) (grub_efi_physical_address_t address,grub_efi_uintn_t pages); +void * +EXPORT_FUNC (grub_efi_allocate_boot_pages ) (grub_efi_physical_address_t address, +grub_efi_uintn_t pages); +void +EXPORT_FUNC (grub_efi_free_boot_pages ) (grub_efi_physical_address_t address, +grub_efi_uintn_t pages); + int EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size, grub_efi_memory_descriptor_t *memory_map,
include/grub/ia64/efi/kernel.h +33 -0
@@ -0,0 +1,33 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2002,2003,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_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[]; + +/* The offset of GRUB_PREFIX. */ +#define GRUB_KERNEL_MACHINE_PREFIX 0x8 + +/* End of the data section. */ +#define GRUB_KERNEL_MACHINE_DATA_END 0x50 + +#endif /* ! GRUB_MACHINE_KERNEL_HEADER */ +
include/grub/ia64/efi/loader.h +30 -0
@@ -0,0 +1,30 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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_LOADER_MACHINE_HEADER +#define GRUB_LOADER_MACHINE_HEADER 1 + +/* It is necessary to export these functions, because normal mode commands +reuse rescue mode commands. */ +void grub_rescue_cmd_linux (int argc,char *argv[]); +void grub_rescue_cmd_initrd (int argc,char *argv[]); +void grub_rescue_cmd_module (int argc,char *argv[]); +void grub_rescue_cmd_relocate (int argc,char *argv[]); +void grub_rescue_cmd_fpswa (int argc,char *argv[]); + +#endif /* ! GRUB_LOADER_MACHINE_HEADER */
include/grub/ia64/efi/misc.h +24 -0
@@ -0,0 +1,24 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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/>. +*/ + +void EXPORT_FUNC (memset ) (void ); +void EXPORT_FUNC (__ia64_trampoline ) (void ); +void EXPORT_FUNC (grub_init_modules ) (void ); + +extern unsigned long EXPORT_VAR (__gp ); +
include/grub/ia64/efi/time.h +23 -0
@@ -0,0 +1,23 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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_MACHINE_TIME_HEADER +#define GRUB_MACHINE_TIME_HEADER 1 + +#include <grub/efi/time.h> + +#endif /* ! GRUB_MACHINE_TIME_HEADER */
include/grub/ia64/setjmp.h +31 -0
@@ -0,0 +1,31 @@ +/* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version. +Copyright (C) 1999, 2000, 2008 Free Software Foundation, Inc. +Contributed by David Mosberger-Tang <[email protected]>. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* User code must not depend on the internal representation of jmp_buf. */ + +#define _JBLEN 70 + +/* the __jmp_buf element type should be __float80 per ABI... */ +typedef long grub_jmp_buf [_JBLEN] __attribute__ ((aligned (16 )));/* guarantees 128-bit alignment! */ + +#define grub_setjmp setjmp +#define grub_longjmp longjmp + +int grub_setjmp (grub_jmp_buf env); +void grub_longjmp (grub_jmp_buf env,int val) __attribute__ ((noreturn));
include/grub/ia64/time.h +28 -0
@@ -0,0 +1,28 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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 KERNEL_CPU_TIME_HEADER +#define KERNEL_CPU_TIME_HEADER 1 + +static __inlinevoid +grub_cpu_idle (void ) +{ +/* FIXME: not implemented */ +} + +#endif /* ! KERNEL_CPU_TIME_HEADER */
include/grub/ia64/types.h +32 -0
@@ -0,0 +1,32 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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_TYPES_CPU_HEADER +#define GRUB_TYPES_CPU_HEADER 1 + +/* The size of void *. */ +#define GRUB_TARGET_SIZEOF_VOID_P 8 + +/* The size of long. */ +#define GRUB_TARGET_SIZEOF_LONG 8 + +/* ia64 is little-endian (usually). */ +#undef GRUB_TARGET_WORDS_BIGENDIAN + + +#endif /* ! GRUB_TYPES_CPU_HEADER */
include/grub/kernel.h +1 -1
@@ -53,7 +53,7 @@ void grub_main (void);void grub_machine_init (void );/* The machine-specific finalization. */ -void grub_machine_fini (void ); +void EXPORT_FUNC (grub_machine_fini ) (void );/* The machine-specific prefix initialization. */ void grub_machine_set_prefix (void );
include/grub/misc.h +1 -0
@@ -46,6 +46,7 @@ int EXPORT_FUNC(grub_memcmp) (const voidint EXPORT_FUNC (grub_strcmp ) (const char *s1,const char *s2);int EXPORT_FUNC (grub_strncmp ) (const char *s1,const char *s2,grub_size_t n);int EXPORT_FUNC (grub_strncasecmp ) (const char *s1,const char *s2,int c); +int EXPORT_FUNC (grub_strcasecmp ) (const char *s1,const char *s2);char *EXPORT_FUNC (grub_strchr ) (const char *s,int c);char *EXPORT_FUNC (grub_strrchr ) (const char *s,int c);int EXPORT_FUNC (grub_strword ) (const char *s,const char *w);
kern/dl.c +23 -0
@@ -579,6 +579,29 @@ grub_dl_load_core (void *addr, grub_sizereturn mod; } +void +grub_init_module (const char *name, +void (*init)(grub_dl_t ),void (*fini)(void )) +{ +grub_dl_t mod; + + mod = (grub_dl_t )grub_malloc (sizeof (*mod)); +if (! mod) +return ; + + mod->name = name; + mod->ref_count =1 ; + mod->dep =0 ; + mod->segment =0 ; + mod->init = init; + mod->fini = fini; + +grub_dl_call_init (mod); + +/* Can't fail. */ +grub_dl_add (mod); +} +/* Load a module from the file FILENAME. */ grub_dl_t grub_dl_load_file (const char *filename)
kern/efi/mm.c +63 -27
190 lines not on this page · raw message
kern/ia64/efi/elf_ia64_efi.lds +84 -0
84 lines not on this page · raw message
kern/ia64/efi/init.c +59 -0
59 lines not on this page · raw message
kern/ia64/efi/startup.S +40 -0
@@ -0,0 +1,40 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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/>. + */ + .text + .psr abi64 + .psr lsb + .lsb + + .global _start + .proc _start +_start: + alloc loc0=ar.pfs,2,4,0,0 + mov loc1=rp + addl loc2=@gprel(grub_efi_image_handle),gp + addl loc3=@gprel(grub_efi_system_table),gp + ;; + st8 [loc2]=in0 + st8 [loc3]=in1 + br.call.sptk.few rp=grub_main + ;; + mov ar.pfs=loc0 + mov rp=loc1 + ;; + br.ret.sptk.few rp + + .endp _start
kern/ia64/trampoline.S +38 -0
@@ -0,0 +1,38 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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/>. + */ + .text + .psr abi64 + .psr lsb + .lsb + + .proc __ia64_trampoline + .global __ia64_trampoline +__ia64_trampoline: + /* Read address of the real descriptor. */ + ld8 r2=[r1],8 + ;; + /* Read chain. */ + ld8 r15=[r1] + /* Read pc. */ + ld8 r3=[r2],8 + ;; + /* Read gp. */ + ld8 r1=[r2] + mov b6=r3 + br.many b6 + .endp __ia64_trampoline
kern/misc.c +20 -0
@@ -193,6 +193,26 @@ grub_strcmp (const char *s1, const char }int +grub_strcasecmp (const char *s1,const char *s2) +{ +char c1, c2; + +while (*s1 && *s2) + { + c1 =grub_tolower (*s1); + c2 =grub_tolower (*s2); +if (c1 != c2) +return (int ) c1 - (int ) c2; + + s1++; + s2++; + } + +/* One of these is 0! */ +return (int ) *s1 - (int ) *s2; +} + +int grub_strncmp (const char *s1,const char *s2,grub_size_t n) {
loader/ia64/efi/linux.c +780 -0
780 lines not on this page · raw message
loader/ia64/efi/linux_normal.c +107 -0
107 lines not on this page · raw message
normal/ia64/longjmp.S +162 -0
162 lines not on this page · raw message
normal/ia64/setjmp.S +171 -0
171 lines not on this page · raw message
util/ia64/efi/elf2pe.c +812 -0
237 lines not on this page · raw message
util/ia64/efi/grub-install.in +233 -0
233 lines not on this page · raw message
util/ia64/efi/pe32.h +237 -0
237 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Makefile.in MOSTLYCLEANFILES = · line 106
Quoted 9 lines · Tristan Gingold
Makefile.in +2
-2-MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) +MAINTAINER_CLEANFILES = $(srcdir)/configure $(MKFILES) # The default target. all: all-local ### Include an arch-specific Makefile. -$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb +$(MKFILES): %.mk: %.rmk genmk.rb
Don't these two break srcdir != objdir builds?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 7 lines · Tristan Gingold
Quoted 2 lines
Have you checked if this trick works on other ports? Maybe it'd be a good idea to merge this first.
I don't really understand what do you mean by 'works on other ports'. It is designed to be an optionnal feature used only by ia64. Nothing IA64 specific and other ports may use it. If we go this way, it would be good to slightly improve it.
I suggest you just make sure it'll be usable on other ports in case a need arises, without going out of your way to support it.
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
loader/ia64/efi/linux_normal.c +14
-0+GRUB_MOD_INIT (linux_normal) +{ + (void ) mod;/* To stop warning. */ +grub_register_command + ("linux" , grub_normal_linux_command, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"linux FILE [ARGS...]" , +"Load a linux kernel." ,0 ); + +grub_register_command + ("initrd" , grub_normal_initrd_command, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"initrd FILE" , +"Load an initrd." ,0 );Quoted 8 lines
loader/ia64/efi/linux_normal.c line 85
Quoted 6 lines
loader/ia64/efi/linux_normal.c +6
-0+ +grub_register_command + ("module" , grub_normal_cmd_module, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"module FILE [ARGS...]" , +"Load a Multiboot module." ,0 );Multiboot module loader in linux_normal.mod ?
Quoted 3 lines
Well, well well. Long question :-)
Ia64 doesn't really fit in multiboot: it's a full 64 bits processor,
But there's multiboot2.
Quoted 4 lines
there
may be no room for an header in the 8KB (or you have to waste a lot of memory to keep alignment), no room for EFI pointers in the header and no Ia64 OS uses it. Well this were my conclusion when I read MB specs.
Does this affect only EFI, or ia64 in general (e.g. ia64-coreboot, when that exists) ?
Also note the string "Load a Multiboot module." is present.
If this is not multiboot, I'd suggest renaming the command to avoid name collisions (not only if multiboot is added later, but also user confusion).
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
diff -ruNp -x '*~' -x CVS
grub2.orig/util/ia64/efi/elf2pe.cgrub2/util/ia64/efi/elf2pe.cutil/ia64/efi/elf2pe.c +0
-0[...]
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
This utility seems to be usable on i386 too? In that case, better to put it outside ia64/ dir?
It should work on i386 too, but not tested.
I have written this utility for my port of EFI and adapted the style for grub. It may be nice to share this code with i386 but not really required now IMHO.
util/i386/efi/grub-mkimage.c already generates PE, right? Why a different way to handle this? Sound like it'd be more consistent to either use elf2pe on both or share the same grub-mkimage. What do you think?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 24 lines · Tristan Gingold
Quoted 15 lines
Quoted 15 lines
fs/fat.c +1
-1@@ -568,7 +568,7 @@ grub_fat_find_dir (grub_disk_t disk, strcontinue ; } -if (grub_strcmp (dirname, filename) ==0 ) +if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );@@ -601,7 +601,7 @@ grub_fat_find_dir (grub_disk_t disk, strif (hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY ))break ; }Quoted 8 lines
fs/fat.c grub_fat_find_dir (grub_disk_t disk, str · line 607
Quoted 5 lines
fs/fat.c +1
-1-else if (grub_strcmp (dirname, filename) ==0 ) +else if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );Why is this needed? I'm not sure if it's good to exploit this "unreliability" feature that fat provides us ;-)
Quoted 2 lines
On EFI, the prefix is extracted from an EFI path, whose case may not match the FAT entries.
Can you be more specific about this? What do the specs say? We wrote /boot/grub ourselves via grub-install; is an EFI-compliant firmware allowed to actively mess up case in paths we provided?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoting Robert Millan <[email protected]>:
Quoted 5 lines · Tristan Gingold
Quoted 1 line
-MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix
$(srcdir)/,$(MKFILES))
Quoted 2 lines
+MAINTAINER_CLEANFILES = $(srcdir)/configure $(MKFILES)
Quoted 8 lines
Quoted 6 lines
# The default target.
all: all-local### Include an arch-specific
Makefile.
-$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb +$(MKFILES): %.mk: %.rmk genmk.rbDon't these two break srcdir != objdir builds?
We wrote .mk files in srcdir, and this behaviour is kept. Did I miss your point ?
Quoting Robert Millan <[email protected]>:
Quoted 7 lines · Tristan Gingold
Quoted 1 line
Quoted 1 line
Have you checked if this trick works on other ports? Maybe it'd be a
good idea
Quoted 3 lines
Quoted 1 line
to merge this first.
I don't really understand what do you mean by 'works on other ports'. It
is
Quoted 8 lines
Quoted 1 line
designed to be an optionnal feature used only by ia64. Nothing IA64
specific
Quoted 1 line
and other ports may use it. If we go this way, it would be good to
slightly
Quoted 1 line
improve it.
I suggest you just make sure it'll be usable on other ports in case a need arises, without going out of your way to support it.
Sure. I won't forget other ports. Anyway, there shouldn't be arch specific code in this trick.
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 10 lines
loader/ia64/efi/linux_normal.c +10
-0+GRUB_MOD_INIT (linux_normal) +{ + (void ) mod;/* To stop warning. */ +grub_register_command + ("linux" , grub_normal_linux_command, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"linux FILE [ARGS...]" , +"Load a linux kernel." ,0 ); + + grub_register_commandloader/ia64/efi/linux_normal.c line 85
Quoted 10 lines
loader/ia64/efi/linux_normal.c +10
-0+ ("initrd" , grub_normal_initrd_command, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"initrd FILE" , +"Load an initrd." ,0 ); + +grub_register_command + ("module" , grub_normal_cmd_module, +GRUB_COMMAND_FLAG_BOTH |GRUB_COMMAND_FLAG_NO_ARG_PARSE , +"module FILE [ARGS...]" , +"Load a Multiboot module." ,0 );Multiboot module loader in linux_normal.mod ?
Quoted 5 lines
Quoted 3 lines
Well, well well. Long question :-)
Ia64 doesn't really fit in multiboot: it's a full 64 bits processor,
But there's multiboot2.
Right.
Quoted 8 lines
Quoted 2 lines
there
may be no room for an header in the 8KB (or you have to waste a lot ofmemory
Quoted 2 lines
to keep alignment), no room for EFI pointers in the header and no Ia64 OS uses it. Well this were my conclusion when I read MB specs.
Does this affect only EFI, or ia64 in general (e.g. ia64-coreboot, when that exists) ?
It's IA64 indeed.
Quoted 4 lines
Also note the string "Load a Multiboot module." is present.
If this is not multiboot, I'd suggest renaming the command to avoid name collisions (not only if multiboot is added later, but also user confusion).
Ok, I will rename the command and change the string, so this issue will be closed.
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
diff -ruNp -x '*~' -x CVS
grub2.orig/util/ia64/efi/elf2pe.c
grub2/util/ia64/efi/elf2pe.cQuoted 1 line
Quoted 1 line
Quoted 1 line
---
grub2.orig/util/ia64/efi/elf2pe.c1970-01-01 01:00:00.000000000+0100
Quoted 4 lines
Quoted 1 line
Quoted 1 line
+++
grub2/util/ia64/efi/elf2pe.c2008-01-28 16:29:58.000000000 +0100[...]
Quoted 2 lines
This utility seems to be usable on i386 too? In that case, better to put
it
Quoted 2 lines
Quoted 1 line
outside ia64/ dir?
Quoted 8 lines
Quoted 4 lines
It should work on i386 too, but not tested.
I have written this utility for my port of EFI and adapted the style for grub. It may be nice to share this code with i386 but not really required now IMHO.
util/i386/efi/grub-mkimage.calready generates PE, right? Why a different way to handle this? Sound like it'd be more consistent to either use elf2pe on both or share the same grub-mkimage. What do you think?
Having only one implementation is for sure a goal. But there are many differences between the two implementations:
* grub-mkimage can only handle PE and I386.
* grub-mkimage can put modules image in a section.
* elf2pe can generate PE and PE+ and read I386 or IA64 ELF.
Enhancing grub-mkimage is not a small work as there are a lot of 32 bits types. And in any case we have to test the two implementations (doable).
In my opinion, there is no need to hurry here. The both implementations work, they do slightly different job, do not require maintainance and we can do the merge later.
Tristan.
Quoting Robert Millan <[email protected]>:
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Why is this needed? I'm not sure if it's good to exploit this
"unreliability"
Quoted 4 lines
Quoted 1 line
feature that fat provides us ;-)
On EFI, the prefix is extracted from an EFI path, whose case may not match the FAT entries.
Can you be more specific about this? What do the specs say? We wrote
/boot/grubourselves via grub-install; is an EFI-compliant firmware allowed to actively mess up case in paths we provided?
On EFI, we don't really know where grub is stored. There is a filesystem layout convention we'd better to follow. As a consequence, we extract the path from an EFI structure (I didn't write this code - it's in the EFI common code).
Did I answer to all your concerns on this topic ?
Quoted 10 lines · On Tue, Jan 29, 2008 at 11:10:21AM +0100, [email protected] wrote:
Quoting Robert Millan <[email protected]>:
Quoted 8 lines · Tristan Gingold
Quoted 1 line
-MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix
$(srcdir)/,$(MKFILES))
Quoted 5 lines
+MAINTAINER_CLEANFILES = $(srcdir)/configure $(MKFILES)
# The default target.
all: all-local
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
### Include an arch-specific
Makefile.
-$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb +$(MKFILES): %.mk: %.rmk genmk.rbDon't these two break srcdir != objdir builds?
We wrote .mk files in srcdir, and this behaviour is kept. Did I miss your point ?
But mkfile generation itself can also happen when srcdir != objdir, can it?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 11 lines · On Tue, Jan 29, 2008 at 11:31:21AM +0100, [email protected] wrote:
Quoted 3 lines
util/i386/efi/grub-mkimage.calready generates PE, right? Why a different way to handle this? Sound like it'd be more consistent to either use elf2pe on both or share the same grub-mkimage. What do you think?Having only one implementation is for sure a goal. But there are many differences between the two implementations:
* grub-mkimage can only handle PE and I386.
* grub-mkimage can put modules image in a section.
* elf2pe can generate PE and PE+ and read I386 or IA64 ELF.
Quoted 6 lines
Enhancing grub-mkimage is not a small work as there are a lot of 32 bits types. And in any case we have to test the two implementations (doable).
In my opinion, there is no need to hurry here. The both implementations work, they do slightly different job, do not require maintainance and we can do the merge later.
No objection from me.
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 8 lines · On Tue, Jan 29, 2008 at 11:35:26AM +0100, [email protected] wrote:
Quoting Robert Millan <[email protected]>:
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Why is this needed? I'm not sure if it's good to exploit this
"unreliability"
Quoted 4 lines
Quoted 1 line
feature that fat provides us ;-)
On EFI, the prefix is extracted from an EFI path, whose case may not match the FAT entries.
Quoted 8 lines
Quoted 3 lines
Can you be more specific about this? What do the specs say? We wrote
/boot/grubourselves via grub-install; is an EFI-compliant firmware allowed to actively mess up case in paths we provided?On EFI, we don't really know where grub is stored. There is a filesystem layout convention we'd better to follow. As a consequence, we extract the path from an EFI structure (I didn't write this code - it's in the EFI common code).
What would you think of case-insensitive search in grub_efi_set_prefix() ?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoting Robert Millan <[email protected]>:
Quoted 15 lines · On Tue, Jan 29, 2008 at 11:10:21AM +0100, [email protected] wrote:
Quoted 14 lines
Quoting Robert Millan <[email protected]>:
Quoted 12 lines · Tristan Gingold
Quoted 1 line
-MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix
$(srcdir)/,$(MKFILES))
Quoted 8 lines
+MAINTAINER_CLEANFILES = $(srcdir)/configure $(MKFILES)
# The default target.
all: all-local### Include an arch-specific
Makefile.
-$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb +$(MKFILES): %.mk: %.rmk genmk.rb
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Don't these two break srcdir != objdir builds?
We wrote .mk files in srcdir, and this behaviour is kept. Did I miss your
point
Quoted 1 line
?
But mkfile generation itself can also happen when srcdir != objdir, can it?
Right. I fail to understand your point: how did the patch break srcdir != objdir ? I tested it with srcdir != objdir.
Quoting Robert Millan <[email protected]>:
Quoted 14 lines · On Tue, Jan 29, 2008 at 11:35:26AM +0100, [email protected] wrote:
Quoted 6 lines
Quoting Robert Millan <[email protected]>:
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Why is this needed? I'm not sure if it's good to exploit this
"unreliability"
Quoted 3 lines
Quoted 1 line
feature that fat provides us ;-)
On EFI, the prefix is extracted from an EFI path, whose case may not
match
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
the FAT entries.
Can you be more specific about this? What do the specs say? We wrote
/boot/grubourselves via grub-install; is an EFI-compliant firmware allowed to actively mess up case in paths we provided?
Quoted 7 lines
Quoted 3 lines
On EFI, we don't really know where grub is stored. There is a filesystem layout convention we'd better to follow. As a consequence, we extract the path from an EFI structure (I didn't write this code - it's in the EFI
common
Quoted 1 line
code).
What would you think of case-insensitive search in
grub_efi_set_prefix()?
You mean walking the filesystem in grub_efi_set_prefix ? Humm, this looks like a hack. The filesystem may not be FAT and there may be no way to read directory entries (eg tftp - even if not yet supported).
If you really don't like it I can put it away for now. Grub should work without this patch in most cases.
Tristan.
Quoted 19 lines · On Tue, Jan 29, 2008 at 01:56:49PM +0100, [email protected] wrote:
Quoting Robert Millan <[email protected]>:
Quoted 17 lines · On Tue, Jan 29, 2008 at 11:35:26AM +0100, [email protected] wrote:
Quoted 6 lines
Quoting Robert Millan <[email protected]>:
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Why is this needed? I'm not sure if it's good to exploit this
"unreliability"
Quoted 3 lines
Quoted 1 line
feature that fat provides us ;-)
On EFI, the prefix is extracted from an EFI path, whose case may not
match
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
the FAT entries.
Can you be more specific about this? What do the specs say? We wrote
/boot/grubourselves via grub-install; is an EFI-compliant firmware allowed to actively mess up case in paths we provided?On EFI, we don't really know where grub is stored. There is a filesystem layout convention we'd better to follow. As a consequence, we extract the path from an EFI structure (I didn't write this code - it's in the EFI
Quoted 7 lines
Quoted 4 lines
common
Quoted 1 line
code).
What would you think of case-insensitive search in
grub_efi_set_prefix()?You mean walking the filesystem in
grub_efi_set_prefix? Humm, this looks like a hack.
It does, I admit ;-). From my POV, it's a workaround for a bug, and it's not so strange that workarounds tend to look like ugly hacks.
Anyway, does EFI replace the string with a case-unsensitive equivalent in practise?
Quoted 2 lines
The filesystem may not be FAT and there may be no way to read directory entries (eg tftp - even if not yet supported).
You can still do this kind of search by stating for a lot of specific files instead of iterating. This would be a PITA, though :-(
Quoted 2 lines
If you really don't like it I can put it away for now. Grub should work without this patch in most cases.
Could you wait untill the maintainers have their say on this? If Marco or Okuji think it is fine, I have no objection then.
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 6 lines · Tristan Gingold
Hi,
here is my new version of the patch. I think all the comments have been addressed.
(There are still // comments in the .S files I copied from glibc. I suppose this is OK as the files come as-is from glibc).
Uhm looks like the patch is messed up somehow:
patch: **** malformed patch at line 1755: diff -ruNp -x '*~' -x CVS -x autom4te.cache -x '*.mk' -x configure grub2.orig/loader/ia64/efi/linux.c grub2/loader/ia64/efi/linux.c
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 5 lines · On Tue, Jan 29, 2008 at 01:53:03PM +0100, [email protected] wrote:
Quoted 2 lines
But mkfile generation itself can also happen when srcdir != objdir, can it?
Right. I fail to understand your point: how did the patch break srcdir != objdir ? I tested it with srcdir != objdir.
Ah, sorry I read the patch wrong. I thought you were removing $(srcdir) rather than moving it from one place to another.
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 37 lines · Robert Millan
Quoted 19 lines · On Tue, Jan 29, 2008 at 01:56:49PM +0100, [email protected] wrote:
Quoting Robert Millan <[email protected]>:
Quoted 17 lines · On Tue, Jan 29, 2008 at 11:35:26AM +0100, [email protected] wrote:
Quoted 6 lines
Quoting Robert Millan <[email protected]>:
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Why is this needed? I'm not sure if it's good to exploit this
"unreliability"
Quoted 3 lines
Quoted 1 line
feature that fat provides us ;-)
On EFI, the prefix is extracted from an EFI path, whose case may not
match
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
the FAT entries.
Can you be more specific about this? What do the specs say? We wrote
/boot/grubourselves via grub-install; is an EFI-compliant firmware allowed to actively mess up case in paths we provided?On EFI, we don't really know where grub is stored. There is a filesystem layout convention we'd better to follow. As a consequence, we extract the path from an EFI structure (I didn't write this code - it's in the EFI
Quoted 7 lines
Quoted 4 lines
common
Quoted 1 line
code).
What would you think of case-insensitive search in
grub_efi_set_prefix()?You mean walking the filesystem in
grub_efi_set_prefix? Humm, this looks like a hack.It does, I admit ;-). From my POV, it's a workaround for a bug, and it's not so strange that workarounds tend to look like ugly hacks.
Anyway, does EFI replace the string with a case-unsensitive equivalent in practise?
Quoted 2 lines
The filesystem may not be FAT and there may be no way to read directory entries (eg tftp - even if not yet supported).
Quoted 8 lines
You can still do this kind of search by stating for a lot of specific files instead of iterating. This would be a PITA, though :-(
Quoted 2 lines
If you really don't like it I can put it away for now. Grub should work without this patch in most cases.
Could you wait untill the maintainers have their say on this? If Marco or Okuji think it is fine, I have no objection then.
Personally I do not like working around an issue in specific code (in this case specific to *-efi) in generic code. Usually, this doesn't improve shared code.
In this case, FAT is modified so fit the need of EFI. However, FAT is case insensitive. On windows C:\FOO.TXT is the same as c:\foo.txt. Although I have troubles believing people want to use a technically flawed non-free OS that costs a lot of money. But that might be something personally ;-)
What matters is that it is normal that FAT is not case sensitive. It's defined that way. This change can't and won't be made for ext2, for example. You can have a ~/foo and ~/FOO side by side. AFAIK, this is not possible with FAT. So I think this patch is ok :-)
Robert suggested some changes. I also noticed in the discussion that you didn't follow common practise (like an existing grub-mkimage implementation). Personally, as maintainer, I am against maintaining two different approaches of the same problem. It costs us time to maintain this and both case have separate bugs. So I rather see the code shared, one way or the other. To safe time, it might save you some work if you initiate a discussion about this.
If you send in a new patch that addresses Robert's concerns + Changelog entry, I will go over it ASAP :-). Giving the same comments as Robert does seems like a waste of time for everyone. Is this ok for you?
--
Marco
Quoted 10 lines · Marco Gerards
In this case, FAT is modified so fit the need of EFI. However, FAT is case insensitive. On windows C:\FOO.TXT is the same as c:\foo.txt. Although I have troubles believing people want to use a technically flawed non-free OS that costs a lot of money. But that might be something personally ;-)
What matters is that it is normal that FAT is not case sensitive. It's defined that way. This change can't and won't be made for ext2, for example. You can have a ~/foo and ~/FOO side by side. AFAIK, this is not possible with FAT. So I think this patch is ok :-)
I may lack some perspective on how FAT works internally, so please bear with me, but as far as I can see:
- FAT is not really case insensitive any more than its path names are 8.3-limited. It originally was, but latest revisions don't enforce these limitations.
- For backwards compatibility with legacy applications we don't really care about, the _OS_ that usually operates on FAT uses case insensitive file access (but not case insensitive directory listing!).
- The only remnant that we have from all of this, is that two different files can't have names that match a case-insensitive comparison, which doesn't really affect our problem which is finding a match through case insensitive search.
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoting Marco Gerards <[email protected]>:
Quoted 10 lines
Personally I do not like working around an issue in specific code (in this case specific to *-efi) in generic code. Usually, this doesn't improve shared code.
In this case, FAT is modified so fit the need of EFI. However, FAT is case insensitive. On windows C:\FOO.TXT is the same as c:\foo.txt. Although I have troubles believing people want to use a technically flawed non-free OS that costs a lot of money. But that might be something personally ;-)
Quoted 4 lines
What matters is that it is normal that FAT is not case sensitive. It's defined that way. This change can't and won't be made for ext2, for example. You can have a ~/foo and ~/FOO side by side. AFAIK, this is not possible with FAT. So I think this patch is ok :-)
Ok, I will send it separately (as it is not really ia64 specific).
Quoted 7 lines
Robert suggested some changes. I also noticed in the discussion that you didn't follow common practise (like an existing grub-mkimage implementation). Personally, as maintainer, I am against maintaining two different approaches of the same problem. It costs us time to maintain this and both case have separate bugs. So I rather see the code shared, one way or the other. To safe time, it might save you some work if you initiate a discussion about this.
Ok.
Quoted 4 lines
If you send in a new patch that addresses Robert's concerns + Changelog entry, I will go over it ASAP :-). Giving the same comments as Robert does seems like a waste of time for everyone. Is this ok for you?
Ok.
Tristan.
Quoting Robert Millan <[email protected]>:
Quoted 12 lines · Marco Gerards
Quoted 10 lines
In this case, FAT is modified so fit the need of EFI. However, FAT is case insensitive. On windows C:\FOO.TXT is the same as c:\foo.txt. Although I have troubles believing people want to use a technically flawed non-free OS that costs a lot of money. But that might be something personally ;-)
What matters is that it is normal that FAT is not case sensitive. It's defined that way. This change can't and won't be made for ext2, for example. You can have a ~/foo and ~/FOO side by side. AFAIK, this is not possible with FAT. So I think this patch is ok :-)
Quoted 6 lines
I may lack some perspective on how FAT works internally, so please bear with me, but as far as I can see:
- FAT is not really case insensitive any more than its path names are 8.3-limited. It originally was, but latest revisions don't enforce these limitations.
FAT is now case preserving but still case insensitive. Like MacOS filesystem.
Quoted 8 lines
- For backwards compatibility with legacy applications we don't really care about, the _OS_ that usually operates on FAT uses case insensitive file access (but not case insensitive directory listing!).
- The only remnant that we have from all of this, is that two different files can't have names that match a case-insensitive comparison, which doesn't really affect our problem which is finding a match through case insensitive search.
Right.
Tristan.
Quoted 14 lines · On Tue, Jan 29, 2008 at 05:38:20PM +0100, [email protected] wrote:
Quoting Robert Millan <[email protected]>:
Quoted 12 lines · Marco Gerards
Quoted 10 lines
In this case, FAT is modified so fit the need of EFI. However, FAT is case insensitive. On windows C:\FOO.TXT is the same as c:\foo.txt. Although I have troubles believing people want to use a technically flawed non-free OS that costs a lot of money. But that might be something personally ;-)
What matters is that it is normal that FAT is not case sensitive. It's defined that way. This change can't and won't be made for ext2, for example. You can have a ~/foo and ~/FOO side by side. AFAIK, this is not possible with FAT. So I think this patch is ok :-)
Quoted 8 lines
Quoted 6 lines
I may lack some perspective on how FAT works internally, so please bear with me, but as far as I can see:
- FAT is not really case insensitive any more than its path names are 8.3-limited. It originally was, but latest revisions don't enforce these limitations.
FAT is now case preserving but still case insensitive. Like MacOS filesystem.
AFAIK, there's no standard specifiing FAT, only a few implementations that act de-facto as a "reference". Because of this, it is up to us to decide what is "standard" and what is just an OS-dependant oddity.
Since the choice is arbitrary, why not choose based on the merits of each option, rather than based on what some implementations do?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
On Tue, Jan 29, 2008 at 07:48:29PM +0100, Robert Millan wrote:
[...]
Quoted 3 lines
AFAIK, there's no standard specifiing FAT, only a few implementations that act de-facto as a "reference". Because of this, it is up to us to decide what is "standard" and what is just an OS-dependant oddity.
There are spefications from MS, eg:
Microsoft Extensible Firmware Initiative FAT32 File System Specification, rev. 1.03, December 6, 2000,
(http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx)
or even ECMA 107.
Quoted 2 lines
Since the choice is arbitrary, why not choose based on the merits of each option, rather than based on what some implementations do?
Tristan.
Quoted 4 lines · Marco Gerards
If you send in a new patch that addresses Robert's concerns + Changelog entry, I will go over it ASAP :-). Giving the same comments as Robert does seems like a waste of time for everyone. Is this ok for you?
Here is the IA64 port patch. I will send separately the FAT patch (optionnal) and I will mail my proposal to merge the both efi tools.
Tristan.
2008-01-28 Tristan Gingold <[email protected]>
* geninit.sh: Call _init with a null argument.
* configure.ac: Add ia64-efi target.
* Makefile.in (STRIP_FLAGS): Declare (overriden on ia64). (RMKFILES): Use a wildcard.
* genmk.rb: Use STRIP_FLAGS for strip.
* util/ia64/efi/grub-install.in: New file.
* util/ia64/efi/pe32.h: New file.
* util/ia64/efi/elf2pe.c: New file.
* normal/ia64/setjmp.S: New file (from glibc).
* normal/ia64/longjmp.S: New file (from glibc).
* loader/ia64/efi/linux_normal.c: New file.
* loader/ia64/efi/linux.c: New file.
* conf/ia64-efi.rmk: New file.
* commands/efi/systab.c: New file.
* commands/efi/memmap.c: New file.
* commands/efi/acpi.c: New file.
* include/grub/efi/efi.h: Declare grub_efi_allocate_boot_pages and grub_efi_free_boot_pages.
* include/grub/kernel.h: Export grub_machine_fini.
* include/grub/dl.h: Use attribute instead of raw asm statement. Use grub_module as prefix to make identification easier.
* include/grub/ia64/efi/time.h: New file.
* include/grub/ia64/efi/misc.h: New file.
* include/grub/ia64/efi/loader.h: New file.
* include/grub/ia64/efi/kernel.h: New file.
* include/grub/ia64/time.h: New file.
* include/grub/ia64/setjmp.h: New file.
* include/grub/ia64/types.h: New file.
* kern/efi/mm.c (BYTES_TO_PAGES): Round instead of truncating. (grub_efi_allocate_boot_pages): Low level interface to allocate_pages. (grub_efi_free_boot_pages): Low level interface to free_pages. (grub_efi_allocate_pages): Call grub_efi_allocate_boot_pages. (grub_efi_free_pages): Call grubèefi_free_boot_pages. (add_memory_regions): Add debug message in ifdef. (add_memory_regions): Add debug message in ifdef. (grub_efi_mm_init): Do not constraint memory map length, add space for a few more entries.
* kern/dl.c (grub_init_module): New function. Register an already linked module.
* kern/ia64/efi/elf_ia64_efi.lds: New file.
* kern/ia64/efi/startup.S: New file.
* kern/ia64/efi/init.c: New file.
* kern/ia64/trampoline.S: New file.
Makefile.in +4 -4
@@ -67,6 +67,7 @@ TARGET_CFLAGS = @TARGET_CFLAGS@ TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I. -Iinclude -I$(srcdir)/include \ -Wall -W TARGET_LDFLAGS = @TARGET_LDFLAGS@ +STRIP_FLAGS=--strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment OBJCOPY = @OBJCOPY@ STRIP = @STRIP@ NM = @NM@
@@ -82,8 +83,7 @@ enable_grub_emu = @enable_grub_emu@ ### General variables. -RMKFILES = $(addprefix conf/,common.rmk i386-pc.rmk powerpc-ieee1275.rmk \ - sparc64-ieee1275.rmk i386-efi.rmk) +RMKFILES = $(wildcard $(srcdir)/conf/*.rmk) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) PKGLIB = $(pkglib_IMAGES) $(pkglib_MODULES) $(pkglib_PROGRAMS) \
@@ -97,13 +97,13 @@ MOSTLYCLEANFILES = DISTCLEANFILES = config.status config.cache config.log config.h \ Makefile stamp-h include/grub/cpu include/grub/machine \ gensymlist.sh genkernsyms.sh -MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) +MAINTAINER_CLEANFILES = $(srcdir)/configure $(MKFILES) # The default target. all: all-local ### Include an arch-specific Makefile. -$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb +$(MKFILES): %.mk: %.rmk genmk.rb if test "x$(RUBY)" = x; then \ touch $@; \ else \
commands/efi/acpi.c +190 -0
190 lines not on this page · raw message
commands/efi/memmap.c +143 -0
143 lines not on this page · raw message
commands/efi/systab.c +258 -0
258 lines not on this page · raw message
conf/ia64-efi.rmk +127 -0
127 lines not on this page · raw message
config.h.in +2 -2
@@ -88,10 +88,10 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* The size of `long', as computed by sizeof. */ +/* The size of a `long', as computed by sizeof. */ #undef SIZEOF_LONG -/* The size of `void *', as computed by sizeof. */ +/* The size of a `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P /* Define it to either start or _start */
configure.ac +4 -1
@@ -53,7 +53,8 @@ case "$target_cpu" in powerpc) ;; powerpc64) target_cpu=powerpc target_m32=1;; sparc64) ;; - *) AC_MSG_ERROR([unsupported CPU type]) ;; + ia64) ;; + *) AC_MSG_ERROR([unsupported CPU type $target_cpu]) ;; esac # Specify the platform (such as firmware).
@@ -68,6 +69,7 @@ if test "x$with_platform" = x; then i386-*) platform=pc ;; powerpc-*) platform=ieee1275 ;; sparc64-*) platform=ieee1275 ;; + ia64*) platform=efi ;; *) AC_MSG_ERROR([unsupported machine type]) ;; esac else
@@ -82,6 +84,7 @@ case "$target_cpu"-"$platform" in i386-ieee1275) ;; powerpc-ieee1275) ;; sparc64-ieee1275) ;; + ia64-efi) ;; *) AC_MSG_ERROR([unsupported machine type]) ;; esac
geninit.sh +1 -1
@@ -49,7 +49,7 @@ EOF while read line; do file=`echo $line | cut -f1 -d:` if echo $@ | grep $file >/dev/null; then - echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init ();/' + echo $line | sed -e 's/.*GRUB_MOD_INIT *(\([a-zA-Z0-9_]*\)).*/ grub_\1_init (0);/' fi done < ${lst}
genmk.rb +1 -1
@@ -115,7 +115,7 @@ UNDSYMFILES += #{undsym} #{@name}: #{pre_obj} #{mod_obj} -rm -f $@ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ $^ - $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ + $(STRIP) $(STRIP_FLAGS) $@ #{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str} -rm -f $@
include/grub/dl.h +8 -6
@@ -26,25 +26,27 @@#define GRUB_MOD_INIT (name) \ static void grub_mod_init (grub_dl_t mod __attribute__ ((unused))) __attribute__ ((used)); \ -void grub_##name##_init (void); \ +void grub_module_##name##_init (grub_dl_t); \ void \ -grub_##name##_init (void) { grub_mod_init (0); } \ +grub_module_##name##_init (grub_dl_t mod) { grub_mod_init (mod); } \ static void \ grub_mod_init (grub_dl_t mod __attribute__ ((unused)))#define GRUB_MOD_FINI (name) \ static void grub_mod_fini (void) __attribute__ ((used)); \ -void grub_##name##_fini (void); \ +void grub_module_##name##_fini (void); \ void \ -grub_##name##_fini (void) { grub_mod_fini (); } \ +grub_module_##name##_fini (void) { grub_mod_fini (); } \ static void \ grub_mod_fini (void)#define GRUB_MOD_NAME (name) \ -__asm__ (".section .modname,\"S\"\n.string \"" #name "\"\n.previous") +static const char grub_module_name_##name[] \ + __attribute__((section(".modname"), __used__)) = #name#define GRUB_MOD_DEP (name) \ -__asm__ (".section .moddeps,\"S\"\n.string \"" #name "\"\n.previous") +static const char grub_module_depend_##name[] \ + __attribute__((section(".moddeps"), __used__)) = #namestruct grub_dl_segment {
include/grub/efi/efi.h +7 -0
@@ -42,6 +42,13 @@ EXPORT_FUNC(grub_efi_allocate_pages) (gr grub_efi_uintn_t pages);void EXPORT_FUNC (grub_efi_free_pages ) (grub_efi_physical_address_t address,grub_efi_uintn_t pages); +void * +EXPORT_FUNC (grub_efi_allocate_boot_pages ) (grub_efi_physical_address_t address, +grub_efi_uintn_t pages); +void +EXPORT_FUNC (grub_efi_free_boot_pages ) (grub_efi_physical_address_t address, +grub_efi_uintn_t pages); + int EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size, grub_efi_memory_descriptor_t *memory_map,
include/grub/ia64/efi/kernel.h +33 -0
@@ -0,0 +1,33 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2002,2003,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_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[]; + +/* The offset of GRUB_PREFIX. */ +#define GRUB_KERNEL_MACHINE_PREFIX 0x8 + +/* End of the data section. */ +#define GRUB_KERNEL_MACHINE_DATA_END 0x50 + +#endif /* ! GRUB_MACHINE_KERNEL_HEADER */ +
include/grub/ia64/efi/loader.h +30 -0
@@ -0,0 +1,30 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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_LOADER_MACHINE_HEADER +#define GRUB_LOADER_MACHINE_HEADER 1 + +/* It is necessary to export these functions, because normal mode commands +reuse rescue mode commands. */ +void grub_rescue_cmd_linux (int argc,char *argv[]); +void grub_rescue_cmd_initrd (int argc,char *argv[]); +void grub_rescue_cmd_payload (int argc,char *argv[]); +void grub_rescue_cmd_relocate (int argc,char *argv[]); +void grub_rescue_cmd_fpswa (int argc,char *argv[]); + +#endif /* ! GRUB_LOADER_MACHINE_HEADER */
include/grub/ia64/efi/misc.h +24 -0
@@ -0,0 +1,24 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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/>. +*/ + +void EXPORT_FUNC (memset ) (void ); +void EXPORT_FUNC (__ia64_trampoline ) (void ); +void EXPORT_FUNC (grub_init_modules ) (void ); + +extern unsigned long EXPORT_VAR (__gp ); +
include/grub/ia64/efi/time.h +23 -0
@@ -0,0 +1,23 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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_MACHINE_TIME_HEADER +#define GRUB_MACHINE_TIME_HEADER 1 + +#include <grub/efi/time.h> + +#endif /* ! GRUB_MACHINE_TIME_HEADER */
include/grub/ia64/setjmp.h +31 -0
@@ -0,0 +1,31 @@ +/* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version. +Copyright (C) 1999, 2000, 2008 Free Software Foundation, Inc. +Contributed by David Mosberger-Tang <[email protected]>. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If not, +write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* User code must not depend on the internal representation of jmp_buf. */ + +#define _JBLEN 70 + +/* the __jmp_buf element type should be __float80 per ABI... */ +typedef long grub_jmp_buf [_JBLEN] __attribute__ ((aligned (16 )));/* guarantees 128-bit alignment! */ + +#define grub_setjmp setjmp +#define grub_longjmp longjmp + +int grub_setjmp (grub_jmp_buf env); +void grub_longjmp (grub_jmp_buf env,int val) __attribute__ ((noreturn));
include/grub/ia64/time.h +28 -0
@@ -0,0 +1,28 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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 KERNEL_CPU_TIME_HEADER +#define KERNEL_CPU_TIME_HEADER 1 + +static __inlinevoid +grub_cpu_idle (void ) +{ +/* FIXME: not implemented */ +} + +#endif /* ! KERNEL_CPU_TIME_HEADER */
include/grub/ia64/types.h +32 -0
@@ -0,0 +1,32 @@ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 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_TYPES_CPU_HEADER +#define GRUB_TYPES_CPU_HEADER 1 + +/* The size of void *. */ +#define GRUB_TARGET_SIZEOF_VOID_P 8 + +/* The size of long. */ +#define GRUB_TARGET_SIZEOF_LONG 8 + +/* ia64 is little-endian (usually). */ +#undef GRUB_TARGET_WORDS_BIGENDIAN + + +#endif /* ! GRUB_TYPES_CPU_HEADER */
include/grub/kernel.h +1 -1
@@ -53,7 +53,7 @@ void grub_main (void);void grub_machine_init (void );/* The machine-specific finalization. */ -void grub_machine_fini (void ); +void EXPORT_FUNC (grub_machine_fini ) (void );/* The machine-specific prefix initialization. */ void grub_machine_set_prefix (void );
kern/dl.c +23 -0
@@ -579,6 +579,29 @@ grub_dl_load_core (void *addr, grub_sizereturn mod; } +void +grub_init_module (const char *name, +void (*init)(grub_dl_t ),void (*fini)(void )) +{ +grub_dl_t mod; + + mod = (grub_dl_t )grub_malloc (sizeof (*mod)); +if (! mod) +return ; + + mod->name = name; + mod->ref_count =1 ; + mod->dep =0 ; + mod->segment =0 ; + mod->init = init; + mod->fini = fini; + +grub_dl_call_init (mod); + +/* Can't fail. */ +grub_dl_add (mod); +} +/* Load a module from the file FILENAME. */ grub_dl_t grub_dl_load_file (const char *filename)
kern/efi/mm.c +63 -27
190 lines not on this page · raw message
kern/ia64/efi/elf_ia64_efi.lds +84 -0
84 lines not on this page · raw message
kern/ia64/efi/init.c +59 -0
59 lines not on this page · raw message
kern/ia64/efi/startup.S +40 -0
@@ -0,0 +1,40 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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/>. + */ + .text + .psr abi64 + .psr lsb + .lsb + + .global _start + .proc _start +_start: + alloc loc0=ar.pfs,2,4,0,0 + mov loc1=rp + addl loc2=@gprel(grub_efi_image_handle),gp + addl loc3=@gprel(grub_efi_system_table),gp + ;; + st8 [loc2]=in0 + st8 [loc3]=in1 + br.call.sptk.few rp=grub_main + ;; + mov ar.pfs=loc0 + mov rp=loc1 + ;; + br.ret.sptk.few rp + + .endp _start
kern/ia64/trampoline.S +38 -0
@@ -0,0 +1,38 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 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/>. + */ + .text + .psr abi64 + .psr lsb + .lsb + + .proc __ia64_trampoline + .global __ia64_trampoline +__ia64_trampoline: + /* Read address of the real descriptor. */ + ld8 r2=[r1],8 + ;; + /* Read chain. */ + ld8 r15=[r1] + /* Read pc. */ + ld8 r3=[r2],8 + ;; + /* Read gp. */ + ld8 r1=[r2] + mov b6=r3 + br.many b6 + .endp __ia64_trampoline
loader/ia64/efi/linux.c +781 -0
781 lines not on this page · raw message
loader/ia64/efi/linux_normal.c +107 -0
107 lines not on this page · raw message
normal/ia64/longjmp.S +162 -0
162 lines not on this page · raw message
normal/ia64/setjmp.S +171 -0
171 lines not on this page · raw message
util/ia64/efi/elf2pe.c +812 -0
284 lines not on this page · raw message
util/ia64/efi/grub-install.in +233 -0
233 lines not on this page · raw message
util/ia64/efi/pe32.h +237 -0
237 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 4 lines
If you send in a new patch that addresses Robert's concerns + Changelog entry, I will go over it ASAP :-). Giving the same comments as Robert does seems like a waste of time for everyone. Is this ok for you?
Here is the patch that makes FAT fs case insensitive.
Tristan.
2008-01-28 Tristan Gingold <[email protected]>
* kern/misc.c (grub_strcasecmp): New function.
* include/grub/misc.h: Declare grub_strcasecmp.
* fs/fat.c (grub_fat_find_dir): Use case insensitive string compare as filenames are not case sensitive.
kern/misc.c +20 -0
@@ -193,6 +193,26 @@ grub_strcmp (const char *s1, const char }int +grub_strcasecmp (const char *s1,const char *s2) +{ +char c1, c2; + +while (*s1 && *s2) + { + c1 =grub_tolower (*s1); + c2 =grub_tolower (*s2); +if (c1 != c2) +return (int ) c1 - (int ) c2; + + s1++; + s2++; + } + +/* One of these is 0! */ +return (int ) *s1 - (int ) *s2; +} + +int grub_strncmp (const char *s1,const char *s2,grub_size_t n) {if (n ==0 )
include/grub/misc.h +1 -0
@@ -46,6 +46,7 @@ int EXPORT_FUNC(grub_memcmp) (const voidint EXPORT_FUNC (grub_strcmp ) (const char *s1,const char *s2);int EXPORT_FUNC (grub_strncmp ) (const char *s1,const char *s2,grub_size_t n);int EXPORT_FUNC (grub_strncasecmp ) (const char *s1,const char *s2,int c); +int EXPORT_FUNC (grub_strcasecmp ) (const char *s1,const char *s2);char *EXPORT_FUNC (grub_strchr ) (const char *s,int c);char *EXPORT_FUNC (grub_strrchr ) (const char *s,int c);int EXPORT_FUNC (grub_strword ) (const char *s,const char *w);
fs/fat.c +2 -2
@@ -568,7 +568,7 @@ grub_fat_find_dir (grub_disk_t disk, strcontinue ; } -if (grub_strcmp (dirname, filename) ==0 ) +if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );
@@ -601,7 +601,7 @@ grub_fat_find_dir (grub_disk_t disk, strif (hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY ))break ; } -else if (grub_strcmp (dirname, filename) ==0 ) +else if (grub_strcasecmp (dirname, filename) ==0 ) {if (call_hook)hook (filename, dir.attr &GRUB_FAT_ATTR_DIRECTORY );
Quoted 7 lines · Marco Gerards
Robert suggested some changes. I also noticed in the discussion that you didn't follow common practise (like an existing grub-mkimage implementation). Personally, as maintainer, I am against maintaining two different approaches of the same problem. It costs us time to maintain this and both case have separate bugs. So I rather see the code shared, one way or the other. To safe time, it might save you some work if you initiate a discussion about this.
The facts:
util/i386/efi/grub-mkimage.c and elf2pe.c do almost the same thing: converting an ELF file to a PE file. But:
* the input format is slightly different (Elf32 vs Elf64)
* the output format is slightly different (PE vs PE+)
* the relocating work is different (x86 vs ia64, Rel vs Rela)
* The entry point is a descriptor on ia64
* grub-mkimage.c can insert modules in a section.
I propose to extend grub-mkimage.c so that it can handle ia64. I propose to select at compile time which convertion to do through macro (see beginning of elf2pe file to see an example). I don't think it is worth making a generic grub-mkimage binary that can do any convertion: it's too much code duplication.
Ok for this approach ?
Tristan.
Quoted 9 lines · Tristan Gingold
On Tue, Jan 29, 2008 at 07:48:29PM +0100, Robert Millan wrote:
[...]Quoted 3 lines
AFAIK, there's no standard specifiing FAT, only a few implementations that act de-facto as a "reference". Because of this, it is up to us to decide what is "standard" and what is just an OS-dependant oddity.
There are spefications from MS, eg:
Microsoft Extensible Firmware Initiative FAT32 File System Specification, rev. 1.03, December 6, 2000,
(http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx)
Ok, I have downloaded the document without accepting their license (which is completely legal where I live), and had a look it (or at least the part of it that can be deciphered from MS-Office internal format).
I can't legally quote it, but it seems the requirement of case insensitivity is present. I really think it is completely broken to describe a filesystem structure saying, not how the data is organized, but how your implementation must present it to the upper layer.
It is simply out of scope. Consider there was a document describing ext2 that said /dev/zero, if present, must output an endless stream of 0xff.
Quoted 1 line
or even ECMA 107.
Also, note that neither of these qualify as "standards". The first is a Microsoft internal document, the second is just a rubber-stamp organization.
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 11 lines · Tristan Gingold
Quoted 7 lines · Marco Gerards
Robert suggested some changes. I also noticed in the discussion that you didn't follow common practise (like an existing grub-mkimage implementation). Personally, as maintainer, I am against maintaining two different approaches of the same problem. It costs us time to maintain this and both case have separate bugs. So I rather see the code shared, one way or the other. To safe time, it might save you some work if you initiate a discussion about this.
The facts:
Quoted 8 lines
util/i386/efi/grub-mkimage.candelf2pe.cdo almost the same thing: converting an ELF file to a PE file. But:* the input format is slightly different (Elf32 vs Elf64)
* the output format is slightly different (PE vs PE+)
* the relocating work is different (x86 vs ia64, Rel vs Rela)
* The entry point is a descriptor on ia64
*grub-mkimage.ccan insert modules in a section.
Sounds like they're very different. Maybe it'd be fine to just change the name and user interface from elf2pe.c to util/ia64/efi/grub-mkimage.c ?
What do you think?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 15 lines · Tristan Gingold
conf/ia64-efi.rmk +15
-0+ +# For grub-emu. +grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ + commands/configfile.c commands/help.c \ + commands/terminal.c commands/ls.c commands/test.c \ + commands/search.c commands/blocklist.c \ + disk/loopback.c \ + \ + fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \ + fs/hfsplus.c fs/iso9660.c fs/jfs.c fs/minix.c \ + fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \ + fs/ufs.c fs/xfs.c \ + \ + io/gzio.c \ + kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \
conf/ia64-efi.rmk line 48
Quoted 10 lines
conf/ia64-efi.rmk +10
-0+ normal/execute.c kern/file.c kern/fs.c normal/lexer.c \ + kern/loader.c kern/main.c kern/misc.c kern/parser.c \ + grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \ + normal/arg.c normal/cmdline.c normal/command.c normal/function.c\ + normal/completion.c normal/main.c \ + normal/menu.c normal/menu_entry.c normal/misc.c normal/script.c \ + partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \ + partmap/acorn.c partmap/gpt.c \ + util/console.c util/grub-emu.c util/misc.c \ + util/i386/pc/misc.c grub_emu_init.c
grub-probe is missing. Did you check if it works? Although, I think it should just move to common.rmk. I'll have a look at that.
util/ia64/efi/grub-install.in line 45
Quoted 5 lines
diff -ruNp -x '*~' -x CVS -x autom4te.cache -x '*.mk' -x configure grub2.orig/util/ia64/efi/grub-install.in grub2/util/ia64/efi/grub-install.in
util/ia64/efi/grub-install.in +1
-0+grub_probefs=${sbindir}/grub-probefs
grub-probefs was renamed to grub-probe.
util/ia64/efi/grub-install.in line 167
Quoted 7 lines
util/ia64/efi/grub-install.in +7
-0+# Create the core image. First, auto-detect the filesystme module. +#fs_module=`$grub_probefs --device-map=${device_map} ${grubdir}` +#if test "x$fs_module" = x -a "x$modules" = x; then +# echo "Auto-detection of a filesystem module failed." 1>&2 +# echo "Please specify the module with the option \`--modules' explicitly." 1>&2 +# exit 1 +#fi
Why is this commented out? Is ${grubdir} a mount point to efi's boot memory device? We do that on i386 (I don't claim that it is a good way, in fact I dislike it and Okuji does as well, but if we want to change it I expect we'll want to change it in both).
Also, missing partmap_module and devabstraction_module. I think you should resync this with the latest version of i386/efi/grub-install.in.
Quoted 1 line
+modules="kernel
kernel isn't implicit?
Quoted 1 line
gpt
Is gpt mandatory? We can use gpt without efi; I wonder if we can also use efi without gpt. If you can access the raw disk, any partition map (even no partition map at all!) could be used, right?
Quoted 1 line
fat
Even if fat is mandated by the standard, I think it's safer to probe for that, since we have the mechanism to do it (grub-probe also performs some sanity checks that would detect if the fat is corrupted or so).
Quoted 1 line
gzio normal ls cat fshelp help
_linuxlinux memmap systab boot
Why this selection specificaly? Other ports without significant size limit just encourage the user to do "grub-mkimage *.mod -o foo" or manually select what is needed.
Or it wasn't possible to load additional modules in runtime yet? I don't remember well..
Quoted 6 lines
util/ia64/efi/grub-install.in +6
-0+# Generate init/fini for modules. +modfile=$tmpdir/mod.c +echo "/* Dummy modules. */" > $modfile +list="" +init_list="" +fini_list=""
util/ia64/efi/grub-install.in line 197
Quoted 10 lines
util/ia64/efi/grub-install.in +10
-0+for m in $modules; do + file="$pkglibdir/${m}.mod" + name=`nm $file | sed -n "/ r grub_module_name/ s/.* r grub_module_name_\(.*\)/\1/p"` + init=`nm $file | sed -n "/ T grub_module_.*_init/ s/.* T //p"` + fini=`nm $file | sed -n "/ T grub_module_.*_fini/ s/.* T //p"` + init_list="$init_list $init" + fini_list="$fini_list $fini" + arg="\"$name\",${init:-0},${fini:-0}" + list="$list $arg" +done
Is there a way we can do this before to avoid runtime dependency on binutils?
Btw has this been tested on i386-efi ?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 3 lines · Robert Millan
grub-probe is missing. Did you check if it works? Although, I think it should just move to common.rmk. I'll have a look at that.
It's in common.rmk now. Please, can you check that update-grub works for ia64-efi ?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoting Robert Millan <[email protected]>:
Quoted 22 lines · Tristan Gingold
Quoted 9 lines · Marco Gerards
Quoted 7 lines
Robert suggested some changes. I also noticed in the discussion that you didn't follow common practise (like an existing grub-mkimage implementation). Personally, as maintainer, I am against maintaining two different approaches of the same problem. It costs us time to maintain this and both case have separate bugs. So I rather see the code shared, one way or the other. To safe time, it might save you some work if you initiate a discussion about this.
Quoted 3 lines
The facts:
util/i386/efi/grub-mkimage.candelf2pe.cdo almost the same thing:converting
Quoted 7 lines
an ELF file to a PE file. But:
* the input format is slightly different (Elf32 vs Elf64)
* the output format is slightly different (PE vs PE+)
* the relocating work is different (x86 vs ia64, Rel vs Rela)
* The entry point is a descriptor on ia64
*grub-mkimage.ccan insert modules in a section.
Quoted 4 lines
Sounds like they're very different. Maybe it'd be fine to just change the name and user interface from
elf2pe.ctoutil/ia64/efi/grub-mkimage.c?What do you think?
Fine for me.
Quoting Robert Millan <[email protected]>:
Quoted 4 lines · Tristan Gingold
grub-probe is missing. Did you check if it works? Although, I think it should just move to common.rmk. I'll have a look at that.
Ok.
Quoted 9 lines
Quoted 1 line
diff -ruNp -x '*~' -x CVS -x autom4te.cache -x '*.mk' -x configure
grub2.orig/util/ia64/efi/grub-install.in grub2/util/ia64/efi/grub-install.in
Quoted 1 line
--- grub2.orig/util/ia64/efi/grub-install.in 1970-01-01 01:00:00.000000000
+0100
Quoted 3 lines
+++ grub2/util/ia64/efi/grub-install.in 2008-01-28 16:29:58.000000000 +0100
[...]
+grub_probefs=${sbindir}/grub-probefsgrub-probefs was renamed to grub-probe.
Ok, I missed that.
Quoted 11 lines
util/ia64/efi/grub-install.in
Quoted 5 lines
util/ia64/efi/grub-install.in +5
-0+# Create the core image. First, auto-detect the filesystme module. +#fs_module=`$grub_probefs --device-map=${device_map} ${grubdir}` +#if test "x$fs_module" = x -a "x$modules" = x; then +# echo "Auto-detection of a filesystem module failed." 1>&2 +# echo "Please specify the module with the option \`--modules'explicitly." 1>&2
Review
Quoted 2 lines
(quoted diff) +2
-0+# exit 1 +#fiWhy is this commented out? Is ${grubdir} a mount point to efi's boot memory device?
Yes.
Quoted 6 lines
We do that on i386 (I don't claim that it is a good way,
in fact I dislike it and Okuji does as well, but if we want to change it I expect we'll want to change it in both).Also, missing
partmap_moduleanddevabstraction_module. I think you should resync this with the latest version of i386/efi/grub-install.in.
Will do.
Quoted 3 lines
Quoted 1 line
+modules="kernel
kernel isn't implicit?
Should be.
Quoted 3 lines
Quoted 1 line
gpt
Is gpt mandatory?
Almost.
Quoted 3 lines
We can use gpt without efi; I wonder if we can also use
efi without gpt. If you can access the raw disk, any partition map (even no partition map at all!) could be used, right?
Not really. EFI has to load grub, and EFI only always knows GPT+FAT.
Quoted 6 lines
Quoted 1 line
fat
Even if fat is mandated by the standard, I think it's safer to probe for that,
since we have the mechanism to do it (grub-probe also performs some sanity checks that would detect if the fat is corrupted or so).
Sure.
Quoted 3 lines
Quoted 1 line
gzio normal ls cat fshelp help
_linuxlinux memmap systab bootWhy this selection specificaly?
That's the one I used and tested :-)
Quoted 3 lines
Other ports without significant size limit
just encourage the user to do "grub-mkimage *.mod -o foo" or manually select what is needed.
Ok.
Quoted 2 lines
Or it wasn't possible to load additional modules in runtime yet? I don't remember well..
Yes, you currently can't dynload modules.
Quoted 18 lines
util/ia64/efi/grub-install.in
Quoted 9 lines
util/ia64/efi/grub-install.in +9
-0+# Generate init/fini for modules. +modfile=$tmpdir/mod.c +echo "/* Dummy modules. */" > $modfile +list="" +init_list="" +fini_list="" +for m in $modules; do + file="$pkglibdir/${m}.mod" + name=`nm $file | sed -n "/ r grub_module_name/ s/.* rgrub_module_name_\(.*\)/\1/p"`
util/ia64/efi/grub-install.in line 197
Quoted 7 lines
util/ia64/efi/grub-install.in +7
-0+ init=`nm $file | sed -n "/ T grub_module_.*_init/ s/.* T //p"` + fini=`nm $file | sed -n "/ T grub_module_.*_fini/ s/.* T //p"` + init_list="$init_list $init" + fini_list="$fini_list $fini" + arg="\"$name\",${init:-0},${fini:-0}" + list="$list $arg" +done
Quoted 1 line
Is there a way we can do this before to avoid runtime dependency on binutils?
This is part of the module trick ;-). If we build a grub with all modules, this is not necessary anymore.
Quoted 1 line
Btw has this been tested on i386-efi ?
No. I only have access to an EFI simulator on i386.
Tristan.
Quoted 9 lines · On Wed, Jan 30, 2008 at 05:22:00PM +0100, [email protected] wrote:
Quoted 1 line
Is gpt mandatory?
Almost.
Quoted 3 lines
We can use gpt without efi; I wonder if we can also use
efi without gpt. If you can access the raw disk, any partition map (even no partition map at all!) could be used, right?Not really. EFI has to load grub, and EFI only always knows GPT+FAT.
I see. Anyway, I still think it'd be a good idea to probe for it. Say, if someone makes an extended version of EFI that supports other partition maps, or so. And since we have the instruments to do it, why not?
Quoted 3 lines
Quoted 1 line
Btw has this been tested on i386-efi ?
No. I only have access to an EFI simulator on i386.
It doesn't cause regression on the simulator then? :-)
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoted 8 lines · Tristan Gingold
Quoted 4 lines · Marco Gerards
If you send in a new patch that addresses Robert's concerns + Changelog entry, I will go over it ASAP :-). Giving the same comments as Robert does seems like a waste of time for everyone. Is this ok for you?
Here is the IA64 port patch. I will send separately the FAT patch (optionnal) and I will mail my proposal to merge the both efi tools.
Is this patch still relevant, or if I reply to this, will I comment on old code?
--
Marco
Quoted 8 lines · Marco Gerards
Quoted 6 lines · Tristan Gingold
Quoted 4 lines · Marco Gerards
If you send in a new patch that addresses Robert's concerns + Changelog entry, I will go over it ASAP :-). Giving the same comments as Robert does seems like a waste of time for everyone. Is this ok for you?
Quoted 5 lines
Quoted 2 lines
Here is the IA64 port patch. I will send separately the FAT patch (optionnal) and I will mail my proposal to merge the both efi tools.
Is this patch still relevant, or if I reply to this, will I comment on old code?
I think it is.
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
Quoting Robert Millan <[email protected]>:
Quoted 9 lines · Marco Gerards
Quoted 8 lines
Quoted 6 lines · Tristan Gingold
Quoted 4 lines · Marco Gerards
If you send in a new patch that addresses Robert's concerns + Changelog entry, I will go over it ASAP :-). Giving the same comments as Robert does seems like a waste of time for everyone. Is this ok for you?
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Here is the IA64 port patch. I will send separately the FAT patch
(optionnal)
Quoted 4 lines
Quoted 1 line
and I will mail my proposal to merge the both efi tools.
Is this patch still relevant, or if I reply to this, will I comment on old code?
I think it is.
Still relevant and independent on the remaining ia64 patches.
Quoted 6 lines · Robert Millan
Quoted 2 lines
On EFI, the prefix is extracted from an EFI path, whose case may not match the FAT entries.
Can you be more specific about this? What do the specs say? We wrote
/boot/grubourselves via grub-install; is an EFI-compliant firmware allowed to actively mess up case in paths we provided?
Actually, kern/efi/init.c:grub_efi_set_prefix does not use the "user defined" grub_prefix at all.
Currently, it gets the device path of the grub.efi binary, and traverses to there. So, it only works when the modules are in the same directory as grub.efi itself.
On the other hand, as the path is extracted using EFI's API (IIRC), it sounds like an EFI bug that it mises up case like this. So the FAT case sensitivity patch is then inevitable ...
Alex
Quoted 2 lines · Tristan Gingold
*
loader/ia64/efi/linux_normal.c: New file.
*loader/ia64/efi/linux.c: New file.
Hello,
Wouldn't it be possible to merge these and the current loader/i386/efi/linux* into one single loader/efi/linux.c and linux_normal.c ?
As far as I've seen, the only IA64 specific part is the FPSWA driver.
Alex
Quoting Alexandre Boeglin <[email protected]>:
Quoted 10 lines · Tristan Gingold
Quoted 2 lines
*
loader/ia64/efi/linux_normal.c: New file.
*loader/ia64/efi/linux.c: New file.Hello,
Wouldn't it be possible to merge these and the current loader/i386/efi/linux* into one single
loader/efi/linux.candlinux_normal.c?As far as I've seen, the only IA64 specific part is the FPSWA driver.
Not only.
The parameters are very different, the jump to the kernel too as well as the memory allocation (we don't want to bother with < 1 MB limit on ia64).
Very few common lines as a consequence.
Quoted 24 lines · On Wed, Jan 30, 2008 at 05:04:18PM +0100, [email protected] wrote:
Quoting Robert Millan <[email protected]>:
Quoted 22 lines · Tristan Gingold
Quoted 9 lines · Marco Gerards
Quoted 7 lines
Robert suggested some changes. I also noticed in the discussion that you didn't follow common practise (like an existing grub-mkimage implementation). Personally, as maintainer, I am against maintaining two different approaches of the same problem. It costs us time to maintain this and both case have separate bugs. So I rather see the code shared, one way or the other. To safe time, it might save you some work if you initiate a discussion about this.
Quoted 3 lines
The facts:
util/i386/efi/grub-mkimage.candelf2pe.cdo almost the same thing:converting
Quoted 7 lines
an ELF file to a PE file. But:
* the input format is slightly different (Elf32 vs Elf64)
* the output format is slightly different (PE vs PE+)
* the relocating work is different (x86 vs ia64, Rel vs Rela)
* The entry point is a descriptor on ia64
*grub-mkimage.ccan insert modules in a section.
Quoted 6 lines
Quoted 4 lines
Sounds like they're very different. Maybe it'd be fine to just change the name and user interface from
elf2pe.ctoutil/ia64/efi/grub-mkimage.c?What do you think?
Fine for me.
Will you send a new patch for this?
Signature · 5 lines
Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
On Wed, Mar 19, 2008 at 06:11:31PM +0100, Robert Millan wrote:
[...]
Quoted 3 lines
Quoted 1 line
Fine for me.
Will you send a new patch for this?
Yes, I still plan to update my patches. But I am currently out of time...
Tristan.
Quoted 8 lines · Tristan Gingold
Quoted 4 lines · Marco Gerards
If you send in a new patch that addresses Robert's concerns + Changelog entry, I will go over it ASAP :-). Giving the same comments as Robert does seems like a waste of time for everyone. Is this ok for you?
Here is the IA64 port patch. I will send separately the FAT patch (optionnal) and I will mail my proposal to merge the both efi tools.
Hi!
I put your patch in /branches/ia64/ in our Bazaar repository and resynced it with latest trunk, then fixed a ton of trivial build problems.
Unfortunately I can't test it. If you can test it and confirm it works, we could consider it for merging into experimental branch. Although we'd need to figure out what we do about missing loadable module support.
(btw FAT fixes were merged separately)
Signature · 3 lines
Robert Millan "Be the change you want to see in the world" -- Gandhi