|
【Linux】
制作Ubuntu 18.04文件系统chroot失败
发表于 2021-12-8 15:31:36
浏览:4417
|
回复:1
打印
只看该作者
[复制链接]
楼主
在官网下载ubuntu-base-18.04.5-base-arm64.tar.gz,解压执行./ch-mount.sh -m ubuntu/时提示chroot: failed to run command ‘/bin/bash’: No such file or directory
ch-mount.sh文件内容如下
#!/bin/bash
function mnt() {
echo "MOUNTING"
sudo mount -t proc /proc ${2}proc
sudo mount -t sysfs /sys ${2}sys
sudo mount -o bind /dev ${2}dev
sudo chroot ${2}
}
function umnt() {
echo "UNMOUNTING"
sudo umount ${2}proc
sudo umount ${2}sys
sudo umount ${2}dev
}
if [ "$1" == "-m" ] && [ -n "$2" ] ;
then
mnt $1 $2
elif [ "$1" == "-u" ] && [ -n "$2" ];
then
umnt $1 $2
else
echo ""
echo "Either 1'st, 2'nd or both parameters were missing"
echo ""
echo "1'st parameter can be one of these: -m(mount) OR -u(umount)"
echo "2'nd parameter is the full path of rootfs directory(with trailing '/')"
echo ""
echo "For example: ch-mount -m /media/sdcard/"
echo ""
echo 1st parameter : ${1}
echo 2nd parameter : ${2}
fi
|
|