Skip to content

Commit a9aa997

Browse files
committed
finish dualboot kernel patching doc
1 parent 002d473 commit a9aa997

File tree

1 file changed

+54
-5
lines changed

1 file changed

+54
-5
lines changed

DualBoot/PatchKernel.md

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
```
3737
+ You will get something like this:
3838
```bash
39-
/sdcard/dualboot# magiskboot unpack boot.img
39+
/sdcard/dualboot# /data/adb/magisk/magiskboot unpack boot.img
4040
Parsing boot image: [boot.img]
4141
HEADER_VER [1]
4242
KERNEL_SZ [41576325]
@@ -55,12 +55,61 @@
5555
/sdcard/dualboot# ls
5656
boot kernel kernel_dtb ramdisk.cpio
5757
```
58-
58+
::: TIP
59+
Please do not patch a patched kernel.
60+
:::
5961
- Apply patch with dualboot kernel patcher.
6062
+ Assume the patcher and shellcodes and config you downloaded above was saved at `/sdcard/Download/`
61-
+ Unpack these zips:
63+
+ Unpack these zips with these cmds, or extract in file manager.
64+
```
65+
unzip /sdcard/Download/Shellcodes.zip
66+
unzip /sdcard/Download/DualBootKernelPatcher-Linux-arm64.zip
67+
unzip /sdcard/Download/Config.zip
68+
```
69+
+ Give permission to dualboot kernel patcher
70+
```bash
71+
mv DualBootKernelPatcher ~/
72+
chmod +x ~/DualBootKernelPatcher
73+
```
74+
+ Patch kernel with a shellcode.
75+
```bash
76+
./DualBootKernelPatcher /sdcard/dualboot/patched_kernel <Path-to>/SM8150_EFI.fd /sdcard/dualboot/kernel <Path-To>/Config/DualBoot.Sm8150.cfg <Path-To>/ShellCode.XXXX.bin
77+
```
78+
+ Repack boot image with patched kernel
79+
```bash
80+
cd /sdcard/dualboot/
81+
mv patched_kernel kernel
82+
/data/adb/magisk/magiskboot repack boot.img
83+
```
84+
+ You will get a file named `new-boot.img` if magiskboot success.
85+
86+
- Test with fastboot.
87+
+ Send `new-boot.img` to your computer:
88+
```pwsh
89+
adb pull /sdcard/dualboot/new-boot.img
90+
```
91+
+ Reboot to fastboot
92+
```pwsh
93+
adb reboot bootloader
94+
```
95+
+ Ensure OS-switch is on the correct state before it loading. Like magnet shell or tri-state key.
96+
+ Try load boot image once.
97+
```pwsh
98+
fastboot boot new-boot.img
99+
```
100+
+ See if the device is entering a correct os.
101+
102+
- Flash boot image into disk
103+
+ If everything goes well and boot image was backuped. You can flash boot image into disk now. Then no fastboot command is required when using dualboot.
104+
+ Flash boot:
105+
```pwsh
106+
fastboot flash boot new-boot.img
62107
```
63-
unzip /sdcard/Download/
108+
- Recover original boot image:
109+
+ If you want to remove dualboot, flash your backuped boot image.
110+
```pwsh
111+
fastboot flash boot.img
64112
```
65113

66-
-
114+
## Remove dualboot
115+
Run `DualBootPatchRemover` on the patched kernel and rebuild the boot image. After flashing to boot parition the dualboot feature will disappear.

0 commit comments

Comments
 (0)