OpenWrt Forum Archive

Topic: shfs (shell filesystem , like NFS) unresolved symbols

The content of this topic has been archived on 14 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

i have updated my wrt54gs with my own build openwrt, and wanted to add shfs kernel module to it....

so i modified the Makefile for shfs like THAT:

ndef KERNEL
KERNEL=2.4.20
endif

#ifndef MODULESDIR
#MODULESDIR=${ROOT}/lib/modules/${KERNEL}
#endif

ifndef KERNEL_SOURCES
KERNEL_SOURCES=/root/tmp/buildroot/build_mipsel/linux
endif

ifeq (${MODVERSIONS},detect)
  ifeq ($(shell test -e ${KERNEL_SOURCES}/include/linux/modversions.h; echo $$?),0)
    MODVERSIONS=yes
  endif
endif

ifeq (${MODVERSIONS},yes)
MVER=-DMODVERSIONS -DEXPORT_SYMTAB
endif

LINVER=linux-${KERNEL}

ALL_TARGETS := shfs.o

#SEARCHDIRS := -I- -I. -I${KERNEL_SOURCES}/include #-I/usr/src/linux/include/
SEARCHDIRS := -I${KERNEL_SOURCES}/include #-I/usr/src/linux/include/


CC=mipsel-linux-uclibc-gcc
LD=mipsel-linux-uclibc-ld
#CFLAGS  = -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -Wall ${SEARCHDIRS} -DMODULE ${MVER} -D__KERNEL__ -DLINUX
CFLAGS  = -static -DUSE_UCLIBC -Llib -lc -nostdlib -DCROSS_COMPILE -fno-common -mips2 -fomit-frame-pointer -fno-strict-aliasing -pipe -Wall ${SEARCHDIRS} -DMODULE -D__KERNEL__ -DLINUX
#LINKER    := ld
LINKER = mipsel-linux-uclibc-ld
LDFLAGS    = -r
LOADLIBES :=

all: ${ALL_TARGETS}

%.o: %.c $(wildcard *.h)
        ${CC} ${CFLAGS} -c $< -o $@

shfs.o: dcache.o dir.o fcache.o file.o inode.o ioctl.o proc.o shell.o symlink.o
        ${LINKER} ${LDFLAGS} -o $@ ${filter-out %.a %.so, $^} ${LOADLIBES}

tidy:
        ${RM} core dcache.o dir.o fcache.o file.o inode.o ioctl.o proc.o shell.o symlink.o
---> further lines are only compile rules ....


and it compiles without problems .... but insmod on openwrt gives THAT back:

Using ./shfs.o
insmod: unresolved symbol atomic_sub_return
insmod: unresolved symbol memchr
insmod: unresolved symbol strcmp
insmod: unresolved symbol atomic_add
insmod: unresolved symbol strcpy
insmod: unresolved symbol strncpy
insmod: unresolved symbol atomic_add_return
insmod: unresolved symbol _gp_disp
insmod: unresolved symbol strncmp

Please help me, shfs is a really cool thing for mounting anything you have a shell on !
Cant be that difficult to find this mistake ...

Thanks !

Simon

Hi !

Did you try to strip the compiled modules, so that normally they shan't give you such an error ?

No i did not strip it ... should i ?

Strip only reduces the size AFAIK ? It deletes the symbol information .... but has nothing todo with funcionality ???

Thanks for reply !

Simon

I'm a real newbie but I have read strip can remove symbols, so that it may help you in using shfs. Maybe you should get an earlier version which compiles a little bit more cleanly on 2.4 kernels ?

The error would be the SAME without Symbol Table, but you would only see Memory Adresses instead of function names ....

shfs does compile WITHOUT errors , i think its a LINKER / LIBRARY Problem , but i think i linked it against UCLIBC ....

Maybe the eperienced developers here should go for help  here....

SHFS compiles in 2sec with my Makefile .. so it doesnt take much time ....

Thanks !
Simon

Come on i think the problems not to big ....

Is anyone here who cares for a method , to mount EVERYTHING you have a shell to ? ssh , telnet, or whatever !

I already modified the makefile, its only a Linker problem i think

Please help

Hello,

i got one step further

after including uclibc statically im only missing

THESE symbols .... can anyone help ?

insmod: unresolved symbol atomic_sub_return
insmod: unresolved symbol main
insmod: unresolved symbol atomic_add
insmod: unresolved symbol atomic_add_return
insmod: unresolved symbol _gp_disp

Cant be a big thing .... thanks !

i cant believe that there is noone here to fix that !!!

thats sad.

one less good ipkg

shfs is something I need, and that has intrigued me for a while. I'll take a look into building something workable after I've (hopefully) gotten a v2.2 to work with the new firmware.

try adding '-mno-abicalls -fno-pic -mlong-calls -G 0' in CFLAGS.

I have build a module that load into the kernel ... sadly any access to the mounted filesystem failed with Input/Output error.

I managed to build working packages : kmod-shfs and shfs-utils. Basically, I trashed the module Makefile and replaced it with a simplier one that will let the kernel tree build the module, like that :

make -C $(KERNEL_DIR) SUBDIR=mymodule modules

So that the kernel and the module are built with the same flags.

There was another glitch about an unresolved symbol (memchr), solved by linking the module with $(KERNEL_DIR)/lib/string.o

WorksForMe (TM)

--
Nico

Very cool !!!

Thanks for YOUR help !

can you tell me WHERE i can get YOUR Makefile and your Package ???

:-)

Nice man !!!

There was another glitch about an unresolved symbol (memchr), solved by linking the module with $(KERNEL_DIR)/lib/string.o

In my test I have writen a memchr function and include it in proc.c.

SirDodger,

The package tracker is your friend ! Sources are mentionned in the "Source:" field of the packages


lpr,

Why would you rewrite the memchr function ?
It's already in the kernel, the only problem is that the function is not exported on mips, and the module assumes it is.

--
Nico

The discussion might have continued from here.