From 126777bc019a54afb4ec51299f2cf9d2841698aa Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 25 Apr 2007 12:26:16 +0000 Subject: re-sync after the big svn loss --- mdk-stage1/pcmcia-resource/Makefile | 24 +++++++++++++++ mdk-stage1/pcmcia-resource/update-pcmcia-ids.pl | 41 +++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 mdk-stage1/pcmcia-resource/Makefile create mode 100755 mdk-stage1/pcmcia-resource/update-pcmcia-ids.pl (limited to 'mdk-stage1/pcmcia-resource') diff --git a/mdk-stage1/pcmcia-resource/Makefile b/mdk-stage1/pcmcia-resource/Makefile new file mode 100644 index 000000000..46dda9be1 --- /dev/null +++ b/mdk-stage1/pcmcia-resource/Makefile @@ -0,0 +1,24 @@ + #****************************************************************************** + # + # Olivier Blin (blino@mandriva.com) + # + # Copyright 2006 Mandriva + # + # This software may be freely redistributed under the terms of the GNU + # public license. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + # + #***************************************************************************** + +TARGET=pcmcia-ids.h + +all: $(TARGET) + +$(TARGET): + perl update-pcmcia-ids.pl > $@ || { rm -f $@; exit 1; } + +clean: + rm -f $(TARGET) diff --git a/mdk-stage1/pcmcia-resource/update-pcmcia-ids.pl b/mdk-stage1/pcmcia-resource/update-pcmcia-ids.pl new file mode 100755 index 000000000..2dd7728b6 --- /dev/null +++ b/mdk-stage1/pcmcia-resource/update-pcmcia-ids.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl + +use strict; +use MDK::Common; + +my @aliases; +my ($main) = `ls -t /lib/modules/*/modules.alias`; +foreach (cat_(chomp_($main))) { + push @aliases, [ $1, $2 ] if /^alias\s+(pcmcia:\S+)\s+(\S+)$/; #- modalias, module +} +@aliases or die "unable to get PCMCIA aliases"; + +print ' +struct pcmcia_alias { + const char *modalias; + const char *module; +}; + +'; + +my %t = ( + network => 'network/pcmcia', + medias => 'disk/pcmcia', +); + +foreach my $type (keys %t) { + my @modules = chomp_(`perl ../../kernel/modules.pl pci_modules4stage1 "$t{$type}"`) + or die "unable to get PCMCIA modules"; + + print "#ifndef DISABLE_".uc($type)." +struct pcmcia_alias ${type}_pcmcia_ids[] = { +"; + print qq|\t{ "$_->[0]", "$_->[1]" },\n| foreach grep { member($_->[1], @modules) } @aliases; + print "}; +unsigned int ${type}_pcmcia_num_ids = sizeof(${type}_pcmcia_ids) / sizeof(struct pcmcia_alias); + +#endif + +"; + +} -- cgit v1.2.1