Jump to content

How to Unstretch the Chameleon Boot Screen


  • Please log in to reply
38 replies to this topic

#1
Mac Boy

Mac Boy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 98 posts
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)

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.

#2
Azimutz

Azimutz

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 759 posts
  • Gender:Male
  • Location:Almadan - Pt.
  • Interests:At the moment, OSx86.. In general, music, audiophile, computers.. to much to mention...
Hi Mac Boy...

read your post and here i am :P
Atm i don't have a way to test this, but i'll probably have soon; i recently bought a GT 220, don't have it installed
because i'm still testing some ATI stuff and i fear that my power source may not deal with it on a daily basis;
it's a 300 W one while the card specs ask for 350 min. I use the AutoResolution patch to get native resolution
for my ATI; i did gave a try to the nVidia and the patch failed, that's why i say "probably" on test this.
Anyway, i wanted to ask you a few things:
- can you "translate" this to asm code and post a diff, or the boot0.s modified file?
- will this hex patch work on current boot0? the code slightly changed since your post, mainly
regarding enabling/disabling verbose; i applied the patch to current boot0 and i did get the correct md5
checksum but, one never knows.

Thinks that's it... will post if i remember something else.

Thanks and see ya...

#3
Mac Boy

Mac Boy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 98 posts
I posted the diff here a while ago. The hex patch will work (as long as the md5 is correct) with any version of boot0 because it replaces the whole thing anyway.

#4
ifrit05

ifrit05

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 509 posts
  • Gender:Male
  • Location:Wyandotte, MI
I tried this a while ago and the md5 matched but it hung at "Boot0 Unstretch" or something like that and never actually booted into chameleon. Tried it with a GeForce 8400GS with a LCD monitor through DVI.

#5
Mac Boy

Mac Boy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 98 posts
That's strange, I have the same card and it works every time. Have you changed anything else?

#6
ifrit05

ifrit05

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 509 posts
  • Gender:Male
  • Location:Wyandotte, MI
No, I was like "Ahhh balls, oh well." Lol. I think I'm just going to flash a hex moded BIOS to my card. I have the BIOS but I'm kinda being lazy about actually flashing it.

#7
Azimutz

Azimutz

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPip
  • 759 posts
  • Gender:Male
  • Location:Almadan - Pt.
  • Interests:At the moment, OSx86.. In general, music, audiophile, computers.. to much to mention...

I posted the diff here a while ago. The hex patch will work (as long as the md5 is correct) with any version of boot0 because it replaces the whole thing anyway.

Nice, i do have a preference for Voodoo forums ;)
I may have read it at the time, but didn't pay attention since i didn't had any nVidia.
Will post there when i get the opportunity to test it.

Thanks mate.

#8
marmotta

marmotta

    InsanelyMac Protégé

  • Members
  • PipPip
  • 94 posts
And if I not have mbr? My disk is gpt....

MacOSx:Desktop marmotta$ sudo fdisk -uy -f mbr /dev/disk1
fdisk: could not read MBR code: Undefined error: 0

P.S. I boot from disk1

#9
Mac Boy

Mac Boy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 98 posts
Even GPT disks have MBR code in the 1st sector. I also use GPT. You need to put the code where your original chameleon is installed. So you may need to try disk0 also.

Can you post the output of:
sudo xxd -g1 -l512 /dev/disk0
and
sudo xxd -g1 -l512 /dev/disk1

#10
marmotta

marmotta

    InsanelyMac Protégé

  • Members
  • PipPip
  • 94 posts

Even GPT disks have MBR code in the 1st sector. I also use GPT. You need to put the code where your original chameleon is installed. So you may need to try disk0 also.

Can you post the output of:
sudo xxd -g1 -l512 /dev/disk0
and
sudo xxd -g1 -l512 /dev/disk1


Last login: Mon Aug  1 18:12:11 on console
MacOSx:Desktop marmotta$ sudo xxd -g1 -l512 /dev/disk0
Password:
0000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
0000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00001a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00001b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20  ............... 
00001c0: 21 00 83 fe ff ff 00 08 00 00 41 eb 20 56 00 fe  !.........A. V..
00001d0: ff ff 82 fe ff ff 00 f8 20 56 cf 6e 33 01 00 00  ........ V.n3...
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.
MacOSx:Desktop marmotta$ sudo xxd -g1 -l512 /dev/disk1
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 66 31  ..............f1
0000020: c0 66 a3 00 e4 b0 02 bb 00 10 e8 1c 01 72 06 be  .f...........r..
0000030: be 11 e8 09 00 bf a4 e1 e8 41 01 f4 eb fd 81 7c  .........A.....|
0000040: 40 55 aa 75 51 31 db fe c7 b9 04 00 66 8b 44 08  @U.uQ1......f.D.
0000050: 66 a3 00 e4 80 7c 04 00 74 29 80 7c 04 ee 75 05  f....|..t).|..u.
0000060: c6 04 00 b3 01 80 ff 01 75 0b 80 7c 04 af 75 13  ........u..|..u.
0000070: b6 01 e9 07 00 80 3c 80 75 09 30 f6 e8 94 00 75  ......<.u.0....u
0000080: 02 eb 14 83 c6 10 e2 c4 fe cb 75 03 e8 11 00 fe  ..........u.....
0000090: cf be be 11 74 b3 c3 bf b3 e1 e8 df 00 e9 60 9b  ....t.........`.
00000a0: 53 bf 00 12 66 81 3d 45 46 49 20 75 64 66 81 7d  S...f.=EFI udf.}
00000b0: 04 50 41 52 54 75 5a 89 fe 66 8b 44 48 66 a3 00  .PARTuZ..f.DHf..
00000c0: e4 8b 4c 50 8b 5c 54 53 b0 20 bb 00 14 53 e8 78  ..LP.\TS. ...S.x
00000d0: 00 5e 5b 0f 82 5e ff bf aa e1 e8 9f 00 66 8b 44  .^[..^.......f.D
00000e0: 0c 66 3d 65 43 ec ac 74 08 66 3d c9 3e c9 3b 75  .f=eC..t.f=.>.;u
00000f0: 1c 66 8b 44 20 66 a3 00 e4 b6 01 e8 15 00 75 0d  .f.D f........u.
0000100: be be 11 66 89 44 08 c6 44 04 af eb 8a 01 de e2  ...f.D..D.......
0000110: cc 5b c3 60 b0 03 bb 00 7c e8 2d 00 0f 82 15 ff  .[.`....|.-.....
0000120: 08 f6 74 1b bf ae e1 e8 52 00 a1 00 80 3d 48 2b  ..t.....R....=H+
0000130: 74 0d 3d 48 58 74 08 a1 5a 7c 3d 42 4f 75 08 89  t.=HXt..Z|=BOu..
0000140: df 81 bd fe 01 55 aa 61 c3 51 b9 05 00 e8 06 00  .....U.a.Q......
0000150: 73 02 e2 f9 59 c3 66 60 89 e5 1e 1e 66 8b 0e 00  s...Y.f`....f...
0000160: e4 66 51 06 53 30 e4 50 6a 10 89 e6 b4 42 cd 13  .fQ.S0.Pj....B..
0000170: 73 05 31 c0 cd 13 f9 89 ec 66 61 c3 60 57 be 9a  s.1......fa.`W..
0000180: e1 e8 06 00 5e e8 02 00 61 c3 bb 01 00 fc ac 3c  ....^...a......<
0000190: 00 74 06 b4 0e cd 10 eb f5 c3 0a 0d 62 6f 6f 74  .t..........boot
00001a0: 30 3a 20 00 65 72 72 6f 72 00 47 50 54 00 74 65  0: .error.GPT.te
00001b0: 73 74 00 64 6f 6e 65 00 2b 49 8d 12 00 00 00 fe  st.done.+I......
00001c0: ff ff ee fe ff ff 01 00 00 00 27 40 06 00 00 fe  ..........'@....
00001d0: ff ff af fe ff ff 28 40 06 00 08 c6 98 2e 80 fe  ......(@........
00001e0: ff ff 07 fe ff ff 30 06 a3 2e df 59 95 0b 00 00  ......0....Y....
00001f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa  ..............U.


#11
Mac Boy

Mac Boy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 98 posts
OK, there's no bootloader on disk0 and that's fine. And chameleon is on disk1. I only have one disk so I can't reproduce the error. Maybe you have a different version of fdisk or a different mac version (Lion vs Snow) or something like that.

So the solution for you is to boot into linux and type sudo hexdump -Cv -n512 /dev/sdb to make sure it matches the output of disk1 because sometimes disks may get switched around when booting. Then find my boot0 and type: sudo dd if=boot0 of=/dev/sdb bs=440 count=1

#12
marmotta

marmotta

    InsanelyMac Protégé

  • Members
  • PipPip
  • 94 posts

OK, there's no bootloader on disk0 and that's fine. And chameleon is on disk1. I only have one disk so I can't reproduce the error. Maybe you have a different version of fdisk or a different mac version (Lion vs Snow) or something like that.

So the solution for you is to boot into linux and type sudo hexdump -Cv -n512 /dev/sdb to make sure it matches the output of disk1 because sometimes disks may get switched around when booting. Then find my boot0 and type: sudo dd if=boot0 of=/dev/sdb bs=440 count=1


I have succesfully executed "sudo dd if=boot0 of=/dev/sda bs=440 count=1" (the real position is sda) but now this disk does not start more...... i need to restore my last 440 bites

.....i now returned at start position, why your patch stop my boot? I see the cursor run in the screen and after few seconds all freeze! Is not a better option mod the vga bios?

#13
Mac Boy

Mac Boy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 98 posts
I tried it on 3 different machines (one was AMD) and with a 7300gt, 8400gs, and 9800gt. None had problems, and all had chameleon RC5 installed. It can be placed in the vbios, but that's a little more risky.

#14
marmotta

marmotta

    InsanelyMac Protégé

  • Members
  • PipPip
  • 94 posts

I tried it on 3 different machines (one was AMD) and with a 7300gt, 8400gs, and 9800gt. None had problems, and all had chameleon RC5 installed. It can be placed in the vbios, but that's a little more risky.


I have a ugly beast of gtx465.... low vesa resolution, black borders, no vesa bios mod work -_- and now mbr mod not work. I want to trash this board in the trashcan!

I tried a sandy bridge igpu and the vesa resolutions are less than a nvidia fermi! But i not have a black borders! I always use a dvi connection.

#15
marmotta

marmotta

    InsanelyMac Protégé

  • Members
  • PipPip
  • 94 posts
Nibitor have a function to force gpu scaling... but with my card don't have effect

Other way? If i use a hdmi out with cable/adapter dvi? (my monitor have only vga/dvi)

#16
Mac Boy

Mac Boy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 98 posts
My MBR patch is for DVI only. If I connect my 9800 via VGA, I get a new mode: 1600x1200. But my monitor is 1920x1080 so that's still no good for me. Do you get more vesa modes with VGA?

Anyway, you should not throw out your card just because the boot screen is stretched.

#17
marmotta

marmotta

    InsanelyMac Protégé

  • Members
  • PipPip
  • 94 posts

My MBR patch is for DVI only. If I connect my 9800 via VGA, I get a new mode: 1600x1200. But my monitor is 1920x1080 so that's still no good for me. Do you get more vesa modes with VGA?

Anyway, you should not throw out your card just because the boot screen is stretched.


Sorry but i have poor english :rolleyes:

My card is good but i angry for a this too stupid problem.... I not have tried with vga (i not use it)

I have gtx465 + dvi + 1080 monitor. One curiosity: if i view a osd interface of my monitor it show me a 1920x1080 res! But i not at this resolution... i set my vesa screen mode to the best 16:9 res of 1280x800. Why? Is a gpu upscaling? Any mode to disable it with bios editing?

I remember my old 8800gts (g80) this old card have a perfect vesa fullscreen!

#18
Mac Boy

Mac Boy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 98 posts
My osd also always says 1920x1080 res, no matter what mode I'm in. I think the 8800gts cards had up to 1680x1050.

The only way I managed to disable the upscaling is with this patch. I've attached a dos executable for you to try, just install DOS or freedos to a usb/floppy and run the small program and see if it disables the scaler.

Attached Files



#19
marmotta

marmotta

    InsanelyMac Protégé

  • Members
  • PipPip
  • 94 posts
Houston i have a problem :D

The first image is with your disable.com

The second image is my normal "not-fullscreen"

Attached Files



#20
Mac Boy

Mac Boy

    InsanelyMac Protégé

  • Members
  • PipPip
  • 98 posts
It's hard for me to tell from the picture you posted. If you had big and fuzzy text before running disable.com, then small sharp text after running it, then that's exactly what the patch is supposed to do.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy