[fpc-pascal] Building kernel modules using fpc (for fun)

Lukasz Sokol el.es.cr at gmail.com
Sat Jan 15 20:32:03 CET 2011


Hi,
http://wiki.freepascal.org/linux/kernel/module_development has some 
information, unfortunately after copy-pasting into relevant files, 
and running

make

i get

fpc kernel_module
Free Pascal Compiler version 2.4.0-2 [2010/03/06] for i386
Copyright (c) 1993-2009 by Florian Klaempfl
Target OS: Linux for i386
Compiling kernel_module.pas
Compiling system.pas
kernel_module.pas(165,2) Note: Local variable "data" not used
kernel_module.pas(166,2) Note: Local variable "cmd" not used
kernel_module.pas(15,2) Note: Local variable "i" not used
kernel_module.pas(15,5) Note: Local variable "j" not used
kernel_module.pas(28,2) Note: Local variable "msg" not used
kernel_module.pas(29,2) Note: Local variable "msg_Ptr" not used
471 lines compiled, 0.1 sec 
6 note(s) issued
make -C /lib/modules/2.6.32-27-generic/build SUBDIRS=/home/lukasz/projects
/kfpc
modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-27-generic'
  CC [M]  /home/lukasz/projects/kfpc/kernel_module_info.o
  LD [M]  /home/lukasz/projects/kfpc/kernel_pmodule.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: could not find /home/lukasz/projects/kfpc/.kernel_module.o.cmd for
/home/lukasz/projects/kfpc/kernel_module.o
WARNING: "register_chrdev" [/home/lukasz/projects/kfpc/kernel_pmodule.ko] 
undefined!
WARNING: "proc_root" [/home/lukasz/projects/kfpc/kernel_pmodule.ko] undefined!
WARNING: "unregister_chrdev" [/home/lukasz/projects/kfpc/kernel_pmodule.ko]
undefined!
  CC      /home/lukasz/projects/kfpc/kernel_pmodule.mod.o
  LD [M]  /home/lukasz/projects/kfpc/kernel_pmodule.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-27-generic'

(fpc is
lukasz at lukasz-laptop:~/projects/kfpc$ fpc
Free Pascal Compiler version 2.4.0-2 [2010/03/06] for i386
default from ubuntu 10.04 LTS)

Issuing 
make V=1

gives (cut out the fpc part) :

make -C /lib/modules/2.6.32-27-generic/build SUBDIRS=/home/lukasz/projects/kfpc
modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-27-generic'
test -e include/linux/autoconf.h -a -e include/config/auto.conf || (		\
	echo;								\
	echo "  ERROR: Kernel configuration is invalid.";		\
	echo "         include/linux/autoconf.h or include/config/auto.conf are
missing.";	\
	echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";	\
	echo;								\
	/bin/false)
mkdir -p /home/lukasz/projects/kfpc/.tmp_versions ; rm -f
/home/lukasz/projects/kfpc/.tmp_versions/*
make -f scripts/Makefile.build obj=/home/lukasz/projects/kfpc
  gcc -Wp,-MD,/home/lukasz/projects/kfpc/.kernel_module_info.o.d  -nostdinc
-isystem /usr/lib/gcc/i486-linux-gnu/4.4.3/include  -Iinclude 
-I/usr/src/linux-headers-2.6.32-27-generic/arch/x86/include -include
include/linux/autoconf.h -Iubuntu/include  -D__KERNEL__ -Wall -Wundef
-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Wno-format-security
-fno-delete-null-pointer-checks -O2 -m32 -msoft-float -mregparm=3
-freg-struct-return -mpreferred-stack-boundary=2 -march=i586 -mtune=generic
-maccumulate-outgoing-args -Wa,-mtune=generic32 -ffreestanding -fstack-protector
-DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
-Wframe-larger-than=1024 -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg
-Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow
-fno-dwarf2-cfi-asm -fconserve-stack  -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(kernel_module_info)" 
-D"KBUILD_MODNAME=KBUILD_STR(kernel_pmodule)"  -c -o
/home/lukasz/projects/kfpc/.tmp_kernel_module_info.o
/home/lukasz/projects/kfpc/kernel_module_info.c
  set -e ; perl /usr/src/linux-headers-2.6.32-27-generic/scripts/recordmcount.pl
"i386" "32" "objdump" "objcopy" "gcc" "ld" "nm" "" "" "1"
"/home/lukasz/projects/kfpc/kernel_module_info.o";
  ld -m elf_i386   -r -o /home/lukasz/projects/kfpc/kernel_pmodule.o
/home/lukasz/projects/kfpc/kernel_module_info.o
/home/lukasz/projects/kfpc/kernel_module.o /home/lukasz/projects/kfpc/system.o 
(cat /dev/null;   echo kernel//home/lukasz/projects/kfpc/kernel_pmodule.ko;) >
/home/lukasz/projects/kfpc/modules.order
make -f /usr/src/linux-headers-2.6.32-27-generic/scripts/Makefile.modpost
  scripts/mod/modpost -m -a -i
/usr/src/linux-headers-2.6.32-27-generic/Module.symvers -I
/home/lukasz/projects/kfpc/Module.symvers  -o
/home/lukasz/projects/kfpc/Module.symvers -S -w  -s
WARNING: could not find /home/lukasz/projects/kfpc/.kernel_module.o.cmd for
/home/lukasz/projects/kfpc/kernel_module.o
WARNING: "register_chrdev" [/home/lukasz/projects/kfpc/kernel_pmodule.ko] 
undefined!
WARNING: "proc_root" [/home/lukasz/projects/kfpc/kernel_pmodule.ko] 
undefined!
WARNING: "unregister_chrdev" [/home/lukasz/projects/kfpc/kernel_pmodule.ko]
undefined!
  gcc -Wp,-MD,/home/lukasz/projects/kfpc/.kernel_pmodule.mod.o.d  -nostdinc
-isystem /usr/lib/gcc/i486-linux-gnu/4.4.3/include  -Iinclude 
-I/usr/src/linux-headers-2.6.32-27-generic/arch/x86/include -include
include/linux/autoconf.h -Iubuntu/include  -D__KERNEL__ -Wall -Wundef
-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Wno-format-security
-fno-delete-null-pointer-checks -O2 -m32 -msoft-float -mregparm=3
-freg-struct-return -mpreferred-stack-boundary=2 -march=i586 -mtune=generic
-maccumulate-outgoing-args -Wa,-mtune=generic32 -ffreestanding 
-fstack-protector
-DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
-Wframe-larger-than=1024 -fno-omit-frame-pointer -fno-optimize-sibling-calls 
-pg
-Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow
-fno-dwarf2-cfi-asm -fconserve-stack  -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(kernel_pmodule.mod)" 
-D"KBUILD_MODNAME=KBUILD_STR(kernel_pmodule)"  -DMODULE -c -o
/home/lukasz/projects/kfpc/kernel_pmodule.mod.o
/home/lukasz/projects/kfpc/kernel_pmodule.mod.c
  ld -r -m elf_i386 -T
/usr/src/linux-headers-2.6.32-27-generic/scripts/module-common.lds --build-id
 -o
/home/lukasz/projects/kfpc/kernel_pmodule.ko
/home/lukasz/projects/kfpc/kernel_pmodule.o
/home/lukasz/projects/kfpc/kernel_pmodule.mod.o
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-27-generic'

Is this something I should ask here or at kernel-newbies ? :)

Lukasz




More information about the fpc-pascal mailing list