a FAQ that probably isn't that trivial to answer ...

2007-10-01 Thread Udo Rader
Hi,

for various reasons I decided to give grub2 a try and now I am caught in
the "my system doesn't boot" trap.

The problem is probably a bit more complex then it seems at first hand,
because my system doesn't even start into grub at all but "freezes"
somewhere between hard disk detection and starting up grub. Absolutely
no message is displayed after the POST is complete.

The only chance I can currently somewhat revive my system is by
unplugging the hard drive before powering up the system, inserting some
kind of boot CD (in my case a debian etch installation CD), plug in the
hard drive and then boot into rescue mode.

In rescue mode I see the the hard drive itself (and the data on it) is
completely OK and so after many hours of trying I am completely lost ...

Things were working absolutely OK before I tried to install grub2. Yet
now, reinstalling whatever bootloader does not bring my system back into
normal booting again. So far I have tried to reinstall grub legacy and
even lilo, but all without success.

grub-install/update-grub gives this:

--CUT--
% grub-install --recheck /dev/sda
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0)   /dev/sda
%
% update-grub
Searching for GRUB installation directory ... found: /boot/grub
Testing for an existing GRUB grub.cfg file ...
found: /boot/grub/grub.cfg
Searching for splash image ... found: /boot/grub/splash.xpm.gz
Found kernel: /vmlinuz-2.6.22-12-generic
Found kernel: /memtest86+.bin
Updating /boot/grub/grub.cfg ... done
--CUT--

The hints on http://grub.enbug.org/GettingStarted also did not bring me
anywhere, so any ideas are greatly appreciated ...

If my box hadn't worked without problems before, I would consider a
firmware issue, but I can hardly believe that to be the case ...

-- 
Udo Rader

bestsolution.at EDV Systemhaus GmbH
http://www.bestsolution.at


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] fix memory management on efika/pegasos

2007-10-01 Thread Marcin Kurek
Hell[o]

> [...]

I just checked cvs grub2 with this patch on older version of pegasos
firmware (1.2 - 20040810) and it seems to fail with out of memory
message.

Then it seems to fix problem for efika and for latest version of
pegasos firmware.

-- 
--- Marcin 'Morgoth' Kurek ---


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


Re: pxebooting with GRUB 2

2007-10-01 Thread Daniel Kahn Gillmor
On Sun 2007-09-30 12:07:38 -0400, Robert Millan wrote:

> WIP.  Check latest mails from Marco on the subject.  He sent patches
> implementing ethernet infrastructure and requested feedback.

Ah, thanks.  Are you referring to this, from two months ago?

 http://lists.gnu.org/archive/html/grub-devel/2007-08/msg00011.html

I couldn't find a more recent e-mail.  And though the message suggests
that the patchset will be in CVS within a week (i.e. mid-August), it
doesn't look merged to me.  i'm looking at CVS HEAD, though -- is
there another branch i should be trying?

I'm not sure what feedback i can give as i'm not a grub developer, and
there doesn't appear to be enough in the patch (e.g. no IPv4 support)
to make it something i can test as an end user.

Marco, can you give another status report on netbooting?

Thanks for the followup,

   --dkg


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


Re: [PATCH] Fixed ieee1275 console

2007-10-01 Thread Marcin Kurek
Hell[o]

> Is this a bitmask?  In this case, looks like you aren't using the right
> numbers.  Now GRUB_TERM_SIMPLE_MENU == GRUB_TERM_DUMB | GRUB_TERM_NO_EDIT
> OTOH if that's what you intended, I think it's better to build one macro
> using the others.

Eeeek, why ? The flags are checked using 'flags & ' as I can see
in kern/term.c, then how (1 << 3) can be evaluated as (1 << 1) and (1
<< 2) in this case ?

> This part doesn't look right.  vesa/vga is a whole different history.  At the
> least vesa *does* support unicode.

But both remaps border codes to cp437 and my code change only this
part, the unicode support is still there I does not touch it.

> Please try to avoid cosmetical changes.

Hmmm, I can not see this change in patch in files I have on my hd :/

> Have you verified that grub-emu still builds / works?

It does not build for ieee1275 on cvs because missing util/hostfs.c in
powerpc-ieee1275.rmk, but after adding it builds/runs fine.

> What is 127 normally?  For firmware bugs, we have a flag mechanism so that it
> only affects the buggy firmware.  Check my latest commit to
> kern/powerpc/ieee1275/cmain.c.

It's DEL key. I placed it here as I saw similar thing in
util/console.c and of coz I verified first that both keys (del &&
backspace) are working correctly on ODW && Efika.

-- 
--- Marcin 'Morgoth' Kurek ---


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


Re: [PATCH] Fixed ieee1275 console

2007-10-01 Thread Robert Millan
On Mon, Oct 01, 2007 at 08:14:16PM +0200, Marcin Kurek wrote:
> diff -urN grub2.org/include/grub/term.h grub2/include/grub/term.h
> --- grub2.org/include/grub/term.h 2007-07-22 01:32:22.0 +0200
> +++ grub2/include/grub/term.h 2007-10-01 19:20:49.734330521 +0200
> @@ -51,10 +51,13 @@
>  #define GRUB_TERM_NO_EDIT(1 << 1)
>  /* Set when the terminal cannot do fancy things.  */
>  #define GRUB_TERM_DUMB   (1 << 2)
> +/* Set to use ascii menu borders.  */
> +#define GRUB_TERM_SIMPLE_MENU(1 << 3) 
> +/* Set to use cp437 menu borders.  */
> +#define GRUB_TERM_CP437_MENU (1 << 4)
>  /* Set when the terminal needs to be initialized.  */
>  #define GRUB_TERM_NEED_INIT  (1 << 16)

Is this a bitmask?  In this case, looks like you aren't using the right
numbers.  Now GRUB_TERM_SIMPLE_MENU == GRUB_TERM_DUMB | GRUB_TERM_NO_EDIT
OTOH if that's what you intended, I think it's better to build one macro
using the others.

> diff -urN grub2.org/term/i386/pc/vesafb.c grub2/term/i386/pc/vesafb.c
> --- grub2.org/term/i386/pc/vesafb.c   2007-07-22 01:32:31.0 +0200
> +++ grub2/term/i386/pc/vesafb.c   2007-10-01 19:37:38.160330521 +0200
> @@ -214,45 +214,7 @@
>  unsigned *width)
>  {
>if (code > 0x7f)
> -{
> -  /* Map some unicode characters to the VGA font, if possible.  */
> -  switch (code)
> - {
> - case 0x2190:/* left arrow */
> -   code = 0x1b;
> -   break;
> - case 0x2191:/* up arrow */
> -   code = 0x18;
> -   break;
> - case 0x2192:/* right arrow */
> -   code = 0x1a;
> -   break;
> - case 0x2193:/* down arrow */
> -   code = 0x19;
> -   break;
> - case 0x2501:/* horizontal line */
> -   code = 0xc4;
> -   break;
> - case 0x2503:/* vertical line */
> -   code = 0xb3;
> -   break;
> - case 0x250F:/* upper-left corner */
> -   code = 0xda;
> -   break;
> - case 0x2513:/* upper-right corner */
> -   code = 0xbf;
> -   break;
> - case 0x2517:/* lower-left corner */
> -   code = 0xc0;
> -   break;
> - case 0x251B:/* lower-right corner */
> -   code = 0xd9;
> -   break;
> -
> - default:
> -   return grub_font_get_glyph (code, bitmap, width);
> - }
> -}
> +return grub_font_get_glyph (code, bitmap, width);
>  
>if (bitmap)
>  grub_memcpy (bitmap,
> @@ -601,7 +563,7 @@
>  .setcolorstate = grub_virtual_screen_setcolorstate,
>  .setcolor = grub_virtual_screen_setcolor,
>  .setcursor = grub_vesafb_setcursor,
> -.flags = 0,
> +.flags = GRUB_TERM_CP437_MENU,
>  .next = 0
>};
>  
> diff -urN grub2.org/term/i386/pc/vga.c grub2/term/i386/pc/vga.c
> --- grub2.org/term/i386/pc/vga.c  2007-07-22 01:32:31.0 +0200
> +++ grub2/term/i386/pc/vga.c  2007-10-01 19:38:10.883330521 +0200
> @@ -198,45 +198,7 @@
>  get_vga_glyph (grub_uint32_t code, unsigned char bitmap[32], unsigned *width)
>  {
>if (code > 0x7f)
> -{
> -  /* Map some unicode characters to the VGA font, if possible.  */
> -  switch (code)
> - {
> - case 0x2190:/* left arrow */
> -   code = 0x1b;
> -   break;
> - case 0x2191:/* up arrow */
> -   code = 0x18;
> -   break;
> - case 0x2192:/* right arrow */
> -   code = 0x1a;
> -   break;
> - case 0x2193:/* down arrow */
> -   code = 0x19;
> -   break;
> - case 0x2501:/* horizontal line */
> -   code = 0xc4;
> -   break;
> - case 0x2503:/* vertical line */
> -   code = 0xb3;
> -   break;
> - case 0x250F:/* upper-left corner */
> -   code = 0xda;
> -   break;
> - case 0x2513:/* upper-right corner */
> -   code = 0xbf;
> -   break;
> - case 0x2517:/* lower-left corner */
> -   code = 0xc0;
> -   break;
> - case 0x251B:/* lower-right corner */
> -   code = 0xd9;
> -   break;
> -
> - default:
> -   return grub_font_get_glyph (code, bitmap, width);
> - }
> -}
> +return grub_font_get_glyph (code, bitmap, width);

This part doesn't look right.  vesa/vga is a whole different history.  At the
least vesa *does* support unicode.

> diff -urN grub2.org/term/ieee1275/ofconsole.c grub2/term/ieee1275/ofconsole.c
> --- grub2.org/term/ieee1275/ofconsole.c   2007-07-22 11:05:11.0 
> +0200
> +++ grub2/term/ieee1275/ofconsole.c   2007-10-01 19:01:49.820330521 +0200
> @@ -75,6 +75,7 @@
>  grub_ofconsole_putchar (grub_uint32_t c)
>  {
>char chr = c;
> +  
>if (c == '\n')
>  {
>grub_curr_y++;
> @@ -86,6 +87,7 @@
>if (grub_curr_x > grub_ofconsole_width)
>   grub_putcode ('\n');
>  }
> +
>grub_ieee1275_write (stdout_ihandle, &chr, 1, 0);
>  }

Please try to avoid cosmetical changes.

> diff -urN grub2.org/util/console.c grub2/util/console.c
> --- grub2.org/util/console.c  2007-07-22 01:32:31.000

Re: [PATCH] fix memory management on efika/pegasos

2007-10-01 Thread Marcin Kurek
Hell[o]

> Finally, I think I got this right now.  My efika boots and all the other
> setups should be happy as well.  Please, review/test this and report.

Tested on ODW && Efika, works fine in both cases.

-- 
--- Marcin 'Morgoth' Kurek ---


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


Re: [PATCH] Fixed ieee1275 console

2007-10-01 Thread Marcin Kurek
Hell[o]

> [...]

OK, split fixes in to separate patches this time as requested.

01-grub2-simple_console.patch
==

This is a idea how to handle ascii&&cp473&&utf based menus for
diffrent consoles. I added a two term flags GRUB_TERM_SIMPLE_MENU
(ascii menu) and GRUB_TERM_CP437_MENU (cp437 menus) and handle borders
code remap in kern/term.c/grub_putcode() by using new function
remap_border()

For now GRUB_TERM_CP437_MENU is used in i386/pc/console.c, vesafb.c,
vga.c and GRUB_TERM_SIMPLE_MENU is used in i386/pc/serial.c and in
ieee1275/ofconsole.c

I think it would be wise to use ascii border codes for OF as there is
no easy way to check the terminal type (serial, screen) and encoding
(on my ODW normal console seems to use cp437, but framebuffer console
seems to be using something else) Anyway ascii menu looks quite nice
here.

02-grub2-ofconsole_cosmetic.patch
==

Two small things here. First make grub_ofconsole_writeesc() use single
grub_ieee1275_write() call and correct '- 1' in grub_ofconsole_getxy()
... hmmm maybe this should go in to [4]

03-grub2-ofconsole_backspace.patch
===

My OF seems to send 127 for backspace key this patch handle '127' as
backspace. Now I can use it normaly ;)

04-grub2-ofconsole_fix.patch


Fixed cursor x/y position tracking for ofconsole as currect version
definitly doesn't not work as expect to. I am not sure only about
grub_curr_y -= 4; line as my OF scroll the console +4 lines when reach
last line, but is '4' correct for other OF implementations ?

-- 
--- Marcin 'Morgoth' Kurek ---
diff -urN grub2.org/include/grub/term.h grub2/include/grub/term.h
--- grub2.org/include/grub/term.h	2007-07-22 01:32:22.0 +0200
+++ grub2/include/grub/term.h	2007-10-01 19:20:49.734330521 +0200
@@ -51,10 +51,13 @@
 #define GRUB_TERM_NO_EDIT	(1 << 1)
 /* Set when the terminal cannot do fancy things.  */
 #define GRUB_TERM_DUMB		(1 << 2)
+/* Set to use ascii menu borders.  */
+#define GRUB_TERM_SIMPLE_MENU	(1 << 3) 
+/* Set to use cp437 menu borders.  */
+#define GRUB_TERM_CP437_MENU	(1 << 4)
 /* Set when the terminal needs to be initialized.  */
 #define GRUB_TERM_NEED_INIT	(1 << 16)
 
-
 /* Unicode characters for fancy graphics.  */
 #define GRUB_TERM_DISP_LEFT	0x2190
 #define GRUB_TERM_DISP_UP	0x2191
diff -urN grub2.org/kern/term.c grub2/kern/term.c
--- grub2.org/kern/term.c	2007-07-22 01:32:26.0 +0200
+++ grub2/kern/term.c	2007-10-01 19:27:23.367330521 +0200
@@ -90,6 +90,94 @@
   return grub_cur_term;
 }
 
+static
+grub_uint32_t remap_border(grub_uint32_t code)
+{
+  if (grub_cur_term->flags & GRUB_TERM_SIMPLE_MENU)
+{
+  switch (code)
+{
+case GRUB_TERM_DISP_LEFT:
+  code = '<';
+  break;
+
+case GRUB_TERM_DISP_UP:
+  code = '^';
+  break;
+
+case GRUB_TERM_DISP_RIGHT:
+  code = '>';
+  break;
+
+case GRUB_TERM_DISP_DOWN:
+  code = 'v';
+  break;
+
+case GRUB_TERM_DISP_HLINE:
+  code = '-';
+  break;
+
+case GRUB_TERM_DISP_VLINE:
+  code = '|';
+  break;
+
+case GRUB_TERM_DISP_UL:
+case GRUB_TERM_DISP_UR:
+case GRUB_TERM_DISP_LL:
+case GRUB_TERM_DISP_LR:
+  code = '+';
+  break;
+}
+}
+  else if(grub_cur_term->flags & GRUB_TERM_CP437_MENU)
+{
+  switch (code)
+{
+case GRUB_TERM_DISP_LEFT:
+  code = 0x1b;
+  break;
+
+case GRUB_TERM_DISP_UP:
+  code = 0x18;
+  break;
+
+case GRUB_TERM_DISP_RIGHT:
+  code = 0x1a;
+  break;
+
+case GRUB_TERM_DISP_DOWN:
+  code = 0x19;
+  break;
+
+case GRUB_TERM_DISP_HLINE:
+  code = 0xc4;
+  break;
+
+case GRUB_TERM_DISP_VLINE:
+  code = 0xb3;
+  break;
+
+case GRUB_TERM_DISP_UL:
+  code = 0xda;
+  break;
+
+case GRUB_TERM_DISP_UR:
+  code = 0xbf;
+  break;
+
+case GRUB_TERM_DISP_LL:
+  code = 0xc0;
+  break;
+
+case GRUB_TERM_DISP_LR:
+  code = 0xd9;
+  break;
+}
+}
+
+  return code;
+}
+
 /* Put a Unicode character.  */
 void
 grub_putcode (grub_uint32_t code)
@@ -106,7 +194,9 @@
 
   return;
 }
-  
+
+  code = remap_border (code);
+
   (grub_cur_term->putchar) (code);
   
   if (code == '\n')
diff -urN grub2.org/term/i386/pc/console.c grub2/term/i386/pc/console.c
--- grub2.org/term/i386/pc/console.c	2007-07-22 01:32:30.0 +0200
+++ grub2/term/i386/pc/console.c	2007-10-01 19:30:35.966330521 +0200
@@ -25,58 +25,13 @@
 static grub_uint8_t grub_console_no

Re: Grub and GPT support

2007-10-01 Thread Robert Millan
On Mon, Oct 01, 2007 at 05:34:38PM +0200, Jeffrey Lensen wrote:
> Hello all,
> 
> I was wondering if someone could provide me with some information about
> GPT support in Grub. I realize this isn't implemented yet, and that
> there is a patch out there that's supposed to fix this isssue, but I'm
> curious to find out if there is any progress in building support for GPT
> in Grub.

GPT is indeed implemented, but only in GRUB 2.

-- 
Robert Millan

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


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


Grub and GPT support

2007-10-01 Thread Jeffrey Lensen
Hello all,

I was wondering if someone could provide me with some information about
GPT support in Grub. I realize this isn't implemented yet, and that
there is a patch out there that's supposed to fix this isssue, but I'm
curious to find out if there is any progress in building support for GPT
in Grub.

We currently have about 50 servers in our collocation with 4.4TB
diskspace. I managed to create a LVM partition of 4.3TB and a boot and
root partition using Parted, but since the disk label is set to GPT, I
can't install Grub on the device.

If anyone has any tips on how to get Grub on these devices, that would
be very much appreciated, especially since we have another batch of
these type of servers coming up soon...

Thanks.

-- 
Jeffrey Lensen
System Administrator Hyves
hyves page: http://skyler.hyves.nl
mail/msn:   [EMAIL PROTECTED]



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


Re: [PATCH] generic ELF version of grub-mkimage

2007-10-01 Thread Robert Millan

Hi!

On Thu, Aug 30, 2007 at 12:03:47PM +0200, Patrick Georgi wrote:
> Hi,
> 
> the attached patch makes powerpc-ieee1275's grub-mkimage work with 
> little endian ELF images, too.
> I did this, as I need basically the same functionality for 
> i386-linuxbios, just with little endian ELFs. I first copied and changed 
> the file for my needs, but it might be more generally useful (other 
> architectures), and having to maintain two very similar files seems like 
> a waste of time to me - hence the merged version.
> I also moved the file to util/elf, to denote that it's a generic ELF 
> mangler now and adapted the powerpc makefile.

I think the endianess checks are overkill.  AFAICT grub-mkimage isn't really
meant for non-native use (as exemplified by the fact that it's not called
grub-mkelfimage vs grub-mkaoutimage).

I propose the following:

2007-10-01  Robert Millan  <[EMAIL PROTECTED]>

* conf/powerpc-ieee1275.rmk (grub_mkimage_SOURCES): Replace reference
to util/powerpc/ieee1275/grub-mkimage.c with util/elf/grub-mkimage.c.

* include/grub/powerpc/ieee1275/kernel.h: Rename
GRUB_IEEE1275_MOD_ALIGN to GRUB_MOD_ALIGN.
* kern/powerpc/ieee1275/init.c: Replace GRUB_IEEE1275_MOD_ALIGN with
GRUB_MOD_ALIGN.
* util/elf/grub-mkimage.c: Replace GRUB_IEEE1275_MOD_ALIGN with
GRUB_MOD_ALIGN.  Remove all use of endian conversion macros, since
they break LE platforms and grub-mkimage is only meant for native
use anyway.

2007-10-01  Robert Millan  <[EMAIL PROTECTED]>

* util/powerpc/ieee1275/grub-mkimage.c: Moved to ...
* util/elf/grub-mkimage.c: ... here.

The attached patch has been tested on Qemu/LinuxBIOS and on my Efika
(powerpc).

-- 
Robert Millan

 I know my rights; I want my phone call!
 What use is a phone call, if you are unable to speak?
(as seen on /.)
2007-10-01  Robert Millan  <[EMAIL PROTECTED]>

	* conf/powerpc-ieee1275.rmk (grub_mkimage_SOURCES): Replace reference
	to util/powerpc/ieee1275/grub-mkimage.c with util/elf/grub-mkimage.c.

	* include/grub/powerpc/ieee1275/kernel.h: Rename
	GRUB_IEEE1275_MOD_ALIGN to GRUB_MOD_ALIGN.
	* kern/powerpc/ieee1275/init.c: Replace GRUB_IEEE1275_MOD_ALIGN with
	GRUB_MOD_ALIGN.
	* util/elf/grub-mkimage.c: Replace GRUB_IEEE1275_MOD_ALIGN with
	GRUB_MOD_ALIGN.  Remove all use of endian conversion macros, since
	they break LE platforms and grub-mkimage is only meant for native
	use anyway.

2007-10-01  Robert Millan  <[EMAIL PROTECTED]>

	* util/powerpc/ieee1275/grub-mkimage.c: Moved to ...
	* util/elf/grub-mkimage.c: ... here.

Index: conf/powerpc-ieee1275.rmk
===
RCS file: /sources/grub/grub2/conf/powerpc-ieee1275.rmk,v
retrieving revision 1.71
diff -u -r1.71 powerpc-ieee1275.rmk
--- conf/powerpc-ieee1275.rmk	29 Aug 2007 10:39:42 -	1.71
+++ conf/powerpc-ieee1275.rmk	1 Oct 2007 14:38:31 -
@@ -32,7 +32,7 @@
 endif
  
 # For grub-mkimage.
-grub_mkimage_SOURCES = util/powerpc/ieee1275/grub-mkimage.c util/misc.c \
+grub_mkimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \
 util/resolve.c 
 
 # For grub-mkdevicemap.
Index: include/grub/powerpc/ieee1275/kernel.h
===
RCS file: /sources/grub/grub2/include/grub/powerpc/ieee1275/kernel.h,v
retrieving revision 1.6
diff -u -r1.6 kernel.h
--- include/grub/powerpc/ieee1275/kernel.h	21 Jul 2007 23:32:24 -	1.6
+++ include/grub/powerpc/ieee1275/kernel.h	1 Oct 2007 14:38:31 -
@@ -21,7 +21,7 @@
 
 #include 
 
-#define GRUB_IEEE1275_MOD_ALIGN 0x1000
+#define GRUB_MOD_ALIGN 0x1000
 
 void EXPORT_FUNC (grub_reboot) (void);
 void EXPORT_FUNC (grub_halt) (void);
Index: kern/powerpc/ieee1275/init.c
===
RCS file: /sources/grub/grub2/kern/powerpc/ieee1275/init.c,v
retrieving revision 1.31
diff -u -r1.31 init.c
--- kern/powerpc/ieee1275/init.c	21 Jul 2007 23:32:27 -	1.31
+++ kern/powerpc/ieee1275/init.c	1 Oct 2007 14:38:31 -
@@ -205,5 +205,5 @@
 grub_addr_t
 grub_arch_modules_addr (void)
 {
-  return ALIGN_UP(_end, GRUB_IEEE1275_MOD_ALIGN);
+  return ALIGN_UP(_end, GRUB_MOD_ALIGN);
 }
Index: util/powerpc/ieee1275/grub-mkimage.c
===
RCS file: /sources/grub/grub2/util/powerpc/ieee1275/grub-mkimage.c,v
retrieving revision 1.9
diff -u -r1.9 grub-mkimage.c
--- util/powerpc/ieee1275/grub-mkimage.c	21 Jul 2007 23:32:32 -	1.9
+++ util/powerpc/ieee1275/grub-mkimage.c	1 Oct 2007 14:38:31 -
@@ -70,28 +70,27 @@
 
   grub_util_info ("adding CHRP NOTE segment");
 
-  note.header.namesz = grub_cpu_to_be32 (sizeof (GRUB_IEEE1275_NOTE_NAME));
-  note.header.descsz = grub_cpu_to_be32 (note_size);
-  note.header.type = grub_cpu_to_be32 (GRUB_IEEE1275_NOTE_TYPE);
+  note.header.namesz = sizeof (GRUB_IEEE1275_NOTE_NAME);
+  note.header.descsz = note_size;
+  note.header.type = GR

Re: [PATCH] Fixed ieee1275 console

2007-10-01 Thread Robert Millan
On Mon, Oct 01, 2007 at 12:57:35PM +0200, Marcin Kurek wrote:
> Hell[o]
> 
> Finaly I found a few free minutes to look at ofconsole as it never
> correctly work for me. There was 3 problems on my Pegasos:
> 
> 1) Backspace key not works with USB keyboard.
> 2) menu looks ugly like hell as it contains some random characters in
> place of borders.
> 3) Console works wrong (the cursor position was wrong after some
> commands eg. ls and it displays only a black hole when grub prints
> more than one screen of text)

Now that I look at it, it seems you attached 3 patches but they're not
addressed at each of the problems you describe.  Could you split up the
console patch in 3 for each of the problems, and start a separate thread
for the others?

Also, please include ChangeLog entries with your patches.

-- 
Robert Millan

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


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


Re: [PATCH] Fixed ieee1275 console

2007-10-01 Thread Robert Millan
On Mon, Oct 01, 2007 at 12:57:35PM +0200, Marcin Kurek wrote:
> 2) menu looks ugly like hell as it contains some random characters in
> place of borders.

I have a few concerns about this part:

>  static void
>  grub_ofconsole_putchar (grub_uint32_t c)
>  {
> -  char chr = c;
> -  if (c == '\n')
> -{
> +  char chr;
> +
> +  switch (c)
> +  {
> +case GRUB_TERM_DISP_LEFT:
> +  c = '<';
> +  break;
> +case GRUB_TERM_DISP_UP:
> +  c = '^';
> +  break;
> +case GRUB_TERM_DISP_RIGHT:
> +  c = '>';
> +  break;
> +case GRUB_TERM_DISP_DOWN:
> +  c = 'v';
> +  break;
> +case GRUB_TERM_DISP_HLINE:
> +  c = '-';
> +  break;
> +case GRUB_TERM_DISP_VLINE:
> +  c = '|';
> +  break;
> +case GRUB_TERM_DISP_UL:
> +case GRUB_TERM_DISP_UR:
> +case GRUB_TERM_DISP_LL:
> +case GRUB_TERM_DISP_LR:
> +  c = '+';
> +  break;
> +case '\t':
> +  c = ' ';
> +  break;
> +
> +default:
> +  /* of does not support Unicode.  */
> +  if (c > 0x7f)
> +c = '?';
> +  break;
> +  }

1- First, you're duplicating code from term/i386/pc/serial.c.  I think it should
   be shared.

2- Do we _always_ want to map to ascii?  Of course, mapping to ascii is the best
   choice when we don't have anything better, but if we can distinguish physical
   screen (cp437 charset, on PCs and on efika as well) from serial cable (must
   be ascii?), we could still draw pretty lines instead of -|+ stuff.

3- The cp437 charset in efika is buggy (I don't know about pegasos), as some
   chars are replaced with portions of the bplan logo (sigh).  I gave it a try
   before, and the only sane way to draw a pretty rectangle seems to
   be:

   (warning, utf-8 follows.  if you can't read this get a decent MUA ;-))

   ╒═╕
   │ │
   ╘═╛

I had this pending patch liing around.  I never got the time to sort out all
these problems, but perhaps you can obtain something useful from it.

-- 
Robert Millan

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

  Tested on Efika *only*

  Get rid of the FIXME

diff -ur -x i386-pc.mk -x powerpc-ieee1275.mk grub2.old/conf/i386-pc.rmk grub2/conf/i386-pc.rmk
--- grub2.old/conf/i386-pc.rmk	2007-06-23 16:40:12.0 +0200
+++ grub2/conf/i386-pc.rmk	2007-07-10 21:32:52.0 +0200
@@ -28,7 +28,7 @@
 	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/parser.c kern/partition.c \
 	kern/env.c disk/i386/pc/biosdisk.c \
-	term/i386/pc/console.c \
+	term/i386/pc/console.c term/cp437.c \
 	symlist.c
 kernel_img_HEADERS = arg.h boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
 	env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
diff -ur -x i386-pc.mk -x powerpc-ieee1275.mk grub2.old/conf/powerpc-ieee1275.rmk grub2/conf/powerpc-ieee1275.rmk
--- grub2.old/conf/powerpc-ieee1275.rmk	2007-07-10 20:40:07.0 +0200
+++ grub2/conf/powerpc-ieee1275.rmk	2007-07-10 21:33:19.0 +0200
@@ -80,7 +80,8 @@
 	kern/ieee1275/ieee1275.c kern/main.c kern/device.c 		\
 	kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c 		\
 	kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c 	\
-	kern/powerpc/ieee1275/init.c term/ieee1275/ofconsole.c 		\
+	kern/powerpc/ieee1275/init.c term/ieee1275/ofconsole.c		\
+	term/cp437.c 			\
 	kern/powerpc/ieee1275/openfw.c disk/ieee1275/ofdisk.c 		\
 	kern/parser.c kern/partition.c kern/env.c kern/powerpc/dl.c 	\
 	kernel_elf_symlist.c kern/powerpc/cache.S
diff -ur -x i386-pc.mk -x powerpc-ieee1275.mk grub2.old/include/grub/ieee1275/ieee1275.h grub2/include/grub/ieee1275/ieee1275.h
--- grub2.old/include/grub/ieee1275/ieee1275.h	2007-07-09 17:12:15.0 +0200
+++ grub2/include/grub/ieee1275/ieee1275.h	2007-07-10 23:29:37.0 +0200
@@ -83,6 +83,14 @@
 
   /* CodeGen firmware does not correctly implement "output-device output" */
   GRUB_IEEE1275_FLAG_BROKEN_OUTPUT,
+
+  /* On CodeGen firmware (maybe others?), extended chars are assumed to be
+ cp437-encoded */
+  GRUB_IEEE1275_FLAG_CP437_DISPLAY,
+
+  /* On CodeGen firmware, cp437 characters 0xc0 to 0xcb are reserved for the
+ bplan logo */
+  GRUB_IEEE1275_FLAG_BPLAN_LOGO,
 };
 
 extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);
diff -ur -x i386-pc.mk -x powerpc-ieee1275.mk grub2.old/include/grub/term.h grub2/include/grub/term.h
--- grub2.old/include/grub/term.h	2005-10-15 11:22:31.0 +0200
+++ grub2/include/grub/term.h	2007-07-10 23:31:02.0 +0200
@@ -202,6 +202,7 @@
 int EXPORT_FUNC(grub_getcursor) (void);
 void EXPORT_FUNC(grub_refresh) (void);
 void EXPORT_FUNC(grub_set_more) (int onoff);
+grub_uint32_t EXPORT_FUNC(grub_utf8_to_cp437) (grub_uint32_t c);
 
 /* For convenience.  */
 #define GRUB_TERM_ASCII_CHAR(c)	((c) & 0xff)
diff -ur -x i386-pc.mk -x powerpc-ieee1275.mk grub2.old/kern/powerpc/ieee1275/cmain.c grub2/kern/

[PATCH] Fixed ieee1275 console

2007-10-01 Thread Marcin Kurek
Hell[o]

Finaly I found a few free minutes to look at ofconsole as it never
correctly work for me. There was 3 problems on my Pegasos:

1) Backspace key not works with USB keyboard.
2) menu looks ugly like hell as it contains some random characters in
place of borders.
3) Console works wrong (the cursor position was wrong after some
commands eg. ls and it displays only a black hole when grub prints
more than one screen of text)

I am not sure how correct my fix is for non Efika/ODW machines, but I
tested it on both without any problems.

In grub_ofconsole_writeesc() I think it would be good idea to use
single "write" command, but this is a cosmetics only I guess. Also in
grub_ofconsole_getxy() the -1 for grub_curr_x seems to be wrong for
me.

Replaced borders characters in grub_ofconsole_putchar() by '-', '|',
etc. Maybe not perfect, but looks definitly better than before [2].
Also fixed cursor position tracking (grub_curr_x, grub_curr_y) which
fix both console problems [3]

Handle 127 keycode as backspace key in grub_ofconsole_readkey() which fix [1]

BTW Also attach my previous patches with [PATCH] in topic this time.

-- 
--- Marcin 'Morgoth' Kurek ---
diff -urN grub2.org/fs/affs.c grub2/fs/affs.c
--- grub2.org/fs/affs.c	2007-08-02 20:40:36.0 +0200
+++ grub2/fs/affs.c	2007-09-15 10:23:35.550133111 +0200
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* The affs bootblock.  */
 struct grub_affs_bblock
@@ -97,6 +98,9 @@
   struct grub_fshelp_node diropen;
   grub_disk_t disk;
 
+  /* Size in sectors */
+  grub_uint64_t len;
+
   /* Blocksize in sectors.  */
   int blocksize;
 
@@ -170,10 +174,17 @@
   int checksumr = 0;
   int blocksize = 0;
 
+
   data = grub_malloc (sizeof (struct grub_affs_data));
   if (!data)
 return 0;
 
+  /* total_sectors are not valid on ieee1275 */
+  if(disk->partition)
+data->len = grub_partition_get_len (disk->partition);
+  else
+data->len = disk->total_sectors;
+
   /* Read the bootblock.  */
   grub_disk_read (disk, 0, 0, sizeof (struct grub_affs_bblock),
 		  (char *) &data->bblock);
@@ -194,12 +205,6 @@
   goto fail;
 }
 
-  /* Read the bootblock.  */
-  grub_disk_read (disk, 0, 0, sizeof (struct grub_affs_bblock),
-		  (char *) &data->bblock);
-  if (grub_errno)
-goto fail;
-
   /* No sane person uses more than 8KB for a block.  At least I hope
  for that person because in that case this won't work.  */
   rootblock = grub_malloc (GRUB_DISK_SECTOR_SIZE * 16);
@@ -209,7 +214,7 @@
   rblock = (struct grub_affs_rblock *) rootblock;
 
   /* Read the rootblock.  */
-  grub_disk_read (disk, (disk->total_sectors >> 1) + blocksize, 0,
+  grub_disk_read (disk, (data->len >> 1) + blocksize, 0,
 		  GRUB_DISK_SECTOR_SIZE * 16, (char *) rootblock);
   if (grub_errno)
 goto fail;
@@ -241,7 +246,7 @@
   data->disk = disk;
   data->htsize = grub_be_to_cpu32 (rblock->htsize);
   data->diropen.data = data;
-  data->diropen.block = (disk->total_sectors >> 1);
+  data->diropen.block = (data->len >> 1);
 
   grub_free (rootblock);
 
@@ -522,7 +527,7 @@
 {
   /* The rootblock maps quite well on a file header block, it's
 	 something we can use here.  */
-  grub_disk_read (data->disk, disk->total_sectors >> 1,
+  grub_disk_read (data->disk, data->len >> 1,
 		  data->blocksize * (GRUB_DISK_SECTOR_SIZE
 	 - GRUB_AFFS_FILE_LOCATION),
 		  sizeof (file), (char *) &file);
diff -urN grub2.org/conf/powerpc-ieee1275.mk grub2/conf/powerpc-ieee1275.mk
--- grub2.org/conf/powerpc-ieee1275.mk	2007-08-29 19:49:46.0 +0200
+++ grub2/conf/powerpc-ieee1275.mk	2007-09-15 02:40:33.144459267 +0200
@@ -235,14 +235,14 @@
 	normal/menu_entry.c normal/misc.c normal/script.c		\
 	partmap/amiga.c	partmap/apple.c partmap/pc.c partmap/sun.c	\
 	partmap/acorn.c			\
-	util/console.c util/grub-emu.c util/misc.c			\
+	util/console.c util/hostfs.c util/grub-emu.c util/misc.c			\
 	util/biosdisk.c util/getroot.c			\
 	util/powerpc/ieee1275/misc.c grub_script.tab.c grub_emu_init.c
-CLEANFILES += grub-emu grub_emu-commands_boot.o grub_emu-commands_cat.o grub_emu-commands_cmp.o grub_emu-commands_configfile.o grub_emu-commands_help.o grub_emu-commands_search.o grub_emu-commands_terminal.o grub_emu-commands_test.o grub_emu-commands_ls.o grub_emu-commands_blocklist.o grub_emu-commands_ieee1275_halt.o grub_emu-commands_ieee1275_reboot.o grub_emu-disk_loopback.o grub_emu-fs_affs.o grub_emu-fs_ext2.o grub_emu-fs_fat.o grub_emu-fs_fshelp.o grub_emu-fs_hfs.o grub_emu-fs_iso9660.o grub_emu-fs_jfs.o grub_emu-fs_minix.o grub_emu-fs_sfs.o grub_emu-fs_ufs.o grub_emu-fs_xfs.o grub_emu-fs_hfsplus.o grub_emu-fs_ntfs.o grub_emu-io_gzio.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_elf.o grub_emu-kern_env.o grub_emu-kern_err.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_loader.o grub_emu-kern_main.o grub_emu-kern_misc.o grub_emu-kern_parser.o grub_emu-kern_partition.o grub_emu-kern_rescue.o grub_emu-kern_te