All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] turn grub-emu into a port
@ 2009-10-26 18:10 Robert Millan
  2009-10-30 22:49 ` Robert Millan
  2009-10-30 23:08 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 7+ messages in thread
From: Robert Millan @ 2009-10-26 18:10 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]


This turns grub-emu into a port in order to make it easier to port GRUB to
new CPUs.  A porter can then do the CPU port without having to worry about
firmware and/or hardware drivers initially.

Patch attached.  Branch is available in
bzr+ssh://bzr.savannah.gnu.org/grub/people/robertmh/grub-emu/

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

[-- Attachment #2: grub-emu.diff --]
[-- Type: text/x-diff, Size: 43024 bytes --]

=== modified file 'Makefile.in'
--- Makefile.in	2009-10-26 18:01:19 +0000
+++ Makefile.in	2009-10-26 18:06:56 +0000
@@ -104,7 +104,6 @@
 UNIFONT_BDF = @UNIFONT_BDF@
 
 # Options.
-enable_grub_emu = @enable_grub_emu@
 enable_grub_emu_usb = @enable_grub_emu_usb@
 enable_grub_fstest = @enable_grub_fstest@
 enable_grub_pe2elf = @enable_grub_pe2elf@
@@ -115,9 +114,7 @@
 
 ### General variables.
 
-RMKFILES = $(addprefix conf/,common.rmk i386-coreboot.rmk i386-efi.rmk \
-	i386-qemu.rmk i386-ieee1275.rmk i386-pc.rmk i386.rmk powerpc-ieee1275.rmk \
-	sparc64-ieee1275.rmk x86_64-efi.rmk)
+RMKFILES = $(wildcard conf/*.rmk)
 
 MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES))
 
@@ -148,7 +145,11 @@
 	  $(RUBY) $(srcdir)/genmk.rb < $< > $@; \
 	fi
 
+ifeq ($(platform), emu)
+include $(srcdir)/conf/any-emu.mk
+else
 include $(srcdir)/conf/$(target_cpu)-$(platform).mk
+endif
 
 ### General targets.
 

=== modified file 'commands/acpi.c'
--- commands/acpi.c	2009-09-14 15:38:30 +0000
+++ commands/acpi.c	2009-10-26 16:59:22 +0000
@@ -26,7 +26,6 @@
 #include <grub/gzio.h>
 #include <grub/acpi.h>
 #include <grub/mm.h>
-#include <grub/machine/machine.h>
 #include <grub/machine/memory.h>
 #include <grub/memory.h>
 

=== modified file 'commands/halt.c'
--- commands/halt.c	2009-05-04 03:49:08 +0000
+++ commands/halt.c	2009-10-26 16:59:22 +0000
@@ -18,7 +18,6 @@
  */
 
 #include <grub/dl.h>
-#include <grub/machine/machine.h>
 #include <grub/command.h>
 
 #if defined(GRUB_MACHINE_IEEE1275)

=== modified file 'commands/reboot.c'
--- commands/reboot.c	2009-05-04 03:49:08 +0000
+++ commands/reboot.c	2009-10-26 16:59:22 +0000
@@ -18,7 +18,6 @@
  */
 
 #include <grub/dl.h>
-#include <grub/machine/machine.h>
 #include <grub/command.h>
 
 #if defined(GRUB_MACHINE_IEEE1275)

=== added file 'conf/any-emu.rmk'
--- conf/any-emu.rmk	1970-01-01 00:00:00 +0000
+++ conf/any-emu.rmk	2009-10-26 17:17:19 +0000
@@ -0,0 +1,87 @@
+# -*- makefile -*-
+
+sbin_UTILITIES += grub-emu
+util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
+grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c	\
+	commands/configfile.c commands/echo.c commands/help.c		\
+	commands/handler.c commands/ls.c commands/test.c 		\
+	commands/search.c commands/blocklist.c commands/hexdump.c	\
+	lib/hexdump.c commands/halt.c commands/reboot.c			\
+	lib/envblk.c commands/loadenv.c					\
+	commands/gptsync.c commands/probe.c commands/xnu_uuid.c		\
+	commands/password.c commands/keystatus.c			\
+	disk/host.c disk/loopback.c disk/scsi.c				\
+	fs/fshelp.c 	\
+	\
+	io/gzio.c							\
+	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
+	kern/err.c kern/list.c kern/handler.c				\
+	kern/command.c kern/corecmd.c commands/extcmd.c	kern/file.c	\
+	kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c	\
+	kern/partition.c kern/reader.c kern/term.c			\
+	kern/rescue_reader.c kern/rescue_parser.c			\
+	lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c	\
+	normal/handler.c normal/auth.c normal/autofs.c			\
+	normal/completion.c normal/main.c normal/color.c		\
+	normal/menu.c normal/menu_entry.c normal/menu_viewer.c		\
+	normal/menu_text.c						\
+	script/sh/main.c script/sh/execute.c script/sh/function.c	\
+	script/sh/lexer.c script/sh/script.c grub_script.tab.c		\
+	partmap/amiga.c	partmap/apple.c partmap/msdos.c partmap/sun.c	\
+	partmap/acorn.c partmap/gpt.c					\
+	\
+	fs/affs.c fs/cpio.c  fs/fat.c fs/ext2.c fs/hfs.c		\
+	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c		\
+	fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c			\
+	fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c		\
+	fs/befs.c fs/befs_be.c fs/tar.c				\
+	\
+	util/console.c util/hostfs.c util/grub-emu.c util/misc.c	\
+	util/hostdisk.c util/getroot.c					\
+	\
+	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
+	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
+	commands/parttool.c parttool/msdospart.c			\
+	grub_emu_init.c
+
+ifeq ($(target_cpu), i386)
+grub_emu_SOURCES += commands/i386/cpuid.c
+endif
+
+grub_emu_LDFLAGS = $(LIBCURSES)
+
+ifeq ($(enable_grub_emu_usb), yes)
+grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c	\
+		commands/usbtest.c
+grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
+endif
+
+grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
+	rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
+DISTCLEANFILES += grub_emu_init.lst
+
+grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh
+	rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
+DISTCLEANFILES += grub_emu_init.h
+
+grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h
+	rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
+DISTCLEANFILES += grub_emu_init.c
+
+
+
+
+# FIXME: this could be shared with common.rmk
+
+# For grub-mkfont.
+ifeq ($(enable_grub_mkfont), yes)
+bin_UTILITIES += grub-mkfont
+grub_mkfont_SOURCES = util/grub-mkfont.c util/misc.c
+grub_mkfont_CFLAGS = $(freetype_cflags)
+grub_mkfont_LDFLAGS = $(freetype_libs)
+endif
+
+grub_script.tab.c grub_script.tab.h: script/sh/parser.y
+	$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/sh/parser.y
+DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
+script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h

=== modified file 'conf/common.rmk'
--- conf/common.rmk	2009-10-26 17:59:33 +0000
+++ conf/common.rmk	2009-10-26 18:06:56 +0000
@@ -64,19 +64,6 @@
 	$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/sh/parser.y
 DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
 
-# For grub-emu.
-grub_emu_init.lst: geninit.sh $(filter-out grub_emu_init.c,$(grub_emu_SOURCES))
-	rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
-DISTCLEANFILES += grub_emu_init.lst
-
-grub_emu_init.h: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninitheader.sh
-	rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
-DISTCLEANFILES += grub_emu_init.h
-
-grub_emu_init.c: grub_emu_init.lst $(filter-out grub_emu_init.c,$(grub_emu_SOURCES)) geninit.sh grub_emu_init.h
-	rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
-DISTCLEANFILES += grub_emu_init.c
-
 # For grub-probe.
 grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
 	rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@

=== modified file 'conf/i386-coreboot.rmk'
--- conf/i386-coreboot.rmk	2009-10-26 17:59:33 +0000
+++ conf/i386-coreboot.rmk	2009-10-26 18:06:56 +0000
@@ -94,60 +94,11 @@
 
 # Utilities.
 sbin_UTILITIES = grub-mkdevicemap
-ifeq ($(enable_grub_emu), yes)
-sbin_UTILITIES += grub-emu
-endif
 
 # For grub-mkdevicemap.
 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
-# For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
-grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c	\
-	commands/configfile.c commands/echo.c commands/help.c		\
-	commands/handler.c commands/ls.c commands/test.c 		\
-	commands/search.c commands/blocklist.c commands/hexdump.c	\
-	commands/gptsync.c commands/probe.c commands/xnu_uuid.c		\
-	commands/password.c commands/keystatus.c			\
-	lib/hexdump.c commands/i386/cpuid.c				\
-	lib/envblk.c commands/loadenv.c					\
-	disk/host.c disk/loopback.c					\
-	\
-	fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c  fs/hfs.c		\
-	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c		\
-	fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c			\
-	fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c		\
-	fs/befs.c fs/befs_be.c fs/tar.c				\
-	\
-	fs/fshelp.c							\
-	io/gzio.c							\
-	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
-	kern/err.c kern/list.c kern/handler.c				\
-	kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c	\
-	kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c	\
-	kern/partition.c kern/reader.c kern/term.c			\
-	kern/rescue_reader.c kern/rescue_parser.c                       \
-	lib/arg.c normal/cmdline.c normal/misc.c			\
-	normal/handler.c normal/auth.c normal/autofs.c			\
-	normal/completion.c normal/datetime.c normal/main.c 		\
-	normal/menu_text.c						\
-	normal/menu.c normal/menu_entry.c normal/menu_viewer.c		\
-	normal/color.c							\
-	script/sh/main.c script/sh/execute.c script/sh/function.c       \
-	script/sh/lexer.c script/sh/script.c grub_script.tab.c          \
-	partmap/amiga.c	partmap/apple.c partmap/msdos.c partmap/sun.c	\
-	partmap/acorn.c partmap/gpt.c					\
-	util/console.c util/hostfs.c util/grub-emu.c util/misc.c	\
-	util/hostdisk.c util/getroot.c					\
-	\
-	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
-	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
-	commands/parttool.c parttool/msdospart.c				\
-	grub_emu_init.c
-
-grub_emu_LDFLAGS = $(LIBCURSES)
-
 sbin_SCRIPTS += grub-install
 grub_install_SOURCES = util/i386/pc/grub-install.in
 

=== modified file 'conf/i386-efi.rmk'
--- conf/i386-efi.rmk	2009-10-26 17:59:33 +0000
+++ conf/i386-efi.rmk	2009-10-26 18:06:56 +0000
@@ -9,9 +9,6 @@
 # Utilities.
 bin_UTILITIES = grub-mkimage
 sbin_UTILITIES = grub-mkdevicemap
-#ifeq ($(enable_grub_emu), yes)
-#sbin_UTILITIES += grub-emu
-#endif
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
@@ -30,51 +27,6 @@
 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
-# For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
-grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c 	\
-	commands/configfile.c commands/help.c				\
-	commands/handler.c commands/ls.c commands/test.c 		\
-	commands/search.c commands/hexdump.c lib/hexdump.c		\
-	commands/halt.c commands/reboot.c commands/keystatus.c		\
-	commands/i386/cpuid.c						\
-	commands/password.c						\
-	lib/envblk.c commands/loadenv.c					\
-	disk/loopback.c							\
-	\
-	fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c			\
-	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c		\
-	fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c			\
-	fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c		\
-	fs/befs.c fs/befs_be.c fs/tar.c				\
-	\
-	io/gzio.c							\
-	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
-	kern/err.c kern/list.c kern/handler.c				\
-	kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c	\
-	kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c	\
-	kern/partition.c kern/reader.c kern/term.c			\
-	kern/rescue_reader.c kern/rescue_parser.c                       \
-	lib/arg.c normal/cmdline.c normal/command.c normal/datetime.c 	\
-	normal/auth.c normal/autofs.c					\
-	normal/completion.c normal/context.c normal/main.c		\
-	normal/menu.c normal/menu_entry.c normal/menu_viewer.c		\
-	normal/menu_text.c						\
-	normal/color.c							\
-	script/sh/main.c script/sh/execute.c script/sh/function.c       \
-	script/sh/lexer.c script/sh/script.c grub_script.tab.c          \
-	partmap/amiga.c	partmap/apple.c partmap/msdos.c partmap/sun.c	\
-	partmap/acorn.c partmap/gpt.c					\
-	util/console.c util/hostfs.c util/grub-emu.c util/misc.c	\
-	util/hostdisk.c util/getroot.c					\
-	\
-	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
-	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
-	commands/parttool.c parttool/msdospart.c				\
-	grub_emu_init.c
-
-grub_emu_LDFLAGS = $(LIBCURSES)
-
 # Scripts.
 sbin_SCRIPTS = grub-install
 

=== modified file 'conf/i386-ieee1275.rmk'
--- conf/i386-ieee1275.rmk	2009-10-26 17:59:33 +0000
+++ conf/i386-ieee1275.rmk	2009-10-26 18:06:56 +0000
@@ -48,59 +48,11 @@
 
 # Utilities.
 sbin_UTILITIES = grub-mkdevicemap
-ifeq ($(enable_grub_emu), yes)
-sbin_UTILITIES += grub-emu
-endif
 
 # For grub-mkdevicemap.
 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
-# For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
-grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c	\
-	commands/configfile.c commands/echo.c commands/help.c		\
-	commands/handler.c commands/ls.c commands/test.c 		\
-	commands/search.c commands/blocklist.c commands/hexdump.c	\
-	lib/hexdump.c commands/halt.c commands/reboot.c			\
-	lib/envblk.c commands/loadenv.c					\
-	commands/gptsync.c commands/probe.c  commands/xnu_uuid.c	\
-	commands/i386/cpuid.c	\
-	commands/password.c commands/keystatus.c			\
-	disk/host.c disk/loopback.c					\
-	\
-	fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c			\
-	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c		\
-	fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c			\
-	fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c	\
-	fs/befs_be.c fs/tar.c				\
-	\
-	fs/fshelp.c							\
-	io/gzio.c							\
-	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
-	kern/err.c kern/list.c kern/handler.c				\
-	kern/command.c kern/corecmd.c commands/extcmd.c	kern/file.c 	\
-	kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c	\
-	kern/partition.c kern/reader.c kern/term.c			\
-	kern/rescue_reader.c kern/rescue_parser.c 			\
-	lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c	\
-	normal/handler.c normal/auth.c normal/autofs.c			\
-	normal/completion.c normal/main.c normal/menu_text.c		\
-	normal/menu.c normal/menu_entry.c normal/menu_viewer.c		\
-	normal/color.c							\
-	script/sh/main.c script/sh/execute.c script/sh/function.c	\
-	script/sh/lexer.c script/sh/script.c grub_script.tab.c		\
-	partmap/amiga.c	partmap/apple.c partmap/msdos.c partmap/sun.c	\
-	partmap/acorn.c partmap/gpt.c					\
-	util/console.c util/hostfs.c util/grub-emu.c util/misc.c	\
-	util/hostdisk.c util/getroot.c					\
-	\
-	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
-	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
-	grub_emu_init.c
-
-grub_emu_LDFLAGS = $(LIBCURSES)
-
 # Scripts.
 sbin_SCRIPTS = grub-install
 

=== modified file 'conf/i386-pc.rmk'
--- conf/i386-pc.rmk	2009-10-26 17:59:33 +0000
+++ conf/i386-pc.rmk	2009-10-26 18:06:56 +0000
@@ -81,9 +81,6 @@
 # Utilities.
 bin_UTILITIES = grub-mkimage
 sbin_UTILITIES = grub-setup grub-mkdevicemap
-ifeq ($(enable_grub_emu), yes)
-sbin_UTILITIES += grub-emu
-endif
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
@@ -114,59 +111,6 @@
 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
-# For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
-grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c	\
-	commands/configfile.c commands/echo.c commands/help.c		\
-	commands/handler.c commands/ls.c commands/test.c 		\
-	commands/search.c commands/blocklist.c commands/hexdump.c	\
-	lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c		\
-	lib/envblk.c commands/loadenv.c					\
-	commands/gptsync.c commands/probe.c commands/xnu_uuid.c		\
-	commands/i386/cpuid.c	\
-	commands/password.c commands/keystatus.c			\
-	disk/host.c disk/loopback.c disk/scsi.c				\
-	fs/fshelp.c 	\
-	\
-	io/gzio.c							\
-	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
-	kern/err.c kern/list.c kern/handler.c				\
-	kern/command.c kern/corecmd.c commands/extcmd.c	kern/file.c	\
-	kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c	\
-	kern/partition.c kern/reader.c kern/term.c			\
-	kern/rescue_reader.c kern/rescue_parser.c			\
-	lib/arg.c normal/cmdline.c normal/datetime.c normal/misc.c	\
-	normal/handler.c normal/auth.c normal/autofs.c				\
-	normal/completion.c normal/main.c normal/color.c		\
-	normal/menu.c normal/menu_entry.c normal/menu_viewer.c		\
-	normal/menu_text.c						\
-	script/sh/main.c script/sh/execute.c script/sh/function.c	\
-	script/sh/lexer.c script/sh/script.c grub_script.tab.c		\
-	partmap/amiga.c	partmap/apple.c partmap/msdos.c partmap/sun.c	\
-	partmap/acorn.c partmap/gpt.c					\
-	\
-	fs/affs.c fs/cpio.c  fs/fat.c fs/ext2.c fs/hfs.c		\
-	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c		\
-	fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c			\
-	fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c		\
-	fs/befs.c fs/befs_be.c fs/tar.c				\
-	\
-	util/console.c util/hostfs.c util/grub-emu.c util/misc.c	\
-	util/hostdisk.c util/getroot.c					\
-	\
-	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
-	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
-	commands/parttool.c parttool/msdospart.c				\
-	grub_emu_init.c
-
-grub_emu_LDFLAGS = $(LIBCURSES)
-
-ifeq ($(enable_grub_emu_usb), yes)
-grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c	\
-		commands/usbtest.c
-grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
-endif
-
 # Scripts.
 sbin_SCRIPTS = grub-install
 bin_SCRIPTS = grub-mkrescue

=== modified file 'conf/powerpc-ieee1275.rmk'
--- conf/powerpc-ieee1275.rmk	2009-10-26 17:59:33 +0000
+++ conf/powerpc-ieee1275.rmk	2009-10-26 18:06:56 +0000
@@ -29,60 +29,11 @@
 
 # Utilities.
 sbin_UTILITIES = grub-mkdevicemap
-ifeq ($(enable_grub_emu), yes)
-sbin_UTILITIES += grub-emu
-endif
 
 # For grub-mkdevicemap.
 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
-# For grub-emu
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
-grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c 	\
-	commands/configfile.c commands/help.c				\
-	commands/search.c commands/handler.c commands/test.c 		\
-	commands/ls.c commands/blocklist.c commands/hexdump.c		\
-	lib/hexdump.c commands/halt.c commands/reboot.c 		\
-	lib/envblk.c commands/loadenv.c					\
-	commands/gptsync.c commands/probe.c commands/xnu_uuid.c		\
-	commands/password.c commands/keystatus.c			\
-	disk/loopback.c							\
-	\
-	fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c			\
-	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c		\
-	fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c			\
-	fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c		\
-	fs/befs.c fs/befs_be.c fs/tar.c				\
-	\
-	io/gzio.c							\
-	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
-	kern/err.c kern/file.c kern/fs.c commands/boot.c kern/main.c	\
-	kern/misc.c kern/parser.c kern/partition.c kern/reader.c	\
-	kern/rescue_reader.c kern/rescue_parser.c			\
-	kern/term.c kern/list.c kern/handler.c fs/fshelp.c		\
-	kern/command.c kern/corecmd.c commands/extcmd.c			\
-	lib/arg.c normal/cmdline.c normal/datetime.c 			\
-	normal/completion.c normal/misc.c		 		\
-	normal/handler.c normal/auth.c normal/autofs.c normal/main.c	\
-	normal/menu.c 							\
-	normal/menu_text.c						\
-	normal/menu_entry.c normal/menu_viewer.c 	 		\
-	normal/color.c							\
-	script/sh/main.c script/sh/execute.c script/sh/function.c	\
-	script/sh/lexer.c script/sh/script.c				\
-	partmap/amiga.c	partmap/apple.c partmap/msdos.c partmap/sun.c	\
-	partmap/acorn.c							\
-	util/console.c util/hostfs.c util/grub-emu.c util/misc.c	\
-	util/hostdisk.c util/getroot.c					\
-	\
-	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
-	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
-	commands/parttool.c parttool/msdospart.c				\
-	grub_script.tab.c grub_emu_init.c
-
-grub_emu_LDFLAGS = $(LIBCURSES)
-
 kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
 	kern/ieee1275/ieee1275.c kern/main.c kern/device.c 		\
 	kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c 		\

=== modified file 'conf/sparc64-ieee1275.rmk'
--- conf/sparc64-ieee1275.rmk	2009-10-26 17:59:33 +0000
+++ conf/sparc64-ieee1275.rmk	2009-10-26 18:06:56 +0000
@@ -59,9 +59,6 @@
 # Utilities.
 bin_UTILITIES = grub-mkimage
 sbin_UTILITIES = grub-setup grub-mkdevicemap grub-ofpathname
-ifeq ($(enable_grub_emu), yes)
-sbin_UTILITIES += grub-emu
-endif
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
@@ -95,52 +92,6 @@
 grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
 	util/ieee1275/ofpath.c util/misc.c
 
-# For grub-emu
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
-grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c 	\
-	commands/configfile.c commands/help.c				\
-	commands/search.c commands/handler.c commands/test.c 		\
-	commands/ls.c commands/blocklist.c commands/hexdump.c		\
-	lib/hexdump.c commands/halt.c commands/reboot.c 		\
-	lib/envblk.c commands/loadenv.c					\
-	commands/gptsync.c commands/probe.c commands/xnu_uuid.c		\
-	commands/password.c commands/keystatus.c			\
-	disk/loopback.c							\
-	\
-	fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c			\
-	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c		\
-	fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c			\
-	fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c		\
-	fs/befs.c fs/befs_be.c fs/tar.c				\
-	\
-	io/gzio.c							\
-	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
-	kern/err.c kern/file.c kern/fs.c commands/boot.c kern/main.c	\
-	kern/misc.c kern/parser.c kern/partition.c kern/reader.c	\
-	kern/rescue_reader.c kern/rescue_parser.c			\
-	kern/term.c kern/list.c kern/handler.c fs/fshelp.c		\
-	kern/command.c kern/corecmd.c commands/extcmd.c			\
-	lib/arg.c normal/cmdline.c normal/datetime.c 			\
-	normal/completion.c normal/misc.c		 		\
-	normal/handler.c normal/auth.c normal/autofs.c normal/main.c	\
-	normal/menu.c 							\
-	normal/menu_text.c						\
-	normal/menu_entry.c normal/menu_viewer.c 	 		\
-	normal/color.c							\
-	script/sh/main.c script/sh/execute.c script/sh/function.c	\
-	script/sh/lexer.c script/sh/script.c				\
-	partmap/amiga.c	partmap/apple.c partmap/msdos.c partmap/sun.c	\
-	partmap/acorn.c							\
-	util/console.c util/hostfs.c util/grub-emu.c util/misc.c	\
-	util/hostdisk.c util/getroot.c					\
-	\
-	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
-	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
-	commands/parttool.c parttool/msdospart.c				\
-	grub_script.tab.c grub_emu_init.c
-
-grub_emu_LDFLAGS = $(LIBCURSES)
-
 # Scripts.
 sbin_SCRIPTS = grub-install
 

=== modified file 'conf/x86_64-efi.rmk'
--- conf/x86_64-efi.rmk	2009-10-26 17:59:33 +0000
+++ conf/x86_64-efi.rmk	2009-10-26 18:06:56 +0000
@@ -9,9 +9,6 @@
 # Utilities.
 bin_UTILITIES = grub-mkimage
 sbin_UTILITIES = grub-mkdevicemap
-#ifeq ($(enable_grub_emu), yes)
-#sbin_UTILITIES += grub-emu
-#endif
 
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
@@ -29,50 +26,6 @@
 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
-# For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
-grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c 	\
-	commands/configfile.c commands/help.c				\
-	commands/handler.c commands/ls.c commands/test.c 		\
-	commands/search.c commands/hexdump.c lib/hexdump.c		\
-	commands/halt.c commands/reboot.c				\
-	commands/i386/cpuid.c						\
-	commands/password.c commands/keystatus.c			\
-	lib/envblk.c commands/loadenv.c					\
-	disk/loopback.c							\
-	\
-	fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c			\
-	fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c		\
-	fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c			\
-	fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c					\
-	\
-	io/gzio.c							\
-	kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c	\
-	kern/err.c kern/list.c kern/handler.c				\
-	kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c 	\
-	kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c	\
-	kern/partition.c kern/readerescue.c kern/term.c			\
-	lib/arg.c normal/cmdline.c normal/misc.c normal/auth.c		\
-	normal/autofs.c	\
-	normal/completion.c normal/datetime.c normal/context.c 		\
-	normal/main.c		\
-	normal/menu.c normal/menu_entry.c normal/menu_viewer.c		\
-	normal/menu_text.c						\
-	normal/color.c							\
-	script/sh/main.c script/sh/execute.c script/sh/function.c	\
-	script/sh/lexer.c script/sh/script.c grub_script.tab.c		\
-	partmap/amiga.c	partmap/apple.c partmap/msdos.c partmap/sun.c	\
-	partmap/acorn.c partmap/gpt.c					\
-	util/console.c util/hostfs.c util/grub-emu.c util/misc.c	\
-	util/hostdisk.c util/getroot.c					\
-	\
-	disk/raid.c disk/raid5_recover.c disk/raid6_recover.c		\
-	disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c		\
-	commands/parttool.c parttool/msdospart.c				\
-	grub_emu_init.c
-
-grub_emu_LDFLAGS = $(LIBCURSES)
-
 # Scripts.
 sbin_SCRIPTS = grub-install
 

=== modified file 'configure.ac'
--- configure.ac	2009-10-26 00:40:53 +0000
+++ configure.ac	2009-10-26 17:46:52 +0000
@@ -89,6 +89,7 @@
   i386-qemu) ;;
   powerpc-ieee1275) ;;
   sparc64-ieee1275) ;;
+  *-emu) ;;
   *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
 esac
 
@@ -111,6 +112,15 @@
   cygwin)			host_kernel=windows ;;
 esac
 
+case "$platform" in
+  coreboot)	CFLAGS="$CFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
+  efi)		CFLAGS="$CFLAGS -DGRUB_MACHINE_EFI=1" ;;
+  ieee1275)	CFLAGS="$CFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
+  qemu)		CFLAGS="$CFLAGS -DGRUB_MACHINE_QEMU=1" ;;
+  pc)		CFLAGS="$CFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
+  emu)		CFLAGS="$CFLAGS -DGRUB_MACHINE_EMU=1" ;;
+esac
+
 AC_SUBST(host_cpu)
 AC_SUBST(host_os)
 AC_SUBST(host_kernel)
@@ -500,40 +510,28 @@
               [AC_DEFINE([MM_DEBUG], [1],
                          [Define to 1 if you enable memory manager debugging.])])
 
-AC_ARG_ENABLE([grub-emu],
-	      [AS_HELP_STRING([--enable-grub-emu],
-                             [build and install the `grub-emu' debugging utility (default=guessed)])])
 AC_ARG_ENABLE([grub-emu-usb],
 	      [AS_HELP_STRING([--enable-grub-emu-usb],
                              [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
-if test x"$enable_grub_emu" = xno ; then
-  grub_emu_excuse="explicitly disabled"
-fi
 
-  [# Check for curses libraries.]
-[if [ x"$grub_emu_excuse" = x ]; then ]
+if test "$platform" = emu; then
+  missing_ncurses=
+[# Check for curses libraries.]
   AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
     [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
-      [grub_emu_excuse=["need (n)curses libraries"]])])
+      [missing_ncurses=[true]])])
   AC_SUBST([LIBCURSES])
-[fi]
-[if [ x"$grub_emu_excuse" = x ]; then ]
+[if [ x"$missing_ncurses" = x ]; then ]
   [# Check for headers.]
   AC_CHECK_HEADERS([ncurses/curses.h], [],
     [AC_CHECK_HEADERS([ncurses.h], [],
       [AC_CHECK_HEADERS([curses.h], [],
-	[grub_emu_excuse=["need (n)curses headers"]])])])
+	[missing_ncurses=[true]])])])
 [fi]
+if test x"$missing_ncurses" = xtrue ; then
+  AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
+fi
 
-if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
-  AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled])
-fi
-if test x"$grub_emu_excuse" = x ; then
-enable_grub_emu=yes
-else
-enable_grub_emu=no
-grub_emu_usb_excuse="grub-emu isn't built"
-fi
 if test x"$enable_grub_emu_usb" = xno ; then
   grub_emu_usb_excuse="explicitly disabled"
 fi
@@ -556,9 +554,8 @@
 else
 enable_grub_emu_usb=no
 fi
-
-AC_SUBST([enable_grub_emu])
 AC_SUBST([enable_grub_emu_usb])
+fi
 
 AC_ARG_ENABLE([grub-fstest],
 	      [AS_HELP_STRING([--enable-grub-fstest],
@@ -606,14 +603,18 @@
 # Output files.
 grub_CHECK_LINK_DIR
 if test x"$link_dir" = xyes ; then
-  AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
-	include/grub/machine:include/grub/$target_cpu/$platform])
+  AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
+  if test "$platform" != emu ; then
+    AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
+  fi
 else
   mkdir -p include/grub 2>/dev/null
   rm -rf include/grub/cpu
   cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
-  rm -rf include/grub/machine
-  cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
+  if test "$platform" != emu ; then
+    rm -rf include/grub/machine
+    cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
+  fi
 fi
 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
@@ -622,16 +623,13 @@
 echo "*******************************************************"
 echo GRUB2 will be compiled with following components:
 echo Platform: "$target_cpu"-"$platform"
-if [ x"$grub_emu_excuse" = x ]; then
-echo grub-emu: Yes
-else
-echo grub-emu: No "($grub_emu_excuse)"
-fi
+if [ x"$platform" = xemu ]; then
 if [ x"$grub_emu_usb_excuse" = x ]; then
 echo USB support for grub-emu: Yes
 else
 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
 fi
+fi
 if [ x"$enable_mm_debug" = xyes ]; then
 echo With memory debugging: Yes
 else

=== modified file 'include/grub/autoefi.h'
--- include/grub/autoefi.h	2009-06-10 21:04:23 +0000
+++ include/grub/autoefi.h	2009-10-26 16:59:25 +0000
@@ -21,7 +21,6 @@
 #ifndef GRUB_AUTOEFI_HEADER
 #define GRUB_AUTOEFI_HEADER	1
 
-#include <grub/machine/machine.h>
 
 #ifdef GRUB_MACHINE_EFI
 # include <grub/efi/efi.h>

=== modified file 'include/grub/i386/at_keyboard.h'
--- include/grub/i386/at_keyboard.h	2009-09-24 13:15:51 +0000
+++ include/grub/i386/at_keyboard.h	2009-10-26 16:59:23 +0000
@@ -19,7 +19,6 @@
 #ifndef GRUB_CPU_AT_KEYBOARD_HEADER
 #define GRUB_CPU_AT_KEYBOARD_HEADER	1
 
-#include <grub/machine/machine.h>
 
 #define SHIFT_L		0x2a
 #define SHIFT_R		0x36

=== removed file 'include/grub/i386/coreboot/machine.h'
--- include/grub/i386/coreboot/machine.h	2009-07-13 23:57:11 +0000
+++ include/grub/i386/coreboot/machine.h	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2007  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_MACHINE_HEADER
-#define GRUB_MACHINE_MACHINE_HEADER	1
-
-#define GRUB_MACHINE_COREBOOT	1
-
-#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

=== removed file 'include/grub/i386/efi/machine.h'
--- include/grub/i386/efi/machine.h	2007-11-10 20:23:14 +0000
+++ include/grub/i386/efi/machine.h	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2007  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_MACHINE_HEADER
-#define GRUB_MACHINE_MACHINE_HEADER	1
-
-#define GRUB_MACHINE_EFI	1
-
-#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

=== removed file 'include/grub/i386/ieee1275/machine.h'
--- include/grub/i386/ieee1275/machine.h	2008-01-23 09:57:26 +0000
+++ include/grub/i386/ieee1275/machine.h	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2008  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_MACHINE_HEADER
-#define GRUB_MACHINE_MACHINE_HEADER	1
-
-#define GRUB_MACHINE_IEEE1275	1
-
-#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

=== modified file 'include/grub/i386/kernel.h'
--- include/grub/i386/kernel.h	2009-06-22 20:40:28 +0000
+++ include/grub/i386/kernel.h	2009-10-26 16:59:23 +0000
@@ -19,7 +19,6 @@
 #ifndef GRUB_KERNEL_CPU_HEADER
 #define GRUB_KERNEL_CPU_HEADER	1
 
-#include <grub/machine/machine.h>
 
 #ifdef GRUB_MACHINE_IEEE1275
 #define GRUB_MOD_ALIGN	0x1000

=== modified file 'include/grub/i386/loader.h'
--- include/grub/i386/loader.h	2009-06-20 14:11:45 +0000
+++ include/grub/i386/loader.h	2009-10-26 16:59:24 +0000
@@ -22,7 +22,6 @@
 #include <grub/types.h>
 #include <grub/err.h>
 #include <grub/symbol.h>
-#include <grub/machine/machine.h>
 
 extern grub_addr_t EXPORT_VAR(grub_os_area_addr);
 extern grub_size_t EXPORT_VAR(grub_os_area_size);

=== removed file 'include/grub/i386/pc/machine.h'
--- include/grub/i386/pc/machine.h	2007-11-10 20:23:14 +0000
+++ include/grub/i386/pc/machine.h	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2007  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_MACHINE_HEADER
-#define GRUB_MACHINE_MACHINE_HEADER	1
-
-#define GRUB_MACHINE_PCBIOS	1
-
-#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

=== modified file 'include/grub/i386/pc/memory.h'
--- include/grub/i386/pc/memory.h	2009-08-28 13:20:34 +0000
+++ include/grub/i386/pc/memory.h	2009-10-26 16:59:23 +0000
@@ -21,7 +21,6 @@
 #define GRUB_MEMORY_MACHINE_HEADER	1
 
 #include <grub/symbol.h>
-#include <grub/machine/machine.h>
 #ifndef ASM_FILE
 #include <grub/types.h>
 #include <grub/err.h>

=== removed file 'include/grub/i386/qemu/machine.h'
--- include/grub/i386/qemu/machine.h	2009-06-27 11:18:10 +0000
+++ include/grub/i386/qemu/machine.h	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2009  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_MACHINE_HEADER
-#define GRUB_MACHINE_MACHINE_HEADER	1
-
-#define GRUB_MACHINE_QEMU	1
-
-#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

=== removed file 'include/grub/powerpc/ieee1275/machine.h'
--- include/grub/powerpc/ieee1275/machine.h	2007-11-10 20:23:14 +0000
+++ include/grub/powerpc/ieee1275/machine.h	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2007  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_MACHINE_HEADER
-#define GRUB_MACHINE_MACHINE_HEADER	1
-
-#define GRUB_MACHINE_IEEE1275	1
-
-#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

=== removed file 'include/grub/sparc64/ieee1275/machine.h'
--- include/grub/sparc64/ieee1275/machine.h	2007-11-10 20:23:14 +0000
+++ include/grub/sparc64/ieee1275/machine.h	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2007  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_MACHINE_HEADER
-#define GRUB_MACHINE_MACHINE_HEADER	1
-
-#define GRUB_MACHINE_IEEE1275	1
-
-#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

=== modified file 'include/grub/time.h'
--- include/grub/time.h	2008-08-05 11:54:37 +0000
+++ include/grub/time.h	2009-10-26 17:28:39 +0000
@@ -21,8 +21,13 @@
 
 #include <grub/types.h>
 #include <grub/symbol.h>
+#include <grub/cpu/time.h>
+
+#ifdef GRUB_MACHINE_EMU
+#define GRUB_TICKS_PER_SECOND 100000
+#else
 #include <grub/machine/time.h>
-#include <grub/cpu/time.h>
+#endif
 
 void EXPORT_FUNC(grub_millisleep) (grub_uint32_t ms);
 grub_uint64_t EXPORT_FUNC(grub_get_time_ms) (void);

=== removed file 'include/grub/x86_64/efi/machine.h'
--- include/grub/x86_64/efi/machine.h	2008-07-17 09:50:26 +0000
+++ include/grub/x86_64/efi/machine.h	1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
-/*
- *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2007  Free Software Foundation, Inc.
- *
- *  GRUB is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  GRUB is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef GRUB_MACHINE_MACHINE_HEADER
-#define GRUB_MACHINE_MACHINE_HEADER	1
-
-#define GRUB_MACHINE_EFI	1
-
-#endif /* ! GRUB_MACHINE_MACHINE_HEADER */

=== modified file 'kern/dl.c'
--- kern/dl.c	2009-07-21 20:18:44 +0000
+++ kern/dl.c	2009-10-26 16:59:18 +0000
@@ -31,7 +31,6 @@
 #include <grub/file.h>
 #include <grub/env.h>
 #include <grub/cache.h>
-#include <grub/machine/machine.h>
 
 /* Platforms where modules are in a readonly area of memory.  */
 #if defined(GRUB_MACHINE_QEMU)

=== modified file 'kern/i386/coreboot/init.c'
--- kern/i386/coreboot/init.c	2009-06-27 11:18:10 +0000
+++ kern/i386/coreboot/init.c	2009-10-26 16:59:18 +0000
@@ -23,7 +23,6 @@
 #include <grub/machine/memory.h>
 #include <grub/machine/console.h>
 #include <grub/machine/kernel.h>
-#include <grub/machine/machine.h>
 #include <grub/types.h>
 #include <grub/err.h>
 #include <grub/dl.h>

=== modified file 'loader/i386/bsd.c'
--- loader/i386/bsd.c	2009-10-16 20:21:12 +0000
+++ loader/i386/bsd.c	2009-10-26 16:59:21 +0000
@@ -23,7 +23,6 @@
 #include <grub/machine/init.h>
 #include <grub/machine/memory.h>
 #include <grub/memory.h>
-#include <grub/machine/machine.h>
 #include <grub/file.h>
 #include <grub/err.h>
 #include <grub/dl.h>

=== modified file 'loader/i386/linux.c'
--- loader/i386/linux.c	2009-09-12 13:07:27 +0000
+++ loader/i386/linux.c	2009-10-26 16:59:21 +0000
@@ -17,7 +17,6 @@
  */
 
 #include <grub/loader.h>
-#include <grub/machine/machine.h>
 #include <grub/machine/memory.h>
 #include <grub/machine/loader.h>
 #include <grub/normal.h>

=== modified file 'loader/multiboot_loader.c'
--- loader/multiboot_loader.c	2009-07-13 23:57:11 +0000
+++ loader/multiboot_loader.c	2009-10-26 16:59:22 +0000
@@ -17,7 +17,6 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/machine/machine.h>
 #include <grub/multiboot.h>
 #include <grub/multiboot2.h>
 #include <multiboot2.h>

=== modified file 'term/i386/pc/serial.c'
--- term/i386/pc/serial.c	2009-08-29 00:24:32 +0000
+++ term/i386/pc/serial.c	2009-10-26 16:59:19 +0000
@@ -16,7 +16,6 @@
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <grub/machine/machine.h>
 #include <grub/machine/memory.h>
 #include <grub/machine/serial.h>
 #include <grub/machine/console.h>

=== modified file 'term/usb_keyboard.c'
--- term/usb_keyboard.c	2009-09-20 16:07:45 +0000
+++ term/usb_keyboard.c	2009-10-26 16:59:19 +0000
@@ -18,7 +18,6 @@
  */
 
 #include <grub/term.h>
-#include <grub/machine/machine.h>
 #include <grub/machine/console.h>
 #include <grub/time.h>
 #include <grub/cpu/io.h>

=== modified file 'util/misc.c'
--- util/misc.c	2009-07-16 22:14:09 +0000
+++ util/misc.c	2009-10-26 17:31:08 +0000
@@ -36,8 +36,6 @@
 #include <grub/mm.h>
 #include <grub/term.h>
 #include <grub/time.h>
-#include <grub/machine/time.h>
-#include <grub/machine/machine.h>
 
 /* Include malloc.h, only if memalign is available. It is known that
    memalign is declared in malloc.h in all systems, if present.  */
@@ -326,9 +324,8 @@
 
   gettimeofday (&tv, 0);
 
-  return (tv.tv_sec * GRUB_TICKS_PER_SECOND
-	  + (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
-	     * GRUB_TICKS_PER_SECOND / 1000000));
+  GRUB_COMPILE_TIME_ASSERT (GRUB_TICKS_PER_SECOND == 1000000);
+  return (tv.tv_sec * 1000000 + tv.tv_usec);
 }
 
 grub_uint64_t


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] turn grub-emu into a port
  2009-10-26 18:10 [PATCH] turn grub-emu into a port Robert Millan
@ 2009-10-30 22:49 ` Robert Millan
  2009-10-30 23:08 ` Vladimir 'phcoder' Serbinenko
  1 sibling, 0 replies; 7+ messages in thread
From: Robert Millan @ 2009-10-30 22:49 UTC (permalink / raw)
  To: grub-devel

On Mon, Oct 26, 2009 at 07:10:10PM +0100, Robert Millan wrote:
> 
> This turns grub-emu into a port in order to make it easier to port GRUB to
> new CPUs.  A porter can then do the CPU port without having to worry about
> firmware and/or hardware drivers initially.

Any comments on this?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] turn grub-emu into a port
  2009-10-26 18:10 [PATCH] turn grub-emu into a port Robert Millan
  2009-10-30 22:49 ` Robert Millan
@ 2009-10-30 23:08 ` Vladimir 'phcoder' Serbinenko
  2009-10-31 10:06   ` Robert Millan
  2009-11-09 22:50   ` Robert Millan
  1 sibling, 2 replies; 7+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-10-30 23:08 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> This turns grub-emu into a port in order to make it easier to port GRUB to
> new CPUs.  A porter can then do the CPU port without having to worry about
> firmware and/or hardware drivers initially.
>
> Patch attached.  Branch is available in
> bzr+ssh://bzr.savannah.gnu.org/grub/people/robertmh/grub-emu/
>
>   
Following hunk is a regression for me:
-  return (tv.tv_sec * GRUB_TICKS_PER_SECOND
-         + (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
-            * GRUB_TICKS_PER_SECOND / 1000000));
+  GRUB_COMPILE_TIME_ASSERT (GRUB_TICKS_PER_SECOND == 1000000);
+  return (tv.tv_sec * 1000000 + tv.tv_usec);
Having virtual clock going at any rate is an advantage for debugging.
Other than this I'm ok with this patch and you can merge it into
experimental
> ------------------------------------------------------------------------
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] turn grub-emu into a port
  2009-10-30 23:08 ` Vladimir 'phcoder' Serbinenko
@ 2009-10-31 10:06   ` Robert Millan
  2009-10-31 10:18     ` Vladimir 'phcoder' Serbinenko
  2009-11-09 22:50   ` Robert Millan
  1 sibling, 1 reply; 7+ messages in thread
From: Robert Millan @ 2009-10-31 10:06 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Oct 31, 2009 at 12:08:55AM +0100, Vladimir 'phcoder' Serbinenko wrote:
> Robert Millan wrote:
> > This turns grub-emu into a port in order to make it easier to port GRUB to
> > new CPUs.  A porter can then do the CPU port without having to worry about
> > firmware and/or hardware drivers initially.
> >
> > Patch attached.  Branch is available in
> > bzr+ssh://bzr.savannah.gnu.org/grub/people/robertmh/grub-emu/
> >
> >   
> Following hunk is a regression for me:
> -  return (tv.tv_sec * GRUB_TICKS_PER_SECOND
> -         + (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
> -            * GRUB_TICKS_PER_SECOND / 1000000));
> +  GRUB_COMPILE_TIME_ASSERT (GRUB_TICKS_PER_SECOND == 1000000);
> +  return (tv.tv_sec * 1000000 + tv.tv_usec);
> Having virtual clock going at any rate is an advantage for debugging.

I don't get what you mean.  When GRUB runs on a Unix system, a tick
represents a 1000000th fraction of a second, and therefore
GRUB_TICKS_PER_SECOND is 1000000.

The old behaviour tried to emulate the behaviour of the specific hardware
platform, but with grub-emu being a standalone port this doesn't make sense.

I don't think we can have both things (old tick behaviour + portable grub-emu).
Was that behaviour useful?  It seems to me that GRUB routines don't directly
care about number of ticker per second, but rather just use it as a means to
archieve something else.  E.g. to compare output of grub_get_rtc().

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] turn grub-emu into a port
  2009-10-31 10:06   ` Robert Millan
@ 2009-10-31 10:18     ` Vladimir 'phcoder' Serbinenko
  2009-10-31 10:29       ` Robert Millan
  0 siblings, 1 reply; 7+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-10-31 10:18 UTC (permalink / raw)
  To: The development of GRUB 2

Robert Millan wrote:
> On Sat, Oct 31, 2009 at 12:08:55AM +0100, Vladimir 'phcoder' Serbinenko wrote:
>   
>> Robert Millan wrote:
>>     
>>> This turns grub-emu into a port in order to make it easier to port GRUB to
>>> new CPUs.  A porter can then do the CPU port without having to worry about
>>> firmware and/or hardware drivers initially.
>>>
>>> Patch attached.  Branch is available in
>>> bzr+ssh://bzr.savannah.gnu.org/grub/people/robertmh/grub-emu/
>>>
>>>   
>>>       
>> Following hunk is a regression for me:
>> -  return (tv.tv_sec * GRUB_TICKS_PER_SECOND
>> -         + (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
>> -            * GRUB_TICKS_PER_SECOND / 1000000));
>> +  GRUB_COMPILE_TIME_ASSERT (GRUB_TICKS_PER_SECOND == 1000000);
>> +  return (tv.tv_sec * 1000000 + tv.tv_usec);
>> Having virtual clock going at any rate is an advantage for debugging.
>>     
>
> I don't get what you mean.  When GRUB runs on a Unix system, a tick
> represents a 1000000th fraction of a second, and therefore
> GRUB_TICKS_PER_SECOND is 1000000.
>
> The old behaviour tried to emulate the behaviour of the specific hardware
> platform, but with grub-emu being a standalone port this doesn't make sense.
>
> I don't think we can have both things (old tick behaviour + portable grub-emu).
> Was that behaviour useful?  It seems to me that GRUB routines don't directly
> care about number of ticker per second, but rather just use it as a means to
> archieve something else.  E.g. to compare output of grub_get_rtc().
>
>   
I meant: keep GRUB_TICKS_PER_SECOND=1000000 per default but allow easy
adjustment to any number by coder

-- 
Regards
Vladimir 'phcoder' Serbinenko
Personal git repository: http://repo.or.cz/w/grub2/phcoder.git 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] turn grub-emu into a port
  2009-10-31 10:18     ` Vladimir 'phcoder' Serbinenko
@ 2009-10-31 10:29       ` Robert Millan
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Millan @ 2009-10-31 10:29 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Oct 31, 2009 at 11:18:03AM +0100, Vladimir 'phcoder' Serbinenko wrote:
> >> -  return (tv.tv_sec * GRUB_TICKS_PER_SECOND
> >> -         + (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
> >> -            * GRUB_TICKS_PER_SECOND / 1000000));
> >> +  GRUB_COMPILE_TIME_ASSERT (GRUB_TICKS_PER_SECOND == 1000000);
> >> +  return (tv.tv_sec * 1000000 + tv.tv_usec);
> I meant: keep GRUB_TICKS_PER_SECOND=1000000 per default but allow easy
> adjustment to any number by coder

Ah, you mean instead of assuming (and asserting) that they're 1000000, leave
it as a hardcoded "#define GRUB_TICKS_PER_SECOND 1000000" so that this can
be changed at source level?

Seems fine.  If that's what you mean, I'll adjust the patch and add it to
experimental.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] turn grub-emu into a port
  2009-10-30 23:08 ` Vladimir 'phcoder' Serbinenko
  2009-10-31 10:06   ` Robert Millan
@ 2009-11-09 22:50   ` Robert Millan
  1 sibling, 0 replies; 7+ messages in thread
From: Robert Millan @ 2009-11-09 22:50 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Oct 31, 2009 at 12:08:55AM +0100, Vladimir 'phcoder' Serbinenko wrote:
> Following hunk is a regression for me:
> -  return (tv.tv_sec * GRUB_TICKS_PER_SECOND
> -         + (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
> -            * GRUB_TICKS_PER_SECOND / 1000000));
> +  GRUB_COMPILE_TIME_ASSERT (GRUB_TICKS_PER_SECOND == 1000000);
> +  return (tv.tv_sec * 1000000 + tv.tv_usec);
> Having virtual clock going at any rate is an advantage for debugging.
> Other than this I'm ok with this patch and you can merge it into
> experimental

Fixed and merged in exp.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-11-09 22:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-26 18:10 [PATCH] turn grub-emu into a port Robert Millan
2009-10-30 22:49 ` Robert Millan
2009-10-30 23:08 ` Vladimir 'phcoder' Serbinenko
2009-10-31 10:06   ` Robert Millan
2009-10-31 10:18     ` Vladimir 'phcoder' Serbinenko
2009-10-31 10:29       ` Robert Millan
2009-11-09 22:50   ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.