Package: yaird
Version: 0.0.12-18
Severity: normal
Tags: patch

Hello,

currently, if a filesystem to be mounted is detected to be of type
'vfat', only the vfat module is copied onto the initramfs image.

However, vfat mounting additionally requires native language support
modules (e.g. nls-cp437 and nls-iso8859-1) to be available, if not
built into the kernel. Thus, mounting a FAT filesystem at boot time
currently fails with a standard Debian kernel.

The patch below adds support for adding codepage and iocharset modules,
considering either the codepage= and iocharset= fstab attributes, the
kernel config values of FAT_DEFAULT_CODEPAGE and FAT_DEFAULT_IOCHARSET,
or the vfat default values of codepage 437 and iocharset iso8859-1.

Regards,
Peter
diff -urN yaird-0.0.12.orig/perl/KConfig.pm yaird-0.0.12/perl/KConfig.pm
--- yaird-0.0.12.orig/perl/KConfig.pm   2006-10-22 12:02:19.000000000 +0200
+++ yaird-0.0.12/perl/KConfig.pm        2006-10-22 12:54:34.000000000 +0200
@@ -148,6 +148,46 @@
        coda => [ 'CODA_FS' ],
        kafs => [ 'AFS_FS' ],
 
+       # native language support
+       'nls-cp437' => [ 'NLS_CODEPAGE_437' ],
+       'nls-cp737' => [ 'NLS_CODEPAGE_737' ],
+       'nls-cp775' => [ 'NLS_CODEPAGE_775' ],
+       'nls-cp850' => [ 'NLS_CODEPAGE_850' ],
+       'nls-cp852' => [ 'NLS_CODEPAGE_852' ],
+       'nls-cp855' => [ 'NLS_CODEPAGE_855' ],
+       'nls-cp857' => [ 'NLS_CODEPAGE_857' ],
+       'nls-cp860' => [ 'NLS_CODEPAGE_860' ],
+       'nls-cp861' => [ 'NLS_CODEPAGE_861' ],
+       'nls-cp862' => [ 'NLS_CODEPAGE_862' ],
+       'nls-cp863' => [ 'NLS_CODEPAGE_863' ],
+       'nls-cp864' => [ 'NLS_CODEPAGE_864' ],
+       'nls-cp865' => [ 'NLS_CODEPAGE_865' ],
+       'nls-cp866' => [ 'NLS_CODEPAGE_866' ],
+       'nls-cp869' => [ 'NLS_CODEPAGE_869' ],
+       'nls-cp936' => [ 'NLS_CODEPAGE_936' ],
+       'nls-cp950' => [ 'NLS_CODEPAGE_950' ],
+       'nls-cp932' => [ 'NLS_CODEPAGE_932' ],
+       'nls-cp949' => [ 'NLS_CODEPAGE_949' ],
+       'nls-cp874' => [ 'NLS_CODEPAGE_874' ],
+       'nls-iso8859-8' => [ 'NLS_ISO8859_8' ],
+       'nls-cp1250' => [ 'NLS_CODEPAGE_1250' ],
+       'nls-cp1251' => [ 'NLS_CODEPAGE_1251' ],
+       'nls-ascii' => [ 'NLS_ASCII' ],
+       'nls-iso8859-1' => [ 'NLS_ISO8859_1' ],
+       'nls-iso8859-2' => [ 'NLS_ISO8859_2' ],
+       'nls-iso8859-3' => [ 'NLS_ISO8859_3' ],
+       'nls-iso8859-4' => [ 'NLS_ISO8859_4' ],
+       'nls-iso8859-5' => [ 'NLS_ISO8859_5' ],
+       'nls-iso8859-6' => [ 'NLS_ISO8859_6' ],
+       'nls-iso8859-7' => [ 'NLS_ISO8859_7' ],
+       'nls-iso8859-9' => [ 'NLS_ISO8859_9' ],
+       'nls-iso8859-13' => [ 'NLS_ISO8859_13' ],
+       'nls-iso8859-14' => [ 'NLS_ISO8859_14' ],
+       'nls-iso8859-15' => [ 'NLS_ISO8859_15' ],
+       'nls-koi8-r' => [ 'NLS_KOI8_R' ],
+       'nls-koi8-u' => [ 'NLS_KOI8_U' ],
+       'nls-utf8' => [ 'NLS_UTF8' ],
+
        # network
        'af-packet' => [ 'PACKET' ],
 
@@ -220,6 +260,20 @@
 }
 
 #
+# getValue -- return config value for a given config key
+#
+sub getValue ($) {
+       my ($confKey) = @_;
+       init;
+       my $confVal = $kConfMap->{"CONFIG_$confKey"};
+       if (defined ($confVal)) {
+               # config type of "string"
+               $confVal =~ s/^"(.*)"$/$1/;
+       }
+       return $confVal;
+}
+
+#
 # allKnownModules -- return list of all module names for
 # which a corresponding kernel define is known.
 #
--- yaird-0.0.12.orig/perl/Plan.pm      2006-10-22 12:02:19.000000000 +0200
+++ yaird-0.0.12/perl/Plan.pm   2006-10-22 12:40:54.000000000 +0200
@@ -682,6 +683,20 @@
                }
 
                ModProbe::addModules ($actions, [ $type ]);
+               if ($type eq 'vfat') {
+                       my $codepage = (
+                               $root->opts->get ('codepage')
+                               || KConfig::getValue ('FAT_DEFAULT_CODEPAGE')
+                               || '437'
+                       );
+                       my $iocharset = (
+                               $root->opts->get ('iocharset')
+                               || KConfig::getValue ('FAT_DEFAULT_IOCHARSET')
+                               || 'iso8859-1'
+                       );
+                       ModProbe::addModules ($actions, [ 'nls-cp' . $codepage 
]);
+                       ModProbe::addModules ($actions, [ 'nls-' . lc 
($iocharset) ]);
+               }
        }
 
        my $yspecial = $abd->yspecial();

Reply via email to