Jump to content











Photo
- - - - -

Possible to install grub4dos to mbr from 64bit Windows PE?


  • Please log in to reply
11 replies to this topic

#1 ndog37

ndog37

    Member

  • Members
  • 88 posts
  •  
    New Zealand

Posted 13 November 2017 - 02:09 AM

Hi

 

I am wondering if there is either a 64bit version of grubinst.exe or another way of installing grub4dos from a 64bit windows PE environment, I typically use the following command from a 32bit windows PE, but ideally I would like to run it from a 64bit PE so I can integrate into an AIO toolbox type environment.

 

install.cmd

"x:\grub4dos\grubinst.exe" --no-backup-mbr -t=0 -v (hd0)
copy /y "x:\grub4dos\grldr" d:
copy /y "x:\grub4dos\default" d:
copy /y "x:grub4dos\menu.lst" d:

 


Edited by ndog37, 13 November 2017 - 02:22 AM.


#2 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 13 November 2017 - 09:14 AM

You mean a 64 bit PE without WOW64 (i.e. 32 bit support)? :unsure:

 

Why not self-installing it with dd?

 

We already talked about this, just for the record:

http://reboot.pro/to...os-bootable-cd/

 

Looky here:

http://reboot.pro/to...dows-and-linux/

 

the source code is available and should be re-compilable as 64 bit. :dubbio:

 

Still, maybe you can use some Windows 64-bit version of dd or similar to install it from the PE.

 

Or you can use bootice, that is available in 64 bit version and does have command line. 

http://bbs.wuyou.net...a=page=1&page=1

 

:duff:

Wonko



#3 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3042 posts
  • Location:Nantes - France
  •  
    France

Posted 13 November 2017 - 06:58 PM

Overall, writing a bunch of bytes (sector(s) to a hard drive should be independant of the installed OS or running OS.



#4 ndog37

ndog37

    Member

  • Members
  • 88 posts
  •  
    New Zealand

Posted 14 November 2017 - 12:11 AM

Thanks @wonko

 

I'm experimenting with grub4dos-0.4.5b-2012-01-16 - as it was the last version I could find which includes grldr.mbr

And the 64bit dd.exe suggested here - http://gmgsystemsinc.com/fau/

 

The options are different eg

of=(hd0) writes to a file called (hd0)

of=\\.\PhysicalDrive0 writes to the hard disk

and --localwrt switch is required

 

Now I'm having difficulty partitioning a drive the way I like and then installing the boot loader without overwriting the partition table

 

I've tried 

(first partition the drive to 2 partitions, copy grub required files to second partition)

dd.exe" if="x:\grub4dos\grldr.mbr" of=\\.\PhysicalDrive0 bs=440 count=1 --localwrt

however errors with

the input blocksize, 440, is not an integral multiple of the sector size, 512!Unable to copy file!

 

If I use

dd.exe" if="x:\grub4dos\grldr.mbr" of=\\.\PhysicalDrive0 count=1 --localwrt
then it completes successfully and installs the mbr properly, but wipes out the partitions

 

Is it possible to install grub4dos mbr to mbr without wiping the partitions?



#5 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 14 November 2017 - 04:09 AM

@ndog37

dd.exe if=\\.\PhysicalDrive0 of="x:\grub4dos\disk0.mbr" count=1 --localwrt
dd.exe if="x:\grub4dos\grldr.mbr" of="x:\grub4dos\disk0.mbr" bs=440 count=1 --localwrt
dd.exe if="x:\grub4dos\disk0.mbr" of=\\.\PhysicalDrive0 count=1 --localwrt
 
You can use the temporary file to compile 440 bytes of grldr.mbr and 72 bytes of Disk 0.

  • devdevadev likes this

#6 ndog37

ndog37

    Member

  • Members
  • 88 posts
  •  
    New Zealand

Posted 14 November 2017 - 04:38 AM

Thanks @nguyentu

 

I'm still getting error on the second line as you suggested

The input blocksize, 440, is not an integral multiple of the sector size, 512!There are no more files.

 

 

I'll try with different versions of grub4dos and dd.exe to see whether its a bug, or the windows PE environment etc


Edited by ndog37, 14 November 2017 - 04:39 AM.


#7 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 14 November 2017 - 07:30 AM

@ndog37 it works for me.


Edited by nguyentu, 14 November 2017 - 07:41 AM.


#8 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 14 November 2017 - 07:53 AM

You can try grldrins.

 

Usage:
grldrins64.exe \path\to\grldr.mbr DiskNumber

Example:

grldrins64.exe C:\grldr.mbr 2


#9 ndog37

ndog37

    Member

  • Members
  • 88 posts
  •  
    New Zealand

Posted 14 November 2017 - 11:41 AM

nguyentu 

Thanks for the grldrins tool it works well  

:D



#10 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 14 November 2017 - 12:57 PM

@ndog

Unrelated, but that is a seriously outdated grub4dos.

 

The "current/suggested" grub4dos is right now the 0.4.6.a 2017-08-30:

http://grub4dos.chen....6a-2017-08-30/

or (the previous branch "last") 0.4.5c-2016-01-18:

http://grub4dos.chen....5c-2016-01-18/

 

As a side not the dd.exe from the FAU has already been reported to have some "peculiar beaviour", but in any case the command line is "philosophically wrong", as the "bs=" parameter normally does not work that way. (the blocksize normally should be a power of 2).

Mind you, most probably a number of dd versions will accept bs=440 count=1 just fine, but in theory they shouldn't.

You can try with bs=1 count=440, but probably it won't work anyway with the FAU which is more a dedicated disk imaging tool than an actual dd.

 

Just for the record and FYI, I simply cannot bear the specific version/release (which has its own uses BTW), because - besides being a huge mass of bloat - it has this "feature" of attempting to translate itself into the OS language with results that in Italian are appalling, besides being extremely verbose and sometimes even "patronizing".

And given the endless amount of (possibly very useful in a few intended uses) of unneeded complications in the command line, it is simply not dd (anymore) but a totally dfferent program that tricks everyone into believing tht it is dd. :(

 

Issue is that I have no handy idea right now for a (stupid) 64 bit version of dd (or similar) apart the stupid (for further reasons besides the 64 bits) Cygwin one. :(

 

Most probably the Cygwin (64 bit version) would work nicely, but just like the 32 bit version:

http://reboot.pro/to...uest-for-ddexe/

getting it will be in itself a challenge. :frusty:

 

More or less you need (this is my 32 bit setup):

 

cygiconv-2.dll
cygintl-8.dll
cygwin1.dll
dd.exe

 

So you need to download (for 64 bit):

http://cygwin.mbware...s-8.26-2.tar.xz< dd.exe

http://cygwin.mbware...-2.9.0-3.tar.xz< cygwin1.dll

http://cygwin.mbware...conv/libiconv2/< cygiconv-2.dll

http://cygwin.mbware...19.8.1-2.tar.xz< cygintl-8.dll

 

To look for what files are in what package, you can use:

https://cygwin.com/c...ackage-grep.cgi

 

Even founding the above is in itself a challenge and of course it doesn't tell you that libintl8 is under gettext. :ranting2:

 

:duff:

Wonko



#11 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 14 November 2017 - 03:12 PM

@ndog37,

 

What is the value of your Disk Bytes Per Sector?
On Windows, the value of dd's bs parameter should be a multiple of Bytes Per Sector for physical drives.

 

File Buffering from Microsoft:

  • File access sizes, including the optional file offset in the OVERLAPPED structure, if specified, must be for a number of bytes that is an integer multiple of the volume sector size. For example, if the sector size is 512 bytes, an application can request reads and writes of 512, 1,024, 1,536, or 2,048 bytes, but not of 335, 981, or 7,171 bytes.
  • File access buffer addresses for read and write operations should be physical sector-aligned, which means aligned on addresses in memory that are integer multiples of the volume's physical sector size. Depending on the disk, this requirement may not be enforced.

Edited by nguyentu, 14 November 2017 - 03:13 PM.


#12 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 14 November 2017 - 05:21 PM

On Windows, the value of dd's bs parameter should be a multiple of Bytes Per Sector for physical drives.

Sure :), but not for files.

 

I.e. you can read (or write) no less than 512  bytes from PhysicalDrive, but this does not apply to files, so your suggested use of an intermediate file should be fine (but it doesn't work with FAU's dd because of its own peculiarities).

 

The set of commands you suggested works fine with the Cygwin's dd.exe (at least the 32 bit version), even the bs=440 count=1 is OK with it.

 

The later issue is that the grldr.mbr is not only one sector, so you need to later copy the remaining sectors, IMHO a more "proper" way is:

 

dd.exe if="x:\grub4dos\grldr.mbr" of="x:\grub4dos\disk0grldr.mbr" bs=512 count=16

dd.exe if=\\.\PhysicalDrive0 of="x:\grub4dos\disk0.mbr" bs=512 count=1

<optional> dd if="x:\grub4dos\disk0.mbr" of="x:\grub4dos\disk0grldr.mbr" bs=1 count=512 seek=512
dd.exe if="x:\grub4dos\disk0.mbr" of="x:\grub4dos\disk0grldr.mbr" bs=1 count=72 skip=440 seek=440 
dd.exe if="x:\grub4dos\disk0grldr.mbr" of=\\.\PhysicalDrive0 bs=512 count=16

 

(because at the end you already have a "monolithic" backup of the "customized" grldr.mbr).

 

The third command is "optional" because ndog37 (for whatever reasons) does not use the backup MBR on sector 2 of the grldr.mbr, and possibly one would want to to set a few bits, see:

http://reboot.pro/to...linux/?p=189578

 

 

:duff:

Wonko






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users