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