This corrects the dribble I posted earlier so, hopefully, it will not
mislead anyone.
The following does work on Debian to cross-compile hellodriver.c for
the ts-7250 linux 2.4 kernel:
Cross tool chain installed in /opt/crosstool
ts-linux 2.4 kernel built in ~/linux24
path:
export
PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/bin:/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/lib/gcc-lib/arm-linux/3.3.4
makefile:
TARGET := hellodriver
WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem ~/linux24/include
CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC := arm-linux-gcc
${TARGET}.o: ${TARGET}.c
.PHONY: clean
clean:
rm -rf {TARGET}.o
hellodriver.c
#include <linux/module.h>
int init_module(void) {
printk("<1>Hello, world\n");
return 0;
}
void cleanup_module(void) {
printk("<1>Goodbye world\n");
}
Marv
--- In "marv.schwartz" <> wrote:
>
> Charlie,
>
> It's 2.4. Also, I just found the first problem. Apparently replacing
> the ~ with /home/marv in the INCLUDE makes a difference.
>
> Thanks,
>
> Marv
>
> --- In "charliem_1216" <charliem_1216@> wrote:
> >
> > Hi Marv --
> >
> > --- In "marv.schwartz" <mschwartz@> wrote:
> > >
> > > I'm trying to build a kernel module to set 4 DIO pins for debounced
> > > leading edge interrupts and just count the interrupts. A user space
> > > program uses the counts. I'm new to building linux kernels and
drivers
> > > and am using the Linux Drivers book from O'Reilly.
> >
> > Is this the book where the second edition covers 2.4 and the third
> > edition covers 2.6?
> >
> > >
> > > I've successfully cross-compiled user space programs to access
the DIO
> > > pins and the real-time clock and run them on ts-7250.
> > >
> > > I've set up Debian in a VM, copied the cross tool chain into
> > > /opt/CrossTools, downloaded and built the TS-linux 2.4 kernel in
> > > ~/linux24 except for creating the actual kernel image. But I'm
unable
> > > to build the trivial hello kernel module.
> > >
> > > I've set the path as follows: export
> > >
> >
>
PATH=$PATH:/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/bin:/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/lib/gcc-lib/arm-linux/3.3.4
> > >
> > > The makefile is:
> > > TARGET := hello-1
> > > WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
> > > INCLUDE := -isystem ~/linux24/Include
> >
> > I think that should be -I, not -i, and you need a -I for each include
> > dir. Also ~/linux24/Include should be ~/linux24/include.
> > ie, maybe:
> >
> > INCLUDE := -Isystem -I~/linux24/include
> >
> > regards, ............ Charlie
> >
> > > CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
> > > CC := arm-linux-gcc
> > >
> > > ${TARGET}.o: ${TARGET}.c
> > >
> > > .PHONY: clean
> > >
> > > clean:
> > > rm -rf {TARGET}.o
> > >
> > > hellodriver.c is:
> > > #include <linux/module.h>
> > >
> > > int init_module(void) {
> > > printk("<1>Hello, world\n");
> > > return 0;
> > > }
> > >
> > > void cleanup_module(void) {
> > > printk("<1>Goodbye world\n");
> > > }
> > >
> > > and make hellodriver gets include files from the wrong directory and
> > > results in the following error:
> > >
> > > :~$ make hellodriver
> > > arm-linux-gcc -O2 -DMODULE -D__KERNEL__ -W -Wall -Wstrict-prototypes
> > > -Wmissing-prototypes -isystem ~/linux24/Include hellodriver.c
-o
> > > hellodriver
> > > In file included from
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/asm/irq.h:4,
> > > from
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/asm/hardirq.h:7,
> > > from
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/asm-generic/local.h:7,
> > > from
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/asm/local.h:1,
> > > from
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:21,
> > > from hellodriver.c:1:
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/asm/arch/irqs.h:11:28:
> > > asm/mach-types.h: No such file or directory
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:
> > > In function `bit_spin_lock':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:406:
> > > warning: unused parameter `bitnum'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:406:
> > > warning: unused parameter `addr'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:
> > > In function `bit_spin_trylock':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:427:
> > > warning: unused parameter `bitnum'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:427:
> > > warning: unused parameter `addr'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:
> > > In function `bit_spin_unlock':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:446:
> > > warning: unused parameter `bitnum'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:446:
> > > warning: unused parameter `addr'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:
> > > In function `bit_spin_is_locked':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:459:
> > > warning: unused parameter `bitnum'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/spinlock.h:459:
> > > warning: unused parameter `addr'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/timex.h:
> > > In function `time_interpolator_update':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/timex.h:403:
> > > warning: unused parameter `delta_nsec'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/prefetch.h:
> > > In function `prefetch':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/prefetch.h:43:
> > > warning: unused parameter `x'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/prefetch.h:
> > > In function `prefetchw':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/prefetch.h:47:
> > > warning: unused parameter `x'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/prefetch.h:
> > > In function `prefetch_range':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/prefetch.h:58:
> > > warning: unused parameter `addr'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/prefetch.h:58:
> > > warning: unused parameter `len'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/wait.h:
> > > In function `__remove_wait_queue':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/wait.h:101:
> > > warning: unused parameter `head'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/smp.h:
> > > In function `smp_send_reschedule':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/smp.h:104:
> > > warning: unused parameter `cpu'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/gfp.h:
> > > In function `alloc_pages_node':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/gfp.h:79:
> > > warning: unused parameter `nid'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/percpu.h:
> > > In function `__alloc_percpu':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/percpu.h:43:
> > > warning: unused parameter `align'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:
> > > In function `set_cpus_allowed':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:682:
> > > warning: unused parameter `p'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:682:
> > > warning: unused parameter `new_mask'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:
> > > In function `kick_process':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:757:
> > > warning: unused parameter `tsk'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:
> > > In function `task_cpu':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:1083:
> > > warning: unused parameter `p'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:
> > > In function `set_task_cpu':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:1088:
> > > warning: unused parameter `p'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/sched.h:1088:
> > > warning: unused parameter `cpu'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/kmod.h:
> > > In function `request_module':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/kmod.h:33:
> > > warning: unused parameter `name'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `search_module_extables':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:455:
> > > warning: unused parameter `addr'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `module_text_address':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:461:
> > > warning: unused parameter `addr'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `__module_text_address':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:467:
> > > warning: unused parameter `addr'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `__module_get':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:477:
> > > warning: unused parameter `module'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `try_module_get':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:481:
> > > warning: unused parameter `module'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `module_put':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:486:
> > > warning: unused parameter `module'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `module_address_lookup':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:495:
> > > warning: unused parameter `addr'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:496:
> > > warning: unused parameter `symbolsize'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:497:
> > > warning: unused parameter `offset'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:498:
> > > warning: unused parameter `modname'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `module_get_kallsym':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:503:
> > > warning: unused parameter `symnum'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:504:
> > > warning: unused parameter `value'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:505:
> > > warning: unused parameter `type'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:506:
> > > warning: unused parameter `namebuf'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `module_kallsyms_lookup_name':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:511:
> > > warning: unused parameter `name'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `is_exported':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:516:
> > > warning: unused parameter `name'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:516:
> > > warning: unused parameter `mod'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `register_module_notifier':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:521:
> > > warning: unused parameter `nb'
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:
> > > In function `unregister_module_notifier':
> > >
> >
>
/opt/crosstool/arm-linux/gcc-3.3.4-glibc-2.3.2/arm-linux/sys-include/linux/module.h:527:
> > > warning: unused parameter `nb'
> > > make: *** [hellodriver] Error 1
> > >
> > > I'd really appreciate knowing what I'm doing wrong.
> > >
> > > Thanks.
> > >
> >
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|