2

Author Topic: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!  (Read 40350 times)

0 Members and 1 Guest are viewing this topic.

staticanime

  • Member
  • Posts: 45
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #15 on: November 22, 2009, 02:55:05 AM »
I don't really understand exactly how you have done this, but well done as I have found it a pain that Windows 7 won't sleep when using a modified booter. :)
So what, you boot up, and get the Chameleon bootloader, even though the Windows disk is active? If so, can you give us instructions on how you achieved this, I'd like to do the same

hb76

  • Entrant
  • Posts: 4
SOLVED Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #16 on: November 22, 2009, 05:16:26 PM »
I do not have a clean solution yet, so you still have to wait some time.

In the meantime the most brave among you might want to tryout this procedure:

WARNING: This might break your Chameleon Installation / MBR / GPT
I think it should work if you have only one win7 and one HFS+ partition on your primary disk.
The disk must be partitioned with GUID partition table.
Try at your own risk.

1. Save your master boot record
dd if=/dev/rdriveX of=<fileMBR> bs=512 count=1
and if you have time, also save the GPT (the first 16kB of your disk should be enough)
dd if=/dev/rdriveX of=<fileMBR-GPT> bs=512 count=32

make sure that you still can access this file even if neither OsX nor Windows can boot (e.g. save on an USB stick)

2. download the binary Chameleon2 RC3 package

3. copy the boot0 file to boot0-win7fix

4. Now we are going to change the boot0win7 MBR code
echo h > not0x80
dd if=not0x80 of=boot0win7 bs=1 seek=108 conv=notrunc count=1


5. verify that everything worked !!!
This should be done, but you can skip this step if you dont have developer tools on your OsX
ndisasm boot0 > boot0.asm
ndisasm boot0win7 > boot0win7.asm
diff -u boot0.asm boot0win7.asm


This should give something like this:
-0000006A  803C80            cmp byte [si],0x80
+0000006A  803C68            cmp byte [si],0x68


this is the code where boot0 checks if a partition is bootable (0x80). By changing this
boot0 will not find an active partition and will try to check for an HFS+ partition in the GPT tables.

6. Good: When you are done, you can write boot0win7 to the MBR with fdisk (this will however delete the diskID and
you have to use the win7 DVD to repair)
Better: use dd to write only the first 440bytes of to the MBR (I did this with Linux dd)
BAD: !!! do not write the whole file with dd to the MBR - this will delete your MBR partition table !!!

7a. boot Windows and set its partition to active, then check sleep an hibernation
7b. If everything fails, get a linux live CD and rewrite the MBR backup of step 1.

For the advanced user:
(One could also take the MBR from step 1. instead of the boot0 from Chameleon distro)

I KNOW THIS IS A REALLY BAD FIX, BUT:
1. This is exactly how I did it on my computer in the first place
2. I don't want to add bad code to the source code
3. I'm still working on a proper fix (see attached file for proposed changes)


Edit: I found an easier way to do this:

1. download a disk editor that can access raw disks
(e.g. HDD software Free Neo http://www.hhdsoftware.com/ for windows
 HxD did not work because its not 64bit safe )
2. open your disk
3. Change the following line
0x060: c6 04 00 b3 01 80 ff 01 75 0a 80 3c 80 75 0f 30
to
0x060: c6 04 00 b3 01 80 ff 01 75 0a 80 3c 68 75 0f 30

Edit2: corrected some typos

Edit3: I would apreciate feedback (especially on the patch for boot0.s)
« Last Edit: December 02, 2009, 07:17:41 PM by hb76 »

staticanime

  • Member
  • Posts: 45
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #17 on: November 23, 2009, 01:29:00 AM »
Just tried your fix there, the face says it all -> ;D

I patched boot0 with the echo h > not0x80 and the following dd command, then installed it with fdisk in mac os x, set my windows partition active, and repaired windows 7, now have hibernate and hybrid sleep working.

PS this is on a GPT/MBR hybrid, with Chameleon on the EFi partition, Snow Leopard on the 2nd partition, ubuntu 9.10 on the 3rd, and Windows 7 on the 4th

zef

  • Administrator
  • Posts: 265
Re: SOLVED Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #18 on: November 23, 2009, 12:48:37 PM »
I would apreciate feedback (especially on the patch for boot0.s)

Hi hb76,

Nice finding! :) If I understand correctly Win7 is picky about what partition is set active and sleep/hibernate works only if his partition is the active one. Your change overrides Chameleon's boot0 ability to pickup the active partition on hybrid GPT/MBR disks.

Originally this behaviour was meant to be a cool feature, but it seems it causes more headaches instead of happiness for win7 users - in case you want to use Chameleon as the primary boot loader. I can live without it and left the MBR untouched then boot my Mac OS partition via Vista's BCD + chain0 (added by EasyBCD) method.

What we can do is to either remove this feature forever or provide a separate version of boot0, one with the original extra hybrid GPT/MBR active partition scan and another one with this different functionality.

Bye,
zef
« Last Edit: November 23, 2009, 12:50:53 PM by zef »
ASUS P8Z68-V PRO/GEN3 | i5-2500k | 16GB RAM | GTX560 | Keyboard | Mouse | Devilsound DAC

hb76

  • Entrant
  • Posts: 4
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #19 on: November 23, 2009, 07:46:29 PM »
I  suggest to remove the search for an active MBR partition on GPT/PMBR systems in the next release candidate.

Maybe one could make a comment to the source why it has been removed.

If people start complaining after the release, one could add a second boot0.

wkr

hb76

BTW: I did not even know about the chain0/BDCedit multiboot path. I am kind of a newbie to Chameleon and stuff.


Edit:  I searched the web and found dozens of threads asking for a solution to this problem. So
in my opinion it should be the default behaviour to ignore the active partition in a PMBR (while still using it when there is no GPT).
 
« Last Edit: November 24, 2009, 12:00:47 AM by hb76 »

Artmuzz

  • Entrant
  • Posts: 1
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #20 on: November 28, 2009, 11:57:46 AM »
Thanks spongemak :)

I have Snow Leopard and Windows 7 dual booting with Chameleon 2 RC3.

Your solution fixed my problem of Windows 7 not going into sleep mode. I went into CMD as administrator and typed "powercfg -h off" and pressed enter and closed CMD window. I now have sleep working. ;D

Cheers

Art
« Last Edit: November 28, 2009, 02:21:16 PM by Artmuzz »

Blackosx

  • Forum Moderator
  • Posts: 1150
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #21 on: December 02, 2009, 03:39:35 PM »
Good work hb76. Thanks for spending the time to detail your solution for us all :)
10.10.5 / 10.11 GM1 | Asus Maximum IV Gene-Z | i7-2600 3.40GHz | 4GB | Radeon 5770 1GB

minimalpc

  • Entrant
  • Posts: 3
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #22 on: January 05, 2010, 04:18:55 AM »
It doesn't look like this fix made it into RC4.  Are there still plans to incorporate it into a future version?

BTW, hb76, I am not sure about the proposed ASM patch, but the one-byte change you posted above works great!  I had no problems using HxD to make the change (doesn't look like the free HHD Neo supports disk editing).  Thanks for all your work on this!
« Last Edit: January 06, 2010, 08:33:47 AM by minimalpc »

staticanime

  • Member
  • Posts: 45
Re: SOLVED Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #23 on: January 15, 2010, 04:29:13 PM »
I tried your patch for boot0.s, unforunantly, it didn't do anything at all, Chameleon still honoured my active partitino flag first. I can confirm tho that the one byte edit works, just wish I could de-compile boot0 after the one byte patch so I could make a diff for it. Here's hoping you get a working patch soon (^_^)

redundant quoting trimmed.
« Last Edit: January 20, 2010, 11:18:20 PM by Gringo Vermelho »

minimalpc

  • Entrant
  • Posts: 3
Re: SOLVED Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #24 on: January 20, 2010, 01:02:04 AM »
I tried your patch for boot0.s, unforunantly, it didn't do anything at all, Chameleon still honoured my active partitino flag first. I can confirm tho that the one byte edit works, just wish I could de-compile boot0 after the one byte patch so I could make a diff for it. Here's hoping you get a working patch soon (^_^)

The quick and dirty one byte patch just effectively results in the following change to the ASM code in boot0.s:
Code: [Select]
.Pass1:
    cmp     BYTE [si + part.bootid], kPartActive ; In pass 1 we are walking on the standard path
becomes
Code: [Select]
.Pass1:
    cmp     BYTE [si + part.bootid], 0x68 ; In pass 1 we are walking on the standard path

However, I believe all that does is make Pass1 fail eventually so that it moves onto Pass2.  In that case, a more efficient way of changing the code would be to just get rid of Pass1.

cirial

  • Entrant
  • Posts: 5
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #25 on: March 05, 2010, 02:50:51 PM »
The hexedit solution does work.. Win7 is set as active partition, and Chameleon still boots. Sleep and Hibernate work in Win7 for me on my Lenovo S10 netbook. Im using a GUID partition scheme, OSX installed first on second partition, win7 on primary partition and a 3rd shared partition just for space.

However, my computer doesnt goto sleep, THEN hibernate after X amount of minutes like it did when I only had Win7 on here. It just sleeps and sleeps and sleeps.  Truely seems like all my settings are correct. Like I said.. hibernate at least works now, but just not fully the way it used to.

Any suggestions? Can you other guys that got this working help out and let me know if your laptops/netbooks do this?

Gringo Vermelho

  • Forum Moderator
  • Posts: 611
  • The gray monster energy hat
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #26 on: March 05, 2010, 03:34:57 PM »
You want "Hybrid Sleep".

Is it enabled in your Windows 7 power management profile?
10.9.5 - ASUS P8Z77-V Pro - i5 3570K - GTX 660 - Chameleon 2.3 svn-r2xxx
How to...
Install Chameleon: http://forum.voodooprojects.org/index.php/topic,649
Make your own Chameleon boot CD: http://forum.voodooprojects.org/index.php/topic,484.msg2131.html#msg2131

cirial

  • Entrant
  • Posts: 5
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #27 on: March 05, 2010, 04:14:38 PM »
Nope, I will enable it and check back..

cirial

  • Entrant
  • Posts: 5
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #28 on: March 05, 2010, 07:53:03 PM »
No luck using the "hybrid sleep" option.  I had that enabled, and have "hibernate after.. on battery" on 1 minute. It just sleeps and sleeps. Never goes to hibernate automatically.

Also, hybrid sleep is NOT the answer to this hibernation problem.  Hybrid sleep sleeps just like the regular sleep setting does, but it ALSO saves to hard disk like a hibernation.  From what I have seen on my Lenovo netbook is that resuming from hybrid sleep is extremely slow and hd intensive. It took 5+ min to get back to windows.

I just want my "hibernate after" setting to work correctly.
« Last Edit: March 05, 2010, 08:02:45 PM by cirial »

Skorpio_72

  • Entrant
  • Posts: 1
Re: Chameleon 2.0RC1 and RC2 prevents sleep - on Windows!
« Reply #29 on: August 07, 2014, 04:20:47 PM »
I found the solution for this problem, I upgraded my vista with windows 7 and had no issues with chameleon and sleep, however I did a clean install of windows 7 and started to have this problem, I found the solution is disabling hibernate or hibryd sleep in windows 7.

To disable Hibernate in command prompt, type powercfg -h off and press enter.

I guess Windows tries to use hibryd sleep or hibernate with the active or boot partition, and that cuases the problem, also makes windows unstable.

This problem has nothing to do with chameleon, is a problem from windows and leopard by it self, if you are having problems with leopard probably is some driver o your dsdt.aml

THANK YOU!!!!
This solution is always been under my nose but i've never seen it; it has solved my needs, easily and with no efforts at all ;)
« Last Edit: August 08, 2014, 09:57:55 PM by Skorpio_72 »