Revision 61
- Date:
- 2008/08/17 10:08:40
- Files:
-
- /trunk/utils/perl/ban
- /trunk/utils/perl/build_kernel
Legend:
- Added
- Removed
- Modified
-
trunk/utils/perl/ban
1 #!/usr/local/bin/perl -w 2 3 # Copyright 1996 - 2000 by Paul Johnson. 4 5 # Original author: Paul Johnson 6 # Created: Sat 04 May 1996 12:58:05 am 7 8 use strict; 9 10 use lib "/home/pjcj/nt/tools/perl/local"; 11 12 use Filenames; 13 14 my $file = Filenames->new(shift || ""); # filename 15 my $base = $file->basename(); 16 my $ext = $file->extension(); 17 18 my $year = `date +"%Y"`; # year 19 chomp $year; 20 21 my $date = `date +"%a %d %h %Y %r"`; # date 22 chomp $date; 23 $date =~ s/[AP]M/\L$&/g; 24 25 my $me = $ENV{USER} || getlogin || (getpwuid($<))[0] || "nobody"; 26 my $user = (getpwnam($me))[6]; # username 27 28 my $perl_header = <<"EOT"; 29 use strict; 30 31 require 5.005; 32 EOT 33 34 SWITCH: for ($ext) 35 { 36 /^pm$/ and do # perl module 37 { 38 print <<"EOT1", <<'EOT2', <<"EOT"; 39 # Copyright $year by Paul Johnson 40 41 # documentation at __END__ 42 43 # \$RCSfile\$ 44 # \$Revision\$ 45 # \$Date\$ 46 # \$Author\$ 47 # \$State\$ 48 # \$Locker\$ 49 50 # Original author: $user 51 # Created: $date 52 53 $perl_header 54 package $base; 55 56 EOT1 57 BEGIN 58 { 59 use Exporter (); 60 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); 61 62 $VERSION = do { my @r = (q$Revision: 0.01 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker 63 64 @ISA = qw( Exporter ); 65 @EXPORT = qw( &func1 &func2 &func4 ); 66 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ] 67 68 # your exported package globals go here, 69 # as well as any optionally exported functions 70 @EXPORT_OK = qw($Var1 %Hashit &func3); 71 } 72 73 use vars @EXPORT_OK; 74 75 use ...; # any other libraries 76 77 END { } # module clean-up code here (global destructor) 78 79 sub new 80 { 81 my $proto = shift; 82 my $class = ref($proto) || $proto; 83 my $self = { @_ }; 84 bless($self, $class); 85 $self; 86 } 87 88 EOT2 89 sub AUTOLOAD 90 { 91 my \$self = shift; 92 return if \$${base}::AUTOLOAD =~ /::DESTROY\$/; 93 my \$func = \$${base}::AUTOLOAD; 94 # print "autoloading \$func\\n"; 95 \$func =~ s/^.*:://; 96 \$self->{\$func} = shift if \@_; 97 \$self->{\$func}; 98 } 99 100 1; 101 102 __END__ 103 104 =head1 NAME 105 106 $base - a class to ... 107 108 =head1 SYNOPSIS 109 110 use $base; 111 112 =head1 DESCRIPTION 113 114 The $base class implements ... 115 116 =cut 117 EOT 118 last SWITCH; 119 }; 120 121 /^c(xx|pp)?$/ and do # c body 122 { 123 # not used any more... 124 #if defined MEMORY_TRACE 125 #define NEW(T) (mem_set_params(__LINE__, __FILE__, 0, -1), new T) 126 #else 127 #define NEW(T) new T 128 #endif 129 130 print <<"EOT1", <<'EOT2', <<"EOT3", <<'EOT4', <<"EOT"; 131 /*------------------------------------------------------------------------------ 132 133 Copyright $year by Paul Johnson 134 135 EOT1 136 $RCSfile$ 137 $Revision$ 138 $Date$ 139 $Author$ 140 $State$ 141 $Locker$ 142 143 EOT2 144 Original author: $user 145 Created: $date 146 147 EOT3 148 ------------------------------------------------------------------------------*/ 149 150 static const char *rcsid= 151 "$Id$"; 152 153 EOT4 154 #include "$base.h" 155 156 EOT 157 last SWITCH; 158 }; 159 160 /^h$/ and do # c header 161 { 162 print <<"EOT1", <<'EOT2', <<"EOT3", <<'EOT4', <<"EOT"; 163 /*------------------------------------------------------------------------------ 164 165 Copyright $year by Paul Johnson 166 167 EOT1 168 $RCSfile$ 169 $Revision$ 170 $Date$ 171 $Author$ 172 $State$ 173 $Locker$ 174 175 EOT2 176 Original author: $user 177 Created: $date 178 179 EOT3 180 ------------------------------------------------------------------------------*/ 181 182 EOT4 183 #ifndef ${base}_h 184 #define ${base}_h 185 186 EOT 187 last SWITCH; 188 }; 189 190 /^ts$/ and do # ts file 191 { 192 print <<"EOT"; 193 # Copyright $year by Paul Johnson 194 195 # Original author: $user 196 # Created: $date 197 198 use strict; 199 200 \$options = 201 { 202 purpose => "unknown - please find out ...", 203 tests => "", 204 } 205 EOT 206 last SWITCH; 207 }; 208 209 /^v$/ and do # verilog body 210 { 211 print <<"EOT"; 212 /*------------------------------------------------------------------------------ 213 214 Copyright $year by Paul Johnson 215 216 Original author: $user 217 Created: $date 218 219 ------------------------------------------------------------------------------*/ 220 221 EOT 222 last SWITCH; 223 }; 224 225 my $shell = "/usr/local/bin/perl -w"; # default shell 226 $shell = "/bin/$_" if /sh$/; 227 $shell = "/bin/$_ -f" if /^t?csh$/; 228 $shell = "/usr/local/gbin/$_" if /zsh$/; 229 print <<"EOT1", <<'EOT2', <<"EOT3", <<'EOT'; 230 #!$shell 231 232 # Copyright $year by Paul Johnson 233 234 # vim: makeprg=nmake\\ % textwidth=0 235 236 EOT1 237 # $RCSfile$ 238 # $Revision$ 239 # $Date$ 240 # $Author$ 241 # $State$ 242 # $Locker$ 243 244 EOT2 245 # Original author: $user 246 # Created: $date 247 248 EOT3 249 EOT 250 if ($shell =~ /perl/) 251 { 252 print << "EOT"; 253 $perl_header 254 use lib "/export/home6/tools/perl/local"; 255 use lib "i:/perl/local"; 256 257 use LocalLibs 1.00; # pick up our local libraries 258 EOT 259 } 260 } 261 262 print <>; 263 264 print "\n#endif\n" if $ext eq "h"; 265 266 __END__ 267 268 /*------------------------------------------------------------------------------ 269 270 Copyright TransEDA Ltd. syscmd(date +"%Y All rights reserved.") 271 272 $RCSfile$ 273 $Revision$ 274 $Date$ 275 $Author$ 276 $State$ 277 $Locker$ 278 279 Original author: syscmd(echo $USER)dnl 280 Created: syscmd(date +"%a %d %h %Y %r" | sed -e "s/AM/am/" -e "s/PM/pm/")dnl 281 282 ------------------------------------------------------------------------------*/ 283 changecom 284 define(cat,$1$2$3)dnl 285 define(newifdef,defn(`ifdef'))dnl 286 undefine(`ifdef')dnl 287 undefine(`define')dnl 288 undefine(`include')dnl 289 newifdef(`header',#ifndef cat(file,_h) 290 #define cat(file,_h) 291 292 293 #endif, 294 static const char *rcsid= 295 "$Id$"; 296 297 #include "cat(file,.h)" 298 299 #ifdef MEMORY_TRACE 300 #define NEW(T) (mem_set_params(__LINE__,__FILE__,0,-1),new (T)) 301 #else 302 #define NEW(T) new(T) 303 #endif) 304 changecom()dnl 305 #! /bin/csh -f 306 307 # Copyright TransEDA Ltd. All rights reserved. 308 309 # Module: %M% 310 # Version: %I% 311 # Version date: %E% 312 # Version time: %U% 313 # Author: syscmd(echo $USER)dnl 314 # Creation date: syscmd(date +"%a %d %h 19%y")dnl 315 # Creation time: syscmd(date +%r | tr APM apm)dnl 316 317 # %Z% %M% %I% %E% %U% 318 319 changecom()dnl 320 #! /usr/bin/perl -w 321 322 # Copyright TransEDA Ltd. syscmd(date +"%Y All rights reserved.") 323 324 # $RCSfile$ 325 # $Revision$ 326 # $Date$ 327 # $Author$ 328 # $State$ 329 # $Locker$ 330 331 # Original author: syscmd(echo $USER)dnl 332 # Created: syscmd(date +"%a %d %h %Y %r" | sed -e "s/AM/am/" -e "s/PM/pm/")dnl 333 334 # $Log$ 335 changecom()dnl 336 #! /bin/sh 337 338 # Copyright TransEDA Ltd. All rights reserved. 339 340 # Module: %M% 341 # Version: %I% 342 # Version date: %E% 343 # Version time: %U% 344 # Author: syscmd(echo $USER)dnl 345 # Creation date: syscmd(date +"%a %d %h 19%y")dnl 346 # Creation time: syscmd(date +%r | tr APM apm)dnl 347 348 # %Z% %M% %I% %E% %U% 349 350 -- Copyright TransEDA Ltd. All rights reserved. 351 352 -- Module: %M% 353 -- Version: %I% 354 -- Version date: %E% 355 -- Version time: %U% 356 -- Author: syscmd(echo $USER)dnl 357 -- Creation date: syscmd(date +"%a %d %h 19%y")dnl 358 -- Creation time: syscmd(date +%r | tr APM apm)dnl 359 360 -- %Z% %M% %I% %E% %U% 361 362 library translib; 363 use translib.integers.all; 364 use translib.synthesis.all; 365 366 library ieee; 367 use ieee.std_logic_1164.all; 368 -
trunk/utils/perl/build_kernel
1 #!/bin/sh 2 3 kernel=$1 4 patch=$2 5 build=$3 6 dryrun=$4 7 host=`hostname` 8 9 echo kernel: $kernel 10 echo patch: $patch 11 echo host: $host 12 echo build: $build 13 echo dryrun: $dryrun 14 15 if [[ "x$dryrun" == "x" ]]; then 16 cd /usr/src/linux_tree 17 rm -rf linux-$kernel 18 usq linux-$kernel.tar.bz2 19 cd linux-$kernel 20 fi 21 22 if [[ -n $patch && $patch != "none" ]]; then 23 if [[ "x$dryrun" == "x" ]]; then 24 bzcat ../patch-$patch.bz2 | patch -p1 25 cd /usr/src/linux_tree 26 rm -rf linux-$patch 27 mv linux-$kernel linux-$patch 28 fi 29 kernel=$patch 30 fi 31 32 echo 33 # echo apt-get install nvidia-kernel-src nvidia-glx-src 34 # echo cd /usr/src 35 # echo usq nvidia-kernel-src.tar.gz 36 echo cd /usr/src/linux_tree/linux-$kernel 37 echo now copy .config from the old build 38 echo cp /usr/src/linux_tree/.config . 39 echo make oldconfig 40 echo make menuconfig 41 echo cp .config /usr/src/linux_tree 42 echo make-kpkg clean 43 echo IGNORE_CC_MISMATCH=1 make-kpkg --revision=$host.$build kernel_image modules_image 44 echo cd /usr/src/linux_tree 45 echo dpkg -i kernel-image-${kernel}_$host.${build}_i386.deb 46 echo "answer n a few times if lilo is hanging (lilo runs twice)" 47 # echo dpkg -i nvidia-kernel-${kernel}_1.0.2880-3+$host.${build}_i386.deb 48 # echo cd /usr/src/nvidia-glx-1.0.2880 49 # echo dpkg-buildpackage -us -uc 50 # echo cd /usr/src 51 # echo dpkg -i nvidia-glx_1.0.2880-3_i386.deb 52 # echo dpkg -i nvidia-glx-dev_1.0.2880-3_i386.deb 53 # echo cd /usr/src/modules 54 # echo cd pcmcia-cs-3.2.4 55 # echo make clean 56 # echo make config 57 # echo make all 58 # echo make install 59 # echo cd /usr/src/modules 60 # echo cd linux-wlan-ng-0.2.0 61 # echo make clean 62 # echo make config 63 # echo make all 64 # echo make install 65 echo reboot