Kernel modules: DF versus FBSD?

walt wa1ter at myrealbox.com
Sun Jul 22 18:42:59 PDT 2007


On Sat, 21 Jul 2007, Matthew Dillon wrote:

>
>> The kernel image loads normally.  If I type 'load green_saver' :the message
>> is: :'don't know how to load module /boot/kernel/green_saver.ko'

>     It doesn't understand the file format.  I think FreeBSD changed
>     the output format for the modules.
>
>     If I look in /archive/FreeBSD-current/src/sys/boot/i386/loader/conf.c
>     I notice that FreeBSD's boot loader now lists four file formats intstead
>     of the two we have:
>
>     extern struct file_format       i386_elf;		US
>     extern struct file_format       amd64_elf;
>
>     extern struct file_format       i386_elf;		THEM
>     extern struct file_format       i386_elf_obj;
>     extern struct file_format       amd64_elf;
>     extern struct file_format       amd64_elf_obj;
>
>     I suggest getting support for i386_elf_obj and amd64_elf_obj into
>     our boot loader and seeing if that fixes the problem.

I've been trying, but there's an error I don't understand.  I edit our
sys/boot/pc32/libi386/elf32_freebsd.c to match FBSD:

 static int     elf32_exec(struct preloaded_file *amp);
+static int     elf32_obj_exec(struct preloaded_file *amp);

 struct file_format i386_elf = { elf32_loadfile, elf32_exec };
+struct file_format i386_elf_obj = { elf32_obj_loadfile, elf32_obj_exec };

@@ -74,3 +76,9 @@
     panic("exec returned");
 }
+
+static int	elf32_obj_exec(struct preloaded_file *fp)
+{
+       return (EFTYPE);
+}

Now, when I try to compile the loader I get this error:

/usr/src/sys/boot/pc32/libi386/elf32_freebsd.c:43: error: 'elf32_obj_loadfile'
undeclared here (not in a function)
*** Error code 1

What mystifies me is why the line above it doesn't trigger the same error
because elf32_loadfile is no more declared than elf32_obj_loadfile is.
Neither of those names appear anywhere else in the entire /usr/src tree.

Any clues much appreciated!






More information about the Users mailing list