Skip to contentSkip to conversation

efiemu

PATCH In review phcoder 3 participants 5 messages Apr 14, 2009 – May 3, 2009

lore
Share & tools
lore

phcoder

author
#0 lore raw

PATCH 1/1 efiemu

Hello here is rediff & update of my efiemu patch. Now it's patched on top of following patch chain:
bootmove->preboot->mmap->acpi
Now to use it do ([32|64] means 32 for 32-bit version, 64 for 64-bit version):
efiemu_loadcore /grub/loadcore[32|64].o
efiemu_pnvram [pnvram file if any]
efiemu_prepare
<commands to load OS using efiemu>

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
ChangeLog +41 -0
index 909d4b7..69326ea 100644
@@ -1,3 +1,44 @@
+2009-03-15  Vladimir Serbinenko  <[email protected]>
+ 
+	Efiemu
+ 
+	* conf/i386-pc.rmk: new modules efiemu, efiemu_acpi, efiemu_pnvram,
+ 	_linux_efi, linux_efi. 
+ 	new files in grub-emu 
+ 	new targets efiemu32.o and efiemu64.o
+ 	* loader/linux_normal_efiemu.c: likewise
+ 	* loader/i386/efi/linux.c: added preliminary efiemu support
+ 	* util/i386/pc/grub-install.in: add efiemu??.o to the list of 
+ 	files to copy
+ 	* include/grub/autoefi.h: new file
+ 	* nclude/grub/i386/efiemu.h: likewise
+ 	* include/grub/i386/pc/efiemu.h: likewise
+ 	* include/grub/efi/api.h: add LL suffix when necessary
+ 	new definitions relating to tables
+ 	* include/grub/efiemu/efiemu.h: new file
+ 	* include/grub/efiemu/runtime.h: likewise
+ 	* efiemu/prepare.c: likewise
+ 	* efiemu/loadcore_common.c: likewise
+ 	* efiemu/loadcore64.c: likewise
+ 	* efiemu/runtime/efiemu.sh: likewise
+ 	* efiemu/runtime/efiemu.S: likewise
+ 	* efiemu/runtime/efiemu.c: likewise
+ 	* efiemu/runtime/config.h: likewise
+ 	* efiemu/prepare32.c: likewise
+ 	* efiemu/main.c: likewise
+ 	* efiemu/modules/pnvram.c: likewise
+ 	* efiemu/modules/i386: likewise
+ 	* efiemu/modules/i386/pc: likewise
+ 	* efiemu/modules/acpi.c: likewise
+ 	* efiemu/i386/pc/cfgtables.c: likewise
+ 	* efiemu/i386/loadcore64.c: likewise
+ 	* efiemu/i386/loadcore32.c: likewise
+ 	* efiemu/prepare64.c: likewise
+ 	* efiemu/loadcore.c: likewise
+ 	* efiemu/symbols.c: likewise
+ 	* efiemu/mm.c: likewise
+	* efiemu/loadcore32.c: likewise
+ 	
 2009-04-11  Vladimir Serbinenko <[email protected]>
 
 	ACPI spoofing
conf/i386-pc.rmk +24 -1
index 1b61cc2..7a6d79a 100644
@@ -182,7 +182,16 @@ pkglib_MODULES = biosdisk.mod chain.mod normal.mod \
 	aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
 	datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
 	usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
-	mmap.mod acpi.mod
+	efiemu.mod efiemu_pnvram.mod mmap.mod acpi.mod
+
+# For efiemu.mod.
+efiemu_mod_SOURCES = efiemu/main.c efiemu/i386/loadcore32.c efiemu/i386/loadcore64.c efiemu/i386/pc/cfgtables.c efiemu/mm.c efiemu/loadcore_common.c efiemu/symbols.c efiemu/loadcore32.c efiemu/loadcore64.c efiemu/prepare32.c efiemu/prepare64.c
+efiemu_mod_CFLAGS = $(COMMON_CFLAGS) -Werror -Wall
+efiemu_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
+efiemu_pnvram_mod_SOURCES = efiemu/modules/pnvram.c 
+efiemu_pnvram_mod_CFLAGS = $(COMMON_CFLAGS) -Werror -Wall
+efiemu_pnvram_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For acpi.mod.
 acpi_mod_SOURCES = commands/acpi.c commands/i386/pc/acpi.c
@@ -388,5 +397,19 @@ hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
 hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
 hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
+efiemu32.o: efiemu/runtime/efiemu.c
+	$(CC) -c -m32 -DELF32 -o $@ -Wall -Werror efiemu/runtime/efiemu.c -nostdlib -O2 -Iefiemu/runtime -Iinclude 
+efiemu64_c.o: efiemu/runtime/efiemu.c
+	$(CC) -c -m64 -DELF64 -o $@ -Wall -Werror efiemu/runtime/efiemu.c -nostdlib  -mcmodel=large -O2 -Iefiemu/runtime -Iinclude 
+
+efiemu64_s.o: efiemu/runtime/efiemu.S
+	$(CC) -c -m64 -DELF64 -o $@ -Wall -Werror efiemu/runtime/efiemu.S -nostdlib  -mcmodel=large -O2 -Iefiemu/runtime -Iinclude 
+
+efiemu64.o: efiemu64_c.o efiemu64_s.o
+	ld -o $@ -r efiemu64_c.o efiemu64_s.o -nostdlib 
+
+CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
+lib_DATA += efiemu32.o efiemu64.o
+
 include $(srcdir)/conf/i386.mk
 include $(srcdir)/conf/common.mk
efiemu/i386/loadcore32.c new file +114 -0

114 lines not on this page · raw message

efiemu/i386/loadcore64.c new file +120 -0

120 lines not on this page · raw message

efiemu/i386/pc/cfgtables.c new file +65 -0

65 lines not on this page · raw message

efiemu/loadcore.c new file +365 -0

365 lines not on this page · raw message

efiemu/loadcore32.c new file +27 -0
new file mode 100644
index 0000000..b4f61c7
@@ -0,0 +1,27 @@
+/* This file contains definitions so that loadcore.c compiles for 32-bit */
+/*
+ *  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/>.
+ */
+
+#define SUFFIX(x) x ## 32
+#define Elf_Ehdr Elf32_Ehdr
+#define Elf_Shdr Elf32_Shdr
+#define Elf_Sym Elf32_Sym
+#define Elf_Word Elf32_Word
+#define ELF_ST_TYPE ELF32_ST_TYPE
+#define ELF_ST_BIND ELF32_ST_BIND
+#include "loadcore.c"
efiemu/loadcore64.c new file +27 -0
new file mode 100644
index 0000000..097276c
@@ -0,0 +1,27 @@
+/* This file contains definitions so that loadcore.c compiles for 64-bit */
+/*
+ *  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/>.
+ */
+
+#define SUFFIX(x) x ## 64
+#define Elf_Ehdr Elf64_Ehdr
+#define Elf_Shdr Elf64_Shdr
+#define Elf_Sym Elf64_Sym
+#define Elf_Word Elf64_Word
+#define ELF_ST_TYPE ELF64_ST_TYPE
+#define ELF_ST_BIND ELF64_ST_BIND
+#include "loadcore.c"
efiemu/loadcore_common.c new file +189 -0

189 lines not on this page · raw message

efiemu/main.c new file +282 -0

282 lines not on this page · raw message

efiemu/mm.c new file +635 -0

635 lines not on this page · raw message

efiemu/modules/pnvram.c new file +368 -0

368 lines not on this page · raw message

efiemu/prepare.c new file +127 -0

127 lines not on this page · raw message

efiemu/prepare32.c new file +23 -0
new file mode 100644
index 0000000..48c177f
@@ -0,0 +1,23 @@
+/* This file contains definitions so that prepare.c compiles for 32-bit */
+/*
+ *  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/>.
+ */
+
+#define SUFFIX(x) x ## 32
+#define TYPE(x) x ## 32_t
+
+#include "prepare.c"
efiemu/prepare64.c new file +23 -0
new file mode 100644
index 0000000..f1399bd
@@ -0,0 +1,23 @@
+/* This file contains definitions so that prepare.c compiles for 64-bit */
+/*
+ *  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/>.
+ */
+
+#define SUFFIX(x) x ## 64
+#define TYPE(x) x ## 64_t
+
+#include "prepare.c"
efiemu/runtime/config.h new file +34 -0
new file mode 100644
index 0000000..26fb2ff
@@ -0,0 +1,34 @@
+/* This is a pseudo config.h so that types.h compiles nicely */
+/*
+ *  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/>.
+ */
+
+#define GRUB_TYPES_CPU_HEADER	1
+
+#ifdef ELF32
+# define SIZEOF_VOID_P	4
+# define SIZEOF_LONG	4
+# define GRUB_TARGET_SIZEOF_VOID_P	4
+# define GRUB_TARGET_SIZEOF_LONG	4
+# define EFI_FUNC(x) x
+#else
+# define SIZEOF_VOID_P	8
+# define SIZEOF_LONG	8
+# define GRUB_TARGET_SIZEOF_VOID_P	8
+# define GRUB_TARGET_SIZEOF_LONG	8
+# define EFI_FUNC(x) x ## _real
+#endif
efiemu/runtime/efiemu.S new file +159 -0

159 lines not on this page · raw message

efiemu/runtime/efiemu.c new file +623 -0

362 lines not on this page · raw message

efiemu/runtime/efiemu.sh new file +4 -0
new file mode 100644
index 0000000..1ae059a

Lines of this file are not shown. View the raw message.

efiemu/symbols.c new file +188 -0

188 lines not on this page · raw message

include/grub/autoefi.h new file +70 -0

70 lines not on this page · raw message

include/grub/efi/api.h +13 -10
index 598c7c3..432266b 100644

Lines of this file are not shown. View the raw message.

include/grub/efiemu/efiemu.h new file +271 -0

271 lines not on this page · raw message

include/grub/efiemu/runtime.h new file +37 -0
new file mode 100644
index 0000000..1eb474a

Lines of this file are not shown. View the raw message.

include/grub/i386/efiemu.h new file +33 -0
new file mode 100644
index 0000000..1b29f45

Lines of this file are not shown. View the raw message.

include/grub/i386/pc/efiemu.h new file +24 -0
new file mode 100644
index 0000000..f269dd0

Lines of this file are not shown. View the raw message.

util/i386/pc/grub-install.in +2 -2
index 8a7a4da..da1c2d7 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw

Sounds like grub needs a git server (with /~user/stuff.git dirs) ....

I'll see about testing it with some various gear.

Thanks
-joey

Quoted 11 lines · phcoder

Hello here is rediff & update of my efiemu patch. Now it's patched on top of following patch chain:
bootmove->preboot->mmap->acpi
Now to use it do ([32|64] means 32 for 32-bit version, 64 for 64-bit version):
efiemu_loadcore /grub/loadcore[32|64].o
efiemu_pnvram [pnvram file if any]
efiemu_prepare
<commands to load OS using efiemu>

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#2 lore raw
In reply to phcoder

Install scripts fixed. Additionally now skipped commands (efiemu_loadcore, efiemu_pnvram) are executed automatically

Quoted 14 lines · phcoder

Hello here is rediff & update of my efiemu patch. Now it's patched on top of following patch chain:
bootmove->preboot->mmap->acpi
Now to use it do ([32|64] means 32 for 32-bit version, 64 for 64-bit version):
efiemu_loadcore /grub/loadcore[32|64].o
efiemu_pnvram [pnvram file if any]
efiemu_prepare
<commands to load OS using efiemu>
--

Regards
Vladimir 'phcoder' Serbinenko

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
ChangeLog +41 -0
index a68b970..cc77f4a 100644
@@ -1,3 +1,44 @@
+2009-04-26  Vladimir Serbinenko  <[email protected]>
+ 
+	Efiemu
+ 
+	* conf/i386-pc.rmk: new modules efiemu, efiemu_acpi, efiemu_pnvram,
+ 	_linux_efi, linux_efi. 
+ 	new files in grub-emu 
+ 	new targets efiemu32.o and efiemu64.o
+ 	* loader/linux_normal_efiemu.c: likewise
+ 	* loader/i386/efi/linux.c: added preliminary efiemu support
+ 	* util/i386/pc/grub-install.in: add efiemu??.o to the list of 
+ 	files to copy
+ 	* include/grub/autoefi.h: new file
+ 	* nclude/grub/i386/efiemu.h: likewise
+ 	* include/grub/i386/pc/efiemu.h: likewise
+ 	* include/grub/efi/api.h: add LL suffix when necessary
+ 	new definitions relating to tables
+ 	* include/grub/efiemu/efiemu.h: new file
+ 	* include/grub/efiemu/runtime.h: likewise
+ 	* efiemu/prepare.c: likewise
+ 	* efiemu/loadcore_common.c: likewise
+ 	* efiemu/loadcore64.c: likewise
+ 	* efiemu/runtime/efiemu.sh: likewise
+ 	* efiemu/runtime/efiemu.S: likewise
+ 	* efiemu/runtime/efiemu.c: likewise
+ 	* efiemu/runtime/config.h: likewise
+ 	* efiemu/prepare32.c: likewise
+ 	* efiemu/main.c: likewise
+ 	* efiemu/modules/pnvram.c: likewise
+ 	* efiemu/modules/i386: likewise
+ 	* efiemu/modules/i386/pc: likewise
+ 	* efiemu/modules/acpi.c: likewise
+ 	* efiemu/i386/pc/cfgtables.c: likewise
+ 	* efiemu/i386/loadcore64.c: likewise
+ 	* efiemu/i386/loadcore32.c: likewise
+ 	* efiemu/prepare64.c: likewise
+ 	* efiemu/loadcore.c: likewise
+ 	* efiemu/symbols.c: likewise
+ 	* efiemu/mm.c: likewise
+	* efiemu/loadcore32.c: likewise
+ 	
 2009-04-26  Vladimir Serbinenko <[email protected]>
 
 	ACPI spoofing
conf/i386-pc.rmk +25 -1
index 8f4dbe9..2893fb9 100644
@@ -183,7 +183,17 @@ pkglib_MODULES = biosdisk.mod chain.mod normal.mod \
 	aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
 	datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
 	usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod \
-	mmap.mod acpi.mod
+	efiemu.mod mmap.mod acpi.mod
+
+# For efiemu.mod.
+efiemu_mod_SOURCES = efiemu/main.c efiemu/i386/loadcore32.c \
+		     efiemu/i386/loadcore64.c efiemu/i386/pc/cfgtables.c \
+		     efiemu/mm.c efiemu/loadcore_common.c efiemu/symbols.c \
+		     efiemu/loadcore32.c efiemu/loadcore64.c \
+		     efiemu/prepare32.c efiemu/prepare64.c efiemu/pnvram.c \
+		     efiemu/i386/coredetect.c
+efiemu_mod_CFLAGS = $(COMMON_CFLAGS) -Werror -Wall
+efiemu_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For acpi.mod.
 acpi_mod_SOURCES = commands/acpi.c commands/i386/pc/acpi.c
@@ -389,5 +399,19 @@ hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
 hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
 hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
+efiemu32.o: efiemu/runtime/efiemu.c
+	$(CC) -c -m32 -DELF32 -o $@ -Wall -Werror efiemu/runtime/efiemu.c -nostdlib -O2 -Iefiemu/runtime -Iinclude 
+efiemu64_c.o: efiemu/runtime/efiemu.c
+	$(CC) -c -m64 -DELF64 -o $@ -Wall -Werror efiemu/runtime/efiemu.c -nostdlib  -mcmodel=large -O2 -Iefiemu/runtime -Iinclude 
+
+efiemu64_s.o: efiemu/runtime/efiemu.S
+	$(CC) -c -m64 -DELF64 -o $@ -Wall -Werror efiemu/runtime/efiemu.S -nostdlib  -mcmodel=large -O2 -Iefiemu/runtime -Iinclude 
+
+efiemu64.o: efiemu64_c.o efiemu64_s.o
+	ld -melf_x86_64 -o $@ -r efiemu64_c.o efiemu64_s.o -nostdlib 
+
+CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
+lib_DATA += efiemu32.o efiemu64.o
+
 include $(srcdir)/conf/i386.mk
 include $(srcdir)/conf/common.mk
efiemu/i386/coredetect.c new file +60 -0

60 lines not on this page · raw message

efiemu/i386/loadcore32.c new file +114 -0

114 lines not on this page · raw message

efiemu/i386/loadcore64.c new file +120 -0

120 lines not on this page · raw message

efiemu/i386/pc/cfgtables.c new file +65 -0

65 lines not on this page · raw message

efiemu/loadcore.c new file +365 -0

365 lines not on this page · raw message

efiemu/loadcore32.c new file +27 -0
new file mode 100644
index 0000000..b4f61c7
@@ -0,0 +1,27 @@
+/* This file contains definitions so that loadcore.c compiles for 32-bit */
+/*
+ *  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/>.
+ */
+
+#define SUFFIX(x) x ## 32
+#define Elf_Ehdr Elf32_Ehdr
+#define Elf_Shdr Elf32_Shdr
+#define Elf_Sym Elf32_Sym
+#define Elf_Word Elf32_Word
+#define ELF_ST_TYPE ELF32_ST_TYPE
+#define ELF_ST_BIND ELF32_ST_BIND
+#include "loadcore.c"
efiemu/loadcore64.c new file +27 -0
new file mode 100644
index 0000000..097276c
@@ -0,0 +1,27 @@
+/* This file contains definitions so that loadcore.c compiles for 64-bit */
+/*
+ *  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/>.
+ */
+
+#define SUFFIX(x) x ## 64
+#define Elf_Ehdr Elf64_Ehdr
+#define Elf_Shdr Elf64_Shdr
+#define Elf_Sym Elf64_Sym
+#define Elf_Word Elf64_Word
+#define ELF_ST_TYPE ELF64_ST_TYPE
+#define ELF_ST_BIND ELF64_ST_BIND
+#include "loadcore.c"
efiemu/loadcore_common.c new file +189 -0

189 lines not on this page · raw message

efiemu/main.c new file +335 -0

335 lines not on this page · raw message

efiemu/mm.c new file +635 -0

635 lines not on this page · raw message

efiemu/pnvram.c new file +395 -0

395 lines not on this page · raw message

efiemu/prepare.c new file +127 -0

127 lines not on this page · raw message

efiemu/prepare32.c new file +23 -0
new file mode 100644
index 0000000..48c177f
@@ -0,0 +1,23 @@
+/* This file contains definitions so that prepare.c compiles for 32-bit */
+/*
+ *  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/>.
+ */
+
+#define SUFFIX(x) x ## 32
+#define TYPE(x) x ## 32_t
+
+#include "prepare.c"
efiemu/prepare64.c new file +23 -0
new file mode 100644
index 0000000..f1399bd
@@ -0,0 +1,23 @@
+/* This file contains definitions so that prepare.c compiles for 64-bit */
+/*
+ *  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/>.
+ */
+
+#define SUFFIX(x) x ## 64
+#define TYPE(x) x ## 64_t
+
+#include "prepare.c"
efiemu/runtime/config.h new file +34 -0
new file mode 100644
index 0000000..26fb2ff
@@ -0,0 +1,34 @@
+/* This is a pseudo config.h so that types.h compiles nicely */
+/*
+ *  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/>.
+ */
+
+#define GRUB_TYPES_CPU_HEADER	1
+
+#ifdef ELF32
+# define SIZEOF_VOID_P	4
+# define SIZEOF_LONG	4
+# define GRUB_TARGET_SIZEOF_VOID_P	4
+# define GRUB_TARGET_SIZEOF_LONG	4
+# define EFI_FUNC(x) x
+#else
+# define SIZEOF_VOID_P	8
+# define SIZEOF_LONG	8
+# define GRUB_TARGET_SIZEOF_VOID_P	8
+# define GRUB_TARGET_SIZEOF_LONG	8
+# define EFI_FUNC(x) x ## _real
+#endif
efiemu/runtime/efiemu.S new file +159 -0

159 lines not on this page · raw message

efiemu/runtime/efiemu.c new file +623 -0

221 lines not on this page · raw message

efiemu/runtime/efiemu.sh new file +4 -0
new file mode 100644
index 0000000..1ae059a

Lines of this file are not shown. View the raw message.

efiemu/symbols.c new file +188 -0

188 lines not on this page · raw message

include/grub/autoefi.h new file +75 -0

75 lines not on this page · raw message

include/grub/efi/api.h +13 -10
index 598c7c3..432266b 100644

Lines of this file are not shown. View the raw message.

include/grub/efiemu/efiemu.h new file +275 -0

275 lines not on this page · raw message

include/grub/efiemu/runtime.h new file +37 -0
new file mode 100644
index 0000000..1eb474a

Lines of this file are not shown. View the raw message.

include/grub/i386/efiemu.h new file +33 -0
new file mode 100644
index 0000000..1b29f45

Lines of this file are not shown. View the raw message.

include/grub/i386/pc/efiemu.h new file +24 -0
new file mode 100644
index 0000000..f269dd0

Lines of this file are not shown. View the raw message.

util/i386/pc/grub-install.in +2 -2
index 8a7a4da..31c2dc7 100644

Lines of this file are not shown. View the raw message.

util/i386/pc/grub-mkrescue.in +1 -1
index 358b37b..31b1f81 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#3 lore raw

commited

Quoted 27 lines · Vladimir 'phcoder' Serbinenko

Install scripts fixed. Additionally now skipped commands (efiemu_loadcore, efiemu_pnvram) are executed automatically

Quoted 11 lines · phcoder

Hello here is rediff & update of my efiemu patch. Now it's patched on top of following patch chain:
bootmove->preboot->mmap->acpi
Now to use it do ([32|64] means 32 for 32-bit version, 64 for 64-bit version):
efiemu_loadcore /grub/loadcore[32|64].o
efiemu_pnvram [pnvram file if any]
efiemu_prepare
<commands to load OS using efiemu>
--

Quoted 3 lines

Regards
Vladimir 'phcoder' Serbinenko

--
Regards
Vladimir 'phcoder' Serbinenko

Signature · 2 lines
Regards
Vladimir 'phcoder' Serbinenko
#4 lore raw

Hi,

There are a few problems with the build script, I'm fixing it now.

First, the build rules for efiemu32.o:

efiemu32.o: efiemu/runtime/efiemu.c

        $(CC) -c -m32 -DELF32 -o $@ -Wall -Werror

efiemu/runtime/efiemu.c -nostdlib -O2 -Iefiemu/runtime -Iinclude

This would break building from a directory other than the root source path. For example, I usually put the binaries in directory pc:

mkdir pc
cd pc
../configure
make

This would avoid populating the root source directory with hundreds of build files, it also make it possible to build multiple targets with the same source tree. For example, pc for i386-pc, efi32 for i386-efi, efi64 for x86_64-efi. When I want a clean build, I just remove the directory and recreate it again.

To support building from other directories, the rules should be:

efiemu32.o: efiemu/runtime/efiemu.c

        $(CC) -c -m32 -DELF32 -o $@ -Wall -Werror $< -nostdlib -O2

-I$(srcdir)/efiemu/runtime -I$(srcdir)/include -Iinclude

make would take care of translating $< to the real path, for example ../efiemu/runtime/efiemu.c, and $(srcdir) is the root source directory.

Also, for 64-bit efiemu, I think it'd be safer to add the -mno-red-zone option, otherwise it might access the stack using negative offset from %rsp.

BTW, not all system can build efiemu runtime properly. For example, cygwin/mingw can't build it at all, even in linux, if gcc-multilib is not installed, it would fail to build the 32-bit or 64-bit component. So I add an option --enable-efiemu in configure. The efiemu runtime is only built when this option is enabled.

Quoted 42 lines · Vladimir 'phcoder' Serbinenko

commited

Quoted 17 lines · Vladimir 'phcoder' Serbinenko

Install scripts fixed. Additionally now skipped commands (efiemu_loadcore, efiemu_pnvram) are executed automatically

Quoted 12 lines · phcoder

Hello here is rediff & update of my efiemu patch. Now it's patched on top of following patch chain:
bootmove->preboot->mmap->acpi
Now to use it do ([32|64] means 32 for 32-bit version, 64 for 64-bit version):
efiemu_loadcore /grub/loadcore[32|64].o
efiemu_pnvram [pnvram file if any]
efiemu_prepare
<commands to load OS using efiemu>
--

Quoted 8 lines
Quoted 2 lines

Regards
Vladimir 'phcoder' Serbinenko

--
Regards
Vladimir 'phcoder' Serbinenko

--
Regards
Vladimir 'phcoder' Serbinenko

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 1 line
Bean