{"id":1638,"date":"2015-05-17T19:09:47","date_gmt":"2015-05-17T17:09:47","guid":{"rendered":"http:\/\/labalec.fr\/erwan\/?p=1638"},"modified":"2015-05-17T19:12:17","modified_gmt":"2015-05-17T17:12:17","slug":"a-universal-bcd-boot-configuration-data","status":"publish","type":"post","link":"https:\/\/labalec.fr\/erwan\/?p=1638","title":{"rendered":"A \u00ab\u00a0universal\u00a0\u00bb BCD (boot configuration data)"},"content":{"rendered":"<p>Read <a href=\"http:\/\/reboot.pro\/topic\/20468-create-a-windows-system-from-scratch-using-linux\/\" target=\"_blank\">here<\/a> for an interesting thread over reboot.pro.<\/p>\n<p>One issue is the BCD is that it is normally linked to one hard drive since it contains (hard coded) the <strong>disk id<\/strong>.<br \/>\nThe boot manager will assume winload.exe sits on a specific disk\/partition.<br \/>\nMeaning you cannot re use it on another system : you have to generate it for each drive using bcdedit command line.<br \/>\nIn some cases like automating, cloning, preping, etc, it can be a stopper.<\/p>\n<p>One alternative is to use the <strong>\u00ab\u00a0boot\u00a0\u00bb<\/strong> keyword.<br \/>\nYou can then re use this bcd from one disk to the other with one constraint thus : you need to have one unique partition (whereas the windows setup will usually creates 2 partition : a hidden\/boot one and a system one).<br \/>\nThe boot manager will then assume winload.exe sits on the boot partition.<br \/>\nSee below the code to create such a \u00ab\u00a0boot\u00a0\u00bb bcd.<\/p>\n<p><code><br \/>\n@echo off<br \/>\n:_start<\/p>\n<p>::_____________________________________________________________<\/p>\n<p>setlocal<br \/>\nset LABEL=Windows<br \/>\nset BCDEDIT=bcdedit.exe<br \/>\nset BCDSTORE=%~dp0BCD<\/p>\n<p>cls<br \/>\nEcho Creating store...<br \/>\n%BCDEDIT% \/createstore %BCDSTORE%<br \/>\necho.<br \/>\necho.<\/p>\n<p>Echo Creating bootmgr entry...<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/create {bootmgr}<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {bootmgr} description \"Boot Manager\"<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {bootmgr} device boot<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set {bootmgr} timeout 20<br \/>\necho.<br \/>\necho.<\/p>\n<p>Echo Adding Windows entry...<br \/>\nfor \/f \"tokens=2 delims={}\" %%g in ('%BCDEDIT% \/store %BCDSTORE% \/create \/d %LABEL% \/application osloader') do set guid={%%g}<br \/>\necho guid=%guid%<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% device boot<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% path \\Windows\\system32\\winload.exe<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% osdevice boot<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/set %guid% systemroot \\Windows<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/displayorder %guid% \/addlast<br \/>\n%BCDEDIT% \/store %BCDSTORE% \/default %guid%<br \/>\necho.<br \/>\necho.<br \/>\nendlocal<br \/>\npause<br \/>\n:_end<br \/>\n<\/code> <\/p>\n<p>One last alternative is to use the less documented <strong>\u00ab\u00a0locate\u00a0\u00bb<\/strong> keyword.<br \/>\nThe boot manager will actually search for a specific file\/folder and chain winload.exe from the partition containing that file\/folder.<br \/>\nGet the batch to generate this BCD <a href=\"http:\/\/reboot.pro\/index.php?app=core&#038;module=attach&#038;section=attach&#038;attach_id=15590\" target=\"_blank\">here<\/a>.<br \/>\nIt should give you a bcd looking like the below.<\/p>\n<p><code><br \/>\nbcdedit \/store c:\\temp\\bcd.dat<br \/>\nidentificateur          {bootmgr}<br \/>\ndevice                  locate=unknown<br \/>\ndescription             Boot Manager<br \/>\ncustom:23000003         {default}<br \/>\ncustom:24000001         {default}<br \/>\ncustom:25000004         20<br \/>\nidentificateur          {default}<br \/>\ndevice                  locate=\\\\Windows\\\\system32\\\\winload.exe<br \/>\npath                    \\\\Windows\\\\system32\\\\winload.exe<br \/>\ndescription             Windows<br \/>\ncustom:21000001         locate=\\\\Windows<br \/>\ncustom:22000002         \\\\Windows<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Read here for an interesting thread over reboot.pro. One issue is the BCD is that it is normally linked to one hard drive since it contains (hard coded) the disk id. The boot manager will assume winload.exe sits on a specific disk\/partition. Meaning you cannot re use it on another system : you have to <a href='https:\/\/labalec.fr\/erwan\/?p=1638' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-1638","post","type-post","status-publish","format-standard","hentry","category-boot","category-16-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1638"}],"version-history":[{"count":3,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1638\/revisions"}],"predecessor-version":[{"id":1641,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=\/wp\/v2\/posts\/1638\/revisions\/1641"}],"wp:attachment":[{"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labalec.fr\/erwan\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}