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