jpz4085 / bcd-sys Goto Github PK
View Code? Open in Web Editor NEWSetup the Windows BCD and boot files from Linux or macOS.
License: GNU General Public License v3.0
Setup the Windows BCD and boot files from Linux or macOS.
License: GNU General Public License v3.0
I am back with this Recovery\BCD Error:
I have tried several times, and the issue repeats.
Attached is the file from the error:
BCD.zip
Let me know any information you need or anything you would like to try.
Awesome work, thank you! But there are some things I would like to change (and eventually pitch it to you). Would you care to add a license to your code?
BCD-sys -help
The following packages are required: hivexregedit
How do I get hivexregedit
in macOS?
Hi,
I am trying to use your scripts in conjunction with .WIM images.
If possible, I would like to discuss this with you.
Let me know. Thanks!
i got some errors when run: bcd-sys -v /mnt/windows
where /mnt/windows is mount point to /dev/nvme0n1p3 (win part) and EFI part /dev/nvme0n1p1
DEBUG: Length=3, String=MUI
DEBUG: Length=11, String=BOOTMGR.XSL
DEBUG: Length=3, String=MUI
DEBUG: Length=11, String=BOOTMGR.XSL
sfdisk: cannot open /dev/nvme0n1p: No such file or directory
Update main BCD hive with new entries...
Loader GUID: {005a0c6e-67ad-4e92-99e9-a0546faf8732}
Resume GUID: {71992148-7aca-4e78-afc5-4742c3e3e41f}
sfdisk: cannot open /dev/nvme0n1p: No such file or directory
sfdisk: cannot open /dev/nvme0n1p: No such file or directory
sfdisk: cannot open /dev/nvme0n1p: No such file or directory
sfdisk: cannot open /dev/nvme0n1p: No such file or directory
Update recovery BCD hive with new entries...
Clean up temporary files...
Finished configuring UEFI boot files.
error is "/dev/nvme0n1p", should be "/dev/nvme0n1".
probably same with device /dev/mmcblk0
Hello,
We received the attached error after doing this script. This is a Windows 10 (build 17763).
Here is the log from this:
Get block device for mount point (sudo required later)...
/root/.hivexsh: Read-only file system
Remove entry at {cf4ca6b0-57e3-46f1-85ed-e8a96bd010e6}
/root/.hivexsh: Read-only file system
/root/.hivexsh: Read-only file system
Remove {cf4ca6b0-57e3-46f1-85ed-e8a96bd010e6} from WBM display order.
/root/.hivexsh: Read-only file system
/root/.hivexsh: Read-only file system
Remove entry at {d32da8ce-d3d7-4017-a889-79e9afc61bcf}
/root/.hivexsh: Read-only file system
/root/.hivexsh: Read-only file system
/root/.hivexsh: Read-only file system
Remove {d32da8ce-d3d7-4017-a889-79e9afc61bcf} from WBM resume object.
/root/.hivexsh: Read-only file system
Update main BCD hive with new entries...
/root/.hivexsh: Read-only file system
Loader GUID: {f697c3eb-534d-41f1-b3c4-816ccbf55481}
Resume GUID: {6371cb56-ea7f-4867-99a2-02d97ab025f9}
/root/.hivexsh: Read-only file system
/root/.hivexsh: Read-only file system
/root/.hivexsh: Read-only file system
Update recovery BCD hive with new entries...
/root/.hivexsh: Read-only file system
/root/.hivexsh: Read-only file system
Clean up temporary files...
Finished configuring UEFI boot files.
And here is the XML:
15371843041 109262 335963 41920901581 7696989766 0x01D8B2A8 0x8818FD5F 0x01D8B2A8 0x9C39C2D5 0 9 Microsoft® Windows® Operating System EnterpriseS Client 0 10.0.17763.2989;2016-01-01T00:00:00Z IMAGE_STATE_COMPLETE acpiapic WinNT Terminal Server en-US en-US 10 0 17763 3287 0 WINDOWS Factory_0 1 0 0 0 0x01D8B2A8 0x98BDFB35 0x01D8B2A8 0x9C3C254D 0 Factory_1 20-58977715 0 17 8 2022 15 16 2 0 0 99970187264 NTFS Factory_0 OS 2 3 0 0 4923064320 NTFS Factory_1 Imaging 2 5 3 0 6Let me know any feedback or needs.
Thanks!
Hello. I wrote to you there https://sourceforge.net/p/windows-install/discussion/general/thread/2fd478e439/?limit=25#ed25/cbdd/c114/1a05/5e38/eb08/67b0
But I think it’s convenient to communicate here.
I adapted the creation of BCD UEFI for the program and it works well. But there are difficulties with BCD BIOS.
This is an MBR disk
iMac:~ sergey$ diskutil info /Volumes/Windows
Device Identifier: disk6s1
Device Node: /dev/disk6s1
Whole: No
Part of Whole: disk6
Volume Name: Windows
Mounted: Yes
Mount Point: /Volumes/Windows
Partition Type: Windows_NTFS
File System Personality: ExFAT
Type (Bundle): exfat
Name (User Visible): ExFAT
OS Can Be Installed: No
Media Type: Общий
Protocol: USB
SMART Status: Not Supported
Volume UUID: 7F7C6600-E4EC-32D9-9064-A2DBA7EFCD2A
Partition Offset: 1048576 Bytes (2048 512-Byte-Device-Blocks)
Disk Size: 320.1 GB (320071532544 Bytes) (exactly 625139712 512-Byte-Units)
Device Block Size: 512 Bytes
Volume Total Space: 320.1 GB (320060129280 Bytes) (exactly 625117440 512-Byte-Units)
Volume Used Space: 11.3 MB (11272192 Bytes) (exactly 22016 512-Byte-Units) (0.0%)
Volume Free Space: 320.0 GB (320048857088 Bytes) (exactly 625095424 512-Byte-Units) (100.0%)
Allocation Block Size: 512 Bytes
Media OS Use Only: No
Media Read-Only: No
Volume Read-Only: No
Device Location: External
Removable Media: Fixed
Solid State: Info not available
I get:
iMac:~ sergey$ /Users/sergey/Desktop/test15 ; exit;
part - /dev/disk6s1
disk - /dev/disk6
FDisk_partition_scheme
Password:
Disk: /dev/disk6 geometry: 38913/255/63 [625142448 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 07 1023 254 63 - 1023 254 63 [ 2048 - 625139712] HPFS/QNX/AUX
2: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
FDisk_partition_scheme
disksig - 00000000
partoffset - 1048576
diskbytes - 00,00,00,00,00,00,00,00,00,00,00,00,0
partbytes - 00,00,10,00,00,00,00,00,00,00,00,00,00,00,00,00
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
GPT disk with hybrid MBR
iMac:~ sergey$ diskutil info /Volumes/Windows
Device Identifier: disk6s3
Device Node: /dev/disk6s3
Whole: No
Part of Whole: disk6
Volume Name: Windows
Mounted: Yes
Mount Point: /Volumes/Windows
Partition Type: Microsoft Basic Data
File System Personality: NTFS
Type (Bundle): ntfs
Name (User Visible): Windows NT File System (NTFS)
OS Can Be Installed: No
Media Type: Общий
Protocol: USB
SMART Status: Not Supported
Disk / Partition UUID: 0E7E4ACF-CE00-4595-B642-D972CDFEAB57
Partition Offset: 139829706752 Bytes (273104896 512-Byte-Device-Blocks)
Disk Size: 100.1 GB (100092870656 Bytes) (exactly 195493888 512-Byte-Units)
Device Block Size: 512 Bytes
Volume Total Space: 100.1 GB (100092866560 Bytes) (exactly 195493880 512-Byte-Units)
Volume Used Space: 11.1 GB (11061256192 Bytes) (exactly 21604016 512-Byte-Units) (11.1%)
Volume Free Space: 89.0 GB (89031610368 Bytes) (exactly 173889864 512-Byte-Units) (88.9%)
Allocation Block Size: 512 Bytes
Media OS Use Only: No
Media Read-Only: No
Volume Read-Only: Yes (read-only mount flag set)
Device Location: External
Removable Media: Fixed
Solid State: Info not available
I get:
iMac:~ sergey$ /Users/sergey/Desktop/test15 ; exit;
part - /dev/disk6s3
disk - /dev/disk6
GUID_partition_scheme
Password:
Disk: /dev/disk6 geometry: 29185/255/63 [468862128 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 0 0 2 - 25 127 14 [ 1 - 409639] <Unknown ID>
2: AF 25 127 15 - 1023 254 63 [ 409640 - 272431832] HFS+
*3: 07 1023 254 63 - 1023 254 63 [ 273104896 - 195493888] HPFS/QNX/AUX
4: 08 1023 254 63 - 1023 254 63 [ 272841472 - 263424] AIX fs
FDisk_partition_scheme
disksig - 00000000
partoffset - 139829706752
diskbytes - 00,00,00,00,00,00,00,00,00,00,00,00,0
partbytes - 00,00,80,8e,20,00,00,00,00,00,00,00,00,00,00,00
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Script-Test for testing
#!/bin/bash
endian () {
v=$1
i=${#v}
while [ $i -gt 0 ]
do
i=$[$i-2]
echo -n ${v:$i:2}
done
echo
}
guid_bytes () {
guidstr="$1"
IFS='-'
read -a strarr <<< "$guidstr"
guidbytes=$(endian ${strarr[0]})
guidbytes+=$(endian ${strarr[1]})
guidbytes+=$(endian ${strarr[2]})
guidbytes+=${strarr[3]}
guidbytes+=${strarr[4]}
echo $guidbytes
}
blksize () {
sectsz=$(diskutil info $1 | grep "Device Block Size:" | awk '{print $4}')
echo $sectsz
}
mntpoint=/Volumes/Windows
part=$(diskutil info "$(basename "$mntpoint")" | grep "Device Node:" | awk '{print $3}')
echo part - $part
disk=$(printf $part | sed 's/s[0-9]*$//')
echo "disk - $disk"
scheme=$(diskutil info $disk | grep "Content (IOContent):" | awk '{print $3}')
echo $scheme
if [[ "$scheme" == "GUID_partition_scheme" ]]; then
if [[ ! -z $(sudo fdisk "$disk" | grep -E '2:|3:|4:' | grep -v unused) ]]; then
scheme="FDisk_partition_scheme" #Use fdisk option for GPT disk with hybrid MBR.
fi
fi
sudo fdisk -y "$disk" <<EOF
p
quit
EOF
echo $scheme
if [[ "$scheme" == "GUID_partition_scheme" ]]; then
sectsize=$(blksize $disk)
echo "sectsize- $sectsize"
diskbytes=$(sudo xxd -u -p -s $(($sectsize + 56)) -l 16 $disk | sed 's/.\{2\}/&,/g;s/,$//')
partguid=$(diskutil info $part | grep "Partition UUID:" | awk '{print $5}')
echo "partguid - $partguid"
partbytes=$(printf "%s" $(guid_bytes $partguid) | sed 's/.\{2\}/&,/g;s/,$//')
schemebyte="00"
elif [[ "$scheme" == "FDisk_partition_scheme" ]]; then
disksig=$(sudo xxd -u -p -s 440 -l 4 $disk)
partoffset=$(diskutil info $part | grep "Partition Offset:" | awk '{print $3}')
echo "disksig - $disksig"
echo "partoffset - $partoffset"
if [[ -z $partoffset ]]; then
hidsect=$(sudo fdisk $disk | tail -n +6 | awk -v partnum=${part##*s} 'FNR == partnum {print $11}')
sectsize=$(blksize $disk)
partoffset=$(($sectsize * $hidsect))
fi
diskbytes=$(printf "%s" $(printf "%x%024x" "0x$disksig") | sed 's/.\{2\}/&,/g;s/,$//')
partbytes=$(printf "%s" $(endian $(printf "%032x" "$partoffset")) | sed 's/.\{2\}/&,/g;s/,$//')
schemebyte="01"
fi
echo "diskbytes - $diskbytes"
echo "partbytes - $partbytes"
exit
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.