dwctwo2netbsd revision 1.3.4.2 1 1.3.4.2 rmind #! /bin/sh
2 1.3.4.2 rmind #
3 1.3.4.2 rmind # $NetBSD: dwctwo2netbsd,v 1.3.4.2 2014/05/18 17:46:01 rmind Exp $
4 1.3.4.2 rmind #
5 1.3.4.2 rmind # Copyright (c) 2013 The NetBSD Foundation, Inc.
6 1.3.4.2 rmind # All rights reserved.
7 1.3.4.2 rmind #
8 1.3.4.2 rmind # Redistribution and use in source and binary forms, with or without
9 1.3.4.2 rmind # modification, are permitted provided that the following conditions
10 1.3.4.2 rmind # are met:
11 1.3.4.2 rmind # 1. Redistributions of source code must retain the above copyright
12 1.3.4.2 rmind # notice, this list of conditions and the following disclaimer.
13 1.3.4.2 rmind # 2. Redistributions in binary form must reproduce the above copyright
14 1.3.4.2 rmind # notice, this list of conditions and the following disclaimer in the
15 1.3.4.2 rmind # documentation and/or other materials provided with the distribution.
16 1.3.4.2 rmind #
17 1.3.4.2 rmind # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 1.3.4.2 rmind # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 1.3.4.2 rmind # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 1.3.4.2 rmind # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 1.3.4.2 rmind # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 1.3.4.2 rmind # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 1.3.4.2 rmind # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 1.3.4.2 rmind # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 1.3.4.2 rmind # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 1.3.4.2 rmind # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 1.3.4.2 rmind # POSSIBILITY OF SUCH DAMAGE.
28 1.3.4.2 rmind #
29 1.3.4.2 rmind # dwctwo2netbsd: prepare the synopsys driver sources for import into the
30 1.3.4.2 rmind # netbsd dwc2 source tree, under src/sys/external/bsd/dwc2/dist,
31 1.3.4.2 rmind # based on the other *2netbsd scripts in the NetBSD source tree
32 1.3.4.2 rmind #
33 1.3.4.2 rmind # Instructions for importing new dwc2 release:
34 1.3.4.2 rmind #
35 1.3.4.2 rmind # $ DATE=$(date +%F)
36 1.3.4.2 rmind # $ cd /some/where/temporary
37 1.3.4.2 rmind # $ git clone -b staging.next git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
38 1.3.4.2 rmind # $ DWC2SRCS=$(pwd)/drivers/usb/dwc2
39 1.3.4.2 rmind # $ WRKDIR=/an/other/temporary
40 1.3.4.2 rmind # $ sh /usr/src/sys/external/bsd/dwc2/dwctwo2netbsd $DWC2SRCS $WRKDIR
41 1.3.4.2 rmind # $ cd $WRKDIR
42 1.3.4.2 rmind # $ cvs -d cvs.netbsd.org:/cvsroot import -m "Import dwc2 $DATE" src/sys/external/bsd/dwc2/dist SYNOPSYS dwc2-$DATE
43 1.3.4.2 rmind #
44 1.3.4.2 rmind
45 1.3.4.2 rmind if [ $# -ne 2 ]; then echo "dwctwo2netbsd src dest"; exit 1; fi
46 1.3.4.2 rmind
47 1.3.4.2 rmind r=$1
48 1.3.4.2 rmind d=$2
49 1.3.4.2 rmind
50 1.3.4.2 rmind case "$d" in
51 1.3.4.2 rmind /*)
52 1.3.4.2 rmind ;;
53 1.3.4.2 rmind *)
54 1.3.4.2 rmind d=`/bin/pwd`/$d
55 1.3.4.2 rmind ;;
56 1.3.4.2 rmind esac
57 1.3.4.2 rmind
58 1.3.4.2 rmind case "$r" in
59 1.3.4.2 rmind /*)
60 1.3.4.2 rmind ;;
61 1.3.4.2 rmind *)
62 1.3.4.2 rmind r=`/bin/pwd`/$r
63 1.3.4.2 rmind ;;
64 1.3.4.2 rmind esac
65 1.3.4.2 rmind
66 1.3.4.2 rmind echo preparing directory $d
67 1.3.4.2 rmind rm -rf $d
68 1.3.4.2 rmind mkdir -p $d
69 1.3.4.2 rmind
70 1.3.4.2 rmind ### Copy the files and directories
71 1.3.4.2 rmind echo copying $r to $d
72 1.3.4.2 rmind cd $r
73 1.3.4.2 rmind
74 1.3.4.2 rmind # Not copied
75 1.3.4.2 rmind # pci.c platform.c
76 1.3.4.2 rmind #
77 1.3.4.2 rmind for f in \
78 1.3.4.2 rmind core.c core.h core_intr.c hcd.c hcd.h hcd_ddma.c hcd_intr.c hcd_queue.c \
79 1.3.4.2 rmind hw.h
80 1.3.4.2 rmind do
81 1.3.4.2 rmind n=$(echo $f | sed -e 's:_::')
82 1.3.4.2 rmind cp $r/$f $d/dwc2_$n
83 1.3.4.2 rmind done
84 1.3.4.2 rmind
85 1.3.4.2 rmind # cd to import directory
86 1.3.4.2 rmind cd $d
87 1.3.4.2 rmind
88 1.3.4.2 rmind ### dwc2 distribution doesn't have RCS/CVS tags, so add them.
89 1.3.4.2 rmind
90 1.3.4.2 rmind ### Add our NetBSD RCS Id
91 1.3.4.2 rmind find $d -type f -name '*.[ch]' -print | while read c; do
92 1.3.4.2 rmind sed 1q < $c | grep -q '\$NetBSD' || (
93 1.3.4.2 rmind echo "/* \$NetBSD\$ */" >/tmp/dwc2n$$
94 1.3.4.2 rmind echo "" >>/tmp/dwc2n$$
95 1.3.4.2 rmind cat $c >> /tmp/dwc2n$$
96 1.3.4.2 rmind mv /tmp/dwc2n$$ $c && echo added NetBSD RCS tag to $c
97 1.3.4.2 rmind )
98 1.3.4.2 rmind done
99 1.3.4.2 rmind
100 1.3.4.2 rmind echo done
101 1.3.4.2 rmind
102 1.3.4.2 rmind ### Clean up any CVS directories that might be around.
103 1.3.4.2 rmind echo "cleaning up CVS residue."
104 1.3.4.2 rmind (
105 1.3.4.2 rmind cd $d
106 1.3.4.2 rmind find . -type d -name "CVS" -print | xargs rm -r
107 1.3.4.2 rmind )
108 1.3.4.2 rmind echo done
109 1.3.4.2 rmind
110 1.3.4.2 rmind ### Fixing file and directory permissions.
111 1.3.4.2 rmind echo "Fixing file/directory permissions."
112 1.3.4.2 rmind (
113 1.3.4.2 rmind cd $d
114 1.3.4.2 rmind find . -type f -print | xargs chmod u+rw,go+r
115 1.3.4.2 rmind find . -type d -print | xargs chmod u+rwx,go+rx
116 1.3.4.2 rmind )
117 1.3.4.2 rmind echo done
118 1.3.4.2 rmind
119 1.3.4.2 rmind exit 0
120