All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Misc patches for grub2
@ 2008-07-25 16:38 Bean
  2008-07-25 17:19 ` Chris Knadle
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Bean @ 2008-07-25 16:38 UTC (permalink / raw)
  To: The development of GRUB 2

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

Hi,

This is a collection of miscellaneous patches, it includes:

1, move util/envblk.c to lib/envblk.c

As envblk.c is used by module loadenv and tool grub-editenv, I think
it's better to move it to lib directory.

2. seperate hexdump function, and move it to lib/hexdump.c

hexdump module consists of two parts, one is hexdump function, the
other is user land command. I move the hexdump function to lib, as
it's also used in other place, for example grub-fstest.

3. add new command crc

Just like hexdump, this module is split into two parts, lib/crc.c for
the crc function, commands/crc.c for the user land command that
calculate the crc checksum of selected file.

4. rename appleloader command to bootcamp

The name appleloader may be a little confusing, bootcamp seems to be a
better choice.

-- 
Bean

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: misc.diff --]
[-- Type: text/x-diff; name=misc.diff, Size: 40675 bytes --]

diff --git a/commands/crc.c b/commands/crc.c
new file mode 100644
index 0000000..5148648
--- /dev/null
+++ b/commands/crc.c
@@ -0,0 +1,66 @@
+/* crc.c - command to calculate the crc32 checksum of a file  */
+/*
+ *  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/>.
+ */
+
+#include <grub/normal.h>
+#include <grub/dl.h>
+#include <grub/arg.h>
+#include <grub/disk.h>
+#include <grub/file.h>
+#include <grub/misc.h>
+#include <grub/lib/crc.h>
+
+static grub_err_t
+grub_cmd_crc (struct grub_arg_list *state __attribute__ ((unused)),
+	      int argc, char **args)
+
+{
+  grub_file_t file;
+  char buf[GRUB_DISK_SECTOR_SIZE];
+  grub_ssize_t size;
+  grub_uint32_t crc;
+
+  if (argc != 1)
+    return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
+
+  file = grub_file_open (args[0]);
+  if (! file)
+    return 0;
+
+  crc = 0;
+  while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
+    crc = grub_getcrc32 (crc, buf, size);
+
+  grub_file_close (file);
+
+  grub_printf ("%08x\n", crc);
+
+  return 0;
+}
+
+GRUB_MOD_INIT(crc)
+{
+  (void) mod;			/* To stop warning. */
+  grub_register_command ("crc", grub_cmd_crc, GRUB_COMMAND_FLAG_BOTH,
+			 "crc FILE", "Calculate the crc32 checksum of a file.", 0);
+}
+
+GRUB_MOD_FINI(crc)
+{
+  grub_unregister_command ("crc");
+}
diff --git a/commands/hexdump.c b/commands/hexdump.c
index c340638..5c0ddc0 100644
--- a/commands/hexdump.c
+++ b/commands/hexdump.c
@@ -24,8 +24,8 @@
 #include <grub/disk.h>
 #include <grub/misc.h>
 #include <grub/gzio.h>
-#include <grub/hexdump.h>
 #include <grub/partition.h>
+#include <grub/lib/hexdump.h>
 
 static const struct grub_arg_option options[] = {
   {"skip", 's', 0, "skip offset bytes from the beginning of file.", 0,
@@ -34,52 +34,6 @@ static const struct grub_arg_option options[] = {
   {0, 0, 0, 0, 0, 0}
 };
 
-void
-hexdump (unsigned long bse, char *buf, int len)
-{
-  int pos;
-  char line[80];
-
-  while (len > 0)
-    {
-      int cnt, i;
-
-      pos = grub_sprintf (line, "%08lx  ", bse);
-      cnt = 16;
-      if (cnt > len)
-	cnt = len;
-
-      for (i = 0; i < cnt; i++)
-	{
-	  pos += grub_sprintf (&line[pos], "%02x ", (unsigned char) buf[i]);
-	  if ((i & 7) == 7)
-	    line[pos++] = ' ';
-	}
-
-      for (; i < 16; i++)
-	{
-	  pos += grub_sprintf (&line[pos], "   ");
-	  if ((i & 7) == 7)
-	    line[pos++] = ' ';
-	}
-
-      line[pos++] = '|';
-
-      for (i = 0; i < cnt; i++)
-	line[pos++] = ((buf[i] >= 32) && (buf[i] < 127)) ? buf[i] : '.';
-
-      line[pos++] = '|';
-
-      line[pos] = 0;
-
-      grub_printf ("%s\n", line);
-
-      bse += 16;
-      buf += 16;
-      len -= cnt;
-    }
-}
-
 static grub_err_t
 grub_cmd_hexdump (struct grub_arg_list *state, int argc, char **args)
 {
diff --git a/commands/loadenv.c b/commands/loadenv.c
index 7359683..4dbf1d9 100644
--- a/commands/loadenv.c
+++ b/commands/loadenv.c
@@ -25,8 +25,8 @@
 #include <grub/disk.h>
 #include <grub/misc.h>
 #include <grub/env.h>
-#include <grub/envblk.h>
 #include <grub/partition.h>
+#include <grub/lib/envblk.h>
 
 static const struct grub_arg_option options[] =
   {
diff --git a/conf/common.rmk b/conf/common.rmk
index c0087f5..7db0b2a 100644
--- a/conf/common.rmk
+++ b/conf/common.rmk
@@ -26,7 +26,7 @@ util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
 grub_fstest_SOURCES = util/grub-fstest.c util/hostfs.c util/misc.c 	\
 	kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c	\
 	disk/host.c disk/loopback.c  normal/arg.c normal/misc.c		\
-	io/gzio.c commands/hexdump.c commands/blocklist.c commands/ls.c \
+	io/gzio.c lib/hexdump.c commands/blocklist.c commands/ls.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		\
@@ -96,7 +96,7 @@ DISTCLEANFILES += grub_fstest_init.c
 
 # for grub-editenv
 bin_UTILITIES += grub-editenv
-grub_editenv_SOURCES = util/grub-editenv.c util/envblk.c util/misc.c kern/misc.c kern/err.c
+grub_editenv_SOURCES = util/grub-editenv.c lib/envblk.c util/misc.c kern/misc.c kern/err.c
 CLEANFILES += grub-editenv
 
 # for grub-pe2elf
@@ -274,7 +274,7 @@ pkglib_MODULES += hello.mod boot.mod terminal.mod ls.mod	\
 	cmp.mod cat.mod help.mod font.mod search.mod		\
 	loopback.mod fs_uuid.mod configfile.mod echo.mod	\
 	terminfo.mod test.mod blocklist.mod hexdump.mod		\
-	read.mod sleep.mod loadenv.mod
+	read.mod sleep.mod loadenv.mod crc.mod
 
 # For hello.mod.
 hello_mod_SOURCES = hello/hello.c
@@ -357,7 +357,7 @@ blocklist_mod_CFLAGS = $(COMMON_CFLAGS)
 blocklist_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For hexdump.mod.
-hexdump_mod_SOURCES = commands/hexdump.c
+hexdump_mod_SOURCES = commands/hexdump.c lib/hexdump.c
 hexdump_mod_CFLAGS = $(COMMON_CFLAGS)
 hexdump_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
@@ -372,10 +372,15 @@ sleep_mod_CFLAGS = $(COMMON_CFLAGS)
 sleep_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For loadenv.mod.
-loadenv_mod_SOURCES = commands/loadenv.c util/envblk.c
+loadenv_mod_SOURCES = commands/loadenv.c lib/envblk.c
 loadenv_mod_CFLAGS = $(COMMON_CFLAGS)
 loadenv_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
+# For crc.mod.
+crc_mod_SOURCES = commands/crc.c lib/crc.c
+crc_mod_CFLAGS = $(COMMON_CFLAGS)
+crc_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 # Misc.
 pkglib_MODULES += gzio.mod elf.mod
 
diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk
index d2546be..5b110d9 100644
--- a/conf/i386-coreboot.rmk
+++ b/conf/i386-coreboot.rmk
@@ -61,7 +61,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c	\
 	commands/configfile.c commands/echo.c commands/help.c		\
 	commands/terminal.c commands/ls.c commands/test.c 		\
 	commands/search.c commands/blocklist.c commands/hexdump.c	\
-	commands/i386/cpuid.c						\
+	lib/hexdump.c commands/i386/cpuid.c				\
 	disk/host.c disk/loopback.c					\
 	\
 	fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c			\
diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk
index 99bb0d4..ea2f0b7 100644
--- a/conf/i386-efi.rmk
+++ b/conf/i386-efi.rmk
@@ -36,7 +36,7 @@ util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
 grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c 	\
 	commands/configfile.c commands/help.c				\
 	commands/terminal.c commands/ls.c commands/test.c 		\
-	commands/search.c commands/hexdump.c				\
+	commands/search.c commands/hexdump.c lib/hexdump.c		\
 	commands/halt.c commands/reboot.c				\
 	commands/i386/cpuid.c						\
 	disk/loopback.c							\
@@ -74,7 +74,7 @@ sbin_SCRIPTS = grub-install
 grub_install_SOURCES = util/i386/efi/grub-install.in
 
 # Modules.
-pkglib_MODULES = kernel.mod normal.mod _chain.mod chain.mod appleldr.mod \
+pkglib_MODULES = kernel.mod normal.mod _chain.mod chain.mod bootcamp.mod \
 	_linux.mod linux.mod cpuid.mod halt.mod reboot.mod pci.mod lspci.mod
 
 # For kernel.mod.
@@ -123,10 +123,10 @@ chain_mod_SOURCES = loader/efi/chainloader_normal.c
 chain_mod_CFLAGS = $(COMMON_CFLAGS)
 chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
-# For appleldr.mod.
-appleldr_mod_SOURCES = loader/efi/appleloader.c
-appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
-appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
+# For bootcamp.mod.
+bootcamp_mod_SOURCES = loader/efi/bootcamp.c
+bootcamp_mod_CFLAGS = $(COMMON_CFLAGS)
+bootcamp_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For _linux.mod.
 _linux_mod_SOURCES = loader/i386/efi/linux.c
diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk
index e4f2a66..03827ae 100644
--- a/conf/i386-ieee1275.rmk
+++ b/conf/i386-ieee1275.rmk
@@ -62,7 +62,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c	\
 	commands/configfile.c commands/echo.c commands/help.c		\
 	commands/terminal.c commands/ls.c commands/test.c 		\
 	commands/search.c commands/blocklist.c commands/hexdump.c	\
-	commands/halt.c commands/reboot.c				\
+	lib/hexdump.c commands/halt.c commands/reboot.c			\
 	commands/i386/cpuid.c						\
 	disk/host.c disk/loopback.c					\
 	\
diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk
index 84c0b7d..8617a92 100644
--- a/conf/i386-pc.rmk
+++ b/conf/i386-pc.rmk
@@ -111,7 +111,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c	\
 	commands/configfile.c commands/echo.c commands/help.c		\
 	commands/terminal.c commands/ls.c commands/test.c 		\
 	commands/search.c commands/blocklist.c commands/hexdump.c	\
-	commands/i386/pc/halt.c commands/reboot.c			\
+	lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c		\
 	commands/i386/cpuid.c						\
 	disk/host.c disk/loopback.c					\
 	fs/fshelp.c 	\
diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk
index bb04490..6ade1ab 100644
--- a/conf/powerpc-ieee1275.rmk
+++ b/conf/powerpc-ieee1275.rmk
@@ -49,7 +49,7 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c 	\
 	commands/configfile.c commands/help.c				\
 	commands/search.c commands/terminal.c commands/test.c 		\
 	commands/ls.c commands/blocklist.c commands/hexdump.c		\
-	commands/halt.c commands/reboot.c		\
+	lib/hexdump.c commands/halt.c commands/reboot.c			\
 	disk/loopback.c							\
 	\
 	fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c		\
diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk
index daa416c..493627e 100644
--- a/conf/x86_64-efi.rmk
+++ b/conf/x86_64-efi.rmk
@@ -38,7 +38,7 @@ util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
 grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c 	\
 	commands/configfile.c commands/help.c				\
 	commands/terminal.c commands/ls.c commands/test.c 		\
-	commands/search.c commands/hexdump.c				\
+	commands/search.c commands/hexdump.c lib/hexdump.c		\
 	commands/halt.c commands/reboot.c				\
 	commands/i386/cpuid.c						\
 	disk/loopback.c							\
@@ -76,7 +76,7 @@ sbin_SCRIPTS = grub-install
 grub_install_SOURCES = util/i386/efi/grub-install.in
 
 # Modules.
-pkglib_MODULES = kernel.mod normal.mod _chain.mod chain.mod appleldr.mod \
+pkglib_MODULES = kernel.mod normal.mod _chain.mod chain.mod bootcamp.mod \
 	cpuid.mod halt.mod reboot.mod _linux.mod linux.mod pci.mod lspci.mod
 
 # For kernel.mod.
@@ -126,10 +126,10 @@ chain_mod_SOURCES = loader/efi/chainloader_normal.c
 chain_mod_CFLAGS = $(COMMON_CFLAGS)
 chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
-# For appleldr.mod.
-appleldr_mod_SOURCES = loader/efi/appleloader.c
-appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
-appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
+# For bootcamp.mod.
+bootcamp_mod_SOURCES = loader/efi/bootcamp.c
+bootcamp_mod_CFLAGS = $(COMMON_CFLAGS)
+bootcamp_mod_LDFLAGS = $(COMMON_LDFLAGS)
 
 # For _linux.mod.
 _linux_mod_SOURCES = loader/i386/efi/linux.c
diff --git a/include/grub/envblk.h b/include/grub/envblk.h
deleted file mode 100644
index 5c1157e..0000000
--- a/include/grub/envblk.h
+++ /dev/null
@@ -1,45 +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_ENVBLK_HEADER
-#define GRUB_ENVBLK_HEADER	1
-
-#define GRUB_ENVBLK_SIGNATURE	0x764e6547	/* GeNv  */
-
-#define GRUB_ENVBLK_MAXLEN	8192
-
-#define GRUB_ENVBLK_DEFCFG	"grubenv"
-
-#ifndef ASM_FILE
-
-struct grub_envblk
-{
-  grub_uint32_t signature;
-  grub_uint16_t length;
-  char data[0];
-} __attribute__ ((packed));
-typedef struct grub_envblk *grub_envblk_t;
-
-grub_envblk_t grub_envblk_find (char *buf);
-int grub_envblk_insert (grub_envblk_t envblk, char *name, char *value);
-void grub_envblk_delete (grub_envblk_t envblk, char *name);
-void grub_envblk_iterate (grub_envblk_t envblk, int hook (char *name, char *value));
-
-#endif
-
-#endif /* ! GRUB_ENVBLK_HEADER */
diff --git a/include/grub/hexdump.h b/include/grub/hexdump.h
deleted file mode 100644
index 23c6fa6..0000000
--- a/include/grub/hexdump.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* hexdump.h - prototypes for dump */
-/*
- *  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_HEXDUMP_H
-#define GRUB_HEXDUMP_H	1
-
-void hexdump (unsigned long bse,char* buf,int len);
-
-#endif /* ! GRUB_HEXDUMP_H */
diff --git a/include/grub/lib/crc.h b/include/grub/lib/crc.h
new file mode 100644
index 0000000..ff7284d
--- /dev/null
+++ b/include/grub/lib/crc.h
@@ -0,0 +1,25 @@
+/* crc.h - prototypes for crc */
+/*
+ *  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_CRC_H
+#define GRUB_CRC_H	1
+
+grub_uint32_t grub_getcrc32 (grub_uint32_t crc, void *buf, int size);
+
+#endif /* ! GRUB_CRC_H */
diff --git a/include/grub/lib/envblk.h b/include/grub/lib/envblk.h
new file mode 100644
index 0000000..5c1157e
--- /dev/null
+++ b/include/grub/lib/envblk.h
@@ -0,0 +1,45 @@
+/*
+ *  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_ENVBLK_HEADER
+#define GRUB_ENVBLK_HEADER	1
+
+#define GRUB_ENVBLK_SIGNATURE	0x764e6547	/* GeNv  */
+
+#define GRUB_ENVBLK_MAXLEN	8192
+
+#define GRUB_ENVBLK_DEFCFG	"grubenv"
+
+#ifndef ASM_FILE
+
+struct grub_envblk
+{
+  grub_uint32_t signature;
+  grub_uint16_t length;
+  char data[0];
+} __attribute__ ((packed));
+typedef struct grub_envblk *grub_envblk_t;
+
+grub_envblk_t grub_envblk_find (char *buf);
+int grub_envblk_insert (grub_envblk_t envblk, char *name, char *value);
+void grub_envblk_delete (grub_envblk_t envblk, char *name);
+void grub_envblk_iterate (grub_envblk_t envblk, int hook (char *name, char *value));
+
+#endif
+
+#endif /* ! GRUB_ENVBLK_HEADER */
diff --git a/include/grub/lib/hexdump.h b/include/grub/lib/hexdump.h
new file mode 100644
index 0000000..23c6fa6
--- /dev/null
+++ b/include/grub/lib/hexdump.h
@@ -0,0 +1,25 @@
+/* hexdump.h - prototypes for dump */
+/*
+ *  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_HEXDUMP_H
+#define GRUB_HEXDUMP_H	1
+
+void hexdump (unsigned long bse,char* buf,int len);
+
+#endif /* ! GRUB_HEXDUMP_H */
diff --git a/lib/crc.c b/lib/crc.c
new file mode 100644
index 0000000..bc0d8aa
--- /dev/null
+++ b/lib/crc.c
@@ -0,0 +1,75 @@
+/* crc.c - crc function  */
+/*
+ *  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/>.
+ */
+
+#include <grub/types.h>
+#include <grub/lib/crc.h>
+
+static grub_uint32_t crc32_table [256];
+
+static void
+init_crc32_table (void)
+{
+  auto grub_uint32_t reflect (grub_uint32_t ref, int len);
+  grub_uint32_t reflect (grub_uint32_t ref, int len)
+    {
+      grub_uint32_t result = 0;
+      int i;
+
+      for (i = 1; i <= len; i++)
+        {
+          if (ref & 1)
+            result |= 1 << (len - i);
+          ref >>= 1;
+        }
+
+      return result;
+    }
+
+  grub_uint32_t polynomial = 0x04c11db7;
+  int i, j;
+
+  for(i = 0; i < 256; i++)
+    {
+      crc32_table[i] = reflect(i, 8) << 24;
+      for (j = 0; j < 8; j++)
+        crc32_table[i] = (crc32_table[i] << 1) ^
+            (crc32_table[i] & (1 << 31) ? polynomial : 0);
+      crc32_table[i] = reflect(crc32_table[i], 32);
+    }
+}
+
+grub_uint32_t
+grub_getcrc32 (grub_uint32_t crc, void *buf, int size)
+{
+  int i;
+  grub_uint8_t *data = buf;
+
+  if (! crc32_table[1])
+    init_crc32_table ();
+
+  crc^= 0xffffffff;
+
+  for (i = 0; i < size; i++)
+    {
+      crc = (crc >> 8) ^ crc32_table[(crc & 0xFF) ^ *data];
+      data++;
+    }
+
+  return crc ^ 0xffffffff;
+}
diff --git a/lib/envblk.c b/lib/envblk.c
new file mode 100644
index 0000000..6618d97
--- /dev/null
+++ b/lib/envblk.c
@@ -0,0 +1,156 @@
+/* envblk.c - Common function for environment block.  */
+/*
+ *  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/>.
+ */
+
+#include <config.h>
+#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/lib/envblk.h>
+
+grub_envblk_t
+grub_envblk_find (char *buf)
+{
+  grub_uint32_t *pd;
+  int len;
+
+  pd = (grub_uint32_t *) buf;
+
+  for (len = GRUB_ENVBLK_MAXLEN - 6; len > 0; len -= 4, pd++)
+    if (*pd == GRUB_ENVBLK_SIGNATURE)
+      {
+        grub_envblk_t p;
+
+        p = (grub_envblk_t) pd;
+        if (p->length <= len)
+          return p;
+      }
+
+  return 0;
+}
+
+int
+grub_envblk_insert (grub_envblk_t envblk, char *name, char *value)
+{
+  char *p, *pend;
+  char *found = 0;
+  int nl;
+
+  nl = grub_strlen (name);
+  p = envblk->data;
+  pend = p + envblk->length;
+
+  while (*p)
+    {
+      if ((! found) && (! grub_memcmp (name, p, nl)) && (p[nl] == '='))
+        found = p + nl + 1;
+
+      p += grub_strlen (p) + 1;
+      if (p >= pend)
+        return 1;
+    }
+
+  if (found)
+    {
+      int len1, len2;
+
+      len1 = grub_strlen (found);
+      len2 = grub_strlen (value);
+      if ((p - envblk->data) + 1 - len1 + len2 > envblk->length)
+        return 1;
+
+      grub_memcpy (found + len2 + 1, found + len1 + 1, (p - found) - len1);
+      grub_strcpy (found, value);
+    }
+  else
+    {
+      int len2 = grub_strlen (value);
+
+      if ((p - envblk->data) + nl + 1 + len2 + 2 > envblk->length)
+        return 1;
+
+      grub_strcpy (p, name);
+      p[nl] = '=';
+      grub_strcpy (p + nl + 1, value);
+      p[nl + 1 + len2 + 1] = 0;
+    }
+
+  return 0;
+}
+
+void
+grub_envblk_delete (grub_envblk_t envblk, char *name)
+{
+  char *p, *pend;
+  char *found = 0;
+  int nl;
+
+  nl = grub_strlen (name);
+  p = envblk->data;
+  pend = p + envblk->length;
+
+  while (*p)
+    {
+      if ((! found) && (! grub_memcmp (name, p, nl)) && (p[nl] == '='))
+        found = p;
+
+      p += grub_strlen (p) + 1;
+      if (p >= pend)
+        return;
+    }
+
+  if (found)
+    {
+      int len;
+
+      len = grub_strlen (found);
+      grub_memcpy (found, found + len + 1, (p - found) - len);
+    }
+}
+
+void
+grub_envblk_iterate (grub_envblk_t envblk,
+                     int hook (char *name, char *value))
+{
+  char *p, *pend;
+
+  p = envblk->data;
+  pend = p + envblk->length;
+
+  while (*p)
+    {
+      char *v;
+      int r;
+
+      v = grub_strchr (p, '=');
+      if (v)
+        {
+          *v = 0;
+          r = hook (p, v + 1);
+          *v = '=';
+        }
+      else
+        r = hook (p, "");
+
+      if (r)
+        break;
+
+      p += grub_strlen (p) + 1;
+      if (p >= pend)
+        break;
+    }
+}
diff --git a/lib/hexdump.c b/lib/hexdump.c
new file mode 100644
index 0000000..9b79f45
--- /dev/null
+++ b/lib/hexdump.c
@@ -0,0 +1,68 @@
+/* hexdump.c - hexdump function */
+/*
+ *  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/>.
+ */
+
+#include <grub/types.h>
+#include <grub/misc.h>
+#include <grub/lib/hexdump.h>
+
+void
+hexdump (unsigned long bse, char *buf, int len)
+{
+  int pos;
+  char line[80];
+
+  while (len > 0)
+    {
+      int cnt, i;
+
+      pos = grub_sprintf (line, "%08lx  ", bse);
+      cnt = 16;
+      if (cnt > len)
+	cnt = len;
+
+      for (i = 0; i < cnt; i++)
+	{
+	  pos += grub_sprintf (&line[pos], "%02x ", (unsigned char) buf[i]);
+	  if ((i & 7) == 7)
+	    line[pos++] = ' ';
+	}
+
+      for (; i < 16; i++)
+	{
+	  pos += grub_sprintf (&line[pos], "   ");
+	  if ((i & 7) == 7)
+	    line[pos++] = ' ';
+	}
+
+      line[pos++] = '|';
+
+      for (i = 0; i < cnt; i++)
+	line[pos++] = ((buf[i] >= 32) && (buf[i] < 127)) ? buf[i] : '.';
+
+      line[pos++] = '|';
+
+      line[pos] = 0;
+
+      grub_printf ("%s\n", line);
+
+      bse += 16;
+      buf += 16;
+      len -= cnt;
+    }
+}
diff --git a/loader/efi/appleloader.c b/loader/efi/appleloader.c
deleted file mode 100644
index 910a13d..0000000
--- a/loader/efi/appleloader.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* appleloader.c - apple legacy boot loader.  */
-/*
- *  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/>.
- */
-
-#include <grub/loader.h>
-#include <grub/err.h>
-#include <grub/mm.h>
-#include <grub/dl.h>
-#include <grub/misc.h>
-#include <grub/normal.h>
-#include <grub/efi/api.h>
-#include <grub/efi/efi.h>
-
-static grub_dl_t my_mod;
-
-static grub_efi_handle_t image_handle;
-static grub_efi_char16_t *cmdline;
-
-static grub_err_t
-grub_appleloader_unload (void)
-{
-  grub_efi_boot_services_t *b;
-
-  b = grub_efi_system_table->boot_services;
-  efi_call_1 (b->unload_image, image_handle);
-
-  grub_free (cmdline);
-  cmdline = 0;
-
-  grub_dl_unref (my_mod);
-  return GRUB_ERR_NONE;
-}
-
-static grub_err_t
-grub_appleloader_boot (void)
-{
-  grub_efi_boot_services_t *b;
-
-  b = grub_efi_system_table->boot_services;
-  efi_call_3 (b->start_image, image_handle, 0, 0);
-
-  grub_appleloader_unload ();
-
-  return grub_errno;
-}
-
-/* early 2006 Core Duo / Core Solo models  */
-static grub_uint8_t devpath_1[] =
-{
-  0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00,
-  0xFF, 0xFF, 0xF9, 0xFF, 0x00, 0x00, 0x00, 0x00,
-  0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
-  0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
-  0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
-};
-
-/* mid-2006 Mac Pro (and probably other Core 2 models)  */
-static grub_uint8_t devpath_2[] =
-{
-  0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00,
-  0xFF, 0xFF, 0xF7, 0xFF, 0x00, 0x00, 0x00, 0x00,
-  0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
-  0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
-  0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
-};
-
-/* mid-2007 MBP ("Santa Rosa" based models)  */
-static grub_uint8_t devpath_3[] =
-{
-  0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00,
-  0xFF, 0xFF, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00,
-  0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
-  0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
-  0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
-};
-
-/* early-2008 MBA  */
-static grub_uint8_t devpath_4[] =
-{
-  0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0xC0, 0xFF, 0x00, 0x00, 0x00, 0x00,
-  0xFF, 0xFF, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00,
-  0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
-  0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
-  0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
-};
-
-struct devdata
-{
-  char *model;
-  grub_efi_device_path_t *devpath;
-};
-
-struct devdata devs[] =
-{
-  {"Core Duo/Solo", (grub_efi_device_path_t *) devpath_1},
-  {"Mac Pro", (grub_efi_device_path_t *) devpath_2},
-  {"MBP", (grub_efi_device_path_t *) devpath_3},
-  {"MBA", (grub_efi_device_path_t *) devpath_4},
-  {NULL, NULL},
-};
-
-static grub_err_t
-grub_cmd_appleloader (struct grub_arg_list *state __attribute__ ((unused)),
-                      int argc, char *argv[])
-{
-  grub_efi_boot_services_t *b;
-  grub_efi_loaded_image_t *loaded_image;
-  struct devdata *pdev;
-
-  grub_dl_ref (my_mod);
-
-  /* Initialize some global variables.  */
-  image_handle = 0;
-
-  b = grub_efi_system_table->boot_services;
-
-  for (pdev = devs ; pdev->devpath ; pdev++)
-    if (efi_call_6 (b->load_image, 0, grub_efi_image_handle, pdev->devpath,
-                    NULL, 0, &image_handle) == GRUB_EFI_SUCCESS)
-      break;
-
-  if (! pdev->devpath)
-    {
-      grub_error (GRUB_ERR_BAD_OS, "can't find model");
-      goto fail;
-    }
-
-  grub_printf ("Model : %s\n", pdev->model);
-
-  loaded_image = grub_efi_get_loaded_image (image_handle);
-  if (! loaded_image)
-    {
-      grub_error (GRUB_ERR_BAD_OS, "no loaded image available");
-      goto fail;
-    }
-
-  if (argc > 0)
-    {
-      int i, len;
-      grub_efi_char16_t *p16;
-
-      for (i = 0, len = 0; i < argc; i++)
-        len += grub_strlen (argv[i]) + 1;
-
-      len *= sizeof (grub_efi_char16_t);
-      cmdline = p16 = grub_malloc (len);
-      if (! cmdline)
-        goto fail;
-
-      for (i = 0; i < argc; i++)
-        {
-          char *p8;
-
-          p8 = argv[i];
-          while (*p8)
-            *(p16++) = *(p8++);
-
-          *(p16++) = ' ';
-        }
-      *(--p16) = 0;
-
-      loaded_image->load_options = cmdline;
-      loaded_image->load_options_size = len;
-    }
-
-  grub_loader_set (grub_appleloader_boot, grub_appleloader_unload, 0);
-
-  return 0;
-
- fail:
-
-  grub_dl_unref (my_mod);
-  return grub_errno;
-}
-
-GRUB_MOD_INIT(appleloader)
-{
-  grub_register_command ("appleloader", grub_cmd_appleloader,
-			 GRUB_COMMAND_FLAG_BOTH,
-			 "appleloader [OPTS]",
-			 "Boot legacy system.", 0);
-
-  my_mod = mod;
-}
-
-GRUB_MOD_FINI(appleloader)
-{
-  grub_unregister_command ("appleloader");
-}
diff --git a/loader/efi/bootcamp.c b/loader/efi/bootcamp.c
new file mode 100644
index 0000000..ccb4f9d
--- /dev/null
+++ b/loader/efi/bootcamp.c
@@ -0,0 +1,208 @@
+/* bootcamp.c - apple legacy boot loader.  */
+/*
+ *  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/>.
+ */
+
+#include <grub/loader.h>
+#include <grub/err.h>
+#include <grub/mm.h>
+#include <grub/dl.h>
+#include <grub/misc.h>
+#include <grub/normal.h>
+#include <grub/efi/api.h>
+#include <grub/efi/efi.h>
+
+static grub_dl_t my_mod;
+
+static grub_efi_handle_t image_handle;
+static grub_efi_char16_t *cmdline;
+
+static grub_err_t
+grub_bootcamp_unload (void)
+{
+  grub_efi_boot_services_t *b;
+
+  b = grub_efi_system_table->boot_services;
+  efi_call_1 (b->unload_image, image_handle);
+
+  grub_free (cmdline);
+  cmdline = 0;
+
+  grub_dl_unref (my_mod);
+  return GRUB_ERR_NONE;
+}
+
+static grub_err_t
+grub_bootcamp_boot (void)
+{
+  grub_efi_boot_services_t *b;
+
+  b = grub_efi_system_table->boot_services;
+  efi_call_3 (b->start_image, image_handle, 0, 0);
+
+  grub_bootcamp_unload ();
+
+  return grub_errno;
+}
+
+/* early 2006 Core Duo / Core Solo models  */
+static grub_uint8_t devpath_1[] =
+{
+  0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00,
+  0xFF, 0xFF, 0xF9, 0xFF, 0x00, 0x00, 0x00, 0x00,
+  0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
+  0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
+  0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
+};
+
+/* mid-2006 Mac Pro (and probably other Core 2 models)  */
+static grub_uint8_t devpath_2[] =
+{
+  0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00,
+  0xFF, 0xFF, 0xF7, 0xFF, 0x00, 0x00, 0x00, 0x00,
+  0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
+  0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
+  0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
+};
+
+/* mid-2007 MBP ("Santa Rosa" based models)  */
+static grub_uint8_t devpath_3[] =
+{
+  0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0x00,
+  0xFF, 0xFF, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00,
+  0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
+  0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
+  0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
+};
+
+/* early-2008 MBA  */
+static grub_uint8_t devpath_4[] =
+{
+  0x01, 0x03, 0x18, 0x00, 0x0B, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0xC0, 0xFF, 0x00, 0x00, 0x00, 0x00,
+  0xFF, 0xFF, 0xF8, 0xFF, 0x00, 0x00, 0x00, 0x00,
+  0x04, 0x06, 0x14, 0x00, 0xEB, 0x85, 0x05, 0x2B,
+  0xB8, 0xD8, 0xA9, 0x49, 0x8B, 0x8C, 0xE2, 0x1B,
+  0x01, 0xAE, 0xF2, 0xB7, 0x7F, 0xFF, 0x04, 0x00,
+};
+
+struct devdata
+{
+  char *model;
+  grub_efi_device_path_t *devpath;
+};
+
+struct devdata devs[] =
+{
+  {"Core Duo/Solo", (grub_efi_device_path_t *) devpath_1},
+  {"Mac Pro", (grub_efi_device_path_t *) devpath_2},
+  {"MBP", (grub_efi_device_path_t *) devpath_3},
+  {"MBA", (grub_efi_device_path_t *) devpath_4},
+  {NULL, NULL},
+};
+
+static grub_err_t
+grub_cmd_bootcamp (struct grub_arg_list *state __attribute__ ((unused)),
+                   int argc, char *argv[])
+{
+  grub_efi_boot_services_t *b;
+  grub_efi_loaded_image_t *loaded_image;
+  struct devdata *pdev;
+
+  grub_dl_ref (my_mod);
+
+  /* Initialize some global variables.  */
+  image_handle = 0;
+
+  b = grub_efi_system_table->boot_services;
+
+  for (pdev = devs ; pdev->devpath ; pdev++)
+    if (efi_call_6 (b->load_image, 0, grub_efi_image_handle, pdev->devpath,
+                    NULL, 0, &image_handle) == GRUB_EFI_SUCCESS)
+      break;
+
+  if (! pdev->devpath)
+    {
+      grub_error (GRUB_ERR_BAD_OS, "can't find model");
+      goto fail;
+    }
+
+  grub_printf ("Model : %s\n", pdev->model);
+
+  loaded_image = grub_efi_get_loaded_image (image_handle);
+  if (! loaded_image)
+    {
+      grub_error (GRUB_ERR_BAD_OS, "no loaded image available");
+      goto fail;
+    }
+
+  if (argc > 0)
+    {
+      int i, len;
+      grub_efi_char16_t *p16;
+
+      for (i = 0, len = 0; i < argc; i++)
+        len += grub_strlen (argv[i]) + 1;
+
+      len *= sizeof (grub_efi_char16_t);
+      cmdline = p16 = grub_malloc (len);
+      if (! cmdline)
+        goto fail;
+
+      for (i = 0; i < argc; i++)
+        {
+          char *p8;
+
+          p8 = argv[i];
+          while (*p8)
+            *(p16++) = *(p8++);
+
+          *(p16++) = ' ';
+        }
+      *(--p16) = 0;
+
+      loaded_image->load_options = cmdline;
+      loaded_image->load_options_size = len;
+    }
+
+  grub_loader_set (grub_bootcamp_boot, grub_bootcamp_unload, 0);
+
+  return 0;
+
+ fail:
+
+  grub_dl_unref (my_mod);
+  return grub_errno;
+}
+
+GRUB_MOD_INIT(bootcamp)
+{
+  grub_register_command ("bootcamp", grub_cmd_bootcamp,
+			 GRUB_COMMAND_FLAG_BOTH,
+			 "bootcamp [OPTS]",
+			 "Boot legacy system.", 0);
+
+  my_mod = mod;
+}
+
+GRUB_MOD_FINI(bootcamp)
+{
+  grub_unregister_command ("bootcamp");
+}
diff --git a/util/envblk.c b/util/envblk.c
deleted file mode 100644
index 9cea7d6..0000000
--- a/util/envblk.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* envblk.c - Common function for environment block.  */
-/*
- *  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/>.
- */
-
-#include <config.h>
-#include <grub/types.h>
-#include <grub/envblk.h>
-#include <grub/misc.h>
-
-grub_envblk_t
-grub_envblk_find (char *buf)
-{
-  grub_uint32_t *pd;
-  int len;
-
-  pd = (grub_uint32_t *) buf;
-
-  for (len = GRUB_ENVBLK_MAXLEN - 6; len > 0; len -= 4, pd++)
-    if (*pd == GRUB_ENVBLK_SIGNATURE)
-      {
-        grub_envblk_t p;
-
-        p = (grub_envblk_t) pd;
-        if (p->length <= len)
-          return p;
-      }
-
-  return 0;
-}
-
-int
-grub_envblk_insert (grub_envblk_t envblk, char *name, char *value)
-{
-  char *p, *pend;
-  char *found = 0;
-  int nl;
-
-  nl = grub_strlen (name);
-  p = envblk->data;
-  pend = p + envblk->length;
-
-  while (*p)
-    {
-      if ((! found) && (! grub_memcmp (name, p, nl)) && (p[nl] == '='))
-        found = p + nl + 1;
-
-      p += grub_strlen (p) + 1;
-      if (p >= pend)
-        return 1;
-    }
-
-  if (found)
-    {
-      int len1, len2;
-
-      len1 = grub_strlen (found);
-      len2 = grub_strlen (value);
-      if ((p - envblk->data) + 1 - len1 + len2 > envblk->length)
-        return 1;
-
-      grub_memcpy (found + len2 + 1, found + len1 + 1, (p - found) - len1);
-      grub_strcpy (found, value);
-    }
-  else
-    {
-      int len2 = grub_strlen (value);
-
-      if ((p - envblk->data) + nl + 1 + len2 + 2 > envblk->length)
-        return 1;
-
-      grub_strcpy (p, name);
-      p[nl] = '=';
-      grub_strcpy (p + nl + 1, value);
-      p[nl + 1 + len2 + 1] = 0;
-    }
-
-  return 0;
-}
-
-void
-grub_envblk_delete (grub_envblk_t envblk, char *name)
-{
-  char *p, *pend;
-  char *found = 0;
-  int nl;
-
-  nl = grub_strlen (name);
-  p = envblk->data;
-  pend = p + envblk->length;
-
-  while (*p)
-    {
-      if ((! found) && (! grub_memcmp (name, p, nl)) && (p[nl] == '='))
-        found = p;
-
-      p += grub_strlen (p) + 1;
-      if (p >= pend)
-        return;
-    }
-
-  if (found)
-    {
-      int len;
-
-      len = grub_strlen (found);
-      grub_memcpy (found, found + len + 1, (p - found) - len);
-    }
-}
-
-void
-grub_envblk_iterate (grub_envblk_t envblk,
-                     int hook (char *name, char *value))
-{
-  char *p, *pend;
-
-  p = envblk->data;
-  pend = p + envblk->length;
-
-  while (*p)
-    {
-      char *v;
-      int r;
-
-      v = grub_strchr (p, '=');
-      if (v)
-        {
-          *v = 0;
-          r = hook (p, v + 1);
-          *v = '=';
-        }
-      else
-        r = hook (p, "");
-
-      if (r)
-        break;
-
-      p += grub_strlen (p) + 1;
-      if (p >= pend)
-        break;
-    }
-}
diff --git a/util/grub-editenv.c b/util/grub-editenv.c
index 523e5c7..f53a9bb 100644
--- a/util/grub-editenv.c
+++ b/util/grub-editenv.c
@@ -20,8 +20,7 @@
 #include <config.h>
 #include <grub/types.h>
 #include <grub/util/misc.h>
-
-#include <grub/envblk.h>
+#include <grub/lib/envblk.h>
 
 #include <stdio.h>
 #include <unistd.h>
diff --git a/util/grub-fstest.c b/util/grub-fstest.c
index 3872ff1..35af6a5 100644
--- a/util/grub-fstest.c
+++ b/util/grub-fstest.c
@@ -29,7 +29,7 @@
 #include <grub/term.h>
 #include <grub/mm.h>
 #include <grub/normal.h>
-#include <grub/hexdump.h>
+#include <grub/lib/hexdump.h>
 
 #include <grub_fstest_init.h>
 

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

* Re: [PATCH] Misc patches for grub2
  2008-07-25 16:38 [PATCH] Misc patches for grub2 Bean
@ 2008-07-25 17:19 ` Chris Knadle
  2008-07-25 17:45   ` Bean
  2008-07-25 20:53 ` Robert Millan
  2008-08-05 10:36 ` Marco Gerards
  2 siblings, 1 reply; 19+ messages in thread
From: Chris Knadle @ 2008-07-25 17:19 UTC (permalink / raw)
  To: The development of GRUB 2

On Friday 25 July 2008, Bean wrote:
> 4. rename appleloader command to bootcamp
>
> The name appleloader may be a little confusing, bootcamp seems to be a
> better choice.

   Rather than patching all of the content from appleloader.c to bootcamp.c 
you may want to consider doing a 'git-mv' to rename the file instead.

   -- Chris

-- 

Chris Knadle
Chris.Knadle@coredump.us



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

* Re: [PATCH] Misc patches for grub2
  2008-07-25 17:19 ` Chris Knadle
@ 2008-07-25 17:45   ` Bean
  2008-07-25 18:58     ` Chris Knadle
  0 siblings, 1 reply; 19+ messages in thread
From: Bean @ 2008-07-25 17:45 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Jul 26, 2008 at 1:19 AM, Chris Knadle <Chris.Knadle@coredump.us> wrote:
> On Friday 25 July 2008, Bean wrote:
>> 4. rename appleloader command to bootcamp
>>
>> The name appleloader may be a little confusing, bootcamp seems to be a
>> better choice.
>
>   Rather than patching all of the content from appleloader.c to bootcamp.c
> you may want to consider doing a 'git-mv' to rename the file instead.

Hi,

Yes, i do use git-mv to rename files, but when i use git-diff to
generate the patch, it looks like this.

-- 
Bean



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

* Re: [PATCH] Misc patches for grub2
  2008-07-25 17:45   ` Bean
@ 2008-07-25 18:58     ` Chris Knadle
  2008-07-27  4:36       ` Pavel Roskin
  0 siblings, 1 reply; 19+ messages in thread
From: Chris Knadle @ 2008-07-25 18:58 UTC (permalink / raw)
  To: The development of GRUB 2

On Friday 25 July 2008, Bean wrote:
> On Sat, Jul 26, 2008 at 1:19 AM, Chris Knadle <Chris.Knadle@coredump.us> 
wrote:
> > On Friday 25 July 2008, Bean wrote:
> >> 4. rename appleloader command to bootcamp
> >>
> >> The name appleloader may be a little confusing, bootcamp seems to be a
> >> better choice.
> >
> >   Rather than patching all of the content from appleloader.c to
> > bootcamp.c you may want to consider doing a 'git-mv' to rename the file
> > instead.
>
> Yes, i do use git-mv to rename files, but when i use git-diff to
> generate the patch, it looks like this.

   Oh...  Okay I think I understand why.  'git-diff -M' can detect the renames 
and just list them, but the 'patch' command can't use that to incorporate the 
renames, which is probably why the -M behavior isn't the default.  

   So...  nevermind.  ;-)

   -- Chris

-- 

Chris Knadle
Chris.Knadle@coredump.us



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

* Re: [PATCH] Misc patches for grub2
  2008-07-25 16:38 [PATCH] Misc patches for grub2 Bean
  2008-07-25 17:19 ` Chris Knadle
@ 2008-07-25 20:53 ` Robert Millan
  2008-07-26  4:28   ` Bean
  2008-08-05 10:36 ` Marco Gerards
  2 siblings, 1 reply; 19+ messages in thread
From: Robert Millan @ 2008-07-25 20:53 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Jul 26, 2008 at 12:38:59AM +0800, Bean wrote:
> 4. rename appleloader command to bootcamp
> 
> The name appleloader may be a little confusing, bootcamp seems to be a
> better choice.

I'm not sure if this would comply with Apple trademarks.  What does this
command do?

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)



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

* Re: [PATCH] Misc patches for grub2
  2008-07-25 20:53 ` Robert Millan
@ 2008-07-26  4:28   ` Bean
  2008-07-27  4:55     ` Pavel Roskin
  0 siblings, 1 reply; 19+ messages in thread
From: Bean @ 2008-07-26  4:28 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, Jul 26, 2008 at 4:53 AM, Robert Millan <rmh@aybabtu.com> wrote:
> On Sat, Jul 26, 2008 at 12:38:59AM +0800, Bean wrote:
>> 4. rename appleloader command to bootcamp
>>
>> The name appleloader may be a little confusing, bootcamp seems to be a
>> better choice.
>
> I'm not sure if this would comply with Apple trademarks.  What does this
> command do?

Hi,

It does the same thing as bootcamp, like loading legacy mbr, cd, etc.
Also, It doesn't do it by itself, it calls a special efi image
provided by the apple firmware.

-- 
Bean



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

* Re: [PATCH] Misc patches for grub2
  2008-07-25 18:58     ` Chris Knadle
@ 2008-07-27  4:36       ` Pavel Roskin
  0 siblings, 0 replies; 19+ messages in thread
From: Pavel Roskin @ 2008-07-27  4:36 UTC (permalink / raw)
  To: The development of GRUB 2

On Fri, 2008-07-25 at 14:58 -0400, Chris Knadle wrote:
> On Friday 25 July 2008, Bean wrote:
> > On Sat, Jul 26, 2008 at 1:19 AM, Chris Knadle <Chris.Knadle@coredump.us> 
> wrote:
> > > On Friday 25 July 2008, Bean wrote:
> > >> 4. rename appleloader command to bootcamp
> > >>
> > >> The name appleloader may be a little confusing, bootcamp seems to be a
> > >> better choice.
> > >
> > >   Rather than patching all of the content from appleloader.c to
> > > bootcamp.c you may want to consider doing a 'git-mv' to rename the file
> > > instead.
> >
> > Yes, i do use git-mv to rename files, but when i use git-diff to
> > generate the patch, it looks like this.
> 
>    Oh...  Okay I think I understand why.  'git-diff -M' can detect the renames 
> and just list them, but the 'patch' command can't use that to incorporate the 
> renames, which is probably why the -M behavior isn't the default.  
> 
>    So...  nevermind.  ;-)

Our main repository is in Subversion, so whoever applies the patch
should use "svn move" to keep the contiguous file history.  Unlike git,
which trusts the contents in the first place, Subversion is more
sensitive to whatever users are telling it.

-- 
Regards,
Pavel Roskin



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

* Re: [PATCH] Misc patches for grub2
  2008-07-26  4:28   ` Bean
@ 2008-07-27  4:55     ` Pavel Roskin
  2008-07-27  6:00       ` Bean
  0 siblings, 1 reply; 19+ messages in thread
From: Pavel Roskin @ 2008-07-27  4:55 UTC (permalink / raw)
  To: The development of GRUB 2

On Sat, 2008-07-26 at 12:28 +0800, Bean wrote:
> On Sat, Jul 26, 2008 at 4:53 AM, Robert Millan <rmh@aybabtu.com> wrote:
> > On Sat, Jul 26, 2008 at 12:38:59AM +0800, Bean wrote:
> >> 4. rename appleloader command to bootcamp
> >>
> >> The name appleloader may be a little confusing, bootcamp seems to be a
> >> better choice.
> >
> > I'm not sure if this would comply with Apple trademarks.  What does this
> > command do?
> 
> Hi,
> 
> It does the same thing as bootcamp, like loading legacy mbr, cd, etc.
> Also, It doesn't do it by itself, it calls a special efi image
> provided by the apple firmware.

IMHO that even worse.  Using a trademarked name like "linux" to run the
trademarked software could be justified.  But using a trademarked name
to replace or emulate the original software is asking for a big trouble.

Admittedly, I'm not a lawyer, but some people are, and it's better not
to attract their attention.

-- 
Regards,
Pavel Roskin



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

* Re: [PATCH] Misc patches for grub2
  2008-07-27  4:55     ` Pavel Roskin
@ 2008-07-27  6:00       ` Bean
  2008-07-27  7:05         ` Pavel Roskin
  0 siblings, 1 reply; 19+ messages in thread
From: Bean @ 2008-07-27  6:00 UTC (permalink / raw)
  To: The development of GRUB 2

Hi,

On Sun, Jul 27, 2008 at 12:55 PM, Pavel Roskin <proski@gnu.org> wrote:
> Our main repository is in Subversion, so whoever applies the patch
> should use "svn move" to keep the contiguous file history.  Unlike git,
> which trusts the contents in the first place, Subversion is more
> sensitive to whatever users are telling it.

I use git-mv to move files, which is the equivalence of "svn move".
But when I use git-diff to generate the patch, it looks as if files
are truncated. I can use git-diff -M to create a patch that shows the
renames, but it's not usable by patch.

>
> IMHO that even worse.  Using a trademarked name like "linux" to run the
> trademarked software could be justified.  But using a trademarked name
> to replace or emulate the original software is asking for a big trouble.
>
> Admittedly, I'm not a lawyer, but some people are, and it's better not
> to attract their attention.

In fact, it doesn't replace bootcamp, it calls the service provided by
bootcamp. But anyway, it's not a big deal, I can just keep the name
appleloader.

BTW, any comment about the other changes ?

-- 
Bean



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

* Re: [PATCH] Misc patches for grub2
  2008-07-27  6:00       ` Bean
@ 2008-07-27  7:05         ` Pavel Roskin
  2008-07-27  7:14           ` Bean
  0 siblings, 1 reply; 19+ messages in thread
From: Pavel Roskin @ 2008-07-27  7:05 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, 2008-07-27 at 14:00 +0800, Bean wrote:
> Hi,
> 
> On Sun, Jul 27, 2008 at 12:55 PM, Pavel Roskin <proski@gnu.org> wrote:
> > Our main repository is in Subversion, so whoever applies the patch
> > should use "svn move" to keep the contiguous file history.  Unlike git,
> > which trusts the contents in the first place, Subversion is more
> > sensitive to whatever users are telling it.
> 
> I use git-mv to move files, which is the equivalence of "svn move".
> But when I use git-diff to generate the patch, it looks as if files
> are truncated. I can use git-diff -M to create a patch that shows the
> renames, but it's not usable by patch.

That's why I'm asking "whoever applies the patch" to be careful.

> > IMHO that even worse.  Using a trademarked name like "linux" to run the
> > trademarked software could be justified.  But using a trademarked name
> > to replace or emulate the original software is asking for a big trouble.
> >
> > Admittedly, I'm not a lawyer, but some people are, and it's better not
> > to attract their attention.
> 
> In fact, it doesn't replace bootcamp, it calls the service provided by
> bootcamp. But anyway, it's not a big deal, I can just keep the name
> appleloader.

Fine.

> BTW, any comment about the other changes ?

Why do we need "crc"?  If there are chances that it will be used for
security, we should be using SHA-1.

-- 
Regards,
Pavel Roskin



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

* Re: [PATCH] Misc patches for grub2
  2008-07-27  7:05         ` Pavel Roskin
@ 2008-07-27  7:14           ` Bean
  2008-07-27  7:20             ` Pavel Roskin
  0 siblings, 1 reply; 19+ messages in thread
From: Bean @ 2008-07-27  7:14 UTC (permalink / raw)
  To: The development of GRUB 2

Hi,

On Sun, Jul 27, 2008 at 3:05 PM, Pavel Roskin <proski@gnu.org> wrote:
>> > IMHO that even worse.  Using a trademarked name like "linux" to run the
>> > trademarked software could be justified.  But using a trademarked name
>> > to replace or emulate the original software is asking for a big trouble.
>> >
>> > Admittedly, I'm not a lawyer, but some people are, and it's better not
>> > to attract their attention.
>>
>> In fact, it doesn't replace bootcamp, it calls the service provided by
>> bootcamp. But anyway, it's not a big deal, I can just keep the name
>> appleloader.
>
> Fine.

I'm sorry, do you mean it's fine to use bootcamp, or keep the name appleloader ?

>
>> BTW, any comment about the other changes ?
>
> Why do we need "crc"?  If there are chances that it will be used for
> security, we should be using SHA-1.

crc is useful in many place. For example, png, jffs2, etc.

-- 
Bean



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

* Re: [PATCH] Misc patches for grub2
  2008-07-27  7:14           ` Bean
@ 2008-07-27  7:20             ` Pavel Roskin
  2008-07-27  7:30               ` Bean
  0 siblings, 1 reply; 19+ messages in thread
From: Pavel Roskin @ 2008-07-27  7:20 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, 2008-07-27 at 15:14 +0800, Bean wrote:
> > Fine.
> 
> I'm sorry, do you mean it's fine to use bootcamp, or keep the name appleloader ?

Fine to use "appleloader".  Actually, I've never had a chance to play
with an Intel Mac, so I don't know the details.

> >> BTW, any comment about the other changes ?
> >
> > Why do we need "crc"?  If there are chances that it will be used for
> > security, we should be using SHA-1.
> 
> crc is useful in many place. For example, png, jffs2, etc.

But why make it a command?

-- 
Regards,
Pavel Roskin



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

* Re: [PATCH] Misc patches for grub2
  2008-07-27  7:20             ` Pavel Roskin
@ 2008-07-27  7:30               ` Bean
  2008-07-27  7:33                 ` Pavel Roskin
  0 siblings, 1 reply; 19+ messages in thread
From: Bean @ 2008-07-27  7:30 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Jul 27, 2008 at 3:20 PM, Pavel Roskin <proski@gnu.org> wrote:
>> >> BTW, any comment about the other changes ?
>> >
>> > Why do we need "crc"?  If there are chances that it will be used for
>> > security, we should be using SHA-1.
>>
>> crc is useful in many place. For example, png, jffs2, etc.
>
> But why make it a command?

There are two parts, one is lib/crc.c, which contains only the crc
function, the other is command/crc.c, which is a command to calculate
the crc of selected file. Although it's not necessary to have a
command, but it can 1) serve as an example of how to use the crc
function, 2) as a cheap way to verify if a file is read correctly by
the fs driver.

-- 
Bean



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

* Re: [PATCH] Misc patches for grub2
  2008-07-27  7:30               ` Bean
@ 2008-07-27  7:33                 ` Pavel Roskin
  2008-07-27 13:51                   ` Bean
  0 siblings, 1 reply; 19+ messages in thread
From: Pavel Roskin @ 2008-07-27  7:33 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, 2008-07-27 at 15:30 +0800, Bean wrote:
> On Sun, Jul 27, 2008 at 3:20 PM, Pavel Roskin <proski@gnu.org> wrote:
> >> >> BTW, any comment about the other changes ?
> >> >
> >> > Why do we need "crc"?  If there are chances that it will be used for
> >> > security, we should be using SHA-1.
> >>
> >> crc is useful in many place. For example, png, jffs2, etc.
> >
> > But why make it a command?
> 
> There are two parts, one is lib/crc.c, which contains only the crc
> function, the other is command/crc.c, which is a command to calculate
> the crc of selected file. Although it's not necessary to have a
> command, but it can 1) serve as an example of how to use the crc
> function, 2) as a cheap way to verify if a file is read correctly by
> the fs driver.

OK, then it's probably a good idea.

-- 
Regards,
Pavel Roskin



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

* Re: [PATCH] Misc patches for grub2
  2008-07-27  7:33                 ` Pavel Roskin
@ 2008-07-27 13:51                   ` Bean
  0 siblings, 0 replies; 19+ messages in thread
From: Bean @ 2008-07-27 13:51 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Jul 27, 2008 at 3:33 PM, Pavel Roskin <proski@gnu.org> wrote:
> On Sun, 2008-07-27 at 15:30 +0800, Bean wrote:
>> On Sun, Jul 27, 2008 at 3:20 PM, Pavel Roskin <proski@gnu.org> wrote:
>> >> >> BTW, any comment about the other changes ?
>> >> >
>> >> > Why do we need "crc"?  If there are chances that it will be used for
>> >> > security, we should be using SHA-1.
>> >>
>> >> crc is useful in many place. For example, png, jffs2, etc.
>> >
>> > But why make it a command?
>>
>> There are two parts, one is lib/crc.c, which contains only the crc
>> function, the other is command/crc.c, which is a command to calculate
>> the crc of selected file. Although it's not necessary to have a
>> command, but it can 1) serve as an example of how to use the crc
>> function, 2) as a cheap way to verify if a file is read correctly by
>> the fs driver.
>
> OK, then it's probably a good idea.

Committed (remove the bootcamp part).

-- 
Bean



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

* Re: [PATCH] Misc patches for grub2
  2008-07-25 16:38 [PATCH] Misc patches for grub2 Bean
  2008-07-25 17:19 ` Chris Knadle
  2008-07-25 20:53 ` Robert Millan
@ 2008-08-05 10:36 ` Marco Gerards
  2008-08-05 14:14   ` Bean
  2008-08-05 20:11   ` Robert Millan
  2 siblings, 2 replies; 19+ messages in thread
From: Marco Gerards @ 2008-08-05 10:36 UTC (permalink / raw)
  To: The development of GRUB 2

Hi,

Bean <bean123ch@gmail.com> writes:

> This is a collection of miscellaneous patches, it includes:

Please do not collect patches.  Independant changes can better go into
independant patches.  Mails like this are easily overseen and so are
important changes made by such patch.

> 1, move util/envblk.c to lib/envblk.c
>
> As envblk.c is used by module loadenv and tool grub-editenv, I think
> it's better to move it to lib directory.


For some reason I have some doubts about lib/.  But I do not have a
better name in mind either.  What does belong in there?  Do you happen
to have other names in mind as a suggestion? :-)

> 2. seperate hexdump function, and move it to lib/hexdump.c
>
> hexdump module consists of two parts, one is hexdump function, the
> other is user land command. I move the hexdump function to lib, as
> it's also used in other place, for example grub-fstest.

Same here :-)

> 3. add new command crc
>
> Just like hexdump, this module is split into two parts, lib/crc.c for
> the crc function, commands/crc.c for the user land command that
> calculate the crc checksum of selected file.

If it is for users, it should go into util/

When and how is it used?

> 4. rename appleloader command to bootcamp
>
> The name appleloader may be a little confusing, bootcamp seems to be a
> better choice.

How about legacyloader or even legacy?  Isn't that what it does
without actually using possibly trademarked names people are afraid of
using?

--
Marco





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

* Re: [PATCH] Misc patches for grub2
  2008-08-05 10:36 ` Marco Gerards
@ 2008-08-05 14:14   ` Bean
  2008-08-05 17:30     ` Colin D Bennett
  2008-08-05 20:11   ` Robert Millan
  1 sibling, 1 reply; 19+ messages in thread
From: Bean @ 2008-08-05 14:14 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Aug 5, 2008 at 6:36 PM, Marco Gerards <mgerards@xs4all.nl> wrote:
> Hi,
>
> Bean <bean123ch@gmail.com> writes:
>
>> This is a collection of miscellaneous patches, it includes:
>
> Please do not collect patches.  Independant changes can better go into
> independant patches.  Mails like this are easily overseen and so are
> important changes made by such patch.
>

ok, I'd remember this the next time, :-).

>> 1, move util/envblk.c to lib/envblk.c
>>
>> As envblk.c is used by module loadenv and tool grub-editenv, I think
>> it's better to move it to lib directory.
>
>
> For some reason I have some doubts about lib/.  But I do not have a
> better name in mind either.  What does belong in there?  Do you happen
> to have other names in mind as a suggestion? :-)

The files in this directory are used by both modules and utilities,
while files in util/ are only used by utilities.

I also sense that lib is a little strange, but I can't think of a
better name. Some alternative name could be: shared, common, helper.

>> 4. rename appleloader command to bootcamp
>>
>> The name appleloader may be a little confusing, bootcamp seems to be a
>> better choice.
>
> How about legacyloader or even legacy?  Isn't that what it does
> without actually using possibly trademarked names people are afraid of
> using?

There is a legacy boot protocol in efi, but apple doesn't use it.
Therefore, I think it's better to use a name to indicate that this is
apple related, to distinguish from the generic service.

-- 
Bean



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

* Re: [PATCH] Misc patches for grub2
  2008-08-05 14:14   ` Bean
@ 2008-08-05 17:30     ` Colin D Bennett
  0 siblings, 0 replies; 19+ messages in thread
From: Colin D Bennett @ 2008-08-05 17:30 UTC (permalink / raw)
  To: grub-devel

On Tue, 5 Aug 2008 22:14:37 +0800
Bean <bean123ch@gmail.com> wrote:

> On Tue, Aug 5, 2008 at 6:36 PM, Marco Gerards <mgerards@xs4all.nl>
> wrote:
> > For some reason I have some doubts about lib/.  But I do not have a
> > better name in mind either.  What does belong in there?  Do you
> > happen to have other names in mind as a suggestion? :-)
> 
> The files in this directory are used by both modules and utilities,
> while files in util/ are only used by utilities.
> 
> I also sense that lib is a little strange, but I can't think of a
> better name. Some alternative name could be: shared, common, helper.

Until recently, it looked like only the LZMA code was in 'lib/'.  This
led me to think along the following lines:  Since the lzma code is in
lib, which is essentially just a modified import of the LZMA SDK 4.58
beta, I thought that lib's intent was something like:

  Code imported from other projects.
  Although this code may have been modified from its upstream form to
  work for GRUB, it is still, in essence, a library that is maintained
  separately from GRUB, and we should be able to stay in sync with the
  upstream project by integrating new versions when we want to.

By keeping imported code as close to its original form as possible
(and in a logical, self contained source tree location such as
'lib/lzma/'), it will make it much easier to upgrade that imported
code to a new version of the upstream.  Perhaps when LZMA SDK 4.58
final is released they will have fixed a bug or two... then it's easy
to bring that forward if we haven't changed the code too much in GRUB.

Just a thought on what 'lib/' *could* be...

Regards,
Colin



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

* Re: [PATCH] Misc patches for grub2
  2008-08-05 10:36 ` Marco Gerards
  2008-08-05 14:14   ` Bean
@ 2008-08-05 20:11   ` Robert Millan
  1 sibling, 0 replies; 19+ messages in thread
From: Robert Millan @ 2008-08-05 20:11 UTC (permalink / raw)
  To: The development of GRUB 2

On Tue, Aug 05, 2008 at 12:36:06PM +0200, Marco Gerards wrote:
> >
> > The name appleloader may be a little confusing, bootcamp seems to be a
> > better choice.
> 
> How about legacyloader or even legacy?

Legacy is ambigous.  Does it mean BIOS?  msdos partmap?  Or perhaps EFI?

-- 
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] 19+ messages in thread

end of thread, other threads:[~2008-08-05 20:13 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-25 16:38 [PATCH] Misc patches for grub2 Bean
2008-07-25 17:19 ` Chris Knadle
2008-07-25 17:45   ` Bean
2008-07-25 18:58     ` Chris Knadle
2008-07-27  4:36       ` Pavel Roskin
2008-07-25 20:53 ` Robert Millan
2008-07-26  4:28   ` Bean
2008-07-27  4:55     ` Pavel Roskin
2008-07-27  6:00       ` Bean
2008-07-27  7:05         ` Pavel Roskin
2008-07-27  7:14           ` Bean
2008-07-27  7:20             ` Pavel Roskin
2008-07-27  7:30               ` Bean
2008-07-27  7:33                 ` Pavel Roskin
2008-07-27 13:51                   ` Bean
2008-08-05 10:36 ` Marco Gerards
2008-08-05 14:14   ` Bean
2008-08-05 17:30     ` Colin D Bennett
2008-08-05 20:11   ` 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.