-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zh: Windows DBG: Some words for kdnet/kdcom setup.
- Loading branch information
1 parent
31e28a2
commit 429a0e5
Showing
3 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# 配置Windbg KdCom | ||
::: tip 提示 | ||
如果你正在调试的设备引出了**UART引脚**,那么你可以使用这种方法在不占用一个USB口的情况下进行调试,但其速度较慢且**不支持远程桌面**。 | ||
::: | ||
|
||
## 准备工具 | ||
- 一块高通的开发板,或者一只工程机 | ||
- 调试串口可以使用 | ||
- 已经在待测设备上正确安装了Windows | ||
- 安装了[Windbg Preview](https://apps.microsoft.com/detail/9pgjgd53tn86) | ||
|
||
## 设置BCD | ||
- 找到手机里面ESP分区内的/EFI/Microsoft/Boot/BCD (路径不区分大小写) | ||
+ 你可以采用大容量模式挂载ESP分区获取[BCD](https://learn.microsoft.com/zh-cn/windows-hardware/manufacture/desktop/bcd-system-store-settings-for-uefi)文件,也可以采用安卓/REC挂载的方式获取BCD | ||
+ 以下举例安卓/REC挂载获取的方法,假定你的ESP分区的label是esp: | ||
```bash | ||
# 在手机上以root权限执行: | ||
mkdir /dev/esp_mnt | ||
mount /dev/block/by-name/esp /dev/esp_mnt | ||
cp /dev/esp_mnt/EFI/Microsoft/Boot/BCD /sdcard | ||
``` | ||
```powershell | ||
# 在电脑的终端中执行,请确保你已经安装adb并配置了环境变量 | ||
adb pull /sdcard/BCD . | ||
``` | ||
- 在电脑上打开一个**具有管理员权限**的终端,并设置调试模式: | ||
```powershell | ||
bcdedit /store BCD /set "{default}" testsigning on | ||
bcdedit /store BCD /set "{default}" nointegritychecks on | ||
bcdedit /store BCD /set "{default}" debug on | ||
bcdedit /store BCD /dbgsettings serial baudrate:115200 debugport:1 | ||
``` | ||
- 将BCD复制到手机上的ESP分区中 | ||
```powershell | ||
# 在电脑的终端中执行,请确保你已经安装adb并配置了环境变量 | ||
adb push BCD /sdcard | ||
``` | ||
```bash | ||
# 在手机上以root权限执行: | ||
cp /dev/esp_mnt/EFI/Microsoft/Boot/BCD /dev/esp_mnt/EFI/Microsoft/Boot/NMBCD | ||
cp /sdcard/BCD /dev/esp_mnt/EFI/Microsoft/Boot/DBGBCD | ||
cp /sdcard/BCD /dev/esp_mnt/EFI/Microsoft/Boot/BCD | ||
``` | ||
|
||
## Windbg KdCom配置 | ||
- 将USB转TTL设备连接到电脑上,此时在设备管理器中的**端口**中可以看到端口号为`COMXX`. | ||
- 打开Windbg(新版),点击左上角**文件** | ||
- 点击`Start Debugging`下面的`Attach to kernel` | ||
- 点击右方窗口中的`COM`选项, | ||
- `Baud Rate`一栏中填入`115200` | ||
- `Port`一栏中填入你在设备管理器中看到的`COMXX`, `XX`是几就写几。 | ||
- 其余默认即可 | ||
- 点击下方的`OK`按钮, 此时Windbg应该会进入等待连接状态 | ||
|
||
|
||
## 待测机启动 | ||
- 确保待测机器的DBG2表配置正确(一般本项目支持的平台都会正确配置,故无需担心) | ||
- 在待测机器上启动Windows, Windows 会等待大约几秒时间连接Windbg | ||
- 若Windbg的`command`窗口中打印出待测机的Windows内核版本信息,则Windbg kdcom此时成功连接。 | ||
|
||
::: tip 后记 | ||
- 如果在Windows启动的时候直接使用串口工具(例如PuTTY、SecureCRT之类)查看文字输出,那么会在控制台看见一些与kdcom相关的乱码字符。 | ||
- 故如若Windbg无法连接内核且串口在Win启动时无输出乱码字符,因考虑kdcom配置是否有误。 | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# 配置Windbg KDNET | ||
|
||
## 准备工具 | ||
- 一台已经释放完windows且已经修复完ESP分区的手机 | ||
- UEFI镜像 | ||
- 一台Windows系统的电脑(或者另一台WOA的手机,随便你) | ||
- 安装[Windbg Preview](https://apps.microsoft.com/detail/9pgjgd53tn86) | ||
- USB数据线,2.0或者3.0无所谓 | ||
|
||
## 设置BCD | ||
- 找到手机里面ESP分区内的/EFI/Microsoft/Boot/BCD (路径不区分大小写) | ||
+ 你可以采用大容量模式挂载ESP分区获取[BCD](https://learn.microsoft.com/zh-cn/windows-hardware/manufacture/desktop/bcd-system-store-settings-for-uefi)文件,也可以采用安卓/REC挂载的方式获取BCD | ||
+ 以下举例安卓/REC挂载获取的方法,假定你的ESP分区的label是esp: | ||
```bash | ||
# 在手机上以root权限执行: | ||
mkdir /dev/esp_mnt | ||
mount /dev/block/by-name/esp /dev/esp_mnt | ||
cp /dev/esp_mnt/EFI/Microsoft/Boot/BCD /sdcard | ||
``` | ||
```powershell | ||
# 在电脑的终端中执行,请确保你已经安装adb并配置了环境变量 | ||
adb pull /sdcard/BCD . | ||
``` | ||
- 在电脑上打开一个**具有管理员权限**的终端,并设置调试模式: | ||
```powershell | ||
bcdedit /store BCD /set "{default}" testsigning on | ||
bcdedit /store BCD /set "{default}" nointegritychecks on | ||
bcdedit /store BCD /set "{default}" debug on | ||
bcdedit /store BCD /dbgsettings net hostip:169.254.255.255 port:50000 key:1.1.1.1 | ||
``` | ||
- 将BCD复制到手机上的ESP分区中 | ||
```powershell | ||
# 在电脑的终端中执行,请确保你已经安装adb并配置了环境变量 | ||
adb push BCD /sdcard | ||
``` | ||
```bash | ||
# 在手机上以root权限执行: | ||
cp /dev/esp_mnt/EFI/Microsoft/Boot/BCD /dev/esp_mnt/EFI/Microsoft/Boot/NMBCD | ||
cp /sdcard/BCD /dev/esp_mnt/EFI/Microsoft/Boot/DBGBCD | ||
cp /sdcard/BCD /dev/esp_mnt/EFI/Microsoft/Boot/BCD | ||
``` | ||
|
||
### Windbg KDNET 配置 | ||
- 打开Windbg(新版),点击左上角**文件** | ||
- 点击`Start Debugging`下面的`Attach to kernel` | ||
- 点击`Net` | ||
+ 在`Port Number`输入`50000` | ||
+ 在`Key`中输入`1.1.1.1` | ||
- 点击下方的`OK` | ||
![Kdnet waiting for connection](Resources/SetupKDNET/KdNetWaiting.png) | ||
|
||
### 连接手机 | ||
- 手机重启到fastboot,连接电脑 | ||
```powershell | ||
# 在电脑上执行 | ||
fastboot boot brand-codename.img | ||
``` | ||
- 手机会启动到Windows,但不会转圈,此时Windows在等待Windbg连接 | ||
- 你可以在**任务管理器**或者**设备管理器**中找到名字叫做`Kdnet EEM`的网络设备 | ||
- 大约几分钟后,Windbg连接成功,手机上的windows开始加载 | ||
- 你可以在还未连接的时候使用`Ctrl+Alt+V`打开verbose mode,查看驱动加载状态 | ||
|