: grub: Add sparc64 support code.
PATCH 1/1 : grub: Add sparc64 support code.
Ok, this gets sparc64 building again and adds the necessary seperation of the mkdevicemap implementation so we can use escaped openfirmware path names instead of "(hdX)" and "(fdX)" as is customary on i386.
Code is added to convert OS path names into openfirmware device paths. With some very simple changes, this code can be adapted to powerpc. This is not done yet, but when it is then grub will no longer depend upon the 'ofpathname' program on powerpc.
We're pretty close to working on sparc64 with this patch. What remains is:
1) Fleshing out and implementing the OF path name escaping for device map entries.
2) Fixing how FS UUID code can open the same device multiple times at once, which doesn't work on OpenBoot.
I have patches for #2 and will begin working on #1 now.
2009-04-19 David S. Miller <[email protected]>
* util/sparc64/ieee1275/misc.c: New file.
* util/sparc64/ieee1275/grub-setup.c: New file.
* util/sparc64/ieee1275/grub-ofpathname.c: New file.
* util/sparc64/ieee1275/grub-mkimage.c: New file.
* util/sparc64/ieee1275/grub-install.in: New file.
* util/ieee1275/ofpath.c: New file.
* util/ieee1275/devicemap.c: New file.
* util/devicemap.c: New file.
* util/deviceiter.c: New file.
* kern/sparc64/ieee1275/init.c: New file.
* include/grub/util/ofpath.h: New file.
* include/grub/util/deviceiter.h: New file.
* util/grub-mkdevicemap.c: Include deviceiter.h. Implement using grub_util_emit_devicemap_entry and grub_util_iterate_devices.
* conf/i386-corebook.rmk: Build util/deviceiter.c and util/devicemap.c into grub-mkdevicemap
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Add rules to build boot block images and installation utilities. Build kernel as image instead of as elf binary. Use common rules as much as possible.
--- conf/i386-coreboot.rmk | 3 +- conf/i386-efi.rmk | 3 +- conf/i386-ieee1275.rmk | 3 +- conf/i386-pc.rmk | 3 +- conf/powerpc-ieee1275.rmk | 3 +- conf/sparc64-ieee1275.rmk | 368 +++++++------------ include/grub/util/deviceiter.h | 11 + include/grub/util/ofpath.h | 6 + kern/sparc64/ieee1275/init.c | 161 ++++++++ util/deviceiter.c | 621 ++++++++++++++++++++++++++++++ util/devicemap.c | 13 + util/grub-mkdevicemap.c | 589 +---------------------------- util/ieee1275/devicemap.c | 13 + util/ieee1275/ofpath.c | 415 ++++++++++++++++++++ util/sparc64/ieee1275/grub-install.in | 276 ++++++++++++++ util/sparc64/ieee1275/grub-mkimage.c | 294 +++++++++++++++ util/sparc64/ieee1275/grub-ofpathname.c | 39 ++ util/sparc64/ieee1275/grub-setup.c | 625 +++++++++++++++++++++++++++++++ util/sparc64/ieee1275/misc.c | 33 ++ 19 files changed, 2663 insertions(+), 816 deletions(-) create mode 100644 include/grub/util/deviceiter.h create mode 100644 include/grub/util/ofpath.h create mode 100644 kern/sparc64/ieee1275/init.c create mode 100644 util/deviceiter.c create mode 100644 util/devicemap.c create mode 100644 util/ieee1275/devicemap.c create mode 100644 util/ieee1275/ofpath.c create mode 100644 util/sparc64/ieee1275/grub-install.in create mode 100644 util/sparc64/ieee1275/grub-mkimage.c create mode 100644 util/sparc64/ieee1275/grub-ofpathname.c create mode 100644 util/sparc64/ieee1275/grub-setup.c create mode 100644 util/sparc64/ieee1275/misc.c
conf/i386-coreboot.rmk +2 -1
@@ -51,7 +51,8 @@ sbin_UTILITIES += grub-emu endif # For grub-mkdevicemap. -grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c +grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ + util/devicemap.c util/misc.c # For grub-emu. util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
conf/i386-efi.rmk +2 -1
@@ -28,7 +28,8 @@ util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile # kern/fs.c kern/env.c fs/fshelp.c # For grub-mkdevicemap. -grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c +grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ + util/devicemap.c util/misc.c # For grub-emu. util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
conf/i386-ieee1275.rmk +2 -1
@@ -50,7 +50,8 @@ sbin_UTILITIES += grub-emu endif # For grub-mkdevicemap. -grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c +grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ + util/devicemap.c util/misc.c # For grub-emu. util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
conf/i386-pc.rmk +2 -1
@@ -114,7 +114,8 @@ grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \ grub_setup_init.c # For grub-mkdevicemap. -grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c +grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ + util/devicemap.c util/misc.c # For grub-emu. util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
conf/powerpc-ieee1275.rmk +2 -1
@@ -35,7 +35,8 @@ sbin_UTILITIES += grub-emu endif # For grub-mkdevicemap. -grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c +grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \ + util/devicemap.c util/misc.c # For grub-emu util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
conf/sparc64-ieee1275.rmk +135 -233
420 lines not on this page · raw message
include/grub/util/deviceiter.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef GRUB_DEVICEITER_MACHINE_UTIL_HEADER +#define GRUB_DEVICEITER_MACHINE_UTIL_HEADER 1 + +#include <config.h> + +void grub_util_iterate_devices (int NESTED_FUNC_ATTR (*hook) (const char *, int), +int floppy_disks); +void grub_util_emit_devicemap_entry (FILE *fp,char *name,int is_floppy, +int *num_fd,int *num_hd); + +#endif /* ! GRUB_DEVICEITER_MACHINE_UTIL_HEADER */
include/grub/util/ofpath.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef GRUB_OFPATH_MACHINE_UTIL_HEADER +#define GRUB_OFPATH_MACHINE_UTIL_HEADER 1 + +char *grub_util_devname_to_ofpath (char *devname); + +#endif /* ! GRUB_OFPATH_MACHINE_UTIL_HEADER */
kern/sparc64/ieee1275/init.c new file +161 -0
161 lines not on this page · raw message
util/deviceiter.c new file +621 -0
621 lines not on this page · raw message
util/devicemap.c new file +13 -0
@@ -0,0 +1,13 @@ +#include <stdio.h> + +#include <grub/util/deviceiter.h> + +void +grub_util_emit_devicemap_entry (FILE *fp,char *name,int is_floppy, +int *num_fd,int *num_hd) +{ +if (is_floppy) +fprintf (fp,"(fd%d)\t%s\n" , (*num_fd)++, name); +else +fprintf (fp,"(hd%d)\t%s\n" , (*num_hd)++, name); +}
util/grub-mkdevicemap.c +11 -578
611 lines not on this page · raw message
util/ieee1275/devicemap.c new file +13 -0
@@ -0,0 +1,13 @@ +#include <stdio.h> +#include <grub/types.h> +#include <grub/util/deviceiter.h> +#include <grub/util/ofpath.h> + +void +grub_util_emit_devicemap_entry (FILE *fp, char *name, int is_floppy UNUSED, + int *num_fd UNUSED, int *num_hd UNUSED) +{ +const char *ofpath =grub_util_devname_to_ofpath (name); + +fprintf (fp,"(%s)\t%s\n" , ofpath, name); +}
util/ieee1275/ofpath.c new file +415 -0
415 lines not on this page · raw message
util/sparc64/ieee1275/grub-install.in new file +276 -0
276 lines not on this page · raw message
util/sparc64/ieee1275/grub-mkimage.c new file +294 -0
294 lines not on this page · raw message
util/sparc64/ieee1275/grub-ofpathname.c new file +39 -0
@@ -0,0 +1,39 @@ +/* grub-ofpathname.c - Find OpenBOOT path for a given device */ +/* +* GRUB -- GRand Unified Bootloader +* Copyright (C) 2009 Free Software Foundation, Inc. +* +* GRUB is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* GRUB is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with GRUB. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <grub/util/misc.h> +#include <grub/util/ofpath.h> + +int main (int argc,char **argv) +{ +char *of_path; + +if (argc !=2 ) + { +printf ("Usage: grub-ofpathname DEVICE\n" ); +return 1 ; + } + + of_path =grub_util_devname_to_ofpath (argv[1 ]); +printf ("%s\n" , of_path); + +free (of_path); + +return 0 ; +}
util/sparc64/ieee1275/grub-setup.c new file +625 -0
75 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.6.2.3
Part of the diff is not shown here. View the raw message.
From: David Miller <[email protected]>
Date: Sun, 19 Apr 2009 17:42:18 -0700 (PDT)
Ho hum, the grub-devel "posting size monster" is likely going to eat this one.
If you want to review this patch, I've put a copy up at:
http://vger.kernel.org/~davem/0004-grub-Add-sparc64-support-code.patch
Quoted 46 lines
Ok, this gets sparc64 building again and adds the necessary seperation of the mkdevicemap implementation so we can use escaped openfirmware path names instead of "(hdX)" and "(fdX)" as is customary on i386. a
Code is added to convert OS path names into openfirmware device paths. With some very simple changes, this code can be adapted to powerpc. This is not done yet, but when it is then grub will no longer depend upon the 'ofpathname' program on powerpc.We're pretty close to working on sparc64 with this patch. What remains is:
1) Fleshing out and implementing the OF path name escaping for device map entries.
2) Fixing how FS UUID code can open the same device multiple times at once, which doesn't work on OpenBoot.
I have patches for #2 and will begin working on #1 now.
2009-04-19 David S. Miller <[email protected]>
*
util/sparc64/ieee1275/misc.c: New file.
*util/sparc64/ieee1275/grub-setup.c: New file.
*util/sparc64/ieee1275/grub-ofpathname.c: New file.
*util/sparc64/ieee1275/grub-mkimage.c: New file.
* util/sparc64/ieee1275/grub-install.in: New file.
*util/ieee1275/ofpath.c: New file.
*util/ieee1275/devicemap.c: New file.
*util/devicemap.c: New file.
*util/deviceiter.c: New file.
*kern/sparc64/ieee1275/init.c: New file.
*include/grub/util/ofpath.h: New file.
*include/grub/util/deviceiter.h: New file.
*util/grub-mkdevicemap.c: Includedeviceiter.h. Implement usinggrub_util_emit_devicemap_entryandgrub_util_iterate_devices.
* conf/i386-corebook.rmk: Buildutil/deviceiter.candutil/devicemap.cinto grub-mkdevicemap
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Add rules to build boot block images and installation utilities. Build kernel as image instead of as elf binary. Use common rules as much as possible.
From: David Miller <[email protected]>
Date: Sun, 19 Apr 2009 17:45:21 -0700 (PDT)
Quoted 2 lines
Ho hum, the grub-devel "posting size monster" is likely going to eat this one.
It actually allowed the posting, I was just impatient :-)
From: David Miller <[email protected]>
Date: Sun, 19 Apr 2009 17:42:18 -0700 (PDT)
Quoted 18 lines
2009-04-19 David S. Miller <[email protected]>
*
util/sparc64/ieee1275/misc.c: New file.
*util/sparc64/ieee1275/grub-setup.c: New file.
*util/sparc64/ieee1275/grub-ofpathname.c: New file.
*util/sparc64/ieee1275/grub-mkimage.c: New file.
* util/sparc64/ieee1275/grub-install.in: New file.
*util/ieee1275/ofpath.c: New file.
*util/ieee1275/devicemap.c: New file.
*util/devicemap.c: New file.
*util/deviceiter.c: New file.
*kern/sparc64/ieee1275/init.c: New file.
*include/grub/util/ofpath.h: New file.
*include/grub/util/deviceiter.h: New file.
*util/grub-mkdevicemap.c: Includedeviceiter.h. Implement usinggrub_util_emit_devicemap_entryandgrub_util_iterate_devices.
* conf/i386-corebook.rmk: Buildutil/deviceiter.cand
Quoted 8 lines
util/devicemap.cinto grub-mkdevicemap
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Add rules to build boot block images and installation utilities. Build kernel as image instead of as elf binary. Use common rules as much as possible.
Committed.