From 0b81a3e0e805ae562250f5dd7ca50d253d83f41d Mon Sep 17 00:00:00 2001 From: Arata Notsu Date: Thu, 29 Nov 2012 12:28:14 +0900 Subject: [PATCH] Remove udev stuff from the source tree Pick udev stuff from the running evironment instead. Change-Id: I90a004d0a2b83d3451e73ae351cf474a7bfd62ee --- bin/ramdisk-image-create | 8 +++++++- lib/ramdisk-defaults | 1 + lib/ramdisk-functions | 8 +++++--- udev/firmware.sh | 30 ------------------------------ udev/rules.d/50-firmware.rules | 1 - udev/rules.d/80-drivers.rules | 11 ----------- 6 files changed, 13 insertions(+), 46 deletions(-) delete mode 100755 udev/firmware.sh delete mode 100644 udev/rules.d/50-firmware.rules delete mode 100644 udev/rules.d/80-drivers.rules diff --git a/bin/ramdisk-image-create b/bin/ramdisk-image-create index 25f9988d..40dcf9b6 100755 --- a/bin/ramdisk-image-create +++ b/bin/ramdisk-image-create @@ -66,7 +66,6 @@ mk_build_dir INIT="$_DIR/../scripts/init" FUNCTIONS_D="$_DIR/../scripts/d" -LIB_UDEV="$_DIR/../udev" MODULE_DIR=$MODULE_ROOT/lib/modules/$KERNEL_VERSION FIRMWARE_DIR=$MODULE_ROOT/lib/firmware @@ -76,6 +75,13 @@ if [ ! -d "$MODULE_DIR" ]; then return 1 fi +LIB_UDEV=$LIB_UDEV_ROOT/lib/udev + +if [ ! -d "$LIB_UDEV" ]; then + echo "ERROR: udev directory not found at $LIB_UDEV" + return 1 +fi + mk_build_dir mkdir -p $TMP_BUILD_DIR/mnt TMP_MOUNT_PATH=$TMP_BUILD_DIR/mnt diff --git a/lib/ramdisk-defaults b/lib/ramdisk-defaults index 5c117e79..ce4d3a55 100644 --- a/lib/ramdisk-defaults +++ b/lib/ramdisk-defaults @@ -1,6 +1,7 @@ # options for initrd-create.sh KERNEL_VERSION=${KERNEL_VERSION:-$(uname -r)} MODULE_ROOT=${MODULE_ROOT:-""} +LIB_UDEV_ROOT=${LIB_UDEV_ROOT:-""} BUSYBOX=${BUSYBOX:-$(which busybox)} IMAGE_NAME=${IMAGE_NAME:-"ramdisk"} FLAVOURS_DIR=$(dirname $0)/../flavours diff --git a/lib/ramdisk-functions b/lib/ramdisk-functions index 4dfa08f9..046bc971 100644 --- a/lib/ramdisk-functions +++ b/lib/ramdisk-functions @@ -49,8 +49,10 @@ function create_base () { mkdir -p "$TMP_MOUNT_PATH/var/lib/dhcp" mkdir -p "$TMP_MOUNT_PATH/var/run" - - cp -a "$LIB_UDEV" "$TMP_MOUNT_PATH/lib/udev" + mkdir -p "$TMP_MOUNT_PATH/lib/udev/rules.d" + cp -a "$LIB_UDEV/rules.d/50-firmware.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d" + cp -a "$LIB_UDEV/rules.d/80-drivers.rules" "$TMP_MOUNT_PATH/lib/udev/rules.d" + cp -a "$LIB_UDEV/firmware" "$TMP_MOUNT_PATH/lib/udev" # cjk adding for hwdiscovery support cp "/sbin/dhclient-script" "$TMP_MOUNT_PATH/sbin" @@ -73,7 +75,7 @@ function populate_lib () { echo "Populating /lib" libs= - for i in "$BUSYBOX" bash lsmod modprobe udevd udevadm wget reboot shutdown $BINARY_DEPS ; do + for i in "$BUSYBOX" "$LIB_UDEV/firmware" bash lsmod modprobe udevd udevadm wget reboot shutdown $BINARY_DEPS ; do if "$BUSYBOX" --list | grep "^$i\$" >/dev/null; then continue fi diff --git a/udev/firmware.sh b/udev/firmware.sh deleted file mode 100755 index 1a13e5f7..00000000 --- a/udev/firmware.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -e - -FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \ - /lib/firmware/$(uname -r) /lib/firmware" - -err() { - echo "$@" >&2 - logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true -} - -if [ ! -e /sys$DEVPATH/loading ]; then - err "udev firmware loader misses sysfs directory" - exit 1 -fi - -for DIR in $FIRMWARE_DIRS; do - [ -e "$DIR/$FIRMWARE" ] || continue - echo 1 > /sys$DEVPATH/loading - cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data - echo 0 > /sys$DEVPATH/loading - exit 0 -done - -echo -1 > /sys$DEVPATH/loading -err "Cannot find firmware file '$FIRMWARE'" -mkdir -p /dev/.udev/firmware-missing -file=$(echo "$FIRMWARE" | sed 's:/:\\x2f:g') -ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file -exit 1 - diff --git a/udev/rules.d/50-firmware.rules b/udev/rules.d/50-firmware.rules deleted file mode 100644 index 2fbebb0e..00000000 --- a/udev/rules.d/50-firmware.rules +++ /dev/null @@ -1 +0,0 @@ -SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" diff --git a/udev/rules.d/80-drivers.rules b/udev/rules.d/80-drivers.rules deleted file mode 100644 index caf1be44..00000000 --- a/udev/rules.d/80-drivers.rules +++ /dev/null @@ -1,11 +0,0 @@ -ACTION!="add", GOTO="drivers_end" - -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe tifm_ms" -SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" -SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe ppdev" - -LABEL="drivers_end"