Jump to content











Photo
- - - - -

Create a windows system from scratch using Linux


  • Please log in to reply
98 replies to this topic

#76 erwan.l

erwan.l

    Gold Member

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

Posted 24 May 2015 - 11:20 AM

Update - information in my previous post applies to the bcdedit version included with Windows 8.1 - just completed a quick test using the Windows 7 (SP1) version and it didn't work -

 

Hi Misty,

 

Tested your batch.

I can bcdedit the generated bcd both on win8.1 and win7 without errors.

 

One extra item I found out : when you use regedit or offlinereg to generate the bcd, the value in description key matter.

It has to be Type=269484034 for the "boot manager" entry and Type=270532611 for the windows entry.

I could not find (yet) any documentation for this description key.

 

Attaching an updated batch using offlinereg which generates a bcd identical to yours.

 

Cheers,

Erwa,

Attached Files



#77 misty

misty

    Silver Member

  • Developer
  • 667 posts
  •  
    United Kingdom

Posted 24 May 2015 - 05:12 PM

@erwan.l
Which file version of bcdedit.exe are you using on your Windows 7 system? I tried using the batch I posted again - in Windows 7 (SP1) with bcdedit.exe (Product Version 6.1.7601.17514) and received the same error I reported in post #75.

#78 erwan.l

erwan.l

    Gold Member

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

Posted 24 May 2015 - 05:15 PM

my windows 7 version : Microsoft Windows [version 6.1.7601] .

my bcdedit version : 6.1.7601.17514 .



#79 misty

misty

    Silver Member

  • Developer
  • 667 posts
  •  
    United Kingdom

Posted 24 May 2015 - 05:30 PM

...my bcdedit version : 6.1.7601.17514 .

So we appear to be using the same bcdedit version - yours runs the batch without errors, mine doesn't :frusty:
 

One extra item I found out : when you use regedit or offlinereg to generate the bcd, the value in description key matter.
It has to be Type=269484034 for the "boot manager" entry and Type=270532611 for the windows entry.
I could not find (yet) any documentation for this description key.

This page might be useful - http://www.geoffchap...bcd/objects.htm. I certainly plan to investigate it further.

:cheers:

Regards,

Misty

#80 erwan.l

erwan.l

    Gold Member

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

Posted 24 May 2015 - 05:38 PM

So we appear to be using the same bcdedit version - yours runs the batch without errors, mine doesn't :frusty:
 
This page might be useful - http://www.geoffchap...bcd/objects.htm. I certainly plan to investigate it further.

:cheers:

Regards,

Misty

 

My bad, I misread you.

 

When running your batch, I do get the same error.

When testing the generated bcd (on win8.1) with bcdedit /store c:\test\bcd (on win 7), then it runs fine.

 

Sorry for the confusion :)



#81 misty

misty

    Silver Member

  • Developer
  • 667 posts
  •  
    United Kingdom

Posted 24 May 2015 - 05:44 PM

Thanks for reporting back and ending my confusion - and frustration :thumbsup:

:cheers:

#82 erwan.l

erwan.l

    Gold Member

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

Posted 30 May 2015 - 04:09 PM

Hi Guys,

 

Just reporting back that using the hivexsh package under ubuntu, I was able to read/write a BCD store.

The hivesh syntax can be found here.

 

Regards,

Erwan



#83 cheche

cheche
  • Members
  • 4 posts
  •  
    Spain

Posted 18 June 2016 - 01:53 AM

I know that this is an old topic, but it is the closest I could find that I would like to implement on an OSS project.
I am using http://unattended.so...e.net/index.phpto install windows XP/2003 from within linux.
I managed to add wimlib on the linuxboot and I was able to copy install.wim to (hd0,0)
 

wimlib-imagex apply /z/os/install.wim 1 /dev/sda1
# mount c
ntfs-3g /dev/sda1 /c
#copy files
cp -p /c/Windows/Boot/PCAT/bootmgr /c
mkdir /c/Boot
cp -p /c/Windows/Boot/DVD/BCD /c/Boot
cp -p /c/Windows/Boot/DVD/boot.sdi /c/Boot
cp -p /c/Windows/Boot/DVD/es-ES/bootfix.bin /c/Boot
date | md5sum |dd of=/dev/dsk bs=1 count=4 seek=440

 
but still. the windows stuff boot up I had an error  that I am unable to fix.



#84 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 18 June 2016 - 07:53 AM

Well, the "windows stuff" error is usually a BSOD with a number, but your report misses many details, can you try decribing fully your "plan", and what actually happens?

At first sight you are dd-ing the Md5 of the current date as the disk signature, but the BCD is seemingly a "standard" one, so how is it supposed to have the entry for the right disk/volume? :unsure:

Before that, which MBR code and bootsector/PBR code are you using? (if any) Or are you using a bootmanager?

Also why the boot.sdi if you are already applying the .wim?

And what would be the role of bootfix.bin? :dubbio:

:duff:
Wonkio

#85 cdob

cdob

    Gold Member

  • Expert
  • 1314 posts

Posted 18 June 2016 - 07:54 AM

the windows stuff boot up I had an error

Which error do you get?
How do you create the file /boot/bcd?
Do you always use /c/boot and /c/Windows, hence Windows and /boot at the same partition?

to install windows XP/2003 from within linux.

Windows XP/2003 dosn't use a install.wim, /bootmgr or /boot/bcd by default.
Can you clarify:
Do you like to install XP/2003? Which install.wim do you use?
Do you like to install Vista or later?

Edited by cdob, 18 June 2016 - 08:12 AM.


#86 cheche

cheche
  • Members
  • 4 posts
  •  
    Spain

Posted 18 June 2016 - 11:32 PM

Thanks Wonko and cdob,

At first I only copy the install.wim, but the I as getting an error about "bootmgr not found" so I decide to copy whatever was on the /boot folder.

 

The error I get is 0xc000000f

I would like to install windows7

yes, /windows and /boot are on the same partition. I thought that the only reason they are separate is to allow BitLocker which is not my case.

 

do you think that I should create a Boot partition?



#87 cheche

cheche
  • Members
  • 4 posts
  •  
    Spain

Posted 19 June 2016 - 12:23 AM

Ok. Searching about the error I got someone that suggest just to boot the system from the dvd and click repair. So I did, a suggestion to repair and restart pop up on the installation program. and after the restart the system could boot up from the HD and continue.

So I guess the I am using the wrong /boot/BCD or I need to modify that file within linux before reboot within the installation of windows.



#88 cdob

cdob

    Gold Member

  • Expert
  • 1314 posts

Posted 19 June 2016 - 06:07 AM

the wrong /boot/BCD or I need to modify that file within linux before reboot within the installation of windows.

cp -p /c/Windows/Boot/DVD/BCD /c/Boot

Strange a default uses \Windows\Boot\DVD\PCAT\BCD
This is for installation from a DVD, won't match.

Keep one parttion. Create a generic bcd file yourself first at running windows.
http://reboot.pro/to...ux/#entry192138
This approach uses the device boot. Distribue this file in future.

#89 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 19 June 2016 - 11:06 AM

cp -p /c/Windows/Boot/DVD/BCD /c/Boot

Strange a default uses \Windows\Boot\DVD\PCAT\BCD
This is for installation from a DVD, won't match.

Keep one parttion. Create a generic bcd file yourself first at running windows.
http://reboot.pro/to...ux/#entry192138
This approach uses the device boot. Distribue this file in future.

Yes and no :w00t:, I mean the topic is (mostly) about modifying a \boot\BCD entirely from Linux, it is fine at either experimenting or at quickly fixing an issue of course :) but the real fun would be to do everything "natively" in Linux, the OP just threw the question on the board, but never followed the evolution of the thread or however failed to come back posting a report, but all the needed info to directly edit a BCD from Linux should be already on the thread and erwan.l actually reported his successes with hiveshx, so all it is missing (from some of the good Linux guys) is to provide some bash (or whatever) script/helper to edit the "standard" BCD on a DVD to have a setting for either the "boot" or "locate" or "custom" target.

:duff:
Wonko

#90 cdob

cdob

    Gold Member

  • Expert
  • 1314 posts

Posted 19 June 2016 - 10:10 PM

script/helper to edit the "standard" BCD on a DVD to have a setting for either the "boot" or "locate" or "custom" target.

Copy a default DVD installaiton BCD and set:
device boot
osdevice boot
winpe no

cp /c/Windows/Boot/DVD/PCAT/BCD /c/Boot/BCD
hivexsh -w /c/Boot/BCD -f generic_boot

generic_boot
cd \Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\11000001
setval 1
Element
hex:3:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,00,00,00,00,00,00,00,48,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
lsval
cd \Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\21000001
setval 1
Element
hex:3:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,00,00,00,00,00,00,00,48,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
lsval
cd \Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\26000022
setval 1
Element
hex:3:00
lsval
commit
unload
This assumes: {7619dcc9-fafe-11d9-b411-000476eba25f} is generic to installation DVD bcd.
Has to be verified.

@cheche
Can you verify your bcd file?
cp /c/Windows/Boot/DVD/PCAT/BCD /c/Boot/bcd.dvd
bcdedit.exe /enum all /store c:\boot\bcd.dvd /v

#91 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 20 June 2016 - 06:16 AM

This assumes: {7619dcc9-fafe-11d9-b411-000476eba25f} is generic to installation DVD bcd.
Has to be verified.

According to a certain cdob ;), it is fixed since Vista and up to 10 (though some of the good MS guys seemingly forgot to mark it as {ramdiskoptions} lately) :w00t::
http://reboot.pro/to...in-the-dvd-bcd/

 

Nice script, BTW :).

:duff:
Wonko
 



#92 cheche

cheche
  • Members
  • 4 posts
  •  
    Spain

Posted 20 June 2016 - 11:41 PM

Hi,

I have got mixed results. After the hivexsh modifications, I am able to start the installation process. nice!.

But after the system start configuring services I had got this error:

"The Windows installation program is unable to configure Windows to execute on the hardware of this system"

This Time loading the DVD on the system and loading the "repair system" option did not fix that error.

 

I am using 64Bit,Windows 7 Professional SP1-U ISO

bcdedit.exe /enum all /store bcd.dvd /v
Administrador de arranque de Windows
----------------------------------
Identificador           {9dea862c-5cdd-4e70-acc1-f32b344d4795}
description             Windows Boot Manager
locale                  en-US
inherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
default                 {7619dcc9-fafe-11d9-b411-000476eba25f}
displayorder            {7619dcc9-fafe-11d9-b411-000476eba25f}
toolsdisplayorder       {b2721d73-1db4-4c62-bf78-c548a880142d}
timeout                 30

Cargador de arranque de Windows
-----------------------------
Identificador           {7619dcc9-fafe-11d9-b411-000476eba25f}
device                  ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
path                    \windows\system32\boot\winload.exe
description             Windows Setup
locale                  en-US
inherit                 {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
osdevice                ramdisk=[boot]\sources\boot.wim,{7619dcc8-fafe-11d9-b411-000476eba25f}
systemroot              \windows
detecthal               Yes
winpe                   Yes
ems                     Yes

Herramienta de comprobaci¢n de memoria de Windows
-------------------------------------------------
Identificador           {b2721d73-1db4-4c62-bf78-c548a880142d}
device                  boot
path                    \boot\memtest.exe
description             Windows Memory Diagnostic
locale                  en-US
inherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}

Configuraci¢n de EMS
--------------------
Identificador           {0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9}
bootems                 Yes

Configuraci¢n del depurador
---------------------------
Identificador           {4636856e-540f-4170-a130-a84776f4c654}
debugtype               Serial
debugport               1
baudrate                115200

Configuraci¢n global
--------------------
Identificador           {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
inherit                 {4636856e-540f-4170-a130-a84776f4c654}
                        {0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9}

Configuraci¢n del cargador de arranque
------------------------------------
Identificador           {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
inherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
                        {7ff607e0-4395-11db-b0de-0800200c9a66}

Configuraci¢n de hipervisor
-------------------
Identificador           {7ff607e0-4395-11db-b0de-0800200c9a66}
description             Hypervisor Settings
hypervisordebugtype     Serial
hypervisordebugport     1
hypervisorbaudrate      115200

Opciones de dispositivo
-----------------------
Identificador           {7619dcc8-fafe-11d9-b411-000476eba25f}
ramdisksdidevice        boot
ramdisksdipath          \boot\boot.sdi

Here I will copy the contents of the BCD.fixed that worked on my system.

bcdedit.exe /enum all /store bcd.fixed /v

Administrador de arranque de Windows
----------------------------------
Identificador           {9dea862c-5cdd-4e70-acc1-f32b344d4795}
device                  unknown
path                    \bootmgr
description             Windows Boot Manager
locale                  es-ES
default                 {db868518-35f9-11e6-943c-824243aa65b0}
displayorder            {db868518-35f9-11e6-943c-824243aa65b0}
timeout                 30

Cargador de arranque de Windows
-----------------------------
Identificador           {db868518-35f9-11e6-943c-824243aa65b0}
device                  unknown
path                    \Windows\system32\winload.exe
description             Windows 7 Professional (recuperado)
locale                  es-ES
recoverysequence        {db868519-35f9-11e6-943c-824243aa65b0}
recoveryenabled         Yes
osdevice                unknown
systemroot              \Windows
resumeobject            {81b53df1-35f1-11e6-9ab7-806e6f6e6963}

Cargador de arranque de Windows
-----------------------------
Identificador           {db868519-35f9-11e6-943c-824243aa65b0}

Reanudar tras hibernaci¢n
-------------------------
Identificador           {81b53df1-35f1-11e6-9ab7-806e6f6e6963}
device                  unknown
path                    \Windows\system32\winresume.exe
description             Windows 7 Professional (recuperado)
locale                  es-ES
inherit                 {1afa9c49-16ab-4a5c-901b-212802da9460}
filedevice              unknown
filepath                \hiberfil.sys
debugoptionenabled      No

Herramienta de comprobaci¢n de memoria de Windows
-------------------------------------------------
Identificador           {b2721d73-1db4-4c62-bf78-c548a880142d}
device                  unknown
path                    \boot\memtest.exe
description             Windows Memory Diagnostic
locale                  es-ES

Opciones de dispositivo
-----------------------
Identificador           {db86851a-35f9-11e6-943c-824243aa65b0}
description             Ramdisk Options
ramdisksdidevice        unknown
ramdisksdipath          \Recovery\db868519-35f9-11e6-943c-824243aa65b0\boot.sdi




#93 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 21 June 2016 - 12:58 PM

 

 

But after the system start configuring services I had got this error:

"The Windows installation program is unable to configure Windows to execute on the hardware of this system"

 

 

 

Well, but maybe you are mixing two things from what I understand. :unsure:

 

Does the procedure (with the edited BOOTMGR) works with a pristine, unmodified source DVD or is this latter modified by *anything*? 

 

The error should be :dubbio::

Windows Setup could not configure Windows on this computer’s hardware”

(maybe you backtranslated it form Spanish) and tells us very little or "nothing":

https://support.micr...n-us/kb/2466753

Check the setuperr.log and setupact.log as per above and post the errors you find there (if any).

 

:duff:

Wonko



#94 cdob

cdob

    Gold Member

  • Expert
  • 1314 posts

Posted 21 June 2016 - 04:59 PM

I had got this error:
"The Windows installation program is unable to configure Windows to execute on the hardware of this system"


Good catch. I get this with generice bcdedit.exe boot bcd too.
http://reboot.pro/to...ux/#entry192138

Soemthing is missing to satisfy windows setup: maybe the Hibernation entry?

#95 cdob

cdob

    Gold Member

  • Expert
  • 1314 posts

Posted 23 June 2016 - 05:31 PM

Soemthing is missing to satisfy windows setup: maybe the Hibernation entry?

http://reboot.pro/to...e-7#entry192902

Generic.BCD.Store.cmd http://reboot.pro/to...ux/#entry192138
And bcd adjusted
reg load HKLM\BCD BCD
reg add HKLM\BCD\Description /v System /t REG_DWORD /d 0x1 /f
reg add HKLM\BCD\Description /v KeyName /t REG_SZ /d "BCD00000000" /f
reg unload HKLM\BCD
Windows setup does finish.

#96 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 23 June 2016 - 05:55 PM

http://reboot.pro/to...e-7#entry192902

Generic.BCD.Store.cmd http://reboot.pro/to...ux/#entry192138
And bcd adjusted

reg load HKLM\BCD BCD
reg add HKLM\BCD\Description /v System /t REG_DWORD /d 0x1 /f
reg add HKLM\BCD\Description /v KeyName /t REG_SZ /d "BCD00000000" /f
reg unload HKLM\BCD
Windows setup does finish.

 

Ok, I lost you *somewhere*. :w00t: :ph34r:

 

We are still in the "using Linux" thread.

 

Can you explain what you added/changed when compared to the previous non-working setup?

And optionally translate that in hivexsh commands?

 

:duff:

Wonko



#97 cdob

cdob

    Gold Member

  • Expert
  • 1314 posts

Posted 23 June 2016 - 09:51 PM

We are still in the "using Linux" thread.

Yes, but I investigate at OS installation native tools.
 

Can you explain what you added/changed when compared to the previous non-working setup?

Add a key \Description\System.
It's not part of a DVD bcd file and not part of bcdedit createstore.
 

And optionally translate that in hivexsh commands?


Copy a default DVD installation BCD file. And set:
\Description\System 1
{default}device boot
{default}osdevice boot
{default}delete winpe
 
### BIOS: adjust to local boot, one primary active parttion
### cp /c/Windows/Boot/DVD/PCAT/BCD /c/Boot/BCD
### UEFI
### cp /c/Windows/Boot/DVD/EFI/BCD /s/EFI/Microsoft/Boot/BCD
### hivexsh -w /c/Boot/BCD -f generic_boot
###
### verify bcd: list {bootmgr} default entry ###
cd \Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\23000003
lsval
######################################
### select default {default} entry ###
cd \Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements
### /set device boot: ###
cd 11000001
setval 1
Element
hex:3:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,00,00,00,00,00,00,00,48,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
###
### /set device locate path:
### setval 1
### Element
### hex:3:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,00,00,00,00,00,00,00,1e,00,00,00,00,00,00,00,00,00,00,00,02,00,00,12,00,00,00,00,00,00
lsval
### BIOS: /set path \windows\system32\winload.exe ###
cd ..\12000002
setval 1
Element
string:\windows\system32\winload.exe
### UEFI:
### setval 1
### Element
### string:\windows\system32\winload.efi
lsval
### /set description ###
cd ..\12000004
setval 1
Element
string:Windows boot
lsval
### /set osdevice ###
cd ..\21000001
### /set osdevice boot:
setval 1
Element
hex:3:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,05,00,00,00,00,00,00,00,48,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
### /set osdevice locate path:
### setval 1
### Element
### hex:3:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,08,00,00,00,00,00,00,00,1e,00,00,00,00,00,00,00,00,00,00,00,02,00,00,12,00,00,00,00,00,00
lsval
cd ..
### delete winpe ###
cd 26000022
del
### delete ems ###
cd 260000b0
del
####################################
### add System and unify KeyName ###
cd \Description 
setval 2
KeyName
string:BCD00000000
System
dword:1
lsval
### delete \boot\boot.sdi section ###
cd \Objects\{7619dcc8-fafe-11d9-b411-000476eba25f}
del
ls
commit
unload
Some comments added.

Edited by cdob, 25 June 2016 - 01:56 PM.


#98 Wonko the Sane

Wonko the Sane

    The Finder

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

Posted 24 June 2016 - 08:15 AM

I see now, very good :).

I wonder if the "script" file could contain some comments (lines wit h a prefix like REM or \\* or ; or :: ) to make it more readable.

Or maybe it could be "enclosed" in a bash script that generates the hiveshx file so that the commands can be commented/documented.

 

:duff:

Wonko

 

 



#99 cdob

cdob

    Gold Member

  • Expert
  • 1314 posts

Posted 25 June 2016 - 02:09 PM

I wonder if the "script" file could contain some comments

Done.
And added some hints for locate approach: useful at BIOS and UEFI mode.
The path file \windows\system32\winload.* is used as tag file.
Prefered at one windows installation at the machine. May fail at multi boot windows installations.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users