I am trying to compile a WiFi driver for an oldish (3.18.29) kernel.
Processor is an MT7628 (mips), board is a VoCore2.
I have the kernel correctly configured and built in /home/mcon/vocore/kernel.
As I am cross-compiling I also need to give a pointer to my cross-toolchain.
mcon#cinderella:~/vocore/kernel$ make ARCH=mips CROSS_COMPILE=/home/mcon/vocore/Buildroot/toolchain/host/bin/mipsel-linux-
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
HOSTCC scripts/dtc/dtc.o
...
IHEX firmware/edgeport/down3.bin
IHEX2FW firmware/whiteheat_loader.fw
IHEX2FW firmware/whiteheat.fw
IHEX2FW firmware/keyspan_pda/keyspan_pda.fw
IHEX2FW firmware/keyspan_pda/xircom_pgs.fw
mcon#cinderella:~/vocore/kernel$ make ARCH=mips CROSS_COMPILE=/home/mcon/vocore/Buildroot/toolchain/host/bin/mipsel-linux- modules_prepare
scripts/kconfig/conf --silentoldconfig Kconfig
net/sched/Kconfig:43: warning: menuconfig statement without prompt
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
Diver is taken from here and unpacked in /home/mcon/vocore/mt7628-p4rev-120395
I had to add a symlink because Makefile looks in ../mt_wifi and not in ../src if not compiling for OpenWRT.
Anyways compilation doesn't seem to do anything:
mcon#cinderella:~/vocore/mt7628-p4rev-120395/build$ make -C /home/mcon/vocore/kernel M=$(pwd) CROSS_COMPILE=/home/mcon/vocore/Buildroot/toolchain/host/bin/mipsel-linux- ARCH=mips
make: Entering directory '/home/mcon/vocore/linux-3.18-vocore2'
Building modules, stage 2.
MODPOST 0 modules
make: Leaving directory '/home/mcon/vocore/linux-3.18-vocore2'
I have been unable to start kernel configuration for module:
mcon#cinderella:~/vocore/mt7628-p4rev-120395/build$ make -C /home/mcon/vocore/kernel M=$(pwd) CROSS_COMPILE=/home/mcon/vocore/Buildroot/toolchain/host/bin/mipsel-linux- ARCH=mips menuconfig
make: Entering directory '/home/mcon/vocore/linux-3.18-vocore2'
make: *** No rule to make target 'menuconfig'. Stop.
make: Leaving directory '/home/mcon/vocore/linux-3.18-vocore2'
... and I also tried to manually add relevant configuration variables to .config and/or command-line, but they seem to be completely ignored.
I am obviously missing some needed step, but I'm unable to understand what.
Related
I'm trying to cross-compile Mali DX910-SW-99002-r7p0-00rel0 Driver in my Linux x86 (Ubuntu) machine for an ARM64 machine linux kernel version 4.4.83.
I followed the instructions given in the readme file:
DX910-SW-99002-r7p0-00rel0/driver/src/devicedrv/ump/readme.txt
select Mali as a module (M) within the menuconfig:
CONFIG_MALI400=m
CONFIG_MALI450=y
KDIR=~/linux-4.4.83 USING_UMP=1 BUILD=debug make
cannot find bingcc
KDIR=./linux-4.4.83 CONFIG=default BUILD=debug make
cannot find bingcc
My question is:
The two compile commands (items 2. and 3. above) both yield the same failure result as the following:
KDIR=~/linux-4.4.83 USING_UMP=1 BUILD=debug make
make: gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/aarch64-linux- gnu/bingcc: Command not found
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CC kernel/bounds.s
/bin/sh: 1: gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/bingcc: not found
Kbuild:44: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 127
Makefile:1007: recipe for target 'prepare0' failed
What should be done to fix these?
If you want to use GNU C compiler from gcc-aarch64-linux-gnu Ubuntu package, then you'd better make sure that the package is indeed installed and then specify one more option to make, in example:
KDIR=~/linux-4.4.83 USING_UMP=1 BUILD=debug ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make.
However, I see linaro mentioned in your output. So, alternatively, you may consider following this guide on toolchain setup and usage.
I have been trying to cross compile a loadable kernel module and I have been getting warning message that I would like to get help.
Below is the warning message
make[1]: Entering directory `/home/userid/rowboat-android/kernel'
Building modules, stage 2.
MODPOST 1 modules
WARNING: "omap_device_build" [/home/userid/myfiles/lcdc_load_device.ko] undefined!
WARNING: "omap_hwmod_lookup" [/home/userid/myfiles/lcdc_load_device.ko] undefined!
make[1]: Leaving directory `/home/userid/rowboat-android/kernel'
Below is the Makefile
obj-m :=lcdc_load_device.o
lcdc_load_device-m := ../rowboat-android/kernel/arch/arm/plat-omap/omap_device.o
lcdc_load_device-m += ../rowboat-android/kernel/arch/arm/mach-omap2/omap_hwmod.o
ccflags-m := -I$(src)/../rowboat-android/kernel/arch/arm/plat-omap/include/plat/
KDIR := /home/userid/rowboat-android/kernel/
PWD := $(shell pwd)
default:
$(MAKE) ARCH=arm CROSS_COMPILE=/home/userid/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
I am suspecting that the makefile is finding the header file for "omap_device_build" and "omap_hwmod_lookup" functions.
Appreciate your help, and thank you advance.
Thank you to mbratch and artless noise for their comments
To address the WARNINGS, the symbols need to be exported. For the above question place
EXPORT_SYMBOL(omap_device_build) in omap_device.c
EXPORT_SYMBOL(omap_hwmod_lookup) in omap_hwmod.c
and compile the kernel. Then compile the loadable kernel module against the compiled kernel. Perform the following to verify if the symbols have been exported
grep omap_device_build /proc/kallsyms
or
grep omap_device_build Module.symvers
For more details reference the following links
Kernel Symbols: What's available to Your Module
Building and Running Modules
Comments are welcome
Thank you
I tried to compile chardev.c from this tutorial using the following Makefile:
obj-m := chardev.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default :
$(MAKE) -C $(KDIR) M=$(PWD) modules
I got the correct output and it is working fine while I make in Ubuntu 10.04 LTC:
make -C /lib/modules/2.6.32-33-generic-pae/build M=/home/noge/Desktop/driver- tutorial/IOCTL_example/ioctl_eclipse modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-33-generic-pae'
Building modules, stage 2.
MODPOST 1 modules
LD [M] /home/noge/Desktop/driver-tutorial/IOCTL_example/ioctl_eclipse/chardev.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-33-generic-pae'
However, when I transfer the same files to BeagleBoard that is running Angstrom, and did a make CROSS_COMPILE=arm-angstrom-linux-gnueabi-, I got the following error:
root#beagleboard:~/Desktop/noge/C-tutorials/hello_world# make CROSS_COMPILE=
arm-angstrom-linux-gnueabi-
make -C /lib/modules/2.6.32/build M=/home/root/Desktop/noge/C-tutorials/hels
make[1]: Entering directory `/usr/src/linux-2.6.32/2.6_kernel'
Makefile:1448: *** mixed implicit and normal rules. Stop.
make[1]: Leaving directory `/usr/src/linux-2.6.32/2.6_kernel'
make: *** [default] Error 2
I'm not sure if this is the cause, but I noticed the version of make is different for the Ubuntu and Angstrom:
Angstrom's version:
GNU Make 3.82
Built for arm-angstrom-linux-gnueabi
Ubuntu's version:
GNU Make 3.81
This program built for i486-pc-linux-gnu
In short, why the error while doing make in Beagle Board running Anstrom?
Thanks for any help..!
Update:
The content of the Makefile near line 1448:
1447 # Modules
1448 / %/: prepare scripts FORCE
1449 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1450 $(build)=$(build-dir)
1451 %.ko: prepare scripts FORCE
1452 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1453 $(build)=$(build-dir) $(#:.ko=.o)
1454 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
I did a check on my kernel version and I got:Linux beagleboard 2.6.32 #3 PREEMPT Thu Jun 23 09:56:19 CEST 2011 armv7l GNU/Linux, but the kernel source I got from here is of version 2.6.22.18.
Is it possible for getting the wrong kernel source code that is causing this ?
I'm fairly sure your Makefile is not at fault here, but there might be a rule name collision. What is at line 1448 of /usr/src/linux-2.6.32/2.6_kernel/Makefile ?
make -C /usr/src/linux-2.6.32.9 M=`pwd`
LD /root/test/lkm/built-in.o
Building modules, stage 2.
MODPOST 1 modules
make: Leaving directory `/usr/src/linux-2.6.32.9'
make -C /usr/src/linux-2.6.32.9 M=`pwd` modules_install
INSTALL /root/test/lkm/try.ko
DEPMOD 2.6.32.9
But when I lsmod |grep try,nothing is shown,why?
INSTALL doesn't load the module, it just copies it to its final location. Try insmod /root/test/lkm/try.ko.
I am trying to run 'make' on a module in User Mode Linux to install a simple makefile. Here is my make file:
obj-m := hello.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
When I run this in User Mode Linux I get the following error:
make[1]: Entering directory `/lib/modules/2.6.28/build'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/lib/modules/2.6.28/build'
make: *** [default] Error 2
The problem is that no files are present under /lib/modules/. There's no directory for 2.6.28 or build. From what I've read, these should be symlinks to /usr/src, but under /usr/src, I don't see any files under that either.
Sources and headers of your UML kernel must be used to compile module for it.
You can compile it either inside UML or just in main system, but you must to use UML's kernel's headers and build scripts
You need to build and install the version of the kernel you are compiling for. Get the source from kernel.org, configure (I think make menuconfig picks the config up from the running kernel), build, and install it. You can do the build in your home directory under regular user, then of course you would need root to install it.
Edit:
Just in case you missed this - here's User Mode Linux HOWTO. It contains specific items for building and installing kernel and modules. Hope this helps.