Home | History | Annotate | Line # | Download | only in dwc2
dwctwo2netbsd revision 1.3.12.1
      1       1.1  skrll #! /bin/sh
      2       1.1  skrll #
      3  1.3.12.1  skrll #	$NetBSD: dwctwo2netbsd,v 1.3.12.1 2015/09/22 12:06:06 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.3.12.1  skrll #	$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
     38       1.3  skrll #	$ DWC2SRCS=$(pwd)/drivers/usb/dwc2
     39       1.2  skrll #	$ WRKDIR=/an/other/temporary
     40       1.2  skrll #	$ sh /usr/src/sys/external/bsd/dwc2/dwctwo2netbsd $DWC2SRCS $WRKDIR
     41       1.2  skrll #	$ cd $WRKDIR
     42       1.1  skrll #	$ cvs -d cvs.netbsd.org:/cvsroot import -m "Import dwc2 $DATE" src/sys/external/bsd/dwc2/dist SYNOPSYS dwc2-$DATE
     43       1.1  skrll #
     44       1.1  skrll 
     45       1.1  skrll if [ $# -ne 2 ]; then echo "dwctwo2netbsd src dest"; exit 1; fi
     46       1.1  skrll 
     47       1.1  skrll r=$1
     48       1.1  skrll d=$2
     49       1.1  skrll 
     50       1.1  skrll case "$d" in
     51       1.1  skrll 	/*)
     52       1.1  skrll 		;;
     53       1.1  skrll 	*)
     54       1.1  skrll 		d=`/bin/pwd`/$d
     55       1.1  skrll 		;;
     56       1.1  skrll esac
     57       1.1  skrll 
     58       1.1  skrll case "$r" in
     59       1.1  skrll 	/*)
     60       1.1  skrll 		;;
     61       1.1  skrll 	*)
     62       1.1  skrll 		r=`/bin/pwd`/$r
     63       1.1  skrll 		;;
     64       1.1  skrll esac
     65       1.1  skrll 
     66       1.1  skrll echo preparing directory $d
     67       1.1  skrll rm -rf $d
     68       1.1  skrll mkdir -p $d
     69       1.1  skrll 
     70       1.1  skrll ### Copy the files and directories
     71       1.1  skrll echo copying $r to $d
     72       1.1  skrll cd $r
     73       1.1  skrll 
     74       1.1  skrll # Not copied
     75       1.1  skrll # pci.c platform.c
     76       1.1  skrll #
     77       1.1  skrll for f in \
     78       1.1  skrll     core.c core.h core_intr.c hcd.c hcd.h hcd_ddma.c hcd_intr.c hcd_queue.c \
     79       1.1  skrll     hw.h
     80       1.1  skrll do
     81       1.1  skrll 	n=$(echo $f | sed -e 's:_::')
     82       1.1  skrll 	cp $r/$f $d/dwc2_$n
     83       1.1  skrll done
     84       1.1  skrll 
     85       1.1  skrll # cd to import directory
     86       1.1  skrll cd $d
     87       1.1  skrll 
     88       1.1  skrll ### dwc2 distribution doesn't have RCS/CVS tags, so add them.
     89       1.1  skrll 
     90       1.1  skrll ### Add our NetBSD RCS Id
     91       1.1  skrll find $d -type f -name '*.[ch]' -print | while read c; do
     92       1.1  skrll 	sed 1q < $c | grep -q '\$NetBSD' || (
     93       1.1  skrll echo "/*	\$NetBSD\$	*/" >/tmp/dwc2n$$
     94       1.1  skrll echo "" >>/tmp/dwc2n$$
     95       1.1  skrll cat $c  >> /tmp/dwc2n$$
     96       1.1  skrll mv /tmp/dwc2n$$ $c && echo added NetBSD RCS tag to $c
     97       1.1  skrll 	)
     98       1.1  skrll done
     99       1.1  skrll 
    100       1.1  skrll echo done
    101       1.1  skrll 
    102       1.1  skrll ### Clean up any CVS directories that might be around.
    103       1.1  skrll echo "cleaning up CVS residue."
    104       1.1  skrll (
    105       1.1  skrll 	cd $d
    106       1.1  skrll 	find . -type d -name "CVS" -print | xargs rm -r
    107       1.1  skrll )
    108       1.1  skrll echo done
    109       1.1  skrll 
    110       1.1  skrll ### Fixing file and directory permissions.
    111       1.1  skrll echo "Fixing file/directory permissions."
    112       1.1  skrll (
    113       1.1  skrll 	cd $d
    114       1.1  skrll 	find . -type f -print | xargs chmod u+rw,go+r
    115       1.1  skrll 	find . -type d -print | xargs chmod u+rwx,go+rx
    116       1.1  skrll )
    117       1.1  skrll echo done
    118       1.1  skrll 
    119       1.1  skrll exit 0
    120