[Prev][Next][Index][Thread]
Re: link-time trouble..
[Note to fellow Utahn's: why didn't we catch this in testing? Do we
test any of the linux_fs stuff at all?]
Arturo Busleiman <buanzox@usa.net>:
> I'm having troubles at link time.
> [...]
> /usr/local/lib/liboskit_linux_fs.a(super.o):
> In function `FS_LINUX_mount_root':
> /home/yo/teamos/oskit-19991124/linux/fs/../../linux/src/fs/super.c:1197:
> undefined reference to `floppy_eject'
> /home/yo/teamos/oskit-19991124/linux/fs/../../linux/src/fs/super.c:1208:
> undefined reference to `wait_for_keypress'
To trace this kind of problem, you first have to track down the symbols.
nm -A is good for this:
$ cd build_oskit
$ nm -A lib/*.a | grep floppy_eject
lib/liboskit_linux_dev.a:floppy.o:00006f14 T FDEV_LINUX_floppy_eject
lib/liboskit_linux_fs.a:super.o: U floppy_eject
$ nm -A lib/*.a | grep wait_for_keypress
lib/liboskit_linux_fs.a:super.o: U wait_for_keypress
>From this, we see:
1) floppy_eject is not being renamed to FDEV_LINUX_floppy_eject in super.o
2) floppy_eject is defined in linux_dev but used in linux_fs.
Do they appear on the link line in the right order? Yes.
3) wait_for_keypress isn't defined at all.
This is highly suspicious so do a make to be sure this output is correct:
$ make -C linux/dev/
make: Entering directory `/z/reid/build_oskit/linux/dev'
make: Leaving directory `/z/reid/build_oskit/linux/dev'
make: Entering directory `/z/reid/build_oskit/linux/dev'
make: Nothing to be done for `all'.
make: Leaving directory `/z/reid/build_oskit/linux/dev'
Didn't do anything so look at the code. The {FS,FDEV}_LINUX prefix
comes from the global.h files in linux/*/global.h, so check what
they say about floppy_eject:
$ grep floppy_eject ../oskit/linux/*/global.h
../oskit/linux/dev/global.h:#define floppy_eject FDEV_LINUX_floppy_eject
Ooops, looks like we only rename it in one place. We can hack quickly
hack round the problem by adding this line to linux/fs/global.h:
#define floppy_eject FDEV_LINUX_floppy_eject
[Long term, we'll probably want to move some of this shared code into
linux/shared/* or eliminate the dependency, but this will get you
going again.]
Looking at linux/src/fs/super.o, searching for wait_for_keypress, we find
this code:
{
printk(KERN_NOTICE "VFS: Insert root floppy and press ENTER\n");
wait_for_keypress();
}
}
#endif
Root floppies sound optional so maybe the cpp is relevant? A little
work with M-x cpp-highlight-buffer (in emacs) suggests this is caused
by compiling with:
-DCONFIG_BLK_DEV_FD
I'm not certain but I suspect this is the switch for "do I want to use
the floppy as a block device" (as opposed to "do I want to consider
booting off the floppy") so, unless you plan to use the floppy, you
could probably just turn it off:
$ r grep BLK_DEV_FD
/z/reid/oskit/linux/dev/init_blk.c:#ifdef CONFIG_BLK_DEV_FD
/z/reid/oskit/linux/src/fs/super.c:#ifdef CONFIG_BLK_DEV_FD
/z/reid/oskit/linux/src/include/linux/autoconf.h:#define CONFIG_BLK_DEV_FD 1
by editing linux/src/include/linux/autoconf.h.
If you want the floopy, a hackier (untested) alternative is to stick
this line near the head of super.c:
#define wait_for_keypress() direct_cons_getchar()
or, comment out the reference to wait_for_keypress in super.c on the
assumption that this is _probably_ dead code.
Alastair
References: