From f7091cb2fc973271b1c063b892bf083b41d3c9fa Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 12 Nov 2012 16:56:08 +0000 Subject: [PATCH] Add support for flavours to ship udev rules.d files and port over the mellanox variant to use this --- bin/ramdisk-image-create | 1 + flavours/mellanox/README.md | 1 + flavours/mellanox/init | 3 +++ flavours/mellanox/udev/81-mellanox-drivers.rules | 6 ++++++ lib/ramdisk-functions | 13 ++++++++++++- 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 flavours/mellanox/README.md create mode 100644 flavours/mellanox/init create mode 100644 flavours/mellanox/udev/81-mellanox-drivers.rules diff --git a/bin/ramdisk-image-create b/bin/ramdisk-image-create index 23dd0ba5..25f9988d 100755 --- a/bin/ramdisk-image-create +++ b/bin/ramdisk-image-create @@ -86,6 +86,7 @@ create_base populate_lib populate_busybox populate_init +populate_udev finalise_image save_image $IMAGE_NAME diff --git a/flavours/mellanox/README.md b/flavours/mellanox/README.md new file mode 100644 index 00000000..c3932d57 --- /dev/null +++ b/flavours/mellanox/README.md @@ -0,0 +1 @@ +Flavour to force support for mellanox hardware diff --git a/flavours/mellanox/init b/flavours/mellanox/init new file mode 100644 index 00000000..2608ca22 --- /dev/null +++ b/flavours/mellanox/init @@ -0,0 +1,3 @@ +# extra load for mellanox +modprobe mlx4_en + diff --git a/flavours/mellanox/udev/81-mellanox-drivers.rules b/flavours/mellanox/udev/81-mellanox-drivers.rules new file mode 100644 index 00000000..eda32596 --- /dev/null +++ b/flavours/mellanox/udev/81-mellanox-drivers.rules @@ -0,0 +1,6 @@ +ACTION!="add", GOTO="drivers_end" + +SUBSYSTEM=="net", RUN+="/sbin/modprobe mlx4_en" + +LABEL="drivers_end" + diff --git a/lib/ramdisk-functions b/lib/ramdisk-functions index 8496007d..1e0fe8b1 100644 --- a/lib/ramdisk-functions +++ b/lib/ramdisk-functions @@ -101,7 +101,6 @@ function populate_busybox () { function populate_init () { echo "Installing init" - # XXX: This needs to understand flavours and the pre-shipped init needs to split up cp "$INIT" "$TMP_MOUNT_PATH/init" chmod +x $TMP_MOUNT_PATH/init for F in "$FUNCTIONS_D"/* ; do @@ -129,3 +128,15 @@ function finalise_image () { (cd "$TMP_MOUNT_PATH"; find . | cpio -o -H newc | gzip > "$TMP_IMAGE_PATH" ) } +function populate_udev () { + echo "Installing udev rules" + + for _FLVR in ${RAMDISK_FLAVOUR} ; do + _DIR="${FLAVOURS_DIR}/${_FLVR}/udev" + if [ -d $_DIR ]; then + find $_DIR -type f -exec cp -v {} $TMP_MOUNT_PATH/lib/udev/rules.d/ \; + fi + done +} + +