Commit 95919854 authored by Andrey Filippov's avatar Andrey Filippov

autogeneration of mknod

parent 3f29764c
.project
.cproject
.pydevproject
.settings
*.directory
generated*
TARGETDIR=$(DESTDIR)/lib/udev/devices
X393_DEVICES=$(STAGING_DIR_HOST)/usr/include-uapi/elphel/x393_devices.h
include generated_include
generated_include:$(X393_DEVICES) generate_mknods.py
@echo "running make all"
@echo $(STAGING_DIR_HOST)
@echo $(X393_DEVICES)
./generate_mknods.py $(X393_DEVICES) >generated_include
install:
install:generated_include
install -d $(DESTDIR)/etc/udev/rules.d
install -m 644 90-elphel-automount.rules $(DESTDIR)/etc/udev/rules.d
install -d $(TARGETDIR)
mknod -m 0622 $(TARGETDIR)/circbuf0 c 135 32
mknod -m 0622 $(TARGETDIR)/circbuf1 c 135 33
mknod -m 0622 $(TARGETDIR)/circbuf2 c 135 34
mknod -m 0622 $(TARGETDIR)/circbuf3 c 135 35
mknod -m 0622 $(TARGETDIR)/jpeghead0 c 135 48
mknod -m 0622 $(TARGETDIR)/jpeghead1 c 135 49
mknod -m 0622 $(TARGETDIR)/jpeghead2 c 135 50
mknod -m 0622 $(TARGETDIR)/jpeghead3 c 135 51
mknod -m 0622 $(TARGETDIR)/exif_exif0 c 125 16
mknod -m 0622 $(TARGETDIR)/exif_exif1 c 125 17
mknod -m 0622 $(TARGETDIR)/exif_exif2 c 125 18
mknod -m 0622 $(TARGETDIR)/exif_exif3 c 125 19
mknod -m 0622 $(TARGETDIR)/exif_meta0 c 125 32
mknod -m 0622 $(TARGETDIR)/exif_meta1 c 125 33
mknod -m 0622 $(TARGETDIR)/exif_meta2 c 125 34
mknod -m 0622 $(TARGETDIR)/exif_meta3 c 125 35
mknod -m 0622 $(TARGETDIR)/exif_template c 125 2
mknod -m 0622 $(TARGETDIR)/exif_metadir c 125 3
@$(mknodes)
clean:
rm -f generated_include
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>elphel-udev-rules</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
#!/usr/bin/env python
# encoding: utf-8
'''
# Copyright (C) 2016, Elphel.inc.
# Generate static device nodes from the header file with drivers/devices definitions
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@author: Andrey Filippov
@copyright: 2016 Elphel, Inc.
@license: GPLv3.0+
@contact: andrey@elphel.coml
@deffield updated: Updated
'''
from __future__ import division
from __future__ import print_function
#from __builtin__ import str
import sys
import re
__author__ = "Andrey Filippov"
__copyright__ = "Copyright 2015, Elphel, Inc."
__license__ = "GPL"
__version__ = "3.0+"
__maintainer__ = "Andrey Filippov"
__email__ = "andrey@elphel.com"
__status__ = "Development"
def process_header():
print("define mknodes =")
# files = []
pat=re.compile(r'#define\s+(\w+)\s+\(\s*"([^"]+)"\s*,\s*"([^"]+)"\s*,\s*(\w*)\s*,\s*(\w*)\s*,\s*"([^"]+)"\s*,\s*"([^"]+)"\s*\)(.*)')
f = open(sys.argv[1], "r")
line = f.readline()
while line:
fs = pat.search(line)
if fs:
print("mknod -m %s $(TARGETDIR)/%-20s %s %3s %3s #%s"%(
fs.group(6), fs.group(2), fs.group(7), fs.group(4), fs.group(5), fs.group(8).strip(" \t/<*")))
# files.append(fs.group(2))
line = f.readline()
# for f in files:
# print("chown root:root $(TARGETDIR)/%-20s"%(f))
print("endef")
# mknod -m 0622 $(TARGETDIR)/circbuf0 c 135 32
if __name__ == "__main__":
process_header()
#!/bin/sh
mknod -m 0622 $1/circbuf0 c 135 32
mknod -m 0622 $1/circbuf1 c 135 33
mknod -m 0622 $1/circbuf2 c 135 34
mknod -m 0622 $1/circbuf3 c 135 35
mknod -m 0622 $1/jpeghead0 c 135 48
mknod -m 0622 $1/jpeghead1 c 135 49
mknod -m 0622 $1/jpeghead2 c 135 50
mknod -m 0622 $1/jpeghead3 c 135 51
mknod -m 0622 $1/exif_exif0 c 125 16
mknod -m 0622 $1/exif_exif1 c 125 17
mknod -m 0622 $1/exif_exif2 c 125 18
mknod -m 0622 $1/exif_exif3 c 125 19
mknod -m 0622 $1/exif_meta0 c 125 32
mknod -m 0622 $1/exif_meta1 c 125 33
mknod -m 0622 $1/exif_meta2 c 125 34
mknod -m 0622 $1/exif_meta3 c 125 35
mknod -m 0622 $1/exif_template c 125 2
mknod -m 0622 $1/exif_metadir c 125 3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment