Dell Media Direct button

2008-08-20 Thread Per Öberg
Hi

Some laptops, e.g., from Dell have a special button that they use to
boot a special embedded OS for media only instead of the ordinary OS.

For my Dell XPS1330M I can determine if the Media button was pressed by
first writing 0xf9 to port 0x70 and then testing bit 0x08 of port 0x71.

It would be really nice if such a test could be enabled in grub so that
grub can go directly to a specific menu alternative without showing the
gui if the media button was pressed.

Is this interesting? I'd like to contribute but I don't know where to start.

Regards Per Öberg

-- 
Per Öberg, Ph.D. Student
Address: Division of Vehicular Systems
Department of Electrical Engineering
Linköpings universitet
581 83 Linköping, SWEDEN
Phone: +46 (0)13-28 23 69
e-mail: [EMAIL PROTECTED]
PGP: http://www.fs.isy.liu.se/~oberg/0x61984A9D.asc

begin:vcard
fn;quoted-printable:Per =C3=96berg
n;quoted-printable:=C3=96berg;Per
org;quoted-printable:Link=C3=B6pings Universitet
adr;quoted-printable;quoted-printable:;;M=C3=A4ster Mattias v=C3=A4g;Link=C3=B6ping;;581 83;Sweden
email;internet:[EMAIL PROTECTED]
title:Doktorand (PhD Student)
tel;work:+46 (0)13 - 282369
tel;fax:+46 (0)13 - 282035
tel;home:+46 (0)13 - 212825
tel;cell:+46 (0)70 - 4857936
note:PGP Public Key: http://www.fs.isy.liu.se/~oberg/0x61984A9D.asc
x-mozilla-html:FALSE
url:http://www.fs.isy.liu.se/~oberg/
version:2.1
end:vcard

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


Re: [PATCH] Replace magic numbers by constants

2008-08-20 Thread Carles Pina i Estany

Hola,

On Aug/17/2008, Carles Pina i Estany wrote:


  When reading the subject I thought it was the other way around.  Would
  something like:
  
replace hardcoded numbers with macros
  
  or
  
macroify numbers
 
 Ok:
 
 
 2008-08-17  Carles Pina i Estany  [EMAIL PROTECTED]
 
 * menu/normal.c (run_menu): Replace hardcoded numbers with macros
   (16 for GRUB_TERM_UP and 14 for GRUB_TERM_DOWN)
 
 
  etc, make it more clear?
 
 An English note: In my previous mail I've confused change ... by 
 with change ... for :-)

any other change is needed? (patch or changelog) or patch is not needed
and then i will forget about it :-)

-- 
Carles Pina i EstanyGPG id: 0x17756391
http://pinux.info


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


Re: [PATCH] Replace magic numbers by constants

2008-08-20 Thread Robert Millan
On Sun, Aug 17, 2008 at 09:11:29PM +0200, Carles Pina i Estany wrote:
 Ok:
 
 
 2008-08-17  Carles Pina i Estany  [EMAIL PROTECTED]
 
 * menu/normal.c (run_menu): Replace hardcoded numbers with macros
   (16 for GRUB_TERM_UP and 14 for GRUB_TERM_DOWN)
 

Thanks, I checked this in.

Btw, were you going to add support for PageUp / PageDown as well? :-)

-- 
Robert Millan

  The DRM opt-in fallacy: Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all.


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


Re: Dell Media Direct button

2008-08-20 Thread Robert Millan
On Wed, Aug 20, 2008 at 10:57:22AM +0200, Per Öberg wrote:
 Hi
 
 Some laptops, e.g., from Dell have a special button that they use to
 boot a special embedded OS for media only instead of the ordinary OS.
 
 For my Dell XPS1330M I can determine if the Media button was pressed by
 first writing 0xf9 to port 0x70 and then testing bit 0x08 of port 0x71.
 
 It would be really nice if such a test could be enabled in grub so that
 grub can go directly to a specific menu alternative without showing the
 gui if the media button was pressed.
 
 Is this interesting? I'd like to contribute but I don't know where to start.

Sounds interesting, but this needs some thought on how to design it.

I suppose what you want is change the 'default' variable.  Perhaps increase
it by 1?  But then, where do you do this?  grub_machine_init is too early as
'default' hasn't been set yet.

Maybe we could have a global 'int default_offset' variable that is initialized
in grub_machine_init and later on used by normal.mod?

-- 
Robert Millan

  The DRM opt-in fallacy: Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all.


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


Re: [PATCH] Generic 32-bit Linux loader (for coreboot)

2008-08-20 Thread Robert Millan

If there are no objections, I'll commit this tomorrow.

-- 
Robert Millan

  The DRM opt-in fallacy: Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all.


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


Re: [PATCH] Replace magic numbers by constants

2008-08-20 Thread Carles Pina i Estany

Hi,

On Aug/20/2008, Robert Millan wrote:
 On Sun, Aug 17, 2008 at 09:11:29PM +0200, Carles Pina i Estany wrote:
  Ok:
  
  
  2008-08-17  Carles Pina i Estany  [EMAIL PROTECTED]
  
  * menu/normal.c (run_menu): Replace hardcoded numbers with macros
  (16 for GRUB_TERM_UP and 14 for GRUB_TERM_DOWN)
  
 
 Thanks, I checked this in.
 
 Btw, were you going to add support for PageUp / PageDown as well? :-)

Yes, that was my plan.

Today (probably) I will write a proposal of how would behave (how much
lines would scroll, which physical line number would be the new selected
-last one of the screen, first one-). When we agree (if we do :-) ) I
will write the patch (hopefully on weekend).

I will also start a new mailing thread.

-- 
Carles Pina i EstanyGPG id: 0x17756391
http://pinux.info


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


EFI report w/ linux 2.6.26.2

2008-08-20 Thread Isaac Dupree
I tested with both video=vesafb and video=efifb on a 
self-compiled Linux-2.6.26.2 with a config based on 
Ubuntu's, both with my own compile of GRUB SVN head and with 
Bean's grub2-efi compile that had mysteriously worked better 
for me in some ways.


linux /... video=...fb agp=off root=/dev/sda4 gpt
initrd /...
boot

+ loading the 50MB initrd worked fine (I have no idea why my 
self-compiled Linux .ko modules are 5x the size of Ubuntu's :-)
+ it booted fine, except the graphics and sound (I could 
tell because of listening to disk noises and pressing the 
power button on the login screen did a clean shutdown as 
normal for Ubuntu; maybe I should've checked ssh-ing)
- Linux failed at graphics both in console and X: Linux made 
a funny pattern on the screen that didn't change (though it 
was different the two times I tried booting through EFI).

- No sound when there probably should've been

maybe I'm still doing something wrong, I dunno :-) ... BIOS 
boot is still working great.  Although, I tried putting 
grub2-bios on a USB Flash drive's MBR[is that the right 
terminology? it is partitioned, not superfloppy], and when I 
tried booting from it on my MacBook, rEFIt told me that 
booting it failed and that it's probably because Apple's 
support for USB-boot is not very good.  So I don't think I 
got even as far as the point of discovering whether grub 
worked (it had mentioned an odd device.map(IIRC) to me when 
installing).


-Isaac


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


Re: EFI report w/ linux 2.6.26.2

2008-08-20 Thread Bean
On Wed, Aug 20, 2008 at 8:38 PM, Isaac Dupree
[EMAIL PROTECTED] wrote:
 I tested with both video=vesafb and video=efifb on a self-compiled
 Linux-2.6.26.2 with a config based on Ubuntu's, both with my own compile of
 GRUB SVN head and with Bean's grub2-efi compile that had mysteriously worked
 better for me in some ways.

 linux /... video=...fb agp=off root=/dev/sda4 gpt
 initrd /...
 boot

 + loading the 50MB initrd worked fine (I have no idea why my self-compiled
 Linux .ko modules are 5x the size of Ubuntu's :-)
 + it booted fine, except the graphics and sound (I could tell because of
 listening to disk noises and pressing the power button on the login screen
 did a clean shutdown as normal for Ubuntu; maybe I should've checked
 ssh-ing)
 - Linux failed at graphics both in console and X: Linux made a funny pattern
 on the screen that didn't change (though it was different the two times I
 tried booting through EFI).
 - No sound when there probably should've been

 maybe I'm still doing something wrong, I dunno :-) ... BIOS boot is still
 working great.  Although, I tried putting grub2-bios on a USB Flash drive's
 MBR[is that the right terminology? it is partitioned, not superfloppy], and
 when I tried booting from it on my MacBook, rEFIt told me that booting it
 failed and that it's probably because Apple's support for USB-boot is not
 very good.  So I don't think I got even as far as the point of discovering
 whether grub worked (it had mentioned an odd device.map(IIRC) to me when
 installing).

Hi,

Please take a look at the wiki page and see if you can make graphic
work by following the instructions:

http://grub.enbug.org/TestingOnMacbook

-- 
Bean


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


Re: Dell Media Direct button

2008-08-20 Thread Vesa Jääskeläinen
Robert Millan wrote:
 On Wed, Aug 20, 2008 at 10:57:22AM +0200, Per Öberg wrote:
 Hi

 Some laptops, e.g., from Dell have a special button that they use to
 boot a special embedded OS for media only instead of the ordinary OS.

 For my Dell XPS1330M I can determine if the Media button was pressed by
 first writing 0xf9 to port 0x70 and then testing bit 0x08 of port 0x71.

 It would be really nice if such a test could be enabled in grub so that
 grub can go directly to a specific menu alternative without showing the
 gui if the media button was pressed.

 Is this interesting? I'd like to contribute but I don't know where to start.
 
 Sounds interesting, but this needs some thought on how to design it.
 
 I suppose what you want is change the 'default' variable.  Perhaps increase
 it by 1?  But then, where do you do this?  grub_machine_init is too early as
 'default' hasn't been set yet.
 
 Maybe we could have a global 'int default_offset' variable that is initialized
 in grub_machine_init and later on used by normal.mod?

Nah... Do a module to query for it and if it is there then use scripting
to do alternative path within script. Much better and more convenient.
And you can use script to increment default variable if needed :)





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


Re: Dell Media Direct button

2008-08-20 Thread Colin D Bennett
On Wed, 20 Aug 2008 12:12:59 +0200
Robert Millan [EMAIL PROTECTED] wrote:

 On Wed, Aug 20, 2008 at 10:57:22AM +0200, Per Öberg wrote:
  Hi
  
  Some laptops, e.g., from Dell have a special button that they use to
  boot a special embedded OS for media only instead of the ordinary
  OS.
  
  For my Dell XPS1330M I can determine if the Media button was
  pressed by first writing 0xf9 to port 0x70 and then testing bit
  0x08 of port 0x71.
  
  It would be really nice if such a test could be enabled in grub so
  that grub can go directly to a specific menu alternative without
  showing the gui if the media button was pressed.
  
  Is this interesting? I'd like to contribute but I don't know where
  to start.
 
 Sounds interesting, but this needs some thought on how to design it.
 
 I suppose what you want is change the 'default' variable.  Perhaps
 increase it by 1?  But then, where do you do this?  grub_machine_init
 is too early as 'default' hasn't been set yet.
 
 Maybe we could have a global 'int default_offset' variable that is
 initialized in grub_machine_init and later on used by normal.mod?

If I pressed the Media Direct button, I would also want to have a
timeout of 0, since by pressing the Media Direct button instead of the
power button, I've already indicated which entry I want to boot, and
there is no need to show the menu -- unless, perhaps, we decided to
show a different media menu... so hopefully giving all the power to
the grub.cfg script would be enough to make all this possible.

Regards,
Colin


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


Re: Dell Media Direct button

2008-08-20 Thread Javier Martín
2008/8/20 Colin D Bennett [EMAIL PROTECTED]:
 On Wed, 20 Aug 2008 12:12:59 +0200
 Robert Millan [EMAIL PROTECTED] wrote:

 On Wed, Aug 20, 2008 at 10:57:22AM +0200, Per Öberg wrote:
  Hi
 
  Some laptops, e.g., from Dell have a special button that they use to
  boot a special embedded OS for media only instead of the ordinary
  OS.
 
  For my Dell XPS1330M I can determine if the Media button was
  pressed by first writing 0xf9 to port 0x70 and then testing bit
  0x08 of port 0x71.
 
  It would be really nice if such a test could be enabled in grub so
  that grub can go directly to a specific menu alternative without
  showing the gui if the media button was pressed.
 
  Is this interesting? I'd like to contribute but I don't know where
  to start.

 Sounds interesting, but this needs some thought on how to design it.

 I suppose what you want is change the 'default' variable.  Perhaps
 increase it by 1?  But then, where do you do this?  grub_machine_init
 is too early as 'default' hasn't been set yet.

 Maybe we could have a global 'int default_offset' variable that is
 initialized in grub_machine_init and later on used by normal.mod?

 If I pressed the Media Direct button, I would also want to have a
 timeout of 0, since by pressing the Media Direct button instead of the
 power button, I've already indicated which entry I want to boot, and
 there is no need to show the menu -- unless, perhaps, we decided to
 show a different media menu... so hopefully giving all the power to
 the grub.cfg script would be enough to make all this possible.

 Regards,
 Colin

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



Well, I own a XPS1330 myself (I'm writing from it now, as I'm taking a
week at the beach in Benidorm ^^). This functionality could be
implemented by a module that used the pre-menu hooks proposed by Bean:
it would check the status before the menu is shown, then act on the
result.

However, all this assumes that pressing that key creates no additional
side effect like the replacement of the MBR by the system firmware,
booting another MBR written in flash memory or something like that: I
thought the choice took place at the real MBR, but disassembling it
revealed that it does not use the mentioned I/O ports interface, so
most likely what the system firmware does is set the active flag in
the MediaDirect partition.

I'm ready to check any related patches on the actual hardware _once
I'm back in Madrid_ because here I have no recovery tools.

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


[PATCH] fix for a memleak in grub_ntfs_mount

2008-08-20 Thread Felix Zielcke
I have just run valgrind on grub-probe /
Attached is a patch to fix a memleak in grub_ntfs_mount, which is very
obvious if you look at the code.
Probable there's nothing wrong with it and I could just commit it, but
as always I want to be sure :)


I attached the full valgrind output too.
Though it's with grub-probe compiled with the ntfs fix so it doestn't
appear there.

The first one:

==11709==by 0x40431F: grub_guess_root_device (getroot.c:379)
==11709==by 0x4016CC: probe (grub-probe.c:122)

is about device_name in probe ()
Not a real problem and too fix it you'd need to introduce a temporary
variable just to make valgrind happy.

For the others I wasn't yet able to find out if they're real problems or
if it just valgrind is confused.


2008-08-20  Felix Zielcke  [EMAIL PROTECTED]

	* fs/ntfs.c (grub_ntfs_mount): Fix a memory leak. 

Index: fs/ntfs.c
===
--- fs/ntfs.c	(Revision 1822)
+++ fs/ntfs.c	(Arbeitskopie)
@@ -850,6 +850,7 @@ fail:
 {
   free_file (data-mmft);
   free_file (data-cmft);
+  grub_free (data);
 }
   return 0;
 }
==11709== Memcheck, a memory error detector.
==11709== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==11709== Using LibVEX rev 1854, a library for dynamic binary translation.
==11709== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==11709== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation framework.
==11709== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==11709== For more details, rerun with: -v
==11709== 
==11709== My PID = 11709, parent PID = 10584.  Prog and args are:
==11709==./grub-probe
==11709==/
==11709== 
==11709== Conditional jump or move depends on uninitialised value(s)
==11709==at 0x4015287: (within /lib/ld-2.8.so)
==11709==by 0x4004EF2: (within /lib/ld-2.8.so)
==11709==by 0x4007A48: (within /lib/ld-2.8.so)
==11709==by 0x4002EBB: (within /lib/ld-2.8.so)
==11709==by 0x4013CC4: (within /lib/ld-2.8.so)
==11709==by 0x4001308: (within /lib/ld-2.8.so)
==11709==by 0x4000A57: (within /lib/ld-2.8.so)
==11709==by 0x1: ???
==11709==by 0x7FF00093E: ???
==11709==by 0x7FF00094B: ???
==11709== 
==11709== Conditional jump or move depends on uninitialised value(s)
==11709==at 0x401504E: (within /lib/ld-2.8.so)
==11709==by 0x40072CA: (within /lib/ld-2.8.so)
==11709==by 0x4007D15: (within /lib/ld-2.8.so)
==11709==by 0x400176A: (within /lib/ld-2.8.so)
==11709==by 0x400D205: (within /lib/ld-2.8.so)
==11709==by 0x400166E: (within /lib/ld-2.8.so)
==11709==by 0x4003AEF: (within /lib/ld-2.8.so)
==11709==by 0x4013CC4: (within /lib/ld-2.8.so)
==11709==by 0x4001308: (within /lib/ld-2.8.so)
==11709==by 0x4000A57: (within /lib/ld-2.8.so)
==11709==by 0x1: ???
==11709==by 0x7FF00093E: ???
==11709== 
==11709== Conditional jump or move depends on uninitialised value(s)
==11709==at 0x4015059: (within /lib/ld-2.8.so)
==11709==by 0x40072CA: (within /lib/ld-2.8.so)
==11709==by 0x4007D15: (within /lib/ld-2.8.so)
==11709==by 0x400176A: (within /lib/ld-2.8.so)
==11709==by 0x400D205: (within /lib/ld-2.8.so)
==11709==by 0x400166E: (within /lib/ld-2.8.so)
==11709==by 0x4003AEF: (within /lib/ld-2.8.so)
==11709==by 0x4013CC4: (within /lib/ld-2.8.so)
==11709==by 0x4001308: (within /lib/ld-2.8.so)
==11709==by 0x4000A57: (within /lib/ld-2.8.so)
==11709==by 0x1: ???
==11709==by 0x7FF00093E: ???
==11709== 
==11709== Conditional jump or move depends on uninitialised value(s)
==11709==at 0x4015064: (within /lib/ld-2.8.so)
==11709==by 0x40072CA: (within /lib/ld-2.8.so)
==11709==by 0x4007D15: (within /lib/ld-2.8.so)
==11709==by 0x400176A: (within /lib/ld-2.8.so)
==11709==by 0x400D205: (within /lib/ld-2.8.so)
==11709==by 0x400166E: (within /lib/ld-2.8.so)
==11709==by 0x4003AEF: (within /lib/ld-2.8.so)
==11709==by 0x4013CC4: (within /lib/ld-2.8.so)
==11709==by 0x4001308: (within /lib/ld-2.8.so)
==11709==by 0x4000A57: (within /lib/ld-2.8.so)
==11709==by 0x1: ???
==11709==by 0x7FF00093E: ???
==11709== 
==11709== Conditional jump or move depends on uninitialised value(s)
==11709==at 0x40152A1: (within /lib/ld-2.8.so)
==11709==by 0x40072D7: (within /lib/ld-2.8.so)
==11709==by 0x4007D15: (within /lib/ld-2.8.so)
==11709==by 0x400176A: (within /lib/ld-2.8.so)
==11709==by 0x400D205: (within /lib/ld-2.8.so)
==11709==by 0x400166E: (within /lib/ld-2.8.so)
==11709==by 0x4003AEF: (within /lib/ld-2.8.so)
==11709==by 0x4013CC4: (within /lib/ld-2.8.so)
==11709==by 0x4001308: (within /lib/ld-2.8.so)
==11709==by 0x4000A57: (within /lib/ld-2.8.so)
==11709==by 0x1: ???
==11709==by 0x7FF00093E: ???
==11709== 
==11709== Conditional jump or move depends on uninitialised value(s)
==11709==at 0x40152A1: (within /lib/ld-2.8.so)
==11709==by 

Page up/down keys

2008-08-20 Thread Carles Pina i Estany

Hello,

As we talked (Robert and me) in another thread, I'm thinking to add
support for Page Up/Down keys in Grub menu (if here, in the mailing
list, think that it's fine).

My suggestion for the exact behaviour is mainly the same that vim is
using. If you want to test how it would look in a menu, get a xterm,
resize to 6 rows (and many columns as you want) and execute:

seq 100 | vim -

I would implement the same behaviour (I'm thinking about which lines are
showed and where is the active line after pressing PgUp/Down)

I would add only one thing: pressing many times PageUp would move the
active line to the first position (vim is not doing it). So, when the
active line is on the first page and the user press PgUp one more time
it would move te cursor to the top.

Suggestions? Comments?

-- 
Carles Pina i EstanyGPG id: 0x17756391
http://pinux.info


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