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