Skip to content

Commit

Permalink
en/zh: Common: Add syntax highlighting for some code blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunflower2333 committed Feb 8, 2024
1 parent 8b2fec5 commit be551e9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion DualBoot/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ If you do not need it, set the two values to 0.
+ RestartReasonAddress can be found in a Qualcomm device's device tree.
+ Enter android or recovery, run the following shell cmd with root permission.
+ Output should like this:
```
```bash
android:/# printf "RestartReasonAddress=0x%x\n" $((0x$(realpath /sys/firmware/devicetree/base/soc/qcom\,msm-imem@*/restart_reason@* | awk -F'[@/]' '{print $(NF-2)"+0x"$(NF)}')))
RestartReasonAddress=0x146bf65c
```
Expand Down
6 changes: 3 additions & 3 deletions PortingGuides/FindProtocolAddressesForKailua.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ ___
## Steps
1. Get **uefi** partition from your phone:
- In *termux* or adb shell:
```
```bash
cp /dev/block/by-name/uefi_a /sdcard
```

2. Use UefiReader to extract uefi_a image:
- Windows:
```
```powershell
UefiReader.exe <absolute-path-to-uefi_a> <absolute-path-to-output-dir>
```
- Linux:
```
```bash
sudo apt install dotnet-sdk-6.0
git clone https://github.com/WOA-Project/UEFIReader
cd UEFIReader/UEFIReader
Expand Down
18 changes: 9 additions & 9 deletions PortingGuides/SimpleGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
___
## **Part 0.** Introduce some directories and files.
- We only need to know few directories and files under `Platform/SurfaceDuo1Pkg/`
```
```bash
~/mu-msmnile$ tree Platforms/SurfaceDuo1Pkg/ -L 2 -d
Platforms/SurfaceDuo1Pkg/
|-- AcpiTables
Expand Down Expand Up @@ -73,7 +73,7 @@ ___
- **PythonLibs/**
* *Stores python libs.*
- Let's take a closer look at `Device/nubia-tp1803`.
```
```bash
~/mu-msmnile/Platforms/SurfaceDuo1Pkg/Device$ tree -L 1 nubia-tp1803/
├── ACPI
├── APRIORI.inc
Expand Down Expand Up @@ -122,15 +122,15 @@ ___
4. Extract files from your device's xbl and put them under Binaries.
+ *Download and compile [UefiReader](https://github.com/WOA-Project/UEFIReader)*
+ *Connect your phone to your computer and execute the command on your computer.*
```
```bash
adb shell su -c "dd if=/dev/block/by-name/xbl_a of=/sdcard/xbl.img"
adb pull /sdcard/xbl.img .
```
+ *Execute UefiReader.exe \<Path-to-xbl.img\> \<Path-to-output-folder\>*
+ *Put output into `meizu-m928q/Binaries`.*
5. Edit `${brand-codename}/DXE.inc`, `${brand-codename}/APRIORI.inc`, `${brand-codename}/DXE.dsc.inc`.
+ *See the difference by `diff`*
```
```bash
$ diff meizu-m928q/Binaries/DXE.inc oneplus-guacamole/Binaries/DXE.inc
23d22
< INF QcomPkg/Drivers/SimpleTextInOutSerialDxe/SimpleTextInOutSerial.inf
Expand All @@ -151,7 +151,7 @@ ___
11. Build it.
12. Test it.
+ *Connect your phone to your computer and execute it on your computer.*
```
```bash
adb reboot bootloader
fastboot boot Build/meizu-m928q/meizu-m928q.img
```
Expand Down Expand Up @@ -180,14 +180,14 @@ ___
* The most simple way to know where to patch:
+ Find one other device's original xxxDxe.efi and its patched xxxDxe.efi .
+ Dump hex and get where & what to patch.
```
```bash
hexdump -C a_xxxDxe.efi > a.txt
hexdump -C b_xxxDxe.efi > b.txt
diff a.txt b.txt
```
- Example:
* UFSDxe.efi (nabu):
```
```bash
~/mu-msmnile/Platforms/SurfaceDuo1Pkg/Device/xiaomi-nabu$ diff a.txt b.txt
383c383
< 000025f0 00 00 80 52 c0 03 5f d6 fd 7b 03 a9 fd c3 00 91 |...R.._..{......|
Expand All @@ -212,11 +212,11 @@ ___
- How to get dtb of my device? *assume in termux environment*
* Download Magiskboot. ([Prebuilt](https://github.com/TeamWin/external_magisk-prebuilt/blob/android-11/prebuilt/))
* Get boot image from your phone.
```
```bash
sudo cp /dev/block/by-name/boot ~/split-appended-dtb/myboot.img
```
* Split dtb from you phone's boot.
```
```bash
./magiskboot_arm unpack myboot.img
```
* Renamed `kernel_dtb`(or `dtb`) to android-`codename`.dtb and put it into Device/*\<brand-codename\>*/DeviceTreeBlob/Android/.
Expand Down
2 changes: 1 addition & 1 deletion zh/InstallationGuides/WindowsInstallation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- 打开解压后的文件夹,Shift+右键选择`在终端中打开`
+ 你可以下载任何你想要的版本,用法参考[这里](https://github.com/gus33000/UUPMediaCreator#usage)或者[这里](https://github.com/WOA-Project/SurfaceDuo-Guides/blob/main/CreateWindowsISO.md)
+ 示例:下载Win11 22h2,然后转换为iso格式
```
```powershell
UUPDownload.exe -s Professional -v 10.0.22621.1105 -r Retail -b Retail -c vb_release -t arm64 -l zh-cn
UUPMediaConverter.exe -u 10.0.22621.1.ni_release.220506-1250_arm64xxxxxxxxx -i Windows11_Pro_arm64_en-US.iso -l zh-cn -e Professional
Expand Down
14 changes: 7 additions & 7 deletions zh/PortingGuides/SimpleGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
___
## **步骤0.** 介绍一些目录和文件
- 我们只需要了解`Platform/SurfaceDuo1Pkg/`目录下的一些目录和文件。
```
```bash
~/mu-msmnile$ tree Platforms/SurfaceDuo1Pkg/ -L 2 -d
Platforms/SurfaceDuo1Pkg/
|-- AcpiTables # 存放ACPI tables
Expand Down Expand Up @@ -57,7 +57,7 @@ ___
```

- 近距离观察一下`Device/nubia-tp1803`
```
```bash
~/mu-msmnile/Platforms/SurfaceDuo1Pkg/Device$ tree -L 1 nubia-tp1803/
├── ACPI # 存放设备的dsdt table
├── APRIORI.inc # Dxe的加载顺序。包含在SurfaceDuo1.fdf内
Expand Down Expand Up @@ -87,7 +87,7 @@ ___
+ *将输出文件放到`meizu-m928q/Binaries`.*
5. 编辑 meizu-m928q文件夹中的`DXE.inc`, `APRIORI.inc`, `DXE.dsc.inc`.
+ *使用`diff`对比不同之处*
```
```bash
$ diff meizu-m928q/Binaries/DXE.inc oneplus-guacamole/Binaries/DXE.inc
23d22
< INF QcomPkg/Drivers/SimpleTextInOutSerialDxe/SimpleTextInOutSerial.inf
Expand Down Expand Up @@ -132,14 +132,14 @@ ___
* 最简单的方法:
+ 找到另一个设备的原始xxxDxe.efi和它补丁过的 xxxDxe.efi .
+ hex对比一下,就知道应该patch哪里和patch什么了.
```
```bash
hexdump -C a_xxxDxe.efi > a.txt
hexdump -C b_xxxDxe.efi > b.txt
diff a.txt b.txt
```
- 例:
* UFSDxe.efi (nabu):
```
```bash
~/mu-msmnile/Platforms/SurfaceDuo1Pkg/Device/xiaomi-nabu$ diff a.txt b.txt
383c383
< 000025f0 00 00 80 52 c0 03 5f d6 fd 7b 03 a9 fd c3 00 91 |...R.._..{......|
Expand All @@ -164,11 +164,11 @@ ___
- 如何获得我的设备的dtb? *默认在termux环境中*
* 下载Magiskboot. ([Prebuilt](https://github.com/TeamWin/external_magisk-prebuilt/blob/android-11/prebuilt/))
* 提取设备的boot分区.
```
```bash
sudo cp /dev/block/by-name/boot ~/split-appended-dtb/myboot.img
```
* Magsikboot解包boot获得dtb.
```
```bash
./magiskboot_arm unpack myboot.img
```
*`kernel_dtb`重命名为`android-设备代号.dtb`并放置在Device/品牌-设备代号/DeviceTreeBlob/Android/.
Expand Down

0 comments on commit be551e9

Please sign in to comment.