1 |
On 17 February 2010 10:31, Willie Wong <wwong@××××××××××××××.edu> wrote: |
2 |
> On Wed, Feb 17, 2010 at 06:58:16AM +0000, Mick wrote: |
3 |
>> On Wednesday 17 February 2010 01:12:08 Peter Humphrey wrote: |
4 |
>> > On Monday 15 February 2010 23:45:23 Mick wrote: |
5 |
>> > > If I were to [tell] GRUB to chainload W7 [which} should I point it |
6 |
>> > > to? Dell's partition 2 which has the boot flag, or the main W7 OS |
7 |
>> > > partition 3? |
8 |
>> > |
9 |
>> > The one with W7 on it, I should have thought, as that's the one you want |
10 |
>> > to start. Why not just try it? And when you find out which partition is |
11 |
>> > which, why not set the bootable flag on the right one? I.e. the one with |
12 |
>> > grub in it. |
13 |
>> |
14 |
>> I am not sure that I would want to do this. I recall that MSWindows used to |
15 |
>> be and it possible still is rather sensitive with needing the boot flag on its |
16 |
>> partition. Linux on the other hand is a more advanced OS which does not care |
17 |
>> where the boot flag is. |
18 |
> |
19 |
> If you were to go with the GRUB -> W7 route, I don't think just trying |
20 |
> out the two configurations (don't change boot flags, just try each |
21 |
> partition) would've hurt. The worst that I can imagine is an error |
22 |
> thrown about OS not found. |
23 |
> |
24 |
>> Nope. I mean use the Windows 7 bootloader as the primary bootloader to |
25 |
>> chainload GRUB from the Gentoo partition. The MSWindows stays in the MBR as |
26 |
>> it is now, the GRUB is installed in the Gentoo /boot partition. MSWindows |
27 |
>> bootloader chainloads GRUB. |
28 |
>> |
29 |
> I wish you good luck with your project. |
30 |
> |
31 |
>> PPS. I am making some progress with this (at least in terms of googling) and |
32 |
>> will report back as soon as I have achieved this MSWindows --> chainloading -- |
33 |
>> > Gentoo thing. |
34 |
> |
35 |
> Please do write a page on the Wiki (or at least a summary of what you |
36 |
> did to this mailing list). This will be some handy information to |
37 |
> have. |
38 |
|
39 |
I have now succeeded at achieving what I wanted: to use the Windows 7 |
40 |
boot manager (bootmgr.exe) which is the successor to NTLDR to |
41 |
chainload GRUB from it and so leave the Windows installation intact |
42 |
(at least until the warranty expires) ;-) |
43 |
|
44 |
I very briefly detail here the steps that I followed - if you need |
45 |
more please contact me and I will help if I can, or if I get some time |
46 |
I will sign up to edit a Wiki page. |
47 |
|
48 |
First the necessary WARNING: You can render your MSWindows OS |
49 |
unbootable and without an installation CD things can get hairy. So |
50 |
research the necessary steps to recover a borked MSWindows boot system |
51 |
using the facilities offered by the OEM *before* you start and use |
52 |
partimage to make a back up, just in case. |
53 |
|
54 |
There's two or three gotchas that make this more difficult than |
55 |
chainloading GRUB from NTLDR.exe under Win2k and WinXP: |
56 |
|
57 |
1. Disk and partition signatures in the MBR are used by Vista and |
58 |
Windows 7 to find the active boot partition of MSWindows. If you move |
59 |
that partition then its disk offset changes and you start getting |
60 |
errors like "winload.exe..... is missing or corrupt", when what has |
61 |
actually happened is that the drive ID (partition signature) has |
62 |
changed and BCD doesn't know about it. |
63 |
|
64 |
2. OEMs use additional partitions to save installation images for |
65 |
recovery purposes and they often mark these as active boot partitions. |
66 |
The boomgr and BCD is consequently installed there as part of the |
67 |
installation script - but it doesn't clearly tell you this in the BCD |
68 |
file (that's the new boot.ini) unless you can decipher partition ID |
69 |
signatures. Remove that recovery partition to save space and your |
70 |
MSWindows won't boot again. |
71 |
|
72 |
3. Windows 7 uses BitLocker on the IPL in the MBR and this may |
73 |
introduce additional complications - you mess with the MBR and then |
74 |
kiss goodbye to booting your MSWindows bloatware again. |
75 |
|
76 |
My solution worked by editing the BCD file using the native editor |
77 |
provided by MSWindows, the bcdedit command. The winload.exe (which |
78 |
partly replaces NTLDR) is thereafter used normally to launch an image |
79 |
of the GRUB partition boot record and that of course knows where to |
80 |
jump to launch your Gentoo. There's no need for 3rd party boot |
81 |
managers - there are two or three available like Neogrub which should |
82 |
do the same job by offering you a GUI, but if you are capable enough |
83 |
to install Gentoo then you can easily find your way around the BCD |
84 |
file with bcdedit.exe. |
85 |
|
86 |
The main steps to achieve this solution are: |
87 |
|
88 |
1. Install GRUB in your Linux /boot partition and capture an image of |
89 |
the partition boot record (it must be unmouted at the time): |
90 |
|
91 |
dd if=/dev/sda5 of=boot.lnx bs=512 count=1 |
92 |
|
93 |
2. Copy the boot.lnx file to C:\boot.lnx |
94 |
|
95 |
3. Launch cmd.exe as administrator and call bcdedit /v which will |
96 |
show you something like this: |
97 |
==================================================== |
98 |
C:\Windows\system32>bcdedit /v |
99 |
|
100 |
Windows Boot Manager |
101 |
-------------------- |
102 |
identifier {9dea862c-5cdd-4e70-acc1-f32b344d4795} |
103 |
device partition=\Device\HarddiskVolume2 |
104 |
path \bootmgr |
105 |
description Windows Boot Manager |
106 |
locale en-US |
107 |
inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e} |
108 |
default {fda5ebf3-119b-11df-969c-f924691e8117} |
109 |
resumeobject {5744906c-0bf4-11df-8e08-0026b920b49c} |
110 |
displayorder {fda5ebf3-119b-11df-969c-f924691e8117} |
111 |
{fda5ebf6-119b-11df-969c-f924691e8117} |
112 |
toolsdisplayorder {b2721d73-1db4-4c62-bf78-c548a880142d} |
113 |
timeout 3 |
114 |
|
115 |
Windows Boot Loader |
116 |
------------------- |
117 |
identifier {fda5ebf3-119b-11df-969c-f924691e8117} |
118 |
device partition=C: |
119 |
path \Windows\system32\winload.exe |
120 |
description Windows 7 Home Premium |
121 |
locale en-US |
122 |
recoverysequence {5744906e-0bf4-11df-8e08-0026b920b49c} |
123 |
recoveryenabled Yes |
124 |
osdevice partition=C: |
125 |
systemroot \Windows |
126 |
resumeobject {5b312091-116a-11df-8b54-806e6f6e6963} |
127 |
==================================================== |
128 |
|
129 |
The first entry is the bootmgr, the second is MSWindows OS partition. |
130 |
First make a back up of the BCD file: |
131 |
|
132 |
C:\Windows\system32>bcdedit /export C:\BCD_backup |
133 |
|
134 |
Then create a new entry using bcdedit for the Linux boot image, by entering: |
135 |
==================================================== |
136 |
bcdedit /create /d "Gentoo Linux2" /application BOOTSECTOR |
137 |
The entry {fda5ebf7-119b-11df-969c-f924691e8117} was successfully created. |
138 |
==================================================== |
139 |
|
140 |
Cut and paste the partition ID in all the subsequent commands: |
141 |
==================================================== |
142 |
bcdedit /set {fda5ebf7-119b-11df-969c-f924691e8117} device boot |
143 |
|
144 |
bcdedit /set {fda5ebf7-119b-11df-969c-f924691e8117} path /boot.lnx |
145 |
|
146 |
bcdedit /set {fda5ebf7-119b-11df-969c-f924691e8117} locale en-US |
147 |
==================================================== |
148 |
If you don't get "The operation completed successfully." you know |
149 |
you've done something wrong. |
150 |
|
151 |
Then set it as last in the menu: |
152 |
==================================================== |
153 |
bcdedit /displayorder {fda5ebf7-119b-11df-969c-f924691e8117} /addlast |
154 |
The operation completed successfully. |
155 |
==================================================== |
156 |
|
157 |
and increase the delay before the menu automatically boots the default |
158 |
(leave the default as MSWindows until you prove that your Linux system |
159 |
can boot): |
160 |
==================================================== |
161 |
bcdedit /timeout 10 |
162 |
==================================================== |
163 |
|
164 |
Then run C:\Windows\system32>bcdedit /v to see what you have just |
165 |
made, at the bottom of the menu: |
166 |
==================================================== |
167 |
Real-mode Boot Sector |
168 |
--------------------- |
169 |
identifier {fda5ebf6-119b-11df-969c-f924691e8117} |
170 |
device boot |
171 |
path \boot.lnx |
172 |
description Gentoo Linux |
173 |
locale en-US |
174 |
==================================================== |
175 |
|
176 |
Now, this may not boot if your MSWindows boot drive is different to |
177 |
the MSWindows OS partition (as was in my case). So, we need to point |
178 |
the bootmgr at the partition where the linux boot image resides, in my |
179 |
case C: |
180 |
==================================================== |
181 |
bcdedit /set {fda5ebf7-119b-11df-969c-f924691e8117} device partition=C: |
182 |
==================================================== |
183 |
|
184 |
Use the /v option to check all is good and reboot the machine. |
185 |
Hopefully, you will be greeted with a GRUB splash. :-) |
186 |
|
187 |
HTH. |
188 |
-- |
189 |
Regards, |
190 |
Mick |