#! /usr/bin/perl -w use strict; use warnings; # # # # include # include/linux # include/linux/dsl_avm_event.h # include/linux/avm_power.h # include/linux/avm_cpmac.h # include/linux/avm_event.h # include/linux/avm_led.h # include/linux/ar7wdt.h # include/linux/avm_profile.h # include/linux/avm_debug.h # include/new_capi.h # etc # etc/rc.vdsl.sh # lib # lib/modules # # kernel # source # build # # # vmlinux # lha.options # System.map # add-file-kernel # ########################################################################################## # ########################################################################################## my %add_file; $add_file{modules_pcimap} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_dep} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_ieee1394map} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_usbmap} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_ccwmap} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_isapnpmap} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_inputmap} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_ofmap} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_seriomap} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_alias} = { "modes" => "555", "tags" => "BASIS" }; $add_file{modules_symbols} = { "modes" => "555", "tags" => "BASIS" }; $add_file{drivers}{atm}{avm_atm}{tiatm_ko} = { "modes" => "555", "tags" => "ATM" }; $add_file{drivers}{block}{loop_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{drivers}{block}{nbd_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{drivers}{cdrom}{cdrom_ko} = { "modes" => "555", "tags" => "USB_STORAGE" }; $add_file{drivers}{char}{Piglet}{Piglet_ko} = { "modes" => "555", "tags" => "XILINX" }; $add_file{drivers}{char}{Piglet_noemif}{Piglet_noemif_ko} = { "modes" => "555", "tags" => "XILINX" }; $add_file{drivers}{char}{flash_update}{flash_update_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{drivers}{char}{ubik2}{ubik2_ko} = { "modes" => "555", "tags" => "UBIK2,ISDN" }; $add_file{drivers}{isdn}{capi}{capiconn_ko} = { "modes" => "555", "tags" => "DROP" }; $add_file{drivers}{isdn}{capi_codec}{capi_codec_ko} = { "modes" => "555", "tags" => "ISDN" }; $add_file{drivers}{isdn}{isdn_fon3}{zzz}{isdn_fbox_ko} = { "modes" => "555", "tags" => "ISDN" }; $add_file{drivers}{isdn}{isdn_fon4}{zzz}{isdn_fbox_ko} = { "modes" => "555", "tags" => "ISDN" }; $add_file{drivers}{net}{dummy_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{drivers}{net}{wireless}{avm_wlan}{wlan}{tiap_ko} = { "modes" => "555", "tags" => "WLAN" }; $add_file{drivers}{scsi}{scsi_mod_ko} = { "modes" => "555", "tags" => "USB_STORAGE" }; $add_file{drivers}{scsi}{sd_mod_ko} = { "modes" => "555", "tags" => "USB_STORAGE" }; $add_file{drivers}{scsi}{sg_ko} = { "modes" => "555", "tags" => "USB_STORAGE" }; $add_file{drivers}{scsi}{sr_mod_ko} = { "modes" => "555", "tags" => "USB_STORAGE" }; $add_file{drivers}{usb}{ahci}{usbahcicore_ko} = { "modes" => "555", "tags" => "USB_AVM_HOST" }; $add_file{drivers}{usb}{class}{usblp_ko} = { "modes" => "555", "tags" => "USB_PRINT" }; $add_file{drivers}{usb}{core}{usbcore_ko} = { "modes" => "555", "tags" => "USB" }; $add_file{drivers}{usb}{misc}{usbauth}{usbauth_ko} = { "modes" => "555", "tags" => "USB_AUTH" }; $add_file{drivers}{usb}{mon}{usbmon_ko} = { "modes" => "555", "tags" => "USB" }; $add_file{drivers}{usb}{storage}{usb_storage_ko} = { "modes" => "555", "tags" => "USB_STORAGE" }; $add_file{drivers}{vinax}{drv_vinax_ko} = { "modes" => "555", "tags" => "VDSL" }; $add_file{fs}{ext2}{ext2_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{fs}{fat}{fat_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{fs}{isofs}{isofs_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{fs}{jffs2}{jffs2_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{fs}{mbcache_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{fs}{msdos}{msdos_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{fs}{nls}{nls_cp437_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{fs}{nls}{nls_iso8859_1_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{fs}{nls}{nls_iso8859_15_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{fs}{vfat}{vfat_ko} = { "modes" => "555", "tags" => "FILESYSTEM" }; $add_file{net}{sched}{cls_basic_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{net}{sched}{cls_tcindex_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{net}{sched}{cls_u32_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{net}{sched}{sch_atm_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{net}{sched}{sch_cbq_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{net}{sched}{sch_hfsc_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{net}{sched}{sch_htb_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{net}{sched}{sch_prio_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{net}{sched}{sch_sfq_ko} = { "modes" => "555", "tags" => "BASIS" }; $add_file{net}{sched}{sch_tbf_ko} = { "modes" => "555", "tags" => "BASIS" }; my $mode = $ARGV[0]; shift @ARGV; my $source_path = $ARGV[0]; shift @ARGV; my @ref_list; ########################################################################################## # ########################################################################################## sub find_end_of_tree { my ($level, $tree, $ref) = @_; if(defined($ref->{tags})) { # print "[" . $level . "][" . $tree . "] TAG found: " . $ref->{tags} . "\n"; push(@ref_list, (\%{$ref})); return 0; } foreach my $iii (keys %{$ref}) { # print "use: " . $iii . "\n"; if(defined($ref->{$iii})) { find_end_of_tree($level + 1, $tree . "/" . $iii, \%{$ref->{$iii}}); } } } ########################################################################################## # ########################################################################################## sub write_one_line { my ($source_path, $dest_path) = @_; my $ref; my $i; open (OUTPUT, ">>add-file-kernel") or die "ERROR could not open \"add-file-kernel\" for write"; # print "[write_one_line] source=" . $source_path . " file=" . $dest_path . "\n"; $ref = pop(@ref_list); $i = pop(@ref_list); if(defined($i)) { push(@ref_list, ($i)); print OUTPUT "[" . $ref->{tags}; foreach $i (@ref_list) { print OUTPUT "," . $i->{tags}; } print OUTPUT "] "; } else { if($ref->{tags} =~ /.*,.*/) { print OUTPUT "[" . $ref->{tags} . "] "; } else { print OUTPUT $ref->{tags} . " "; } } if($mode eq "dir") { print OUTPUT "D 777 "; } else { print OUTPUT "F " . $ref->{modes} . " "; } print OUTPUT $source_path . "/." . $dest_path . " ." . $dest_path . "\n"; close OUTPUT; } foreach my $i (@ARGV) { my $filename = $i; my $ref = \%add_file; my $found = 0; my $tree = ""; # print "# process " . $i . " => "; $i =~ s/filesystem\/(.*)\/kernel\///g; # print "# process " . $i . "\n"; $i =~ s/-/_/g; $i =~ s/\.ko/_ko/g; $filename =~ s/filesystem//; @ref_list = (); foreach my $ii (split("/", $i)) { # print "# part " . $ii . "\n"; if(defined($ref->{$ii})) { $ref = \%{$ref->{$ii}}; $tree = $tree . "/" . $ii; } else { # print "not found give up\n"; last; } if(defined($ref->{tags})) { push(@ref_list, (\%{$ref})); # print "TAG found: " . $ref->{tags} . "\n"; $found = 1; last; } } if($found == 0) { find_end_of_tree(0, $tree, $ref); # print "TAGS found: "; # foreach my $iiii (@ref_list) { # print $iiii->{tags} . " "; # } # print "\n"; } my @new_ref_list = @ref_list; my $last = ""; @ref_list = (); foreach $ref (sort {$a->{tags} cmp $b->{tags}} @new_ref_list) { # foreach $ref (sort @new_ref_list) { if($last eq $ref->{tags}) { # print "drop " . $last . "\n"; next; } $last = $ref->{tags}; # print "use " . $last . "\n"; push(@ref_list, ($ref)); } write_one_line($source_path, $filename); }