GRUB 2.02 and APFS filesystems causing boot-time issue

2023-06-15 Thread vincent


Hi all,

I'm new to this list and I hope it's the right place to ask for help..

I'd like to better understand how to rebuild grubx64.efi from 
upstream source so I could give a try at fixing the issue I've come 
across:


https://bugzilla.redhat.com/show_bug.cgi?id=1524685

https://savannah.gnu.org/bugs/?64304

Long story short: the simple presence of an APFS filesystem on any disk in 
an x86_64 system makes GRUB spit out errors (as if multiple disks were 
unreadable). The machine still boots fine (after pressing 'q') but the 
process requires human intervention on every reboot.


The machine in question is a Mac Pro (Later 2013) but at this point I'm 
pretty sure it's a software problem since changing the partition type of 
the APFS partition to something else makes GRUB happy again.


This system uses UEFI and the Linux boot entry shows this:

[root@neraka ~]# efibootmgr -v|grep shim
Boot* Red Hat Enterprise Linux 
HD(2,GPT,d36bfc93-9920-4346-9c56-bd7c57bdb0bb,0x1000,0x3f800)/File(\EFI\redhat\shimx64.efi)


Is my interpretation of the issue correct? Something causes GRUB to get 
confused when it probes/enumerates the partition and it fails in 
shimx64.efi (a signed grubx64.efi rebuild)


Since shimx64.efi is a signed binary which would not possible for me to 
rebuild, am I correct to think that I instead want to boot grubx64.efi an 
learn how to rebuild it (with efibootmgr it would be easy to add another 
entry pointing to that binary and try to boot from it).


I would love to have a few pointers, Thank you. (I've done some 'C' and 
'ASM' in my past lives so I hope that will be enough... ) :)


Thank you for your consideration,

Vincent

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


Re: [PATCH] arm/efi: fix ram base detection

2021-03-30 Thread Vincent Stehlé via Grub-devel
On Mon, Mar 22, 2021 at 06:28:51PM +, Leif Lindholm wrote:
..
> > > diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
> > > index 0cdb063bb..abf8772bc 100644
> > > --- a/grub-core/kern/efi/mm.c
> > > +++ b/grub-core/kern/efi/mm.c
> > > @@ -677,7 +677,8 @@ grub_efi_get_ram_base(grub_addr_t *base_addr)
> > >for (desc = memory_map, *base_addr = GRUB_EFI_MAX_USABLE_ADDRESS;
> > > (grub_addr_t) desc < ((grub_addr_t) memory_map + memory_map_size);
> > > desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
> > > -if (desc->attribute & GRUB_EFI_MEMORY_WB)
> > > +if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY &&
> > > +desc->attribute & GRUB_EFI_MEMORY_WB)
> 
> Can we safely assume we don't also need to check against
> GRUB_EFI_PERSISTENT_MEMORY? If so, this is fine.

Hi Leif,

Thanks for the review.

This is a good question about persistent memory; I don't know if we should
check it or not.

I am "fighting" with qemu to add an nvdimm above or below the first normal
memory region to see how this behaves. I will let you know when I have
succeeded.

Best regards,
Vincent.

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


[PATCH] arm/efi: fix ram base detection

2021-03-12 Thread Vincent Stehlé via Grub-devel
On 32b Arm platforms, grub allocates memory for the initrd in the first
512MB of DRAM. To do so, the grub_efi_get_ram_base() function will be
called to compute the DRAM base. Currently this function returns the lowest
start address of all memory regions with attribute write-back.

However, if for example a small memory region with type reserved and
attribute write-back is present at the bottom of the memory map, it will be
chosen as DRAM base and initrd memory allocation will fail with:

  error: out of memory.

  Press any key to continue...

This is indeed the case with qemu arm machine virt when the secure world is
enabled and TF-A and OP-TEE are used. The secure world firmware will
reserve secure memory, resulting in the following EFI memory map:

  Type  Physical start  - end #PagesSize Attributes
  reserved  0e10-0eff 0f00 15MiB WB
  conv-mem  4000-47ef9fff 7efa 130024KiB WB
  ACPI-rec  47efa000-47f05fff 000c 48KiB WB
  conv-mem  47f06000-6d4f9fff 000255f4 612304KiB WB
  ldr-data  6d4fa000-6d4fafff 0001  4KiB WB
 ...

In this case, the DRAM base is computed as 0xe10, while it should be
0x4000 instead.

Fix this issue by considering only conventional memory with attribute
write-back for DRAM base computation.

This is similar to what is done by Peter Jones in commit 3c1a5d940be5
("arm/arm64 loader: Better memory allocation and error messages.") in
Fedora's grub[1]. This patch reduces the modifications to a minimum.

[1]: https://github.com/rhboot/grub2.git

Fixes: bad144c60f66 ("efi: Add grub_efi_get_ram_base() function for arm64")
Suggested-by: Grant Likely 
Signed-off-by: Vincent Stehlé 
Cc: Peter Jones 
Cc: Leif Lindholm 
---
 grub-core/kern/efi/mm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c
index 0cdb063bb..abf8772bc 100644
--- a/grub-core/kern/efi/mm.c
+++ b/grub-core/kern/efi/mm.c
@@ -677,7 +677,8 @@ grub_efi_get_ram_base(grub_addr_t *base_addr)
   for (desc = memory_map, *base_addr = GRUB_EFI_MAX_USABLE_ADDRESS;
(grub_addr_t) desc < ((grub_addr_t) memory_map + memory_map_size);
desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size))
-if (desc->attribute & GRUB_EFI_MEMORY_WB)
+if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY &&
+desc->attribute & GRUB_EFI_MEMORY_WB)
   *base_addr = grub_min (*base_addr, desc->physical_start);
 
   grub_free(memory_map);
-- 
2.30.0


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


Re: [PATCH] Fix error message about the wrong command having failed: mformat instead of mcopy

2019-05-10 Thread Vincent Legoll
Hello,

> May I add your SOB? If yes then Reviewed-by: Daniel Kiper 
> 

Yes, and sorry to have forgotten to add it

-- 
Vincent Legoll

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


[PATCH] Fix error message about the wrong command having failed: mformat instead of mcopy

2019-04-27 Thread Vincent Legoll
---
 util/grub-mkrescue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/grub-mkrescue.c b/util/grub-mkrescue.c
index 21e5ce4e4..ce2cbc4f1 100644
--- a/util/grub-mkrescue.c
+++ b/util/grub-mkrescue.c
@@ -815,7 +815,7 @@ main (int argc, char *argv[])
grub_util_error ("`%s` invocation failed\n", "mformat");
   rv = grub_util_exec ((const char * []) { "mcopy", "-s", "-i", efiimgfat, 
efidir_efi, "::/", NULL });
   if (rv != 0)
-   grub_util_error ("`%s` invocation failed\n", "mformat");
+   grub_util_error ("`%s` invocation failed\n", "mcopy");
   xorriso_push ("--efi-boot");
   xorriso_push ("efi.img");
   xorriso_push ("-efi-boot-part");
-- 
2.19.1


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


Re: --recheck option

2012-07-06 Thread Vincent Pelletier
Le jeudi 05 juillet 2012 14:19:54, yannubu...@gmail.com a écrit :
 A) Which are the situations where the --recheck option of grub-install must
 NOT be used?

In my experience (grub legacy, linux boot with /dev/hd* device names, years 
ago), I had to play with device map to be able to reorder boot device priority 
(or plug HDDs in a different PATA layout, I don't remember precisely).
I could edit the map to fit the intended layout change, grub (without
--recheck) just followed, and machine could boot just fine.

Nowadays I don't have to care about this, thanks to UUIDs everywhere instead 
of dev paths.

-- 
Vincent Pelletier

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


Re: Mouse support in GRUB

2011-10-01 Thread Vincent Pelletier
Le samedi 01 octobre 2011 15:39:12, Tirtha Chatterjee a écrit :
 So I wish to work on implementing mouse support for GRUB.

I've attached the result of my early fidling with grub on sparc.
Yeah, once I got grub to load, I made a serial msmouse work instead of working 
on things like actually getting it to boot any OS.

It most certainly won't be applying cleanly on current code, and it is highly 
unlikely that I rebase it myself.

This adds 2 modules to grub, each with a single command.
Both modules require ieee1275, and were only tested on sparc.
One opens a serial port and moves a mouse cursor on screen. It doesn't 
integrate with anything (no event system...).
The other draws a mandelbrot fractal (this is off-topic, but it was in the 
same patch...).

More seriously, I feel the only value in this patch is in the ieee1275 
wrappers for framebuffer entrypoints.

If anyone feels like integrating any chunk, please do. I had signed the 
copyright assignment back then, so you can consider the FSF own copyright on 
that patch already, as far as I'm concerned.

-- 
Vincent Pelletier
Index: commands/ieee1275/mandelbrot.c
===
RCS file: commands/ieee1275/mandelbrot.c
diff -N commands/ieee1275/mandelbrot.c
--- /dev/null	1 Jan 1970 00:00:00 -
+++ commands/ieee1275/mandelbrot.c	25 Aug 2005 09:05:09 -
@@ -0,0 +1,145 @@
+/* mandelbrot.c - Draws a nice Manldebrot fractal.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  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 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 GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include grub/rescue.h
+#include grub/dl.h
+#include grub/misc.h
+#include grub/machine/kernel.h
+#include grub/ieee1275/ieee1275.h
+#include grub/ieee1275/fb.h
+#include grub/ieee1275/fbprops.h
+
+#ifndef GRUB_EMBED
+static grub_err_t
+grub_cmd_mandelbrot (struct grub_arg_list *state __attribute__ ((unused)),
+	 int argc, char **argv)
+#else /* GRUB_EMBED */
+static void
+grub_cmd_mandelbrot (int argc, char *argv[])
+#endif /* ! GRUB_EMBED */
+{
+  grub_ieee1275_ihandle_t screen;
+  grub_ieee1275_phandle_t pscreen;
+  const unsigned int nmax = 25;
+  unsigned int n, x, y, w, h, a;
+  const double xmin = -2.5, xmax = 2.5, ymin = -2, ymax = 2;
+  double dx, dy, rz, iz, tz, rc, ic;
+  unsigned char *fb, tmp[4];
+  char *device;
+  grub_ssize_t actual;
+
+  if(argc == 1)
+device = argv[0];
+  else
+device = screen;
+  grub_printf(Using device %s...\n,device);
+  if (!grub_ieee1275_open (device, screen))
+{
+  grub_ieee1275_finddevice (device, pscreen);
+  h = grub_ieee1275_fb_height (pscreen);
+  w = grub_ieee1275_fb_width (pscreen);
+  grub_printf(w=%d h=%d\n,w,h);
+  grub_ieee1275_get_property (pscreen,address,tmp,sizeof(tmp),actual);
+  fb = (unsigned char *) grub_ieee1275_decode_int_4(tmp);
+//  fb = (unsigned char *) grub_ieee1275_fb_addr (pscreen);
+  grub_printf (Framebuffer is at %p.\nClearing screen...\n, fb);
+  for (a = 0; a  w * h; a++)
+fb[a] = 0;
+  for (a = 0; a  256; a++) /* Fill palette with shades of gray.  */
+grub_ieee1275_setcolor (screen, a, a, a, a);
+  dx = (xmax - xmin) / w;
+  dy = (ymax - ymin) / h;
+  for (x = 0; x  w; x++)
+{
+  rc = xmin + x * dx;
+  for (y = 0; y  h; y++)
+{
+  ic = ymin + y * dy;
+  rz = 0;
+  iz = 0;
+  for (n = 1; n  nmax; n++)
+{
+  tz = rz * rz - iz * iz + rc;
+  iz = 2 * rz * iz + ic;
+  rz = tz;
+  if (rz * rz + iz * iz = 4)
+{
+  fb[x+w*y] = (n*255/nmax) % 256;
+  n = nmax;
+}
+}
+  if (rz * rz + iz * iz  4)
+fb[x+w*y]=255;
+}
+}
+#if 0
+  grub_ieee1275_close (screen); /* If screen is closed, it goes black.  */
+#endif
+}
+  grub_printf(Finished !\n);
+#ifndef GRUB_EMBED
+  return 0;
+#endif /* ! GRUB_EMBED */
+}
+
+
+#ifdef GRUB_EMBED
+void
+grub_mandelbrot_init (void)
+{
+  grub_rescue_register_command (mandelbrot, grub_cmd_mandelbrot,
+Draws a fractal.);
+}
+
+void
+grub_mandelbrot_fini

Re: Your contributions to grub.enbug.org

2011-03-31 Thread Vincent Pelletier
Le jeudi 31 mars 2011 21:17:10, vous avez écrit :
 would you agree to consider that your contributor agreement covers wiki as
 well?

Sure, no problem.

-- 
Vincent Pelletier

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


Re: [PATCH 0/10]: Respin of sparc patches.

2009-03-07 Thread Vincent Pelletier
Le Saturday 07 March 2009 11:37:36 Robert Millan, vous avez écrit :
 I'm not sure how many of us are experienced with sparc (Vincent?  Who
 else?).

I wouldn't call me experienced, except if it only means that I did 
experimentation with that arch :) .

 I'm very interested to see proper sparc support completed/merged.  Your
 effort is much appreciated.

+1

-- 
Vincent Pelletier


signature.asc
Description: This is a digitally signed message part.
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH 7/7]: Get cob-webs out of sparc64-ieee1275.rmk

2009-03-04 Thread Vincent Pelletier
Le Wednesday 04 March 2009 03:15:39 David Miller, vous avez écrit :
 There is no way anyone tried to build the sparc target in
 years :-)

Literaly years. More than 3 I think.
I gave it a try ~2 1/2 years ago, and started writing a patch... And gave up.
Thanks a lot for taking care of this. I had a very fun time discovering 
sparc64 as I wrote it, and I stopped before making anything usable. I hope 
you won't find too much bad code (sorry about that cache flush).

I guess I'll fire up my good ol' ultra 10 to celebrate this :) .

-- 
Vincent Pelletier


signature.asc
Description: This is a digitally signed message part.
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Floating point usage

2008-06-05 Thread Vincent Pelletier
Le Thursday 05 June 2008 17:12:26 Jan Kleinsorge, vous avez écrit :
 Given that GRUB is linked against it. Which is likely as it is a necessity
 when compiling with gcc.

...except if -nostdlib is given to gcc, which is the case in grub2. For the 
bootloader part at least, grub-emu is another question.
And there is an except to this except: If -lgcc is specified it will be used, 
and it is for the following archs, as far as I can see:
 - powerpc-ieee1275
 - i386-linuxbios
 - i386-ieee1275

So half the supported archs don't need libgcc, I think it's enough to try 
avoiding that dependency.

-- 
Vincent Pelletier


signature.asc
Description: This is a digitally signed message part.
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: contradiction in boot/i386/pc/boot.S

2008-01-08 Thread Vincent Pelletier
On Jan 9, 2008 12:48 AM, Vincent Pelletier [EMAIL PROTECTED] wrote:
 within the next 2 months

Gah. next 2 weeks.

Vincent Pelletier


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


Re: contradiction in boot/i386/pc/boot.S

2008-01-08 Thread Vincent Pelletier
On Jan 9, 2008 12:37 AM, Robert Millan [EMAIL PROTECTED] wrote:
 On Tue, Jan 08, 2008 at 05:57:16PM -0500, Pavel Roskin wrote:
  That's
  something I'll rather not do without seeing the original bug reports.

 Same here.  Maybe Okuji will know..

I have a box with this bug - sadly, I will not be able to reach it
within the next 2 months - so I can test various proposals if provided
with patches :) .

IIRC originaly this fix was dropped from gub to grub2, and I re-raised
the issue. But that's all, I don't think I touched the code.

Vincent Pelletier


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


[non-finalised patch] reiserfs handling

2007-10-14 Thread Vincent Pelletier
Hi.

Attached is my work on reiserfs handling.

As I don't plan to work on it anytime soon, and as I was advised on IRC, I 
port it here, in case someone want to use it as a base.

It does not follow the coding style, some part looks quite ugly (big hex 
constants as bitmasks, grub_reiserfs_get_item and grub_reiserfe_iterate_dir 
functions), has old commented out code (grub_reiserfs_read) and some debug 
printfs commented out (grub_reiserfe_iterate_dir), conditionaly compiled 
(GRUB_REISERFS_DEBUG), or always available.

As such, it was good enough to read tens of megabyte big files on a reiserfs 
3.5 disk image on a PPC32 box. It handles symlinks as such, and showed no 
read errors as far as I could tell. It was only tested in grub-emu, and never 
on a live system.

To build grub2 with reiserfs module, add this file in the fs folder and add 
a reference to this file in conf/*.rmk files .

Sorry for not finishing that work.

-- 
Vincent Pelletier
/* reiserfs.c - ReiserFS versions up to 3.6 */
/*
 *  GRUB  --  GRand Unified Bootloader
 *  Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 *
 *  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.
 */

/*
  TODO:
  implement journal handling (ram replay)
  implement symlinks support
  support items bigger than roughly (blocksize / 4) * blocksize
!! that goes for directories aswell, size in such case is metadata size.
  test tail packing  direct files
  validate partition label position
*/
#warning TODO : journal, tail packing (?)

// #define GRUB_REISERFS_KEYV2_BITFIELD
// #define GRUB_REISERFS_DEBUG
// #define GRUB_REISERFS_JOURNALING
// #define GRUB_HEXDUMP

#include grub/err.h
#include grub/file.h
#include grub/mm.h
#include grub/misc.h
#include grub/disk.h
#include grub/dl.h
#include grub/types.h
#include grub/fshelp.h

#define MIN(a, b) (((a)(b))?(a):(b))
#define MAX(a, b) (((a)(b))?(a):(b))

#define REISERFS_SUPER_BLOCK_OFFSET 0x1
#define REISERFS_MAGIC_LEN 12
#define REISERFS_MAGIC_STRING ReIsEr2Fs\0\0\0
/* If the 3rd bit of an item state is set, then it's visible.  */
#define GRUB_REISERFS_VISIBLE_MASK ((grub_uint16_t)0x04)
#define REISERFS_MAX_LABEL_LENGTH 16
#define REISERFS_LABEL_OFFSET 0x64

#define S_IFLNK 0xA000

#ifndef GRUB_UTIL
static grub_dl_t my_mod;
#endif

enum grub_reiserfs_item_type
{
  GRUB_REISERFS_STAT,
  GRUB_REISERFS_DIRECTORY,
  GRUB_REISERFS_DIRECT,
  GRUB_REISERFS_INDIRECT,
  GRUB_REISERFS_ANY, /* Matches both _DIRECT and _INDIRECT when searching.  */
  GRUB_REISERFS_UNKNOWN
};

struct grub_reiserfs_superblock
{
  grub_uint32_t block_count;
  grub_uint32_t block_free_count;
  grub_uint32_t root_block;
  grub_uint32_t journal_block;
  grub_uint32_t journal_device;
  grub_uint32_t journal_original_size;
  grub_uint32_t journal_max_transaction_size;
  grub_uint32_t journal_block_count;
  grub_uint32_t journal_max_batch;
  grub_uint32_t journal_max_commit_age;
  grub_uint32_t journal_max_transaction_age;
  grub_uint16_t block_size;
  grub_uint16_t oid_max_size;
  grub_uint16_t oid_current_size;
  grub_uint16_t state;
  grub_uint8_t magic_string[REISERFS_MAGIC_LEN];
  grub_uint32_t function_hash_code;
  grub_uint16_t tree_height;
  grub_uint16_t bitmap_number;
  grub_uint16_t version;
  grub_uint16_t reserved;
  grub_uint32_t inode_generation;
} __attribute__ ((packed));

#ifdef GRUB_REISERFS_JOURNALING
#error Journaling not yet supported.
struct grub_reiserfs_journal_header
{
  grub_uint32_t last_flush_uid;
  grub_uint32_t unflushed_offset;
  grub_uint32_t mount_id;
} __attribute__ ((packed));

struct grub_reiserfs_transaction_header
{
  grub_uint32_t id;
  grub_uint32_t len;
  grub_uint32_t mount_id;
  char *data;
  char checksum[12];
} __attribute__ ((packed));
#endif

struct grub_reiserfs_stat_item_v1
{
  grub_uint16_t mode;
  grub_uint16_t hardlink_count;
  grub_uint16_t uid;
  grub_uint16_t gid;
  grub_uint32_t size;
  grub_uint32_t atime;
  grub_uint32_t mtime;
  grub_uint32_t ctime;
  grub_uint32_t rdev;
  grub_uint32_t first_direct_byte;
} __attribute__ ((packed));

struct grub_reiserfs_stat_item_v2
{
  grub_uint16_t mode;
  grub_uint16_t reserved;
  grub_uint32_t hardlink_count;
  grub_uint64_t size;
  grub_uint32_t uid;
  grub_uint32_t gid;
  grub_uint32_t atime;
  grub_uint32_t mtime;
  grub_uint32_t ctime;
  grub_uint32_t blocks;
  grub_uint32_t

Re: How to generate .mk files from .rmk file ?

2007-03-16 Thread Vincent Pelletier
Le vendredi 16 mars 2007 08:02, Jerone Young a écrit :
 Exactly how do you generate a .mk file from the .rmk files. What is
 the ruby command line to do this?

From the root of the working copy:
./autogen.sh

-- 
Vincent Pelletier


pgp7bb7IhPmCS.pgp
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] Fix build of sparc64 port implement setjmp/longjmp

2007-03-04 Thread Vincent Pelletier
Hi.

Here is a (mostly) maintainance patch for sparc64 port.
It only fixes the build and implements setjmp/longjmp so that one can jump to 
rescue mode.

It also builds the linux loader module, but the boot is known to fail on my 
box (some disk access error at OF level when reading the linux kernel image).

I prefer to post the patch for validation before commiting, it's been too long 
I haven't post to go on my own :) . (changelog is in the diff :p ).

-- 
Vincent Pelletier
? include/grub/sparc64/ieee1275/loader.h
Index: ChangeLog
===
RCS file: /sources/grub/grub2/ChangeLog,v
retrieving revision 1.341
diff -u -p -r1.341 ChangeLog
--- ChangeLog	21 Feb 2007 23:25:09 -	1.341
+++ ChangeLog	4 Mar 2007 12:32:07 -
@@ -1,3 +1,70 @@
+2007-03-01  Vincent Pelletier  [EMAIL PROTECTED]
+
+	* THANKS: Update my mail address.
+	* conf/sparc64-ieee1275.rmk: Include conf/common.mk.
+	(COMMON_ASFLAGS): Build sparc64 binary.
+	(COMMON_LDFLAGS): Updated to gcc-style flags.
+	(grub_mkimage_SOURCES): Commented out.
+	(pkgdata_MODULES): Removed fat.mod, ufs.mod, ext2.mod, minix.mod,
+	hfs.mod, jfs.mod, hello.mod, font.mod, ls.mod, boot.mod, cmp.mod,
+	cat.mod, terminal.mod, fshelp.mod, amiga.mod, apple.mod, pc.mod,
+	loopback.mod, help.mod, sun.mod, configfile.mod, search.mod,
+	gzio.mod, xfs.mod, affs.mod, sfs.mod, acorn.mod.  Added _linux.mod
+	and linux.mod.
+	(kernel_elf_LDFLAGS): Prepend common flags.  Updated to gcc-style
+	flags.
+	(_linux_mod_SOURCES, _linux_mod_CFLAGS, _linux_mod_LDFLAGS)
+	(linux_mod_SOURCES, linux_mod_CFLAGS, linux_mod_LDFLAGS): Uncomment.
+	(grub_script.tab.c, grub_script.tab.h, grub_modules_init.lst)
+	(fshelp_mod_SOURCES, fshelp_mod_CFLAGS, fshelp_mod_LDFLAGS)
+	(fat_mod_SOURCES, fat_mod_CFLAGS, fat_mod_LDFLAGS)
+	(ext2_mod_SOURCES, ext2_mod_CFLAGS, ext2_mod_LDFLAGS)
+	(ufs_mod_SOURCES, ufs_mod_CFLAGS, ufs_mod_LDFLAGS)
+	(minix_mod_SOURCES, minix_mod_CFLAGS, minix_mod_LDFLAGS)
+	(hfs_mod_SOURCES, hfs_mod_CFLAGS, hfs_mod_LDFLAGS, jfs_mod_SOURCES)
+	(jfs_mod_CFLAGS, jfs_mod_LDFLAGS, iso9660_mod_SOURCES)
+	(iso9660_mod_CFLAGS, iso9660_mod_LDFLAGS, xfs_mod_SOURCES)
+	(xfs_mod_CFLAGS, xfs_mod_LDFLAGS, affs_mod_SOURCES)
+	(affs_mod_CFLAGS, affs_mod_LDFLAGS, sfs_mod_SOURCES)
+	(sfs_mod_CFLAGS, sfs_mod_LDFLAGS, hello_mod_SOURCES)
+	(hello_mod_CFLAGS, hello_mod_LDFLAGS, boot_mod_SOURCES)
+	(boot_mod_CFLAGS, boot_mod_LDFLAGS, terminal_mod_SOURCES)
+	(terminal_mod_CFLAGS, terminal_mod_LDFLAGS, ls_mod_SOURCES)
+	(ls_mod_CFLAGS, ls_mod_LDFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
+	(cmp_mod_LDFLAGS, cat_mod_SOURCES, cat_mod_CFLAGS, cat_mod_LDFLAGS)
+	(help_mod_SOURCES, help_mod_CFLAGS, help_mod_LDFLAGS)
+	(font_mod_SOURCES, font_mod_CFLAGS, font_mod_LDFLAGS)
+	(terminfo_mod_SOURCES, terminfo_mod_CFLAGS, terminfo_mod_LDFLAGS)
+	(amiga_mod_SOURCES, amiga_mod_CFLAGS, amiga_mod_LDFLAGS)
+	(apple_mod_SOURCES, apple_mod_CFLAGS, apple_mod_LDFLAG)
+	(pc_mod_SOURCES, pc_mod_CFLAGS, pc_mod_LDFLAGS, sun_mod_SOURCES)
+	(sun_mod_CFLAGS, sun_mod_LDFLAGS, acorn_mod_SOURCES, acorn_mod_CFLAGS)
+	(loopback_mod_SOURCES, loopback_mod_CFLAGS, loopback_mod_LDFLAGS)
+	(default_mod_SOURCES, default_mod_CFLAGS, default_mod_LDFLAGS)
+	(timeout_mod_SOURCES, timeout_mod_CFLAGS, timeout_mod_LDFLAGS)
+	(configfile_mod_SOURCES, configfile_mod_CFLAGS)
+	(configfile_mod_LDFLAGS, search_mod_SOURCES, search_mod_CFLAGS)
+	(search_mod_LDFLAGS, gzio_mod_SOURCES, gzio_mod_CFLAGS)
+	(gzio_mod_LDFLAGS, test_mod_SOURCES, test_mod_CFLAGS)
+	(test_mod_LDFLAGS): Removed.
+	* conf/sparc64-ieee1275.mk: Regenerate.
+	* include/grub/elf.h (ELF64_R_TYPE_DATA, ELF64_R_TYPE_ID)
+	(ELF64_R_TYPE_INFO): New macros.
+	* include/grub/sparc64/setjmp.h: Include grub/types.h.
+	(grub_jmp_buf): Update definition.
+	* kern/sparc64/dl.c (grub_arch_dl_relocate_symbols): Use
+	ELF64_R_TYPE_ID macro.  Explicited bitmasks and casts.  Fixed
+	R_SPARC_WDISP30 relocation checks and updated its error message.
+	Added support for R_SPARC_13 and R_SPARC_OLO10 relocations.
+	* kern/sparc64/ieee1275/init.c (grub_claim_heap): New function.
+	(grub_machine_fini): Call `grub_ieee1275_exit'.
+	* kern/sparc64/ieee1275/openfw.c (grub_devalias_iterate): Update call
+	to `grub_ieee1275_next_property'.  Remove uneeded variable.
+	(grub_available_iterate): New function.
+	* normal/main.c: Explicit grub_exit_env alignment.
+	* normal/sparc64/setjmp.S (grub_setjmp, grub_longjmp): Implement.
+	* include/grub/sparc64/ieee1275/loader.h: New file.
+
 2007-02-21  Hollis Blanchard  [EMAIL PROTECTED]
 
 	* kern/powerpc/ieee1275/init.c (HEAP_SIZE): Removed.
Index: THANKS
===
RCS file: /sources/grub/grub2/THANKS,v
retrieving revision 1.18
diff -u -p -r1.18 THANKS
--- THANKS	25 Nov 2006 03:21:29 -	1.18
+++ THANKS	4 Mar 2007 12:32:07 -
@@ -26,7 +26,7 @@ Tristan Gingold  [EMAIL PROTECTED]
 Tsuneyoshi Yasuo [EMAIL PROTECTED]
 Vesa Jaaskelainen  [EMAIL PROTECTED

Re: GRUB2 - testing report, hppa support?

2006-12-10 Thread Vincent Pelletier
Le mardi 05 décembre 2006 20:46, Yoshinori K. Okuji a écrit :
  Oh, btw, it's HIGHLY confusing that disks start at 0, partitions at
  1. Could you please fix it and make it consequently? either hd1,1
  or hd0,0, but not hd0,1 or hd1,0.

 No. It is consistent with most operating systems, so less confusing to the
 user. GRUB Legacy used 0-based counting for partitions, and I have received
 an uncountable number of complaints. Thus it is really a bad idea to make
 GRUB inconsistent against other systems.

But by changing the numbering, we void both the learning effort of the 
people who knows and the answering effort they spent with people who don't 
know. At least, that's my position regarding to the change.

By changing it we might both face the complaints of the people - like me :) - 
who think the two numberings are inconsistent and the people who would have 
anyway complained about starting from 0, because disks are still numbered 
from 0... We may also face complaints from the people who already complained 
about starting from 0 - and eventually accepted it - and who will have to 
learn again now...

-- 
Vincent Pelletier


pgpn0Z55olpS8.pgp
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: ping (update-grub2)

2006-11-27 Thread Vincent Pelletier
Le lundi 27 novembre 2006 18:00, Robert Millan a écrit :
 No comments?  Are you interested in getting this into the main grub tree?
 In my opinion, since update-grub needs a rewrite it's a good oportunity to
 merge this now and unify grub.cfg generation across distributions
 (something that wasn't possible with the old update-grub because of
 copyright issues).

 That said, if you don't like the idea then we could proceed adding it in
 debian, but that might close the door to merging in the future (maintaining
 the script in debian ourselves implies accepting contributions from many
 people without any paperwork arrangements).

Personally, the way update-grub works on all my applicable debian installs 
suits me perfectly.

But as Declan said, it's bad to overwrite the file...
I wonder if it could become just a generation of a file which would be 
included (or not) by the main config file.
If that main config file does not exist at all, it could be generated - unless 
we consider that a user might want not to have a config file at all.

I don't know if the current scripting allows this, I haven't put an eye on it 
for a looong time.

Another idea, which I just had while writing this mail :

What about putting the .d directory in /boot(/grub) and implementing a 
mechanism in grub to be able to handle such configuration directory ?
My idea is about multi-OS (multi-distro, whatever) users, which have to 
privilege one among and merge the boot possibilities - by hand most probably. 
If this offers a common way of storing boot entries, it can solve that 
problem.

In my idea, I would go even further by suggesting a non grub-specific way of 
doing so, allowing to switch bootloaders which would support such 
configuration layouts. But I guess few people are ready to spend much effort 
in making boot loaders compatible one with the other...

-- 
Vincent Pelletier


pgpP3rFKXucnz.pgp
Description: PGP signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Reiserfs v3 support for grub 2 (alpha version)

2006-10-01 Thread Vincent Pelletier
Here is attached the latest working version of reiserfs handling.

What it does :
- Recognises the partition type
- Read the partition label (needs confirmation of the label position)
- List directory content (see limitations)
- Read file content (see limitations)

Limitations :
- Item (file  dir) size limited to one indirection block. Readable size is a 
bit less than number_of_contiguous_indirect_pointers * block_size, which 
means at most 16MB on a 8192 bytes/block reiserfs, 4MB on a 4096 bytes/block, 
etc.
- No symlink support : although the symlinks can be read, they are read as a 
text file containing a path, nothing more.
- No journal playback
- Alpha version : will potentially leak memory, be slow, not suitable for your 
needs, not tested with all kinds of reiserfs options  versions... Play 
with^W^WUse it at your own risks - risks which should be limited to wasting 
time because no write is ever done to the partition, of course. 

Ah, and it's not always 80-columns wordwrapped, other than that the coding 
style should be respected. This will be fixed in the final version.

-- 
Vincent Pelletier
/* reiserfs.c - ReiserFS versions up to 3.6 */
/*
 *  GRUB  --  GRand Unified Bootloader
 *  Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
 *
 *  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.
 */

/*
  TODO:
  implement journal handling (ram replay)
  implement symlinks support
  support items bigger than roughly (blocksize / 4) * blocksize
!! that goes for directories aswell, size in such case is metadata size.
  test tail packing  direct files
  validate partition label position
*/
#warning TODO : symlinks, journal, support for items larger than (blocksize^2)/4, tail packing

// #define GRUB_REISERFS_KEYV2_BITFIELD
// #define GRUB_REISERFS_DEBUG
// #define GRUB_REISERFS_JOURNALING

#include grub/err.h
#include grub/file.h
#include grub/mm.h
#include grub/misc.h
#include grub/disk.h
#include grub/dl.h
#include grub/types.h
#include grub/fshelp.h

#define MIN(a, b) (((a)(b))?(a):(b))

#define REISERFS_SUPER_BLOCK_OFFSET 0x1
#define REISERFS_MAGIC_LEN 12
#define REISERFS_MAGIC_STRING ReIsEr2Fs\0\0\0
/* If the 3rd bit of an item state is set, then it's visible.  */
#define GRUB_REISERFS_VISIBLE_MASK ((grub_uint16_t)0x04)
#define REISERFS_MAX_LABEL_LENGTH 16
#define REISERFS_LABEL_OFFSET 0x64

enum grub_reiserfs_item_type
{
  GRUB_REISERFS_STAT,
  GRUB_REISERFS_DIRECTORY,
  GRUB_REISERFS_DIRECT,
  GRUB_REISERFS_INDIRECT,
  GRUB_REISERFS_ANY, /* Matches both _DIRECT and _INDIRECT when searching.  */
  GRUB_REISERFS_UNKNOWN
};

struct grub_reiserfs_superblock
{
  grub_uint32_t block_count;
  grub_uint32_t block_free_count;
  grub_uint32_t root_block;
  grub_uint32_t journal_block;
  grub_uint32_t journal_device;
  grub_uint32_t journal_original_size;
  grub_uint32_t journal_max_transaction_size;
  grub_uint32_t journal_block_count;
  grub_uint32_t journal_max_batch;
  grub_uint32_t journal_max_commit_age;
  grub_uint32_t journal_max_transaction_age;
  grub_uint16_t block_size;
  grub_uint16_t oid_max_size;
  grub_uint16_t oid_current_size;
  grub_uint16_t state;
  grub_uint8_t magic_string[REISERFS_MAGIC_LEN];
  grub_uint32_t function_hash_code;
  grub_uint16_t tree_height;
  grub_uint16_t bitmap_number;
  grub_uint16_t version;
  grub_uint16_t reserved;
  grub_uint32_t inode_generation;
} __attribute__ ((packed));

#ifdef GRUB_REISERFS_JOURNALING
#error Journaling not yet supported.
struct grub_reiserfs_journal_header
{
  grub_uint32_t last_flush_uid;
  grub_uint32_t unflushed_offset;
  grub_uint32_t mount_id;
} __attribute__ ((packed));

struct grub_reiserfs_transaction_header
{
  grub_uint32_t id;
  grub_uint32_t len;
  grub_uint32_t mount_id;
  char *data;
  char checksum[12];
} __attribute__ ((packed));
#endif

struct grub_reiserfs_stat_item_v1
{
  grub_uint16_t mode;
  grub_uint16_t hardlink_count;
  grub_uint16_t uid;
  grub_uint16_t gid;
  grub_uint32_t size;
  grub_uint32_t atime;
  grub_uint32_t mtime;
  grub_uint32_t ctime;
  grub_uint32_t rdev;
  grub_uint32_t first_direct_byte;
} __attribute__ ((packed));

struct grub_reiserfs_stat_item_v2
{
  grub_uint16_t mode;
  grub_uint16_t reserved;
  grub_uint32_t hardlink_count;
  grub_uint64_t size;
  grub_uint32_t uid;
  grub_uint32_t gid;
  grub_uint32_t atime;
  grub_uint32_t mtime

[patch 1/3] PCI support (abstract interface)

2006-05-16 Thread vincent guffens
Hello,

Here is a patch to add pci support to grub2.


2006-05-16  Vincent Guffens  [EMAIL PROTECTED]

* drivers/: New directory

* conf/i386-pc.rmk (pkgdata_MODULES): Added pci.mod
to the list of modules.
(DRIVERS_CFLAGS): Added.
(pci_mod_SOURCES): Likewise.
(pci_mod_CFLAGS): Likewise.
(pci_mod_LDFLAGS): Likewise.

* drivers/include/grub/pci.h: New file.
* drivers/include/grub/list.h: Likewise.
* drivers/pci/pci.c: Likewise.


diff -rNu grub2/ChangeLog grub2-pci/ChangeLog
--- grub2/ChangeLog 2006-05-14 22:16:16.0 +0100
+++ grub2-pci/ChangeLog 2006-05-16 21:51:22.0 +0100
@@ -1,3 +1,18 @@
+2006-05-16  Vincent Guffens  [EMAIL PROTECTED]
+
+   * drivers/: New directory.
+
+   * conf/i386-pc.rmk (pkgdata_MODULES): Added pci.mod
+   to the list of modules.
+   (DRIVERS_CFLAGS): Added.
+   (pci_mod_SOURCES): Likewise.
+   (pci_mod_CFLAGS): Likewise.
+   (pci_mod_LDFLAGS): Likewise.
+
+   * drivers/include/grub/pci.h: New file.
+   * drivers/include/grub/list.h: Likewise.
+   * drivers/pci/pci.c: Likewise.
+
 2006-05-14  Yoshinori K. Okuji  [EMAIL PROTECTED]

* kern/i386/pc/startup.S: Include grub/cpu/linux.h instead of
diff -rNu grub2/conf/i386-pc.rmk grub2-pci/conf/i386-pc.rmk
--- grub2/conf/i386-pc.rmk  2006-05-07 19:28:23.0 +0100
+++ grub2-pci/conf/i386-pc.rmk  2006-05-16 21:07:30.0 +0100
@@ -3,6 +3,7 @@
 COMMON_ASFLAGS = -nostdinc -fno-builtin
 COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
 COMMON_LDFLAGS = -melf_i386 -nostdlib
+DRIVERS_CFLAGS = -Idrivers/include -fno-strict-aliasing

 # Images.
 pkgdata_IMAGES = boot.img diskboot.img kernel.img pxeboot.img
@@ -116,7 +117,7 @@
 pkgdata_MODULES = _chain.mod _linux.mod linux.mod normal.mod \
_multiboot.mod chain.mod multiboot.mod reboot.mod halt.mod  \
vbe.mod vbetest.mod vbeinfo.mod video.mod gfxterm.mod \
-   videotest.mod play.mod
+   videotest.mod play.mod pci.mod

 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -209,4 +210,9 @@
 videotest_mod_CFLAGS = $(COMMON_CFLAGS)
 videotest_mod_LDFLAGS = $(COMMON_LDFLAGS)

+# For pci.mod
+pci_mod_SOURCES = drivers/pci/pci.c
+pci_mod_CFLAGS = $(COMMON_CFLAGS) $(DRIVERS_CFLAGS)
+pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 include $(srcdir)/conf/common.mk
diff -rNu grub2/drivers/include/grub/list.h
grub2-pci/drivers/include/grub/list.h
--- grub2/drivers/include/grub/list.h   1970-01-01 01:00:00.0 +0100
+++ grub2-pci/drivers/include/grub/list.h   2006-05-16 21:10:58.0
+0100
@@ -0,0 +1,86 @@
+/* list.h - A very simple list.  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2006  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 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 GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+/*
+  If you want a list of struct myitem
+  you do
+
+  struct myitem *item_list;
+
+  where myitem MUST have its next pointer as the FIRST field
+
+  and you can then add, delete the EL item,
+  grub_add_list (item_list, el);
+  grub_del_list (item_list, el);
+
+  or call HOOK(item) for each element of the list
+  grub_iterate_list (item_list, hook);
+
+  This brk version will point el to the list item for which
+  HOOK(EL) returns a non-null value
+  grub_iterate_list_brk (item_list, hook, el);
+ */
+
+struct obj {
+  struct obj *next; /* MUST BE FIRST */
+};
+
+#define grub_del_list(list, el) _grub_del_list((struct obj**) list,
(struct obj*) el)
+#define grub_add_list(list, el) _grub_add_list((struct obj**) list,
(struct obj*) el)
+#define grub_find_list(list, el) \
+  (typeof(list)) _grub_find_list((struct obj*) list, (struct obj*) el)
+#define grub_iterate_list(list, func) \
+  {typeof(list) el = list; while (el) {func(el); el=el-next;}}
+#define grub_iterate_list_brk(list, func, it) \
+  {typeof(list) el = list; it = 0; \
+while (el) {if (func(el)) {it = el; break;} el=el-next; }}
+
+static inline struct obj*  _grub_find_list (struct obj *list, struct
obj *el)
+{
+  struct obj *it = list;
+  for (it = list; it; it=it-next)
+  {
+if (it == el) return el;
+  }
+  return 0;
+};
+
+static inline void _grub_add_list (struct obj **list, struct obj *el)
+{
+  if ( (!el) || (_grub_find_list (*list, el)) )
+return;
+
+  el-next = *list;
+  *list

[patch 2/3] PCI support (implementation from etherboot)

2006-05-16 Thread vincent guffens
Some directories, other than drivers/include/etherboot/i386 might have
to be created by hand.

2006-05-16  Vincent Guffens  [EMAIL PROTECTED]

* drivers/include/etherboot/: New directory.
* drivers/pci/i386/: Likewise.

* configure.ac (AC_CONFIG_LINKS): Added drivers/include/etherboot/cpu
links.

* conf/i386-pc.rmk (pkgdata_MODULES): Added pci_etherboot.mod
to the list of modules.
(pci_etherboot_mod_SOURCES): Added.
(pci_etherboot_mod_CFLAGS): Likewise.
(pci_etherboot_mod_LDFLAGS): Likewise.

* drivers/include/etherboot/pci_ids.h: New file.
* drivers/include/etherboot/pci_defs.h: Likewise.
* drivers/include/etherboot/i386/io.h: Likewise.
* drivers/include/etherboot/i386/limits.h: Likewise.
* drivers/pci/pci_etherboot.c: Likewise.
* drivers/pci/i386/pci_io.c: Likewise.



diff -rNu grub2-pci/ChangeLog grub2-pci_etherboot/ChangeLog
--- grub2-pci/ChangeLog 2006-05-16 21:51:22.0 +0100
+++ grub2-pci_etherboot/ChangeLog   2006-05-16 21:51:44.0 +0100
@@ -1,5 +1,26 @@
 2006-05-16  Vincent Guffens  [EMAIL PROTECTED]

+   * drivers/include/etherboot/: New directory.
+   * drivers/pci/i386/: Likewise.
+
+   * configure.ac (AC_CONFIG_LINKS): Added drivers/include/etherboot/cpu
+   links.
+
+   * conf/i386-pc.rmk (pkgdata_MODULES): Added pci_etherboot.mod
+   to the list of modules.
+   (pci_etherboot_mod_SOURCES): Added.
+   (pci_etherboot_mod_CFLAGS): Likewise.
+   (pci_etherboot_mod_LDFLAGS): Likewise.
+
+   * drivers/include/etherboot/pci_ids.h: New file.
+   * drivers/include/etherboot/pci_defs.h: Likewise.
+   * drivers/include/etherboot/i386/io.h: Likewise.
+   * drivers/include/etherboot/i386/limits.h: Likewise.
+   * drivers/pci/pci_etherboot.c: Likewise.
+   * drivers/pci/i386/pci_io.c: Likewise.
+
+2006-05-16  Vincent Guffens  [EMAIL PROTECTED]
+
* drivers/: New directory.

* conf/i386-pc.rmk (pkgdata_MODULES): Added pci.mod
Binary files grub2-pci/.ChangeLog.swp and
grub2-pci_etherboot/.ChangeLog.swp differ
diff -rNu grub2-pci/conf/i386-pc.rmk grub2-pci_etherboot/conf/i386-pc.rmk
--- grub2-pci/conf/i386-pc.rmk  2006-05-16 21:07:30.0 +0100
+++ grub2-pci_etherboot/conf/i386-pc.rmk2006-05-16 21:27:03.0 
+0100
@@ -117,7 +117,7 @@
 pkgdata_MODULES = _chain.mod _linux.mod linux.mod normal.mod \
_multiboot.mod chain.mod multiboot.mod reboot.mod halt.mod  \
vbe.mod vbetest.mod vbeinfo.mod video.mod gfxterm.mod \
-   videotest.mod play.mod pci.mod
+   videotest.mod play.mod pci.mod pci_etherboot.mod

 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -215,4 +215,9 @@
 pci_mod_CFLAGS = $(COMMON_CFLAGS) $(DRIVERS_CFLAGS)
 pci_mod_LDFLAGS = $(COMMON_LDFLAGS)

+# For pci_etherboot.mod
+pci_etherboot_mod_SOURCES = drivers/pci/pci_etherboot.c
drivers/pci/i386/pci_io.c
+pci_etherboot_mod_CFLAGS = $(COMMON_CFLAGS) $(DRIVERS_CFLAGS)
+pci_etherboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 include $(srcdir)/conf/common.mk
diff -rNu grub2-pci/configure.ac grub2-pci_etherboot/configure.ac
--- grub2-pci/configure.ac  2006-05-16 21:53:10.0 +0100
+++ grub2-pci_etherboot/configure.ac2006-05-16 21:53:29.0 +0100
@@ -208,6 +208,7 @@

 # Output files.
 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$host_cpu
+drivers/include/etherboot/cpu:drivers/include/etherboot/$host_cpu
include/grub/machine:include/grub/$host_cpu/$platform])
 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
 AC_CONFIG_FILES([stamp-h], [echo timestamp  stamp-h])
diff -rNu grub2-pci/drivers/include/etherboot/i386/io.h
grub2-pci_etherboot/drivers/include/etherboot/i386/io.h
--- grub2-pci/drivers/include/etherboot/i386/io.h   1970-01-01
01:00:00.0 +0100
+++ grub2-pci_etherboot/drivers/include/etherboot/i386/io.h 2006-05-16
21:31:31.0 +0100
@@ -0,0 +1,206 @@
+/* io.h - Architecture specific input/output functions  */
+/* Imported from Etherboot 5.4.1 */
+
+#ifndefETHERBOOT_IO_H
+#define ETHERBOOT_IO_H
+
+/*
+ * This file contains the definitions for the x86 IO instructions
+ * inb/inw/inl/outb/outw/outl and the string versions of the same
+ * (insb/insw/insl/outsb/outsw/outsl). You can also use pausing
+ * versions of the single-IO instructions (inb_p/inw_p/..).
+ *
+ * This file is not meant to be obfuscating: it's just complicated
+ * to (a) handle it all in a way that makes gcc able to optimize it
+ * as well as possible and (b) trying to avoid writing the same thing
+ * over and over again with slight variations and possibly making a
+ * mistake somewhere.
+ */
+
+/*
+ * Thanks to James van Artsdalen for a better timing-fix than
+ * the two short jumps: using outb's to a nonexistent port seems
+ * to guarantee better timings even on fast machines.
+ *
+ * On the other hand, I'd like to be sure of a non

[patch 3/3] PCI support (simple test driver)

2006-05-16 Thread vincent guffens
And here comes the last part, this test driver detects the ne2000 card
in qemu.



2006-05-16  Vincent Guffens  [EMAIL PROTECTED]

* drivers/net/: New directory.

* conf/i386-pc.rmk (pkgdata_MODULES): Added test_driver.mod
to the list of modules.
(test_driver_mod_SOURCES): Added.
(test_driver_mod_CFLAGS): Likewise.
(test_driver_mod_LDFLAGS): Likewise.

* driver/net/test_driver.c: New file.



diff -rNu grub2-pci_etherboot/ChangeLog grub2-pci_test_driver/ChangeLog
--- grub2-pci_etherboot/ChangeLog   2006-05-16 21:51:44.0 +0100
+++ grub2-pci_test_driver/ChangeLog 2006-05-16 21:52:08.0 +0100
@@ -1,5 +1,17 @@
 2006-05-16  Vincent Guffens  [EMAIL PROTECTED]

+   * drivers/net/: New directory.
+
+   * conf/i386-pc.rmk (pkgdata_MODULES): Added test_driver.mod
+   to the list of modules.
+   (test_driver_mod_SOURCES): Added.
+   (test_driver_mod_CFLAGS): Likewise.
+   (test_driver_mod_LDFLAGS): Likewise.
+
+   * driver/net/test_driver.c: New file.
+   
+2006-05-16  Vincent Guffens  [EMAIL PROTECTED]
+
* drivers/include/etherboot/: New directory.
* drivers/pci/i386/: Likewise.

diff -rNu grub2-pci_etherboot/conf/i386-pc.rmk
grub2-pci_test_driver/conf/i386-pc.rmk
--- grub2-pci_etherboot/conf/i386-pc.rmk2006-05-16 21:27:03.0 
+0100
+++ grub2-pci_test_driver/conf/i386-pc.rmk  2006-05-16 21:39:54.0
+0100
@@ -117,7 +117,8 @@
 pkgdata_MODULES = _chain.mod _linux.mod linux.mod normal.mod \
_multiboot.mod chain.mod multiboot.mod reboot.mod halt.mod  \
vbe.mod vbetest.mod vbeinfo.mod video.mod gfxterm.mod \
-   videotest.mod play.mod pci.mod pci_etherboot.mod
+   videotest.mod play.mod pci.mod pci_etherboot.mod \
+test_driver.mod

 # For _chain.mod.
 _chain_mod_SOURCES = loader/i386/pc/chainloader.c
@@ -220,4 +221,9 @@
 pci_etherboot_mod_CFLAGS = $(COMMON_CFLAGS) $(DRIVERS_CFLAGS)
 pci_etherboot_mod_LDFLAGS = $(COMMON_LDFLAGS)

+# For test_driver.mod
+test_driver_mod_SOURCES = drivers/net/test_driver.c
+test_driver_mod_CFLAGS = $(COMMON_CFLAGS) $(DRIVERS_CFLAGS)
+test_driver_mod_LDFLAGS = $(COMMON_LDFLAGS)
+
 include $(srcdir)/conf/common.mk
diff -rNu grub2-pci_etherboot/drivers/net/test_driver.c
grub2-pci_test_driver/drivers/net/test_driver.c
--- grub2-pci_etherboot/drivers/net/test_driver.c   1970-01-01
01:00:00.0 +0100
+++ grub2-pci_test_driver/drivers/net/test_driver.c 2006-05-16
21:40:07.0 +0100
@@ -0,0 +1,40 @@
+#include grub/pci.h
+#include grub/dl.h
+#include grub/normal.h
+#include grub/err.h
+#include etherboot/pci_ids.h
+
+static grub_err_t
+test_driver_probe (grub_pci_device_t pdev __attribute__((unused)))
+{
+  /* Whah! if it was always so simple.  */
+  return GRUB_ERR_NONE;
+}
+
+static struct grub_pci_ids test_driver_ids[] =
+{
+  {0x10ec, 0x8029, realtek 8029 test},
+  {0x1186, 0x0300, dlink-528},
+};
+
+static struct grub_pci_driver test_driver =
+{
+  .next = 0,
+  .type = GRUB_NET_ETHERNET,
+  .name = Test driver,
+  .probe = test_driver_probe,
+  .ids = test_driver_ids,
+  .id_count = sizeof(test_driver_ids)/sizeof(test_driver_ids[0]),
+  .class = 0, /* could be PCI_CLASS_NETWORK_ETHERNET
+  for generic drivers */
+};
+
+GRUB_MOD_INIT(test_driver)
+{
+  grub_register_pci_driver (test_driver);
+}
+
+GRUB_MOD_FINI(test_driver)
+{
+  grub_unregister_pci_driver (test_driver);
+}


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


Re: RE : a simple list

2006-05-09 Thread vincent guffens
Thank you for this information. Adding the concept of context is indeed
the right idea. I was doing it as follows

void function (grub_device_t dev)
{
 grub_device_t it;
 auto int look_for_dev (grub_device_t);

  int look_for_dev (grub_device_t grub_device_t other_dev)
  {
 return compare (dev, other_dev)
  }

grub_iterate_list_brk (grub_devices, look_for_dev, it);
}

but it has to be compared with something like

void function (grub_device_t dev)
{
  grub_device_t it = grub_devices;

  while (it)
  {
 if ( compare (dev, it) )
   break;
  }
}


which is obviously simpler. Maybe the only two functions that are really
needed are add and del ?

Also, I found out yesterday that
the compiler throws out warning about strict aliasing when using the
iterate function. I had to add -fno-strict-aliasing to get rid of them.



Eric Salomé wrote:
 Hi,
 
 I didn’t take a good look at current iterate functions in Grub 2, yet.
 
  
 
 Most iterations needs a “init” (before treatment of first item) and a
 “fini” (after treatment of last item).
 
 Further more, one might want to make iteration functions “re-entrant”
 (or recursive), or call-back other functions in a generic way.
 
  
 
 One way to get to such behavior easily cost a bit more than the example
 you provided : 
 
 you may just add an argument (let’s call it the context object) to the
 call of the iterate function :
 
  
 
 #define grub_iterate_list(list, func, context) \
   {typeof(list) el = list; while (el) {func(context, el); el=el-next;}
 func(context, NULL)}
 or
 
 #define grub_iterate_list(list, func) \
   {void * context = NULL; typeof(list) el = list; while (el)
 {func(context, el); el=el-next;} func(context, NULL)}
 but I prefer the first define as it allows transmission of a full
 context to the iteration function.
 
  
 
 my_struct * my_ctxt;
 
  
 
 my_ctxt = NULL; grub_iterate_list(list, my_func, my_ctxt);
 
  
 
 void my_func (my_struct ** ctxt, my_item * item) {
 
   if (item == NULL) {
 
   /* End of iteration : Do any cleanup */
 
   if (*ctxt == NULL) return;
 
   free (*ctxt) ……
 
   …..
 
   return;
 
   }
 
   if (*ctxt == NULL) {
 
/* First iteration : Do any initialization */
 
*ctxt = malloc (sizeof (my_struct)); ….
 
…..
 
 }
 
 /* Do the iteration stuff */
 
 …..
 
 return;
 
 }
 
  
 
 In grub_iterate_list_brk, you can use context to send a patern or model
 object to compare each item of the list with.
 
  
 
 The draw back is it makes iteration function a bit less readable, but a
 lot more powerful.
 
 
 
 _
 
 Eric Salomé – Paris, France
 
  
 
 -Message d'origine-
 De : [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] De la part de
 Guffens, Vincent
 Envoyé : lundi 8 mai 2006 01:14
 À : grub-devel@gnu.org
 Objet : a simple list
 
  
 
 Hi,
 
 I need to use a simple list to register the pci devices, drivers and so
 on. I notice that there are lists like that already in the code so what
 would you think about having a list.h file like that ?
 
 /* A very simple list.
  *
  * If you want a list of struct myitem
  * you do
  *
  * struct myitem *item_list;
  *
  * where myitem MUST have its next pointer as the FIRST field
  *
  * and you can then add, delete the EL item,
  * grub_add_list (item_list, el);
  * grub_del_list (item_list, el);
  *
  * or call HOOK(item) for each element of the list
  * grub_iterate_list (item_list, hook);
  *
  * This brk version will point el to the list item for which
  * HOOK(EL) returns a non-null value
  * grub_iterate_list_brk (item_list, hook, el);
  *
  */
 
 struct obj {
   struct obj *next; /* MUST BE FIRST */
 };
 
 #define grub_del_list(list, el) _grub_del_list((struct obj**) list,
 (struct obj*) el)
 #define grub_add_list(list, el) _grub_add_list((struct obj**) list,
 (struct obj*) el)
 #define grub_find_list(list, el) \
   (typeof(list)) _grub_find_list((struct obj*) list, (struct obj*) el)
 #define grub_iterate_list(list, func) \
   {typeof(list) el = list; while (el) {func(el); el=el-next;}}
 #define grub_iterate_list_brk(list, func, it) \
   {typeof(list) el = list; it = 0; \
 while (el) {if (func(el)) {it = el; break;} el=el-next; }}
 
 static inline struct obj*  _grub_find_list (struct obj *list, struct obj
 *el)
 {
   struct obj *it = list;
   for (it = list; it; it=it-next)
   {
 if (it == el) return el;
   }
   return 0;
 };
 
 static inline void _grub_add_list (struct obj **list, struct obj *el)
 {
   if ( (!el) || (_grub_find_list (*list, el)) )
 return;
  
   el-next = *list;
   *list = el;
 };
 
 static inline void _grub_del_list (struct obj **list, struct obj *el)
 {
   struct obj **p;
   struct obj *q;
 
   for (p = list, q = *p; q; p = (q-next), q = q-next)
 if (q == el)
   {
 *p = q-next;
 break

Re: GRUB2 netboot development

2006-05-09 Thread vincent guffens
Rudy Attias wrote:
 
 Netboot is taking a different direction? I'm curious about that, can you
 give some details?  


yes, grub legacy also used the drivers from Etherboot and it was
reported not be easily manageable. When Etherboot developpers decide to
change something, the glue code written in grub might have to change too
and so grub developper must constantly track these changes. Also, this
messy glue code is not particularly elegant and is not very funny to
program. It does not seem to me that it would happen too often but it
will happen and I don't have the experience that developpers from grub
legacy have.

So now the idea is to have a unique UNDI driver or maybe to find a way
to call into etherboot and come back into grub if the PXE/UNDI is not
supported. For the moment it is not clear for anyone I think how calling
into etherboot would be done.



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


RE: GRUB2 netboot development

2006-05-07 Thread Guffens, Vincent


Well I followed you advice but I came across some issues, probably on
customization of the driver, I'm trying to add the tg3 to it. I made
some adjustments on the code add some here and remove some there to
resolve dependencies but one dependency I can't resolve. This function
is not in the tg3.c or tg3.h code ... :( 

I probably don't know enough C++ do understand that. If you have any
ideas I would appreciate it very much.

 

genmoddep: error: pcibios_read_config_dword in tg3 is not defined

make: *** [moddep.lst] Error 1


yes, this is right, this function is not implemented anywhere. I have published 
grub2_netboot_8.tgz on my website so that you can have a look. The module 
tg3.mod compiles successfully but I did not test it. By the way, this is not 
c++ but c (although with a nice object oriented design)!

I hope it will work, but if it does not, I think we should not worry too much 
about that for the moment as the netboot development is taking quite a 
different direction now.

Cheers!
winmail.dat___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


pci support

2006-05-06 Thread vincent guffens
Hi!

I was wondering if there was still an interest in pci support as
discussed previously. That is a general interface exported by a module
such as

struct grub_pci_support
{
  /* My name.  */
  const char *name;

  void (*init)(void);
  void (*fini)(void);

  void (*adjust) (grub_pci_device_t p);

  /* Base Address Register helper functions. There are up to 6 BARs
 PCI_BASE_ADDRESS_{[0-5]} in the configuration space of each device */
  unsigned long (*bar_start) (grub_pci_device_t, unsigned int bar);
  unsigned long (*bar_size) (grub_pci_device_t, unsigned int bar);

  int (*find_capability) (grub_pci_device_t, int cap);

  /* Call HOOK with each pci device.  */
  grub_err_t (*iterate) (int (*hook) (grub_pci_device_t));

  /* Fill the pci device structure (romaddr, ioaddr, membase, irq)*/
  grub_err_t (*init_pdev) (grub_pci_device_t);

  /* Low level io functions.  */
  struct grub_pci_io_support *io;
};

which allows multiple implementations such as one for instance from
etherboot which I have now.

It was written original with the idea of importing the etherboot drivers
so I don't know if it would still be usefull. The implementation that I
have uses direct pci access which maybe does not fit very well with the
idea of using pxe later on as it will require dealing with some bios
stuff anyway. It is basically usefull now for the lspci command which
could be made to print some nice text just like the Linux lspci command.

If so, I can prepare a separated patch for it and prepare the changelog.

Cheers,

--
Vincent Guffens


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


Re: pci support

2006-05-06 Thread vincent guffens
Marco Gerards wrote:
 vincent guffens [EMAIL PROTECTED] writes:
 
 
Marco Gerards wrote:

vincent guffens [EMAIL PROTECTED] writes:

Hi Vincent,



I was wondering if there was still an interest in pci support as
discussed previously. That is a general interface exported by a module
such as


Yes, that will make it possible to implement all kinds of drivers and
make something like lspci possible.

Sorry I still didn't start working on the networking stuff as planned.
Scripting and other stuff occupies me longer than I originally
expected. :)

Sure, no problem! In fact, I was wondering if it would be possible to
have a discussion about the overall networking strategy that will be put
in place for grub2 (and which is schedulled for the next release !).
 
 
 Sure!
 
 
As I understand, supporting the etherboot drivers is no longer the
primary option. As it is out of the question to have its own set of
driver,  the UNDI driver seems like a good idea. However, UNDI support
would constrain significantly the design of the network stack. In
particular, it defines a lot of structure such as dhcp header, ipv4
addresses and so on. It also involves interruption while it was assumed
previously that the interfaces would be polled.
 
 
 Well, I do not really know UNDI.  I had the impression it was able to
 send and receive raw ehternet frames.  Which is what I want, nothing
 more and nothing less.
 
 At interrupt time, you can store the frames in a queue so they can be
 polled at a later moment.  Or the design should be changed so
 interruptions can be supported.  That's not a big issue I think.

yes, you can use it with a polling mechanism as well. But UNDI has a
much more complex API then just sending and receiving raw frames. You
have API calls to request a file via tftp or even mtftp, get the
information received from the dhcp server, send UDP packets and so on.
It would be waste, I think, to go through the work of supporting UNDI
and not getting the entire benefit which would require a strong
coordination between the PXE/UNDI code and the net code of grub2
(through the PXE specification)

 
There is also the option of calling etherboot from grub2, which seems
quite appealing but I think I don't really quite get that.
 
 
 Is that etherboot specific or is that the case for every UNDI
 implementation?

well, I just mentioned the idea that was raised by Okuji in an earlier
post. That is what I meant and I don't know if I understood properly but
etherboot implements a PXE stacks. So if a network card does not support
it, it would be possible to use etherboot as the PXE stack. But I don't
know how it would work. When etherboot is located in an extension rom,
then maybe the bios can scan it and use it ? I am not sure but I have
sent the question to the etherboot mailing list, I am waiting for some
comments.






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


netboot related projects

2006-04-29 Thread vincent guffens
Hi,

I just wanted to let you know that I contacted the maintainer of
Etherboot to inform him of my current attempt to port the etherboot
drivers to grub2.

As I understand (don't hesitate to correct me or give more details if
you know them), the development of etherboot will stop and future
development will be done on a new project called gpxe. This will occur
shortly when Etherboot will reach its version 5.5. gpxe will have more
features such as memory allocation, availability for more platforms and
so on. gpxe will also replace the development of nilo.

The etherboot drivers will be used but I was told that the interface
will change.

--
Vincent Guffens



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


Re: netboot related projects

2006-04-29 Thread vincent guffens
Yoshinori K. Okuji wrote:
 On Saturday 29 April 2006 22:15, Marco Gerards wrote:
 
vincent guffens [EMAIL PROTECTED] writes:

Hi Vincent,


I just wanted to let you know that I contacted the maintainer of
Etherboot to inform him of my current attempt to port the etherboot
drivers to grub2.

Is he willing to cooperate with us so it will be easier to share code?
I think I once sent him an email about it...  But I am not sure
anymore. :-)
 
 
 Honestly, I don't like to copy Etherboot's drivers to GRUB any longer. I 
 rather consider how to use the UNDI interface provided by Etherboot. When I 
 worked on netboot in GRUB Legacy, Etherboot didn't support UNDI, so I had to 
 copy the drivers. According to him, the current Etherboot supports UNDI, so 
 it should be feasible to use Etherboot's drivers via UNDI.
 
 I think the difficulty is the case where GRUB is not loaded by Etherboot, for 
 example, when GRUB boots from a disk directly. In this case, one way would be 
 to hack Etherboot so that Etherboot can be invoked by GRUB and give the 
 control back to GRUB.
 
 From the experience of GRUB Legacy, I know how painful to synchronize code 
 with an external project, so I'd like to investigate this direction.

true, but this is why the idea here is to use the drivers without
modification or at least with as few modifications as possible. The
driver that I have working now (ns8390 to drive the qemu NE2000
emulation) works with no modification at all, it only requires the
inclusion of a few lines of code before the driver code and at the end
(i.e could be scripted in a general way). Further it does not put any
constraint on the GRUB interface. I don't know much about UNDI but I
checked that there is an UNDI driver in etherboot that could, I think,
be included just as mentioned above.


Of course, this require an additional glue layer which is not
particularly elegant. Please, let me know what you think about this way
of doing think as am I still spending some time of it in the hope that
it could be usefull for grub2 (the latest version can be found at
http://www.inma.ucl.ac.be/~guffens/grub2_netboot/ ).


--
Vincent Guffens



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


Re: Status of UNDI Support

2006-03-10 Thread vincent guffens

I am resending this mail, it looks that it didn't get through:


Martin Vogt wrote:


Hello grub2 developers,


I just tried pxegrub2, but I found out that the network support
is missing. (can load pxegrub, but no menu.lst or kernel etc)
 


hi,

i have been working on netboot support for grub2 for a while and even 
got it working once using code from etherboot.
I am now grubifying the work in order to submit a patch. The PCI support 
is on its way and is going to feature an abstract interface which should 
ease the merging of new implementations.



My experience with grub1 and the etherboot based nic support,
is that it does not work well, so I still use pxelinux.
I always thought that grub2 wont use etheboot and only supports UNDI,
like pxelinux.

 

As far as I know, a lot of  problems related to netboot in grub were 
linked to the fact that  the drivers could not easily be linked together 
as it could  result in grub freezing of behaving improperly. The idea in 
grub2 is still to use the etherboot drivers but not to be limited by 
them. There will be a glue layer in order to import the etherboot 
drivers, hopefully with as little modifications as possible, but it will 
be possible to extend that.



Isnt it possible to re-use some UNDI support from pxelinux and put it
into grub2?

 



I don't know very much about this UNDI support but this is certainly not 
incompatible with using the etherboot drivers for supported cards 
anyway. Grub is very flexible and we can certainly have both support if 
it is worth it.



regards,

Martin






--
Vincent Guffens
Intelligent Systems  Networks Group
		Research associate, Imperial College 




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


Re: PCI config space patcher

2006-03-07 Thread vincent guffens

Marco Gerards wrote:


Clemens Fruhwirth [EMAIL PROTECTED] writes:

Hi Clemens,

 


I have had a problem with VIA chipsets. I abused GRUB to solve it. The
intermediate product is a PCI config space patcher in GRUB. Not that
it's anything new, as GRUB already contains proper PCI in
netboot. However, I added a command line interface so it's available at
boot.
   



This list is about GRUB 2, while what you did is for GRUB Legacy.

But I think you might be interested in GRUB 2 as well.  It will get
PCI support by default (Vincent is working on this, at the moment), so
it might be easier to patch GRUB 2 when it is ready.

--
Marco

 

indeed the PCI implementation for grub2 is on its way. As the rest of 
grub2, it will be object oriented and will allow for
easily adding a new implementation. You should therefore find it easy to 
add your patch to this framework once it is done.


At least I hope so !

--
Vincent Guffens
Intelligent Systems  Networks Group
		Research associate, Imperial College 




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


Re: FOSDEM 2006

2006-02-17 Thread Vincent Guffens
Marco Gerards wrote:

 Hi,

 Who will go to FOSDEM 24th-26th of February?  Vincent Guffens and
 Vincent Pelletier will most likely be there (right?) and I will
 certainly be there.  Unfortunately we do not have a hackers room and
 can not share a room.  I expected the Hurd hackers would get a room,
 but that unfortunately did not happen.

 It would be nice if we could meet somewhere during FOSDEM.

 -- 
 Marco



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


Yes, I am definitively going and for those of you who would be interested, I
can provide accommodation at a friend's place not too far from the FOSDEM
place (around 20 min on food, possibility to take a bus). 

--
 Vincent Guffens
 UCL/CESAME  +32 10 47 80 30 
 Euler Building A017



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


Re: play.c

2005-11-29 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

New version of my patch.
I think I followed all the given advices.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDjNCnibN+MXHkAogRAtK8AJ4rInXMoWqirdCWUwkrchz1hhAWXACfetNg
t9XlC2XS4zLj08Tf6A2HHzyIPwMFAUOM0KcURCgpFDKO1REC0rwAnifHHB66WIvU
wL5TGVG7yAyONtADAKC02lDTu8C178IVqV2ejfWdsAi4WQ==
=4UJg
-END PGP SIGNATURE-
Index: commands/i386/pc/play.c
===
RCS file: commands/i386/pc/play.c
diff -N commands/i386/pc/play.c
--- /dev/null	1 Jan 1970 00:00:00 -
+++ commands/i386/pc/play.c	29 Nov 2005 22:03:58 -
@@ -0,0 +1,228 @@
+/* play.c - command to play a tune  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  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 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 GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Lots of this file is borrowed from GNU/Hurd generic-speaker driver.  */
+
+#include grub/normal.h
+#include grub/dl.h
+#include grub/arg.h
+#include grub/file.h
+#include grub/disk.h
+#include grub/term.h
+#include grub/misc.h
+
+/* Read a byte from a port.  */
+static inline unsigned char
+inb (unsigned short port)
+{
+  unsigned char value;
+  asm volatile (inb%w1, %0 : =a (value) : Nd (port));
+  return value;
+}
+
+/* Write a byte to a port.  */
+static inline void
+outb (unsigned short port, unsigned char value)
+{
+  asm volatile (outb   %b0, %w1 : : a (value), Nd (port));
+}
+
+/* The speaker port.  */
+#define SPEAKER			0x61
+
+/* If 0, follow state of SPEAKER_DATA bit, otherwise enable output
+   from timer 2.  */
+#define SPEAKER_TMR2		0x01
+
+/* If SPEAKER_TMR2 is not set, this provides direct input into the
+   speaker.  Otherwise, this enables or disables the output from the
+   timer.  */
+#define SPEAKER_DATA		0x02
+
+/* The PIT channel value ports.  You can write to and read from them.
+   Do not mess with timer 0 or 1.  */
+#define PIT_COUNTER_0		0x40
+#define PIT_COUNTER_1		0x41
+#define PIT_COUNTER_2		0x42
+
+/* The frequency of the PIT clock.  */
+#define PIT_FREQUENCY		0x1234dd
+
+/* The PIT control port.  You can only write to it.  Do not mess with
+   timer 0 or 1.  */
+#define PIT_CTRL		0x43
+#define PIT_CTRL_SELECT_MASK	0xc0
+#define PIT_CTRL_SELECT_0	0x00
+#define PIT_CTRL_SELECT_1	0x40
+#define PIT_CTRL_SELECT_2	0x80
+
+/* Read and load control.  */
+#define PIT_CTRL_READLOAD_MASK	0x30
+#define PIT_CTRL_COUNTER_LATCH	0x00	/* Hold timer value until read.  */
+#define PIT_CTRL_READLOAD_LSB	0x10	/* Read/load the LSB.  */
+#define PIT_CTRL_READLOAD_MSB	0x20	/* Read/load the MSB.  */
+#define PIT_CTRL_READLOAD_WORD	0x30	/* Read/load the LSB then the MSB.  */
+
+/* Mode control.  */
+#define PIT_CTRL_MODE_MASK	0x0e
+
+/* Interrupt on terminal count.  Setting the mode sets output to low.
+   When counter is set and terminated, output is set to high.  */
+#define PIT_CTRL_INTR_ON_TERM	0x00
+
+/* Programmable one-shot.  When loading counter, output is set to
+   high.  When counter terminated, output is set to low.  Can be
+   triggered again from that point on by setting the gate pin to
+   high.  */
+#define PIT_CTRL_PROGR_ONE_SHOT	0x02
+
+/* Rate generator.  Output is low for one period of the counter, and
+   high for the other.  */
+#define PIT_CTRL_RATE_GEN	0x04
+
+/* Square wave generator.  Output is low for one half of the period,
+   and high for the other half.  */
+#define PIT_CTRL_SQUAREWAVE_GEN	0x06
+
+/* Software triggered strobe.  Setting the mode sets output to high.
+   When counter is set and terminated, output is set to low.  */
+#define PIT_CTRL_SOFTSTROBE	0x08
+
+/* Hardware triggered strobe.  Like software triggered strobe, but
+   only starts the counter when the gate pin is set to high.  */
+#define PIT_CTRL_HARDSTROBE	0x0a
+
+/* Count mode.  */
+#define PIT_CTRL_COUNT_MASK	0x01
+#define PIT_CTRL_COUNT_BINARY	0x00	/* 16-bit binary counter.  */
+#define PIT_CTRL_COUNT_BCD	0x01	/* 4-decade BCD counter.  */
+
+#define T_REST			((short) 0)
+#define T_FINE			((short) -1)
+
+struct note
+{
+  short pitch;
+  short duration;
+};
+
+static void
+beep_off (void)
+{
+  unsigned char status;
+
+  status = inb (SPEAKER);
+  outb (SPEAKER, status  ~(SPEAKER_TMR2 | SPEAKER_DATA));
+}
+
+static void
+beep_on (short pitch)
+{
+  unsigned char status

Re: Video subsystem draft

2005-11-26 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Sat, 26 Nov 2005 02:28:53 +0200
Vesa Jääskeläinen [EMAIL PROTECTED] wrote:
 Yoshinori K. Okuji wrote:
  If you want to improve it, feel free to do it. It is our own
  format. But I think the byte order was set conveniently.
 
 Byte order is currently exactly the same as in .hex file :)
 
 It has minor issue with widechar fonts (char width  1). It like
 contains two different font data. First there is first half of like
 normal 8x16 font and then there is second half. My idea would be to
 store bitmap in scanlines instead of character blocks so I can take
 whole character width and draw that.

By the way, there is already a font format handled by IEEE1275
frame buffercards.
- From the standard : 

set-font ( addr width height advance min-char #glyphs -- )
Set the current font as specified.

So I think they can handle arbitrary-sized glyphs.
I can't find the font data definition, but as default-font returns
all those values for the default font, reverse engineering will be a
matter of minutes.

If the font format you want to design could be compatible with ths one,
it would be a pleasure to port it to sparc :) - and probably the same
for PPC.

By the way, I think we should start a discussion on the API common to
all architectures for framebuffer handling.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDiCCXFEQoKRQyjtURAryjAJ9Xppf3KxB4aYi8m5V1Xzta6fB5XgCeJXwE
lVa4Lay3OgE/JF3WHBqfZ0k=
=RJLt
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
T�l�chargez cette version sur http://fr.messenger.yahoo.com



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


Re: FOSDEM 2006

2005-11-18 Thread Vincent Guffens
for me, and if I find time to improve the work before that, it would be great
to discuss with everyone the merge from etherboot with grub2 for netboot 
support.

On Fri, 18 Nov 2005 13:31:16 +0100, Marco Gerards wrote
 Yoshinori K. Okuji [EMAIL PROTECTED] writes:
 
 Hi,
 
  As you may know, FOSDEM 2006 is planned at the end of February. And, they 
  started to accept applications to DevRooms:
 
  http://www.fosdem.org/index/press/devrooms_call_for_presence_2006
 
  For now, I really have no idea if I am available at that time, but I 
  promise 
  that I would go, if my schedule permits.
 
 Same for me.  I will go if there are no exams or so the week after
 that.
 
  So I have some questions:
 
  - How many people would like to attend FOSDEM?
 
  - Would anybody like to make a presentation of GRUB 2 or Multiboot 
  Specification 2?
 
 I am willing to do that, although I suck at giving presentations.
 Both one or two talks are fine for me.  I can give a talk about last
 years changes (assuming about the same people will attend) and
 multiboot 2.
 
  - Do we want to have our own DevRoom or share with another group as we did 
  last year?
 
 For two talks, we won't get a room.
 
  In my opinion, sharing a DevRoom is better, if we are not too many, and 
  another group accepts it, because we should listen to what OS developers 
  think. Such a group can be Hurd (like last year), OpenSolaris, or a 
  GNU/Linux 
  distribution project (such as Debian or Ubuntu).
 
 Right, I agree.
 
 Thanks,
 Marco
 
 ___
 Grub-devel mailing list
 Grub-devel@gnu.org
 http://lists.gnu.org/mailman/listinfo/grub-devel



--
 Vincent Guffens
 UCL/CESAME  +32 10 47 80 30 
 Euler Building A017



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


Re: FOSDEM 2006

2005-11-18 Thread Vincent Guffens
ok, here is the status :
http://www.inma.ucl.ac.be/~guffens/grub2_netboot/index.html

you can see there that it is possible to cat file and I was able to boot with
it. Also it is very easy to use the driver from etherboot. The problems are :

1) it has not changed since the 23rd of june and grub has changed a lot since
2) the code does not intgrate vey well into grub as I used a lot of code from
etherboot directly.

I should rewrite every sub component and send them one by one.


On Fri, 18 Nov 2005 14:48:53 +0100, Marco Gerards wrote
 Vincent Guffens [EMAIL PROTECTED] writes:
 
  for me, and if I find time to improve the work before that, it would be 
  great
  to discuss with everyone the merge from etherboot with grub2 for netboot
support.
 
 Cool!  What's the status of netboot support?  Perhaps it would be 
 nice if at least some part of it can be merged or so?
 
 --
 Marco
 
 ___
 Grub-devel mailing list
 Grub-devel@gnu.org
 http://lists.gnu.org/mailman/listinfo/grub-devel



--
 Vincent Guffens
 UCL/CESAME  +32 10 47 80 30 
 Euler Building A017



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


play.c

2005-11-05 Thread Vincent Pelletier
Hi.

Here is the play command, along with some songs.

2005-11-05  Vincent Pelletier  [EMAIL PROTECTED]

* commands/i386/pc/play.c: New file.
* conf/i386-pc.rmk (pkgdata_MODULES): Added play.mod.
(play_mod_SOURCES, play_mod_CFLAGS, play_mod_LDFLAGS): New
macros.

Vincent Pelletier
Index: commands/i386/pc/play.c
===
RCS file: commands/i386/pc/play.c
diff -N commands/i386/pc/play.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ commands/i386/pc/play.c 5 Nov 2005 14:06:00 -
@@ -0,0 +1,248 @@
+/* play.c - command to play a tune  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2003  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 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 GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Lots of this file is borowed from GNU/Hurd generic-speaker driver */
+
+#include grub/normal.h
+#include grub/dl.h
+#include grub/arg.h
+#include grub/file.h
+#include grub/disk.h
+#include grub/term.h
+#include grub/misc.h
+
+/* Read a byte from a port.  */
+static inline unsigned char
+inb (unsigned short port)
+{
+  unsigned char value;
+
+  asm volatile (inb%w1, %0 : =a (value) : Nd (port));
+  asm volatile (outb   %%al, $0x80 : : );
+  
+  return value;
+}
+
+/* Write a byte to a port.  */
+static inline void
+outb (unsigned short port, unsigned char value)
+{
+  asm volatile (outb   %b0, %w1 : : a (value), Nd (port));
+  asm volatile (outb   %%al, $0x80 : : );
+}
+
+/* The speaker port.  */
+#define SPEAKER0x61
+
+/* If 0, follow state of SPEAKER_DATA bit, otherwise enable output
+   from timer 2.  */
+#define SPEAKER_TMR2   0x01
+
+/* If SPEAKER_TMR2 is not set, this provides direct input into the
+   speaker.  Otherwise, this enables or disables the output from the
+   timer.  */
+#define SPEAKER_DATA   0x02
+
+/* The PIT channel value ports.  You can write to and read from them.
+   Do not mess with timer 0 or 1.  */
+#define PIT_COUNTER_0  0x40
+#define PIT_COUNTER_1  0x41
+#define PIT_COUNTER_2  0x42
+
+/* The frequency of the PIT clock.  */
+#define PIT_FREQUENCY  0x1234dd
+
+/* The PIT control port.  You can only write to it.  Do not mess with
+   timer 0 or 1.  */
+#define PIT_CTRL   0x43
+#define PIT_CTRL_SELECT_MASK   0xc0
+#define PIT_CTRL_SELECT_0  0x00
+#define PIT_CTRL_SELECT_1  0x40
+#define PIT_CTRL_SELECT_2  0x80
+
+/* Read and load control.  */
+#define PIT_CTRL_READLOAD_MASK 0x30
+#define PIT_CTRL_COUNTER_LATCH 0x00/* Hold timer value until read.  */
+#define PIT_CTRL_READLOAD_LSB  0x10/* Read/load the LSB.  */
+#define PIT_CTRL_READLOAD_MSB  0x20/* Read/load the MSB.  */
+#define PIT_CTRL_READLOAD_WORD 0x30/* Read/load the LSB then the MSB.  */
+
+/* Mode control.  */
+#define PIT_CTRL_MODE_MASK 0x0e
+
+/* Interrupt on terminal count.  Setting the mode sets output to low.
+   When counter is set and terminated, output is set to high.  */
+#define PIT_CTRL_INTR_ON_TERM  0x00
+
+/* Programmable one-shot.  When loading counter, output is set to
+   high.  When counter terminated, output is set to low.  Can be
+   triggered again from that point on by setting the gate pin to
+   high.  */
+#define PIT_CTRL_PROGR_ONE_SHOT0x02
+
+/* Rate generator.  Output is low for one period of the counter, and
+   high for the other.  */
+#define PIT_CTRL_RATE_GEN  0x04
+
+/* Square wave generator.  Output is low for one half of the period,
+   and high for the other half.  */
+#define PIT_CTRL_SQUAREWAVE_GEN0x06
+
+/* Software triggered strobe.  Setting the mode sets output to high.
+   When counter is set and terminated, output is set to low.  */
+#define PIT_CTRL_SOFTSTROBE0x08
+
+/* Hardware triggered strobe.  Like software triggered strobe, but
+   only starts the counter when the gate pin is set to high.  */
+#define PIT_CTRL_HARDSTROBE0x0a
+
+/* Count mode.  */
+#define PIT_CTRL_COUNT_MASK0x01
+#define PIT_CTRL_COUNT_BINARY  0x00/* 16-bit binary counter.  */
+#define PIT_CTRL_COUNT_BCD 0x01/* 4-decade BCD counter.  */
+
+#define T_REST ((short) 0)
+#define T_FINE ((short) -1)
+
+struct note {
+  short pitch;
+  short duration;
+};
+
+static void
+beep_off (void

Re: play.c

2005-11-05 Thread Vincent Pelletier
Yoshinori K. Okuji wrote:
 I point out some stylish mistakes.

For once that I have the Changelog entry right :) .

 You must put the starting brace character on next line:

Please don't waste your time giving an example when it's that trivial,
or please do it in the diff file directly...

 The lines are folded incorrectly.

I also corrected the lines length where needed.

Vincent Pelletier
Index: commands/i386/pc/play.c
===
RCS file: commands/i386/pc/play.c
diff -N commands/i386/pc/play.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ commands/i386/pc/play.c 5 Nov 2005 14:06:00 -
@@ -0,0 +1,251 @@
+/* play.c - command to play a tune  */
+/*
+ *  GRUB  --  GRand Unified Bootloader
+ *  Copyright (C) 2005  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 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 GRUB; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Lots of this file is borowed from GNU/Hurd generic-speaker driver */
+
+#include grub/normal.h
+#include grub/dl.h
+#include grub/arg.h
+#include grub/file.h
+#include grub/disk.h
+#include grub/term.h
+#include grub/misc.h
+
+/* Read a byte from a port.  */
+static inline unsigned char
+inb (unsigned short port)
+{
+  unsigned char value;
+
+  asm volatile (inb%w1, %0 : =a (value) : Nd (port));
+  asm volatile (outb   %%al, $0x80 : : );
+  
+  return value;
+}
+
+/* Write a byte to a port.  */
+static inline void
+outb (unsigned short port, unsigned char value)
+{
+  asm volatile (outb   %b0, %w1 : : a (value), Nd (port));
+  asm volatile (outb   %%al, $0x80 : : );
+}
+
+/* The speaker port.  */
+#define SPEAKER0x61
+
+/* If 0, follow state of SPEAKER_DATA bit, otherwise enable output
+   from timer 2.  */
+#define SPEAKER_TMR2   0x01
+
+/* If SPEAKER_TMR2 is not set, this provides direct input into the
+   speaker.  Otherwise, this enables or disables the output from the
+   timer.  */
+#define SPEAKER_DATA   0x02
+
+/* The PIT channel value ports.  You can write to and read from them.
+   Do not mess with timer 0 or 1.  */
+#define PIT_COUNTER_0  0x40
+#define PIT_COUNTER_1  0x41
+#define PIT_COUNTER_2  0x42
+
+/* The frequency of the PIT clock.  */
+#define PIT_FREQUENCY  0x1234dd
+
+/* The PIT control port.  You can only write to it.  Do not mess with
+   timer 0 or 1.  */
+#define PIT_CTRL   0x43
+#define PIT_CTRL_SELECT_MASK   0xc0
+#define PIT_CTRL_SELECT_0  0x00
+#define PIT_CTRL_SELECT_1  0x40
+#define PIT_CTRL_SELECT_2  0x80
+
+/* Read and load control.  */
+#define PIT_CTRL_READLOAD_MASK 0x30
+#define PIT_CTRL_COUNTER_LATCH 0x00/* Hold timer value until read.  */
+#define PIT_CTRL_READLOAD_LSB  0x10/* Read/load the LSB.  */
+#define PIT_CTRL_READLOAD_MSB  0x20/* Read/load the MSB.  */
+#define PIT_CTRL_READLOAD_WORD 0x30/* Read/load the LSB then the MSB.  */
+
+/* Mode control.  */
+#define PIT_CTRL_MODE_MASK 0x0e
+
+/* Interrupt on terminal count.  Setting the mode sets output to low.
+   When counter is set and terminated, output is set to high.  */
+#define PIT_CTRL_INTR_ON_TERM  0x00
+
+/* Programmable one-shot.  When loading counter, output is set to
+   high.  When counter terminated, output is set to low.  Can be
+   triggered again from that point on by setting the gate pin to
+   high.  */
+#define PIT_CTRL_PROGR_ONE_SHOT0x02
+
+/* Rate generator.  Output is low for one period of the counter, and
+   high for the other.  */
+#define PIT_CTRL_RATE_GEN  0x04
+
+/* Square wave generator.  Output is low for one half of the period,
+   and high for the other half.  */
+#define PIT_CTRL_SQUAREWAVE_GEN0x06
+
+/* Software triggered strobe.  Setting the mode sets output to high.
+   When counter is set and terminated, output is set to low.  */
+#define PIT_CTRL_SOFTSTROBE0x08
+
+/* Hardware triggered strobe.  Like software triggered strobe, but
+   only starts the counter when the gate pin is set to high.  */
+#define PIT_CTRL_HARDSTROBE0x0a
+
+/* Count mode.  */
+#define PIT_CTRL_COUNT_MASK0x01
+#define PIT_CTRL_COUNT_BINARY  0x00/* 16-bit binary counter.  */
+#define PIT_CTRL_COUNT_BCD 0x01/* 4-decade BCD counter.  */
+
+#define T_REST ((short) 0)
+#define T_FINE ((short) -1)
+
+struct note

Re: play.c

2005-11-05 Thread Vincent Pelletier
On Sat, 5 Nov 2005 23:23:25 +0100
Samuel Thibault [EMAIL PROTECTED] wrote:
 Hollis Blanchard, le Sat 05 Nov 2005 16:17:33 -0600, a écrit :

BTW, thank for your comments, I'll send another version tomorrow.

  Can you describe how the PIT is related to the speaker?
 That's the way one can make the speaker beep without having to keep
 cpu busy with typically-440-Hz outs. One just asks the PIT to do it
 for us in the background.

To beep, a square generator is set to the right frequency, and then a
bit allows the pulses to go to the actual buzzer.

  I'm wondering if this code could mostly work on PPC platforms that
  have PC-like peripherals.
 It depends on whether the PIT is linked to the speaker like on PC.

I think there is really little chance it works (ie. without
writing a sound-card driver).

Vincent Pelletier

PS: trying sylpheed claws gtk2





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
T�l�chargez cette version sur http://fr.messenger.yahoo.com



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


Re: singleboot

2005-11-02 Thread Vincent Pelletier
Paul Tarjan wrote:
 I've been wanting for quite some time a method to be in linux, and
 reboot into windows for just this one time and keep linux as my
 default boot.

What about :

default saved

title windows
root ...
makeactive
chainloader +1

title linux
root ...
kernel ...
initrd ...
savedefault
boot

Then you can select windows and it will only boot once in windows (as
long as you don't select it again sometime).

Another solution would be, if your bios can do that, to define disk boot
order as :

windows disk
linux disk

Then if the windows disk is plugged in, it will not even run grub but
directly the windows bootloader. If nothing is plugged in place of the
windows drive, it will just skip and boot grub on the second.

I'm not sure I got your request right :
Do you want to physically remove the boot entry so no one can use it
later ?
Do you want it to be 100% automatic (like used as some remote automation) ?

Vincent Pelletier


signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [GRUB1] Accessibility: Add beep support

2005-11-01 Thread Vincent Pelletier
Yoshinori K. Okuji wrote:
 It is funny that something written only for fun can be very useful.

Sadly I think nobody will find my framebuffer Mandelbrot of any use ;) .
I think I'll add (f)scanf functions in a library module as you
suggested, so tunes can be passed as arguments in a human (or
voice-synthesis) readable form.

Might be something like :

play tempo tone duration [tone duration [...]]
and
play file

I don't know much about the music conventions/standards, I'll dig a bit
so I can make something once for all and quickly discoverable.

About grub 1 policy, yes I meant my patch would be for grub 2.

Vincent Pelletier


signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: Sparc bootblock [Was: SFS breaks PPC build ]

2005-10-17 Thread Vincent Pelletier
Bart Grantham wrote:
 - have it verify that the file at the configured sector(s) is an ELF file

Quite easy if we stick to the header signature.

 - follow through and make sure it properly boots an ELF image (right now
 it only gets it into memory)

I think there are 2 ways :
-write your own Forth ELF relocating code (might be fun, but beside that...)
-have the init-program command do this work for you, which require you
to load the image where boot net loads it (or maybe other commands,
but for now I only know about boot net as it is the only way to
currently boot grub2 on sparc64 ;) ).

 - verify that the code works on PPC, and if not, try to make it work so
 that there's a unified bootblock [not sure if this is reasonable as I'm
 not as familiar with how PPC OF boots... how similiar is it to Sparc?]

I think this one can't be done without making the FCode grow quite big.

 - same for sparc32

I would be interested if the port could be unified in 32bits. For now I
built it 64bits - don't ask why :) - but if a 32bits build can work both
on sparc32 and sparc64, I think it would be great for maintenance.

Vincent Pelletier


signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] DL support on usparc cls disabling when debugging

2005-10-12 Thread Vincent Pelletier
Hi.

Finally, I send this dl.c patch.
I'll send a separate patch for the .mk  .rmk files, because I have a
lot of dust in those files.

I also joined a patch to disable cls when setting a debug level, and
some changes to parse such arguments before any initialisation, so error
messages won't get cleaned by a cls in early boot.

2005-10-12  Vincent Pelletier  [EMAIL PROTECTED]

* kern/sparc64/dl.c (grub_arch_dl_check_header): Use sparcv9
ELF header values.
grub_arch_dl_relocate_symbols) : Implement 64 bits relocations.
* kern/term.c (grub_cls): Return without clearing screen if
debug is set.
* kern/sparc64/ieee1275/init.c (grub_machine_init): Read
environment variables before anything else.
Index: kern/sparc64/dl.c
===
RCS file: /cvsroot/grub/grub2/kern/sparc64/dl.c,v
retrieving revision 1.1
diff -u -p -r1.1 dl.c
--- kern/sparc64/dl.c   21 Aug 2005 18:42:55 -  1.1
+++ kern/sparc64/dl.c   12 Oct 2005 17:34:00 -
@@ -30,9 +30,9 @@ grub_arch_dl_check_header (void *ehdr)
   Elf64_Ehdr *e = ehdr;
 
   /* Check the magic numbers.  */
-  if (e-e_ident[EI_CLASS] != ELFCLASS32
+  if (e-e_ident[EI_CLASS] != ELFCLASS64
   || e-e_ident[EI_DATA] != ELFDATA2MSB
-  || e-e_machine != EM_PPC)
+  || e-e_machine != EM_SPARCV9)
 return grub_error (GRUB_ERR_BAD_OS, invalid arch specific ELF magic);
 
   return GRUB_ERR_NONE;
@@ -83,53 +83,53 @@ grub_arch_dl_relocate_symbols (grub_dl_t
 rel  max;
 rel++)
  {
-   Elf64_Xword *addr;
+   Elf64_Word *addr;
Elf64_Sym *sym;
-   grub_uint64_t value;
+   Elf64_Addr value;

if (seg-size  rel-r_offset)
  return grub_error (GRUB_ERR_BAD_MODULE,
 reloc offset is out of the segment);

-   addr = (Elf64_Xword *) ((char *) seg-addr + rel-r_offset);
+   addr = (Elf64_Word *) ((char *) seg-addr + rel-r_offset);
sym = (Elf64_Sym *) ((char *) symtab
-+ entsize * ELF32_R_SYM (rel-r_info));
-   
-   /* On the PPC the value does not have an explicit
-  addend, add it.  */
++ entsize * ELF64_R_SYM (rel-r_info));
+
value = sym-st_value + rel-r_addend;
-   switch (ELF32_R_TYPE (rel-r_info))
+   switch (ELF64_R_TYPE (rel-r_info))
  {
- case R_PPC_ADDR16_LO:
-   *(Elf64_Half *) addr = value;
-   break;
-   
- case R_PPC_REL24:
-   {
- Elf64_Sxword delta = value - (Elf64_Xword) addr;
- 
- if (delta  6  6 != delta)
-   return grub_error (GRUB_ERR_BAD_MODULE, Relocation 
overflow);
- *addr = (*addr  0xfc03) | (delta  0x3fc);
- break;
-   }
-   
- case R_PPC_ADDR16_HA:
-   *(Elf64_Half *) addr = (value + 0x8000)  16;
-   break;
-   
- case R_PPC_ADDR32:
-   *addr = value;
-   break;
-   
- case R_PPC_REL32:
-   *addr = value - (Elf64_Xword) addr;
-   break;
-   
+  case R_SPARC_32: /* 3 V-word32 */
+if (value  0x)
+  return grub_error (GRUB_ERR_BAD_MODULE,
+ Address out of 32 bits range);
+*addr = value;
+break;
+  case R_SPARC_WDISP30: /* 7 V-disp30 */
+if (((value - (Elf64_Addr) addr)  0x) 
+((value - (Elf64_Addr) addr)  0x
+!= 0x))
+  return grub_error (GRUB_ERR_BAD_MODULE,
+ Displacement out of 30 bits range);
+*addr = (*addr  0xC000) |
+  (((grub_int32_t) ((value - (Elf64_Addr) addr)  2)) 
+   0x3FFF);
+break;
+  case R_SPARC_HI22: /* 9 V-imm22 */
+if (((grub_int32_t) value)  0xFF)
+  return grub_error (GRUB_ERR_BAD_MODULE,
+ High address out of 22 bits range);
+*addr = (*addr  0xFFC0) | ((value  10)  0x3F);
+break;
+  case R_SPARC_LO10: /* 12 T-simm13 */
+*addr = (*addr  0xFC00) | (value  0x3FF

Re: [PATCH] DL support on usparc cls disabling when debugging

2005-10-12 Thread Vincent Pelletier
Timothy Baldwin wrote:
 With a bad gnupg signature here.

Probably because of the mailing list signature...


signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: backtrace support

2005-08-29 Thread Vincent Guffens

Hi,

I will make change to the patch according to these comments.

+void EXPORT_FUNC(grub_register_debug_sym) (const char*, void*, 


grub_size_t);


+void EXPORT_FUNC(grub_unregister_debug_sym) (void *);
+int EXPORT_FUNC(grub_print_debug_sym) (grub_addr_t);
+void EXPORT_FUNC(grub_backtrace) (void);



Why do you need to export these functions? Are they used outside the kernel?



grub_register_debug_sym is used by the module responsible for loading 
the debug symbols. grub_backtrace could be used by other modules.


--
Vincent Guffens
PhD Student UCL/CESAME
tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
Don't bother us with politics, respond those who don't want to learn.
-- Richard M. Stallman


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


[BUG] Sparc64 rescue mode

2005-08-25 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Here is the output I get with ls on my U10 :

grub rescue ls
(disk) (disk3) (disk2) Can't read disk label.
Can't open disk label package
(disk1) (disk0) (ide) (floppy) Can't read disk label.
Can't open disk label package
(disk) [...]

I see 3 bugs :
- -It loops forever
- -The device list contains devices it shouldn't contain (ide at least)
- -It makes OpenBoot throw errors - but I'm not sure which device actualy
makes it cry, maybe is net behind those.

Does it also happen on ppc ?

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDDXm/FEQoKRQyjtURAk2VAJ9woPYDcirSaIEAq2iIXi3eH8E7AwCdGt24
DbthuwlwWd0cpr1cXe/w9xM=
=52PS
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Mouse support

2005-08-25 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I added basic mouse support for ieee1275.
It's really, really basic :
- -Only works with serial mice
- -Only works with Microsoft 2 buttons protocol (might work for 3 buttons
without wheel)
- -One has to set the serial speed from OpenFirmware command line
- -I only use what the mouse give me : button pushed or not, x  y deltas
(nothing like [double] click handling).
- -For some reason, the mouse is very choppy, like 3 updates per second,
and it sometimes has strange moves - but I guess the second is because
it's an old, old retired mouse.

And for now it doesn't return (I should add a key press detection or
something...).

I'm writing a clean patch to add both Mandelbrot  mousetest commands -
IEEE1275 only for now.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDDYB4FEQoKRQyjtURAqxKAJ9hwo0cIZ9VNgZQjg0uiS6hrAkziwCgiJ7H
r5h6IFSQ1F11PhdAhbBfF3Q=
=kJDp
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


[PATCH] Framebuffer ieee1275 support test commands

2005-08-25 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Here is my patch to add support for framebuffer on IEEE1275 machines, a
fractal drawing test program, and a mouse test program.

Framebuffer support includes :
 -setting the palette colours
 -drawing a rectangle filled with a colour
 -drawing a rectangular image (may have some width  height limitations,
I had some glitches when I used a non-power-of-2 width)
 -grabbing a rectangular image from screen (not tested)
 -getting the framebuffer address (the function I provide doesn't work
for some strange reason... Should be a cast problem somewhere.
Mandelbrot command uses a workaround until I find the problem).

Mandelbrot draws directly in the framebuffer memory. It returns, but
doesn't restore the colours. It calculates the fractal, so it uses fixed
point operations (double).

As I said in a previous mail, mouse support is very limited - but it
just works :). Mouse support is actualy 100% handled by mousetest.c.
It understands Microsoft 2 buttons mouse protocol. Once started, the
mousetest command doesn't exits (except if there is an init error). The
rectangle on the top left corner of the screen shows the data received
(3 bytes, first top, msb on the left). The format is described in
mouse(4), coloured for better readability :
 red : left mouse button
 green : right moue button
 yellow : y axis
 blue : x axis
That command uses the (draw,fill)-rectangle functions, so the
framebuffer must have them (my Creator3D doesn't).
Usage :
 mousetest [screen_device mouse_device]
 default : mousetest screen mouse

Please tell me if it doesn't build on PPC as modules (Marco : It's not
the patch I sent you, I improved it a bit.) and if it doesn't work.
Marco told me he was only getting a grey image with Mandelbrot.

2005-08-25  Vincent Pelletier  [EMAIL PROTECTED]

* commands/ieee1275/mandelbrot.c: New file.
* commands/ieee1275/mousetest.c: Likewise.
* include/grub/ieee1275/fb.h: Likewise.
* include/grub/ieee1275/fbprops.h: Likewise.
* video/ieee1275/fb.c: Likewise.
* video/ieee1275/fbprops.c: Likewise.
* conf/powerpc-ieee1275.rmk (pkgdata_MODULES): Add
mandelbrot.mod, mousetest.mod and fb.mod.
(mandelbrot.mod): New module.
(mousetest.mod): Likewise.
(fb.mod): Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
(grubof_HEADERS, grubof_SOURCES): Add needed files to statically
link the commands.
(grubof_CFLAGS): Add -DGRUB_EMBED to make commands build as
embedded and rescue commands.
* kern/sparc64/ieee1275/init.c: Handle the commands
initialisation and finish when embedded.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDDZsxFEQoKRQyjtURAgtTAJ9qclafmsNNvgVkC1r8jvhP7kDZYQCX
koq32EYbF4X0teVkqhCQmg0=
=TF0X
-END PGP SIGNATURE-


mandel_mouse.diff
Description: audio/mp3
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Graphic calls portability

2005-08-24 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi.

I implemented framebuffer basic primitives for ieee1275.
Here is a picture of what I get :
http://www.sysif.net/~vincent/sparc64-fb.png

For now it only works on the ati framebuffer card in my U10, because the
 Creator 3D card seems only to offer 1bit colors, and almost no packages
functions. Full details below (both cards were open'ed, and they get
some more properties when it's the case, like address).

ok cd ati
ok words
selftest  disp-test close removerestore
draw-logo write open  install
self-test read-rectangle  draw-rectangle
fill-rectangle  get-colorsset-colorscolor!
color@dimensionsr1600x1200x70 r1600x1200x60
r1600x1000x76 r1600x1000x66 r1440x900x76  r1280x1024x85
r1280x1024x76 r1280x1024x75 r1280x1024x67 r1280x1024x60
r1280x800x76  r1152x900x76  r1152x900x66  r1024x800x84
r1024x768x77  r1024x768x75  r1024x768x70  r1024x768x60
r800x600x75   r640x480x60   r1600x1200x70x8
r1600x1200x60x8 r1600x1000x76x8
r1600x1000x66x8 r1440x900x76x8
r1280x1024x85x8 r1280x1024x76x8
r1280x1024x75x8 r1280x1024x67x8
r1280x1024x60x8 r1280x800x76x8
r1152x900x76x24 r1152x900x76x8
r1152x900x66x24 r1152x900x66x8
r1024x800x84x24 r1024x800x84x8
r1024x768x77x24 r1024x768x77x8
r1024x768x75x24 r1024x768x75x8
r1024x768x70x24 r1024x768x70x8
r1024x768x60x24 r1024x768x60x8
r800x600x75x24
r800x600x75x8 r640x480x60x24  r640x480x60x8
.version_pgx

ok .properties
address  fe00
assigned-addresses   82011010  e100  0100
 82011018  e200  1000
aty,fcode1.60
aty,card#109-41900-00
aty,rom# 113-41901-104
modelATY,GT-C
name SUNW,m64B
pgx_version  @(#)pgx24.fth 1.8 01/05/15
reg  00011000    
 02011010    0100
 02011018    1000
character-setISO8859-1
device_type  display
linebytes00 00 04 80
depth00 00 00 08
height   00 00 03 84
width00 00 04 80
fb-memory00 00 00 04
aty,flags00 00 00 02
aty,status   00 00 00 00
fast-back-to-back
devsel-speed 0001
class-code   0003
interrupts   0001
max-latency  
min-grant0008
revision-id  005c
device-id4750
vendor-id1002


ok cd screen
ok words
selftest  disp-test close removerestore
draw-logo write open  install
ffb_change_scrn_params  ffb_do_edid   .version_ffb

ok .properties
character-setISO8859-1
address  fdbee000
ihandle  ff f9 2a 70
reg  01fc   0400
 01fc 0040  0020
 01fc 0060  0020
 01fc 0100  0040
 01fc 0140  0040
 01fc 0180  0040
 01fc 01c0  0040
 01fc 0200  0100
 01fc 0300  0100
 01fc 0400  0040
 01fc 0440  0040
 01fc 0480  0040
 01fc 04c0  0040
 01fc 0500  0100
 01fc 0600  0200
 01fc 0900  0080
 01fc 0980  0080
 01fc 0a00  0100
 01fc 0b00  0080
 01fc 0b80  0080
 01fc 0c00  0040
 01fc 0c80  0080
 01fc 0d00  0080
 01fc 0d80  0080
fbc_reg_id   32 41 90 6d
ramdac_rev   00 00 00 01
fcode_version@(#)ffb2p.fth 2.9 98/07/14
modelSUNW,501-4788
board_type   00 00 00 33
upa-interrupt-slave
interrupts   0005
upa-portid   001e
monitor_mode 00 00 00 02
v_freq

Re: Graphic calls portability

2005-08-24 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
-Add a framebuffer handles (like file handles) for later use in
framebuffer functions
 Can you explain this?  You mean we need an object for this?

Just something like the return value of the open() C function, so the
driver.

 What makes 64 bits archs special?

Framebuffer address will be 64bits, handles might not be 32 bits... All
the usual portability stuff. Don't use int instead of grub_size_t for
example.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDDFMsFEQoKRQyjtURArrfAKCek8sivIdhrwxVcR4tux9urE5t9QCdE4pX
XgTkdM4fJ8QUfocFdSttc+k=
=lvtN
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: backtrace support

2005-08-23 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vincent Guffens wrote:
 This is a problem because I would say that it breaks compilation for
 other architectures. I think that the other architectures should have a
 function grub_backtrace() that does nothing, or even better that really
 does print a backtrace(). However, I don't know how to do it and I can't
 test it anyway.

For sparc64-ieee1275, there is a ctrace command in open firmware which
does that work. grub_backtrace() could do a
grub_ieee1275_interpret(ctrace,NULL);
then
grub_ieee1275_exit();

To make ctrace work the ELF has to be unstripped - for now I hardcoded
it in conf/sparc64-ieee1275.rmk. To my experience, -O1 produces an
easier to understand ASM than -O0 (sparc64-ieee1275 allows to run in
step-by-step or breakpoint mode) because -O0 does really dumb things
that is very verbose in ASM line number. But I don't know in details
what -O1 does, and if it has drawbacks in optimisation (I think about
local functions).

 I hope this backtrace will be usefull, but not too much !

I have already found a use for it : I can't make vbetest work, it fails
with out of range pointer.

I hope it will be committed soon.

Oh, by the way, I'm trying to implement the OpenFirmware framebuffer
primitives - for now with no luck - so we can have it on ieee1275 ports.
There are lots of FCODE examples on Google, but all for PPC.
My current problem is how to allocate memory for the framebuffer itself,
and how to pass the address to frame_buffer_adr (the usual FCODE way
to store a value), if possible without using grub_ieee1275_interpret.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDCtRfFEQoKRQyjtURArwAAJ0QJ9cOK7WTW40UKVdf5O12vU9x5ACfcmXC
wmVVj2BJem/7hlyZ4boBMp8=
=lCgj
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


backtrace support

2005-08-22 Thread Vincent Guffens
Here is a new version of the backtrace support. I have written the 
ChangeLog and modified the code according to your advices.


To compile with the backtrace support use ./configure --with-debug and 
load grub2 with the kern_debug module. The kern module will be unloaded 
automatically after having registered all the kernel symbols in a linked 
list that also contains the module symbols. Any files that includes 
grub/backtrace.h can now call grub_backtrace().


The functions that handle the linked list with the debug symbols are 
generic and are put in kern/backtrace.c. The function grub_backtrace() 
however is architecture dependant and is put in kern/i386/pc/backtrace.c.


This is a problem because I would say that it breaks compilation for 
other architectures. I think that the other architectures should have a 
function grub_backtrace() that does nothing, or even better that really 
does print a backtrace(). However, I don't know how to do it and I can't 
test it anyway.


I have also slightly modified the way genmk.rb generates the rule to 
create the modules. I hope this slight change does not do anything silly 
 that I missed.


I hope this backtrace will be usefull, but not too much !


--
Vincent Guffens
PhD Student UCL/CESAME
tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
Don't bother us with politics, respond those who don't want to learn.
-- Richard M. Stallman
diff -ru -N -b -B grub2/ChangeLog grub2-backtrace/ChangeLog
--- grub2/ChangeLog 2005-08-20 10:25:51.0 +0200
+++ grub2-backtrace/ChangeLog   2005-08-22 22:52:47.934165416 +0200
@@ -1,3 +1,45 @@
+2005-08-22 Vincent Guffens [EMAIL PROTECTED]
+
+   * conf/i386-pc.rmk : Added kern/backtrace.c, kern/i386/pc/backtrace.c 
+   in the kernel dependancy list and backtrace.h in the header list. Added 
a
+   new module kern_debug.mod.
+
+   * grub2/configure.ac : Added a configure switch : --with-debug. 
+   Turn the gcc optimization flag to -O0 and define a variable 
GRUB_DEBUG=1 
+   in Makefile.in if this switch is used. 
+
+   * gendebugkern.sh : New file : shell script which generates the debug
+   symbols for the kernel.
+
+   * genmk.rb : Do not strip the uneeded symbols from the objects if 
+   GRUB_DEBUG=1. Add a variable $(#{prefix}_OTHERDEP) in the dependancy 
list 
+   of the modules. This variable can be set to something useful in 
i386-pc.rmk.
+   Do not compile the module with all the dependances, just use the 
sources.
+
+   * include/grub/backtrace.h : New file
+
+   * kern/backtrace.c : New file 
+   (grub_register_debug_sym): New function
+   (grub_unregister_debug_sym): Likewise
+   (grub_print_debug_sym) : Likewise
+
+   * kern/dl.c : (Un)Register the debug symbols when a module is 
(un)loaded.
+
+   * kern/err.c (grub_fatal) : Call grub_backtrace()
+
+   * kern/i386/pc/backtrace.c : New file
+   (get_fp) : New function
+   (grub_backtrace) : likewise
+
+   * kern/kern_debug.c : New file : This is the source for the new module
+   kern_debug. It registers the kernel symbol during its initialisation and
+   does nothing else. It is automatically removed  later.
+
+   * kern/main.c  (grub_load_modules) : Try to unregister the kern_debug 
module.
+
+   * Makefile.in : Add a new variable GRUB_DEBUG which is set by 
configure. Add 
+   the rule to create the kernel symbol list in kern/grub_debug_kern.sym.
+   
 2005-08-20  Yoshinori K. Okuji  [EMAIL PROTECTED]
 
* loader/powerpc/ieee1275/linux.c (grub_rescue_cmd_linux): Specify
diff -ru -N -b -B grub2/conf/i386-pc.rmk grub2-backtrace/conf/i386-pc.rmk
--- grub2/conf/i386-pc.rmk  2005-08-20 09:49:01.0 +0200
+++ grub2-backtrace/conf/i386-pc.rmk2005-08-22 20:54:51.0 +0200
@@ -28,13 +28,13 @@
kern/i386/dl.c kern/i386/pc/init.c kern/partition.c \
kern/env.c disk/i386/pc/biosdisk.c \
term/i386/pc/console.c \
-   symlist.c
+   symlist.c kern/backtrace.c kern/i386/pc/backtrace.c
 kernel_img_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \
file.h fs.h kernel.h loader.h misc.h mm.h net.h partition.h \
pc_partition.h rescue.h symbol.h term.h types.h \
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
machine/memory.h machine/loader.h machine/time.h machine/vga.h \
-   machine/vbe.h
+   machine/vbe.h backtrace.h
 kernel_img_CFLAGS = $(COMMON_CFLAGS)
 kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
 kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200
@@ -93,7 +93,7 @@
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c  \
util/console.c util/grub-emu.c util/misc.c  \
util/i386/pc/biosdisk.c util/i386/pc/getroot.c  \
-   util

sparc64 port

2005-08-20 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I fixed the sparc64 port.
Current status is : rescue mode works, it can only be netbooted, no
module support, no utils (grub-emu, grub-install,...)

I separate the Changelog in 2 parts, one for the changes I made that
could interfere with the other ports (sparc_common.diff), and another
for the added files (sparc64_files.tar.bz2). It should add only needed
files  directories.

I added /* FIXME (sparc64).  */ in each file that contains hard-coded
values that might not be appropriate for sparc64 port. They come from
powerpc port but I don't know what to set instead. Could be in files I
don't use yet (like setjmp.h).

2005-08-20  Vincent Pelletier  [EMAIL PROTECTED]

* configure.ac: Add support for sparc64 host with ieee1275
firmware.
* configure: Generated from configure.ac.
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): use grub_ssize_t
instead of int.
(grub_ofdisk_read): Likewise.
(grub_ofdisk_open): Use %p to print pointer values, and cast the
pointers as (void *) to remove a warning.
(grub_ofdisk_close): Likewise.
(grub_ofdisk_read): Likewise.
* kern/ieee1275/ieee1275.c (grub_ieee1275_exit): This never
returns, so make it return void to remove a warning.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_exit):
Corresponding prototype change.
* kern/mm.c (grub_mm_init_region): Use %p to print pointer
values, and cast the pointers as (void *) to remove a warning.
(grub_mm_dump): Likewise.

2005-08-20  Vincent Pelletier  [EMAIL PROTECTED]

* boot/sparc64: New directory.
* boot/sparc64/ieee1275: New directory.
* boot/sparc64/ieee1275/cmain.c: New file.
* conf/sparc64-ieee1275.mk: New file.
* conf/sparc64-ieee1275.rmk: New file.
* include/grub/sparc64: New directory.
* include/grub/sparc64/setjmp.h: New file.
* include/grub/sparc64/types.h: New file.
* include/grub/sparc64/ieee1275: New directory.
* include/grub/sparc64/ieee1275/console.h: New file.
* include/grub/sparc64/ieee1275/ieee1275.h: New file.
* include/grub/sparc64/ieee1275/kernel.h: New file.
* include/grub/sparc64/ieee1275/time.h: New file.
* kern/sparc64: New directory.
* kern/sparc64/cache.c: New file.
* kern/sparc64/dl.c: New file.
* kern/sparc64/ieee1275: New directory.
* kern/sparc64/ieee1275/init.c: New file.
* kern/sparc64/ieee1275/openfw.c: New file.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDBxa3FEQoKRQyjtURArmEAJ45AqBteOR4vSto4ssu/jl5NwosXQCgsio/
m9dBbZzRGeKT5mqEcr7/Zr4=
=mU/+
-END PGP SIGNATURE-


sparc64_common.diff
Description: audio/mp3


sparc64_files.tar.bz2
Description: application/bzip
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: sparc64 port

2005-08-20 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yoshinori K. Okuji wrote:
 On Saturday 20 August 2005 13:40, Vincent Pelletier wrote:
  * boot/sparc64/ieee1275/cmain.c: New file.
 This is wrong.

Corrected.

   * kern/sparc64/cache.c: New file.
 The contents of this file is strange. Why don't you simply include 
 grub/cache.h?

Done.

2005-08-20  Vincent Pelletier  [EMAIL PROTECTED]

* configure.ac: Add support for sparc64 host with ieee1275
firmware.
* configure: Generated from configure.ac.
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): use grub_ssize_t
instead of int.
(grub_ofdisk_read): Likewise.
(grub_ofdisk_open): Use %p to print pointer values, and cast the
pointers as (void *) to remove a warning.
(grub_ofdisk_close): Likewise.
(grub_ofdisk_read): Likewise.
* kern/ieee1275/ieee1275.c (grub_ieee1275_exit): This never
returns, so make it return void to remove a warning.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_exit):
Corresponding prototype change.
* kern/mm.c (grub_mm_init_region): Use %p to print pointer
values, and cast the pointers as (void *) to remove a warning.
(grub_mm_dump): Likewise.

2005-08-20  Vincent Pelletier  [EMAIL PROTECTED]

* conf/sparc64-ieee1275.mk: New file.
* conf/sparc64-ieee1275.rmk: Likewise.
* include/grub/sparc64/setjmp.h: Likewise.
* include/grub/sparc64/types.h: Likewise.
* include/grub/sparc64/ieee1275/console.h: Likewise.
* include/grub/sparc64/ieee1275/ieee1275.h: Likewise.
* include/grub/sparc64/ieee1275/kernel.h: Likewise.
* include/grub/sparc64/ieee1275/time.h: Likewise.
* kern/sparc64/cache.c: Likewise.
* kern/sparc64/dl.c: Likewise.
* kern/sparc64/ieee1275/init.c: Likewise.
* kern/sparc64/ieee1275/openfw.c: Likewise.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDBzdMFEQoKRQyjtURApAOAKCrh0SBed8sT+RdIxjSg4md23rkrACbBOTj
xya2F+fAkszTpaD9eieLgrk=
=6Cqh
-END PGP SIGNATURE-


sparc64_common.diff
Description: audio/mp3


sparc64_files.tar.bz2
Description: application/bzip
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: sparc64 port

2005-08-20 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 Please start sentences with an uppercase letter, same for the other
 entries.

Oops.

 Some files are not GPL'ed (cache.c, for example).  The copyright years
 are not always correct, like that of ieee1275.h (you wrote it, so it
 should be (C) 2005 only).

(bis repetita).

 Can't openfw.c be shared?  I think it can be...

I think too. The worse it that both powerpc and sparc versions are
conflicting : both have been modified since I originally extracted the
powerpc version. Going to resolve the problems, and I'll patch a common
version to be checked in before my port.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDB0dHFEQoKRQyjtURAnYFAJ0e23MrnkEiDua5dsDuzcrF4DNKkQCfeMu1
vrwwuyXQ/rB1tOtJSNF2J+A=
=AZqu
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


backtrace support

2005-08-18 Thread Vincent Guffens

Hi,

After having searched for the reason of the unaligned pointer caused by 
the nested functions bug, I thought that it could be interesting to have 
a backtrace in grub. It would be triggered in grub_fatal and would print 
the last few function calls that triggered the problem.


I have implemented such a backtrace function using the stack base 
pointer. You can see how it looks like on the picture attached. This is 
a screenshot taken after the bug mentioned above and it points directly 
to the cause of the problem.


However, the price to pay for that, at least with my implementation, is 
quite high. One has to disable the optimization flag to prevent the 
-fomit-frame-pointer and the module must not be stripped. Still, during 
the developpement phase, it might be usefull to get good bug reports.


The feature is added with
./configure --with-backtrace
and grub must be compile with ./btmake instead of make which is a simple 
script which calls make twice instead of only once.


I include the patch as attachment, if not for inclusion in grub, at 
least for the potential interrested reader.



--
Vincent Guffens
PhD Student UCL/CESAME
tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
Don't bother us with politics, respond those who don't want to learn.
-- Richard M. Stallman
attachment: backtrace.jpg
diff -ru -N -b -B grub2/btmake grub2-backtrace/btmake
--- grub2/btmake1970-01-01 01:00:00.0 +0100
+++ grub2-backtrace/btmake  2005-08-18 18:48:36.0 +0200
@@ -0,0 +1,9 @@
+#!/bin/sh
+# Create a grub kernel image with backtrace support
+# configure must have been run with : --with-backtrace
+make
+./genbtsym.sh kernel.exec  kern/i386/pc/grub_btsym_list.txt
+rm kernel_img-kern_i386_pc_backtrace.d
+rm kernel_img-kern_i386_pc_backtrace.o
+make
+
diff -ru -N -b -B grub2/conf/i386-pc.rmk grub2-backtrace/conf/i386-pc.rmk
--- grub2/conf/i386-pc.rmk  2005-08-12 21:53:32.0 +0200
+++ grub2-backtrace/conf/i386-pc.rmk2005-08-15 16:22:03.0 +0200
@@ -25,7 +25,7 @@
 kernel_img_SOURCES = kern/i386/pc/startup.S kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \
-   kern/i386/dl.c kern/i386/pc/init.c kern/partition.c \
+   kern/i386/dl.c kern/i386/pc/init.c kern/i386/pc/backtrace.c 
kern/partition.c \
kern/env.c disk/i386/pc/biosdisk.c \
term/i386/pc/console.c \
symlist.c
@@ -92,7 +92,7 @@
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c  \
util/console.c util/grub-emu.c util/misc.c  \
util/i386/pc/biosdisk.c util/i386/pc/getroot.c  \
-   util/i386/pc/misc.c
+   util/i386/pc/misc.c kern/i386/pc/backtrace.c
 
 grub_emu_LDFLAGS = $(LIBCURSES)
 
diff -ru -N -b -B grub2/config.h.in grub2-backtrace/config.h.in
--- grub2/config.h.in   2005-08-09 01:15:21.0 +0200
+++ grub2-backtrace/config.h.in 2005-08-13 18:32:23.0 +0200
@@ -16,6 +16,9 @@
 /* Define it to either end or _end */
 #undef END_SYMBOL
 
+/* enable backtrace support */
+#undef GRUB_BACKTRACE
+
 /* Define if C symbols get an underscore after compilation */
 #undef HAVE_ASM_USCORE
 
diff -ru -N -b -B grub2/configure.ac grub2-backtrace/configure.ac
--- grub2/configure.ac  2005-08-09 01:15:21.0 +0200
+++ grub2-backtrace/configure.ac2005-08-18 17:36:26.0 +0200
@@ -57,9 +57,19 @@
 AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
   ])
   if test x$size_flag = xyes; then
+   if test $with_backtrace == yes
+   then
+   tmp_CFLAGS=$tmp_CFLAGS -O0
+   else
 tmp_CFLAGS=$tmp_CFLAGS -Os
+   fi
+  else
+   if test $with_backtrace == yes
+   then
+   tmp_CFLAGS=$tmp_CFLAGS -O0 -fno-strength-reduce -fno-unroll-loops
   else
-tmp_CFLAGS=$tmp_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops
+   tmp_CFLAGS=$tmp_CFLAGS -Os -fno-strength-reduce -fno-unroll-loops
+   fi
   fi
 
   # Force no alignment to save space on i386.
@@ -108,6 +118,16 @@
 # This is not a must.
 AC_PATH_PROG(RUBY, ruby)
 
+# Include the stack trace support ?
+AC_ARG_WITH(backtrace, [  --with-backtraceenable stack trace 
support for i386])
+if test $with_backtrace == yes
+then
+   case $host_cpu in
+   i[[3456]]86) AC_DEFINE([GRUB_BACKTRACE], [], [enable backtrace 
support])  ;;
+   *) AC_MSG_NOTICE([backtrace support available for i386 only]) ;;
+   esac
+fi
+
 # For cross-compiling.
 if test x$build != x$host; then
   AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
diff -ru -N -b -B grub2/genbtsym.sh grub2-backtrace/genbtsym.sh
--- grub2/genbtsym.sh   1970-01-01 01:00:00.0 +0100
+++ grub2-backtrace/genbtsym.sh 2005

Re: vesafb terminal for testing.

2005-08-16 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yoshinori K. Okuji wrote:
 A pluggable menu might sound good, but it's not so easy to maintain multiple 
 menu interfaces.

I think we should only maintain some kind of API interface with an
example module, and let the community develop on it if it finds it
interesting.

 like CSS in HTML.

I like the CSS idea.
From-menu edition of the CSS sound to me as a requirement, to avoid
rebooting each time a change is made. It could be at first with
read-only from device, and maybe a hard-copy print function.

The HTML would be grub.cfg, but the CSS ?
Another file ? In the same ?
We might need to improve the grub.cfg format to handle something like
css classes. Even if we don't implement class support in our graphic
menu, I bet users will be happy to find it supported when writing their
module.
On the other hand, the worse is better rule would say that if the
grub.cfg format is too bad, the users will write another that would best
fit their needs.
It might be good to separate menu definition from environment
initialisation, in case the first gets redesigned they wouldn't have to
care about the second.

 USB mouse support
[...]
 Vesa

On the IEEE1275 point of view, I saw framebuffer graphic primitives in
the standard, so it *should* be easy too. And on my sun, there is a
mouse device in the OB tree.

Marco Gerards wrote:
 Right, but it would be the best if we think now and design the
 interfaces.

Maybe should we design a test-case. I'm thinking of 2~3 buttons bouncing
around the screen, with selection  click events handled (including
tab, return, space). That would test :
- -drawing
- -timer events (I think it's worth the implementation)
 and their regularity among different systems
- -user interaction

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDAYwDFEQoKRQyjtURAi83AJ99xcSmesFJL9zdC5jwiH+Pc8SiEACfeDyd
96z51HGlPugXg65G1aPhMoI=
=6hcN
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: vesafb terminal for testing.

2005-08-16 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 Perhaps we can get help and suggestions from designers instead of
 programmers.  Perhaps we can contact Ubuntu, they have designers.
 Perhaps a KDE or gnome team?

Gnoppix has a really nice - Grub legacy - graphic menu, so I think it is
a good idea to contact Ubuntu.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDAY2zFEQoKRQyjtURAks9AKCShtAFEucHj+7pmRgGfWovid18DgCgojWL
okb6IjD7sSMqdf2vMI5s2Rc=
=13m2
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: GRUB 1.90 is released

2005-08-10 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vernon Mauery wrote:
 I am seeing unaligned pointer messages when I use grub2 on /dev/hda2.
 If I type 'root (hd0,2)', I get 'unaligned pointer 0x7ff94' and if I
 type 'insmod (hd0,2)/boot/grub/mulitboot.mod', I get 'unaligned
 pointer 0x7ff64'.

Sounds like a file system handling bug.
What FS are you using on (hd0,2) ?
By the way, (hd0,2) is hda3 not hda2.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC+jd+FEQoKRQyjtURAi/QAKCBJa8GBCR1YQTI8/6Plt3a1x8KUgCgiere
NOzSOH1SkQo93APSRigdMNw=
=kcAQ
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: doc on memory management

2005-08-08 Thread Vincent Guffens

Hi,

I put the document on the wiki:

http://www.autistici.org/grub/moin.cgi/MemoryManagement

However, the links to the images points to my website as I found no 
other way to inline images. Is it possible to upload these images on the 
wiki server ?


thanks,

Marco Gerards wrote:

Vincent Guffens [EMAIL PROTECTED] writes:

Hi Vincent,



I have written some doc about mm in grub2. I know this is not the most
important think to do now but I had it in mind so I thought it would
not be lost. The document is in latex, there is a makefile to create a
pdf, dvi, ps and html. Let me know if you want to add this document
somewhere and you need some other format.

The pdf can be found here :
http://www.auto.ucl.ac.be/~guffens/article/grub_mm_doc.pdf

and the tgz with the source :
http://www.auto.ucl.ac.be/~guffens/article/grub_mm_doc.tgz



It's a really nice document.  Thanks a lot!

--
Marco



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




--
Vincent Guffens
PhD Student UCL/CESAME
tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
Don't bother us with politics, respond those who don't want to learn.
-- Richard M. Stallman


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


Re: savannah

2005-08-08 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yoshinori K. Okuji wrote:
 And they are still talking about LILO vs. GRUB? Completely off-topic. Who on 
 the earth understands your post? *sigh*

They are asking for a popularity poll between LILO and GRUB.
And they also report some problems they had with grub legacy :
- -software raid (not straightforward with grub)
- -the usual problems with stage 1[.5] not finding stage 2
 (fixed by the grub 2 rescue command line)
- -lilo -R-like functionality (what's that ? an automatic fallback when
kernel can't be read ?) to make remote kernel changes safer.

What comes up is also that most users just keep the default bootloader
from their distro. And grub seems to be the default bootloader in a
growing number of distributions.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC+D3IFEQoKRQyjtURAj4UAJ4kUyc40DUiAxVc0ge9CO+cMp9eBQCbBQR2
XfC+tG2FX2uqsVZZDaFt/ds=
=txlx
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [PATCH] sparc64 (common specific files)

2005-07-13 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vincent Pelletier wrote:
One more sparc64 specific file.
Now that the configure file has been updated on the server, the changes
are more visible.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1MQcFEQoKRQyjtURAsckAJsFzSJbF8rj+mK/aca0e39hoKfN3QCcDiPI
CyBhCKHD6f82gSIuWBDVf50=
=h1m7
-END PGP SIGNATURE-
Index: configure
===
RCS file: /cvsroot/grub/grub2/configure,v
retrieving revision 1.15
diff -u -p -r1.15 configure
--- configure   12 Jul 2005 22:36:43 -  1.15
+++ configure   13 Jul 2005 07:29:21 -
@@ -1397,6 +1397,7 @@ host_os=`echo $ac_cv_host | sed 's/^\([^
 case $host_cpu in
   i[3456]86) host_cpu=i386 ;;
   powerpc) ;;
+  sparc64) ;;
   *) { { echo $as_me:$LINENO: error: unsupported CPU type 5
 echo $as_me: error: unsupported CPU type 2;}
{ (exit 1); exit 1; }; } ;;
@@ -1405,6 +1406,7 @@ esac
 case $host_cpu-$host_vendor in
   i386-*) host_vendor=pc ;;
   powerpc-*) host_vendor=ieee1275 ;;
+  sparc64-*) host_vendor=ieee1275 ;;
   *) { { echo $as_me:$LINENO: error: unsupported machine type 5
 echo $as_me: error: unsupported machine type 2;}
{ (exit 1); exit 1; }; } ;;
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCHv2] FIXME: These should be dynamically obtained from a terminal.

2005-07-13 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vincent Pelletier wrote:
 Warning : terms other than console.c  vga.c will be broken by this
 patch, as long as they don't have the function.

It's fixed in this patch for sparc64 port (see sparc_getwh.diff, which
is a diff between term/powerpc and term/sparc64). I think the same code
can be used for ppc.

It also contains the grub_getwh function I forgot in the previous patch.

2005-07-13  Vincent Pelletier  [EMAIL PROTECTED]

* include/grub/term.h: (GRUB_TERM_WIDTH, GRUB_TERM_HEIGHT):
Redefined to use grub_getwh.
(struct grub_term): New field named getwh.
(grub_getwh): New exported prototype.
* kern/term.c : (grub_getwh): New function.
* term/i386/pc/console.c: (grub_console_getwh): New function.
(grub_console_term): New field and new initial value.
* term/i386/pc/vga.c: (grub_vga_getwh): New function.
(grub_vga_term): New field and new initial value.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1NNnFEQoKRQyjtURAtibAJoDv9ya6nHL1JHkyIxLfWOeC8paaQCfcO9K
fRM2BWoPzNOCr2NMZ+P3z9I=
=g1su
-END PGP SIGNATURE-
diff -rupN powerpc/ieee1275/ofconsole.c sparc64/ieee1275/ofconsole.c
--- powerpc/ieee1275/ofconsole.c2005-06-21 04:33:52.0 +0200
+++ sparc64/ieee1275/ofconsole.c2005-07-13 10:18:46.0 +0200
@@ -120,7 +120,7 @@ static int
 grub_ofconsole_readkey (int *key)
 {
   char c;
-  int actual = 0;
+  grub_ssize_t actual = 0;
 
   grub_ieee1275_read (stdin_ihandle, c, 1, actual);
 
@@ -207,6 +207,49 @@ grub_ofconsole_getxy (void)
   return ((grub_curr_x - 1)  8) | grub_curr_y;
 }
 
+static grub_uint16_t
+grub_ofconsole_getwh (void)
+{
+  grub_ieee1275_ihandle_t config;
+  char *val;
+  grub_ssize_t lval;
+  static grub_uint8_t w, h;
+
+  if (w  h) /* Once we have them, don't ask them again.  */
+{
+  if (! grub_ieee1275_open (/config, config) 
+  config != -1)
+{
+  if (! grub_ieee1275_get_property_length (config, screen-#columns,
+   lval)  lval != -1)
+{
+  val = grub_malloc (lval);
+  if (! grub_ieee1275_get_property (config, screen-#columns,
+val, lval, 0))
+w = (grub_uint8_t) grub_strtoul (val, val + lval, 10);
+  grub_free (val);
+}
+  if (! grub_ieee1275_get_property_length (config, screen-#rows,
+   lval)  lval != -1)
+{
+  val = grub_malloc (lval);
+  if (! grub_ieee1275_get_property (config, screen-#rows,
+val, lval, 0))
+h = (grub_uint8_t) grub_strtoul (val, val + lval, 10);
+  grub_free (val);
+}
+}
+}
+
+  /* XXX: Default values from OpenBoot on my U10.  */
+  if (! w)
+w = 80;
+  if (! h)
+h = 34;
+
+  return (w  8) | h;
+}
+
 static void
 grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y)
 {
@@ -222,6 +265,8 @@ static void
 grub_ofconsole_cls (void)
 {
   /* Clear the screen.  */
+  if (grub_env_get (nocls))
+return;
   grub_ofconsole_writeesc (\e[2J);
   grub_gotoxy (0, 0);
 }
@@ -241,8 +286,8 @@ grub_ofconsole_refresh (void)
 static grub_err_t
 grub_ofconsole_init (void)
 {
-  char data[4];
-  grub_size_t actual;
+  unsigned char data[4];
+  grub_ssize_t actual;
   int col;
 
   if (grub_ieee1275_get_property (grub_ieee1275_chosen, stdout, data,
@@ -287,6 +332,7 @@ static struct grub_term grub_ofconsole_t
 .checkkey = grub_ofconsole_checkkey,
 .getkey = grub_ofconsole_getkey,
 .getxy = grub_ofconsole_getxy,
+.getwh = grub_ofconsole_getwh,
 .gotoxy = grub_ofconsole_gotoxy,
 .cls = grub_ofconsole_cls,
 .setcolorstate = grub_ofconsole_setcolorstate,
Index: include/grub/term.h
===
RCS file: /cvsroot/grub/grub2/include/grub/term.h,v
retrieving revision 1.7
diff -u -p -r1.7 term.h
--- include/grub/term.h 19 Feb 2005 20:56:07 -  1.7
+++ include/grub/term.h 12 Jul 2005 19:55:33 -
@@ -71,9 +71,9 @@ grub_term_color_state;
 
 /* Menu-related geometrical constants.  */
 
-/* FIXME: These should be dynamically obtained from a terminal.  */
-#define GRUB_TERM_WIDTH80
-#define GRUB_TERM_HEIGHT   25
+/* FIXME: Ugly way to get them form terminal.  */
+#define GRUB_TERM_WIDTH ((grub_getwh()0xFF00)8)
+#define GRUB_TERM_HEIGHT(grub_getwh()0xFF)
 
 /* The number of lines of GRUB version... at the top.  */
 #define GRUB_TERM_INFO_HEIGHT  1
@@ -142,6 +142,9 @@ struct grub_term
   /* Get a character.  */
   int (*getkey) (void);
   
+  /* Get the screen size. The return value is ((Width  8) | Height).  */
+  grub_uint16_t (*getwh) (void);
+
   /* Get the cursor position. The return

Re: [PATCH] sparc64 (common specific files)

2005-07-13 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Something I forgot in previous patch : prototype change for grub_get_rtc
in utils/misc.c .

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1NcTFEQoKRQyjtURAlWWAKC0HdHIZCfNqjbl2j685m2hI8o5XwCgnI1Y
/qedbKjsWGY6qLlvLi+N2lg=
=35nJ
-END PGP SIGNATURE-
Index: util/misc.c
===
RCS file: /cvsroot/grub/grub2/util/misc.c,v
retrieving revision 1.13
diff -u -p -r1.13 misc.c
--- util/misc.c 27 Feb 2005 21:19:06 -  1.13
+++ util/misc.c 13 Jul 2005 08:27:22 -
@@ -254,7 +254,7 @@ grub_stop (void)
   exit (1);
 }
 
-grub_uint32_t
+grub_uintn_t
 grub_get_rtc (void)
 {
   struct timeval tv;
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: sparc64 port : diffs to powerpc branches

2005-07-13 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 In that case the usparc port needs a GRUB_IEEE1275_FLAG_... to
 indicate it is not possible to change colors or that it works
 differently.

Good idea.

 Perhaps...  Can you put the bug report on the wiki so we will not
 forget about it?

Done. Btw, I hope my wiki clean up (pages full of links) is ok. I
wondered if it was worth the noise it made in the change log...

 You did not load ext2 as a module, but linked it into the binary.
 I assume you did not use grub-mkimage yet...

Oh, I thought you meant it was used to add them statically in grubof.

 Ok, cool.  I am looking forwards to that patch.

I think patches should be applied in this order :
- - Apply file moving patch for ieee1275 common files.
- - Apply the general patchs I sent (so we have a clean status to add the
sparc64 port, like grub_get_rtc prototype change, the already-applied
mm.c patch to correct behaviour on 64 bits archs, ...)
- - Finally apply the sparc64 specific adds (should be only file additions
at this step, excepts for changes in configure[.ac] and ChangeLog :) ).

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1XxRFEQoKRQyjtURAgciAKCYAeqt7PGpx85WOj0iciC4P49FLwCffFMe
wwtEclilaG6A8+SUUO4KIGQ=
=NR2U
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [PATCH] sparc64 (common specific files)

2005-07-13 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 This change is not required.  We can better leave it as it was.

So you'll have not to apply a part of the first patch in this thread,
because this one fixes an error in grub emu because I changed a
prototype in the first patch.

I insist though that the time should be kept with the most
precision/value range we could give it.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1YFZFEQoKRQyjtURAu7iAKC04QsYgkYqDvckx0d/NX0BLoG/xwCggjNp
7M82LzstyIaa2kUm0TxpLIQ=
=uDB5
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [FILE] Tune generation tool

2005-07-13 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 Perhaps `contrib/util/i386/' or so?

Good idea.

 I am not sure if it has to enter CVS, but I have no objections against
 it.  Can you add the copyright header and copyright years before it is
 committed?

Sure. Do I send a patch or the bare files ?
I'll also check the formatting guidelines are followed in my code ;) .

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1YMpFEQoKRQyjtURAk52AJ9lju/FXYU3J0SCnBVvgyJ8SwiiowCeOtcw
XYTZYl0cEEmItC2DDvs2oek=
=64vf
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [FILE] Play command

2005-07-13 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 Cool!  Won't it be nice to use a user readable fileformat?  It is not
 a requirement from my side, just a suggestion. :)

It might require some [f|s]scanf function, and I don't think it is
welcome in the core just because it is used in such peripheral function.
I thought first about using such format, because it's way easier to
edit... But I finally resigned. Maybe a fscanf function could be added
in this module, then moved in the core if it turns out to be useful.

 This should be 2002, 2004, 2005 if I am not mistaken.  The years 2002,
 2004 for the Hurd code and 2005 for your changes.  I do not know where
 2003 comes from.

Grub cat command I think :) . I sadly don't pay much attention to the
sources header :$ .

 Is it possible to share this code?  We need it for VGA and now for
 play, we will need it more often for other code which we will write in
 the future.

Maybe could they be added to kern/i386/pc/startup.S .

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1YK+FEQoKRQyjtURAqE7AJ4oZWUXEHGGUn4S/vRTC8TCG5CkYQCePphj
TR+SdKebKNI7KusrtHCJo6I=
=qRrY
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [PATCH] sparc64 (common specific files)

2005-07-13 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 For which reason?
 
 But if it should be more precise, it should be a grub_uint64_t.

If the architecture give us a 32 bit number, we won't invent the
remaining 32 bits...
On the other hand, if the architecture give us 64 significant bits, why
loosing 32 of them through a cast ?

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1ZJnFEQoKRQyjtURAs6jAJ9u1dHXeKxPUNgb+jNThMhBWTTopwCeK2u/
PFzGcGVncu6IxqUcBp/kmxk=
=PyOQ
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [FILE] Tune generation tool

2005-07-13 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 Both are fine for me.

Here it is. Merged everything in the c file to be cleaner.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1Zo2FEQoKRQyjtURAiZ1AJwKWv+yVysANtUG3+Z1cBwnzYCWUwCgsDHa
3m8e/Vi+mvD34UtTcKCukPo=
=s0Qh
-END PGP SIGNATURE-
/*  gentunes.c -- Generates tune files for Grub 2 play command.  */
/*
 *  GRUB  --  GRand Unified Bootloader
 *  Copyright (C) 2005  Free Software Foundation, Inc.
 *
 *  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.
 */

#include stdio.h

/* The 12th root of 2.  Sort of.  */
#define T_TEMP_SCALE		1.0594630943592952645
#define T_DOWN_ONE_HALF(x)	((short) (x / T_TEMP_SCALE))
#define T_UP_ONE_HALF(x)	((short) (x * T_TEMP_SCALE))
#define T_DOWN_ONE_OCTAVE(x)	((short) (x / 2))
#define T_UP_ONE_OCTAVE(x)	((short) (x * 2))
#define T_REST			((short) 0)
#define T_FINE			((short) (-1))

/* Notes ranging from C to B in octaves 2 to 6.
   German (?) notation and GNU/Hurd notation supported.  */

/* A little reminder for those who, like me, only know the
   do, re, mi... (Italian ?) names :
   B si
   A la
   G sol
   F fa
   E mi
   D re
   C do */

#define T_b_3	T_UP_ONE_OCTAVE (T_b_2)
#define T_b_F_3	T_UP_ONE_OCTAVE (T_b_F_2)
#define T_a_S_3	T_b_F_3
#define T_a_3	T_UP_ONE_OCTAVE (T_a_2)
#define T_a_F_3	T_UP_ONE_OCTAVE (T_a_F_2)
#define T_g_S_3	T_a_F_3
#define T_g_3	T_UP_ONE_OCTAVE (T_g_2)
#define T_g_F_3	T_f_S_3
#define T_f_S_3	T_UP_ONE_OCTAVE (T_f_S_2)
#define T_f_3	T_UP_ONE_OCTAVE (T_f_2)
#define T_e_3	T_UP_ONE_OCTAVE (T_e_2)
#define T_e_F_3	T_UP_ONE_OCTAVE (T_e_F_2)
#define T_d_S_3	T_e_F_3
#define T_d_3	T_UP_ONE_OCTAVE (T_d_2)
#define T_d_F_3	T_c_S_3
#define T_c_S_3	T_UP_ONE_OCTAVE (T_c_S_2)
#define T_c_3	T_UP_ONE_OCTAVE (T_c_2)
#define B6  T_b_3
#define BF6 T_b_F_3
#define AS6 T_a_S_3
#define A6  T_a_3
#define AF6 T_a_F_3
#define GS6 T_g_S_3
#define G6  T_g_3
#define GF6 T_g_F_3
#define FS6 T_f_S_3
#define F6  T_f_3
#define E6  T_e_3
#define EF6 T_e_F_3
#define DS6 T_d_S_3
#define D6  T_d_3
#define DF6 T_d_F_3
#define CS6 T_c_S_3
#define C6  T_c_3

#define T_b_2	T_UP_ONE_OCTAVE (T_b_1)
#define T_b_F_2	T_UP_ONE_OCTAVE (T_b_F_1)
#define T_a_S_2	T_b_F_2
#define T_a_2	T_UP_ONE_OCTAVE (T_a_1)
#define T_a_F_2	T_UP_ONE_OCTAVE (T_a_F_1)
#define T_g_S_2	T_a_F_2
#define T_g_2	T_UP_ONE_OCTAVE (T_g_1)
#define T_g_F_2	T_f_S_2
#define T_f_S_2	T_UP_ONE_OCTAVE (T_f_S_1)
#define T_f_2	T_UP_ONE_OCTAVE (T_f_1)
#define T_e_2	T_UP_ONE_OCTAVE (T_e_1)
#define T_e_F_2	T_UP_ONE_OCTAVE (T_e_F_1)
#define T_d_S_2	T_e_F_2
#define T_d_2	T_UP_ONE_OCTAVE (T_d_1)
#define T_d_F_2	T_c_S_2
#define T_c_S_2	T_UP_ONE_OCTAVE (T_c_S_1)
#define T_c_2	T_UP_ONE_OCTAVE (T_c_1)
#define B5  T_b_2
#define BF5 T_b_F_2
#define AS5 T_a_S_2
#define A5  T_a_2
#define AF5 T_a_F_2
#define GS5 T_g_S_2
#define G5  T_g_2
#define GF5 T_g_F_2
#define FS5 T_f_S_2
#define F5  T_f_2
#define E5  T_e_2
#define EF5 T_e_F_2
#define DS5 T_d_S_2
#define D5  T_d_2
#define DF5 T_d_F_2
#define CS5 T_c_S_2
#define C5  T_c_2

#define T_b_1	T_UP_ONE_HALF (T_b_F_1)
#define T_b_F_1	T_UP_ONE_HALF (T_a_1)
#define T_a_S_1	T_b_F_1
#define T_a_1	((short) (440))
#define T_a_F_1	T_DOWN_ONE_HALF (T_a_1)
#define T_g_S_1	T_a_F_1
#define T_g_1	T_DOWN_ONE_HALF (T_a_F_1)
#define T_g_F_1	T_f_S_1
#define T_f_S_1	T_DOWN_ONE_HALF (T_g_1)
#define T_f_1	T_DOWN_ONE_HALF (T_f_S_1)
#define T_e_1	T_DOWN_ONE_HALF (T_f_1)
#define T_e_F_1	T_DOWN_ONE_HALF (T_e_1)
#define T_d_S_1	T_e_F_1
#define T_d_1	T_DOWN_ONE_HALF (T_e_F_1)
#define T_d_F_1	T_c_S_1
#define T_c_S_1	T_DOWN_ONE_HALF (T_d_1)
#define T_c_1	T_DOWN_ONE_HALF (T_c_S_1)
#define B4  T_b_1
#define BF4 T_b_F_1
#define AS4 T_a_S_1
#define A4  T_a_1
#define AF4 T_a_F_1
#define GS4 T_g_S_1
#define G4  T_g_1
#define GF4 T_g_F_1
#define FS4 T_f_S_1
#define F4  T_f_1
#define E4  T_e_1
#define EF4 T_e_F_1
#define DS4 T_d_S_1
#define D4  T_d_1
#define DF4 T_d_F_1
#define CS4 T_c_S_1
#define C4  T_c_1

#define T_b	T_DOWN_ONE_OCTAVE (T_b_1)
#define T_b_F	T_DOWN_ONE_OCTAVE (T_b_F_1)
#define T_a_S	T_b_F
#define T_a	T_DOWN_ONE_OCTAVE (T_a_1)
#define T_a_F

Re: [PATCH] Huge changes in mm.c

2005-07-12 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 So with this change all problems are fixed?  In that case this patch
 needs to be committed.

No I can read files from an ext2 partition on sparc64.
What's the next step ? :) Loading modules ? I don't know exactly how to
make a disk bootable, but I think I'll keep net boot for now.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC08h3FEQoKRQyjtURAk/nAJ9zuuGSoXlhimNQ7X9o9CZYX766BACdEaga
ZTBLcL9L4XWm24t6gbldSII=
=QCgU
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


[FILE] Play command

2005-07-12 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Here is the play command source code and some tunes.
I don't submit a patch since I'm not sure where it will (and where the
tunes will) go.

With Marco we thought about contrib/i386/pc/play.c

Ancestors of this code are:
GNU/Hurd
Grub 2 cat command
Grub 2 vga for inb  outb

Contributors for the tunes:
FSF_Song I_Feel_Pretty Indiana_Jones_Theme Summertime : GNU/Hurd
Beverly Hills Cop. Star Trek: The next Generation : Marco Gerards
Tetris_Theme : me

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFC1BuHFEQoKRQyjtURAtfnAJ0Z6EyHKmArEvcGMa7ioMu66zbFZgCglHXy
actaxo6QqQaFx/UfMrvtC+Q=
=C1S1
-END PGP SIGNATURE-
/* play.c - command to play a tune  */
/*
 *  GRUB  --  GRand Unified Bootloader
 *  Copyright (C) 2003  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 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 GRUB; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/* Lots of this file is borowed from GNU/Hurd generic-speaker driver */

#include grub/normal.h
#include grub/dl.h
#include grub/arg.h
#include grub/file.h
#include grub/disk.h
#include grub/term.h
#include grub/misc.h

/* Read a byte from a port.  */
static inline unsigned char
inb (unsigned short port)
{
  unsigned char value;

  asm volatile (inb%w1, %0 : =a (value) : Nd (port));
  asm volatile (outb   %%al, $0x80 : : );
  
  return value;
}

/* Write a byte to a port.  */
static inline void
outb (unsigned short port, unsigned char value)
{
  asm volatile (outb   %b0, %w1 : : a (value), Nd (port));
  asm volatile (outb   %%al, $0x80 : : );
}

/* The speaker port.  */
#define SPEAKER			0x61

/* If 0, follow state of SPEAKER_DATA bit, otherwise enable output
   from timer 2.  */
#define SPEAKER_TMR2		0x01

/* If SPEAKER_TMR2 is not set, this provides direct input into the
   speaker.  Otherwise, this enables or disables the output from the
   timer.  */
#define SPEAKER_DATA		0x02

/* The PIT channel value ports.  You can write to and read from them.
   Do not mess with timer 0 or 1.  */
#define PIT_COUNTER_0		0x40
#define PIT_COUNTER_1		0x41
#define PIT_COUNTER_2		0x42

/* The frequency of the PIT clock.  */
#define PIT_FREQUENCY		0x1234dd

/* The PIT control port.  You can only write to it.  Do not mess with
   timer 0 or 1.  */
#define PIT_CTRL		0x43
#define PIT_CTRL_SELECT_MASK	0xc0
#define PIT_CTRL_SELECT_0	0x00
#define PIT_CTRL_SELECT_1	0x40
#define PIT_CTRL_SELECT_2	0x80

/* Read and load control.  */
#define PIT_CTRL_READLOAD_MASK	0x30
#define PIT_CTRL_COUNTER_LATCH	0x00	/* Hold timer value until read.  */
#define PIT_CTRL_READLOAD_LSB	0x10	/* Read/load the LSB.  */
#define PIT_CTRL_READLOAD_MSB	0x20	/* Read/load the MSB.  */
#define PIT_CTRL_READLOAD_WORD	0x30	/* Read/load the LSB then the MSB.  */

/* Mode control.  */
#define PIT_CTRL_MODE_MASK	0x0e

/* Interrupt on terminal count.  Setting the mode sets output to low.
   When counter is set and terminated, output is set to high.  */
#define PIT_CTRL_INTR_ON_TERM	0x00

/* Programmable one-shot.  When loading counter, output is set to
   high.  When counter terminated, output is set to low.  Can be
   triggered again from that point on by setting the gate pin to
   high.  */
#define PIT_CTRL_PROGR_ONE_SHOT	0x02

/* Rate generator.  Output is low for one period of the counter, and
   high for the other.  */
#define PIT_CTRL_RATE_GEN	0x04

/* Square wave generator.  Output is low for one half of the period,
   and high for the other half.  */
#define PIT_CTRL_SQUAREWAVE_GEN	0x06

/* Software triggered strobe.  Setting the mode sets output to high.
   When counter is set and terminated, output is set to low.  */
#define PIT_CTRL_SOFTSTROBE	0x08

/* Hardware triggered strobe.  Like software triggered strobe, but
   only starts the counter when the gate pin is set to high.  */
#define PIT_CTRL_HARDSTROBE	0x0a

/* Count mode.  */
#define PIT_CTRL_COUNT_MASK	0x01
#define PIT_CTRL_COUNT_BINARY	0x00	/* 16-bit binary counter.  */
#define PIT_CTRL_COUNT_BCD	0x01	/* 4-decade BCD counter.  */

#define T_REST			((short) 0)
#define T_FINE			((short) -1)

struct note {
  short pitch;
  short duration;
};

static void
beep_off (void)
{
  unsigned char status;

  status = inb (SPEAKER)  ~(SPEAKER_TMR2 | SPEAKER_DATA);
  outb (SPEAKER, status);
}

static void
beep_on (short pitch)
{
  unsigned char status;
  unsigned int counter;

  if (pitch  20

Re: rmll - grub2 presentation

2005-07-09 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yoshinori K. Okuji wrote:
 Good news. Is Jeff active now? I haven't seen him hacking these days...

He was moving the last days, so he hasn't much time.

And a good news marco already knows : I finally made the OpenBoot calls
work \o/ !

The problem was in the struct used to send args  receive return values.
It must contain fields of the same size, which is 32 bits on ppc and 64
on usparc. So now it works with long long as field type.

So, I'm glad to announce the very first time some grub 2 related work
booted on an usparc :

ok load net
Boot device: /[EMAIL PROTECTED],0/[EMAIL PROTECTED],1/[EMAIL PROTECTED],1  File 
and args:
5800
ok init-program
testType  'go' to resume
ok go
Program terminated

I call the following functions:
_start :
 grub_ofconsole_init() :
  grub_ieee1275_finddevice (/chosen, chosen)
  grub_ieee1275_get_property (chosen, stdout, data, sizeof data,
 actual)
  grub_ieee1275_get_property (chosen, stdin, data, sizeof data,
 actual)
 ieee1275_write(stdout_ihandle,test,4,wrote);
 ieee1275_enter(); //hence the Type  'go' to resume
 ieee1275_exit();  //hence the Program terminated

So I think I can say OB calls work, have they argument(s) and or return
value(s) or not !
Time to go (for the last day) to the LSM now :).

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCz2p+FEQoKRQyjtURArPuAKCwOLP8ZSyHNK7nxnwS5bvKuYUlZQCfaFd8
UTof30pCDuP9ZrHhrwFwRdk=
=k0TW
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: rmll - grub2 presentation

2005-07-08 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yoshinori K. Okuji wrote:
 Sorry. This sounds funny.

If you want to test it, you can download an i386 core.img here :
http://www.sysif.net/~vincent/grub2/core.img
(built with *.mod)
And some other related things around it :

$ l grub2/
total 92
- -rw-r--r--  1 vincent vincent  5376 2005-07-05 12:35 common.h
- -rw-r--r--  1 vincent vincent 63372 2005-07-05 12:33 core.img
- -rw-r--r--  1 vincent vincent  9103 2005-07-05 12:35 main.c
drwxr-xr-x  2 vincent vincent  4096 2005-07-05 12:35 songs

common.h  main.c are used to convert the songs (hard-coded in main.c)
into files readable by the play command.

$ l grub2/songs/
total 28
- -rw-r--r--  1 vincent vincent 216 2005-07-05 12:35 Beverly Hills Cop.
- -rw-r--r--  1 vincent vincent 188 2005-07-05 12:35 FSF_Song
- -rw-r--r--  1 vincent vincent 144 2005-07-05 12:35 I_Feel_Pretty
- -rw-r--r--  1 vincent vincent 228 2005-07-05 12:35 Indiana_Jones_Theme
- -rw-r--r--  1 vincent vincent 152 2005-07-05 12:35 Star Trek: The Next
Generation
- -rw-r--r--  1 vincent vincent 224 2005-07-05 12:35 Summertime
- -rw-r--r--  1 vincent vincent 736 2005-07-05 12:35 Tetris_Theme

The songs have to be grub2-readable : on a floppy, on a partition...

Would it enter the grub 2 cvs if I send a patch ?
Or maybe another project or cvs branch could be started, containing
less-interesting modules like this one.

 somebody might port it to other architectures

About porting (not especially play command), Marco introduced me to
Jeff Bailey, and we will start porting grub 2 to usparc (aka sparc 64,
aka sparc v9) architecture. I discussed with some #hurdfr people at the
LSM and they were interested in such port (Manuel Menal told me l4 works
on usparc :) ).
As a reminder of the current port status :
- - argument-less commands (like exit) work
- - others lead to Fast Data Access MMU Miss

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCzonUFEQoKRQyjtURAt5tAJ0X+7Z6cQ827q7n/x0DUb2WiF6m8ACeJIvH
p2Ox7SQJmRprLuW4PUr43Hs=
=p2A2
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c

2005-07-05 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yoshinori K. Okuji wrote:
 My feeling is that it is not convenient to use pointers.

Right.
My first idea was to use a struct as return type :

struct coords {
  unsigned char x;
  unsigned char y;
};

So it becomes :

if (grub_getxy () .x)

Or maybe a struct of bitfields...

I feel structs as being cleaner to use compared to shifts. If someday
we have a terminal that exceeds 255 chars in one or both dimensions, we
wouldn't have to grep grub_getxy () to find the shifts...

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCyjDWFEQoKRQyjtURAg5+AKCv+0nJXOMzaiiQ/+ePXVAOhuvvlgCeN88f
40Oy4FUN5ihK0USgAUl7ypE=
=M1Xj
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [PATCH] Small unicode problem fix in normal/menu.c

2005-07-05 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yoshinori K. Okuji wrote:
 You can check in this patch, but this is not the right thing to do.

So I prefer not checking it in.
I had the idea to start a Unicode debate on how to handle this.
My first idea would be :
unsigned int grub_putcode(...);
unsigned int grub_putchar(...);

Ignoring the return value would make those function act as they do now.
Reading it would give the number of char actualy displayed on screen.
0 = Unicode char incomplete (for putchar only, for putcode might be
invalid Unicode if applies)
1 = one char written
2 = a char as wide as 2 usual chars (I think I read somewhere it exists)
(and so on)

I was also wondering about the font format. Does any editor exists ? Or
is it taken from an existing format ? I'm dying to see Japanese chars on
grub menu while playing the tetris theme :] .

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCyu8zFEQoKRQyjtURAiSiAJ98YnZTCJhAFs0nJPj94PNu0tEDCgCgjvmt
cal3c1Ca97j3+ARVBoL9vrg=
=6pce
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
T\xE9l\xE9chargez cette version sur http://fr.messenger.yahoo.com



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


Re: rmll - grub2 presentation

2005-07-05 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yoshinori K. Okuji wrote:
 I won't go

Oh no :( .
I was planning to make a surprise : I've implemented last night a play
command in grub that plays on the standard buzzer a tune read from an
on-disk file.

I grabbed some code from hurd's generic-speaker driver, and some from
grub 2 itself (outb, inb, used skeleton of 'cat' command).

I have 7 tunes this far, most taken from the hurd file :) :
FSF song
Indiana Jones theme
I Feel Pretty
Summertime
Star Trek: The Next Generation
Beverly Hills Cop.
Tetris theme - home-made from a mid file

I had the idea when I was talking with Marco who reminded me his idea
about a tetris module for grub. I asked if the tetris theme would be
played while gaming, and I realized that it was possible, because of the
internal speaker...

To handle the note length, I use grub_get_rtc, so it would be easy to do
something else while waiting for the timeout (like handling tetris blocs
:) )

Now I don't know if it is pertinent to submit it as a patch...
On the one hand, there is no space to loose, and making it a module
would make it noticeable.
On the other hand, having the FSF song as an easter egg (and maybe
others) could be fun.

Another problem would be the portability. Although the hurd code says it
can be used in a wide range of architectures, I think the won't like my
inb  outb...

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCyuz9FEQoKRQyjtURAvbiAKCovyHF5rWviJhDwcSg+R2JJxN8fwCeNDgZ
ZtmDemX9tQiq1aI+T0AQjRM=
=LVNE
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [Bulk] [PATCH] Small unicode problem fix in normal/menu.c

2005-07-04 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

About the grub_getxy function...

Wouldn't it be better to change it ?

ncurses-like (not macros !) :

void grub_getyx (unsigned int y, unsigned int x)
void grub_getmaxyx (unsigned int y, unsigned int x) /* to get the term
size */

Any comment ?

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCyUuKFEQoKRQyjtURAvbHAJ956t5IBtaSiMsVeJTYtfbTyk2RcgCfcfiB
J7BWr/ReX2enuBh4DUSe4a0=
=lSNu
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: FIXME: These should be dynamically obtained from a terminal.

2005-07-04 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yoshinori K. Okuji wrote:
 We need to call grub_getwh only once. Possibly in grub_menu_init_page.

So we have to redesign the way sizes are computed to use something else
than macros.

 BTW, is the VGA terminal working well? Since Marco changed the mode to 0x10 
 from 0x12, the screen is a bit smaller than before, and I'm not sure if the 
 menu entry editor works with this.

It wasn't working, and that's why I started studying the getwh idea :) .
There is one line missing at the bottom of the screen, so when it's
initialy drawn (frame + comments) it scrolls up one line. Then, when
entries are drawn, they are drawn at the right absolute place, so one
line below the top of the menu.

Maybe see you tomorr^Wtoday at the LSM :).

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCycP7FEQoKRQyjtURAvB6AJwMZ1ppB3e+sVxF0o2933WjFunNvgCfcaj0
ZpJw03aghGX1VP4v81oLvkc=
=7FD8
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [Bulk] Boot from SCSI, chainload to IDE?

2005-07-03 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jago Pearce wrote:
 Therefore the next drive MBR should be (hd1,0) but that does work if I
 chainload to that.

The next whole drive (containing the MBR) should be (hd1).
(hd1,0) is the first partition on it.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCx5XmFEQoKRQyjtURAjRLAJ4/HWJV+IR/r+VYs2DCE1R/uDm1GgCfY60R
2NpaP8i6pENZQrJmR+Gnomk=
=qLF0
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


[PATCH] Tiny command line fix

2005-07-03 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Here is a patch that fixes backspace ('\b') acting as delete
(ctrl-d) when at beginning of line.

2005-07-03  Vincent Pelletier  [EMAIL PROTECTED]

* normal/comandline.c
  (grub_cmdline_get): Don't fallback on ctrl-d when backspace is
  pressed at beginning of line.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCx7JCFEQoKRQyjtURAsUJAJ9JC9RdJsh5cxiJR1nFK2KReRxbRwCfQhzQ
WG4cnT+fPtV5BIJfCZrcNN4=
=eaKt
-END PGP SIGNATURE-
Index: normal/cmdline.c
===
RCS file: /cvsroot/grub/grub2/normal/cmdline.c,v
retrieving revision 1.14
diff -u -p -r1.14 cmdline.c
--- normal/cmdline.c8 Mar 2005 01:01:06 -   1.14
+++ normal/cmdline.c3 Jul 2005 09:31:59 -
@@ -717,6 +717,8 @@ grub_cmdline_get (const char *prompt, ch
  lpos--;
  cl_set_pos ();
}
+  else
+break;
  /* fall through */
  
case 4: /* Ctrl-d */
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


FIXME: These should be dynamically obtained from a terminal.

2005-07-03 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'm trying to fix that thing.
I'm only working on the i386 part, because I have no ppc.

Here is how I plan to do it (almost done, but I have some questions) :

- -add an asm function to get the current vga mode without changing it (or
maybe a global var to keep the current vga mode)
- -add a field in struct grub_term
- -implement this function in different terminal handlers
- -implement grub_getwh
- -redefine GRUB_TERM_WIDTH  GRUB_TERM_HEIGHT macros to use grub_getwh

Here are my questions :
Should we foresee, in vga mode, that the user might someday choose his
vga mode ?
Should we redefine all the macros we use to draw the menu to be less
intensive on grub_getwh ?

In the attached patch, the vga function is disabled, because for now the
asm function does not work (returns always 0). As I'm really not
familiar with x86 asm, I think I had something wrong adapting from
grub_vga_set_mode.

nb: I only give the patch as draft, a preview of what I'm working on.

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCyFNXFEQoKRQyjtURAtHIAKCDMtJhev1Z0mXvFm2Rg8p49rk4aQCgl2UR
C3TbKukpU4T4dHFIjyTv6hI=
=wg2h
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [Bulk] FIXME: These should be dynamically obtained from a terminal.

2005-07-03 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vincent Pelletier wrote:
 In the attached patch,

*cough* *cough*

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCyFXJFEQoKRQyjtURAjFRAKCyEeBiF6HDVeeFajmy8oGfVWIrvQCfUiCG
hX6z+XtVX9llG10YKEi6t7A=
=tmOI
-END PGP SIGNATURE-
Index: include/grub/term.h
===
RCS file: /cvsroot/grub/grub2/include/grub/term.h,v
retrieving revision 1.7
diff -u -p -r1.7 term.h
--- include/grub/term.h 19 Feb 2005 20:56:07 -  1.7
+++ include/grub/term.h 3 Jul 2005 20:34:40 -
@@ -72,8 +72,10 @@ grub_term_color_state;
 /* Menu-related geometrical constants.  */
 
 /* FIXME: These should be dynamically obtained from a terminal.  */
-#define GRUB_TERM_WIDTH80
-#define GRUB_TERM_HEIGHT   25
+/*#define GRUB_TERM_WIDTH  80
+#define GRUB_TERM_HEIGHT   25*/
+#define GRUB_TERM_WIDTH ((grub_getwh()0xFF00)8)
+#define GRUB_TERM_HEIGHT(grub_getwh()0xFF)
 
 /* The number of lines of GRUB version... at the top.  */
 #define GRUB_TERM_INFO_HEIGHT  1
@@ -142,6 +144,9 @@ struct grub_term
   /* Get a character.  */
   int (*getkey) (void);
   
+  /* Get the screen size. The return value is ((Width  8) | Height).  */
+  grub_uint16_t (*getwh) (void);
+
   /* Get the cursor position. The return value is ((X  8) | Y).  */
   grub_uint16_t (*getxy) (void);
   
@@ -183,6 +188,7 @@ void EXPORT_FUNC(grub_putchar) (int c);
 void EXPORT_FUNC(grub_putcode) (grub_uint32_t code);
 int EXPORT_FUNC(grub_getkey) (void);
 int EXPORT_FUNC(grub_checkkey) (void);
+grub_uint16_t EXPORT_FUNC(grub_getwh) (void);
 grub_uint16_t EXPORT_FUNC(grub_getxy) (void);
 void EXPORT_FUNC(grub_gotoxy) (grub_uint8_t x, grub_uint8_t y);
 void EXPORT_FUNC(grub_cls) (void);
Index: include/grub/i386/pc/vga.h
===
RCS file: /cvsroot/grub/grub2/include/grub/i386/pc/vga.h,v
retrieving revision 1.3
diff -u -p -r1.3 vga.h
--- include/grub/i386/pc/vga.h  4 Apr 2004 13:46:01 -   1.3
+++ include/grub/i386/pc/vga.h  3 Jul 2005 20:34:40 -
@@ -25,6 +25,9 @@
 /* Set the video mode to MODE and return the previous mode.  */
 unsigned char EXPORT_FUNC(grub_vga_set_mode) (unsigned char mode);
 
+/* Return the current video mode.  */
+unsigned char EXPORT_FUNC(grub_vga_get_mode) (void);
+
 /* Return a pointer to the ROM font table.  */
 unsigned char *EXPORT_FUNC(grub_vga_get_font) (void);
 
Index: kern/term.c
===
RCS file: /cvsroot/grub/grub2/kern/term.c,v
retrieving revision 1.7
diff -u -p -r1.7 term.c
--- kern/term.c 4 Apr 2004 13:46:02 -   1.7
+++ kern/term.c 3 Jul 2005 20:34:44 -
@@ -213,6 +213,12 @@ grub_checkkey (void)
 }
 
 grub_uint16_t
+grub_getwh (void)
+{
+  return (grub_cur_term-getwh) ();
+}
+
+grub_uint16_t
 grub_getxy (void)
 {
   return (grub_cur_term-getxy) ();
Index: kern/i386/pc/startup.S
===
RCS file: /cvsroot/grub/grub2/kern/i386/pc/startup.S,v
retrieving revision 1.13
diff -u -p -r1.13 startup.S
--- kern/i386/pc/startup.S  4 Apr 2004 13:46:02 -   1.13
+++ kern/i386/pc/startup.S  3 Jul 2005 20:34:44 -
@@ -1570,6 +1570,28 @@ FUNCTION(grub_vga_set_mode)
 
 
 /*
+ * unsigned char grub_vga_get_mode (void)
+ */
+FUNCTION(grub_vga_get_mode)
+   pushl   %ebp
+   pushl   %ebx
+
+   callprot_to_real
+   .code16
+   /* get current mode */
+   xorw%bx, %bx
+   movb$0x0f, %ah
+   int $0x10
+
+   DATA32  callreal_to_prot
+   .code32
+
+   popl%ebx
+   popl%ebp
+   ret
+
+
+/*
  * unsigned char *grub_vga_get_font (void)
  */
 FUNCTION(grub_vga_get_font)
Index: term/i386/pc/console.c
===
RCS file: /cvsroot/grub/grub2/term/i386/pc/console.c,v
retrieving revision 1.5
diff -u -p -r1.5 console.c
--- term/i386/pc/console.c  15 Feb 2005 00:07:01 -  1.5
+++ term/i386/pc/console.c  3 Jul 2005 20:34:45 -
@@ -20,6 +20,7 @@
 #include grub/machine/console.h
 #include grub/term.h
 #include grub/types.h
+#include grub/misc.h
 
 grub_uint8_t grub_console_cur_color = 0x7;
 static grub_uint8_t grub_console_standard_color = 0x7;
@@ -74,6 +75,12 @@ grub_console_putchar (grub_uint32_t c)
   grub_console_real_putchar (c);
 }
 
+static grub_uint16_t
+grub_console_getwh (void)
+{
+  return (80  8) | 25; /* FIXME: Always true ?  */
+}
+
 static void
 grub_console_setcolorstate (grub_term_color_state state)
 {
@@ -107,6 +114,7 @@ static struct grub_term grub_console_ter
 .putchar = grub_console_putchar,
 .checkkey = grub_console_checkkey,
 .getkey = grub_console_getkey,
+.getwh = grub_console_getwh,
 .getxy = grub_console_getxy,
 .gotoxy = grub_console_gotoxy,
 .cls = grub_console_cls

Re: [Bulk] Re: [Bulk] Re: [PATCH] grub2: commands/cmp.c: grub_cmd_cmp()

2005-07-02 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I haven't changed the BUFFER_SIZE (512). Please do if you think it is
appropriate.

2005-06-29  Vincent Pelletier  [EMAIL PROTECTED]

* commands/cmp.c
  (BUFFER_SIZE): New macro.
  (grub_cmd_cmp): Close the right file at the right time.  Compare
  only data just read.  Don't report files of different size as
  identical.  Dynamically allocate buffers.  Move variable
  declarations at the beginning of function.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCxmozFEQoKRQyjtURAhgIAJ9lR04VeEhMHnnTe1KJVorjRMzCbwCfYXDT
7qkbXSTMF7bGi8gaxS35/RI=
=N0Ed
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


[PATCH v2] commands/cmp.c: grub_cmd_cmp()

2005-07-02 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

(hum)

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCxnFnFEQoKRQyjtURAp6rAJ9bk6yTKM+px9Ikh+4ByzT+Q01c/gCeLVJ1
3YHNI5TDbln9u0Aoz5i9R4M=
=jdzU
-END PGP SIGNATURE-
Index: cmp.c
===
RCS file: /cvsroot/grub/grub2/commands/cmp.c,v
retrieving revision 1.2
diff -u -p -r1.2 cmp.c
--- cmp.c   4 Apr 2004 13:46:00 -   1.2
+++ cmp.c   2 Jul 2005 10:10:40 -
@@ -23,13 +23,21 @@
 #include grub/arg.h
 #include grub/misc.h
 #include grub/file.h
+#include grub/mm.h
+
+#define BUFFER_SIZE 512
 
 static grub_err_t
 grub_cmd_cmp (struct grub_arg_list *state __attribute__ ((unused)),
  int argc, char **args)
 {
-  grub_file_t file1;
-  grub_file_t file2;
+  grub_err_t err;
+  grub_ssize_t rd1, rd2;
+  grub_uint32_t pos;
+  grub_file_t file1 = 0;
+  grub_file_t file2 = 0;
+  char *buf1 = 0;
+  char *buf2 = 0;
 
   if (argc != 2)
 return grub_error (GRUB_ERR_BAD_ARGUMENT, two arguments required);
@@ -37,16 +45,9 @@ grub_cmd_cmp (struct grub_arg_list *stat
   grub_printf (Compare `%s' and `%s':\n, args[0],
   args[1]);
 
-  file1 = grub_file_open (args[0]);
-  if (! file1)
-return grub_errno;
-
-  file2 = grub_file_open (args[1]);
-  if (! file2)
-{
-  grub_file_close (file2);
-  return grub_errno;
-}
+  if (! (file1 = grub_file_open (args[0]) ) ||
+  ! (file2 = grub_file_open (args[1]) ) )
+goto cleanup;
 
   if (grub_file_size (file1) != grub_file_size (file2))
 grub_printf (Differ in size: %d [%s], %d [%s]\n, 
@@ -55,44 +56,48 @@ grub_cmd_cmp (struct grub_arg_list *stat
   
   else
 {
-  char buf1[512];
-  char buf2[512];
-  grub_ssize_t rd1, rd2;
-  grub_uint32_t pos = 0;
- 
+  pos = 0;
+
+  if (! (buf1 = (char *) grub_malloc (BUFFER_SIZE) ) ||
+  ! (buf2 = (char *) grub_malloc (BUFFER_SIZE) ) )
+goto cleanup;
   do
{
  int i;
- rd1 = grub_file_read (file1, buf1, 512);
- rd2 = grub_file_read (file2, buf2, 512);
+ rd1 = grub_file_read (file1, buf1, BUFFER_SIZE);
+ rd2 = grub_file_read (file2, buf2, BUFFER_SIZE);
 
  if (rd1 != rd2)
-   return 0;
+   goto cleanup;
 
- for (i = 0; i  512; i++)
+ for (i = 0; i  rd2; i++)
{
  if (buf1[i] != buf2[i])
{
  grub_printf (Differ at the offset %d: 0x%x [%s], 0x%x 
[%s]\n,
   i + pos, buf1[i], args[0],
   buf2[i], args[1]);
-
- grub_file_close (file1);
- grub_file_close (file2);
- return 0;
+ goto cleanup;
}
}
- pos += 512;
+ pos += BUFFER_SIZE;
  
} while (rd2);
+  grub_printf (The files are identical.\n);
 }
 
-  grub_file_close (file1);
-  grub_file_close (file2);
-
-  grub_printf (The files are identical.\n);
+cleanup:
+  err=grub_errno;
+  if (buf1)
+grub_free (buf1);
+  if (buf2)
+grub_free (buf2);
+  if (file1)
+grub_file_close (file1);
+  if (file2)
+grub_file_close (file2);
 
-  return 0;
+  return err;
 }
 
 
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


[PATCH] use grub_size_t instead of int in kern/misc.c

2005-07-02 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

New version of the patch, made after a discussion with Okuji on irc.
The ftoa changes in previous version of this patch might be done later,
if someone confirms they are ok.

2005-07-02  Vincent Pelletier  [EMAIL PROTECTED]

* kern/misc.c
  (grub_strncpy, grub_strncat, grub_strncmp, grub_strncasecmp):
  Changed argument type from int to grub_size_t.
  (grub_printf, grub_vprintf, grub_vsprintf, grub_sprintf): Changed
  return type from int to grub_size_t.
  (grub_strncasecmp): Make return value to also ignore case when we
  reach the end of one string.
* include/grub/mish.h
  (grub_strncpy, grub_strncat, grub_strncmp,
  grub_strncasecmp, grub_printf, grub_vprintf, grub_sprintf,
  grub_vsprintf): Updated prototypes to match changes in
  kern/misc.c.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCxtBHFEQoKRQyjtURAsq3AKCTag1s0aqOATkdK54LYJ/K+ZQY2gCfeljo
Hiim/wgZjTV6Og9HTwMjItQ=
=UWpE
-END PGP SIGNATURE-
Index: kern/misc.c
===
RCS file: /cvsroot/grub/grub2/kern/misc.c,v
retrieving revision 1.20
diff -u -p -r1.20 misc.c
--- kern/misc.c 23 Jun 2005 23:13:57 -  1.20
+++ kern/misc.c 2 Jul 2005 17:29:05 -
@@ -63,7 +63,7 @@ grub_strcpy (char *dest, const char *src
 }
 
 char *
-grub_strncpy (char *dest, const char *src, int c)
+grub_strncpy (char *dest, const char *src, grub_size_t c)
 {
   char *p = dest;
   
@@ -101,7 +101,7 @@ grub_strcat (char *dest, const char *src
 }
 
 char *
-grub_strncat (char *dest, const char *src, int c)
+grub_strncat (char *dest, const char *src, grub_size_t c)
 {
   char *p = dest;
 
@@ -115,11 +115,11 @@ grub_strncat (char *dest, const char *sr
   return dest;
 }
 
-int
+grub_size_t
 grub_printf (const char *fmt, ...)
 {
   va_list ap;
-  int ret;
+  grub_size_t ret;
   
   va_start (ap, fmt);
   ret = grub_vprintf (fmt, ap);
@@ -145,10 +145,10 @@ grub_real_dprintf(const char *file, cons
 }
 }
 
-int
+grub_size_t
 grub_vprintf (const char *fmt, va_list args)
 {
-  int ret;
+  grub_size_t ret;
 
   ret = grub_vsprintf (0, fmt, args);
   grub_refresh ();
@@ -191,9 +191,9 @@ grub_strcmp (const char *s1, const char 
 }
 
 int
-grub_strncmp (const char *s1, const char *s2, int c)
+grub_strncmp (const char *s1, const char *s2, grub_size_t c)
 {
-  int p = 1;
+  grub_size_t p = 1;
 
   while (*s1  *s2  p  c)
 {
@@ -209,9 +209,9 @@ grub_strncmp (const char *s1, const char
 }
 
 int
-grub_strncasecmp (const char *s1, const char *s2, int c)
+grub_strncasecmp (const char *s1, const char *s2, grub_size_t c)
 {
-  int p = 1;
+  grub_size_t p = 1;
 
   while (grub_tolower (*s1)  grub_tolower (*s2)  p  c)
 {
@@ -223,7 +223,7 @@ grub_strncasecmp (const char *s1, const 
   p++;
 }
 
-  return (int) *s1 - (int) *s2;
+  return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
 }
 
 char *
@@ -517,11 +517,11 @@ grub_ftoa (char *str, double f, int roun
   return str;
 }
 
-int
+grub_size_t
 grub_vsprintf (char *str, const char *fmt, va_list args)
 {
   char c;
-  int count = 0;
+  grub_size_t count = 0;
   auto void write_char (unsigned char ch);
   auto void write_str (const char *s);
   auto void write_fill (const char ch, int n);
@@ -729,11 +729,11 @@ grub_vsprintf (char *str, const char *fm
   return count;
 }
 
-int
+grub_size_t
 grub_sprintf (char *str, const char *fmt, ...)
 {
   va_list ap;
-  int ret;
+  grub_size_t ret;
   
   va_start (ap, fmt);
   ret = grub_vsprintf (str, fmt, ap);
Index: include/grub/misc.h
===
RCS file: /cvsroot/grub/grub2/include/grub/misc.h,v
retrieving revision 1.13
diff -u -p -r1.13 misc.h
--- include/grub/misc.h 9 May 2005 01:47:37 -   1.13
+++ include/grub/misc.h 2 Jul 2005 17:29:05 -
@@ -32,10 +32,10 @@
 
 void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n);
 char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src);
-char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c);
+char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, grub_size_t c);
 char *EXPORT_FUNC(grub_stpcpy) (char *dest, const char *src);
 char *EXPORT_FUNC(grub_strcat) (char *dest, const char *src);
-char *EXPORT_FUNC(grub_strncat) (char *dest, const char *src, int c);
+char *EXPORT_FUNC(grub_strncat) (char *dest, const char *src, grub_size_t c);
 
 /* Prototypes for aliases.  */
 void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n);
@@ -43,8 +43,8 @@ void *EXPORT_FUNC(memcpy) (void *dest, c
 
 int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);
 int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2);
-int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, int c);
-int EXPORT_FUNC(grub_strncasecmp) (const char *s1, const char *s2, int c);
+int EXPORT_FUNC(grub_strncmp) (const char *s1, const

Re: [Bulk] Re: Broken A20 gate handling (about GPL FSF copyright assignment)

2005-07-01 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ludovic Drolez wrote:
 Moreover, IMHO, it makes no sense trying to rewrite such low level
 functions, since there are not hundreds ways of writing it !

There are at least 2 ways :
1) copy-paste code
2) read specs, implement them - following the directions FSF paper gives.

The result might be the same code, but the way to get it matters too.

Vincent Pelletier

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCxYDKFEQoKRQyjtURAp88AJ0QJz0OxVUvPDuG7EbhFbPbnzlvpgCaA8Nx
yUepxKehU3lUW8IV1g+LSMM=
=iAdr
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


Re: [Bulk] Re: [PATCH] grub2: commands/cmp.c: grub_cmd_cmp()

2005-06-30 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Marco Gerards wrote:
 I think BUFFER_SIZE would be a better name.  Another size can be
 used.  Perhaps it is better to use a bigger buffer size?

As we read from a block device, I think the best size would be a
multiple of the block size... But yes, it could be named buffer size.
And it could even be dynamicaly allocated, to prevent using too much
space on stack.

 Huh?

Some remains from a change-and-undo... I'll send a new patch with a
correct changelog :).

Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCw8j8FEQoKRQyjtURApAVAKCUiOSXjhRmv5Sy/Hkct/9rqZjapwCeNZws
iYms73xiAlh3TMEgfIoctA4=
=+ko/
-END PGP SIGNATURE-





___ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



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


[PATCH] grub2: commands/cmp.c: grub_cmd_cmp()

2005-06-29 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Vincent Pelletier wrote:
 nb: I haven't tested these changes beyond make, but I think they are
 trivial enough to be trusted...

My baaad...
There were 2 bugs left :
- -If the file size isn't a multiple of 512 bytes, we would read
non-initialised or non-updated memory (so it only affects results on
files whom size is  512)
- -The files are identical. is displayed when file size differ (was
corrected in Wanderley's version)

Reminds me Hagakure :
Matters of small concern should be considered seriously.

I'm not sure if it is right to add a macro definition for block size,
and wether the name is good.

2005-06-29  Vincent Pelletier  [EMAIL PROTECTED]

* commands/cmp.c
  (grub_cmd_cmp): Close the right file at the right time.  Compare
  only data just read.  Don't report files of different size as
  identical.  (BLOCK_SIZE): New macro.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCwsVfFEQoKRQyjtURApNOAKC4bO41ca3vX/m64aIy4hIvjIwW1QCgmbyg
AIn3yvP072FMa0LlDFo1CYM=
=o8fq
-END PGP SIGNATURE-
Index: commands/cmp.c
===
RCS file: /cvsroot/grub/grub2/commands/cmp.c,v
retrieving revision 1.2
diff -u -p -r1.2 cmp.c
--- commands/cmp.c  4 Apr 2004 13:46:00 -   1.2
+++ commands/cmp.c  29 Jun 2005 15:47:36 -
@@ -24,6 +24,8 @@
 #include grub/misc.h
 #include grub/file.h
 
+#define BLOCK_SIZE 512
+
 static grub_err_t
 grub_cmd_cmp (struct grub_arg_list *state __attribute__ ((unused)),
  int argc, char **args)
@@ -44,54 +46,53 @@ grub_cmd_cmp (struct grub_arg_list *stat
   file2 = grub_file_open (args[1]);
   if (! file2)
 {
-  grub_file_close (file2);
+  grub_file_close (file1);
   return grub_errno;
 }
 
   if (grub_file_size (file1) != grub_file_size (file2))
-grub_printf (Differ in size: %d [%s], %d [%s]\n, 
-grub_file_size (file1), args[0], 
-grub_file_size (file2), args[1]);
+{
+  grub_printf (Differ in size: %d [%s], %d [%s]\n, 
+  grub_file_size (file1), args[0], 
+  grub_file_size (file2), args[1]);
+}
   
   else
 {
-  char buf1[512];
-  char buf2[512];
+  char buf1[BLOCK_SIZE];
+  char buf2[BLOCK_SIZE];
   grub_ssize_t rd1, rd2;
   grub_uint32_t pos = 0;
  
   do
{
  int i;
- rd1 = grub_file_read (file1, buf1, 512);
- rd2 = grub_file_read (file2, buf2, 512);
+ rd1 = grub_file_read (file1, buf1, BLOCK_SIZE);
+ rd2 = grub_file_read (file2, buf2, BLOCK_SIZE);
 
  if (rd1 != rd2)
-   return 0;
+   goto cleanup;
 
- for (i = 0; i  512; i++)
+ for (i = 0; i  rd1; i++)
{
  if (buf1[i] != buf2[i])
{
  grub_printf (Differ at the offset %d: 0x%x [%s], 0x%x 
[%s]\n,
   i + pos, buf1[i], args[0],
   buf2[i], args[1]);
-
- grub_file_close (file1);
- grub_file_close (file2);
- return 0;
+ goto cleanup;
}
}
- pos += 512;
+ pos += BLOCK_SIZE;
  
} while (rd2);
+  grub_printf (The files are identical.\n);
 }
 
+cleanup:
   grub_file_close (file1);
   grub_file_close (file2);
 
-  grub_printf (The files are identical.\n);
-
   return 0;
 }
 
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


rmll - grub2 presentation

2005-06-27 Thread Vincent Guffens

hi,

I saw on the wiki that a presentation about grub2 is schedulled during 
the RMLL.


Do you have more info about that such as when and where ? From here, 
Dijon is on the way to hollidays so I might possibly go there, and it 
would be great to meet people involved in grub devel.


Thanks,


--
Vincent Guffens
PhD Student UCL/CESAME
tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
Don't bother us with politics, respond those who don't want to learn.
-- Richard M. Stallman


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


Re: free magic is broken

2005-06-23 Thread Vincent Guffens

Yoshinori K. Okuji wrote:

On Wednesday 22 June 2005 23:13, Vincent Guffens wrote:


I have prepared a small web page with some details as it is a little bit
long to explain here. See it there if you want more information:

http://www.auto.ucl.ac.be/~guffens/grub2_netboot/free_magic_broken.html



Thank you very much for your analysis! I finally understood what's wrong, and 
checked in a fix (a bit different from yours). I guess it was very hard to 
find how to reproduce this bug.


Okuji


yes, it was good fun (and a long night)! I managed to post a wrong test 
version yesterday. In the test program, this is not


grub_malloc(base-first-size*(16-1));

but

grub_malloc(base-first-size*16-16);

Although it turns out to be equivalent as far as the bug is concerned, 
in this particular example.


It is good to have that nasty one behind !



--
Vincent Guffens
PhD Student UCL/CESAME
tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
Don't bother us with politics, respond those who don't want to learn.
-- Richard M. Stallman


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


free magic is broken

2005-06-22 Thread Vincent Guffens
Hi,

I have made a small test program that uses the memory management of grub2 to
manage an allocated buffer and I can reproduce the free magic is broken
problem  with it.

I have prepared a small web page with some details as it is a little bit long
to explain here. See it there if you want more information:

http://www.auto.ucl.ac.be/~guffens/grub2_netboot/free_magic_broken.html

I propose the following patch to fix this problem. This patch will modify the
mm code of grub2 only when the problem would occur in subsequent call to
grub_free:

diff -ru grub2/kern/mm.c grub2_free_magic_broken/kern/mm.c
--- grub2/kern/mm.c 2005-01-20 18:25:39.0 +0100
+++ grub2_free_magic_broken/kern/mm.c   2005-06-22 22:59:58.660577232 +0200
@@ -298,6 +298,10 @@
  p-next-magic = 0;
  p-size += p-next-size;
  p-next = p-next-next;
+ if (q-magic != GRUB_MM_FREE_MAGIC) {
+   r-first = p;
+   return;
+ }
}

   if (q + q-size == p)








--
 Vincent Guffens
 UCL/CESAME  +32 10 47 80 30 
 Euler Building A017



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


network support : memory management problem

2005-05-31 Thread Vincent Guffens

Hi,

I sent a similar e-mail yesterday but I think it didn't get through.

I have a working version of the netboot support in grub2. I can issue 
commands like (seeking in file is not yet possible):


cat (nd0)test.txt
linux (nd0)linux24

but depending on where in the code I free my data blocks, I sometimes 
get a  free magic is broken fatal error msg from grub_free().


I found out that if I use the grub_printf() function just before the 
call to grub_free(), the problem disappears.


That is to say that in my grub_net_close function (the close file 
function associated with the net binding file system), I do something like:


struct grub_netfs_data * priv =  (struct grub_netfs_data *) file-data;
struct grub_netfs_block *pp, * p = priv-head;

grub_printf(FREEING\n);

if (p)
  pp = p-next;

  while (p) {
if ((p-data)){
  grub_free(p-data);
}


If I remove the FREEING msg, I have the panic error message, otherwise, 
everything looks fine. The exact error message is


free magic is broken at 0x85900: 0x0

Does someone has an idea ? Is there some documentation available about 
the mm in grub2 ?


The full code is available on this web page:
http://www.auto.ucl.ac.be/~guffens/grub2_netboot/index.html


--
Vincent Guffens
PhD Student UCL/CESAME
tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
Don't bother us with politics, respond those who don't want to learn.
-- Richard M. Stallman


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


Re: compiling with 2.95

2005-03-11 Thread Vincent Guffens
[...]
so I have also replaced in gencmdlist.sh the following line:
#grep -v ^# | sed -ne /grub_register_command *( *\/{s/.*(
*\\([^\]*\)\.*/\1: $module/;p}
grep -v ^# | grep -e grub_register_command *( *\ | sed -ne
s/.*grub_register_command *( *\\([^,\]*\).*/\1: $module/;p

Oh, really? This is a very standard sed expression, I think. Ummh... What 
should I do?

It looks like the problem comes from the braces in the expression, if I 
try a simple one like this:

$ cat test | sed -e /grub_register/{s/register/test/;p}
sed: -e expression #1, char 35: Extra characters after command
So I split the expression in two parts. From my understanding of it, the 
following is equivalent to the original sed expression:

grep -v ^# | grep -e grub_register_command *( *\ | sed -ne s/.*( 
*\\([^\]*\)\.*/\1: $module/;p

which is not the same line than the one I sent in the previous mail 
(although they give the same command.lst)

--
Vincent Guffens
PhD Student UCL/CESAME
tel:   +32 10 47 80 30
Value your freedom, or you will lose it, teaches history.
Don't bother us with politics, respond those who don't want to learn.
-- Richard M. Stallman
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] dprintf implementation

2005-02-24 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Yoshinori K. Okuji wrote:
| Actually, strstr is not appropriate, because it does not consider word
| boundaries.
I think I'll write some function to find a word in a string... There is
an algorithm I would like to test.
| Strings are much better because of the flexibility.
I agree now that I exactly understand what you were talking about :).
I'm working on it.
Vincent Pelletier
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCHlhCFEQoKRQyjtURAhcoAJ9JSnbFh4jon7SNRbPMs52WcpR6lwCcD5qJ
zDVkYGnPV6kL0DJR/4bg9FQ=
=BTYg
-END PGP SIGNATURE-

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


[PATCH] dprintf implementation

2005-02-21 Thread Vincent Pelletier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello.
I haven't worked on grub2 for 2 weeks now, sorry.
Here is the dprintf function I worked on 2 weeks ago, which I fixed this
evening.
Vincent Pelletier
2005-02-21  Vincent Pelletier  [EMAIL PROTECTED]
* include/grub/misc.h (grub_dprintf): New macro.
(grub_real_dprintf): New prototype.
* kern/misc.c (grub_real_dprintf): New function.
Index: kern/misc.c
===
RCS file: /cvsroot/grub/grub2/kern/misc.c,v
retrieving revision 1.18
diff -u -p -r1.18 misc.c
- --- kern/misc.c   19 Feb 2005 20:56:07 -  1.18
+++ kern/misc.c 21 Feb 2005 20:38:38 -
@@ -128,6 +128,18 @@ grub_printf (const char *fmt, ...)
~   return ret;
~ }
+void
+grub_real_dprintf(const char *file, const int line, const char *title,
+  const char *fmt, ...)
+{
+  va_list args;
+
+  grub_printf (%s,%d (%s): , file, line, title);
+  va_start (args, fmt);
+  grub_vprintf (fmt, args);
+  va_end (args);
+}
+
~ int
~ grub_vprintf (const char *fmt, va_list args)
~ {
Index: include/grub/misc.h
===
RCS file: /cvsroot/grub/grub2/include/grub/misc.h,v
retrieving revision 1.12
diff -u -p -r1.12 misc.h
- --- include/grub/misc.h   29 Jan 2005 22:01:53 -  1.12
+++ include/grub/misc.h 21 Feb 2005 20:38:38 -
@@ -26,6 +26,7 @@
~ #include grub/symbol.h
~ #include grub/err.h
+#define grub_dprintf(title,fmt,args...)
grub_real_dprintf(__FILE__,__LINE__,title,fmt,args);
~ /* XXX: If grub_memmove is too slow, we must implement grub_memcpy.  */
~ #define grub_memcpy(d,s,n)grub_memmove ((d), (s), (n))
@@ -58,6 +59,10 @@ char *EXPORT_FUNC(grub_strndup) (const c
~ void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n);
~ grub_size_t EXPORT_FUNC(grub_strlen) (const char *s);
~ int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__
((format (printf, 1, 2)));
+void EXPORT_FUNC(grub_real_dprintf) (const char *file,
+ const int line,
+ const char *title,
+ const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
~ int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
~ int EXPORT_FUNC(grub_sprintf) (char *str, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
~ int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args);
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCGkzqFEQoKRQyjtURAokmAJ9Mirp8xseh2AwUJOl+tykvKm/lHgCeM07L
2pNw3UbeFYot+LOR4vDFWH4=
=+3BC
-END PGP SIGNATURE-

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