mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-10 03:17:49 +00:00
busybox-initramfs: init: add support for NBD mounts
Example kernel command parameter: boot=NBD=192.168.1.1:2000 Signed-off-by: Alain Kalker <a.c.kalker@gmail.com>
This commit is contained in:
parent
a3f3a62767
commit
ac1d0eb0d9
@ -28,6 +28,8 @@ IMAGE_SYSTEM="SYSTEM"
|
|||||||
IMAGE_KERNEL="KERNEL"
|
IMAGE_KERNEL="KERNEL"
|
||||||
REBOOT="0"
|
REBOOT="0"
|
||||||
|
|
||||||
|
NBD_DEVS="0"
|
||||||
|
|
||||||
# mount all needed special filesystems
|
# mount all needed special filesystems
|
||||||
/bin/busybox mount -t devtmpfs none /dev
|
/bin/busybox mount -t devtmpfs none /dev
|
||||||
/bin/busybox mount -t proc none /proc
|
/bin/busybox mount -t proc none /proc
|
||||||
@ -123,6 +125,20 @@ REBOOT="0"
|
|||||||
[ "$ERR_ENV" -ne "0" ] && error "mount_common" "Could not mount $1"
|
[ "$ERR_ENV" -ne "0" ] && error "mount_common" "Could not mount $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mount_nbd() {
|
||||||
|
# Mount NBD device
|
||||||
|
NBD_SERVER="${1%%:*}"
|
||||||
|
NBD_PORT="${1#*:}"
|
||||||
|
NBD_DEV="/dev/nbd$NBD_DEVS"
|
||||||
|
|
||||||
|
$IONICE /bin/busybox nbd-client $NBD_SERVER $NBD_PORT $NBD_DEV > /dev/null 2>&1 || \
|
||||||
|
error "nbd-client" "Could not connect to NBD server $1"
|
||||||
|
|
||||||
|
mount_common "$NBD_DEV" "$2" "$3" "$4"
|
||||||
|
|
||||||
|
NBD_DEVS=$(( ${NBD_DEVS} + 1 ))
|
||||||
|
}
|
||||||
|
|
||||||
mount_part() {
|
mount_part() {
|
||||||
# Mount a local or network filesystem
|
# Mount a local or network filesystem
|
||||||
# $1:[TYPE=]target, $2:mountpoint, $3:mount options, [$4:fs type]
|
# $1:[TYPE=]target, $2:mountpoint, $3:mount options, [$4:fs type]
|
||||||
@ -134,6 +150,9 @@ REBOOT="0"
|
|||||||
MOUNT_CMD="mount_common"
|
MOUNT_CMD="mount_common"
|
||||||
MOUNT_TARGET="$1"
|
MOUNT_TARGET="$1"
|
||||||
;;
|
;;
|
||||||
|
NBD=*)
|
||||||
|
MOUNT_CMD="mount_nbd"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
error "mount_part" "Unknown filesystem $1"
|
error "mount_part" "Unknown filesystem $1"
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user