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