This commit is contained in:
zj
2026-02-12 01:16:16 +08:00
parent 85d0f00a48
commit 6a08d19fd8
3 changed files with 217 additions and 1 deletions

View File

@@ -49,10 +49,27 @@ BootRepairTool/
- **NEW**: Gentoo
- **NEW**: NixOS
### 4. GRUB 修复 (`backend.py:chroot_and_repair_grub`)
### 4. 内核恢复功能 (`backend.py:check_and_restore_kernel`)
**NEW v2.1**: 自动检测和恢复缺失的内核文件
#### 检测逻辑
- 检查 `/boot` 目录下的 `vmlinuz-*``initramfs-*.img` 文件
- 如果缺失,自动尝试恢复
#### 恢复方法
1. **从 /usr/lib/modules 复制** - 如果根分区包含内核模块目录
2. **重新安装内核包** - 使用包管理器重新安装内核:
- CentOS/RHEL/Rocky/Alma: `yum reinstall kernel-core kernel-modules`
- Debian/Ubuntu: `apt-get install --reinstall linux-image-generic`
- Arch/Manjaro: `pacman -S linux`
3. **重新生成 initramfs** - 使用 dracut/mkinitcpio/update-initramfs
### 5. GRUB 修复 (`backend.py:chroot_and_repair_grub`)
#### BIOS 模式
- `grub-install --target=i386-pc --recheck --force /dev/sdX`
- **NEW**: 独立 `/boot` 分区支持(添加 `--boot-directory=/boot`
#### UEFI 模式 (参考 Calamares 实现)
- 自动检测系统架构 (x86_64/i386/arm64/loongarch64)