Re: [PATCH] Fix grub_cpu_idle() declaration

2007-12-06 Thread Robert Millan

My mistake.  Please check that in..

On Fri, Nov 23, 2007 at 09:53:06PM -0500, Pavel Roskin wrote:
 ChangeLog:
 
   * include/grub/i386/time.h: use void in the argument list
   of grub_cpu_idle().
   * include/grub/powerpc/time.h: Likewise.
   * include/grub/sparc64/time.h: Likewise.
 
 Index: include/grub/i386/time.h
 ===
 RCS file: /cvsroot/grub/grub2/include/grub/i386/time.h,v
 retrieving revision 1.2
 diff -u -p -r1.2 time.h
 --- include/grub/i386/time.h  5 Nov 2007 14:54:00 -   1.2
 +++ include/grub/i386/time.h  24 Nov 2007 02:34:37 -
 @@ -20,7 +20,7 @@
  #define KERNEL_CPU_TIME_HEADER   1
  
  static __inline void
 -grub_cpu_idle ()
 +grub_cpu_idle (void)
  {
/* FIXME: this can't work untill we handle interrupts.  */
  /*  __asm__ __volatile__ (hlt); */
 Index: include/grub/powerpc/time.h
 ===
 RCS file: /cvsroot/grub/grub2/include/grub/powerpc/time.h,v
 retrieving revision 1.1
 diff -u -p -r1.1 time.h
 --- include/grub/powerpc/time.h   22 Oct 2007 20:02:16 -  1.1
 +++ include/grub/powerpc/time.h   24 Nov 2007 02:34:37 -
 @@ -20,7 +20,7 @@
  #define KERNEL_CPU_TIME_HEADER   1
  
  static __inline void
 -grub_cpu_idle ()
 +grub_cpu_idle (void)
  {
/* FIXME: not implemented */
  }
 Index: include/grub/sparc64/time.h
 ===
 RCS file: /cvsroot/grub/grub2/include/grub/sparc64/time.h,v
 retrieving revision 1.1
 diff -u -p -r1.1 time.h
 --- include/grub/sparc64/time.h   22 Oct 2007 20:02:16 -  1.1
 +++ include/grub/sparc64/time.h   24 Nov 2007 02:34:37 -
 @@ -20,7 +20,7 @@
  #define KERNEL_CPU_TIME_HEADER   1
  
  static __inline void
 -grub_cpu_idle ()
 +grub_cpu_idle (void)
  {
/* FIXME: not implemented */
  }
 
 
 -- 
 Regards,
 Pavel Roskin
 
 
 ___
 Grub-devel mailing list
 Grub-devel@gnu.org
 http://lists.gnu.org/mailman/listinfo/grub-devel
 

-- 
Robert Millan

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


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Convert grub2 kernel core.img to linux kernel format

2007-12-06 Thread Robert Millan
On Sat, Dec 01, 2007 at 10:16:38PM +0800, Bean wrote:
 Hi,
 
 I've just written a header file that can be used to convert core.img
 to linux kernel format:
 
 cat lnxhdr.bin core.img  grub2.bin
 
 You can then load grub2.bin from syslinux/isolinux/pxelinux/lilo or
 any other boot loader that supports linux kernel.
 
 qemu support linux kernel as well. Now you can start grub2 like this:
 
 qemu -kernel grub2.bin -hda aa.dsk
 
 To compile lnxhdr.bin, use the following commands:
 
 gcc -nostdlib -Wl,-N -o lnxhdr lnxhdr.S
 objcopy -O binary lnxhdr lnxhdr.bin

Very nice!  Can you resend as a patch that puts it in the tree ?  (+ ChangeLog)

-- 
Robert Millan

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


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


BTS overhaul

2007-12-06 Thread Robert Millan

Hi!

I'd like to overhaul the GRUB BTS in Savannah so that it can be used to
track bugs in (or feature requests for) GRUB 2.

What I propose to do is review all bugs, and:

  - If the bug is obviously specific to GRUB Legacy, close it.
  - If the bug was found in GRUB Legacy, but might apply to GRUB 2,
prompt the submitter to reproduce it there (and close it).

I don't think the BTS in its current state is any useful to us; patches
and bug reports are currently overwhelming the mailing list, which make
it less useful for actual discussion.

Comments?

-- 
Robert Millan

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


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Add grub-mkrescue --exclude option

2007-12-06 Thread Robert Millan
On Tue, Nov 20, 2007 at 08:37:50PM +0100, Christian Franke wrote:
 This adds an option to exclude specific modules from the rescue image.

Do you want this because of the ata module ?  Inclussion of ata.mod at this
point is IMO a bug.  If that's your only reason for wanting this feature, I'd
rather exclude ata.mod instead (but in that case, we'd have to figure out how
to allow user to include it in case she _wants_ to).

-- 
Robert Millan

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


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Building GRUB on platforms without ELF support

2007-12-06 Thread Robert Millan
On Mon, Nov 19, 2007 at 09:29:19PM +0100, Christian Franke wrote:
 
 It is not so easy:
 
 Cygwin's libbfd, ld and objcopy support elf32-i386, gas does not.
 
 But ld refuses to output elf32-i386 if pe-i386 is the input format. This 
 restriction is hard-coded into ld because some pe-specific operations 
 are hard-coded into bfd backend (This includes the hack which fixes the 
 pc-relative relocation in the executable).
 
 Enable elf32-i386 as additional output format for gas does not work. The 
 compilation fails, multiple emulations are not supported on i386 platform.
 
 But even building gas as a cross-assembler does not help. Some assembler 
 directives, like symbol type specs, are output format specific. Output 
 from Cygwin's gcc produces syntax errors.
 
 Therefore, you would need also a gcc build as a cross-compiler.

Can't the whole toolchain include ELF support as an alternative target?  Kinda
like -m32 on x86_64.  I don't think it's unreasonable to request that Cygwin
provides this (and it'd probably solve other problems somewhere else).

Have you tried asking the Cygwin maintainers what they think about that?

-- 
Robert Millan

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


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Add grub-mkrescue --exclude option

2007-12-06 Thread Christian Franke
Robert Millan wrote:
 On Tue, Nov 20, 2007 at 08:37:50PM +0100, Christian Franke wrote:
  This adds an option to exclude specific modules from the rescue
  image.
  
 
 Do you want this because of the ata module ?  Inclussion of ata.mod at
 this point is IMO a bug.  If that's your only reason for wanting this
 feature, I'd rather exclude ata.mod instead (but in that case, we'd
 have to figure out how to allow user to include it in case she _wants_
 to).

The necessary exclusion of the ata.mod was actually the reason to
provide this patch. But it also may be useful to track down module
related problems in the future. It is more convenient to use if you want
to exclude a few modules for some reason.

Christian





___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] mkdevicemap for Cygwin

2007-12-06 Thread Robert Millan
On Sun, Nov 18, 2007 at 07:40:15PM +0100, Christian Franke wrote:

 No, it did not work because check_device() returned 1 (exists) on
 (*name == 0). This results in 8 bogus (hd N)\t\n lines and wrong N for
 the real devices.

 Yes, it would work now, because the patch also fixes this bug :-)

Ok, so in that case you don't need...

 +#ifndef __CYGWIN__
  static void
  get_ide_disk_name (char *name, int unit)
  {
 @@ -213,6 +217,7 @@ get_ide_disk_name (char *name, int unit)
*name = 0;
  #endif
  }
 +#endif /* __CYGWIN__ */
  
 [...]
 +#ifndef __CYGWIN__
/* IDE disks.  */
for (i = 0; i  8; i++)
  {
 @@ -431,6 +440,7 @@ make_device_map (const char *device_map,
 num_hd++;
   }
  }
 +#endif /* __CYGWIN__ */

...because you already fixed the problem in:

 -  /* If DEVICE is empty, just return 1.  */
 +  /* If DEVICE is empty, just return error.  */
if (*device == 0)
 -return 1;
 -  
 +return 0;

  ?

-- 
Robert Millan

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


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Building GRUB on platforms without ELF support

2007-12-06 Thread Christian Franke
Robert Millan wrote:
 ...
 Can't the whole toolchain include ELF support as an alternative
 target?  Kinda like -m32 on x86_64.  I don't think it's unreasonable
 to request that Cygwin provides this (and it'd probably solve other
 problems somewhere else).
 
 Have you tried asking the Cygwin maintainers what they think about
 that? 

Besides GRUB2 build, ELF probably support provides no additional
benefit. There are still a lot of open issues to get gcc 4.x working on
Cygwin. Therefore it IMO does not make sense to request such additional
feature now.

I have submitted a patch to fix the PE-ELF relocation info conversion
in objcopy. It was rejected upstream.

Christian





___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] mkdevicemap for Cygwin

2007-12-06 Thread Christian Franke
Robert Millan wrote:
  ...
  Yes, it would work now, because the patch also fixes this bug :-) 
 
 Ok, so in that case you don't need...
 
  +#ifndef __CYGWIN__
  static void
  get_ide_disk_name (char *name, int unit)
  {
  @@ -213,6 +217,7 @@ get_ide_disk_name (char *name, int unit)
  *name = 0;
  #endif
  }
  +#endif /* __CYGWIN__ */
  
  [...]
  +#ifndef __CYGWIN__
  /* IDE disks.  */
  for (i = 0; i  8; i++)
  {
  @@ -431,6 +440,7 @@ make_device_map (const char *device_map,
  num_hd++;
  }
  }
  +#endif /* __CYGWIN__ */
 
 ...because you already fixed the problem in:
 
  -  /* If DEVICE is empty, just return 1.  */
  +  /* If DEVICE is empty, just return error.  */
  if (*device == 0)
  -return 1;
  -
  +return 0;
 
 ?

Yes. I you want this alternative instead, and there are no other issues
with this patch, I'm happy to post a new version.

Christian





___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


New module to detect vmware

2007-12-06 Thread Martin Haaß
Hi all!
I tried to build a module to detect vmware. Attached is the module and a test 
grub.cfg
It is basically working though I have some questions:

can i use the return value of the function (e.g. vmware_detect) to give back a 
value or am I supposed to always return something like GRUB_ERR_NONE?

is there a script to add a module to the makefile or do I have to copy/paste 
it?

if I use this:
if vmware_detect = 1; then set foo=1 else set foo=0 fi
I get syntax error and unknown command in an infinite loop is this expected? 
It should not be a problem with my module, as it also happend while testing a 
environment variable.
So, is it a problem with my if-syntax?

greetings
 Martin

PS:*ahem* I tested against 1.95+20070604 of the debian tree. I will test 
against current cvs as soon as possible  / as soon as someone tells me how to 
automate the makefile updating

insmod vmware-detect
vmware_detect
set default=2
if vmware = 0; then set default=1 else set default=0 fi
menuentry nummer0 {
 linux (hd0,6)/boot/vmlinuz
}
menuentry nummer1 {
 linux (hd0,6)/boot/vmlinuz
}
 /* vmware-detect.c - module to detect vmware  */
/*
 *  GRUB  --  GRand Unified Bootloader
 *  Copyright (C) 2007 Martin Haaß
 *
 *  This program 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 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  VMWARE detection code taken from 
 *  http://chitchat.at.infoseek.co.jp/vmware/backdoor.html
 */

#include grub/normal.h
#include grub/dl.h
#include grub/arg.h
#include grub/misc.h
#include grub/mm.h
#include grub/env.h

//this gives a warning, but looks more fancy than VMWARE_MAGIC 0x564D5868
#define VMWARE_MAGIC 'VMXh'
#define VMWARE_COMMAND_GETVERSION 0x000a
#define VMWARE_PORTNUMBER 0x5658 


static void vmware_getversion( unsigned int *version_number, unsigned int *magic_number, 
   unsigned int *product_type) 
{
  grub_dprintf (vmware,requesting vmware version\n); 
 
  //reference for this is given at top of file,
  //no further magic involved than inline asm
  __asm__(inl %%dx, %%eax\n\t
  //outputs
  : =a (*version_number),
=b (*magic_number),
=c (*product_type)
  //inputs
  : a (VMWARE_MAGIC),
b (0),
c (VMWARE_COMMAND_GETVERSION),
d (VMWARE_PORTNUMBER)
  );
  grub_dprintf(vmware,magic:0x%x, version:0x%x, product 0x%x\n,*magic_number, *version_number, *product_type);
}

static grub_err_t
grub_cmd_vmwaredetect (struct grub_arg_list *state __attribute__ ((unused)),
		int argc __attribute__ ((unused)),
		char **args __attribute__ ((unused)))
{
  unsigned int version_number; 
  unsigned int magic_number;
  unsigned int product_type;

  vmware_getversion(version_number,magic_number,product_type);
  if (magic_number == VMWARE_MAGIC) {
grub_dprintf(vmware,inside in a vmware\n);
grub_env_set(vmware,1);
return 1;
  } else {
grub_dprintf(vmware,not in a vmware\n);
grub_env_set(vmware,0);
return 0;
  }
}

static grub_err_t
grub_cmd_vmwareversion (struct grub_arg_list *state __attribute__ ((unused)),
   int argc __attribute__ ((unused)),
   char **args __attribute__ ((unused)))
{
  unsigned int version_number; 
  unsigned int magic_number;
  unsigned int product_type;

  vmware_getversion(version_number,magic_number,product_type);  
  if (magic_number == VMWARE_MAGIC) {
grub_dprintf(vmware,version number 0x%x\n,version_number);
return version_number;
  } else {
grub_dprintf(vmware,not in a vmware\n);
return 0;
  }
}

static grub_err_t
grub_cmd_vmwaretype (struct grub_arg_list *state __attribute__ ((unused)),
   int argc __attribute__ ((unused)),
   char **args __attribute__ ((unused)))
{
  unsigned int version_number; 
  unsigned int magic_number;
  unsigned int product_type;

  vmware_getversion(version_number,magic_number,product_type);
  if (magic_number == VMWARE_MAGIC) {
grub_dprintf(vmware,product type 0x%x\n,product_type);
return product_type;
  }  else {
grub_dprintf(vmware,not in a vmware\n);
return 0;
  }
}

GRUB_MOD_INIT(vmwaredetect)
{
  (void)mod;			/* To stop warning. */
  grub_register_command (vmware_detect, grub_cmd_vmwaredetect, GRUB_COMMAND_FLAG_BOTH,
 vmware_detect, returns 1 if 

Convert various startup files to linux kernel format

2007-12-06 Thread Bean
Hi,

I've just written a new tool loadbin for the GRUB Utilities project.
It's used to convert various startup files to linux kernel format, so
that they can be loaded in many boot loaders, such as GRUB Legacy,
GRUB2, GRUB4DOS, syslinux/isolinux/pxelinux, lilo, etc.

For each type of startup file, there is a corresponding header, for
example, ldgrub2.bin is the header for grub2.

There are three ways to use the header:

1, Use the header directly as kernel, and the startup file as initrd:

kernel ldgrub2.bin
initrd core.img

2, Combine the header and startup file, to create a single boot file.
To do this, you need the tool mkimage from loadbin:

mkimage ldgrub2.bin core.img grub2.bin

then you can start grub2 by loading grub2.bin

kernel grub2.bin

3, First create the boot file just as step 2, then you can load it
using the GRLDR boot sector.

To install boot code to MBR:

grubinst -b=grub2.bin DEVICE

you also need to copy grub2.bin to the root directory of any
FAT/NTFS/EXT2 partition.

To load it using the NT boot manager, first create a boot file using grubinst:

grubinst -o -b=grub2.bin grub2.mbr

Then add the following line to the bottom of BOOT.INI:
C:\grub2.mbr=grub2.bin

Because some boot loader doesn't pass the boot drive in %DL to the
linux kernel, so we need to set it inside the header. You can use
mkimage to confiure this parameter, for example:

mkimage -x 0x80 ldgrub2.bin core.img grub2.bin

For some system, like GRUB2, you can also set the partition number, for example:

mkimage -x 0x80,0 ldgrub2.bin core.img grub2.bin

After GRUB2 takes over, it will use (hd0,1) as root device to load
menu file and extra modules.

If you are booting from CDROM, you can use 0xe0 as the device number:

mkimage -x 0xe0 ldgrub.bin stage2 grub.bin

Then, after GRUB takes over, it can access the files in CDROM using device (cd).

Currently, loadbin support the following startup files:

1, GRUB2
The header is ldgrub2.bin, the correspoding startup file is core.img.

2, GRUB Legcy
The header is ldgrub.bin, the correspoding startup file is stage2.

3, NTLDR and GRUB4DOS
The header is ldntldr.bin, the correspoding startup file is ntldr and grldr.

Support for other startup file, such as io.sys (MSDOS) and kernel.sys
(FreeDOS), might be added later.

You can download the source code and win32 binaries at:

http://download.gna.org/grubutil/

Linux user need to compile using the source code:
make

-- 
Bean


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Convert grub2 kernel core.img to linux kernel format

2007-12-06 Thread Bean
Hi,

Added a new file boot/i386/pc/lnxboot.S, which will compile into
lnxboot.img. You can use it in a few ways:

1, Use it as standalone kernel, core.img as initrd

kernel lnxboot.img
initrd core.img

For example, you can start grub2 in qemu like this:

qemu -kernel lnxboot.img -initrd core.img ...

2, Create a combined kernel:

cat lnxboot.img core.img  grub2.img

You can then load grub2.img as kernel

kernel grub2.img

The image grub2.img can also be loaded using the grldr boot loader.

-- 
Bean


grub2-lnxboot.diff
Description: Binary data
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Switching to git?

2007-12-06 Thread Pavel Roskin
Hello!

This is a reaction to the BTS overhaul post, I just don't want to
hijack the thread with a separate topic.

If someone asked me what is the project that is not using git but would
benefit from it most, I would say it's GRUB.

First and foremost, git (together with StGIT and other tools) relieves
the pressure to commit.  CVS and Subversion allow to work with only one
patch at a time.  I can have only one patch applied to the working
directory if I want to commit one of the patches safely.  There is no
support for refining series of patches.  StGIT exists precisely for
that, and even bare git is getting better at that.

Another closely related advantage is that git allows parallel
development.  Branching is built in from the beginning.  There are
unofficial forks of GRUB 1 already (such as grub4dos).  git would help
turn forks into branches, bring them under one roof and eventually allow
merging all useful features together.

Not to be overlooked it the git-bisect command.  No amount of code
review can prevent bugs, especially for software that interacts with
black box firmware and hardware.  Having an effective mechanism for
bug isolation is essential.

Tools for viewing history of the git repository, such as qgit, gitk and
tig have no equivalents for CVS.  And the tools for mailing series of
patches are great time savers.  git is actively developed and has a
vibrant community.  Yet it's well past the point where major
incompatibilities are routinely introduced.

Other GNU projects have switched to git.  Savannah supports git.  The
list of the GNU projects using git is pretty impressive:
http://git.sv.gnu.org/gitweb/

I think GNU GRUB would be a welcome addition.

-- 
Regards,
Pavel Roskin


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Switching to git?

2007-12-06 Thread Otavio Salvador
Pavel Roskin [EMAIL PROTECTED] writes:

 Other GNU projects have switched to git.  Savannah supports git.  The
 list of the GNU projects using git is pretty impressive:
 http://git.sv.gnu.org/gitweb/

 I think GNU GRUB would be a welcome addition.

+1. I brought this up to discussion some time ago here but hadn't much
feedback. I hope we can move forward this time :-D

-- 
O T A V I OS A L V A D O R
-
 E-mail: [EMAIL PROTECTED]  UIN: 5906116
 GNU/Linux User: 239058 GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
-
Microsoft sells you Windows ... Linux gives
 you the whole house.


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Switching to git?

2007-12-06 Thread willem

Otavio Salvador wrote:

Pavel Roskin [EMAIL PROTECTED] writes:

  

Other GNU projects have switched to git.  Savannah supports git.  The
list of the GNU projects using git is pretty impressive:
http://git.sv.gnu.org/gitweb/

I think GNU GRUB would be a welcome addition.



+1. I brought this up to discussion some time ago here but hadn't much
feedback. I hope we can move forward this time :-D

  

I did look at git.
I agree , git is better than svn.

regards


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel