Xiaomi Redmi Note 4X(mido)刷Debian Linux

2017年买的一台Xiaomi Redmi Note 4X,一直淘汰放在家里,想着废物利用,看能不能刷Linux,用来玩耍,在Github上找到可以刷Debian Linux,遂将其进行了刷机。
在这里特别致谢https://github.com/calico-cat-3333/debian-on-mido 这个仓库的维护者
image

1.手机信息

- 型号: Xiaomi Redmi Note 4X
- CPU: msm8953
- Memory:3G
- Disk:32G

2.准备工作

2.1.刷机工具

2.2.下载debian镜像

项目地址:https://github.com/calico-cat-3333/debian-on-mido
特别感谢这位作者

image

2.3.刷入orangefox

注意事项:在输入第三方rec时,需要通过mi_unlock解锁小米

  • 同时按开机键和音量键-进入fastboot模式,在fastboot模式下输入rec,刷入完成后在orangefox rec模式下,清空system,cache等数据
fastboot devices
fastboot flash recovery recovery.img

3.刷入Debian系统

3.1.刷入系统

  • 手机需要进入fastboot模式
fastboot erase boot
fastboot erase system
fastboot erase userdata
fastboot flash boot lk2nd.img
fastboot flash system bootfs-simg.img
fastboot flash userdata rootfs-simg.img
fastboot reboot

3.2.配置系统

  • 重启后,手机会进入TTY模式,需要通过USB数据线进入COM模式配置

image

3.3.TTY模式下配置WIFI连接

# 扫描wifi
nmcli r wifi on
nmcli dev wifi
# 连接wifi
nmcli dev wifi connect "wifi name" password "wifi password" ifname wlan0
# 查看ip 地址
ip addr

3.4.开启ssh用户使用root权限

sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
systemctl restart sshd
  • 通过SSH工具就可以连接

3.5.安装蓝牙和亮度传感器软件

apt update
apt install -y bluez iio-sensor-proxy

3.6.配置语言时区 tty 字体

dpkg-reconfigure locales
dpkg-reconfigure tzdata
dpkg-reconfigure console-setup

3.7.创建新用户

adduser user
usermod -aG sudo user
usermod -aG audio user
usermod -aG video user
usermod -aG render user
usermod -aG input user
usermod -aG netdev user
usermod -aG plugdev user
usermod -aG bluetooth user

3.8.启用快充

默认充电速度在 dtb 中限制为 1A, 速度较慢,可以通过修改 dts 提高充电速度。

由于 lk2nd 的 extlinux 支持 device tree overlay 所以这里使用 dtbo 来覆盖设备树节点,无需修改原 dts.

  • 安装 dtc 工具:
sudo apt install device-tree-compiler
  • 创建 fastcharge.dts (这里提升到了 1.6A)
/dts-v1/;
/plugin/;

/ {
    fragment@0 {
        target-path = "/battery";
        __overlay__ {
            constant-charge-current-max-microamp = <1600000>;
        };
    };
};
  • 编译为 dtbo
dtc -I dts -O dtb -o fastcharge.dtbo fastcharge.dts
  • 复制到 /boot/dtbo
sudo su
mkdir -p /boot/dtbo
cp fastcharge.dtbo /boot/dtbo
  • 编辑 /boot/extlinux/extlinux.conf 在最后添加:
	fdtoverlays /dtbo/fastcharge.dtbo
  • 编辑完成后,extlinux.conf 应该如下所示:
timeout 1
default Debian
menu title boot prev kernel

label Debian
	kernel /vmlinuz-6.16.3-calicocat-msm8953+
	fdtdir /
	initrd /initrd.img-6.16.3-calicocat-msm8953+
	append console=tty0 root=UUID=350b96c5-23d6-419f-a377-d2e446190c14 rw loglevel=3 splash
	fdtoverlays /dtbo/fastcharge.dtbo

3.9.配置时间同步

  • 安装chrony时间同步软件
apt install chrony
  • 配置chrony配置文件
cd /etc/chrony/
mv chrony.conf chrony.conf.bak
echo "# 忽略时间偏差" >> /etc/chrony/chrony.conf
echo "makestep 1.0 3" >> /etc/chrony/chrony.conf
echo "# 主时间源(带trust选项)" >> /etc/chrony/chrony.conf
echo "server ntp.aliyun.com prefer iburst minpoll 4 maxpoll 4 trust" >> /etc/chrony/chrony.conf
echo "# 备用时间源" >> /etc/chrony/chrony.conf
echo "server 2.debian.pool.ntp.org iburst minpoll 4 maxpoll 4" >> /etc/chrony/chrony.conf
echo "# 禁用步进调整,改用平滑时间调整" >> /etc/chrony/chrony.conf
echo "leapsecmode slew" >> /etc/chrony/chrony.conf
echo "maxslewrate 1000" >> /etc/chrony/chrony.conf
echo "smoothtime 50000 0.01 leaponly" >> /etc/chrony/chrony.conf
echo "# 日志和漂移文件" >> /etc/chrony/chrony.conf
echo "driftfile /var/lib/chrony/drift" >> /etc/chrony/chrony.conf
echo "logdir /var/log/chrony" >> /etc/chrony/chrony.conf
  • 重启chrony
systemctl restart chrony
  • 强制时间同步
chronyc -a makestep
posted @ 2026-02-26 13:01  二乘八是十六  阅读(374)  评论(0)    收藏  举报