2005-08-21 Vincent Pelletier <subdino2004@yahoo.fr>
* configure.ac: Add support for sparc64 host with ieee1275 firmware. * configure: Generated from configure.ac. * disk/ieee1275/ofdisk.c (grub_ofdisk_open): Use grub_ssize_t instead of int. (grub_ofdisk_read): Likewise. (grub_ofdisk_open): Use %p to print pointer values, and cast the pointers as (void *) to remove a warning. (grub_ofdisk_close): Likewise. (grub_ofdisk_read): Likewise. * kern/ieee1275/ieee1275.c (grub_ieee1275_exit): This never returns, so make it return void to remove a warning. * include/grub/ieee1275/ieee1275.h (grub_ieee1275_exit): Corresponding prototype change. * kern/mm.c (grub_mm_init_region): Use %p to print pointer values, and cast the pointers as (void *) to remove a warning. (grub_mm_dump): Likewise. * conf/sparc64-ieee1275.mk: New file. * conf/sparc64-ieee1275.rmk: Likewise. * include/grub/sparc64/setjmp.h: Likewise. * include/grub/sparc64/types.h: Likewise. * include/grub/sparc64/ieee1275/console.h: Likewise. * include/grub/sparc64/ieee1275/ieee1275.h: Likewise. * include/grub/sparc64/ieee1275/kernel.h: Likewise. * include/grub/sparc64/ieee1275/time.h: Likewise. * kern/sparc64/cache.c: Likewise. * kern/sparc64/dl.c: Likewise. * kern/sparc64/ieee1275/init.c: Likewise. * kern/sparc64/ieee1275/openfw.c: Likewise.
This commit is contained in:
parent
385c6a92a3
commit
e9211b5d32
19 changed files with 1615 additions and 13 deletions
32
ChangeLog
32
ChangeLog
|
@ -1,3 +1,35 @@
|
|||
2005-08-21 Vincent Pelletier <subdino2004@yahoo.fr>
|
||||
|
||||
* configure.ac: Add support for sparc64 host with ieee1275
|
||||
firmware.
|
||||
* configure: Generated from configure.ac.
|
||||
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Use grub_ssize_t
|
||||
instead of int.
|
||||
(grub_ofdisk_read): Likewise.
|
||||
(grub_ofdisk_open): Use %p to print pointer values, and cast the
|
||||
pointers as (void *) to remove a warning.
|
||||
(grub_ofdisk_close): Likewise.
|
||||
(grub_ofdisk_read): Likewise.
|
||||
* kern/ieee1275/ieee1275.c (grub_ieee1275_exit): This never
|
||||
returns, so make it return void to remove a warning.
|
||||
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_exit):
|
||||
Corresponding prototype change.
|
||||
* kern/mm.c (grub_mm_init_region): Use %p to print pointer
|
||||
values, and cast the pointers as (void *) to remove a warning.
|
||||
(grub_mm_dump): Likewise.
|
||||
* conf/sparc64-ieee1275.mk: New file.
|
||||
* conf/sparc64-ieee1275.rmk: Likewise.
|
||||
* include/grub/sparc64/setjmp.h: Likewise.
|
||||
* include/grub/sparc64/types.h: Likewise.
|
||||
* include/grub/sparc64/ieee1275/console.h: Likewise.
|
||||
* include/grub/sparc64/ieee1275/ieee1275.h: Likewise.
|
||||
* include/grub/sparc64/ieee1275/kernel.h: Likewise.
|
||||
* include/grub/sparc64/ieee1275/time.h: Likewise.
|
||||
* kern/sparc64/cache.c: Likewise.
|
||||
* kern/sparc64/dl.c: Likewise.
|
||||
* kern/sparc64/ieee1275/init.c: Likewise.
|
||||
* kern/sparc64/ieee1275/openfw.c: Likewise.
|
||||
|
||||
2005-08-21 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
|
||||
* util/console.c (grub_ncurses_putchar): If C is greater than
|
||||
|
|
411
conf/sparc64-ieee1275.mk
Normal file
411
conf/sparc64-ieee1275.mk
Normal file
|
@ -0,0 +1,411 @@
|
|||
|
||||
# -*- makefile -*-
|
||||
|
||||
COMMON_ASFLAGS = -nostdinc
|
||||
COMMON_CFLAGS = -ggdb -ffreestanding -m64 -mcpu=v9 -mtune=ultrasparc
|
||||
|
||||
# Images.
|
||||
|
||||
MOSTLYCLEANFILES += grubof_symlist.c kernel_syms.lst
|
||||
DEFSYMFILES += kernel_syms.lst
|
||||
|
||||
grubof_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \
|
||||
file.h fs.h kernel.h misc.h mm.h net.h rescue.h symbol.h \
|
||||
term.h types.h loader.h \
|
||||
partition.h pc_partition.h ieee1275/ieee1275.h machine/time.h
|
||||
|
||||
grubof_symlist.c: $(addprefix include/grub/,$(grubof_HEADERS)) gensymlist.sh
|
||||
sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
|
||||
|
||||
kernel_syms.lst: $(addprefix include/grub/,$(grubof_HEADERS)) genkernsyms.sh
|
||||
sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
|
||||
|
||||
# Programs
|
||||
pkgdata_PROGRAMS = grubof
|
||||
|
||||
# Utilities.
|
||||
#bin_UTILITIES = grub-emu grub-mkimage
|
||||
noinst_UTILITIES = genmoddep
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
|
||||
util/resolve.c
|
||||
|
||||
# For grub-emu
|
||||
#grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
||||
# commands/configfile.c commands/default.c commands/help.c \
|
||||
# commands/search.c commands/terminal.c commands/ls.c \
|
||||
# commands/timeout.c \
|
||||
# commands/ieee1275/halt.c commands/ieee1275/reboot.c \
|
||||
# disk/loopback.c \
|
||||
# fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \
|
||||
# fs/minix.c fs/ufs.c \
|
||||
# kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \
|
||||
# kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \
|
||||
# kern/partition.c kern/rescue.c kern/term.c \
|
||||
# normal/arg.c normal/cmdline.c normal/command.c \
|
||||
# normal/completion.c normal/context.c \
|
||||
# normal/main.c normal/menu.c normal/menu_entry.c normal/misc.c \
|
||||
# partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
||||
# util/console.c util/grub-emu.c util/misc.c \
|
||||
# util/i386/pc/biosdisk.c util/i386/pc/getroot.c \
|
||||
# util/sparc64/ieee1275/misc.c
|
||||
|
||||
#grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
||||
grubof_SOURCES = kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
kern/sparc64/ieee1275/init.c term/ieee1275/ofconsole.c \
|
||||
kern/sparc64/ieee1275/openfw.c disk/ieee1275/ofdisk.c \
|
||||
kern/partition.c kern/env.c kern/sparc64/dl.c grubof_symlist.c \
|
||||
kern/sparc64/cache.c
|
||||
CLEANFILES += grubof grubof-kern_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_sparc64_ieee1275_init.o grubof-term_ieee1275_ofconsole.o grubof-kern_sparc64_ieee1275_openfw.o grubof-disk_ieee1275_ofdisk.o grubof-kern_partition.o grubof-kern_env.o grubof-kern_sparc64_dl.o grubof-grubof_symlist.o grubof-kern_sparc64_cache.o
|
||||
MOSTLYCLEANFILES += grubof-kern_ieee1275_ieee1275.d grubof-kern_main.d grubof-kern_device.d grubof-kern_disk.d grubof-kern_dl.d grubof-kern_file.d grubof-kern_fs.d grubof-kern_err.d grubof-kern_misc.d grubof-kern_mm.d grubof-kern_loader.d grubof-kern_rescue.d grubof-kern_term.d grubof-kern_sparc64_ieee1275_init.d grubof-term_ieee1275_ofconsole.d grubof-kern_sparc64_ieee1275_openfw.d grubof-disk_ieee1275_ofdisk.d grubof-kern_partition.d grubof-kern_env.d grubof-kern_sparc64_dl.d grubof-grubof_symlist.d grubof-kern_sparc64_cache.d
|
||||
|
||||
grubof: grubof-kern_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_sparc64_ieee1275_init.o grubof-term_ieee1275_ofconsole.o grubof-kern_sparc64_ieee1275_openfw.o grubof-disk_ieee1275_ofdisk.o grubof-kern_partition.o grubof-kern_env.o grubof-kern_sparc64_dl.o grubof-grubof_symlist.o grubof-kern_sparc64_cache.o
|
||||
$(CC) -o $@ $^ $(LDFLAGS) $(grubof_LDFLAGS)
|
||||
|
||||
grubof-kern_ieee1275_ieee1275.o: kern/ieee1275/ieee1275.c
|
||||
$(CC) -Ikern/ieee1275 -I$(srcdir)/kern/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_ieee1275_ieee1275.d: kern/ieee1275/ieee1275.c
|
||||
set -e; $(CC) -Ikern/ieee1275 -I$(srcdir)/kern/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,ieee1275\.o[ :]*,grubof-kern_ieee1275_ieee1275.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_ieee1275_ieee1275.d
|
||||
|
||||
grubof-kern_main.o: kern/main.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_main.d: kern/main.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,main\.o[ :]*,grubof-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_main.d
|
||||
|
||||
grubof-kern_device.o: kern/device.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_device.d: kern/device.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,device\.o[ :]*,grubof-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_device.d
|
||||
|
||||
grubof-kern_disk.o: kern/disk.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_disk.d: kern/disk.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,disk\.o[ :]*,grubof-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_disk.d
|
||||
|
||||
grubof-kern_dl.o: kern/dl.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_dl.d: kern/dl.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,dl\.o[ :]*,grubof-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_dl.d
|
||||
|
||||
grubof-kern_file.o: kern/file.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_file.d: kern/file.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,file\.o[ :]*,grubof-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_file.d
|
||||
|
||||
grubof-kern_fs.o: kern/fs.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_fs.d: kern/fs.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,fs\.o[ :]*,grubof-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_fs.d
|
||||
|
||||
grubof-kern_err.o: kern/err.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_err.d: kern/err.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,err\.o[ :]*,grubof-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_err.d
|
||||
|
||||
grubof-kern_misc.o: kern/misc.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_misc.d: kern/misc.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grubof-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_misc.d
|
||||
|
||||
grubof-kern_mm.o: kern/mm.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_mm.d: kern/mm.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,mm\.o[ :]*,grubof-kern_mm.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_mm.d
|
||||
|
||||
grubof-kern_loader.o: kern/loader.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_loader.d: kern/loader.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,loader\.o[ :]*,grubof-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_loader.d
|
||||
|
||||
grubof-kern_rescue.o: kern/rescue.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_rescue.d: kern/rescue.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,grubof-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_rescue.d
|
||||
|
||||
grubof-kern_term.o: kern/term.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_term.d: kern/term.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,term\.o[ :]*,grubof-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_term.d
|
||||
|
||||
grubof-kern_sparc64_ieee1275_init.o: kern/sparc64/ieee1275/init.c
|
||||
$(CC) -Ikern/sparc64/ieee1275 -I$(srcdir)/kern/sparc64/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_sparc64_ieee1275_init.d: kern/sparc64/ieee1275/init.c
|
||||
set -e; $(CC) -Ikern/sparc64/ieee1275 -I$(srcdir)/kern/sparc64/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,init\.o[ :]*,grubof-kern_sparc64_ieee1275_init.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_sparc64_ieee1275_init.d
|
||||
|
||||
grubof-term_ieee1275_ofconsole.o: term/ieee1275/ofconsole.c
|
||||
$(CC) -Iterm/ieee1275 -I$(srcdir)/term/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-term_ieee1275_ofconsole.d: term/ieee1275/ofconsole.c
|
||||
set -e; $(CC) -Iterm/ieee1275 -I$(srcdir)/term/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,ofconsole\.o[ :]*,grubof-term_ieee1275_ofconsole.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-term_ieee1275_ofconsole.d
|
||||
|
||||
grubof-kern_sparc64_ieee1275_openfw.o: kern/sparc64/ieee1275/openfw.c
|
||||
$(CC) -Ikern/sparc64/ieee1275 -I$(srcdir)/kern/sparc64/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_sparc64_ieee1275_openfw.d: kern/sparc64/ieee1275/openfw.c
|
||||
set -e; $(CC) -Ikern/sparc64/ieee1275 -I$(srcdir)/kern/sparc64/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,openfw\.o[ :]*,grubof-kern_sparc64_ieee1275_openfw.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_sparc64_ieee1275_openfw.d
|
||||
|
||||
grubof-disk_ieee1275_ofdisk.o: disk/ieee1275/ofdisk.c
|
||||
$(CC) -Idisk/ieee1275 -I$(srcdir)/disk/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-disk_ieee1275_ofdisk.d: disk/ieee1275/ofdisk.c
|
||||
set -e; $(CC) -Idisk/ieee1275 -I$(srcdir)/disk/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,ofdisk\.o[ :]*,grubof-disk_ieee1275_ofdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-disk_ieee1275_ofdisk.d
|
||||
|
||||
grubof-kern_partition.o: kern/partition.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_partition.d: kern/partition.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grubof-kern_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_partition.d
|
||||
|
||||
grubof-kern_env.o: kern/env.c
|
||||
$(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_env.d: kern/env.c
|
||||
set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,env\.o[ :]*,grubof-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_env.d
|
||||
|
||||
grubof-kern_sparc64_dl.o: kern/sparc64/dl.c
|
||||
$(CC) -Ikern/sparc64 -I$(srcdir)/kern/sparc64 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_sparc64_dl.d: kern/sparc64/dl.c
|
||||
set -e; $(CC) -Ikern/sparc64 -I$(srcdir)/kern/sparc64 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,dl\.o[ :]*,grubof-kern_sparc64_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_sparc64_dl.d
|
||||
|
||||
grubof-grubof_symlist.o: grubof_symlist.c
|
||||
$(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-grubof_symlist.d: grubof_symlist.c
|
||||
set -e; $(CC) -I. -I$(srcdir)/. $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,grubof_symlist\.o[ :]*,grubof-grubof_symlist.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-grubof_symlist.d
|
||||
|
||||
grubof-kern_sparc64_cache.o: kern/sparc64/cache.c
|
||||
$(CC) -Ikern/sparc64 -I$(srcdir)/kern/sparc64 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $<
|
||||
|
||||
grubof-kern_sparc64_cache.d: kern/sparc64/cache.c
|
||||
set -e; $(CC) -Ikern/sparc64 -I$(srcdir)/kern/sparc64 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,cache\.o[ :]*,grubof-kern_sparc64_cache.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include grubof-kern_sparc64_cache.d
|
||||
|
||||
grubof_HEADERS = grub/sparc64/ieee1275/ieee1275.h
|
||||
grubof_CFLAGS = $(COMMON_CFLAGS)
|
||||
grubof_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
grubof_LDFLAGS = -m64 -nostdlib -Wl,-N,-Ttext,0x200000,-Bstatic -Xlinker --oformat -Xlinker elf64-sparc
|
||||
|
||||
# For genmoddep.
|
||||
genmoddep_SOURCES = util/genmoddep.c
|
||||
CLEANFILES += genmoddep genmoddep-util_genmoddep.o
|
||||
MOSTLYCLEANFILES += genmoddep-util_genmoddep.d
|
||||
|
||||
genmoddep: genmoddep-util_genmoddep.o
|
||||
$(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(genmoddep_LDFLAGS)
|
||||
|
||||
genmoddep-util_genmoddep.o: util/genmoddep.c
|
||||
$(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -c -o $@ $<
|
||||
|
||||
genmoddep-util_genmoddep.d: util/genmoddep.c
|
||||
set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -M $< | sed 's,genmoddep\.o[ :]*,genmoddep-util_genmoddep.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@
|
||||
|
||||
-include genmoddep-util_genmoddep.d
|
||||
|
||||
|
||||
# Modules.
|
||||
#pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
|
||||
# hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
|
||||
# boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
|
||||
# pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
|
||||
# default.mod timeout.mod configfile.mod search.mod
|
||||
|
||||
# For fshelp.mod.
|
||||
fshelp_mod_SOURCES = fs/fshelp.c
|
||||
fshelp_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For fat.mod.
|
||||
fat_mod_SOURCES = fs/fat.c
|
||||
fat_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For ext2.mod.
|
||||
ext2_mod_SOURCES = fs/ext2.c
|
||||
ext2_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For ufs.mod.
|
||||
ufs_mod_SOURCES = fs/ufs.c
|
||||
ufs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For minix.mod.
|
||||
minix_mod_SOURCES = fs/minix.c
|
||||
minix_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For hfs.mod.
|
||||
hfs_mod_SOURCES = fs/hfs.c
|
||||
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For jfs.mod.
|
||||
jfs_mod_SOURCES = fs/jfs.c
|
||||
jfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For iso9660.mod.
|
||||
iso9660_mod_SOURCES = fs/iso9660.c
|
||||
iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For _linux.mod.
|
||||
_linux_mod_SOURCES = loader/sparc64/ieee1275/linux.c
|
||||
_linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For linux.mod.
|
||||
linux_mod_SOURCES = loader/sparc64/ieee1275/linux_normal.c
|
||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For normal.mod.
|
||||
normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
|
||||
normal/context.c normal/main.c normal/menu.c \
|
||||
normal/menu_entry.c \
|
||||
normal/sparc64/setjmp.c
|
||||
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For hello.mod.
|
||||
hello_mod_SOURCES = hello/hello.c
|
||||
hello_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For boot.mod.
|
||||
boot_mod_SOURCES = commands/boot.c
|
||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For terminal.mod.
|
||||
terminal_mod_SOURCES = commands/terminal.c
|
||||
terminal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For ls.mod.
|
||||
ls_mod_SOURCES = commands/ls.c
|
||||
ls_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For cmp.mod.
|
||||
cmp_mod_SOURCES = commands/cmp.c
|
||||
cmp_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For cat.mod.
|
||||
cat_mod_SOURCES = commands/cat.c
|
||||
cat_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For font.mod.
|
||||
font_mod_SOURCES = font/manager.c
|
||||
font_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For amiga.mod
|
||||
amiga_mod_SOURCES = partmap/amiga.c
|
||||
amiga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For apple.mod
|
||||
apple_mod_SOURCES = partmap/apple.c
|
||||
apple_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For pc.mod
|
||||
pc_mod_SOURCES = partmap/pc.c
|
||||
pc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For sun.mod
|
||||
sun_mod_SOURCES = partmap/sun.c
|
||||
sun_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For loopback.mod
|
||||
loopback_mod_SOURCES = disk/loopback.c
|
||||
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For suspend.mod
|
||||
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For reboot.mod
|
||||
reboot_mod_SOURCES = commands/ieee1275/reboot.c
|
||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For halt.mod
|
||||
halt_mod_SOURCES = commands/ieee1275/halt.c
|
||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For help.mod.
|
||||
help_mod_SOURCES = commands/help.c
|
||||
help_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For default.mod
|
||||
default_mod_SOURCES = commands/default.c
|
||||
default_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For timeout.mod
|
||||
timeout_mod_SOURCES = commands/timeout.c
|
||||
timeout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For configfile.mod
|
||||
configfile_mod_SOURCES = commands/configfile.c
|
||||
configfile_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For search.mod.
|
||||
search_mod_SOURCES = commands/search.c
|
||||
search_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
CLEANFILES += moddep.lst command.lst fs.lst
|
||||
pkgdata_DATA += moddep.lst command.lst fs.lst
|
||||
moddep.lst: $(DEFSYMFILES) $(UNDSYMFILES) genmoddep
|
||||
cat $(DEFSYMFILES) /dev/null | ./genmoddep $(UNDSYMFILES) > $@ \
|
||||
|| (rm -f $@; exit 1)
|
||||
|
||||
command.lst: $(COMMANDFILES)
|
||||
cat $^ /dev/null | sort > $@
|
||||
|
||||
fs.lst: $(FSFILES)
|
||||
cat $^ /dev/null | sort > $@
|
204
conf/sparc64-ieee1275.rmk
Normal file
204
conf/sparc64-ieee1275.rmk
Normal file
|
@ -0,0 +1,204 @@
|
|||
|
||||
# -*- makefile -*-
|
||||
|
||||
COMMON_ASFLAGS = -nostdinc
|
||||
COMMON_CFLAGS = -ggdb -ffreestanding -m64 -mcpu=v9 -mtune=ultrasparc
|
||||
|
||||
# Images.
|
||||
|
||||
MOSTLYCLEANFILES += grubof_symlist.c kernel_syms.lst
|
||||
DEFSYMFILES += kernel_syms.lst
|
||||
|
||||
grubof_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \
|
||||
file.h fs.h kernel.h misc.h mm.h net.h rescue.h symbol.h \
|
||||
term.h types.h loader.h \
|
||||
partition.h pc_partition.h ieee1275/ieee1275.h machine/time.h
|
||||
|
||||
grubof_symlist.c: $(addprefix include/grub/,$(grubof_HEADERS)) gensymlist.sh
|
||||
sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@
|
||||
|
||||
kernel_syms.lst: $(addprefix include/grub/,$(grubof_HEADERS)) genkernsyms.sh
|
||||
sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@
|
||||
|
||||
# Programs
|
||||
pkgdata_PROGRAMS = grubof
|
||||
|
||||
# Utilities.
|
||||
#bin_UTILITIES = grub-emu grub-mkimage
|
||||
noinst_UTILITIES = genmoddep
|
||||
|
||||
# For grub-mkimage.
|
||||
grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
|
||||
util/resolve.c
|
||||
|
||||
# For grub-emu
|
||||
#grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \
|
||||
# commands/configfile.c commands/default.c commands/help.c \
|
||||
# commands/search.c commands/terminal.c commands/ls.c \
|
||||
# commands/timeout.c \
|
||||
# commands/ieee1275/halt.c commands/ieee1275/reboot.c \
|
||||
# disk/loopback.c \
|
||||
# fs/ext2.c fs/fat.c fs/fshelp.c fs/hfs.c fs/iso9660.c fs/jfs.c \
|
||||
# fs/minix.c fs/ufs.c \
|
||||
# kern/device.c kern/disk.c kern/dl.c kern/env.c kern/err.c \
|
||||
# kern/file.c kern/fs.c kern/loader.c kern/main.c kern/misc.c \
|
||||
# kern/partition.c kern/rescue.c kern/term.c \
|
||||
# normal/arg.c normal/cmdline.c normal/command.c \
|
||||
# normal/completion.c normal/context.c \
|
||||
# normal/main.c normal/menu.c normal/menu_entry.c normal/misc.c \
|
||||
# partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
||||
# util/console.c util/grub-emu.c util/misc.c \
|
||||
# util/i386/pc/biosdisk.c util/i386/pc/getroot.c \
|
||||
# util/sparc64/ieee1275/misc.c
|
||||
|
||||
#grub_emu_LDFLAGS = $(LIBCURSES)
|
||||
|
||||
grubof_SOURCES = kern/ieee1275/ieee1275.c kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
|
||||
kern/sparc64/ieee1275/init.c term/ieee1275/ofconsole.c \
|
||||
kern/sparc64/ieee1275/openfw.c disk/ieee1275/ofdisk.c \
|
||||
kern/partition.c kern/env.c kern/sparc64/dl.c grubof_symlist.c \
|
||||
kern/sparc64/cache.c
|
||||
grubof_HEADERS = grub/sparc64/ieee1275/ieee1275.h
|
||||
grubof_CFLAGS = $(COMMON_CFLAGS)
|
||||
grubof_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
grubof_LDFLAGS = -m64 -nostdlib -Wl,-N,-Ttext,0x200000,-Bstatic -Xlinker --oformat -Xlinker elf64-sparc
|
||||
|
||||
# For genmoddep.
|
||||
genmoddep_SOURCES = util/genmoddep.c
|
||||
|
||||
# Modules.
|
||||
#pkgdata_MODULES = _linux.mod linux.mod fat.mod ufs.mod ext2.mod minix.mod \
|
||||
# hfs.mod jfs.mod normal.mod hello.mod font.mod ls.mod \
|
||||
# boot.mod cmp.mod cat.mod terminal.mod fshelp.mod amiga.mod apple.mod \
|
||||
# pc.mod suspend.mod loopback.mod help.mod reboot.mod halt.mod sun.mod \
|
||||
# default.mod timeout.mod configfile.mod search.mod
|
||||
|
||||
# For fshelp.mod.
|
||||
fshelp_mod_SOURCES = fs/fshelp.c
|
||||
fshelp_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For fat.mod.
|
||||
fat_mod_SOURCES = fs/fat.c
|
||||
fat_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For ext2.mod.
|
||||
ext2_mod_SOURCES = fs/ext2.c
|
||||
ext2_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For ufs.mod.
|
||||
ufs_mod_SOURCES = fs/ufs.c
|
||||
ufs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For minix.mod.
|
||||
minix_mod_SOURCES = fs/minix.c
|
||||
minix_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For hfs.mod.
|
||||
hfs_mod_SOURCES = fs/hfs.c
|
||||
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For jfs.mod.
|
||||
jfs_mod_SOURCES = fs/jfs.c
|
||||
jfs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For iso9660.mod.
|
||||
iso9660_mod_SOURCES = fs/iso9660.c
|
||||
iso9660_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For _linux.mod.
|
||||
_linux_mod_SOURCES = loader/sparc64/ieee1275/linux.c
|
||||
_linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For linux.mod.
|
||||
linux_mod_SOURCES = loader/sparc64/ieee1275/linux_normal.c
|
||||
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For normal.mod.
|
||||
normal_mod_SOURCES = normal/arg.c normal/cmdline.c normal/command.c \
|
||||
normal/context.c normal/main.c normal/menu.c \
|
||||
normal/menu_entry.c \
|
||||
normal/sparc64/setjmp.c
|
||||
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||
|
||||
# For hello.mod.
|
||||
hello_mod_SOURCES = hello/hello.c
|
||||
hello_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For boot.mod.
|
||||
boot_mod_SOURCES = commands/boot.c
|
||||
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For terminal.mod.
|
||||
terminal_mod_SOURCES = commands/terminal.c
|
||||
terminal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For ls.mod.
|
||||
ls_mod_SOURCES = commands/ls.c
|
||||
ls_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For cmp.mod.
|
||||
cmp_mod_SOURCES = commands/cmp.c
|
||||
cmp_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For cat.mod.
|
||||
cat_mod_SOURCES = commands/cat.c
|
||||
cat_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For font.mod.
|
||||
font_mod_SOURCES = font/manager.c
|
||||
font_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For amiga.mod
|
||||
amiga_mod_SOURCES = partmap/amiga.c
|
||||
amiga_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For apple.mod
|
||||
apple_mod_SOURCES = partmap/apple.c
|
||||
apple_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For pc.mod
|
||||
pc_mod_SOURCES = partmap/pc.c
|
||||
pc_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For sun.mod
|
||||
sun_mod_SOURCES = partmap/sun.c
|
||||
sun_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For loopback.mod
|
||||
loopback_mod_SOURCES = disk/loopback.c
|
||||
loopback_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For suspend.mod
|
||||
suspend_mod_SOURCES = commands/ieee1275/suspend.c
|
||||
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For reboot.mod
|
||||
reboot_mod_SOURCES = commands/ieee1275/reboot.c
|
||||
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For halt.mod
|
||||
halt_mod_SOURCES = commands/ieee1275/halt.c
|
||||
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For help.mod.
|
||||
help_mod_SOURCES = commands/help.c
|
||||
help_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For default.mod
|
||||
default_mod_SOURCES = commands/default.c
|
||||
default_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For timeout.mod
|
||||
timeout_mod_SOURCES = commands/timeout.c
|
||||
timeout_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For configfile.mod
|
||||
configfile_mod_SOURCES = commands/configfile.c
|
||||
configfile_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
||||
# For search.mod.
|
||||
search_mod_SOURCES = commands/search.c
|
||||
search_mod_CFLAGS = $(COMMON_CFLAGS)
|
2
configure
vendored
2
configure
vendored
|
@ -1397,6 +1397,7 @@ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
|||
case "$host_cpu" in
|
||||
i[3456]86) host_cpu=i386 ;;
|
||||
powerpc) ;;
|
||||
sparc64) ;;
|
||||
*) { { echo "$as_me:$LINENO: error: unsupported CPU type" >&5
|
||||
echo "$as_me: error: unsupported CPU type" >&2;}
|
||||
{ (exit 1); exit 1; }; } ;;
|
||||
|
@ -1405,6 +1406,7 @@ esac
|
|||
case "$host_cpu"-"$host_vendor" in
|
||||
i386-*) host_vendor=pc ;;
|
||||
powerpc-*) host_vendor=ieee1275 ;;
|
||||
sparc64-*) host_vendor=ieee1275 ;;
|
||||
*) { { echo "$as_me:$LINENO: error: unsupported machine type" >&5
|
||||
echo "$as_me: error: unsupported machine type" >&2;}
|
||||
{ (exit 1); exit 1; }; } ;;
|
||||
|
|
|
@ -23,12 +23,14 @@ AC_CANONICAL_HOST
|
|||
case "$host_cpu" in
|
||||
i[[3456]]86) host_cpu=i386 ;;
|
||||
powerpc) ;;
|
||||
sparc64) ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU type]) ;;
|
||||
esac
|
||||
|
||||
case "$host_cpu"-"$host_vendor" in
|
||||
i386-*) host_vendor=pc ;;
|
||||
powerpc-*) host_vendor=ieee1275 ;;
|
||||
sparc64-*) host_vendor=ieee1275 ;;
|
||||
*) AC_MSG_ERROR([unsupported machine type]) ;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
|||
char *devpath;
|
||||
/* XXX: This should be large enough for any possible case. */
|
||||
char prop[64];
|
||||
int actual;
|
||||
grub_ssize_t actual;
|
||||
|
||||
devpath = grub_strndup (name, grub_strlen (name) + 2);
|
||||
if (! devpath)
|
||||
|
@ -72,7 +72,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
grub_dprintf ("disk", "Opened `%s' as handle 0x%x.\n", devpath, dev_ihandle);
|
||||
grub_dprintf ("disk", "Opened `%s' as handle %p.\n", devpath, (void *) dev_ihandle);
|
||||
|
||||
if (grub_ieee1275_finddevice (devpath, &dev))
|
||||
{
|
||||
|
@ -116,8 +116,8 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
|||
static void
|
||||
grub_ofdisk_close (grub_disk_t disk)
|
||||
{
|
||||
grub_dprintf ("disk", "Closing handle 0x%x.\n",
|
||||
(grub_ieee1275_ihandle_t) disk->data);
|
||||
grub_dprintf ("disk", "Closing handle %p.\n",
|
||||
(void *) disk->data);
|
||||
grub_ieee1275_close ((grub_ieee1275_ihandle_t) disk->data);
|
||||
}
|
||||
|
||||
|
@ -125,13 +125,12 @@ static grub_err_t
|
|||
grub_ofdisk_read (grub_disk_t disk, unsigned long sector,
|
||||
unsigned long size, char *buf)
|
||||
{
|
||||
int status;
|
||||
int actual;
|
||||
grub_ssize_t status, actual;
|
||||
unsigned long long pos;
|
||||
|
||||
grub_dprintf ("disk",
|
||||
"Reading handle 0x%x: sector 0x%lx, size 0x%lx, buf %p.\n",
|
||||
(grub_ieee1275_ihandle_t) disk->data, sector, size, buf);
|
||||
"Reading handle %p: sector 0x%lx, size 0x%lx, buf %p.\n",
|
||||
(void *) disk->data, sector, size, buf);
|
||||
|
||||
pos = (unsigned long long) sector * 512UL;
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ int EXPORT_FUNC(grub_ieee1275_parent) (grub_ieee1275_phandle_t node,
|
|||
int EXPORT_FUNC(grub_ieee1275_interpret) (const char *command,
|
||||
grub_ieee1275_cell_t *catch);
|
||||
int EXPORT_FUNC(grub_ieee1275_enter) (void);
|
||||
int EXPORT_FUNC(grub_ieee1275_exit) (void) __attribute__ ((noreturn));
|
||||
void EXPORT_FUNC(grub_ieee1275_exit) (void) __attribute__ ((noreturn));
|
||||
int EXPORT_FUNC(grub_ieee1275_open) (const char *node,
|
||||
grub_ieee1275_ihandle_t *result);
|
||||
int EXPORT_FUNC(grub_ieee1275_close) (grub_ieee1275_ihandle_t ihandle);
|
||||
|
|
43
include/grub/sparc64/ieee1275/console.h
Normal file
43
include/grub/sparc64/ieee1275/console.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_CONSOLE_MACHINE_HEADER
|
||||
#define GRUB_CONSOLE_MACHINE_HEADER 1
|
||||
|
||||
/* Define scan codes. */
|
||||
/* FIXME (sparc64). */
|
||||
#define GRUB_CONSOLE_KEY_LEFT 0x4B00
|
||||
#define GRUB_CONSOLE_KEY_RIGHT 0x4D00
|
||||
#define GRUB_CONSOLE_KEY_UP 0x4800
|
||||
#define GRUB_CONSOLE_KEY_DOWN 0x5000
|
||||
#define GRUB_CONSOLE_KEY_IC 0x5200
|
||||
#define GRUB_CONSOLE_KEY_DC 0x5300
|
||||
#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008
|
||||
#define GRUB_CONSOLE_KEY_HOME 0x4700
|
||||
#define GRUB_CONSOLE_KEY_END 0x4F00
|
||||
#define GRUB_CONSOLE_KEY_NPAGE 0x4900
|
||||
#define GRUB_CONSOLE_KEY_PPAGE 0x5100
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init (void);
|
||||
|
||||
/* Finish the console system. */
|
||||
void grub_console_fini (void);
|
||||
|
||||
#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */
|
28
include/grub/sparc64/ieee1275/ieee1275.h
Normal file
28
include/grub/sparc64/ieee1275/ieee1275.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* ieee1275.h - Access the Open Firmware client interface. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_IEEE1275_MACHINE_HEADER
|
||||
#define GRUB_IEEE1275_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/types.h>
|
||||
|
||||
typedef grub_uint64_t grub_ieee1275_cell_t;
|
||||
|
||||
#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */
|
32
include/grub/sparc64/ieee1275/kernel.h
Normal file
32
include/grub/sparc64/ieee1275/kernel.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
void EXPORT_FUNC (abort) (void);
|
||||
void EXPORT_FUNC (grub_reboot) (void);
|
||||
void EXPORT_FUNC (grub_halt) (void);
|
||||
|
||||
/* Where grub-mkimage places the core modules in memory. */
|
||||
#define GRUB_IEEE1275_MODULE_BASE 0x00300000
|
||||
|
||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
30
include/grub/sparc64/ieee1275/time.h
Normal file
30
include/grub/sparc64/ieee1275/time.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003,2004,2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_TIME_HEADER
|
||||
#define KERNEL_TIME_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
#define GRUB_TICKS_PER_SECOND 1000
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
#endif /* ! KERNEL_TIME_HEADER */
|
26
include/grub/sparc64/setjmp.h
Normal file
26
include/grub/sparc64/setjmp.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_SETJMP_CPU_HEADER
|
||||
#define GRUB_SETJMP_CPU_HEADER 1
|
||||
|
||||
/* FIXME (sparc64). */
|
||||
typedef unsigned long grub_jmp_buf[20];
|
||||
|
||||
#endif /* ! GRUB_SETJMP_CPU_HEADER */
|
33
include/grub/sparc64/types.h
Normal file
33
include/grub/sparc64/types.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002, 2004 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_TYPES_CPU_HEADER
|
||||
#define GRUB_TYPES_CPU_HEADER 1
|
||||
|
||||
/* The size of void *. */
|
||||
#define GRUB_HOST_SIZEOF_VOID_P 8
|
||||
|
||||
/* The size of long. */
|
||||
#define GRUB_HOST_SIZEOF_LONG 8
|
||||
|
||||
/* sparc64 is big-endian. */
|
||||
#define GRUB_HOST_WORDS_BIGENDIAN 1
|
||||
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
|
@ -393,7 +393,7 @@ grub_ieee1275_enter (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
grub_ieee1275_exit (void)
|
||||
{
|
||||
struct exit_args
|
||||
|
|
|
@ -137,7 +137,7 @@ grub_mm_init_region (void *addr, grub_size_t size)
|
|||
grub_mm_header_t h;
|
||||
grub_mm_region_t r, *p, q;
|
||||
|
||||
grub_dprintf ("mem", "Using memory for heap: addr=%p, size=%u\n", addr, size);
|
||||
grub_dprintf ("mem", "Using memory for heap: addr=%p, size=%u\n", addr, (unsigned int) size);
|
||||
|
||||
/* If this region is too small, ignore it. */
|
||||
if (size < GRUB_MM_ALIGN * 2)
|
||||
|
@ -408,10 +408,10 @@ grub_mm_dump (unsigned lineno)
|
|||
{
|
||||
case GRUB_MM_FREE_MAGIC:
|
||||
grub_printf ("F:%p:%u:%p\n",
|
||||
p, p->size << GRUB_MM_ALIGN_LOG2, p->next);
|
||||
p, (unsigned int) p->size << GRUB_MM_ALIGN_LOG2, p->next);
|
||||
break;
|
||||
case GRUB_MM_ALLOC_MAGIC:
|
||||
grub_printf ("A:%p:%u\n", p, p->size << GRUB_MM_ALIGN_LOG2);
|
||||
grub_printf ("A:%p:%u\n", p, (unsigned int) p->size << GRUB_MM_ALIGN_LOG2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
9
kern/sparc64/cache.c
Normal file
9
kern/sparc64/cache.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include <grub/types.h>
|
||||
|
||||
void grub_arch_sync_caches(void *address __attribute__((unused)),
|
||||
grub_size_t len __attribute__((unused)));
|
||||
void grub_arch_sync_caches(void *address __attribute__((unused)),
|
||||
grub_size_t len __attribute__((unused)))
|
||||
{
|
||||
return;
|
||||
}
|
139
kern/sparc64/dl.c
Normal file
139
kern/sparc64/dl.c
Normal file
|
@ -0,0 +1,139 @@
|
|||
/* dl.c - arch-dependent part of loadable module support */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002, 2004, 2005 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
/* Check if EHDR is a valid ELF header. */
|
||||
grub_err_t
|
||||
grub_arch_dl_check_header (void *ehdr)
|
||||
{
|
||||
Elf64_Ehdr *e = ehdr;
|
||||
|
||||
/* Check the magic numbers. */
|
||||
if (e->e_ident[EI_CLASS] != ELFCLASS32
|
||||
|| e->e_ident[EI_DATA] != ELFDATA2MSB
|
||||
|| e->e_machine != EM_PPC)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid arch specific ELF magic");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
/* Relocate symbols. */
|
||||
grub_err_t
|
||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr)
|
||||
{
|
||||
Elf64_Ehdr *e = ehdr;
|
||||
Elf64_Shdr *s;
|
||||
Elf64_Sym *symtab;
|
||||
Elf64_Word entsize;
|
||||
unsigned i;
|
||||
|
||||
/* Find a symbol table. */
|
||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + e->e_shoff);
|
||||
i < e->e_shnum;
|
||||
i++, s = (Elf64_Shdr *) ((char *) s + e->e_shentsize))
|
||||
if (s->sh_type == SHT_SYMTAB)
|
||||
break;
|
||||
|
||||
if (i == e->e_shnum)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found");
|
||||
|
||||
symtab = (Elf64_Sym *) ((char *) e + s->sh_offset);
|
||||
entsize = s->sh_entsize;
|
||||
|
||||
for (i = 0, s = (Elf64_Shdr *) ((char *) e + e->e_shoff);
|
||||
i < e->e_shnum;
|
||||
i++, s = (Elf64_Shdr *) ((char *) s + e->e_shentsize))
|
||||
if (s->sh_type == SHT_RELA)
|
||||
{
|
||||
grub_dl_segment_t seg;
|
||||
|
||||
/* Find the target segment. */
|
||||
for (seg = mod->segment; seg; seg = seg->next)
|
||||
if (seg->section == s->sh_info)
|
||||
break;
|
||||
|
||||
if (seg)
|
||||
{
|
||||
Elf64_Rela *rel, *max;
|
||||
|
||||
for (rel = (Elf64_Rela *) ((char *) e + s->sh_offset),
|
||||
max = rel + s->sh_size / s->sh_entsize;
|
||||
rel < max;
|
||||
rel++)
|
||||
{
|
||||
Elf64_Xword *addr;
|
||||
Elf64_Sym *sym;
|
||||
grub_uint64_t value;
|
||||
|
||||
if (seg->size < rel->r_offset)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"reloc offset is out of the segment");
|
||||
|
||||
addr = (Elf64_Xword *) ((char *) seg->addr + rel->r_offset);
|
||||
sym = (Elf64_Sym *) ((char *) symtab
|
||||
+ entsize * ELF32_R_SYM (rel->r_info));
|
||||
|
||||
/* On the PPC the value does not have an explicit
|
||||
addend, add it. */
|
||||
value = sym->st_value + rel->r_addend;
|
||||
switch (ELF32_R_TYPE (rel->r_info))
|
||||
{
|
||||
case R_PPC_ADDR16_LO:
|
||||
*(Elf64_Half *) addr = value;
|
||||
break;
|
||||
|
||||
case R_PPC_REL24:
|
||||
{
|
||||
Elf64_Sxword delta = value - (Elf64_Xword) addr;
|
||||
|
||||
if (delta << 6 >> 6 != delta)
|
||||
return grub_error (GRUB_ERR_BAD_MODULE, "Relocation overflow");
|
||||
*addr = (*addr & 0xfc000003) | (delta & 0x3fffffc);
|
||||
break;
|
||||
}
|
||||
|
||||
case R_PPC_ADDR16_HA:
|
||||
*(Elf64_Half *) addr = (value + 0x8000) >> 16;
|
||||
break;
|
||||
|
||||
case R_PPC_ADDR32:
|
||||
*addr = value;
|
||||
break;
|
||||
|
||||
case R_PPC_REL32:
|
||||
*addr = value - (Elf64_Xword) addr;
|
||||
break;
|
||||
|
||||
default:
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
"This relocation (%d) is not implemented yet",
|
||||
ELF32_R_TYPE (rel->r_info));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
238
kern/sparc64/ieee1275/init.c
Normal file
238
kern/sparc64/ieee1275/init.c
Normal file
|
@ -0,0 +1,238 @@
|
|||
/* init.c -- Initialize GRUB on the Ultra Sprac (sparc64). */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/setjmp.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/machine/console.h>
|
||||
#include <grub/machine/time.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/ieee1275/ofdisk.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
|
||||
/* OpenBoot entry point. */
|
||||
int (*grub_ieee1275_entry_fn) (void *);
|
||||
grub_ieee1275_phandle_t grub_ieee1275_chosen;
|
||||
static grub_uint32_t grub_ieee1275_flags;
|
||||
/* FIXME (sparc64). */
|
||||
static const grub_addr_t grub_heap_start = 0x40000;
|
||||
static grub_addr_t grub_heap_len;
|
||||
|
||||
void
|
||||
_start (uint64_t r0 __attribute__((unused)),
|
||||
uint64_t r1 __attribute__((unused)),
|
||||
uint64_t r2 __attribute__((unused)),
|
||||
uint64_t r3 __attribute__((unused)),
|
||||
uint64_t r4,
|
||||
uint64_t r5 __attribute__((unused)));
|
||||
void
|
||||
_start (uint64_t r0 __attribute__((unused)),
|
||||
uint64_t r1 __attribute__((unused)),
|
||||
uint64_t r2 __attribute__((unused)),
|
||||
uint64_t r3 __attribute__((unused)),
|
||||
uint64_t r4,
|
||||
uint64_t r5 __attribute__((unused)))
|
||||
{
|
||||
grub_ieee1275_entry_fn = (int (*)(void *)) r4;
|
||||
|
||||
grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen);
|
||||
|
||||
/* Now invoke the main function. */
|
||||
grub_main ();
|
||||
|
||||
/* Never reached. */
|
||||
}
|
||||
|
||||
int
|
||||
grub_ieee1275_test_flag (enum grub_ieee1275_flag flag)
|
||||
{
|
||||
return (grub_ieee1275_flags & (1 << flag));
|
||||
}
|
||||
|
||||
void
|
||||
grub_ieee1275_set_flag (enum grub_ieee1275_flag flag)
|
||||
{
|
||||
grub_ieee1275_flags |= (1 << flag);
|
||||
}
|
||||
|
||||
void
|
||||
abort (void)
|
||||
{
|
||||
/* Trap to Open Firmware. */
|
||||
grub_ieee1275_enter ();
|
||||
}
|
||||
|
||||
/* Translate an OF filesystem path (separated by backslashes), into a GRUB
|
||||
path (separated by forward slashes). */
|
||||
static void
|
||||
grub_translate_ieee1275_path (char *filepath)
|
||||
{
|
||||
char *backslash;
|
||||
|
||||
backslash = grub_strchr (filepath, '\\');
|
||||
while (backslash != 0)
|
||||
{
|
||||
*backslash = '/';
|
||||
backslash = grub_strchr (filepath, '\\');
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
grub_set_prefix (void)
|
||||
{
|
||||
char bootpath[64]; /* XXX check length */
|
||||
char *filename;
|
||||
char *prefix;
|
||||
|
||||
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
|
||||
sizeof (bootpath), 0))
|
||||
{
|
||||
/* Should never happen. */
|
||||
grub_printf ("/chosen/bootpath property missing!\n");
|
||||
grub_env_set ("prefix", "");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Transform an OF device path to a GRUB path. */
|
||||
|
||||
prefix = grub_ieee1275_encode_devname (bootpath);
|
||||
|
||||
filename = grub_ieee1275_get_filename (bootpath);
|
||||
if (filename)
|
||||
{
|
||||
char *newprefix;
|
||||
char *lastslash = grub_strrchr (filename, '\\');
|
||||
|
||||
/* Truncate at last directory. */
|
||||
if (lastslash)
|
||||
{
|
||||
*lastslash = '\0';
|
||||
grub_translate_ieee1275_path (filename);
|
||||
|
||||
newprefix = grub_malloc (grub_strlen (prefix)
|
||||
+ grub_strlen (filename));
|
||||
grub_sprintf (newprefix, "%s%s", prefix, filename);
|
||||
grub_free (prefix);
|
||||
prefix = newprefix;
|
||||
}
|
||||
}
|
||||
|
||||
grub_env_set ("prefix", prefix);
|
||||
|
||||
grub_free (filename);
|
||||
grub_free (prefix);
|
||||
}
|
||||
|
||||
void
|
||||
grub_machine_init (void)
|
||||
{
|
||||
char *args;
|
||||
grub_ssize_t length;
|
||||
|
||||
grub_console_init ();
|
||||
|
||||
/* FIXME (sparc64). */
|
||||
grub_heap_len = (grub_addr_t) &_start - 0x1000 - grub_heap_start;
|
||||
|
||||
if (grub_ieee1275_claim (grub_heap_start, grub_heap_len, 0, 0))
|
||||
grub_fatal ("Failed to claim heap at %p, len 0x%x\n", grub_heap_start,
|
||||
grub_heap_len);
|
||||
grub_mm_init_region ((void *) grub_heap_start, grub_heap_len);
|
||||
|
||||
grub_set_prefix ();
|
||||
|
||||
grub_ofdisk_init ();
|
||||
|
||||
/* Process commandline. */
|
||||
if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootargs",
|
||||
&length) == 0 &&
|
||||
length > 0)
|
||||
{
|
||||
grub_ssize_t i = 0;
|
||||
|
||||
args = grub_malloc (length);
|
||||
grub_ieee1275_get_property (grub_ieee1275_chosen, "bootargs", args,
|
||||
length, 0);
|
||||
|
||||
while (i < length)
|
||||
{
|
||||
char *command = &args[i];
|
||||
char *end;
|
||||
char *val;
|
||||
|
||||
end = grub_strchr (command, ';');
|
||||
if (end == 0)
|
||||
i = length; /* No more commands after this one. */
|
||||
else
|
||||
{
|
||||
*end = '\0';
|
||||
i += end - command + 1;
|
||||
while (grub_isspace(args[i]))
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Process command. */
|
||||
val = grub_strchr (command, '=');
|
||||
if (val)
|
||||
{
|
||||
*val = '\0';
|
||||
grub_env_set (command, val + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
grub_machine_fini (void)
|
||||
{
|
||||
grub_ofdisk_fini ();
|
||||
grub_console_fini ();
|
||||
}
|
||||
|
||||
void
|
||||
grub_stop (void)
|
||||
{
|
||||
grub_ieee1275_exit ();
|
||||
}
|
||||
|
||||
grub_uint32_t
|
||||
grub_get_rtc (void)
|
||||
{
|
||||
grub_uint32_t msecs;
|
||||
|
||||
if (grub_ieee1275_milliseconds (&msecs))
|
||||
return 0;
|
||||
|
||||
return msecs;
|
||||
}
|
||||
|
||||
grub_addr_t
|
||||
grub_arch_modules_addr (void)
|
||||
{
|
||||
return GRUB_IEEE1275_MODULE_BASE;
|
||||
}
|
374
kern/sparc64/ieee1275/openfw.c
Normal file
374
kern/sparc64/ieee1275/openfw.c
Normal file
|
@ -0,0 +1,374 @@
|
|||
/* openfw.c -- Open firmware support funtions. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/machine/kernel.h> /* Needed ? */
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
|
||||
enum grub_ieee1275_parse_type
|
||||
{
|
||||
GRUB_PARSE_FILENAME,
|
||||
GRUB_PARSE_PARTITION,
|
||||
};
|
||||
|
||||
/* Walk children of 'devpath', calling hook for each. */
|
||||
grub_err_t
|
||||
grub_children_iterate (char *devpath,
|
||||
int (*hook) (struct grub_ieee1275_devalias *alias))
|
||||
{
|
||||
grub_ieee1275_phandle_t dev;
|
||||
grub_ieee1275_phandle_t child;
|
||||
|
||||
grub_ieee1275_finddevice (devpath, &dev);
|
||||
if (((signed) dev) == -1)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Unknown device");
|
||||
|
||||
grub_ieee1275_child (dev, &child);
|
||||
if (((signed) child) == -1)
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "Device has no children");
|
||||
|
||||
do
|
||||
{
|
||||
/* XXX: Don't use hardcoded path lengths. */
|
||||
char childtype[64];
|
||||
char childpath[64];
|
||||
char childname[64];
|
||||
char fullname[64];
|
||||
struct grub_ieee1275_devalias alias;
|
||||
grub_ssize_t actual;
|
||||
|
||||
grub_ieee1275_get_property (child, "device_type", childtype,
|
||||
sizeof childtype, &actual);
|
||||
if (actual == -1)
|
||||
continue;
|
||||
|
||||
grub_ieee1275_package_to_path (child, childpath, sizeof childpath,
|
||||
&actual);
|
||||
if (actual == -1)
|
||||
continue;
|
||||
|
||||
grub_ieee1275_get_property (child, "name", childname,
|
||||
sizeof childname, &actual);
|
||||
if (actual == -1)
|
||||
continue;
|
||||
|
||||
grub_sprintf (fullname, "%s/%s", devpath, childname);
|
||||
|
||||
alias.type = childtype;
|
||||
alias.path = childpath;
|
||||
alias.name = fullname;
|
||||
hook (&alias);
|
||||
}
|
||||
while (grub_ieee1275_peer (child, &child));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Iterate through all device aliases. This function can be used to
|
||||
find a device of a specific type. */
|
||||
grub_err_t
|
||||
grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
|
||||
{
|
||||
grub_ieee1275_phandle_t devalias;
|
||||
char aliasname[32];
|
||||
grub_ssize_t actual;
|
||||
grub_ieee1275_cell_t flags;
|
||||
struct grub_ieee1275_devalias alias;
|
||||
|
||||
if (grub_ieee1275_finddevice ("/aliases", &devalias))
|
||||
return -1;
|
||||
|
||||
aliasname[0] = '\0';
|
||||
|
||||
while (grub_ieee1275_next_property (devalias, aliasname, aliasname, &flags) != -1
|
||||
&& ((signed) flags) != -1 )
|
||||
{
|
||||
grub_ieee1275_phandle_t dev;
|
||||
grub_ssize_t pathlen, typelen;
|
||||
char *devpath, *devtype;
|
||||
|
||||
grub_dprintf ("devalias", "devalias name = %s\n", aliasname);
|
||||
|
||||
/* The property `name' is a special case we should skip. */
|
||||
if (!grub_strcmp (aliasname, "name"))
|
||||
continue;
|
||||
|
||||
grub_ieee1275_get_property_length (devalias, aliasname, &pathlen);
|
||||
devpath = grub_malloc (pathlen);
|
||||
if (! devpath)
|
||||
return grub_errno;
|
||||
|
||||
if (grub_ieee1275_get_property (devalias, aliasname, devpath, pathlen,
|
||||
&actual))
|
||||
{
|
||||
grub_dprintf ("devalias", "get_property (%s) failed\n", aliasname);
|
||||
grub_free (devpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (grub_ieee1275_finddevice (devpath, &dev) || ((signed) dev) == -1)
|
||||
{
|
||||
grub_dprintf ("devalias", "finddevice (%s) failed\n", devpath);
|
||||
grub_free (devpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
grub_ieee1275_get_property_length (dev, "device_type", &typelen);
|
||||
devtype = grub_malloc (typelen);
|
||||
if (! devtype)
|
||||
{
|
||||
grub_free (devpath);
|
||||
return grub_errno;
|
||||
}
|
||||
if (grub_ieee1275_get_property (dev, "device_type", devtype, typelen, &actual))
|
||||
{
|
||||
grub_dprintf ("devalias", "get device type failed\n");
|
||||
grub_free (devtype);
|
||||
grub_free (devpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
alias.name = aliasname;
|
||||
alias.path= devpath;
|
||||
alias.type = devtype;
|
||||
if((*hook) (&alias))
|
||||
{
|
||||
grub_free (devtype);
|
||||
grub_free (devpath);
|
||||
break;
|
||||
}
|
||||
|
||||
grub_free (devtype);
|
||||
grub_free (devpath);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME (sparc64) */
|
||||
#if 0
|
||||
/* Call the "map" method of /chosen/mmu. */
|
||||
static int
|
||||
grub_map (grub_addr_t phys, grub_addr_t virt, grub_uint32_t size,
|
||||
grub_uint8_t mode)
|
||||
{
|
||||
struct map_args {
|
||||
struct grub_ieee1275_common_hdr common;
|
||||
char *method;
|
||||
grub_ieee1275_ihandle_t ihandle;
|
||||
grub_uint32_t mode;
|
||||
grub_uint32_t size;
|
||||
grub_uint32_t virt;
|
||||
grub_uint32_t phys;
|
||||
int catch_result;
|
||||
} args;
|
||||
grub_ieee1275_ihandle_t mmu;
|
||||
grub_ssize_t len;
|
||||
|
||||
grub_ieee1275_get_property (grub_ieee1275_chosen, "mmu", &mmu, sizeof mmu,
|
||||
&len);
|
||||
if (len != sizeof mmu)
|
||||
return -1;
|
||||
|
||||
INIT_IEEE1275_COMMON (&args.common, "call-method", 6, 1);
|
||||
args.method = "map";
|
||||
args.ihandle = mmu;
|
||||
args.phys = phys;
|
||||
args.virt = virt;
|
||||
args.size = size;
|
||||
args.mode = mode; /* Format is WIMG0PP. */
|
||||
|
||||
if (IEEE1275_CALL_ENTRY_FN (&args) == -1)
|
||||
return -1;
|
||||
|
||||
return args.catch_result;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
grub_claimmap (grub_addr_t addr, grub_size_t size)
|
||||
{
|
||||
if (grub_ieee1275_claim (addr, size, 0, 0))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get the device arguments of the Open Firmware node name `path'. */
|
||||
static char *
|
||||
grub_ieee1275_get_devargs (const char *path)
|
||||
{
|
||||
char *colon = grub_strchr (path, ':');
|
||||
|
||||
if (! colon)
|
||||
return 0;
|
||||
|
||||
return grub_strdup (colon + 1);
|
||||
}
|
||||
|
||||
/* Get the device path of the Open Firmware node name `path'. */
|
||||
static char *
|
||||
grub_ieee1275_get_devname (const char *path)
|
||||
{
|
||||
char *colon = grub_strchr (path, ':');
|
||||
char *newpath = 0;
|
||||
int pathlen = grub_strlen (path);
|
||||
auto int match_alias (struct grub_ieee1275_devalias *alias);
|
||||
|
||||
int match_alias (struct grub_ieee1275_devalias *curalias)
|
||||
{
|
||||
/* briQ firmware can change capitalization in /chosen/bootpath. */
|
||||
if (! grub_strncasecmp (curalias->path, path, pathlen))
|
||||
{
|
||||
newpath = grub_strndup (curalias->name, grub_strlen (curalias->name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (colon)
|
||||
pathlen = (int)(colon - path);
|
||||
|
||||
/* Try to find an alias for this device. */
|
||||
grub_devalias_iterate (match_alias);
|
||||
|
||||
if (! newpath)
|
||||
newpath = grub_strdup (path);
|
||||
|
||||
return newpath;
|
||||
}
|
||||
|
||||
static char *
|
||||
grub_ieee1275_parse_args (const char *path, enum grub_ieee1275_parse_type ptype)
|
||||
{
|
||||
char type[64]; /* XXX check size. */
|
||||
char *device = grub_ieee1275_get_devname (path);
|
||||
char *args = grub_ieee1275_get_devargs (path);
|
||||
char *ret = 0;
|
||||
grub_ieee1275_phandle_t dev;
|
||||
|
||||
if (!args)
|
||||
/* Shouldn't happen. */
|
||||
return 0;
|
||||
|
||||
/* We need to know what type of device it is in order to parse the full
|
||||
file path properly. */
|
||||
if (grub_ieee1275_finddevice (device, &dev))
|
||||
{
|
||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Device %s not found\n", device);
|
||||
goto fail;
|
||||
}
|
||||
if (grub_ieee1275_get_property (dev, "device_type", type, sizeof type, 0))
|
||||
{
|
||||
grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"Device %s lacks a device_type property\n", device);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!grub_strcmp ("block", type))
|
||||
{
|
||||
/* The syntax of the device arguments is defined in the CHRP and PReP
|
||||
IEEE1275 bindings: "[partition][,[filename]]". */
|
||||
char *comma = grub_strchr (args, ',');
|
||||
|
||||
if (ptype == GRUB_PARSE_FILENAME)
|
||||
{
|
||||
if (comma)
|
||||
{
|
||||
char *filepath = comma + 1;
|
||||
|
||||
ret = grub_malloc (grub_strlen (filepath) + 1);
|
||||
/* Make sure filepath has leading backslash. */
|
||||
if (filepath[0] != '\\')
|
||||
grub_sprintf (ret, "\\%s", filepath);
|
||||
else
|
||||
grub_strcpy (ret, filepath);
|
||||
}
|
||||
}
|
||||
else if (ptype == GRUB_PARSE_PARTITION)
|
||||
{
|
||||
if (!comma)
|
||||
ret = grub_strdup (args);
|
||||
else
|
||||
ret = grub_strndup (args, (grub_size_t)(comma - args));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* XXX Handle net devices by configuring & registering a grub_net_dev
|
||||
here, then return its name?
|
||||
Example path: "net:<server ip>,<file name>,<client ip>,<gateway
|
||||
ip>,<bootp retries>,<tftp retries>". */
|
||||
grub_printf ("Unsupported type %s for device %s\n", type, device);
|
||||
}
|
||||
|
||||
fail:
|
||||
grub_free (device);
|
||||
grub_free (args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *
|
||||
grub_ieee1275_get_filename (const char *path)
|
||||
{
|
||||
return grub_ieee1275_parse_args (path, GRUB_PARSE_FILENAME);
|
||||
}
|
||||
|
||||
/* Convert a device name from IEEE1275 syntax to GRUB syntax. */
|
||||
char *
|
||||
grub_ieee1275_encode_devname (const char *path)
|
||||
{
|
||||
char *device = grub_ieee1275_get_devname (path);
|
||||
char *partition = grub_ieee1275_parse_args (path, GRUB_PARSE_PARTITION);
|
||||
char *encoding;
|
||||
|
||||
if (partition)
|
||||
{
|
||||
unsigned int partno = grub_strtoul (partition, 0, 0);
|
||||
|
||||
/* Assume partno will require less than five bytes to encode. */
|
||||
encoding = grub_malloc (grub_strlen (device) + 3 + 5);
|
||||
grub_sprintf (encoding, "(%s,%d)", device, partno);
|
||||
}
|
||||
else
|
||||
{
|
||||
encoding = grub_malloc (grub_strlen (device) + 2);
|
||||
grub_sprintf (encoding, "(%s)", device);
|
||||
}
|
||||
|
||||
grub_free (partition);
|
||||
grub_free (device);
|
||||
|
||||
return encoding;
|
||||
}
|
||||
|
||||
void
|
||||
grub_reboot (void)
|
||||
{
|
||||
grub_ieee1275_interpret ("reset-all", 0);
|
||||
}
|
||||
|
||||
void
|
||||
grub_halt (void)
|
||||
{
|
||||
grub_ieee1275_interpret ("power-off", 0);
|
||||
}
|
Loading…
Reference in a new issue