This is a suggestion for a patch to fix the broken ubox kmodloader/insmod
preventing certain nls codepage modules from being loaded. Most important one
is nls_iso8859-1.ko as it is used by most FAT based drives, and its absence
makes mounting most USB sticks impossible.
The bug was introduced by r38019 and there are already two bugs about this:
https://dev.openwrt.org/ticket/14182 and https://dev.openwrt.org/ticket/14189
I have created a patch for ubox that works for me. The nls_iso8859-1 module
gets now properly loaded at the startup. Developers should either implement
this patch or devise a better solution ;-)
Background:
The original reason lies with Linux sources. Some of the nls code page module
file name are strange, as they contain both _ and -. Link to Linux sources:
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/fs/nls
Modprobe implementations apparently try to convert most module names to
underscores, but finding those mixed-name nls files will then be impossible.
The original mixed module name (nls_iso8859-1) is not preserved and tested
file name variations are either "all _" or "all -", but not "mixed _ and -".
Openwrt modprobe is not the first one to run into this. Google search reveals
frustration about the same problem elsewhere:
http://www.google.com/search?q=modprobe+8859+error
<https://www.google.com/search?q=modprobe+8859+error>
There are 4 basic ways to solve:
1) Change filenames in Linux sources (and in module definitions). Or
duplicate the files (nls_iso8859_1.ko). Or something like that.
2) Abandon ubox modprobe & insmod. Busybox insmod works ok. Not likely, as
Openwrt has just introduced ubox based modprobe/insmod with r38019.
3) Handle nls codepage module names differently in modprobe = ubox. I tried
that earlier this week, but apparently the modprobe uses various functions to
handle the module name, so trying to preserve original mixed name for nls*
modules did not quite succeed.
4) Handle file search for the nls module files differently in modprobe =
ubox. If the module name starts with "nls", assume that it may contain later
a dash "-", despite it being already standardized to underscore "_" in the
module name. Note that there are no nls file names with a second _ after the
original nls_ .
Based on item 4, I created a hack/patch that works for me. I applied it to
ubox head, one check-in ahead of the ubox currently used in Openwrt, but the
patch should be applicable also to the current ubox version.
After failing the normal search for the module file, the patch checks if the
module name starts with nls, and if yes, then it jumps over the initial
"nls_" but replaces the later occurences of _ with -, making the filename
once again like "nls_iso8859-1.ko".
The new check has been placed last, just before the failure and return with
NULL. So, all normal modules are first handled with the normal logic and this
is just a fallback for nls*. (I have not checked if there are other modules
with mixed names.)
I applied the patch into Openwrt buildroot, but devs should naturally change
the ubox source directly.
signed-off-by: [email protected]
--- trunk/package/system/ubox/Makefile (revision 38237)
+++ trunk/package/system/ubox/Makefile (working copy)
@@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ubox
-PKG_VERSION:=2013-09-17
+PKG_VERSION:=2013-09-27
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=git://nbd.name/luci2/ubox.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=cc07b0b7ac66d0e4a05470dd69a28305405cd7dd
+PKG_SOURCE_VERSION:=102b1ad4c5c4db2c5a62f8581ab098885d4295c8
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
CMAKE_INSTALL:=1
--- trunk/package/system/ubox/patches/020-add-logging (revision 0)
+++ trunk/package/system/ubox/patches/020-add-logging (working copy)
@@ -0,0 +1,26 @@
+--- a/kmodloader.c
++++ b/kmodloader.c
+@@ -121,6 +121,23 @@
+ if (!stat(path, &s))
+ return path;
+
++ // Fix for nls module names like nls_iso8859-1.ko, revert the last
underscore
++ char *t;
++ if (!strncmp("nls", name, 3)) {
++ snprintf(path, 256, "%s" DEF_MOD_PATH "%s.ko", prefix,
ver.release, name);
++ t = basename(path);
++ replace_dash(t);
++ t += 4; // jump over "nls-" at the start
++ while (t && *t) {
++ if (*t == '_')
++ *t = '-';
++ t++;
++ }
++ //LOG("get_module_path: %s\n", path);
++ if (!stat(path, &s))
++ return path;
++ }
++
+ return NULL;
+ }
+
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel