Grub2 M1330 Media Direct Button Patch
After my Dell XPS M1330 with 4 GB of RAM (previously 2GB RAM), a Super Talent Ultra Drive GX 128 GB SSD (previously 160GB HDD) and a new Intel WiFi Link 5300AGN 802.11 Draft-N WLAN MiniPCI Card (previously Broadcom BCM4328 802.11a / b / g / n MiniPCIe card so wireless is now finally working under Linux does) have upgraded, I wanted näturlich have it again so that I can boot switch on with the Dell MediaDirect button to Linux and Windows with the normal power button.
Prior to the 160 GB HD, it was resolved through an appropriate boot.ini entry to the hidden Dell Media Direct Windows XP Embedded partition, then point out invited the GRUB boot sector.
But now I had a new empty SSD with nothing on it. I first of all, therefore, partitioned by the SSD with the UBCD in 6 partitions. Here's how:
| / Dev/sda1 | 29.81 GB | NTFS | Windows 7 System |
| / Dev/sda2 | 14.85 GB | NTFS | Data |
| / Dev/sda3 | 54.93 MB | Hidden FAT16 | For OSDev stuff except QEMU under real conditions |
| / Dev/sda4 | 73.53 GB | Extended partition | |
| / Dev/sda5 | 7.63 GB | Linux swap | Only for Hibernate stuff, I will even spare my SSD |
| / Dev/sda6 | 30.52 GB | EXT4 | / |
| / Dev/sda7 | 36.36 GB | EXT4 | / Home (with private ecryptfs user directories) |
Then I installed Ubuntu 9.10 and then 64-bit Windows 7, and presented using the LiveCD grub2 MBR restore.
And then I finally made myself to work. I invited my grub2 1.97 Beta 4 herrunter sources including Ubuntu 9:10 patches and then I modified the / boot/i386/pc/boot.S so, so that when I "not" press the Media Direct button to turn on, then that of the MBR boot sector of first partition (/ dev/sda1) loads and runs, and even before the rest of grub2 stuff is loaded from the MBR, that is in fact almost at the very beginning of the MBR code. Andif I turn now the MediaDirect button to confirm my eingepatchter code is skipped by a jump condition and then reloaded the grub2 Main code and executes it. Grub2 loads according näturlich then the Linux kernel.
The query whether it has confirmed the Media Direct button is quite simple. So depending on when you have confirmed the MediaDirect button or not, the BIOS uses the CMOS on the site of the 0x79 bit 3 (bitmask 0x08) or not. The one in the MBR can then query as follows on quite easily (Intel x86 16-bit real mode syntax):
cli
mov al, 0x79
out 0x70, al
nop
nop
nop
in al, 0x71
sti
and al, 0x08
jnz Media Direct Button Pressed
MediaDirectButtonNotPressed:
.....
Media Direct Button Pressed:
And now here finally is the link to the patch: http://vserver.rosseaux.net/stuff/m1330boot.diff.txt
Have fun! 















