Answer the question
In order to leave comments, you need to log in
Kernel module for OpenWRT. PowerPC
I am compiling OpenWRT Trunk for one specific piece of hardware on a PowerPC processor (the latter is not very important, I just give it for reference).
And I need to write a driver. I have little experience in developing kernel modules for x86 machines running Ubuntu (I took courses, wrote test game modules).
Now I want to try to write at least the "Hello World" module. I started with an excellent post by comrade Ariman . But I immediately came across the fact that I have a different folder structure
Заходим в target/linux/ar71xx/files/drivers и выполняем там mkdir video, создав директорию для нашего драйвера. Buildroot раскидывает содержимое files по соответствующим директориям дерева исходников. Помещаем файл usblcd.c в только что созданную папку.
[email protected]:~/trunk/openwrt-trunk/target/linux/mpc83xx/files$ ls
scripts
OPENWRT = /home/dlinyj/trunk/openwrt-trunk
KERNEL = /home/dlinyj/trunk/openwrt-trunk/build_dir/linux-mpc83xx/linux-3.3.8
PWD := $(shell pwd)
LD= /home/dlinyj/trunk/openwrt-trunk/staging_dir/toolchain-powerpc_gcc-4.6-linaro_uClibc-0.9.33.2/bin/powerpc-openwrt-linux-uclibc-ld
CROSS_COMPILE="powerpc-openwrt-linux-uclibc-"
EXTRA_LDSFLAGS="-I/home/dlinyj/trunk/openwrt-trunk/build_dir/linux-mpc83xx -include symtab.h"
KBUILD_HAVE_NLS=no
CONFIG_SHELL="/bin/bash"
TARGET = hellok
CC=/home/dlinyj/trunk/openwrt-trunk/staging_dir/toolchain-powerpc_gcc-4.6-linaro_uClibc-0.9.33.2/bin/powerpc-openwrt-linux-uclibc-gcc
obj-m := $(TARGET).o
all:
make -C /home/dlinyj/trunk/openwrt-trunk/build_dir/linux-mpc83xx/linux-3.3.8/ ARCH="powerpc" M=$(PWD) modules
[email protected]:~/myprg_ppc/first_hello$ make
make: The `all' target requires no commands to be executed.
[email protected]:~/myprg_ppc/first_hello$ make
/home/dlinyj/trunk/openwrt-trunk/staging_dir/toolchain-powerpc_gcc-4.6-linaro_uClibc-0.9.33.2/bin/powerpc-openwrt-linux-uclibc-gcc -c -o hellok.o hellok.c
powerpc-openwrt-linux-uclibc-gcc: warning: environment variable 'STAGING_DIR' not defined
hellok.c:1:26: fatal error: linux/module.h: No such file or directory
compilation terminated.
make: *** [hellok.o] Ошибка 1
#include <linux/module.h> /* Needed by all modules */
Answer the question
In order to leave comments, you need to log in
The files directory in target/linux/mpc83xx contains files that will be copied to the kernel directory before compilation. For each platform, the structure and files will be different. If there is no drivers directory, you need to create it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question