[英]Mount Squashfs as Root in initramfs Raspbian
I'm currently trying to make my raspbian boot from a squashFS image through initramfs. 我目前正在尝试通过initramfs从squashFS映像启动raspbian引导。 The squashfs image is on file system /dev/mmcblk0p1, so I mount this prior to mounting the Image. squashfs映像位于文件系统/ dev / mmcblk0p1上,因此在安装映像之前先进行安装。
Unfortunately I'm stuck at mounting the SquashFS Image file. 不幸的是,我被困在安装SquashFS映像文件上。
I tried mounting through 我尝试通过安装
mount -o loop
but I always get 但我总是得到
mounting /dev/loop0 on /mnt/root failed: No such device
So I tried to mount it through loop manually. 因此,我尝试通过循环手动安装它。 The problem is, that mounting the /dev/loop0 fails with the same Error as above. 问题是,挂载/ dev / loop0失败,并出现与上述相同的错误。
This is my init so far: 到目前为止,这是我的初始化:
#!/bin/busybox sh
# Mount the /proc and /sys filesystems.
mount -t proc none /proc
mount -t sysfs none /sys
#create loop devices
mknod /dev/loop0 b 7 0
mkdir /mnt/root
# Mount the boot partition
mount -o ro /dev/mmcblk0p1 /mnt/boot
sleep 5
# Mount the root FS with losetup
echo "Mounting with losetup"
losetup /dev/loop0 /mnt/boot/SYSTEM
mount /dev/loop0 /mnt/root -t squashfs
echo "Done"
#mount -o ro,loop -t squashfs /mnt/boot/SYSTEM /mnt/root
# Use Fallback mounting failed
if [ ! -e /mnt/root/home ]
then
echo "MOUNTING SDA1"
mount /dev/sda1 /mnt/root -t ext4
fi
# Clean up.
umount /proc
umount /sys
umount /mnt/boot
# Boot the real thing.
exec switch_root /mnt/root /sbin/init
Checking 检查
losetup /dev/loop0
tells me, that the squashfs Image has been attached to loop0. 告诉我,squashfs映像已附加到loop0。
Does somebody know where to start? 有人知道从哪里开始吗?
I came across your question because I ran into the same thing today while building my own initramfs. 我遇到了您的问题,因为今天在构建自己的initramfs时遇到了同样的问题。 I did some more digging and found this: 我做了一些进一步的挖掘,发现了这一点:
http://www.silas.net.br/doc.notes/unix/linux/busybox-troubleshooting.html http://www.silas.net.br/doc.notes/unix/linux/busybox-troubleshooting.html
Then it dawned on me that I hadn't built squashfs into the kernel or loaded the module. 然后我突然意识到我没有在内核中构建squashfs或加载模块。 After I did that, everything worked! 完成之后,一切正常!
In case you haven't, make sure your kernel supports squashfs. 如果没有,请确保您的内核支持squashfs。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.