summaryrefslogtreecommitdiffstats
path: root/meta-netboot
diff options
context:
space:
mode:
authorRonan Le Martret <ronan.lemartret@iot.bzh>2019-06-18 14:40:30 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-06-21 11:30:38 +0000
commit576cd930a78ab554cf3d805e65b9cf13d1d77ade (patch)
treed09cfd330fbd60e2a3cf1ac7830429cec29e4e8a /meta-netboot
parentfc5919cbee54d9fad1ed83a5858a9370c375fb05 (diff)
Add support for nbd protocol v3
Add a new cmdline argument using option 'nbd.v3' that could be parsed by the initrd script used for netboot. Bug-AGL: SPEC-1423 Change-Id: I1cd189c343672631feda5bcee2e393eb46b9d000 Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
Diffstat (limited to 'meta-netboot')
-rw-r--r--meta-netboot/recipes-core/initramfs-netboot/files/init.sh11
-rw-r--r--meta-netboot/recipes-core/initramfs-netboot/initramfs-netboot_1.0.bb4
-rw-r--r--meta-netboot/recipes-support/nbd/nbd_%.bbappend6
3 files changed, 18 insertions, 3 deletions
diff --git a/meta-netboot/recipes-core/initramfs-netboot/files/init.sh b/meta-netboot/recipes-core/initramfs-netboot/files/init.sh
index d31988fd6..2def28eb1 100644
--- a/meta-netboot/recipes-core/initramfs-netboot/files/init.sh
+++ b/meta-netboot/recipes-core/initramfs-netboot/files/init.sh
@@ -25,6 +25,7 @@ SMACK=n
NBD_SERVER=
NBD_PORT=10809
NBD_DEV=/dev/nbd0
+NBD_NAMEV3=
DEBUG=n
# -------------------------------------------
@@ -76,6 +77,7 @@ for x in $(cat /proc/cmdline); do
nbd.server=*) NBD_SERVER=${x/*=/};;
nbd.port=*) NBD_PORT=${x/*=/};;
nbd.dev=*) NBD_DEV=/dev/${x/*=/};;
+ nbd.namev3=*) NBD_NAMEV3=${x/*=/};;
nbd.debug=*) DEBUG=${x/*=/};;
esac
done
@@ -99,8 +101,13 @@ grep -q smackfs /proc/filesystems && {
try=5
while :;do
log_info "Starting NBD client"
- nbd-client $NBD_SERVER $NBD_PORT $NBD_DEV && { log_info "NBD client successfully started"; break; }
- log_info "NBD client failed"
+ if [ -z "${NBD_NAMEV3}" ]; then
+ nbd-client $NBD_SERVER $NBD_PORT $NBD_DEV && { log_info "NBD client successfully started"; break; }
+ log_info "NBD client failed"
+ else
+ nbd3-client $NBD_SERVER $NBD_DEV --name $NBD_NAMEV3 && { log_info "NBD3 client successfully started"; break; }
+ log_info "NBDv3 client failed"
+ fi
[[ $try -gt 0 ]] && { log_info "Retrying ($try trie(s) left)..."; sleep 3; try=$(( try - 1 )); continue; }
bail_out "Unable to mount NBD device $NBD_DEV using server $NBD_SERVER:$NBD_PORT"
diff --git a/meta-netboot/recipes-core/initramfs-netboot/initramfs-netboot_1.0.bb b/meta-netboot/recipes-core/initramfs-netboot/initramfs-netboot_1.0.bb
index 5c85bee8f..f519694ed 100644
--- a/meta-netboot/recipes-core/initramfs-netboot/initramfs-netboot_1.0.bb
+++ b/meta-netboot/recipes-core/initramfs-netboot/initramfs-netboot_1.0.bb
@@ -5,12 +5,14 @@ SRC_URI = "file://init.sh"
S = "${WORKDIR}"
+RDEPENDS_${PN} += "nbd-client"
+
do_install() {
install -dm 0755 ${D}/etc
touch ${D}/etc/initrd-release
install -dm 0755 ${D}/dev
install -dm 0755 ${D}/sbin
- install -m 0755 ${WORKDIR}/init.sh ${D}/sbin/init
+ install -m 0755 ${WORKDIR}/init.sh ${D}/sbin/init
}
inherit allarch
diff --git a/meta-netboot/recipes-support/nbd/nbd_%.bbappend b/meta-netboot/recipes-support/nbd/nbd_%.bbappend
new file mode 100644
index 000000000..fb11ef9c2
--- /dev/null
+++ b/meta-netboot/recipes-support/nbd/nbd_%.bbappend
@@ -0,0 +1,6 @@
+
+do_install_append() {
+ mv ${D}/${sbindir}/${BPN}-client ${D}/${sbindir}/${BPN}3-client
+}
+
+FILES_${PN}-client = "${sbindir}/${BPN}3-client"