Skip to contentSkip to conversation

Misc patches for grub2

PATCH In review Bean 6 participants 19 messages Jul 25, 2008 – Aug 5, 2008 Library code

lore
Share & tools
lore

Bean

author
#0 lore raw

PATCH 1/1 Misc patches for grub2

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.

Signature · 1 line
Bean
commands/crc.c new file +66 -0
new file mode 100644
index 0000000..5148648
@@ -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");
+}
commands/hexdump.c +1 -47

61 lines not on this page · raw message

commands/loadenv.c +1 -1
index 7359683..4dbf1d9 100644
@@ -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[] =
   {
conf/common.rmk +10 -5
index c0087f5..7db0b2a 100644
@@ -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
 
conf/i386-coreboot.rmk +1 -1
index d2546be..5b110d9 100644
@@ -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			\
conf/i386-efi.rmk +6 -6
index 99bb0d4..ea2f0b7 100644
@@ -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
conf/i386-ieee1275.rmk +1 -1
index e4f2a66..03827ae 100644
@@ -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					\
 	\
conf/i386-pc.rmk +1 -1
index 84c0b7d..8617a92 100644
@@ -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 	\
conf/powerpc-ieee1275.rmk +1 -1
index bb04490..6ade1ab 100644
@@ -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		\
conf/x86_64-efi.rmk +6 -6
index daa416c..493627e 100644
@@ -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
include/grub/envblk.h deleted +0 -45

45 lines not on this page · raw message

include/grub/hexdump.h deleted +0 -25
deleted file mode 100644
index 23c6fa6..0000000
@@ -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 */
include/grub/lib/crc.h new file +25 -0
new file mode 100644
index 0000000..ff7284d
@@ -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 */
include/grub/lib/envblk.h new file +45 -0

45 lines not on this page · raw message

include/grub/lib/hexdump.h new file +25 -0
new file mode 100644
index 0000000..23c6fa6
@@ -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 */
lib/crc.c new file +75 -0

75 lines not on this page · raw message

lib/envblk.c new file +156 -0

156 lines not on this page · raw message

lib/hexdump.c new file +68 -0

68 lines not on this page · raw message

loader/efi/appleloader.c deleted +0 -208

208 lines not on this page · raw message

loader/efi/bootcamp.c new file +208 -0

208 lines not on this page · raw message

util/envblk.c deleted +0 -156

156 lines not on this page · raw message

util/grub-editenv.c +1 -2
index 523e5c7..f53a9bb 100644
@@ -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>
util/grub-fstest.c +1 -1
index 3872ff1..35af6a5 100644
@@ -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>
 
#1 lore raw
Quoted 4 lines · Bean

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

Signature · 2 lines
Chris Knadle
[email protected]
author
#2 lore raw
Quoted 8 lines · Chris Knadle
Quoted 4 lines · Bean

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.

Signature · 1 line
Bean
#3 lore raw
Quoted 1 line · Bean

On Sat, Jul 26, 2008 at 1:19 AM, Chris Knadle <[email protected]>

Quoted 6 lines · wrote:
Quoted 6 lines · Bean
Quoted 4 lines

4. rename appleloader command to bootcamp

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

Quoted 6 lines
Quoted 3 lines

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

Signature · 2 lines
Chris Knadle
[email protected]
#4 lore raw
Quoted 13 lines · Chris Knadle
Quoted 1 line · Bean

On Sat, Jul 26, 2008 at 1:19 AM, Chris Knadle <[email protected]>

Quoted 10 lines · wrote:
Quoted 9 lines · Bean
Quoted 4 lines

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.

Quoted 8 lines
Quoted 2 lines

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.

Signature · 2 lines
Regards,
Pavel Roskin
#5 lore raw
In reply to Bean
Quoted 4 lines · Bean

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?

Signature · 5 lines
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 /.)
author
#6 lore raw
Quoted 8 lines · Robert Millan
Quoted 4 lines · Bean

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.

Signature · 1 line
Bean
#7 lore raw
Quoted 7 lines · Bean
Quoted 6 lines · Robert Millan
Quoted 4 lines · Bean

4. rename appleloader command to bootcamp

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

Quoted 8 lines
Quoted 2 lines

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.

Signature · 2 lines
Regards,
Pavel Roskin
author
#8 lore raw

Hi,

Quoted 4 lines · Pavel Roskin

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.

Quoted 7 lines

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 ?

Signature · 1 line
Bean
#9 lore raw
Quoted 8 lines · Bean

Hi,

Quoted 4 lines · Pavel Roskin

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.

Quoted 4 lines

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.

Quoted 10 lines
Quoted 6 lines

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.

Quoted 1 line

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.

Signature · 2 lines
Regards,
Pavel Roskin
author
#10 lore raw

Hi,

Quoted 4 lines · Pavel Roskin
Quoted 4 lines
Quoted 4 lines

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.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

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 ?

Quoted 5 lines
Quoted 2 lines

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.

Signature · 1 line
Bean
#11 lore raw
Quoted 3 lines · Bean
Quoted 1 line

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.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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?

Signature · 2 lines
Regards,
Pavel Roskin
author
#12 lore raw
Quoted 8 lines · Pavel Roskin
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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.

Signature · 1 line
Bean
#13 lore raw
Quoted 8 lines · Bean
Quoted 7 lines · Pavel Roskin
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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.

Quoted 8 lines
Quoted 1 line

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.

Signature · 2 lines
Regards,
Pavel Roskin
author
#14 lore raw
Quoted 11 lines · Pavel Roskin
Quoted 10 lines · Bean
Quoted 8 lines · Pavel Roskin
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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?

Quoted 8 lines
Quoted 6 lines

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).

Signature · 1 line
Bean
#15 lore raw
In reply to Bean

Hi,

Quoted 1 line · Bean

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.

Quoted 4 lines

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? :-)

Quoted 5 lines

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 :-)

Quoted 5 lines

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?

Quoted 4 lines

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

author
#16 lore raw
Quoted 10 lines · Marco Gerards

Hi,

Quoted 1 line · Bean

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, :-).

Quoted 9 lines
Quoted 4 lines

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.

Quoted 8 lines
Quoted 4 lines

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.

Signature · 1 line
Bean
#17 lore raw
Quoted 11 lines · On Tue, 5 Aug 2008 22:14:37 +0800 Bean <[email protected]> wrote:
Quoted 3 lines · Marco Gerards

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

#18 lore raw
In reply to Marco Gerards
Quoted 5 lines · Marco Gerards
Quoted 3 lines

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?

Signature · 5 lines
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."