Standard module like USB gets compiled with:
Code:
# mipsel-linux-gcc -D__KERNEL__ -I/home/leon/optware/wl500g/builds/firmware-oleg/src/linux/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -I/home/leon/optware/wl500g/builds/firmware-oleg/src/linux/linux/../../include -DBCMDRIVER -I /home/leon/optware/wl500g/builds/firmware-oleg/src/linux/linux/include/asm/gcc -G 0 -mno-abicalls -fno-pic -pipe -mcpu=r4600 -mips2 -Wa,--trap -m4710a0kern -DMODULE -mlong-calls -fno-common -nostdinc -iwithprefix include -DKBUILD_BASENAME=usb -DEXPORT_SYMTAB -c usb.c
Following this sample I've changed fuse/kernel/Makefile to
Code:
CC = /opt/brcm/hndtools-mipsel-linux/bin/mipsel-linux-gcc
LD = /opt/brcm/hndtools-mipsel-linux/bin/mipsel-linux-ld
CFLAGS = -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -pipe -fno-common -fomit-frame-pointer -mcpu=r4600 -mips2 -Wa,--trap -m4710a0kern
CPPFLAGS = -I/home/leon/optware/wl500g/builds/firmware-oleg/src/linux/linux/include -I. -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DFUSE_VERSION=\"$(VERSION)\"
After that change I've got:
Code:
leon@duo:~/optware/wl500g/builds/fuse/kernel$ make
/opt/brcm/hndtools-mipsel-linux/bin/mipsel-linux-gcc -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -pipe -fno-common -fomit-frame-pointer -mcpu=r4600 -mips2 -Wa,--trap -m4710a0kern -I/home/leon/optware/wl500g/builds/firmware-oleg/src/linux/linux/include -I. -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DFUSE_VERSION=\"2.5.3\" -c dev.c -o dev.o
/opt/brcm/hndtools-mipsel-linux/bin/mipsel-linux-gcc -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -pipe -fno-common -fomit-frame-pointer -mcpu=r4600 -mips2 -Wa,--trap -m4710a0kern -I/home/leon/optware/wl500g/builds/firmware-oleg/src/linux/linux/include -I. -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DFUSE_VERSION=\"2.5.3\" -c dir.c -o dir.o
/opt/brcm/hndtools-mipsel-linux/bin/mipsel-linux-gcc -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -pipe -fno-common -fomit-frame-pointer -mcpu=r4600 -mips2 -Wa,--trap -m4710a0kern -I/home/leon/optware/wl500g/builds/firmware-oleg/src/linux/linux/include -I. -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DFUSE_VERSION=\"2.5.3\" -c file.c -o file.o
/opt/brcm/hndtools-mipsel-linux/bin/mipsel-linux-gcc -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -pipe -fno-common -fomit-frame-pointer -mcpu=r4600 -mips2 -Wa,--trap -m4710a0kern -I/home/leon/optware/wl500g/builds/firmware-oleg/src/linux/linux/include -I. -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES -DFUSE_VERSION=\"2.5.3\" -c inode.c -o inode.o
inode.c:598: unknown field `alloc_inode' specified in initializer
inode.c:598: warning: initialization from incompatible pointer type
inode.c:599: unknown field `destroy_inode' specified in initializer
inode.c:599: warning: initialization from incompatible pointer type
inode.c: In function `fuse_inode_init_once':
inode.c:702: warning: implicit declaration of function `inode_init_once'
make: *** [inode.o] Error 1
Where offending lines are:
Code:
static struct super_operations fuse_super_operations = {
.alloc_inode = fuse_alloc_inode,
.destroy_inode = fuse_destroy_inode,
.read_inode = fuse_read_inode,
.clear_inode = fuse_clear_inode,
.put_super = fuse_put_super,
.statfs = fuse_statfs,
.show_options = fuse_show_options,
};
And if I comment out
Code:
// .alloc_inode = fuse_alloc_inode,
// .destroy_inode = fuse_destroy_inode,
Module gets compiled 
The problematic 2.4.20 header that lacks alloc_inode and destroy_inode is include/linux/fs.h that looks like:
PHP Code:
struct super_operations {
void (*read_inode) (struct inode *);
/* reiserfs kludge. reiserfs needs 64 bits of information to
** find an inode. We are using the read_inode2 call to get
** that information. We don't like this, and are waiting on some
** VFS changes for the real solution.
** iget4 calls read_inode2, iff it is defined
*/
void (*read_inode2) (struct inode *, void *) ;
void (*dirty_inode) (struct inode *);
void (*write_inode) (struct inode *, int);
void (*put_inode) (struct inode *);
void (*delete_inode) (struct inode *);
void (*put_super) (struct super_block *);
void (*write_super) (struct super_block *);
void (*write_super_lockfs) (struct super_block *);
void (*unlockfs) (struct super_block *);
int (*statfs) (struct super_block *, struct statfs *);
int (*remount_fs) (struct super_block *, int *, char *);
void (*clear_inode) (struct inode *);
void (*umount_begin) (struct super_block *);
/* Following are for knfsd to interact with "interesting" filesystems
* Currently just reiserfs, but possibly FAT and others later
*
* fh_to_dentry is given a filehandle fragement with length, and a type flag
* and must return a dentry for the referenced object or, if "parent" is
* set, a dentry for the parent of the object.
* If a dentry cannot be found, a "root" dentry should be created and
* flaged as DCACHE_NFSD_DISCONNECTED. nfsd_iget is an example implementation.
*
* dentry_to_fh is given a dentry and must generate the filesys specific
* part of the file handle. Available length is passed in *lenp and used
* length should be returned therein.
* If need_parent is set, then dentry_to_fh should encode sufficient information
* to find the (current) parent.
* dentry_to_fh should return a 1byte "type" which will be passed back in
* the fhtype arguement to fh_to_dentry. Type of 0 is reserved.
* If filesystem was exportable before the introduction of fh_to_dentry,
* types 1 and 2 should be used is that same way as the generic code.
* Type 255 means error.
*
* Lengths are in units of 4bytes, not bytes.
*/
struct dentry * (*fh_to_dentry)(struct super_block *sb, __u32 *fh, int len, int fhtype, int parent);
int (*dentry_to_fh)(struct dentry *, __u32 *fh, int *lenp, int need_parent);
int (*show_options)(struct seq_file *, struct vfsmount *);
};
Should missing functions be ommited or reconnected to some other func?
I suggest to backport fs.o from 2.4.21 or higher. And I really miss ext2 in Oleg firmware. So much that I've created
package that builds firmware-oleg with mine enables. See http://trac.nslu2-linux.org/optware/...rmware-oleg.mk for details.