merge cleanbuild into emu-modload

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-08 00:21:55 +01:00
commit ca3112ba2d
31 changed files with 801 additions and 397 deletions

View File

@ -1,3 +1,11 @@
2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
* genkernsyms.sh.in: Use TARGET_CC.
2010-02-07 Colin Watson <cjwatson@ubuntu.com>
* NEWS: Update.
2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/multiboot2.h: Remove leftover file.

15
ChangeLog.ofwclock Normal file
View File

@ -0,0 +1,15 @@
2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
* conf/powerpc-ieee1275.rmk (pkglib_MODULES): Add datetime.mod,
date.mod, datehook.mod.
(datetime_mod_SOURCES): New variable.
(datetime_mod_CFLAGS): Likewise.
(datetime_mod_LDFLAGS): Likewise.
(date_mod_SOURCES): Likewise.
(date_mod_CFLAGS): Likewise.
(date_mod_LDFLAGS): Likewise.
(datehook_mod_SOURCES): Likewise.
(datehook_mod_CFLAGS): Likewise.
(datehook_mod_LDFLAGS): Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* lib/ieee1275/datetime.c: New file.

16
ChangeLog.ofwfb Normal file
View File

@ -0,0 +1,16 @@
2010-02-06 Vladimir Serbinenko <phcoder@gmail.com>
* conf/powerpc-ieee1275.rmk (pkglib_MODULES): Add ieee1275_fb.mod.
(ieee1275_fb_mod_SOURCES): New variable.
(ieee1275_fb_mod_CFLAGS): Likewise.
(ieee1275_fb_mod_LDFLAGS): Likewise.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_devices_iterate):
New proto.
* kern/ieee1275/init.c (HEAP_MAX_SIZE): Increased.
(HEAP_MAX_ADDR): Likewise.
* kern/ieee1275/openfw.c (grub_children_iterate): Don't skip empty
type.
Correct stop condition.
(grub_ieee1275_devices_iterate): New function.
* video/ieee1275.c: New file.

15
NEWS
View File

@ -1,5 +1,20 @@
New in 1.98:
* Graphical menu support.
* MIPS support.
* Saved default menu entry support, with new utilities `grub-reboot' and
`grub-set-default'.
* Unit testing framework.
* Support for multiple terminals.
* Encrypted password support, with a new utility `grub-mkpasswd-pbkdf2'.
* `grub-mkfloppy' removed; use `grub-mkrescue' to create floppy images.
* Add grub-probe support for GNU/Hurd.
* Add support for gettext.

View File

@ -16,7 +16,9 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_EMU
#include <grub/machine/memory.h>
#endif
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/command.h>
@ -34,7 +36,9 @@ grub_cmd_lsmmap (grub_command_t cmd __attribute__ ((unused)),
(long long) addr, (long long) size, type);
return 0;
}
#ifndef GRUB_MACHINE_EMU
grub_machine_mmap_iterate (hook);
#endif
return 0;
}

View File

@ -11,12 +11,12 @@ pkglib_PROGRAMS = kernel.img
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
kern/err.c kern/list.c kern/handler.c \
kern/command.c kern/corecmd.c kern/file.c \
kern/fs.c kern/main.c kern/misc.c kern/parser.c \
kern/fs.c kern/main.c kern/misc.c kern/parser.c \
kern/partition.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
\
util/console.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c util/mm.c \
util/hostdisk.c util/getroot.c util/mm.c util/time.c \
\
gnulib/progname.c util/hostfs.c disk/host.c
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
@ -38,18 +38,6 @@ else
kernel_img_SOURCES += grub_emu_init.c
endif
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod.
pkglib_MODULES += reboot.mod
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod.
pkglib_MODULES += halt.mod
halt_mod_SOURCES = commands/halt.c

View File

@ -759,6 +759,42 @@ password_pbkdf2_mod_SOURCES = commands/password_pbkdf2.c
password_pbkdf2_mod_CFLAGS = $(COMMON_CFLAGS)
password_pbkdf2_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For memdisk.mod.
pkglib_MODULES += memdisk.mod
memdisk_mod_SOURCES = disk/memdisk.c
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod.
pkglib_MODULES += reboot.mod
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For date.mod
pkglib_MODULES += date.mod
date_mod_SOURCES = commands/date.c
date_mod_CFLAGS = $(COMMON_CFLAGS)
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datehook.mod
pkglib_MODULES += datehook.mod
datehook_mod_SOURCES = hook/datehook.c
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lsmmap.mod
pkglib_MODULES += lsmmap.mod
lsmmap_mod_SOURCES = commands/lsmmap.c
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
bin_UTILITIES += grub-mkpasswd-pbkdf2
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c util/mm.c kern/err.c
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1

View File

@ -11,8 +11,6 @@ script/lexer.c_DEPENDENCIES = grub_script.tab.h
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
ifeq ($(platform), coreboot)
pkglib_PROGRAMS += kernel.img
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
kern/i386/misc.S \
@ -41,55 +39,6 @@ kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
endif
ifeq ($(platform), qemu)
GRUB_BOOT_MACHINE_LINK_ADDR = 0xffe00
pkglib_IMAGES += boot.img
boot_img_SOURCES = boot/i386/qemu/boot.S
boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
boot_img_FORMAT = binary
bin_UTILITIES += grub-mkimage
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
util/resolve.c gnulib/progname.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
pkglib_IMAGES += kernel.img
kernel_img_SOURCES = kern/i386/qemu/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/qemu/mmap.c \
kern/i386/halt.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/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
kern/i386/tsc.c kern/i386/pit.c \
kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c \
kern/env.c \
term/i386/pc/vga_text.c term/i386/vga_common.c \
symlist.c
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h \
env_private.h
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
kernel_img_FORMAT = binary
endif
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
DEFSYMFILES += kernel_syms.lst
@ -106,17 +55,7 @@ bin_SCRIPTS += grub-mkrescue
grub_mkrescue_SOURCES = util/grub-mkrescue.in
# Modules.
pkglib_MODULES = linux.mod \
aout.mod play.mod serial.mod \
memdisk.mod pci.mod lspci.mod reboot.mod \
halt.mod datetime.mod date.mod datehook.mod \
lsmmap.mod mmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
# For mmap.mod.
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
@ -129,21 +68,11 @@ linux_mod_SOURCES = loader/i386/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod.
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod.
halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod.
serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For aout.mod.
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)
@ -156,45 +85,10 @@ bsd_mod_CFLAGS = $(COMMON_CFLAGS)
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For play.mod.
play_mod_SOURCES = commands/i386/pc/play.c
play_mod_CFLAGS = $(COMMON_CFLAGS)
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For memdisk.mod.
memdisk_mod_SOURCES = disk/memdisk.c
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For pci.mod
pci_mod_SOURCES = bus/pci.c
pci_mod_CFLAGS = $(COMMON_CFLAGS)
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lspci.mod
lspci_mod_SOURCES = commands/lspci.c
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For date.mod
date_mod_SOURCES = commands/date.c
date_mod_CFLAGS = $(COMMON_CFLAGS)
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datehook.mod
datehook_mod_SOURCES = hook/datehook.c
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lsmmap.mod
lsmmap_mod_SOURCES = commands/lsmmap.c
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/i386.mk
include $(srcdir)/conf/common.mk

View File

@ -32,8 +32,8 @@ grub_install_SOURCES = util/i386/efi/grub-install.in
# Modules.
pkglib_PROGRAMS = kernel.img
pkglib_MODULES = chain.mod appleldr.mod \
linux.mod halt.mod reboot.mod pci.mod lspci.mod \
datetime.mod date.mod datehook.mod loadbios.mod \
linux.mod halt.mod \
datetime.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod
# For kernel.img.
@ -68,12 +68,6 @@ symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For acpi.mod.
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
@ -105,36 +99,11 @@ halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod.
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For pci.mod
pci_mod_SOURCES = bus/pci.c
pci_mod_CFLAGS = $(COMMON_CFLAGS)
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lspci.mod
lspci_mod_SOURCES = commands/lspci.c
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/efi/datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For date.mod
date_mod_SOURCES = commands/date.c
date_mod_CFLAGS = $(COMMON_CFLAGS)
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datehook.mod
datehook_mod_SOURCES = hook/datehook.c
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For loadbios.mod
loadbios_mod_SOURCES = commands/efi/loadbios.c
loadbios_mod_CFLAGS = $(COMMON_CFLAGS)

View File

@ -54,16 +54,10 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/ieee1275/grub-install.in
# Modules.
pkglib_MODULES = halt.mod reboot.mod suspend.mod \
aout.mod serial.mod linux.mod \
nand.mod memdisk.mod pci.mod lspci.mod datetime.mod \
date.mod datehook.mod lsmmap.mod mmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES = halt.mod suspend.mod \
aout.mod linux.mod \
nand.mod datetime.mod \
mmap.mod
# For mmap.mod.
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
@ -81,21 +75,11 @@ suspend_mod_SOURCES = commands/ieee1275/suspend.c
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod
halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod.
serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For linux.mod.
linux_mod_SOURCES = loader/i386/ieee1275/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
@ -106,40 +90,10 @@ nand_mod_SOURCES = disk/ieee1275/nand.c
nand_mod_CFLAGS = $(COMMON_CFLAGS)
nand_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For memdisk.mod.
memdisk_mod_SOURCES = disk/memdisk.c
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For pci.mod
pci_mod_SOURCES = bus/pci.c
pci_mod_CFLAGS = $(COMMON_CFLAGS)
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lspci.mod
lspci_mod_SOURCES = commands/lspci.c
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For date.mod
date_mod_SOURCES = commands/date.c
date_mod_CFLAGS = $(COMMON_CFLAGS)
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datehook.mod
datehook_mod_SOURCES = hook/datehook.c
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lsmmap.mod
lsmmap_mod_SOURCES = commands/lsmmap.c
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/i386.mk
include $(srcdir)/conf/common.mk

View File

@ -107,7 +107,7 @@ grub_setup_SOURCES = gnulib/progname.c \
partmap/msdos.c partmap/gpt.c \
\
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
util/raid.c util/lvm.c \
util/raid.c util/lvm.c util/mm.c \
grub_setup_init.c
sbin_SCRIPTS += grub-install
@ -117,20 +117,14 @@ bin_SCRIPTS += grub-mkrescue
grub_mkrescue_SOURCES = util/grub-mkrescue.in
pkglib_MODULES = biosdisk.mod chain.mod \
reboot.mod halt.mod \
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
vga.mod memdisk.mod pci.mod lspci.mod \
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
halt.mod \
vbe.mod vbetest.mod vbeinfo.mod \
vga.mod \
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod \
ata_pthru.mod hdparm.mod \
usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
efiemu.mod mmap.mod acpi.mod drivemap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For drivemap.mod.
drivemap_mod_SOURCES = commands/i386/pc/drivemap.c \
commands/i386/pc/drivemap_int13h.S
@ -187,21 +181,11 @@ xnu_mod_CFLAGS = $(COMMON_CFLAGS)
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
xnu_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For reboot.mod.
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod.
halt_mod_SOURCES = commands/i386/pc/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod.
serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For vbe.mod.
vbe_mod_SOURCES = video/i386/pc/vbe.c
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
@ -217,31 +201,11 @@ vbetest_mod_SOURCES = commands/i386/pc/vbetest.c
vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For play.mod.
play_mod_SOURCES = commands/i386/pc/play.c
play_mod_CFLAGS = $(COMMON_CFLAGS)
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For vga.mod.
vga_mod_SOURCES = term/i386/pc/vga.c
vga_mod_CFLAGS = $(COMMON_CFLAGS)
vga_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For memdisk.mod.
memdisk_mod_SOURCES = disk/memdisk.c
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For pci.mod
pci_mod_SOURCES = bus/pci.c
pci_mod_CFLAGS = $(COMMON_CFLAGS)
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lspci.mod
lspci_mod_SOURCES = commands/lspci.c
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For aout.mod
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)
@ -298,21 +262,6 @@ datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For date.mod
date_mod_SOURCES = commands/date.c
date_mod_CFLAGS = $(COMMON_CFLAGS)
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datehook.mod
datehook_mod_SOURCES = hook/datehook.c
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lsmmap.mod
lsmmap_mod_SOURCES = commands/lsmmap.c
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For ata_pthru.mod.
ata_pthru_mod_SOURCES = disk/ata_pthru.c
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)

View File

@ -1,2 +1,108 @@
# -*- makefile -*-
include $(srcdir)/conf/i386-coreboot.mk
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
COMMON_LDFLAGS = -m32 -nostdlib
# Used by various components. These rules need to precede them.
script/lexer.c_DEPENDENCIES = grub_script.tab.h
# Images.
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
GRUB_BOOT_MACHINE_LINK_ADDR = 0xffe00
pkglib_IMAGES += boot.img
boot_img_SOURCES = boot/i386/qemu/boot.S
boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
boot_img_FORMAT = binary
bin_UTILITIES += grub-mkimage
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
util/resolve.c gnulib/progname.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
pkglib_IMAGES += kernel.img
kernel_img_SOURCES = kern/i386/qemu/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/qemu/mmap.c \
kern/i386/halt.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/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
kern/i386/tsc.c kern/i386/pit.c \
kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c \
kern/env.c \
term/i386/pc/vga_text.c term/i386/vga_common.c \
symlist.c
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h list.h handler.h command.h i18n.h \
env_private.h
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
kernel_img_FORMAT = binary
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
DEFSYMFILES += kernel_syms.lst
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in
bin_SCRIPTS += grub-mkrescue
grub_mkrescue_SOURCES = util/grub-mkrescue.in
# Modules.
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
# For mmap.mod.
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For linux.mod.
linux_mod_SOURCES = loader/i386/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod.
halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For aout.mod.
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For bsd.mod
pkglib_MODULES += bsd.mod
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/i386.mk
include $(srcdir)/conf/common.mk

View File

@ -47,3 +47,28 @@ multiboot2_mod_SOURCES = loader/i386/multiboot.c \
multiboot2_mod_CFLAGS = $(COMMON_CFLAGS) -DGRUB_USE_MULTIBOOT2
multiboot2_mod_LDFLAGS = $(COMMON_LDFLAGS)
multiboot2_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For serial.mod.
pkglib_MODULES += serial.mod
serial_mod_SOURCES = term/serial.c
serial_mod_CFLAGS = $(COMMON_CFLAGS)
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For pci.mod
pkglib_MODULES += pci.mod
pci_mod_SOURCES = bus/pci.c
pci_mod_CFLAGS = $(COMMON_CFLAGS)
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lspci.mod
pkglib_MODULES += lspci.mod
lspci_mod_SOURCES = commands/lspci.c
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For play.mod.
pkglib_MODULES += play.mod
play_mod_SOURCES = commands/i386/pc/play.c
play_mod_CFLAGS = $(COMMON_CFLAGS)
play_mod_LDFLAGS = $(COMMON_LDFLAGS)

View File

@ -61,19 +61,6 @@ datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For date.mod
pkglib_MODULES += date.mod
date_mod_SOURCES = commands/date.c
date_mod_CFLAGS = $(COMMON_CFLAGS)
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datehook.mod
pkglib_MODULES += datehook.mod
datehook_mod_SOURCES = hook/datehook.c
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in

View File

@ -40,26 +40,6 @@ grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
# Modules.
pkglib_MODULES = memdisk.mod \
lsmmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For memdisk.mod.
memdisk_mod_SOURCES = disk/memdisk.c
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lsmmap.mod
lsmmap_mod_SOURCES = commands/lsmmap.c
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For serial.mod.
pkglib_MODULES += serial.mod
serial_mod_SOURCES = term/serial.c

View File

@ -57,47 +57,33 @@ grub_install_SOURCES = util/ieee1275/grub-install.in
grub_mkrescue_SOURCES = util/powerpc/ieee1275/grub-mkrescue.in
# Modules.
pkglib_MODULES = halt.mod \
linux.mod \
reboot.mod \
suspend.mod \
memdisk.mod \
lsmmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += ieee1275_fb.mod
ieee1275_fb_mod_SOURCES = video/ieee1275.c
ieee1275_fb_mod_CFLAGS = $(COMMON_CFLAGS)
ieee1275_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For linux.mod.
pkglib_MODULES += linux.mod
linux_mod_SOURCES = loader/powerpc/ieee1275/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For suspend.mod
pkglib_MODULES += suspend.mod
suspend_mod_SOURCES = commands/ieee1275/suspend.c
suspend_mod_CFLAGS = $(COMMON_CFLAGS)
suspend_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod
pkglib_MODULES += halt.mod
halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For memdisk.mod.
memdisk_mod_SOURCES = disk/memdisk.c
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lsmmap.mod
lsmmap_mod_SOURCES = commands/lsmmap.c
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
pkglib_MODULES += datetime.mod
datetime_mod_SOURCES = lib/ieee1275/datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/common.mk

View File

@ -82,7 +82,7 @@ grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
partmap/sun.c partmap/acorn.c \
\
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
util/raid.c util/lvm.c gnulib/progname.c \
util/raid.c util/lvm.c util/mm.c gnulib/progname.c \
grub_setup_init.c
# For grub-ofpathname.
@ -96,41 +96,27 @@ sbin_SCRIPTS = grub-install
grub_install_SOURCES = util/grub-install.in
# Modules.
pkglib_MODULES = halt.mod \
linux.mod \
reboot.mod \
memdisk.mod \
lsmmap.mod
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += ieee1275_fb.mod
ieee1275_fb_mod_SOURCES = video/ieee1275.c
ieee1275_fb_mod_CFLAGS = $(COMMON_CFLAGS)
ieee1275_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For linux.mod.
pkglib_MODULES += linux.mod
linux_mod_SOURCES = loader/sparc64/ieee1275/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod.
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod.
pkglib_MODULES += halt.mod
halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For memdisk.mod.
memdisk_mod_SOURCES = disk/memdisk.c
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lsmmap.mod
lsmmap_mod_SOURCES = commands/lsmmap.c
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
pkglib_MODULES += datetime.mod
datetime_mod_SOURCES = lib/ieee1275/datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/common.mk

View File

@ -31,8 +31,8 @@ grub_install_SOURCES = util/i386/efi/grub-install.in
# Modules.
pkglib_PROGRAMS = kernel.img
pkglib_MODULES = chain.mod appleldr.mod \
halt.mod reboot.mod linux.mod pci.mod lspci.mod \
datetime.mod date.mod datehook.mod loadbios.mod \
halt.mod linux.mod \
datetime.mod loadbios.mod \
fixvideo.mod mmap.mod acpi.mod
# For kernel.img.
@ -67,12 +67,6 @@ symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
# For boot.mod.
pkglib_MODULES += boot.mod
boot_mod_SOURCES = commands/boot.c lib/i386/pc/biosnum.c
boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For acpi.mod.
acpi_mod_SOURCES = commands/acpi.c commands/efi/acpi.c
acpi_mod_CFLAGS = $(COMMON_CFLAGS)
@ -105,36 +99,11 @@ halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For reboot.mod.
reboot_mod_SOURCES = commands/reboot.c
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For pci.mod
pci_mod_SOURCES = bus/pci.c
pci_mod_CFLAGS = $(COMMON_CFLAGS)
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For lspci.mod
lspci_mod_SOURCES = commands/lspci.c
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/efi/datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For date.mod
date_mod_SOURCES = commands/date.c
date_mod_CFLAGS = $(COMMON_CFLAGS)
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For datehook.mod
datehook_mod_SOURCES = hook/datehook.c
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For loadbios.mod
loadbios_mod_SOURCES = commands/efi/loadbios.c
loadbios_mod_CFLAGS = $(COMMON_CFLAGS)

View File

@ -23,7 +23,6 @@
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/types.h>
#include <grub/machine/kernel.h>
static char *memdisk_addr;
static grub_off_t memdisk_size = 0;

View File

@ -14,7 +14,7 @@
### The configure script will replace these variables.
: ${srcdir=@srcdir@}
: ${CC=@CC@}
: ${CC=@TARGET_CC@}
u=
grep "^#define HAVE_ASM_USCORE" config.h >/dev/null 2>&1 && u="_"

View File

@ -84,7 +84,7 @@ grub_read_hook_datetime (struct grub_env_var *var,
return buf;
}
GRUB_MOD_INIT(datetime)
GRUB_MOD_INIT(datehook)
{
int i;
@ -93,7 +93,7 @@ GRUB_MOD_INIT(datetime)
grub_read_hook_datetime, 0);
}
GRUB_MOD_FINI(datetime)
GRUB_MOD_FINI(datehook)
{
int i;

View File

@ -33,10 +33,17 @@ struct grub_datetime
};
/* Return date and time. */
#ifdef GRUB_MACHINE_EMU
grub_err_t EXPORT_FUNC(grub_get_datetime) (struct grub_datetime *datetime);
/* Set date and time. */
grub_err_t EXPORT_FUNC(grub_set_datetime) (struct grub_datetime *datetime);
#else
grub_err_t grub_get_datetime (struct grub_datetime *datetime);
/* Set date and time. */
grub_err_t grub_set_datetime (struct grub_datetime *datetime);
#endif
int grub_get_weekday (struct grub_datetime *datetime);
char *grub_get_weekday_name (struct grub_datetime *datetime);

View File

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View File

@ -176,4 +176,8 @@ int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size);
char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path);
char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path);
int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook)
(struct grub_ieee1275_devalias *
alias));
#endif /* ! GRUB_IEEE1275_HEADER */

View File

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View File

@ -38,11 +38,11 @@
#define HEAP_MIN_SIZE (unsigned long) (2 * 1024 * 1024)
/* The maximum heap size we're going to claim */
#define HEAP_MAX_SIZE (unsigned long) (4 * 1024 * 1024)
#define HEAP_MAX_SIZE (unsigned long) (32 * 1024 * 1024)
/* If possible, we will avoid claiming heap above this address, because it
seems to cause relocation problems with OSes that link at 4 MiB */
#define HEAP_MAX_ADDR (unsigned long) (4 * 1024 * 1024)
#define HEAP_MAX_ADDR (unsigned long) (32 * 1024 * 1024)
extern char _start[];
extern char _end[];

View File

@ -72,7 +72,7 @@ grub_children_iterate (char *devpath,
if (grub_ieee1275_get_property (child, "device_type", childtype,
IEEE1275_MAX_PROP_LEN, &actual))
continue;
childtype[0] = 0;
if (grub_ieee1275_package_to_path (child, childpath,
IEEE1275_MAX_PATH_LEN, &actual))
@ -82,7 +82,10 @@ grub_children_iterate (char *devpath,
IEEE1275_MAX_PROP_LEN, &actual))
continue;
fullname = grub_xasprintf ("%s/%s", devpath, childname);
if (devpath[0] == '/' && devpath[1] == 0)
fullname = grub_xasprintf ("/%s", childname);
else
fullname = grub_xasprintf ("%s/%s", devpath, childname);
if (!fullname)
{
grub_free (childname);
@ -99,7 +102,7 @@ grub_children_iterate (char *devpath,
if (ret)
break;
}
while (grub_ieee1275_peer (child, &child));
while (grub_ieee1275_peer (child, &child) != -1);
grub_free (childname);
grub_free (childpath);
@ -108,6 +111,20 @@ grub_children_iterate (char *devpath,
return ret;
}
int
grub_ieee1275_devices_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
{
auto int it_through (struct grub_ieee1275_devalias *alias);
int it_through (struct grub_ieee1275_devalias *alias)
{
if (hook (alias))
return 1;
return grub_children_iterate (alias->name, it_through);
}
return grub_children_iterate ("/", it_through);
}
/* Iterate through all device aliases. This function can be used to
find a device of a specific type. */
int

View File

@ -29,10 +29,10 @@
#include <grub/cpu/kernel.h>
extern void grub_video_sm712_init (void);
extern void grub_video_video_init (void);
extern void grub_video_bitmap_init (void);
extern void grub_font_manager_init (void);
extern void grub_term_gfxterm_init (void);
extern void grub_video_init (void);
extern void grub_bitmap_init (void);
extern void grub_font_init (void);
extern void grub_gfxterm_init (void);
extern void grub_at_keyboard_init (void);
/* FIXME: use interrupt to count high. */
@ -98,10 +98,10 @@ grub_machine_init (void)
/* Initialize output terminal (can't be done earlier, as gfxterm
relies on a working heap. */
grub_video_sm712_init ();
grub_video_video_init ();
grub_video_bitmap_init ();
grub_font_manager_init ();
grub_term_gfxterm_init ();
grub_video_init ();
grub_bitmap_init ();
grub_font_init ();
grub_gfxterm_init ();
grub_at_keyboard_init ();
}

142
lib/ieee1275/datetime.c Normal file
View File

@ -0,0 +1,142 @@
/* kern/cmos_datetime.c - CMOS datetime function.
*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/datetime.h>
#include <grub/ieee1275/ieee1275.h>
#include <grub/misc.h>
static char *rtc = 0;
static void
find_rtc (void)
{
auto int hook (struct grub_ieee1275_devalias *alias);
int hook (struct grub_ieee1275_devalias *alias)
{
if (grub_strcmp (alias->type, "rtc") == 0)
{
grub_dprintf ("datetime", "Found RTC %s\n", alias->name);
rtc = grub_strdup (alias->name);
return 1;
}
return 0;
}
grub_ieee1275_devices_iterate (hook);
}
grub_err_t
grub_get_datetime (struct grub_datetime *datetime)
{
struct get_time_args
{
struct grub_ieee1275_common_hdr common;
grub_ieee1275_cell_t method;
grub_ieee1275_cell_t device;
grub_ieee1275_cell_t catch_result;
grub_ieee1275_cell_t year;
grub_ieee1275_cell_t month;
grub_ieee1275_cell_t day;
grub_ieee1275_cell_t hour;
grub_ieee1275_cell_t minute;
grub_ieee1275_cell_t second;
}
args;
int status;
grub_ieee1275_ihandle_t ihandle;
if (!rtc)
find_rtc ();
if (!rtc)
return grub_error (GRUB_ERR_IO, "no RTC found");
status = grub_ieee1275_open (rtc, &ihandle);
if (status == -1)
return grub_error (GRUB_ERR_IO, "couldn't open RTC");
INIT_IEEE1275_COMMON (&args.common, "call-method", 2, 7);
args.device = (grub_ieee1275_cell_t) ihandle;
args.method = (grub_ieee1275_cell_t) "get-time";
status = IEEE1275_CALL_ENTRY_FN (&args);
grub_ieee1275_close (ihandle);
if (status == -1)
return grub_error (GRUB_ERR_IO, "get-time failed");
datetime->year = args.year;
datetime->month = args.month;
datetime->day = args.day;
datetime->hour = args.hour;
datetime->minute = args.minute;
datetime->second = args.second;
return GRUB_ERR_NONE;
}
grub_err_t
grub_set_datetime (struct grub_datetime *datetime)
{
struct get_time_args
{
struct grub_ieee1275_common_hdr common;
grub_ieee1275_cell_t method;
grub_ieee1275_cell_t device;
grub_ieee1275_cell_t year;
grub_ieee1275_cell_t month;
grub_ieee1275_cell_t day;
grub_ieee1275_cell_t hour;
grub_ieee1275_cell_t minute;
grub_ieee1275_cell_t second;
grub_ieee1275_cell_t catch_result;
}
args;
int status;
grub_ieee1275_ihandle_t ihandle;
if (!rtc)
find_rtc ();
if (!rtc)
return grub_error (GRUB_ERR_IO, "no RTC found");
status = grub_ieee1275_open (rtc, &ihandle);
if (status == -1)
return grub_error (GRUB_ERR_IO, "couldn't open RTC");
INIT_IEEE1275_COMMON (&args.common, "call-method", 8, 1);
args.device = (grub_ieee1275_cell_t) ihandle;
args.method = (grub_ieee1275_cell_t) "set-time";
args.year = datetime->year;
args.month = datetime->month;
args.day = datetime->day;
args.hour = datetime->hour;
args.minute = datetime->minute;
args.second = datetime->second;
status = IEEE1275_CALL_ENTRY_FN (&args);
grub_ieee1275_close (ihandle);
if (status == -1)
return grub_error (GRUB_ERR_IO, "set-time failed");
return GRUB_ERR_NONE;
}

46
util/time.c Normal file
View File

@ -0,0 +1,46 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/datetime.h>
#include <time.h>
grub_err_t
grub_get_datetime (struct grub_datetime *datetime)
{
struct tm *mytm;
time_t mytime;
mytime = time (&mytime);
mytm = gmtime (&mytime);
datetime->year = mytm->tm_year + 1900;
datetime->month = mytm->tm_mon + 1;
datetime->day = mytm->tm_mday;
datetime->hour = mytm->tm_hour;
datetime->minute = mytm->tm_min;
datetime->second = mytm->tm_sec;
return GRUB_ERR_NONE;
}
grub_err_t
grub_set_datetime (struct grub_datetime *datetime __attribute__ ((unused)))
{
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"no clock setting routine available");
}

300
video/ieee1275.c Normal file
View File

@ -0,0 +1,300 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#define grub_video_render_target grub_video_fbrender_target
#include <grub/err.h>
#include <grub/types.h>
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/video.h>
#include <grub/video_fb.h>
#include <grub/ieee1275/ieee1275.h>
/* Only 8-bit indexed color is supported for now. */
static unsigned old_width, old_height;
static int restore_needed;
static char *display;
static struct
{
struct grub_video_mode_info mode_info;
struct grub_video_render_target *render_target;
grub_uint8_t *ptr;
} framebuffer;
static grub_err_t
grub_video_ieee1275_set_palette (unsigned int start, unsigned int count,
struct grub_video_palette_data *palette_data);
static void
set_video_mode (unsigned width __attribute__ ((unused)),
unsigned height __attribute__ ((unused)))
{
/* TODO */
}
static void
find_display (void)
{
auto int hook (struct grub_ieee1275_devalias *alias);
int hook (struct grub_ieee1275_devalias *alias)
{
if (grub_strcmp (alias->type, "display") == 0)
{
grub_dprintf ("video", "Found display %s\n", alias->name);
display = grub_strdup (alias->name);
return 1;
}
return 0;
}
grub_ieee1275_devices_iterate (hook);
}
static grub_err_t
grub_video_ieee1275_init (void)
{
grub_memset (&framebuffer, 0, sizeof(framebuffer));
return grub_video_fb_init ();
}
static grub_err_t
grub_video_ieee1275_fini (void)
{
if (restore_needed)
{
set_video_mode (old_width, old_height);
restore_needed = 0;
}
return grub_video_fb_fini ();
}
static grub_err_t
grub_video_ieee1275_fill_mode_info (grub_ieee1275_phandle_t dev,
struct grub_video_mode_info *out)
{
grub_uint32_t tmp;
grub_memset (out, 0, sizeof (*out));
if (grub_ieee1275_get_integer_property (dev, "width", &tmp,
sizeof (tmp), 0))
return grub_error (GRUB_ERR_IO, "Couldn't retrieve display width.");
out->width = tmp;
if (grub_ieee1275_get_integer_property (dev, "height", &tmp,
sizeof (tmp), 0))
return grub_error (GRUB_ERR_IO, "Couldn't retrieve display height.");
out->height = tmp;
if (grub_ieee1275_get_integer_property (dev, "linebytes", &tmp,
sizeof (tmp), 0))
return grub_error (GRUB_ERR_IO, "Couldn't retrieve display pitch.");
out->pitch = tmp;
out->mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
out->bpp = 8;
out->bytes_per_pixel = 1;
out->number_of_colors = 256;
out->blit_format = grub_video_get_blit_format (out);
return GRUB_ERR_NONE;
}
static grub_err_t
grub_video_ieee1275_setup (unsigned int width, unsigned int height,
unsigned int mode_type __attribute__ ((unused)),
unsigned int mode_mask __attribute__ ((unused)))
{
grub_uint32_t current_width, current_height;
grub_addr_t address;
grub_err_t err;
grub_ieee1275_phandle_t dev;
if (!display)
return grub_error (GRUB_ERR_IO, "Couldn't find display device.");
if (grub_ieee1275_finddevice (display, &dev))
return grub_error (GRUB_ERR_IO, "Couldn't open display device.");
if (grub_ieee1275_get_integer_property (dev, "width", &current_width,
sizeof (current_width), 0))
return grub_error (GRUB_ERR_IO, "Couldn't retrieve display width.");
if (grub_ieee1275_get_integer_property (dev, "height", &current_height,
sizeof (current_width), 0))
return grub_error (GRUB_ERR_IO, "Couldn't retrieve display height.");
if ((width == current_width && height == current_height)
|| (width == 0 && height == 0))
{
grub_dprintf ("video", "IEEE1275: keeping current mode %dx%d\n",
current_width, current_height);
}
else
{
grub_dprintf ("video", "IEEE1275: Setting mode %dx%d\n", width, height);
/* TODO. */
return grub_error (GRUB_ERR_IO, "can't set mode %dx%d", width, height);
}
err = grub_video_ieee1275_fill_mode_info (dev, &framebuffer.mode_info);
if (err)
{
grub_dprintf ("video", "IEEE1275: couldn't fill mode info\n");
return err;
}
if (grub_ieee1275_get_integer_property (dev, "address", (void *) &address,
sizeof (address), 0))
return grub_error (GRUB_ERR_IO, "Couldn't retrieve display address.");
framebuffer.ptr = (void *) address;
grub_video_ieee1275_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
grub_video_fbstd_colors);
grub_dprintf ("video", "IEEE1275: initialising FB @ %p %dx%dx%d\n",
framebuffer.ptr, framebuffer.mode_info.width,
framebuffer.mode_info.height, framebuffer.mode_info.bpp);
err = grub_video_fb_create_render_target_from_pointer
(&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr);
if (err)
{
grub_dprintf ("video", "IEEE1275: Couldn't create FB target\n");
return err;
}
err = grub_video_fb_set_active_render_target (framebuffer.render_target);
if (err)
{
grub_dprintf ("video", "IEEE1275: Couldn't set FB target\n");
return err;
}
err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
grub_video_fbstd_colors);
if (err)
grub_dprintf ("video", "IEEE1275: Couldn't set palette\n");
else
grub_dprintf ("video", "IEEE1275: Success\n");
return err;
}
static grub_err_t
grub_video_ieee1275_swap_buffers (void)
{
/* TODO: Implement buffer swapping. */
return GRUB_ERR_NONE;
}
static grub_err_t
grub_video_ieee1275_set_active_render_target (struct grub_video_render_target *target)
{
if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY)
target = framebuffer.render_target;
return grub_video_fb_set_active_render_target (target);
}
static grub_err_t
grub_video_ieee1275_get_info_and_fini (struct grub_video_mode_info *mode_info,
void **framebuf)
{
grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info));
*framebuf = (char *) framebuffer.ptr;
grub_video_fb_fini ();
return GRUB_ERR_NONE;
}
static grub_err_t
grub_video_ieee1275_set_palette (unsigned int start, unsigned int count,
struct grub_video_palette_data *palette_data)
{
grub_err_t err;
struct grub_video_palette_data fb_palette_data[256];
err = grub_video_fb_set_palette (start, count, palette_data);
if (err)
return err;
grub_video_fb_get_palette (0, 256, fb_palette_data);
/* TODO. */
return GRUB_ERR_NONE;
}
static struct grub_video_adapter grub_video_ieee1275_adapter =
{
.name = "IEEE1275 video driver",
.init = grub_video_ieee1275_init,
.fini = grub_video_ieee1275_fini,
.setup = grub_video_ieee1275_setup,
.get_info = grub_video_fb_get_info,
.get_info_and_fini = grub_video_ieee1275_get_info_and_fini,
.set_palette = grub_video_ieee1275_set_palette,
.get_palette = grub_video_fb_get_palette,
.set_viewport = grub_video_fb_set_viewport,
.get_viewport = grub_video_fb_get_viewport,
.map_color = grub_video_fb_map_color,
.map_rgb = grub_video_fb_map_rgb,
.map_rgba = grub_video_fb_map_rgba,
.unmap_color = grub_video_fb_unmap_color,
.fill_rect = grub_video_fb_fill_rect,
.blit_bitmap = grub_video_fb_blit_bitmap,
.blit_render_target = grub_video_fb_blit_render_target,
.scroll = grub_video_fb_scroll,
.swap_buffers = grub_video_ieee1275_swap_buffers,
.create_render_target = grub_video_fb_create_render_target,
.delete_render_target = grub_video_fb_delete_render_target,
.set_active_render_target = grub_video_ieee1275_set_active_render_target,
.get_active_render_target = grub_video_fb_get_active_render_target,
.next = 0
};
GRUB_MOD_INIT(ieee1275_fb)
{
find_display ();
if (display)
grub_video_register (&grub_video_ieee1275_adapter);
}
GRUB_MOD_FINI(ieee1275_fb)
{
if (restore_needed)
{
set_video_mode (old_width, old_height);
restore_needed = 0;
}
if (display)
grub_video_unregister (&grub_video_ieee1275_adapter);
grub_free (display);
}