aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/scripts
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-18 14:34:14 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-01-18 14:34:14 +0200
commit2a606eabbbded5a7141020fb3d5cdbacba330d04 (patch)
tree73d38a54d42261f9380777c62aa12222d162d6e4 /ubi-utils/scripts
parentc842430437cbf2e584994c8eba71bf29bab6cdfc (diff)
ubi-utils: create control device node as well
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/scripts')
-rwxr-xr-xubi-utils/scripts/mkdevs.pl14
1 files changed, 13 insertions, 1 deletions
diff --git a/ubi-utils/scripts/mkdevs.pl b/ubi-utils/scripts/mkdevs.pl
index f0fd464..46d47c5 100755
--- a/ubi-utils/scripts/mkdevs.pl
+++ b/ubi-utils/scripts/mkdevs.pl
@@ -8,11 +8,22 @@
# out UBI's major number.
#
+# Create the control device as well if this UBI version supports them (were
+# added sice Linux kernel 2.6.24)
+my $ctrl = "/sys/class/misc/ubi_ctrl/dev";
+
+if (-e "$ctrl") {
+ open FILE, "<", $ctrl or die "Cannot open $ctrl file: $!\n";
+ my $devnums = <FILE>;
+ close FILE;
+
+ $devnums =~ m/(\d+):(\d+)/;
+ system("mknod /dev/ubi_ctrl c $1 $2");
+}
my $proc = '/proc/devices';
my $regexp = '(\d+) (ubi\d+)$';
-
open FILE, "<", $proc or die "Cannot open $proc file: $!\n";
my @file = <FILE>;
close FILE;
@@ -30,3 +41,4 @@ foreach (@file) {
system("mknod /dev/$2_$i c $1 $j");
}
}
+