how can i implement my kernel module and debug it
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Esaie,
Quoted 6 lines · Esa?e Ledoux NJONGSSI KOUAM
Hi everyone .
Sorry for the inconvenience , ...I want to know how to load my kernel module, run it see these traces using dmesg and debug it.
Buildroot is essentially a deployment tool, not a development infrastructure. You do need a working package to be able to integrate it.
Preferably, you do this step-by-step:
-- develop your kernel module, make sure it compiles and works correctly in your development environment -- integrate the package into Buildroot (see comments below)
-- check if the package builds correctly within Buildroot and gets deployed to target/lib/modules -- test on target hardware
Quoted 10 lines
So , i have read this part of the (manual
<https://buildroot.org/downloads/manual/manual.html#_infrastructure_for_packages_building_kernel_modules>)
, but i don't know how to use it :| What you may have noticed is that, unlike other package infrastructures, we | explicitly invoke a second infrastructure. This allows a package to build a kernel | module, but also, if needed, use any one of other package infrastructures to | build normal userland components (libraries, executables?). Using the kernel-module infrastructure on its own is not sufficient; another package infrastructure *must* be used.
This means that a 'normal' build infrastructure (make, cmake, etc.) has to be used; you covered this by using "generic-package" and providing a (project) make file.
Quoted 10 lines
but in my way , i have try something :
- Config.in
config
BR2_PACKAGE_KERNEL_MODULE
bool "kernel_module"
depends onBR2_LINUX_KERNEL
help
Linux Kernel Module Cheat.
Quoted 7 lines
- external.mk
KERNEL_MODULE_VERSION= 1.0KERNEL_MODULE_SITE= $(BR2_EXTERNAL_KERNEL_MODULE_PATH)KERNEL_MODULE_SITE_METHOD= local
$(eval $(kernel-module))
$(eval $(generic-package))
This file has the same name as your package: "kernel-module.mk". Do not mix Buildroot configuration (BR2_EXTERNAL) and development project; provide a path to your source directory in KERNEL_MODULE_SITE.
If you want to use a BR2_EXTERNAL directory structure, some more work is necessary; see [1]. It will be easier to install your configuration in the Buildroot tree; in that case, all of these files go into the Buildroot package directory, inside a directory named "kernel-module". Edit "package/Config.in" and add your package under a convenient menu heading.
The files below go into your project directory, the one that is referenced by $KERNEL_MODULE_SITE
Quoted 6 lines
-
Makefileobj-m += $(addsuffix .o, $(notdir $(basename $(wildcard $(BR2_EXTERNAL_KERNEL_MODULE_PATH)/*.c))))
ccflags-y := -DDEBUG -g -std=gnu99 -Wno-declaration-after-statement
Quoted 7 lines
.PHONY: all clean
all:
$(MAKE) -C '$(LINUX_DIR)' M='$(PWD)' modulesclean:
$(MAKE) -C '$(LINUX_DIR)' M='$(PWD)' clean
Do not use Buildroot specific variables in your project makefile. Variables should be initialized. You are missing a modules_install target, see [2].
Quoted 18 lines
-
hello.c#include <linux/module.h>#include <
linux/kernel.h>
MODULE_LICENSE("GPL");
static int myinit(void){ printk(KERN_INFO "hello init\n"); return 0; } static void myexit(void) { printk(KERN_INFO "hello exit\n"); }
module_init(myinit)module_exit(myexit)
Quoted 8 lines
And in the terminal :
make BR2_EXTERNAL="$(pwd)/../kernel_module"
qemu_x86_64_defconfigecho 'BR2_PACKAGE_KERNEL_MODULE=y' >> .config
make BR2_JLEVEL="$(($(nproc) - 2))" all qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append root=/dev/vda -net nic,model=virtio -net user
If you plan to use BR2_EXTERNAL, provide all necessary files.
make <defconfig> needs to be run only once, to create a configuration. The configuration persists, until you modify it with "make {menu,n}config" or you call "make distclean". For the different configuration editors, see [3].
Start the config editor, select your package, exit and save. Afterwards start the build process:
$ make nconfig $ make
Quoted 4 lines
On qemu :
modprobe hello
modprobe: module hello not found in modules.dep
The module has not been built and is not present on the target system.
Quoted 3 lines
how can i solve it ??
please i need your help
Kind regards,
Andreas
[1] https://buildroot.org/downloads/manual/manual.html#outside-br-custom
[2] https://www.kernel.org/doc/html/latest/kbuild/modules.html?highlight=modules%20symvers
[3] https://buildroot.org/downloads/manual/manual.html#_buildroot_quick_start
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
A message that is not in the archive (sent off-list or not yet received): CA+eej5PtS6iCJ+W1b6W0mZXk-fQJcB1hhr20_D7cE=fja8NzTw@mail.gmail.com
Hi Esaïe
<appended Buildroot list>
Quoted 4 lines · Esaïe Ledoux NJONGSSI KOUAM
my kernel module works very well ,
in qemu , i have type lsmod , but nothing , doesn't it means that linux kernel image doesn't build ??
<cut>
With the original config files, the module will not be built. Once it gets built, the missing modules_install may prevent copying it into /lib/modules in the target.
To see which steps were executed by Buildroot, run
$ grep kernel-module build/build-time.log
This file contains timestamps of all tasks executed by the Buildroot environment.
Quoted 1 line
i have make something like you have said , but the problem still occur
-- Make sure your configuration is visible to Buildroot. You must be able to select it in the menu editor (make nconfig).
-- Build your module separately by calling 'make kernel-module-rebuild' and analyze the output. You should get headings for the separate build steps (downloading, extracting, patching, configuring, building, installing). Some sections may be missing or empty, but at least 'building/installing' must show output from your module. You might also run build steps separately, until you find the one that fails; see [4]
-- Verify that the directory build/kernel-module exists and contains the expected files.
-- Check target/lib/modules/${BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE} to see if your module is included.
Kind regards,
Andreas
[4] https://buildroot.org/downloads/manual/manual.html#pkg-build-steps
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
so i have develop my kernel module and it is working very well.
there is my folder :
hello.c :
#include <linux/module.h> // included for all kernel modules #include <linux/kernel.h> // included for KERN_INFO #include <linux/init.h> // included for __init and __exit macros
MODULE_LICENSE("GPL"); MODULE_AUTHOR("Lakshmanan"); MODULE_DESCRIPTION("A Simple Hello World module");
static int __init hello_init(void)
{
printk(KERN_INFO "Hello world!\n");
return 0; // Non-zero return means that the module couldn't be
loaded.
}
static void __exit hello_cleanup(void)
{
printk(KERN_INFO "Cleaning up module.\n");
}module_init(hello_init);module_exit(hello_cleanup);
Quoted 1 line
Makefile:
obj-m += helloKernelModule.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
when i run make , it generate some files like hello.o , hello.ko , ...
Quoted 1 line
integrate the package into Buildroot (see comments below)
But , i'm not understanding very well when you said i integrate the package on buildroot. Is it only the Makefile and the hello.c code or Makefile , hello.c code , hello.o , hello.ko , ... ?
Quoted 1 line
check if the package builds correctly within Buildroot and gets
deployed to target/lib/modules
Okay , i have put the project on one folder kernel_module_test in buildroot tree
external.desc :
name: BR2_PACKAGE_KERNEL_MODULE_TEST
external.mk :
include $(sort $(wildcard $(BR2_EXTERNAL_KERNEL_MODULE_TEST_PATH)/*/*.mk))
Config.in :
config BR2_PACKAGE_KERNEL_MODULE_TEST
bool "kernel_module_test"
depends on BR2_LINUX_KERNEL
help
Linux Kernel Module Cheat.
kernel_module_test.mk :
KERNEL_MODULE_VERSION = 1.0KERNEL_MODULE_SITE = $(BR2_EXTERNAL_KERNEL_MODULE_TEST_PATH)/kernel_module_test KERNEL_MODULE_SITE_METHOD = local
$(eval $(kernel_module_test))
$(eval $(generic-package))
As you can see , i want to use a BR2_EXTERNAL directory structure.
So i have make it by typing :
/buildroot# make BR2_EXTERNAL=kernel_module_test menuconfig
Go ahead into External Options , and fortunatly , i have see my package inside, .. so i have saved it and exit.
After that i have type make.
i have seen my package on output/build , looks like kernel_module_test
folder that contains some files.
Finaly , i have seen some files on output/target/lib/modules/${BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE} but not my module.
So i think that it means that my modules/package was not loaded and i can't exploit it.
please where i have mistaken ??
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
On 19/10/2021 16:34, Esaïe Ledoux NJONGSSI KOUAM wrote:
[snip]
Quoted 6 lines
kernel_module_test.mk <http://kernel_module_test.mk> :
KERNEL_MODULE_VERSION= 1.0KERNEL_MODULE_SITE= $(BR2_EXTERNAL_KERNEL_MODULE_TEST_PATH)/kernel_module_testKERNEL_MODULE_SITE_METHOD= local
$(eval $(kernel_module_test))
This should be kernel-module, not kernel_module_test.
Regards,
Arnout
Quoted 1 line
$(eval $(generic-package))
[snip]
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Esaïe,
TL;DR: Main problem is probably the one Arnout mentioned. Fix external.desc, kernel-module-test.mk and Makefile; in that order.
There are still some inconsistencies in your configuration, see remarks below.
Stick to '-' (dash) in file names and '_' (underscore) in (k)config variables. The Linux kernel uses the same convention.
Quoted 31 lines · Esaïe Ledoux NJONGSSI KOUAM
so i have develop my kernel module and it is working very well.
there is my folder :
hello.c:#include <linux/module.h> // included for all kernel modules #include <linux/kernel.h> // included for KERN_INFO #include <linux/init.h> // included for __init and __exit macros
MODULE_LICENSE("GPL");MODULE_AUTHOR("Lakshmanan");MODULE_DESCRIPTION("A Simple Hello World module");static int
__inithello_init(void)
{
printk(KERN_INFO "Hello world!\n");
return 0; // Non-zero return means that the module couldn't be
loaded.
}static void
__exithello_cleanup(void){ printk(KERN_INFO "Cleaning up module.\n"); }
module_init(hello_init);module_exit(hello_cleanup);Quoted 1 line
Makefile:
Quoted 8 lines
obj-m += helloKernelModule.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modulesclean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) cleanwhen i run make , it generate some files like hello.o , hello.ko , ...
This Makefile is broken, and will also not work correctly when run from inside the Buildroot environment: the syntax is incorrect, there is no rule how to make helloKernelModule.o from hello.c, you have an absolute reference to your host kernel, which is different from the one Buildroot uses.
Introduce variables that work on your development machine, but can be overridden by Buildroot:
obj-m := HelloKernelModule.o
HelloKernelModule-objs := hello.o
MAKE := make
KSRC := /lib/modules/$(shell uname -r)/build/
SRC := $(shell pwd)
modules:
$(MAKE) -C $(KSRC) M=$(SRC) modules
modules_install:
$(MAKE) -C $(KSRC) M=$(SRC) modules_install
clean:
$(MAKE) -C $(KSRC) M=$(SRC) clean
Quoted 5 lines
Quoted 1 line
integrate the package into Buildroot (see comments below)
But , i'm not understanding very well when you said i integrate the package on buildroot. Is it only the
Makefileand thehello.ccode orMakefile,hello.ccode , hello.o , hello.ko , ... ?
None of these. Your project is distinct; Buildroot sees it only as a source code package - a tarball that you download from the internet. Buildroot integration means defining where the source code can be found and what to to with it (Config.in and kernel-module-test.mk).
Quoted 9 lines
Quoted 1 line
check if the package builds correctly within Buildroot and gets
deployed to target/lib/modules
Okay , i have put the project on one folder
kernel_module_testin buildroot treeexternal.desc :
name:
BR2_PACKAGE_KERNEL_MODULE_TEST
This is not a Buildroot variable, but something that you define. So call it just KERNEL_MODULE_TEST. The string defined here will be inserted between 'BR2_EXTERNAL_' and '_PATH' ...
Quoted 4 lines
external.mk [1] :
include $(sort $(wildcard
$(BR2_EXTERNAL_KERNEL_MODULE_TEST_PATH)/*/*.mk))
BR2_EXTERNAL_KERNEL_MODULE_TEST_PATH is undefined and expands to an empty string. This probably works only because the files are located inside the buildroot tree. Should work correctly, once you fix 'name' in external.desc.
Quoted 8 lines
Config.in :
config
BR2_PACKAGE_KERNEL_MODULE_TEST
bool "kernel_module_test"
depends onBR2_LINUX_KERNEL
help
Linux Kernel Module Cheat.
Quoted 8 lines
kernel_module_test.mk [2] :
KERNEL_MODULE_VERSION= 1.0KERNEL_MODULE_SITE= $(BR2_EXTERNAL_KERNEL_MODULE_TEST_PATH)/kernel_module_testKERNEL_MODULE_SITE_METHOD= local
$(eval $(kernel_module_test))
$(eval $(generic-package))
You renamed the project to KERNEL_MODULE_TEST. You must also do this to the variables in the .mk file. But do NOT rename $(eval $(kernel-module))!
Quoted 6 lines
As you can see , i want to use a
BR2_EXTERNALdirectory structure.So i have make it by typing :
/buildroot# make BR2_EXTERNAL=kernel_module_test menuconfig
Quoted 7 lines
Go ahead into External Options , and fortunatly , i have see my package inside, .. so i have saved it and exit.
After that i have type make.
i have seen my package on output/build , looks like
kernel_module_testfolder that contains some files.
Yes, but which files? They should be identical to the output of 'make' in the project folder. The important file is HelloKernelModule.ko.
Quoted 3 lines
Finaly , i have seen some files on output/target/lib/modules/${BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE} but not my module.
Eventually you will have a folder 'extra' in target/lib/modules/$(uname -r), containing HelloKernelModule.ko. Also modules.dep will have a corresponding entry at the end.
Quoted 10 lines
So i think that it means that my modules/package was not loaded and i can't exploit it.
please where i have mistaken ??
Links:
------
[1] http://external.mk
[2] http://kernel_module_test.mk
Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Okay ...
I think I have a new form of error, I think it is while compiling.
buildroot# make kernel_module_test-dirclean
rm -Rf /home/ledoux/Documents/buildroot/output/build/kernel_module_test
/buildroot# make
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
kernel_module_test Extracting kernel_module_test Patching kernel_module_test Configuring kernel_module_test Building kernel_module_test Building kernel module(s)
PATH="/home/ledoux/Documents/buildroot/output/host/bin:/home/ledoux/Documents/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games" PKG_CONFIG="/home/ledoux/Documents/buildroot/output/host/bin/pkg-config"
PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="/home/ledoux/Documents/buildroot/output/host/lib/pkgconfig:/home/ledoux/Documents/buildroot/output/host/share/pkgconfig" BR_BINARIES_DIR=/home/ledoux/Documents/buildroot/output/images
KCFLAGS=-Wno-attribute-alias /usr/bin/make -j3 -C/home/ledoux/Documents/buildroot/output/build/linux-5.10.73
HOSTCC="/usr/bin/gcc -O2
-I/home/ledoux/Documents/buildroot/output/host/include
-L/home/ledoux/Documents/buildroot/output/host/lib
-Wl,-rpath,/home/ledoux/Documents/buildroot/output/host/lib" ARCH=x86_64
INSTALL_MOD_PATH=/home/ledoux/Documents/buildroot/output/target
CROSS_COMPILE="/home/ledoux/Documents/buildroot/output/host/bin/x86_64-buildroot-linux-uclibc-"
DEPMOD=/home/ledoux/Documents/buildroot/output/host/sbin/depmod
INSTALL_MOD_STRIP=1
PWD=/home/ledoux/Documents/buildroot/output/build/kernel_module_test/.
M=/home/ledoux/Documents/buildroot/output/build/kernel_module_test/. modules
make[1] : on entre dans le répertoire
« /home/ledoux/Documents/buildroot/output/build/linux-5.10.73 »scripts/Makefile.build:44:/home/ledoux/Documents/buildroot/output/build/kernel_module_test/./Makefile:
Aucun fichier ou dossier de ce type
make[2]: *** Aucune règle pour fabriquer la cible
« /home/ledoux/Documents/buildroot/output/build/kernel_module_test/./Makefile
».
Arrêt.
make[1]: *** [Makefile:1822 :/home/ledoux/Documents/buildroot/output/build/kernel_module_test/.] Erreur 2
make[1] : on quitte le répertoire
« /home/ledoux/Documents/buildroot/output/build/linux-5.10.73 »
make: *** [package/pkg-generic.mk:295 :/home/ledoux/Documents/buildroot/output/build/kernel_module_test/.stamp_built]
Erreur 2
however here is what is inside the files:
Config.in :
config BR2_PACKAGE_KERNEL_MODULE_TEST
bool "kernel_module_test"
depends on BR2_LINUX_KERNEL
help
Linux Kernel Module Cheat.
Makefile :
obj-m := HelloKernelModule.o
HelloKernelModule-objs := hello.o
MAKE := make
KSRC := /lib/modules/$(shell uname -r)/build/ SRC := $(shell pwd)
modules:
$(MAKE) -C $(KSRC) M=$(SRC) modules
modules_install:
$(MAKE) -C $(KSRC) M=$(SRC) modules_install
clean:
$(MAKE) -C $(KSRC) M=$(SRC) clean
external.desc :
name: KERNEL_MODULE_TEST
kernel_module_test.mk :
KERNEL_MODULE_VERSION = 1.0KERNEL_MODULE_SITE = $(BR2_EXTERNAL_KERNEL_MODULE_TEST_PATH)/kernel_module_test KERNEL_MODULE_SITE_METHOD = local
$(eval $(kernel-module))
$(eval $(generic-package))
I'm not understanding very well that compilation error?? Where is it coming from ??
Quoted 164 lines · Andreas Ziegler
Hi Esaïe,
TL;DR: Main problem is probably the one Arnout mentioned. Fix external.desc, kernel-module-test.mk and
Makefile; in that order.There are still some inconsistencies in your configuration, see remarks below.
Stick to '-' (dash) in file names and '_' (underscore) in (k)config variables. The Linux kernel uses the same convention.
Quoted 31 lines · Esaïe Ledoux NJONGSSI KOUAM
so i have develop my kernel module and it is working very well.
there is my folder :
hello.c:#include <linux/module.h> // included for all kernel modules #include <linux/kernel.h> // included for KERN_INFO #include <linux/init.h> // included for __init and __exit macros
MODULE_LICENSE("GPL");MODULE_AUTHOR("Lakshmanan");MODULE_DESCRIPTION("A Simple Hello World module");static int
__inithello_init(void)
{
printk(KERN_INFO "Hello world!\n");
return 0; // Non-zero return means that the module couldn't be
loaded.
}static void
__exithello_cleanup(void){ printk(KERN_INFO "Cleaning up module.\n"); }
module_init(hello_init);module_exit(hello_cleanup);Quoted 1 line
Makefile:Quoted 8 lines
obj-m += helloKernelModule.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modulesclean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) cleanwhen i run make , it generate some files like hello.o , hello.ko , ...
This
Makefileis broken, and will also not work correctly when run from inside the Buildroot environment: the syntax is incorrect, there is no rule how to make helloKernelModule.o fromhello.c, you have an absolute reference to your host kernel, which is different from the one Buildroot uses.Introduce variables that work on your development machine, but can be overridden by Buildroot:
obj-m := HelloKernelModule.o
HelloKernelModule-objs := hello.oMAKE := make
KSRC := /lib/modules/$(shell uname -r)/build/
SRC := $(shell pwd)modules:
$(MAKE) -C $(KSRC) M=$(SRC) modules
modules_install:$(MAKE) -C $(KSRC) M=$(SRC) modules_installclean:
$(MAKE) -C $(KSRC) M=$(SRC) cleanQuoted 5 lines
Quoted 1 line
integrate the package into Buildroot (see comments below)
But , i'm not understanding very well when you said i integrate the package on buildroot. Is it only the
Makefileand thehello.ccode orMakefile,hello.ccode , hello.o , hello.ko , ... ?None of these. Your project is distinct; Buildroot sees it only as a source code package - a tarball that you download from the internet. Buildroot integration means defining where the source code can be found and what to to with it (Config.in and kernel-module-test.mk).
Quoted 9 lines
Quoted 1 line
check if the package builds correctly within Buildroot and gets
deployed to target/lib/modules
Okay , i have put the project on one folder
kernel_module_testin buildroot treeexternal.desc :
name:
BR2_PACKAGE_KERNEL_MODULE_TESTThis is not a Buildroot variable, but something that you define. So call it just
KERNEL_MODULE_TEST. The string defined here will be inserted between 'BR2_EXTERNAL_' and '_PATH' ...Quoted 4 lines
external.mk [1] :
include $(sort $(wildcard
$(BR2_EXTERNAL_KERNEL_MODULE_TEST_PATH)/*/*.mk))
BR2_EXTERNAL_KERNEL_MODULE_TEST_PATHis undefined and expands to an empty string. This probably works only because the files are located inside the buildroot tree. Should work correctly, once you fix 'name' in external.desc.Quoted 8 lines
Config.in :
config
BR2_PACKAGE_KERNEL_MODULE_TEST
bool "kernel_module_test"
depends onBR2_LINUX_KERNEL
help
Linux Kernel Module Cheat.Quoted 8 lines
kernel_module_test.mk [2] :
KERNEL_MODULE_VERSION= 1.0KERNEL_MODULE_SITE= $(BR2_EXTERNAL_KERNEL_MODULE_TEST_PATH)/kernel_module_testKERNEL_MODULE_SITE_METHOD= local
$(eval $(kernel_module_test))
$(eval $(generic-package))You renamed the project to
KERNEL_MODULE_TEST. You must also do this to the variables in the .mk file. But do NOT rename $(eval $(kernel-module))!Quoted 6 lines
As you can see , i want to use a
BR2_EXTERNALdirectory structure.So i have make it by typing :
/buildroot# make BR2_EXTERNAL=kernel_module_test menuconfig
Quoted 7 lines
Go ahead into External Options , and fortunatly , i have see my package inside, .. so i have saved it and exit.
After that i have type make.
i have seen my package on output/build , looks like
kernel_module_testfolder that contains some files.Yes, but which files? They should be identical to the output of 'make' in the project folder. The important file is HelloKernelModule.ko.
Quoted 3 lines
Finaly , i have seen some files on output/target/lib/modules/${BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE} but not my module.
Eventually you will have a folder 'extra' in target/lib/modules/$(uname -r), containing HelloKernelModule.ko. Also modules.dep will have a corresponding entry at the end.
Quoted 6 lines
So i think that it means that my modules/package was not loaded and i can't exploit it.
please where i have mistaken ??
Quoted 8 lines
Quoted 4 lines
Links:
------
[1] http://external.mk
[2] http://kernel_module_test.mkKind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Esaïe,
check the variables in kernel_module_test.mk. They need to be prefixed with KERNEL_MODULE_TEST.
Quoted 41 lines · Esaïe Ledoux NJONGSSI KOUAM
Okay ...
I think I have a new form of error, I think it is while compiling.buildroot# make kernel_module_test-dirclean
rm -Rf/home/ledoux/Documents/buildroot/output/build/kernel_module_test/buildroot# make
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
kernel_module_test Extracting kernel_module_test Patching kernel_module_test Configuring kernel_module_test Building kernel_module_test Building kernel module(s)PATH="/home/ledoux/Documents/buildroot/output/host/bin:/home/ledoux/Documents/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games" PKG_CONFIG="/home/ledoux/Documents/buildroot/output/host/bin/pkg-config"
PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="/home/ledoux/Documents/buildroot/output/host/lib/pkgconfig:/home/ledoux/Documents/buildroot/output/host/share/pkgconfig" BR_BINARIES_DIR=/home/ledoux/Documents/buildroot/output/images
KCFLAGS=-Wno-attribute-alias/usr/bin/make-j3 -C/home/ledoux/Documents/buildroot/output/build/linux-5.10.73
HOSTCC="/usr/bin/gcc -O2(quoted diff) +0
-3-I/home/ledoux/Documents/buildroot/output/host/include -L/home/ledoux/Documents/buildroot/output/host/lib -Wl,-rpath,/home/ledoux/Documents/buildroot/output/host/lib"ARCH=x86_64
INSTALL_MOD_PATH=/home/ledoux/Documents/buildroot/output/target CROSS_COMPILE="/home/ledoux/Documents/buildroot/output/host/bin/x86_64-buildroot-linux-uclibc-" DEPMOD=/home/ledoux/Documents/buildroot/output/host/sbin/depmod INSTALL_MOD_STRIP=1 PWD=/home/ledoux/Documents/buildroot/output/build/kernel_module_test/. M=/home/ledoux/Documents/buildroot/output/build/kernel_module_test/.
modules
make[1] : on entre dans le répertoire «/home/ledoux/Documents/buildroot/output/build/linux-5.10.73»scripts/Makefile.build:44:/home/ledoux/Documents/buildroot/output/build/kernel_module_test/./Makefile:
Aucun fichier ou dossier de ce type
make[2]: *** Aucune règle pour fabriquer la cible «/home/ledoux/Documents/buildroot/output/build/kernel_module_test/./Makefile
». Arrêt.
Quoted 8 lines
make[1]: *** [Makefile:1822 :
/home/ledoux/Documents/buildroot/output/build/kernel_module_test/.] Erreur 2
make[1] : on quitte le répertoire «/home/ledoux/Documents/buildroot/output/build/linux-5.10.73»
make: *** [package/pkg-generic.mk:295[4] :/home/ledoux/Documents/buildroot/output/build/kernel_module_test/.stamp_built] Erreur 2
<cut>
Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
thank you very much all of you.
It is working very well now .
So there is the kernel_module_test.mk :
KERNEL_MODULE_TEST_VERSION = 1.0KERNEL_MODULE_TEST_SITE = kernel_module_testKERNEL_MODULE_TEST_SITE_METHOD = local
$(eval $(kernel-module))
$(eval $(generic-package))
there is the output :
Quoted 1 line
Quoted 1 line
Quoted 1 line
kernel_module_test1.0 Syncing from source dirkernel_module_test
rsync -au --chmod=u=rwX,go=rX --exclude .svn --exclude .git --exclude .hg --exclude .bzr --exclude CVS kernel_module_test/ /home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
kernel_module_test1.0 Configuringkernel_module_test1.0 Buildingkernel_module_test1.0 Building kernel module(s)
PATH="/home/ledoux/Documents/buildroot/output/host/bin:/home/ledoux/Documents/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games" PKG_CONFIG="/home/ledoux/Documents/buildroot/output/host/bin/pkg-config"
PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="/home/ledoux/Documents/buildroot/output/host/lib/pkgconfig:/home/ledoux/Documents/buildroot/output/host/share/pkgconfig" BR_BINARIES_DIR=/home/ledoux/Documents/buildroot/output/images
KCFLAGS=-Wno-attribute-alias /usr/bin/make -j3 -C/home/ledoux/Documents/buildroot/output/build/linux-5.10.73
HOSTCC="/usr/bin/gcc -O2
-I/home/ledoux/Documents/buildroot/output/host/include
-L/home/ledoux/Documents/buildroot/output/host/lib
-Wl,-rpath,/home/ledoux/Documents/buildroot/output/host/lib" ARCH=x86_64
INSTALL_MOD_PATH=/home/ledoux/Documents/buildroot/output/target
CROSS_COMPILE="/home/ledoux/Documents/buildroot/output/host/bin/x86_64-buildroot-linux-uclibc-"
DEPMOD=/home/ledoux/Documents/buildroot/output/host/sbin/depmod
INSTALL_MOD_STRIP=1
PWD=/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/.
M=/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/.
modules
make[1] : on entre dans le répertoire
« /home/ledoux/Documents/buildroot/output/build/linux-5.10.73 »
CC [M]
/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/./hello.o
LD [M]
/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/./HelloKernelModule.o
MODPOST/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/./Module.symvers
CC [M]
/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/./HelloKernelModule.mod.o
LD [M]
/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/./HelloKernelModule.ko
make[1] : on quitte le répertoire
« /home/ledoux/Documents/buildroot/output/build/linux-5.10.73 »
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
kernel_module_test1.0 Installing to targetkernel_module_test1.0 Installing kernel module(s)
PATH="/home/ledoux/Documents/buildroot/output/host/bin:/home/ledoux/Documents/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games" PKG_CONFIG="/home/ledoux/Documents/buildroot/output/host/bin/pkg-config"
PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_LIBDIR="/home/ledoux/Documents/buildroot/output/host/lib/pkgconfig:/home/ledoux/Documents/buildroot/output/host/share/pkgconfig" BR_BINARIES_DIR=/home/ledoux/Documents/buildroot/output/images
KCFLAGS=-Wno-attribute-alias /usr/bin/make -j3 -C/home/ledoux/Documents/buildroot/output/build/linux-5.10.73
HOSTCC="/usr/bin/gcc -O2
-I/home/ledoux/Documents/buildroot/output/host/include
-L/home/ledoux/Documents/buildroot/output/host/lib
-Wl,-rpath,/home/ledoux/Documents/buildroot/output/host/lib" ARCH=x86_64
INSTALL_MOD_PATH=/home/ledoux/Documents/buildroot/output/target
CROSS_COMPILE="/home/ledoux/Documents/buildroot/output/host/bin/x86_64-buildroot-linux-uclibc-"
DEPMOD=/home/ledoux/Documents/buildroot/output/host/sbin/depmod
INSTALL_MOD_STRIP=1
PWD=/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/.
M=/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/.modules_install
make[1] : on entre dans le répertoire
« /home/ledoux/Documents/buildroot/output/build/linux-5.10.73 »
INSTALL/home/ledoux/Documents/buildroot/output/build/kernel_module_test-1.0/./HelloKernelModule.ko
DEPMOD 5.10.73
make[1] : on quitte le répertoire
« /home/ledoux/Documents/buildroot/output/build/linux-5.10.73 »
the module.dep file :
kernel/drivers/char/hw_random/rng-core.ko:kernel/drivers/char/hw_random/intel-rng.ko:kernel/drivers/char/hw_random/rng-core.ko kernel/drivers/char/hw_random/amd-rng.ko:kernel/drivers/char/hw_random/rng-core.ko kernel/drivers/char/hw_random/via-rng.ko:kernel/drivers/char/hw_random/rng-core.ko kernel/drivers/char/hw_random/virtio-rng.ko:kernel/drivers/char/hw_random/rng-core.ko kernel/drivers/thermal/intel/x86_pkg_temp_thermal.ko:extra/HelloKernelModule.ko:
And there output/build/kernel_module_test-1.0 :
buildroot/output/build/kernel_module_test-1.0# ls -la total 148
drwxr-xr-x 2 root root 4096 21 oct. 12:38 . drwxr-xr-x 57 root root 4096 21 oct. 12:38 .. -rwxr-xr-x 1 root root 164 21 oct. 12:19 Config.in -rwxr-xr-x 1 root root 25 21 oct. 08:03 external.desc -rwxr-xr-x 1 root root 49 19 oct. 20:58 external.mk -rw-r--r-- 1 root root 0 21 oct. 12:38 .files-list-host.txt -rw-r--r-- 1 root root 0 21 oct. 12:38 .files-list-staging.txt -rw-r--r-- 1 root root 652 21 oct. 12:38 .files-list.txt -rwxr-xr-x 1 root root 266 16 oct. 13:19 hello.c -rw-r--r-- 1 root root 3696 21 oct. 12:38 HelloKernelModule.ko -rw-r--r-- 1 root root 525 21 oct. 12:38 .HelloKernelModule.ko.cmd -rw-r--r-- 1 root root 80 21 oct. 12:38 HelloKernelModule.mod -rw-r--r-- 1 root root 534 21 oct. 12:38 HelloKernelModule.mod.c -rw-r--r-- 1 root root 292 21 oct. 12:38 .HelloKernelModule.mod.cmd -rw-r--r-- 1 root root 2648 21 oct. 12:38 HelloKernelModule.mod.o -rw-r--r-- 1 root root 30656 21 oct. 12:38 .HelloKernelModule.mod.o.cmd -rw-r--r-- 1 root root 1864 21 oct. 12:38 HelloKernelModule.o -rw-r--r-- 1 root root 372 21 oct. 12:38 .HelloKernelModule.o.cmd -rw-r--r-- 1 root root 1672 21 oct. 12:38 hello.o -rw-r--r-- 1 root root 29282 21 oct. 12:38 .hello.o.cmd -rwxr-xr-x 1 root root 169 21 oct. 12:21 kernel_module_test.mk -rwxr-xr-x 1 root root 296 21 oct. 12:28 Makefile -rw-r--r-- 1 root root 92 21 oct. 12:38 modules.order -rw-r--r-- 1 root root 306 21 oct. 12:38 .modules.order.cmd -rw-r--r-- 1 root root 0 21 oct. 12:38 Module.symvers -rw-r--r-- 1 root root 337 21 oct. 12:38 .Module.symvers.cmd -rw-r--r-- 1 root root 0 21 oct. 12:38 .stamp_built -rw-r--r-- 1 root root 0 21 oct. 12:38 .stamp_configured -rw-r--r-- 1 root root 0 21 oct. 12:38 .stamp_installed -rw-r--r-- 1 root root 0 21 oct. 12:38 .stamp_rsynced -rw-r--r-- 1 root root 0 21 oct. 12:38 .stamp_target_installed
I' so happy.
thank you for all again , ...
Quoted 59 lines · Andreas Ziegler
Hi Esaïe,
check the variables in kernel_module_test.mk. They need to be prefixed with
KERNEL_MODULE_TEST.Quoted 14 lines · Esaïe Ledoux NJONGSSI KOUAM
Okay ...
I think I have a new form of error, I think it is while compiling.buildroot# make kernel_module_test-dirclean
rm -Rf/home/ledoux/Documents/buildroot/output/build/kernel_module_test/buildroot# make
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
kernel_module_test Extracting kernel_module_test Patching kernel_module_test Configuring kernel_module_test Building kernel_module_test Building kernel module(s)PATH="/home/ledoux/Documents/buildroot/output/host/bin:/home/ledoux/Documents/buildroot/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
Quoted 4 lines
PKG_CONFIG="/home/ledoux/Documents/buildroot/output/host/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
PKG_CONFIG_LIBDIR="/home/ledoux/Documents/buildroot/output/host/lib/pkgconfig:/home/ledoux/Documents/buildroot/output/host/share/pkgconfig"
Quoted 10 lines
BR_BINARIES_DIR=/home/ledoux/Documents/buildroot/output/images KCFLAGS=-Wno-attribute-alias
/usr/bin/make-j3 -C/home/ledoux/Documents/buildroot/output/build/linux-5.10.73HOSTCC="/usr/bin/gcc -O2(quoted diff) +0
-3-I/home/ledoux/Documents/buildroot/output/host/include -L/home/ledoux/Documents/buildroot/output/host/lib -Wl,-rpath,/home/ledoux/Documents/buildroot/output/host/lib"ARCH=x86_64 INSTALL_MOD_PATH=/home/ledoux/Documents/buildroot/output/target
CROSS_COMPILE="/home/ledoux/Documents/buildroot/output/host/bin/x86_64-buildroot-linux-uclibc-"
Quoted 9 lines
DEPMOD=/home/ledoux/Documents/buildroot/output/host/sbin/depmod INSTALL_MOD_STRIP=1 PWD=/home/ledoux/Documents/buildroot/output/build/kernel_module_test/. M=/home/ledoux/Documents/buildroot/output/build/kernel_module_test/. modules
make[1] : on entre dans le répertoire «/home/ledoux/Documents/buildroot/output/build/linux-5.10.73»scripts/Makefile.build:44:
/home/ledoux/Documents/buildroot/output/build/kernel_module_test/./Makefile:Quoted 3 lines
Aucun fichier ou dossier de ce type make[2]: *** Aucune règle pour fabriquer la cible «
/home/ledoux/Documents/buildroot/output/build/kernel_module_test/./MakefileQuoted 8 lines
». Arrêt.
make[1]: *** [Makefile:1822 :/home/ledoux/Documents/buildroot/output/build/kernel_module_test/.] Erreur 2
make[1] : on quitte le répertoire «/home/ledoux/Documents/buildroot/output/build/linux-5.10.73»
make: *** [package/pkg-generic.mk:295[4] :
Quoted 8 lines
/home/ledoux/Documents/buildroot/output/build/kernel_module_test/.stamp_built]Quoted 1 line
Erreur 2
<cut>
Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot