[ubuntu20.04 rk3588]解决Kernel panic - not syncing: VFS: Unable to mount root fs问题

文章讲述了在尝试编译Ubuntu20.04内核并烧录后,系统遇到持续重启的问题,主要表现为内核日志中的mount失败。问题在于缺少cpio命令,导致recovery.img文件异常。解决方法是安装cpio并重新编译内核。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

编译了Ubuntu20.04的源码成功烧录后,出现问题:不断重启。内核日志输出如下:

[    3.903443] No filesystem could mount root, tried:
[    3.903446]  ext3
[    3.903450]  ext2
[    3.903455]  ext4
[    3.903459]  squashfs
[    3.903463]  vfat
[    3.903468]  iso9660
[    3.903472]  ntfs
[    3.903477]  fuseblk
[    3.903481]  xfs
[    3.903485]  btrfs
[    3.903489]
[    3.903498] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,6)
[    3.921350] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.10.66 #4
[    3.921881] Hardware name: Rockchip RK3588 IR88MX01 LP4X V10 Board (DT)
[    3.922468] Call trace:
[    3.922694]  dump_backtrace+0x0/0x1e4
[    3.923027]  show_stack+0x24/0x30
[    3.923329]  dump_stack_lvl+0xd4/0x124
[    3.923661]  dump_stack+0x18/0x3c
[    3.923959]  panic+0x15c/0x384
[    3.924238]  mount_block_root+0x150/0x1ec
[    3.924592]  handle_initrd+0x70/0x1f8
[    3.924924]  initrd_load+0x60/0x84
[    3.925233]  prepare_namespace+0x58/0x1a4
[    3.925587]  kernel_init_freeable+0x134/0x168
[    3.925974]  kernel_init+0x20/0x118
[    3.926283]  ret_from_fork+0x10/0x30

查看编译信息,原因是cpio命令没有,但是./edge build -k编译内核命令还是编译过了,导致recovery.img生成不正常,大小为31M,正常情况下为61M

[EDGE DEBUG] Start boot image ...
[EDGE DEBUG] ./make_initrd.sh arm64
./make_initrd.sh: line 7: cpio: command not found
/root/rk3588-edge/rootfs/debian/initrd
[EDGE DEBUG] /root/rk3588-edge/rkbin/tools/mkimage -f /root/rk3588-edge/out/rk3588/RK3588-IR88MX01/images/boot_its -E -p 0x1000 /root/rk3588-edge/out/rk3588/RK3588-IR88MX01/images/recovery.img

解决方法安装cpio

apt install cpio

然后再编译内核

./edge build -k

非常抱歉,我之前提供的代码存在错误。在 PyTorch 中,并没有直接提供离散余弦变换(DCT)的函数。对于 DCT 的实现,你可以使用 `torch.rfft` 函数结合 DCT 系数矩阵来进行计算。 下面是一个修正后的示例代码: ```python import torch import torch.nn as nn import torch.optim as optim # 定义离散余弦变换(DCT)系数矩阵 dct_matrix = torch.zeros(256, 256) for i in range(256): for j in range(256): dct_matrix[i, j] = torch.cos((2 * i + 1) * j * 3.14159 / (2 * 256)) # 定义 OMP 算法 def omp(A, y, k): m, n = A.shape x = torch.zeros(n, 1) residual = y.clone() support = [] for _ in range(k): projections = torch.abs(A.t().matmul(residual)) index = torch.argmax(projections) support.append(index) AtA_inv = torch.linalg.inv(A[:, support].t().matmul(A[:, support])) x_new = AtA_inv.matmul(A[:, support].t()).matmul(y) residual = y - A[:, support].matmul(x_new) x[support] = x_new return x # 加载原始图像 image = torch.randn(256, 256) # 压缩感知成像 measurement_matrix = torch.fft.fft(torch.eye(256), dim=0).real compressed = measurement_matrix.matmul(image.flatten().unsqueeze(1)) # 使用 OMP 进行重构 reconstructed = omp(dct_matrix, compressed, k=100) # 计算重构误差 mse = nn.MSELoss() reconstruction_error = mse(image, reconstructed.reshape(image.shape)) print("重构误差:", reconstruction_error.item()) ``` 在这个示例中,我们手动定义了 DCT 系数矩阵 `dct_matrix`,然后使用 `torch.fft.fft` 函数计算测量矩阵,并进行实部提取。接下来的步骤与之前的示例相同。 请注意,这只是一个示例,用于演示如何使用自定义的 DCT 系数矩阵进行压缩感知成像。在实际应用中,你可能需要根据具体的需求进行调整和优化。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值