Re: Dell Media Direct button

2008-08-21 Thread Per Öberg
Javier Martín wrote:
 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

It works for me =)

See how below...

There might be different firmware versions out there and there's been a
lot of fuss about early versions of MD screwing up you partition table.
There has also been suggestions on how to disable it by overwriting your
MBR (http://ubuntuforums.org/showthread.php?t=606345).

There seems to be a number of different versions in the range of 1-3 and
some uses a hidden HPA partion while some hides the partition by
changing the partition id. The installation process and the possibility
to upgrade between the different version indicates (not same as proof, i
know) that the firmware does about the same for the different releases
and that it is the MBR that is important since this is what you install
to make it work.

Dan Goodell has a website that describes his findings of how the Dell
MBR works (http://www.goodells.net/dellrestore/hpa-issues.htm). On this
website he indicates that these ports exists. I believe that his
documentation is for MD v1-2 and I have v3.3. He has disassembled the
MBR code and the procedure showed in the part he sent me showed out to
work perfectly when using in my test setup.

--
My setup:
--
Comp: Dell XPS1330M,
Media Direct version: 3.3
Delivered: 2008-07-14
Disk layout:
 - grub legacy on MBR,
 - 100Mb (/dev/sda1, Main grub partiton, config chainloads sda2, sda3 or
sda5)
 - 100Mb  (/dev/sda2, geexbox, with own grub and grub config files in /boot)
 -  30Gb, (/dev/sda3, Kubuntu with own grub and grub config files)
 - Extended partition ~250Gb linux (/dev/sda5, Not using yet but with
test-boot-loader) ,~2Gb swap (/dev/sda6) N

I have a small boot loader written from scratch, which is attached to
the mail, that i dd to /dev/sda5 using dd if=boot.bin of=/dev/sda5
count=512 bs=1

If i press the MD button it will show a splash screen and then show grub
main menu, same menu as with ordinary power button (but the graphics
mode is different). I can then choose to chainload /dev/sda5 which
changes the graphics mode and turns the screen 

Re: Dell Media Direct button

2008-08-21 Thread Stefan Reinauer
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?

   

The sequence of writing to port 0x70 / reading from port 0x71 reflects
reading from the computer's cmos nvram memory.
bit 7 of 0x70 is reserved for disabling NMIs, so the actual information
is stored in byte 0x79[8] in the cmos.

To allow full flexibility, there should just be a module that allows
reading / writing the cmos values (could also be useful for other
things, such as reading a boot order set by the bios).

Everything else makes more sense in scripting:
- changing default
- changing timeout
- support for bit operations in the parser
- etc...

-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
  Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: [EMAIL PROTECTED]  • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866



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


Re: Dell Media Direct button

2008-08-21 Thread Javier Martín
2008/8/21 Stefan Reinauer [EMAIL PROTECTED]:
 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?



 The sequence of writing to port 0x70 / reading from port 0x71 reflects
 reading from the computer's cmos nvram memory.
 bit 7 of 0x70 is reserved for disabling NMIs, so the actual information
 is stored in byte 0x79[8] in the cmos.

 To allow full flexibility, there should just be a module that allows
 reading / writing the cmos values (could also be useful for other
 things, such as reading a boot order set by the bios).

 Everything else makes more sense in scripting:
 - changing default
 - changing timeout
 - support for bit operations in the parser
 - etc...

 --
 coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
  Tel.: +49 761 7668825 • Fax: +49 761 7664613
 Email: [EMAIL PROTECTED]  • http://www.coresystems.de/
 Registergericht: Amtsgericht Freiburg • HRB 7656
 Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866



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


So what about a new nvram module in i386-pc that creates a variable
$NVRAM hooked to routines getting/setting the live contents of the
cmos memory? Then menu scripts can check its contents, among them the
MediaDirect button.

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


Re: Dell Media Direct button

2008-08-21 Thread Robert Millan
On Thu, Aug 21, 2008 at 02:13:05PM +0200, Stefan Reinauer wrote:
 
 The sequence of writing to port 0x70 / reading from port 0x71 reflects
 reading from the computer's cmos nvram memory.
 bit 7 of 0x70 is reserved for disabling NMIs, so the actual information
 is stored in byte 0x79[8] in the cmos.
 
 To allow full flexibility, there should just be a module that allows
 reading / writing the cmos values (could also be useful for other
 things, such as reading a boot order set by the bios).

Ah, good catch.  For the record, we already have code that accesses cmos,
in the date handling functions recently added by Bean.

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


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