OpenWrt Forum Archive

Topic: how to avoid "unresolved symbol" when compiling kernel modules?

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

I just compiled ext2 and ext3 modules with acl + user_xattr support.

However, when I uploaded the modules to the router, I can't insmod them, as I get "unresolved symbol" errors (I didn't upload the kernel, as I didn't change any options in it).

So then I tried to insmod vfat module that I build, and I also have "unresolved symbol" errors.

How do you make new kernel modules to avoid these errors?

What I did, was:

# cd ./openwrt/build_mipsel/linux-2.4-brcm/linux-2.4.30
# make menuconfig  (choose modules you want)
# rm -f .depend_done .modules_done

and then make in "openwrt" directory.

However, all modules I build can't be insterted, due to "unresolved symbols".

What do I do wrong?

You have to rebuild the full kernel and reflash the new image. This can be done with:

make target/linux-clean world

If your code is correct than there shouldn't be anymore "unresolved symbols" left.

(Last edited by olli on 7 Feb 2006, 12:20)

olli wrote:

You have to rebuild the full kernel and reflash the new image. This can be done with:

make target/linux-clean world

If your code is correct than there shouldn't be anymore "unresolved symbols" left.

Gee, "make target/linux-clean world" wiped out my carefully patched kernel with rm -fr sad

So really any module addition mean that I need to reflash the router?

mangoo wrote:

Gee, "make target/linux-clean world" wiped out my carefully patched kernel with rm -fr sad

Oh, I'm sorry. I thought you already had a patch created for your changes which you put in the correct directory in the buildroot.

(Last edited by olli on 7 Feb 2006, 12:35)

Never mind, I have (almost) everything scripted.

But anyway, does it mean that it's not possible to contribute kernel modules (installable with ipkg), as mostly it would require reflashing?

Well, if you made significant changes to the kernel you have to reflash the firmware image.

I guess I miss something here.

Even if I make no changes at all, and do only:

# cd openwrt
# make clean
# make

And then copy vfat.o module to the router, I can't insmod it!

# insmod vfat
Using /lib/modules/2.4.30/vfat.o
insmod: unresolved symbol fat_scan
insmod: unresolved symbol fat_dir_empty
insmod: unresolved symbol fat_add_entries
insmod: unresolved symbol fat_mark_buffer_dirty
insmod: unresolved symbol fat__get_entry
insmod: unresolved symbol fat_notify_change
insmod: unresolved symbol fat_date_unix2dos
insmod: unresolved symbol fat_build_inode
insmod: unresolved symbol fat_search_long
insmod: unresolved symbol fat_detach
insmod: unresolved symbol fat_attach
insmod: unresolved symbol fat_new_dir
insmod: unresolved symbol fat_brelse
insmod: unresolved symbol fat_read_super

Hmm, I didn't insert fat module first, shame on me...

OK, it seems that reflashing helped and I can now use acl and user_xattr on attached usb devices smile

Could paste some links where you find the user_xattr patch ? Tia

Well, google for "linux acl patch" could be an answer of course - http://acl.bestbits.at/

acl and xattr are by default in 2.6.x kernels, but you have to patch 2.4.x kernels.

On the site I gave link above you will find patches for 2.4.29, but it will work with 2.4.30 that is used by OpenWRT, too.

However, I spent lots of time patching OpenWRT kernel, as this is really a set of patches + .c + .h files, without any script that will install it.

So if you want to save time, I created a script which will install it all nicely.

You can get it from http://www2.wpkg.org/wrt.tar.bz2

Make a new directory, uncompress the package there.

Point the symlink to yor kernel sources.

Run acls-patch.sh - it will patch the kernel (acl + user_xattr).

cd to kernel sources, run make menuconfig.

Enable extended attributes for ext2 and/or ext3.

Then "make clean; rm -f .depend_done .modules_done"

Run make in the root of your openwrt/ - it will make an image for you, which you will have to reflash.

One more thing - mount won't show that the filesystem is mounted with acl,user_xattr (if you mounted with these options) - as it relies on /proc/mounts by defauöt in openwrt.

The discussion might have continued from here.