|
| 1 | +# Apply DualBoot with DualBoot Kernel Patcher |
| 2 | +> This guide will help you build a boot image with uefi/android dualboot feature. |
| 3 | +
|
| 4 | +## Prepare |
| 5 | +- An android device. |
| 6 | +- Download `UEFI FD` file from [Github Action](https://github.com/Project-Aloha/mu_aloha_platforms/actions)(You may need to login to download artifacts) or [Release Page](https://github.com/Project-Aloha/mu_aloha_platforms/releases) of uefi repository. |
| 7 | +- `Magiskboot` for your environment, there are prebuilt binaries on github. |
| 8 | +- DualBoot kernel patcher binary and shellcode binaries for your devices from [release page](https://github.com/Project-Aloha/DualBootKernelPatcher/releases) or [action page](https://github.com/Project-Aloha/DualBootKernelPatcher/actions). |
| 9 | + |
| 10 | +:::Notice |
| 11 | + All these steps can be done on your android device. |
| 12 | +::: |
| 13 | + |
| 14 | +## Steps |
| 15 | +> Assume you have done the following steps on your android device. |
| 16 | +> 1. Root your device with magisk. |
| 17 | +> 2. Downloaded and installed termux. |
| 18 | +> 3. Installed root-repo and tsu in termux with apt. |
| 19 | +
|
| 20 | +- Get Android Boot Image. |
| 21 | + + The boot image usually can be found at `/dev/block/by-name/boot` or `/dev/block/by-name/boot_a` (or _b). |
| 22 | + + Open your termux, and copy the boot image out for future use. |
| 23 | + ```bash |
| 24 | + tsu # get root shell |
| 25 | + mkdir /sdcard/dualboot/ # create a folder to put files. |
| 26 | + cp /dev/block/by-name/boot /sdcard/dualboot/boot.img # copy to our folder and rename to boot.img. If your device has ab slot, please add _a or _b suffix. |
| 27 | + ``` |
| 28 | + |
| 29 | +- Unpack it with magiskboot. |
| 30 | + + If your device was rooted by magisk, there should be an magiskboot binary at `/data/adb/magisk/magiskboot` |
| 31 | + + By the way you can press the `tab` button in termux to automatically fill path, instead of typing the characters one by one. |
| 32 | + + Do Unpack |
| 33 | + ```bash |
| 34 | + cd /sdcard/dualboot/ # change working directory to our folder. |
| 35 | + /data/adb/magisk/magiskboot unpack boot.img # unpack |
| 36 | + ``` |
| 37 | + + You will get something like this: |
| 38 | + ```bash |
| 39 | + /sdcard/dualboot# magiskboot unpack boot.img |
| 40 | + Parsing boot image: [boot.img] |
| 41 | + HEADER_VER [1] |
| 42 | + KERNEL_SZ [41576325] |
| 43 | + RAMDISK_SZ [927736] |
| 44 | + SECOND_SZ [0] |
| 45 | + RECOV_DTBO_SZ [0] |
| 46 | + OS_VERSION [9.0.0] |
| 47 | + OS_PATCH_LEVEL [2021-05] |
| 48 | + PAGESIZE [4096] |
| 49 | + NAME [] |
| 50 | + CMDLINE [console=ttyMSM0,115200n8 earlycon=msm_geni_serial,0xa90000 androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=2048 firmware_class.path=/vendor/firmware_mnt/image loop.max_part=7 androidboot.usbcontroller=a600000.dwc3 buildvariant=user] |
| 51 | + CHECKSUM [e73518a6e1edf3062d9cebd3203a51069ef2f424000000000000000000000000] |
| 52 | + KERNEL_DTB_SZ [3972965] |
| 53 | + KERNEL_FMT [raw] |
| 54 | + RAMDISK_FMT [raw] |
| 55 | + /sdcard/dualboot# ls |
| 56 | + boot kernel kernel_dtb ramdisk.cpio |
| 57 | + ``` |
| 58 | + |
| 59 | +- Apply patch with dualboot kernel patcher. |
| 60 | + + Assume the patcher and shellcodes and config you downloaded above was saved at `/sdcard/Download/` |
| 61 | + + Unpack these zips: |
| 62 | + ``` |
| 63 | + unzip /sdcard/Download/ |
| 64 | + ``` |
| 65 | + |
| 66 | +- |
0 commit comments