This is an automated flashing tool for RM-01 N305 module SSD. It automates the entire process of flashing the N305RM01 image to an SSD drive, including disk unmounting, partition wiping, image flashing, partition resizing, and filesystem resizing.
- ✅ Automatic disk detection and selection
- ✅ Safe disk unmounting
- ✅ Partition table wiping
- ✅ Image flashing with progress display
- ✅ Automatic partition resizing
- ✅ Filesystem resizing
- ✅ Bilingual support (English/Chinese)
- Linux operating system
- Python 3.6 or higher
- Root/sudo privileges
- Required system tools:
lsblkumountwipefsddsyncpartede2fsckresize2fs
- Clone or download this repository:
cd ~/Desktop/RM-01-N305-Maker- Make the script executable:
chmod +x flash_rm01_n305.pyRun the script with sudo privileges:
sudo python3 flash_rm01_n305.pyThe script will:
- Display available disks
- Prompt you to select the target disk
- Ask for confirmation before proceeding
- Execute the flashing process automatically
Specify the image file path:
sudo python3 flash_rm01_n305.py -i /path/to/n305rm01.imgSpecify the disk name directly:
sudo python3 flash_rm01_n305.py -d sda -i /path/to/n305rm01.imgSkip confirmation prompts (use with caution):
sudo python3 flash_rm01_n305.py -d sda -i /path/to/n305rm01.img --skip-confirm-i, --image: Path to the image file (default:/home/rm01/image/n305rm01.img)-d, --disk: Disk name (e.g.,sda) - if not specified, will prompt for selection--skip-confirm: Skip confirmation prompts (use with extreme caution)
The tool performs the following steps automatically:
- Check sudo privileges - Ensures the script has root access
- Detect disk - Lists available disks and prompts for selection
- Unmount disk - Safely unmounts all mount points on the target disk
- Wipe disk - Clears partition table and data using
wipefs - Flash image - Writes the image file to the disk using
ddwith progress display - Sync - Ensures all data is written to disk
- Check partitions - Verifies partition creation
- Resize partition - Expands partition 2 to 100% using
parted - Resize filesystem - Adjusts the filesystem size using
e2fsckandresize2fs - Final verification - Performs final check to confirm success
Make sure you're running the script with sudo:
sudo python3 flash_rm01_n305.pyVerify the disk name using lsblk:
lsblkCheck the image file path:
ls -lh /path/to/n305rm01.imgIf you encounter GPT warnings, the script will attempt to fix them automatically. If issues persist, you may need to manually run:
sudo parted /dev/sda fix
sudo parted /dev/sda resizepart 2 100%This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues or questions, please open an issue on the project repository.
这是一个用于RM-01 N305模组SSD的自动刷写工具。它自动化了整个将N305RM01镜像刷写到SSD驱动器的过程,包括磁盘卸载、分区清除、镜像刷写、分区扩展和文件系统调整。
- ✅ 自动磁盘检测和选择
- ✅ 安全磁盘卸载
- ✅ 分区表清除
- ✅ 带进度显示的镜像刷写
- ✅ 自动分区扩展
- ✅ 文件系统调整
- ✅ 双语支持(中文/英文)
- Linux操作系统
- Python 3.6或更高版本
- Root/sudo权限
- 必需的系统工具:
lsblkumountwipefsddsyncpartede2fsckresize2fs
- 克隆或下载此仓库:
cd ~/Desktop/RM-01-N305-Maker- 使脚本可执行:
chmod +x flash_rm01_n305.py使用sudo权限运行脚本:
sudo python3 flash_rm01_n305.py脚本将:
- 显示可用磁盘
- 提示您选择目标磁盘
- 在执行前请求确认
- 自动执行刷写过程
指定镜像文件路径:
sudo python3 flash_rm01_n305.py -i /path/to/n305rm01.img直接指定磁盘名称:
sudo python3 flash_rm01_n305.py -d sda -i /path/to/n305rm01.img跳过确认提示(请谨慎使用):
sudo python3 flash_rm01_n305.py -d sda -i /path/to/n305rm01.img --skip-confirm-i, --image: 镜像文件路径(默认:/home/rm01/image/n305rm01.img)-d, --disk: 磁盘名称(例如:sda)- 如果未指定,将提示选择--skip-confirm: 跳过确认提示(请极其谨慎使用)
工具自动执行以下步骤:
- 检查sudo权限 - 确保脚本具有root访问权限
- 检测磁盘 - 列出可用磁盘并提示选择
- 卸载磁盘 - 安全卸载目标磁盘上的所有挂载点
- 清除磁盘 - 使用
wipefs清除分区表和数据 - 刷写镜像 - 使用
dd将镜像文件写入磁盘,并显示进度 - 同步 - 确保所有数据写入磁盘
- 检查分区 - 验证分区创建
- 扩展分区 - 使用
parted将分区2扩展到100% - 调整文件系统 - 使用
e2fsck和resize2fs调整文件系统大小 - 最终验证 - 执行最终检查以确认成功
确保使用sudo运行脚本:
sudo python3 flash_rm01_n305.py使用lsblk验证磁盘名称:
lsblk检查镜像文件路径:
ls -lh /path/to/n305rm01.img如果遇到GPT警告,脚本将尝试自动修复。如果问题持续存在,您可能需要手动运行:
sudo parted /dev/sda fix
sudo parted /dev/sda resizepart 2 100%本项目采用Apache License 2.0许可证 - 详情请参阅LICENSE文件。
欢迎贡献!请随时提交Pull Request。
如有问题或疑问,请在项目仓库中提交issue。