Module Name:    src
Committed By:   jmcneill
Date:           Thu Jun 15 20:15:11 UTC 2017

Added Files:
        src/sys/external/gpl2/dts: dts2netbsd

Log Message:
Add dts2netbsd script


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/external/gpl2/dts/dts2netbsd

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/external/gpl2/dts/dts2netbsd
diff -u /dev/null src/sys/external/gpl2/dts/dts2netbsd:1.1
--- /dev/null	Thu Jun 15 20:15:11 2017
+++ src/sys/external/gpl2/dts/dts2netbsd	Thu Jun 15 20:15:11 2017
@@ -0,0 +1,116 @@
+#! /bin/sh
+#
+#	$NetBSD: dts2netbsd,v 1.1 2017/06/15 20:15:11 jmcneill Exp $ */
+#
+# Copyright (c) 2013, 2017 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# dts2netbsd:  prepare the dts source files and headers for import into the
+# netbsd dts source tree, under src/sys/external/gpl2/dts/dist,
+# based on the other *2netbsd scripts in the NetBSD source tree
+#
+# Instructions for importing new dts release:
+#
+#	$ cd /some/where/temporary
+#	$ ftp https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.x.y.tar.xz
+#	$ tar -jxvf linux-4.x.y.tar.xz
+#	$ DTSSRCS=$(pwd)/linux-4.x.y
+#	$ WRKDIR=/an/other/temporary
+#	$ sh /usr/src/sys/external/gpl2/dts/dts2netbsd $DTSSRCS $WRKDIR
+#	$ cd $WRKDIR
+#	$ 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
+#
+
+if [ $# -ne 2 ]; then echo "dts2netbsd src dest"; exit 1; fi
+
+r=$1
+d=$2
+
+case "$d" in
+	/*)
+		;;
+	*)
+		d=`/bin/pwd`/$d
+		;;
+esac
+
+case "$r" in
+	/*)
+		;;
+	*)
+		r=`/bin/pwd`/$r
+		;;
+esac
+
+echo preparing directory $d
+rm -rf $d
+mkdir -p $d
+
+### Copy the files and directories
+echo copying $r to $d
+cd $r
+
+mkdir -p $d/include
+cp -r $r/include/dt-bindings $d/include
+
+for arch in arm arm64 mips; do
+	mkdir -p $d/arch/${arch}/boot
+	cp -r $r/arch/${arch}/boot/dts $d/arch/${arch}/boot
+done
+
+# cd to import directory
+cd $d
+
+### dts distribution doesn't have RCS/CVS tags, so add them.
+
+### Add our NetBSD RCS Id
+find $d -type f -name '*.[ch]' -print | while read c; do
+	sed 1q < $c | grep -q '\$NetBSD' || (
+echo "/*	\$NetBSD\$	*/" >/tmp/dts2n$$
+echo "" >>/tmp/dts2n$$
+cat $c  >> /tmp/dts2n$$
+mv /tmp/dts2n$$ $c && echo added NetBSD RCS tag to $c
+	)
+done
+
+echo done
+
+### Clean up any CVS directories that might be around.
+echo "cleaning up CVS residue."
+(
+	cd $d
+	find . -type d -name "CVS" -print | xargs rm -r
+)
+echo done
+
+### Fixing file and directory permissions.
+echo "Fixing file/directory permissions."
+(
+	cd $d
+	find . -type f -print | xargs chmod u+rw,go+r
+	find . -type d -print | xargs chmod u+rwx,go+rx
+)
+echo done
+
+exit 0

Reply via email to