Contribute
Register

How to Unstretch the Chameleon Boot Screen

Status
Not open for further replies.
Joined
Jul 15, 2010
Messages
40
Motherboard
P55 > Need make and full model name > See Rules!
CPU
i7 > Need full CPU model number > See Forum Rules!
Graphics
9800GT
Intro
The problem is that your video card does not have a VESA resolution that matches your LCD's native resolution. The result is that the Apple/Windows/Ubuntu logo, Chameleon icons, and verbose text will be stretched/scaled to fill the entire screen, which often looks ugly. The solution is to disable this behavior.

Requirements
1. Any recent nVidia card
2. Any digital LCD connected via DVI

Method
The on-chip scaler can be disabled with a mere 12 bytes of pure machine code. This code must be executed in x86 real mode, therefore it must be placed in the MBR (boot0). Note that the PBR (boot1h) or Chameleon's /boot (boot2) may also be used as long as they do not switch to protected mode.

For simplicity, let's inject the code into the MBR for now. Most MBRs are usually full to the brim, but we can make some room in Chameleon's by disabling the VERBOSE flag. This frees up a precious 32 bytes, which is more than enough for the code plus one message.

For best results, add your card's highest VESA resolution to com.apple.Boot.plist. It must be in it's own key, not on the 'Kernel Flags' line. It should look like this:

  • <key>Graphics Mode</key>
    <string>1280x1024x32</string>
If you omit this step, you'll probably get 1024x768, so be sure to use the highest resolution that you can.

Hexdump of the modified boot0 (MBR)
Code:
0000000: fa 31 c0 8e d0 bc f0 ff fb 8e c0 8e d8 be 00 7c  .1.............|
0000010: bf 00 e0 fc b9 00 01 f2 a5 ea 1e e0 00 00 e8 6a  ...............j
0000020: 01 66 31 c0 66 a3 00 e4 b0 02 bb 00 10 e8 0a 01  .f1.f...........
0000030: 72 06 be be 11 e8 09 00 bf a8 e1 e8 2f 01 f4 eb  r.........../...
0000040: fd 81 7c 40 55 aa 75 51 31 db fe c7 b9 04 00 66  ..|@U.uQ1......f
0000050: 8b 44 08 66 a3 00 e4 80 7c 04 00 74 29 80 7c 04  .D.f....|..t).|.
0000060: ee 75 05 c6 04 00 b3 01 80 ff 01 75 0a 80 3c 80  .u.........u..<.
0000070: 75 14 30 f6 e9 08 00 80 7c 04 af 75 09 b6 01 e8  u.0.....|..u....
0000080: 88 00 75 02 eb 14 83 c6 10 e2 c4 fe cb 75 03 e8  ..u..........u..
0000090: 0b 00 fe cf be be 11 74 b3 c3 e9 63 9b 53 bf 00  .......t...c.S..
00000a0: 12 66 81 3d 45 46 49 20 75 5e 66 81 7d 04 50 41  .f.=EFI u^f.}.PA
00000b0: 52 54 75 54 89 fe 66 8b 44 48 66 a3 00 e4 8b 4c  RTuT..f.DHf....L
00000c0: 50 8b 5c 54 53 b0 20 bb 00 14 53 e8 6c 00 5e 5b  P.\TS. ...S.l.^[
00000d0: 0f 82 64 ff 66 8b 44 0c 66 3d 65 43 ec ac 74 08  ..d.f.D.f=eC..t.
00000e0: 66 3d c9 3e c9 3b 75 1c 66 8b 44 20 66 a3 00 e4  f=.>.;u.f.D f...
00000f0: b6 01 e8 15 00 75 0d be be 11 66 89 44 08 c6 44  .....u....f.D..D
0000100: 04 af eb 96 01 de e2 cc 5b c3 60 b0 03 bb 00 7c  ........[.`....|
0000110: e8 27 00 0f 82 21 ff 08 f6 74 15 a1 00 80 3d 48  .'...!...t....=H
0000120: 2b 74 0d 3d 48 58 74 08 a1 5a 7c 3d 42 4f 75 08  +t.=HXt..Z|=BOu.
0000130: 89 df 81 bd fe 01 55 aa 61 c3 51 b9 05 00 e8 06  ......U.a.Q.....
0000140: 00 73 02 e2 f9 59 c3 66 60 89 e5 1e 1e 66 8b 0e  .s...Y.f`....f..
0000150: 00 e4 66 51 06 53 30 e4 50 6a 10 89 e6 b4 42 cd  ..fQ.S0.Pj....B.
0000160: 13 73 05 31 c0 cd 13 f9 89 ec 66 61 c3 60 57 be  .s.1......fa.`W.
0000170: 9e e1 e8 06 00 5e e8 02 00 61 c3 bb 01 00 fc ac  .....^...a......
0000180: 3c 00 74 06 b4 0e cd 10 eb f5 c3 b8 14 4f b3 02  <.t..........O..
0000190: b7 01 b9 01 00 cd 10 bf ae e1 e8 d0 ff c3 0a 0d  ................
00001a0: 62 6f 6f 74 30 3a 20 00 65 72 72 6f 72 00 55 6e  boot0: .error.Un
00001b0: 73 74 72 65 74 63 68 00 00 00 00 00 00 00 00 00  stretch.........
00001c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00001d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00001e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00001f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa  ..............U.

Copy and paste the above old-school listing to a plain text file called txt, then recreate the binary with this command:
xxd -r txt boot0

Install
You'll notice that the file length is 512 bytes: the first 440 are for the MBR executable code, the next 4 are reserved for the disk signature, and the remaining 68 are for the partition table. Please verify that the MD5 of the newly created boot0 is 97a61d25dd69f0cf87d91f40607f1258, then install it as follows:
sudo fdisk -uy -f boot0 /dev/disk0

Windows 7 Install
If you dual boot, the above command will overwrite your disk signature. To avoid that use these commands:
dd if=boot0 of=mbr bs=440 count=1
sudo fdisk -uy -f mbr /dev/disk0

Now when you reboot, you'll notice that the BIOS will go through it's various stages, and the text will be large and stretched -- just as it always was. But once the new MBR code is loaded and executed, the text will not be stretched and it will be very sharp. It may look like a text window in the center of the display, but it's not. Here you may see the boot0: Unstretch message if you are quick. Then the Chameleon boot screen will appear and you'll see sharp text (especially if you use -v) and a one to one pixel ratio.

Conclusion
If you have a recent nVidia video card AND a digital LCD connected via DVI, you can install the above boot sector and enjoy an undistorted Chameleon boot screen. Once your chosen OS boots up and loads it's own drivers, they will take over and set the resolution and video mode.
 
Doesn't work for me.
The screen is still stretched with my native resolution (1920x1080x32).
But now i can change resolution to 1920x1200x32 and screen becomes significantly smaller, but still stretched.
I made boot0, verified md5 checksum and that i ran: sudo fdisk -uy -f boot0 /dev/disk0

May be i missed something?
 
It looks like you did everything correctly. To verify type sudo xxd -g1 -l512 /dev/rdisk0 and make sure the string "Unstretch" shows up near the end. Also it could be your monitor, what kind is it?
 
"sudo xxd -g1 -l512 /dev/rdisk0" :
.....................................................................................................
00001a0: 62 6f 6f 74 30 3a 20 00 65 72 72 6f 72 00 55 6e boot0: .error.Un
00001b0: 73 74 72 65 74 63 68 00 00 00 00 00 00 00 00 fe stretch.........
00001c0: ff ff ee fe ff ff 01 00 00 00 2f 60 38 3a 00 00 ........../`8:..
00001d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa ..............U.

My monitor is "Benq EW2420".
 
If your monitor is digital and connected via DVI, then it must be your com.apple.Boot.plist settings. Also, what is your card's highest VESA mode?
 
Sort of working for me at 2560x1600 -- the spinner is finally squished, however chameleon is only filling the middle part of the screen, sort of like

+-----------------------+
| |
| +------+ |
| | | |
| +------+ |
+-----------------------+

Do I need a different theme?
 
Actually i checked available vesa mode resolutions via "?video" and the highest of them are:
1280x1024x32;
1600x1200x32.
I think this is the case - vesa driver doesn't support my monitor native resolution 1920x1080x32.
And there is only way to figure out this problem is flashing the video card... how do you think?
Or may be chameleon updating?
 
kmare: That's what it's supposed to do. Changing your theme's background to black would make it look the best.

michael: I also have a native 1920x1080 resolution but my card only goes up to 1280x1024, which is what I have in my Boot.plist. To add a 1920x1080 vesa mode requires editing the video bios. There's a complicated thread at IM that shows how to do it. There's also a AutoRez patch that may work for your mobo, it didn't work on mine.
 
There is a much easier fix, just edit the /Extra/Themes/Default/theme.plist file. The parameters are screen_width and screen_height and boot_width and boot_height.

For more details on themes check out complx's excellent post, viewtopic.php?f=76&t=9448
 
Status
Not open for further replies.
Back
Top