From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: IA64 port
Date: Mon, 28 Jan 2008 17:55:04 +0100 [thread overview]
Message-ID: <20080128165504.GB9715@thorin> (raw)
In-Reply-To: <20080128160905.GA2739@saphi>
Hi Tristan!
On Mon, Jan 28, 2008 at 05:09:05PM +0100, Tristan Gingold wrote:
> 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).
Have you checked if this trick works on other ports? Maybe it'd be a good idea
to merge this first.
> +STRIP_FLAGS=--strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment
Why this? I recall strip was already run with those parameters.
> 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)
Oops, the two last ports I added are missing here. I wonder if there's any way
to automate this part. conf/*.rmk ?
> +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)
> +{
> + 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
> +# 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.
> +# 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 ?
> diff -ruNp -x '*~' -x CVS grub2.orig/fs/fat.c grub2/fs/fat.c
> --- grub2.orig/fs/fat.c 2007-08-02 20:40:36.000000000 +0200
> +++ grub2/fs/fat.c 2008-01-28 16:29:57.000000000 +0100
> @@ -568,7 +568,7 @@ grub_fat_find_dir (grub_disk_t disk, str
> continue;
> }
>
> - 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, str
> if (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 ;-)
> + * GRUB -- GRand Unified Bootloader
> + * Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.
Please remember to update copyright years (in new or modified files).
> +__ia64_trampoline:
> + // Read address of the real descriptor
I think the consensus is to use /**/ comments in GRUB.
> diff -ruNp -x '*~' -x CVS grub2.orig/kern/rescue.c grub2/kern/rescue.c
> --- grub2.orig/kern/rescue.c 2007-09-03 22:28:23.000000000 +0200
> +++ grub2/kern/rescue.c 2008-01-28 16:29:58.000000000 +0100
> @@ -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 ;-)
> +struct ia64_boot_param {
Please add a newline before opening brackets.
> +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);
> +
> + 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.
> diff -ruNp -x '*~' -x CVS grub2.orig/util/ia64/efi/elf2pe.c grub2/util/ia64/efi/elf2pe.c
> --- grub2.orig/util/ia64/efi/elf2pe.c 1970-01-01 01:00:00.000000000 +0100
> +++ grub2/util/ia64/efi/elf2pe.c 2008-01-28 16:29:58.000000000 +0100
> @@ -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
> +#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?
> --- grub2.orig/util/ia64/efi/pe32.h 1970-01-01 01:00:00.000000000 +0100
> +++ grub2/util/ia64/efi/pe32.h 2008-01-28 16:29:58.000000000 +0100
(same here, I assume)
> diff -ruNp -x '*~' -x CVS grub2.orig/util/ia64/efi/grub-install.in grub2/util/ia64/efi/grub-install.in
> --- grub2.orig/util/ia64/efi/grub-install.in 1970-01-01 01:00:00.000000000 +0100
> +++ grub2/util/ia64/efi/grub-install.in 2008-01-28 16:29:58.000000000 +0100
Any ia64-isms here, or just improvements (the module hack you described?)
that could be shared with i386/efi/grub-install.in ?
--
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 /.)
next prev parent reply other threads:[~2008-01-28 16:56 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-28 16:09 IA64 port Tristan Gingold
2008-01-28 16:55 ` Robert Millan [this message]
2008-01-29 5:12 ` Tristan Gingold
2008-01-29 9:17 ` Robert Millan
2008-01-29 10:31 ` tgingold
2008-01-29 11:08 ` Robert Millan
2008-01-29 9:59 ` Robert Millan
2008-01-29 10:35 ` tgingold
2008-01-29 11:32 ` Robert Millan
2008-01-29 12:56 ` tgingold
2008-01-29 13:19 ` Robert Millan
2008-01-29 14:46 ` Marco Gerards
2008-01-29 15:30 ` Robert Millan
2008-01-29 16:38 ` tgingold
2008-01-29 18:48 ` Robert Millan
2008-01-30 5:23 ` Tristan Gingold
2008-01-30 13:19 ` Robert Millan
2008-01-29 16:35 ` tgingold
2008-01-30 5:48 ` Tristan Gingold
2008-01-30 15:07 ` Robert Millan
2008-01-30 15:33 ` Robert Millan
2008-01-30 16:22 ` tgingold
2008-01-30 18:38 ` Robert Millan
2008-02-04 15:45 ` Marco Gerards
2008-02-04 16:07 ` Robert Millan
2008-02-05 9:51 ` tgingold
2008-02-10 22:43 ` Alexandre Boeglin
2008-02-11 8:59 ` tgingold
2010-01-18 18:03 ` Robert Millan
2008-01-30 5:48 ` Tristan Gingold
2008-01-30 5:57 ` Tristan Gingold
2008-01-30 13:25 ` Robert Millan
2008-01-30 16:04 ` tgingold
2008-03-19 17:11 ` Robert Millan
2008-03-20 6:34 ` Tristan Gingold
2008-02-05 22:49 ` Alexandre Boeglin
2008-01-29 5:49 ` Tristan Gingold
2008-01-29 9:08 ` Robert Millan
2008-01-29 10:10 ` tgingold
2008-01-29 11:07 ` Robert Millan
2008-01-29 12:53 ` tgingold
2008-01-29 13:39 ` Robert Millan
2008-01-29 13:36 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080128165504.GB9715@thorin \
--to=rmh@aybabtu.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.