[Redmi 9 / Poco M2 Guides, News, & Discussion] lkj00:
感谢@bynarie @AndyYan 他们两位给我了很大帮助解决了关键问题！Thank you.

第一步：

1：自备固件fastboot包，可以在互联网自行下载.

2：电脑安装虚拟机，同时下载 ubuntu桌面版系统，并在虚拟机里面安装好！并且获取root登录，设置电脑和虚拟机的文件共享问题！

（详情设置请自行百度；google）

第二步：

1：下载安卓工具包，并解压复制到ubuntu

安卓工具包 （大陆需要VPN）

2：先前下载的固件进行解压共享给ubuntu，虚拟机启动ubuntu，进入桌面后点击左侧文件- 计算机-其他位置在任意文件夹或者根目录下新建文件夹名字随意。然后将之前解压的安卓工具包放到这个文件夹里面。只需要其中几个文件和驱动其他都是不需要的。请看我的截图：View attachment 5250303

Step 3: Share the previously downloaded firmware and decompress settings to ubuntu (please google for specific settings). After starting the virtual machine ubuntu and entering the desktop, click on the file on the left-computer-other locations in any folder or the root directory, create a new folder with any name . Then put the previously unzipped Android toolkit into this folder. Only a few files and drivers are needed. Please see my screenshot:

第四步：解压修改固件.我们需要修改其中的 cust.img userdata.img super.img 前面2个img 修改都很简单 google就有详细的教程不做详说。只贴出具体的执行代码！今天重点讲 suer.img 解包和打包。

Step 4: Unzip and modify the firmware. We need to modify the cust.img userdata.img super.img. The first two img modifications are very simple. Google has a detailed tutorial that will not go into details. Only post the specific execution code! Today I will focus on unpacking and packaging suer.img.

cust.img userdata.img 代码：

Code：

1：./simg2img XXXX.img XXX.img （解包）(Unpack)

2：mount -t ext4 -o loop XXX.img ./temp （挂载前一步解包的映像文件）(Mount the image file unpacked in the previous step)

（在ubuntu中删除img镜像中的文件,会生成一个.Trash的隐藏文件夹,即回收站.必需ctrl+H将其显示并删除,否则,所有删除的软件文件,

在system.img刷进手机后仍会起作用）

(Deleting the files in the img image in ubuntu will generate a hidden folder of .Trash, which is the recycle bin. It must be displayed and deleted by ctrl+H, otherwise, all deleted software files will be swiped into the phone in system.img Will still work)

3：sudo umount temp （修改完成后卸载挂载映像）(Uninstall the mount image after the modification is completed)

4：./img2simg XXX.img XXX.img （最后再打包成之前的映像文件 替换即可）(Finally package into the previous image file and replace it)

第五步：suer.img的解包和打包

Step 5: Unpacking and packaging suer.img

1：安装小米手机驱动 开启usb调试 下载adb工具运行命令（打开adb命令一闪而过请参考 https://www.jb51.net/diannaojichu/95294.html）

Install the Xiaomi mobile phone driver, turn on the usb debugging, download the adb tool to run the command (open the adb command for a flash, please refer to https://www.jb51.net/diannaojichu/95294.html)

Code：

开始解包super.img之前，需要连接手机，电脑安装好驱动并下载adb工具包，手设置-开发者模式-打开usb调试.

code：

adb shell lpdump

（请一定不要关闭窗口或截图保存数据，打包super.img 需要里面的参数）

2：./simg2img super.img super.raw.img

3：./lpunpack --slot=0 super.raw.img （命令完成出现三个。.img文件 我们只需要对其中system.img进行修改）

(There are three .img files after the command is completed. We only need to modify the system.img)

4：mount -t ext4 -o loop system.img ./temp

（删除小米那些垃圾应用时需要去除卡米限制 我自己做的redmi9去卡米限制。其他机型自行google 关键词 去除卡米限制。 替换路径system/framework/services.jar 替换后需要设置权限，具体可以选择没有替换的文件右键 权限 对比 设置一模一样即可。下载地址：https://wwa.lanzous.com/iFA4Lmze3va）

(When deleting those rubbish applications of Xiaomi, you need to remove the Kami restriction. I made my own redmi9 to remove the Kami restriction. Other models remove the Kami restriction by using Google keywords. Replace the path system/framework/services.jar After replacement, you need to set permissions. You can choose the right-click permission comparison setting of the file without replacement to be exactly the same. Download address: https://wwa.lanzous.com/iFA4Lmze3va)

5：sudo umount temp

6：./lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super:7516192768 --group main:6012043264 --partition system:readonly:3132657664:main --image system=./system.img --partition vendor:readonly:767078400:main --image vendor=./vendor.img --partition product:readonly:220844032:main --image product=./product.img --sparse --output ./super.img

（现在需要用到前面查询的数据 数字填上即可。super:7516192768这个数据 就是没有进行解包时的数据右键在ununtu里面右键能看到其大小填上即可 后面三个分区亦可这样操作）

(Now you need to use the previous query data and fill in the numbers. Super:7516192768 This data is the data when it is not unpacked. Right click in ununtu and you can see the size and fill in the next three partitions operating)

第六步：修改后替换原始文件 现在你可以进入fastboot 快乐刷机。

Step 6: Replace the original file after modification Now you can enter fastboot happy flashing.

第七步：刷机完成后再次进入fastboot 执行如下指令 才能进入系统 否则会无限重启 操作方法：插上数据线+按着音量下键不放 直至手机自动重启后即可进入fastboot

Step 7: After the flashing is completed, enter fastboot again and execute the following commands to enter the system, otherwise it will restart indefinitely. Operation method: plug in the data cable + press and hold the volume down button until the phone automatically restarts to enter fastboot

Code：

fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img