Jump to content











Photo
* * * * * 1 votes

Hack Bootmgr to boot Windows in BIOS to GPT

bios gpt bootmgr winload

  • Please log in to reply
374 replies to this topic

#276 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 13 February 2016 - 10:50 PM

Just to let you know OP, your investigation, and actually the work everyone put in this thread (although i haven't read the whole thread yet) brought down a GIANT barrier in the Apple side of things, as you may know (or not) apple supports the booting of windows 7, 8.1 and 10 through csm ( virtual bios) that everyone knows as bootcamp (although bootcamp is just a bunch of drivers but all right), well it turns out that windows 10 and 8.1 are more or less well supported through EFI on newer macs on old macs there have grave problems but they work, but there is one that is completely impossible to get working through EFI windows 7, windows 7 through EFI does not work, if you ask anybody on the apple scene that is knowledgeable about macs, EFI and windows, will tell you that is impossible, well that is more or less true, there have been people that were able to boot windows 7 through EFI on Mac but it depends on the models and it requires poking pci registers and some luck, to add not many people were able to do it.

 

By doing this method and a combination of some other method it is possible now to boot Windows 7 on a mac although it is legacy, it is installed as uefi doesn't need hybrid partitions, windows 7 sees the 2tb hdd and reports GPT and on boot it actually thinks it booted through EFI, there is no blackscreen and there is hardware acceleration (which doesn't happen if you try to boot windows 7 through efi in the regular way, you just get a blackscreen).

 

Thank you everyone for all the work you guys put in, your work was a blessing for me to take down that pesky barrier. 



#277 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 14 February 2016 - 08:52 AM

By doing this method and a combination of some other method it is possible now to boot Windows 7 on a mac  ...

Good to know. :)
It would be nice (when and if you have some time for this) if you could post (possibly on a new, dedicated, thread) a description of the procedure, so that it can be of use for other people.

:duff:
Wonko
  • Pockets69 likes this

#278 cdob

cdob

    Gold Member

  • Expert
  • 1440 posts

Posted 14 February 2016 - 09:05 AM

I stumbled across this https://technet.micr...s/dn858566.aspx which talks about installing Windows into a VHD, formatted using MBR, but stored on a GPT partition.

.
Technet article

You have a secondary disk from which you would like to boot the secondary Windows environment, but this disk uses the GUID Partition Table (GPT)
...
BIOS or legacy boot systems require the boot volume to be located on a disk partitioned with master boot record (MBR).

This uses two real hard disks.
The PC boots from a MBR hard disk: bootmgr and \boot\bcd are located at MBR hard disk.
Windows is loaded from the secondary disk, this one inside a VHD image. MBR or GPT dosn't matter inside the VHD image.

The two hard disks approach is known so far. It's good and recomended at a machine with two or more hard disks. Bad at a machine with one hard disk.
Nice, the manufacturer documents this scenario too.
The Windows 10240 to 10568 repair installation should work that way.

#279 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 14 February 2016 - 02:18 PM

@cdob
(unless I missed something :dubbio:) what happened with the OFS vhd?
http://reboot.pro/to...o-gpt/?p=193947

78 downloads (1 expected) and not a single report/comment seems like not promising ... :w00t: :ph34r:

:duff:
Wonko

#280 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 14 February 2016 - 05:12 PM

 Good to know.  :)

It would be nice (when and if you have some time for this) if you could post (possibly on a new, dedicated, thread) a description of the procedure, so that it can be of use for other people.

:duff:
Wonko 

 

Well I will, but i am still going through the thread, I need to figure out a way to all this without needing a pen drive, I saw the vhd solution, but i still need to figure out how to boot into it, syslinux is a possibility, but i need to do a lot of reading first, and actually finish reading this thread.



#281 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 15 February 2016 - 01:18 PM

I am sorry but i tried to find the edit button, but couldn't find it, if you mods want feel free to merge the Posts.
 
Anyway, in these two days I took the time to read the whole thread, and boy oh boy... I get lost after the 3rd or 4th page, I managed to install the bootmgr in the pen drive as was originally proposed by Milind, I was also able to do the alternate solution which was installing the bootmgr on a vhd, I then used grub4dos on a pen drive to mount the vhd and launch windows 7, all good.
 
But i still had a problem, I was still using a pen drive to launch grub4dos, so next part is to make the pen drive disappear.
 
And this is where the problem lies, i have a very complicated setup over here (with about 12 partitions and around 8 or 9 operating systems) to worsen things up a bit, i am using a Macbook with all its idiosyncrasies and limitations.
 
For my testing I can actually just delete everything i have accomplished so far and start from a clean slate, something along the lines of:
gpt1 EFI
gpt2 MSR
gpt3 Macintosh HD
gpt4 Recovery HD
gpt5 Windows 8.1 (I am using windows 8.1 this time instead of 7)
gpt6 Arch
gpt7 Ubuntu.
 
Now every single OS up there is installed in EFI mode, apart from Arch, why do you ask? because i want to test something, so please bear with me.
 
What I have been trying to do is to either load the vhd using ubuntu's grub bootloader (which is in the efi partition) OR using Syslinux bootloader which is installed on the Arch partition, now arch is legacy installed so no efi bootloader.
 
Now this is the problem, I tried using syslinux, but i was unable to boot it, since it is on a legacy partition refind cant see it (although refind can see legacy OSs on a pen drive, but not on the hdd) Grub however is able to see both efi OSs and Legacy ones, so Grub could see the arch partition but it would boot the kernel and the OS, it wouldn't chainload syslinux.
So although syslinux was installed i was unable to access it either through it's own legacy partition or through chainload syslinux through grub efi.
 
So I moved to try to boot the vhd directly through grub efi, i was able to mount the vhd and acess it's contents i tried to ntldr /bootmgr but it wouldn't work saying that ntldr.mod was not present, I did an extensive search on the issue it turned out (apparently) that the grub efi can only chainload other EFI bootloaders (is this true? i don't know but that seems to be what i am getting) I also tried a few more things that didn't work, but I don't want to clutter this post with more useless crap.
 
I then took the time to read all your thread as i was saying above and boy oh boy, i am in for a lot of trouble, for what i could understand there are 2 successful methods one from cdob and another from jaclaz (Wonko the sane), but apprently cdob uses files from jaclaz mainly the mkgrldrGPT.zip which contains a few files and a bat file.
 
Now i am having troubles finding the "usual bunch" of files mainly these two, dumphex.exe and hexalter.exe, did a few google searches and was unable to find them, i only found malware and adware stuff, so if you guys could pelase point me out in the right direction that would be great, I have also searched in the downloads section of the site, but yield no results.
 
I would also like to go over the steps to accomplish this by reading cdob's post and please correct me if i am misreading or assuming stuff that isn't on his post:
 
 
1- starting by getting the files mkgrldrgpt.zip dsfo.exe dsfi.exe dumphex.exe hexalter.exe
 
2 - boot the computer (in my case the macbook) and on windows PE environment apply my windows 8.1 image (by doing DISM.exe /Apply-Image/ImageFile:e:\sources\install.wim /Index:1/ApplyDir:C:\) question can i just do a regular install instead of applying the image through DISM or do i need to really apply the image?
 
3 - create_vhd.txt that will pass it's parameters to diskpart.exe
 
4 - bcdboot.exe c:\Windows /s V: /f BIOS which will install the mbr in the vhd
and the same for the helper usb pen drive
 
5 - boot into windows using the helper pen drive
 
now there is this part:

Grldr can be at windows partition or at another (fake) partition.
If grldr is located at c: then adjust c: boot code : change bootmgr to grldr
BOOTMGR: 07 00 42 00 4F 00 4F 00 54 00 4D 00 47 00 52 00
GRLDR: 05 00 47 00 52 00 4C 00 44 00 52 00 00 00 00 00
copy grldr c:\
copy menu.lst c:\
What does this mean? where can i change this values? is this done after running the mkgrldrGPT.bat? is this even related to mkgrldrGPT.bat?
and what is the point of having grldr in the c: drive? isn't it suposed to be launched from elsewhere? and then launch the vhd? This is the part that is confusing the hell out of me!!!
 
The rest seems pretty straightforward, mount the vhd when windows runs so you can install updates and use various tools.
 
But that part that i quoted above and where in this whole thing do i run mkgrldrGPT.bat is really confusing me.
 
Can you guys please explain it a bit more noob proof please? I would love to get this working, on a mac, I can even try this on the PC first to cover my bases, but still a bit of help would be immensely appreciated.
 
Thank you in advance.

Edited by Pockets69, 15 February 2016 - 02:07 PM.


#282 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 15 February 2016 - 03:06 PM

Let's separate the issues.
hexalter (via Wayback Machine):
https://web.archive..../hexalter.shtml
dumphex:
http://rbach.priv.at/DumpHex/
 
What you should use is however NOT mkgrldrGPT.zip BUT RATHER the mkhidGPT001.zip (which is an updated and bettered version)
http://reboot.pro/to...o-gpt/?p=193659
simply follow the above post and the one by cdob immediately following.
 
The general idea of the batch is:
1) create a small FAT 12 volume
2) have in it the needed boot files
3) write a "special MBR code" pointing to a given area on the GPT disk (sectors 63-2047) including also a "replica" of the small FAT 12 volume  BPB (Bios Parameter Block)
4) write to that area the small FAT 12 volume
 
When the computer is booted in BIOS the MBR code is read and executed, and it simply chainloads the bootsector of the small FAT12 volume, the small FAT 12 volume bootsector then calls and loads grldr (grub4dos).
 
Since there is the BPB data in the MBR, grub4dos can see the volume as (hd0) and you should be able to map it to (fd0) and then chainload the BOOTMGR in it.
(if it doesn't work, you can map (hd0)63+1985 to (fd0), this latter has been checked and confirmed to work).
 
Usage is better detailed in this post:
http://reboot.pro/to...able-usb-drive/
 
I know how this thread is confusing, as several approaches were tested and there is some mix-up, but now you are in a condition where you have everything working (but are still using the external USB drive) the only thing you need is to "move" the boot files from the pen drive to the small hidden FAT12 partition (and you need to make sure that your first GPT partition actually starts on sector 2048 or later).
 
 
:duff:
Wonko
 
P.S.:JFYI, the reference by cdob to the change from BOOTMGR to GRLDR is a hex patch to be carried on the bootsector of a volume partition (first sector in case of FAT, second sector in case of NTFS) but you don't want/need to do that.

#283 cdob

cdob

    Gold Member

  • Expert
  • 1440 posts

Posted 15 February 2016 - 05:33 PM

what happened with the OFS vhd?

I got distracted back then, sorry, never tried.
A good windows BIOS GPT solution works at running windows too: \boot\bcd is available.
A mounted hard disk image does work. Can we use the OFS vhd at boot time and at running windows time?

In the meantime I'm at simple and stupid approach: a own 100 MB partition with grub and menu.lst
Yes, a waste of space, but 100 MB yells nowadays: I'm the boot partition
And the partiton can be adjusted with windows tools.

Other user may like another approach still.
 

What I have been trying to do is to either load the vhd using ubuntu's grub bootloader (which is in the efi partition) OR using Syslinux bootloader which is installed on the Arch partition, now arch is legacy installed so no efi bootloader.

How do you boot at all? What's the main boot loader? refind or another one?

If you use refind as main loader, then you boot windows from a EFI, not from a BIOS.
Ignore this thread then.

I understand: the hard disk is partitioned already and there is grub 2 working.
Continue to use this, chainload another tool: memdisk or grub.exe


BIOS grub.cfg
menuentry "(hd0,gpt3)/windows/Boot.vhd - memdisk" {
 linux16 /boot/syslinux/memdisk harddisk raw
 initrd16 (hd0,gpt3)/Windows/Boot.vhd
}

menuentry "search /windows/Boot.vhd - memdisk" {
 set vhd_file=/Windows/Boot.vhd
 search --file $vhd_file --set=vhd_part
 linux16 /boot/syslinux/memdisk harddisk raw
 initrd16 ($vhd_part)$vhd_file
}

menuentry "grub4dos mapping /windows/boot.vhd" {
  set vhdfile=/windows/boot.vhd
  linux16 /grub/grub.exe --config-file=find --set-root $vhdfile\; map $vhdfile (hd0)\; map (hd0) (hd1)\; map --hook\; root (hd0,0)\; chainloader /bootmgr
}

menuentry "grub4dos" {
  linux16 /grub/grub.exe
}

So I moved to try to boot the vhd directly through grub efi, i was able to mount the vhd and acess it's contents i tried to ntldr /bootmgr but it wouldn't work saying that ntldr.mod was not present, I did an extensive search on the issue it turned out (apparently) that the grub efi can only chainload other EFI bootloaders (is this true?

Break:
If you use a EFI bootloader, then use a window EFI loader too: chainloader /efi/microsoft/bootx64.efi
But this is out of the scope of this thread. Open a new one, if you like to follow this.

Do NOT use bootmgr. Bootmgr will fail at EFI mode.
 

question can i just do a regular install

A regular install fails at BIOS GPT disk, this includes a OS repair installation (default at windows 10 update).
 

now there is this part:

Ignore this part. Load the windows boot part at BIOS grub.
 

and what is the point of having grldr in the c: drive? isn't it suposed to be launched from elsewhere? and then launch the vhd?

Yes, it can be elsewhere. I'm adjusting to different conditions: a new clean hard disk or a partitioned hard disk with a working boot loader.

#284 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 15 February 2016 - 07:46 PM

I got distracted back then, sorry, never tried.

No prob :) just a reminder to test it (when and if you have time for it).
 

A mounted hard disk image does work. Can we use the OFS vhd at boot time and at running windows time?

This is what you have to find out :whistling:.
The OFS.vhd is very small and while it obviously works with grub4dos it has to be seen what happens next.
Possibly the advantage could be that of mounting it through the native driver :unsure:.
 

In the meantime I'm at simple and stupid approach: a own 100 MB partition with grub and menu.lst
Yes, a waste of space, but 100 MB yells nowadays: I'm the boot partition
And the partiton can be adjusted with windows tools.

Other user may like another approach still.

Yep, at the end of the day, whatever floats one's boat is fine :thumbsup:, but before or later we (actually you, but I will try to assist where I can) will need to put some order on the thread, and create maybe a number of "dedicated to each approach" new ones there are some of your posts that even I cannot understand, think at what can a "passing by" user/member possibly understand?

:duff:
Wonko

#285 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 15 February 2016 - 10:13 PM

Ok guys I bring bad news.

 

I'll try to reply to you both in this post, firsty Jaclaz your method works (well not that I thought it wouldn't) but to be more specific it works on the Macbook but not like it should or should I say not like on a normal computer.

 

I was able to run the script, with the provided files (thank you Jaclaz) and it worked, I booted on ubuntu and started gparted to see if I saw the partition, I didn't (Sneaky) so I thought it wouldn't work, but as soon as i tried to boot from the pen drive (yes from the pen drive, i ll explain why in a minute) it actually jumped to the partition and i was presented with the grub4dos bootloader, i was unable to boot windows because my parameters apparently were not working BUT that doesn't really matter right now, what matters is that grub4dos was loaded successfully.

 

Now a reply to both of you, and a small explanation, cdob my main bootloader is refind, I also have grub efi and the obvious windows efi bootloader

 

You see the thing is I don't boot windows from EFI because windows (and mainly windows 7) refuses to boot on Efi on a macbook (it only works on virtual bios, csm) the thing is with this method (meaning using MilindR original method on the first few pages of the thread) i was able to boot windows through a mbr formatted pen drive.

That is why I was trying to use a bootloader like Grub or syslinux to chainload to the vhd, the thing is, syslinux is installed on legacy, and it is impossible to access, so I can only use grub efi.

 

A small explanation on how refind works for people not familiar with it, first refind is an efi bootloader so it is suposed to boot EFI enabled operating systems, refind is also capable of booting legacy OS from the pen drive, refind is capable of booting (at least linux based operating systems) installed on legacy by launching the kernel and initrd, now refind has a very weird thing that is, he lists for instance the partition where you installed windows (since windows is installed through EFI) trying to boot windows directly on its own partition will result in a "no bootable device", or for instance, if you try to boot a legacy partition for instance some linux partition you get the exact same massage, but now do the same try to boot either windows partition that didn't work previously or the linux partition that didn't work previously with some bootable OS installed on a pen drive for example freebsd, if you select either of the entries (windows or the linux partition) refind will do the weird thing of jumping to the pen drive and booting freebsd!! how weird is that? very much, now with the modifications Jaclaz script did if i selected for instance the linux legacy partition i have here with the pen drive inserted, it would however jump to the new partition created instead of booting the pen drive... how cool is that? very cool, problem is, it still needs a pen drive to jump to, otherwise you just get a no bootable device.

To simplify things a bit:

 

- boot legacy partition with arch installed using refind -> no bootable device

- boot legacy partition with arch installed using refind but with an inserted pen drive with freebsd for example -> jumps to freebsd pen drive

- boot legacy partition with arch installed using refind after running jaclaz script -> no bootable device

- boot legacy partition with arch installed using refind after running jaclaz script with a drive with freebsd for example -> jumps to grub4dos partition.

 

How fantastic!? not that much, since using this method I do need a pen drive always, and it is very confusing, between using the old method of installing the bootmgr on a pen drive, or using this method that is a monstrosity on the Macbook, i think i prefer to use the previous which is cleaner.

 


menuentry "(hd0,gpt3)/windows/Boot.vhd - memdisk" {
linux16 /boot/syslinux/memdisk harddisk raw
initrd16
(hd0,gpt3)/Windows/Boot.vhd
}

menuentry "search /windows/Boot.vhd - memdisk" {
set vhd_file=/Windows/Boot.vhd
search
--file $vhd_file --set=vhd_part
linux16
/boot/syslinux/memdisk harddisk raw
initrd16
($vhd_part)$vhd_file
}

menuentry "grub4dos mapping /windows/boot.vhd" {
set vhdfile=/windows/boot.vhd
linux16
/grub/grub.exe --config-file=find --set-root $vhdfile\; map $vhdfile (hd0)\; map (hd0) (hd1)\; map --hook\; root (hd0,0)\; chainloader /bootmgr
}

menuentry "grub4dos" {
linux16 /grub/grub.exe
}

 

well yeah i saw some of those examples for instance the first one, i can't even find memdisk as there is no syslinux folder! i know grub has a memdisk module, is it the same?

I could try

insmod memdisk

 

But still after you list all the examples above you say that if i use grub efi i can only chainload another efi bootloader? so there is no way i can boot the vhd from my grub efi right?

 


A regular install fails at BIOS GPT disk, this includes a OS repair installation (default at windows 10 update).

makes sense mine didn't fail because the install was made on efi computer.

 

With all the things i am seeing here is that it is obviously better to keep booting from the pen drive like before, i don't think that this is going to work, ill just get a small low profile usb to hold the bootmgr files and boot from there.

 

All in all it has a been a great learning experience, and you guys are awesome :D

 

well if you have anything to add please do, but as i see it there is nothing else i can do unfortunately...

 

Thank you Jaclaz and Cdob



#286 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 16 February 2016 - 08:30 AM

You are welcome :), but It would be interesting to see what grub4dos "sees" in your case.

Booting from the pendrive at first and after (if it is the case) when actually on the internal hard disk.

If grub4dos boots, it means that (one way or the other) some BIOS environment does exist.

If you could try running the grub4dos from the pendrive and run a couple of geometry commands, like:
geometry (hd0)
geometry (hd1)
the output may help in understanding what is the situation.

One of the issues (I don't know) may be that only the pen drive is seen in your case.
But if you can manage to try the grub4dos on the internal hard disk, if it boots to the grub4dos, then the internal hard disk will be available.

About syslinux, temporarily forget about the insmod memdisk, just get memdisk from a syslinux distribution and copy it somewhere where it is accessible.
Memdisk is (for all GRUB2 or grub4dos know) a (very minimal) Linux kernel that will take complete control and access the file specified as initrd.

:duff:
Wonko

#287 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 16 February 2016 - 03:09 PM

Hey Jaclaz yes there has to be legacy booting involving over here, otherwise refind wouldn't be able to boot from the pen drive (and as i said i am able to install linux distros in legacy mode), it does that in it's normal state.

 

You can also accomplish legacy boot if you flag a partition as hybrid on the hdd (this would be the correct way to install windows 7 on a mac following apple instructions) but i managed to do it through EFI mode which the mac doesn't support at least for windows 7, and the fact that i can launch legacy from a pen drive shows because that is what i have been doing to get windows 7 to work following the tutorial in the beginning of the thread.

 

Now with your modification I was able to launch legacy from the hdd (more precisely your small partition with grub4dos), but only when a bootable usb was inserted, anyway yes I will try the commands above, luckly enough i have not wiped the hdd again, so I can try them, will post it here later.

 

about syslinux and grub, well cdob said that calling a bootmgr from grub when installed in efi wouldn't work, but i can try that as well, so yeah i just need to download the memdisk and put it in that path, hopefully i don't get invalid magic or whatever i have been having... 

 

EDIT:

 

So here is the geometry command for hd0

drive 0x80(LBA): C/H/S=1023/255/63, Sector Count/Size=16434495/512
Partition num: 0, Filesystem type unknown, Partition type 0xEE

 

also there is a geometry for fd0 (don't know if it s important)

drive 0x00(BIF): C/H/S=1/255/63, Sector Count/Size=16450560/512

 

This is from grub4dos booted from the hdd by using your method.

 

EDIT 2

 

SORRY guys disregard everything i said! I made mistake -.- apparently i installed the grub4dos on the pen drive ( I am fucking idiot, that is why it was booting, it was booting from the pen drive) I am sorry, I ll try to do the method again, and this time install it in the correct place.

 

Sorry for wasting your time.


Edited by Pockets69, 16 February 2016 - 03:26 PM.


#288 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 16 February 2016 - 03:48 PM

It's ok :) if you boot from the pendrive, don't worry, what I wanted to understand was if the internal hard disk was viewable (that would be (hd1) if you boot from the pen drive or (hd0) if you boot from the internal disk).

 

BUT which EXACT version of grub4dos/grldr are you using?

A recent version of grub4dos would recognize the GPT 0xEE "protective" partition entry and enumerate partitions in it as (hd0,0), (hd0,1), etc.

 

:duff:

Wonko



#289 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 16 February 2016 - 04:19 PM

ok so this time i run the correct command and installed it on the hdd, it doesn't finish the script.

 

here is the output:

mkhidGPT.cmd myimage.img 0

mcopy "./root/BOOTMGR" -i 0 "::BOOTMGR"

mcopy "./root/grldr" -i 0 "::grldr"

mcopy "./root/menu.lst" -i 0 "::menu.lst"

mcopy "./root/boot/BCD" -i 0 "::boot/BCD"

volume in drive : is G4D_BIOSGPT

volume Serial Number is 6653-7457

Directory for ::/

 

BOOTMGR

grldr

menu

 

Directory for ::/boot

BCD

 

press any key to continue.

 

And it finishes, so i believe its not running the whole script, because its not writing to disk (on the pen drive for instance it would complete the install).

 

as for the grub4dos version i downloaded it from sourceforge over here, https://sourceforge....grub4dos 0.4.4/(and yeah its old, but i thought that was the correct one guess not, at least its not showing the partitions as you said)

 

ah so yeah the geometry i gave you was from booting the pen drive, i tried hd0 hd1 fd0 and fd1 but only those above were outputted.


Edited by Pockets69, 16 February 2016 - 04:27 PM.


#290 steve6375

steve6375

    Platinum Member

  • Developer
  • 7053 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 16 February 2016 - 06:58 PM

very, very old version!

Use 2016-02-15 0.4.6a

http://grub4dos.chen...ries/downloads/

 

(beware some versions have bugs, so only use recommended version!)



#291 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 16 February 2016 - 10:50 PM

The batch has a "safety" measure preventing it from writing it to first disk (disk 0).

 

In theory the batch should have stopped with a message:

The Physicaldrive number was not provided or it is invalid: 0

Batch aborted ...

 

in practice I somehow omitted a specific check or more generally messed it up :frusty: and the result is seemingly that the batch wrote everything to a file named "0". :w00t: :ph34r:

I will need to make a better check routine to avoid this.

 

 To allow it to write to first disk, you need to open the batch file in notepad and change a line:

 

::For some (minimal) safety reason, \\.\PhysicalDrive0 (first disk) is not selectable
::you will need to change line below to SET MinDisk=0
SET MinDisk=1

 

 

:duff:

Wonko



#292 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 17 February 2016 - 11:09 AM

Ok cool Jaclaz, here is what i am going to do, Ill first install your script on the pen drive again, (like i did accidentally on the first time) and run the geometry commands on the hd0 hd1 hdwhatever, everywhere i can, and since steve6375 linked a newer version of grub i am sure i can get you the output you need..

I ll then post the output here.

Then Ill install your script on the hard disk, and see if i can boot it from the hard disk (which i doubt but hey! it doesn't hurt to try)

Finally ill try to install memdisk on ubuntu and see if i can mount something with it, let's hope something happens.

If all fails i guess ill keep booting from the pen drive.

EDIT:
god damn it! the grub package linked by steve doesn't have the grldr file?! what the hell?

EDIT2:
Yeah great i don't have compilation tools on my machine, i already saw that the linked grub is the source not the binary, can someone please provide me a compiled grldr, if it's not too much to ask.

Edited by Pockets69, 17 February 2016 - 11:43 AM.


#293 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 17 February 2016 - 12:28 PM

You guys need to allow edits forever, i wanted to edit my post but can't :(

 

anyway the syslinux thing with memdisk doesn't work.

 

the efi bootloader loading the vhd is a no go, i did 

linux16 /boot/syslinux/memdisk harddisk raw

initrd16 (hd0,gpt7)/bootmgr.vhd

 

no errors but nothing happened

 

i tried the command boot, and it got stuck, it doesn't load.

 

so grub efi chainloading bootmgr from a vhd is a no go.

 

now i just need (if you would be so kind) the compiled grldr so i can try the geometry commands.


Edited by Pockets69, 17 February 2016 - 12:31 PM.


#294 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 17 February 2016 - 04:24 PM

Download this:

http://dl.grub4dos.c...a-2016-02-15.7z

this is the compiled version.

On the page:

http://grub4dos.chen....6a-2016-02-15/

the .zip is the source, the .7z is the compiled release.

 

:duff:

Wonko



#295 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 17 February 2016 - 05:20 PM

Again sorry Jaclaz, but now grldr is launching but the menu.lst is like infinite scrolling down, and i don't get a menu, it just keeps scrolling down forever and i get a pink screen -.-

 

I really wanted to get you the geometry commands, but as it stands, every little thing is against me.

 

Nothings seems to work.

 

Thank you so much for the patience and the help, but i don't think this is going to work, unless you have any idea... 



#296 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 17 February 2016 - 05:42 PM

No particular idea, but it is possible that the version of grldr suggested by Steve6375 is "too new" to work in this case.

On the "other" thread:

http://reboot.pro/to...drive/?p=197255

an older version was tested successfully, try that one:

http://dl.grub4dos.c...a-2013-10-17.7z

or try one of the "more conservative" 0.4.5c versions, like this one:

http://dl.grub4dos.c...c-2014-01-17.7z

which is the one with which I partially tested the batch.

 

However, when the menu.lst is loaded (scrolling or not) pressing the "c" key should bring you to plain command line mode.

 

:duff:

Wonko



#297 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 17 February 2016 - 05:44 PM

will try those.

yes i tried C and esc every single possible key i could come up with to just get terminal/grub cmd it didn't work.

EDIT:
That file worked thanks a lot Jaclaz

 

ok so here are the geometry(hd0)

 

drive 0x80(LBA): C/H/S=121602/255/63, Sector Count/size=1923536130/512

 

partition num: 0, Filesystem type is fat32, partition type 0xEE (EFI)

partition num: 1, Filesystem type is fat32, partition type 0xEE (Empty)

partition num: 3, Filesystem type is unknown, partition type 0xEE (OS X hfs+)

partition num: 4, Filesystem type is unknown, partition type 0xEE (Recovery OS X hfs+)

partition num: 5, Filesystem type is ntfs, partition type 0xEE (Windows 8.1)

partition num: 6, Filesystem type is ntfs, partition type 0xEE (Windows 7)

partition num: 7, Filesystem type is ext2fs, partition type 0xEE (Elementary OS ext4)

partition num: 8, Filesystem type is fat32, partition type 0xEE (Empty)

partition num: 9, Filesystem type is fat32, partition type 0xEE (Empty)

partition num: 10, Filesystem type is ext2fs, partition type 0xEE (Arch ext4)

partition num: 11, Filesystem type is fat32, partition type 0xEE (Empty)

partition num: 12, Filesystem type is fat32, partition type 0xEE (Empty)

partition num: 13, Filesystem type is ext2fs, partition type 0xEE (Ubuntu ext4)

partition num: 14, Filesystem type is unknown, partition type 0xEE (swap)

 

this is a sketch of my setup some oss are not instaled, because they were irrelevant for my tests that's why there are so many empty partitions, there is a skip from 1 to 3 that partition 2 is the 127mb MSR, don't know why it wasn't shown.

 

geometry (fd0)

 

drive 0x00(LBA): C/H/S=1/255/63, Sector Count/Size=16250560/512

partition num: 0, active, Filesystem type is fat32, partition type 0x0c

Fylesystem type is fat12, using whole disk

 

EDIT 2

 

So I tried your script, on the hdd by changing the parameter you mentioned above, it now asks me to confirm if i want to write to sectors 63-2047 of physicalDrive0

 

I type YES and it says writting image

\\.\Physicaldrive0 - Access is denied 

 

this is obviously running cmd as administrator.


Edited by Pockets69, 17 February 2016 - 06:40 PM.


#298 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15014 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 19 February 2016 - 07:27 AM

The output of geometry for (hd0) is seemingly OK, but that seems the "main" hard disk.

 

Normally (on a PC, the Mac may behave differently), when you boot from the USB disk, disk order is shifted, so that:

When booting from internal hard disk:

  • internal hard disk is first disk or drive 0x80 or (hd0)

whilst when booting from USB:

  • USB disk is first disk or drive 0x80 or (hd0)
  • internal hard disk is second disk or drive 0x81 or (hd1)

Can you verify the output of geometry (hd1) (when you boot from the pendrive)?

 

Access is denied on \\Physicaldrive0 should mean that some kind of "lock" (from the OS) is preventing access to some parts of the disk, it's unusual, as normally event the various 7/8+/and 10 don't normally lock that area.

Are you POSITIVE (i.e. did you actually check with Gdisk or similar) that the area from sector 63 to sector 2047 is actually NOT used by some of the GPT partitions/structures?

Usually the first partition on a GPT disk starts on sector 2048 and the GPT partition table ends on sector 32, but maybe, your disk has been partitioned/formatted in such a way that that area is occupied by *something* and the OS locks it. 

 

Once you have DOUBLE CHECKED that this is not the case, if your OS (it may also be some running anti-virus or similar tool) still locks the area, you can use alternative methods to write the image and the MBR code.

 

Since you have Linux available, you can manually deploy the image and the MBR, this snippet:

ECHO Writing the image ...
dsfi \\.\Physicaldrive%PhysDN% 32256 1016320 %ImgName%
ECHO.
ECHO Writing the special MBR ...

IF NOT EXIST HidGPT63.mbr CALL :Missing HidGPT63.mbr&GOTO :EOF

IF EXIST GPTMBR.mbr DEL GPTMBR.mbr

dsfo \\.\Physicaldrive%PhysDN% 0 512 GPTMBR.mb
dsfi GPTMBR.mbr 0 432 HidGPT63.mbr
dsfi \\.\Physicaldrive%PhysDN% 0 512 GPTMBR.mbr

can be done in Linux with dd (or even in grub4dos, if you boot from it).

Linux:

dd if=/myimage.img of=/dev/sda bs=1 seek=32256

dd if=/dev/sda of=/GPTMBR.mbr bs=1 count=512

dd if=/HidGPT63.mbr of=/GPTMBR.mbr bs=1 count=432

dd if=/GPTMBR.mbr of=/dev/sda  bs=1 count=512

 

grub4dos:

dd if=/myimage.img of=(hd0) bs=1 seek=32256

dd if=(hd0) of=/GPTMBR.mbr bs=1 count=512

dd if=/HidGPT63.mbr of=/GPTMBR.mbr bs=1 count=432

dd if=/GPTMBR.mbr of=(hd0)  bs=1 count=512

 

Be very careful identifying the correct hard disk.

 

:duff:

Wonko



#299 serpens

serpens
  • Members
  • 6 posts
  •  
    Canada

Posted 20 February 2016 - 04:14 PM

 

There are two things that potentially lead to this error message. The first is an attempt to read FirmwareBootDevice from the registry. This seems to be rewritten each boot. Copying SystemBootDevice over this key, then running bcdedit again leads to the following:

#	Time of Day	Thread	Module	API	Return Value	Error	Duration
185	11:42:31.534 AM	1	bcdedit.exe	NtQuerySystemInformation ( SystemSystemPartitionInformation, NULL, 0, 0x000000af5126f3b8 )	STATUS_SYSTEM_DEVICE_NOT_FOUND	0xc0000452 = The requested system device cannot be found. 	0.0006614
...
353    11:42:31.565 AM    1    bcdedit.exe    RtlNtStatusToDosError ( STATUS_SYSTEM_DEVICE_NOT_FOUND )    ERROR_SYSTEM_DEVICE_NOT_FOUND        0.0000014
...
356    11:42:31.565 AM    1    KERNELBASE.dll    RtlFormatMessageEx ( "The requested system device cannot be found.
", 0, TRUE, FALSE, FALSE, NULL, "籰兀¯", 94, 0x000000af5126f36c, 0x000000af5126f3a8 )    STATUS_SUCCESS        0.0000019

 

 

Another interesting point, I copied my installation onto an MBR disk, deleted /boot, rebuilt the records using bcdboot, deleted MountedDevices from the registry and rebooted.

 

Once booted, I re-ran bcdedit /enum all, and discovered that it did not issue NtQuerySystemInformation.



#300 Pockets69

Pockets69

    Newbie

  • Members
  • 26 posts
  •  
    United States

Posted 20 February 2016 - 11:04 PM

Hey Jaclaz :)

 


The output of geometry for (hd0) is seemingly OK, but that seems the "main" hard disk.
 
Normally (on a PC, the Mac may behave differently), when you boot from the USB disk, disk order is shifted, so that:
When booting from internal hard disk:
  • internal hard disk is first disk or drive 0x80 or (hd0)
whilst when booting from USB:
  • USB disk is first disk or drive 0x80 or (hd0)
  • internal hard disk is second disk or drive 0x81 or (hd1)
Can you verify the output of geometry (hd1) (when you boot from the pendrive)?
 
I tried it back then when I listed the hd0 and fd0, says hd1 doesn't exist or it is not present can't remember exactly.
 
So booting from the pen drive it lists hd0 as 0x80 so we can assume it behaves differently on a mac.
 
Yes apparently there should be some lock on the drive i don't know why, I don't know if because i am booting from the pen drive (since the bootmgr is there) when I try to run your script it somehow craps out.
 
So I just checked gdisk and apparently yeah those sectors are occupied by EFI system partition, my EFI partition starts at sector 40 and ends at sector 409639, I use gparted and move it forward in order to free the sectors.
Tried to run the script, no errors it worked, booted into ubuntu to see if gdisk or gparted detetcted the new partition, it doesn't is it supposed to be like this?
 
No no antivirus or anything, this is just a experimental setup so the OS are in default condition almost, it only has bootcamp drivers for the macbook hardware.
 
Since i was not sure even though the script worked and gave no errors, but nothing was listed on gparted and gdisk, I dd'd stuff over following your instructions, after that and a reboot, gdisk and gparted saw nothing new, for them that partition doesn't exist, again is it supposed to be like that?
 
Then there is the problem even though the partition may be there (even if the programs can't see it) I can't boot from it, it's impossible on the macbook to boot from a legacy partition on disk unfortunately.
 
The method with a pen drive attached constantly has to suffice for me.
 
Thank you so much for the patience and help Jaclaz :)
 
This was fun :)






Also tagged with one or more of these keywords: bios, gpt, bootmgr, winload

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users