Cross compile FTDI VCP Driver for embedded linux arm - linux

I'm trying to cross compile the FTDI VCP Driver for my embedded arch linux arm machine. I downloaded the source files from http://www.ftdichip.com/Drivers/VCP.htm onto my host machine which is running kernel:
2.6.32-54-generic-pae
When running the Makefile, I get errors related to kernel headers, ie: asm/thread_info.h file not found. I realize that this means that my asm symlink is broken, so I tried linking it to
linux-headers-2.6.32-54/include/asm-generic
but the contents of that directory does not include thread_info.h either, which I'm trying to find.
Has anyone cross compiled the FTDI VCP Driver for embedded arch linux arm using Ubuntu as their host and can point me in the right direction? I'm new to building kernel modules and cross compiling and any help would be appreciated.
If anyone requires more information I'd be more than happy to add it.

make ARCH=arm menuconfig
Make and install modules: make modules and make modules_install
Don't forget: insmod usbserial.ko and insmod ftdi_sio.ko if you need to, and depmod -a to have them load after a power cycle.
Don't forget to include your cross compiling chains.

Basically u need cross-compile kernel in host x86 machine.
First check the source code is already configured and built if so.
make ARCH=arm menuconfig
window ll appear and enable ftdi in driver .
if source code is clean.
then u need to copy /proc/config.gz file from target machine to host and untar it.
copy to source top folder like `cp config .config'
make ARCH=arm menuconfig
and enable your driver
After this make ARCH=arm CROSS_COMPILE=<your tool chain> zImage
e.g make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- zImage
make ARCH=arm CROSS_COMPILE=<your tool chain> modules
e.g make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules

The FTDI "VCP" driver has been a part of the linux kernel for a good while now. You don't need to download anything, except for the kernel itself. As long as you can cross-compile your kernel, you're all set.

Related

cross compile raspberry pi kernel module

So I have been trying to learn more about developing linux drivers with Linux Device Drivers version 3. Using a spare Rasberry Pi (b) I had kicking around.
I used http://www.raspberrypi.org/documentation/linux/kernel/building.md to build the the kernel in my ~/kernelWork/kernel folder. I have also compiled the kernel and have it running on my raspberry pi to avoid compatibility issues.
The issue I have is I know I need to cross compile the module source to work with the ARM architecture, but I'm not sure where to point the -C flag of the command
make -C ~/kernel-2.6 M=`pwd` modules
command to make my module with. I took a look into my arch folder of my kernel, and looked in the ARM directory included there, but from there I'm not sure where to go.
So in short, after I have built my kernel where do I point the -C flag to cross compile my module.
I had to set my Makefile to cross compile with the settings
all:
make ARCH=arm CROSS_COMPILE=${CCPREFIX} -C /home/jacob/kernelWork/kernel M=$(PWD) modules
clean:
make -C /home/jacob/kernelWork/kernel M=$(PWD) clean
As well as setting my environment variables KERNEL_SRC and CCPREFIX to my kernel source, and the raspberry compiler I pulled from the git source. This page has the full details
http://bchavez.bitarmory.com/archive/2013/01/16/compiling-kernel-modules-for-raspberry-pi.aspx

I am not able to boot with the latest kernel source ie 3.18.0 with the device tree enabled

I am not able to boot with the latest kernel source ie 3.18.0 with the device tree enabled.
I am getting blank screen.
I used the [b]latest tools and firmware[/b] to boot.
downloaded the code from https://github.com/raspberrypi/linux/tree/rpi-3.18.y and compiled it.
I followed the following steps to compile it.
ARCH=arm make bcmrpi_defconfig
CCPREFIX=rpi-tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-
ARCH=arm CROSS_COMPILE=$CCPREFIX make -j4
ARCH=arm CROSS_COMPILE=$CCPREFIX INSTALL_MOD_PATH=modules make -j2 modules_install
/boot/config.txt content:
device_tree=bcm2708-rpi-b-plus.dtb
device_tree_address=0x100
kernel_address=0x8000
disable_commandline_tags=2
Plese let me know if anything i am missing.
Please Suggest me something.

How to compile a modified kernel which is different from the one installed on our computer?

I am currently working on linux kernel 3.11.0-12. But I am adding a system call by modifying the source code I downloaded from kernel.org of linux-2.6.26. I want to compile the modified 2.6.26 kernel to test my new system call. How should i do it?
1)If you want to build kernel for same architecture on which you are working then..
go into your linux source folder and fire below commands....
To Clean:
make distclean
To write config:
make defconfig
To build Kernel:
make uImage
or make vmlinux which image you want to build
2)for arm architecture...
To Clean:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
To write config:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- defconfig
To build Kernel:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage
3) using second step you can build linux kernel for any platform with any toolchain
just use ARCH= CROSS_COMPILE= macro as per requirement......
I assume you use a vanilla kernel and that you are working on a module. Vanilla or not, you need the configuration file for the target kernel.
Just download the source, copy the kernel configuration file to <kernel_source>/.config and build the kernel once, since you need the configuration- and header-files for an out of kernel source build. Use make modules_prepare.
Then run make -C <full_path_to_kernel_source> M=$PWD to build the module.
Take a look at here for more detailed information.

How to generate kernel headers of a toolchain for ARM Integrator Target Machine

I'm trying to build a toolchain from scratch for ARM Integrator target machine. I started by building binutils and it is OK.
Now I have to generate kernel headers and I don't know how to do this in the right way.
Any help will be useful.
I searched a lot for this, in order to cross compile gcc.
This example involves the source of linux-3.9.
#cd to the top directory of the kernel source
cd linux-3.9
make mrproper
make ARCH=arm integrator_defconfig
make ARCH=arm headers_check
make ARCH=arm INSTALL_HDR_PATH=$SOMEWHERE headers_install
variable $SOMEWHERE is where you want it extracted.
What if you want something else than integrator? How to find out? Assuming your are still at the top directory of the kernel's source tree, here are the other _defconfig you could use:
ls /arch/arm/configs/*
Idem for other architectures.
Note: If you build a cross toolchain with newlib instead of glibc, you do not need kernel headers. Which library should you use? It depends of your needs. newlib is aimed at embedded solutions.
Sources:
http://pmc.polytechnique.fr/pagesperso/dc/arm-en.html
http://www.ifp.illinois.edu/~nakazato/tips/xgcc.html
http://www.gentoo.org/proj/en/base/embedded/handbook/?part=1&chap=2

Compiling a kernel - no bzImage/vmlinuz produced

I'm trying to compile a kernel (altered version of 2.6.32.9, found here https://github.com/rabeeh/linux-2.6.32.9). I am doing the compilation on a emulated ARM system (qemu) (yes, I should probably cross-compile, but that's a different topic) running Ubuntu Core (https://wiki.ubuntu.com/Core) and the kernel (vmlinuz) from Ubuntu 11.04 (downloaded from http://ports.ubuntu.com/ubuntu-ports/dists/natty/main/installer-armel/current/images/versatile/netboot/vmlinuz).
After running make bzImage, I look in the arch/arm/boot folder, and find only a file called zImage. I tried using this zImage instead of the vmlinuz I downloaded from ubuntu.com in qemu, but that doesn't work, just shows a black screen. I guess zImage is not the same as bzImage, which is what I think vmlinuz (judging from different articles on the internet) is.
So, a few questions:
Why doesn't make bzImage produce a bzImage/vmlinuz?
Can I convert a vmlinux to a vmlinuz using for example mkimage (there are lots of guides on the opposite...)?
Thanks
The bzImage filename and make target was originally x86-specific (big zImage). Many of the bootloaders on architectures that are not equal to baremetal-x86 (SPARC, PPC, IA64, etc. and also Xen on *) directly take vmlinux (or one of its compressed forms, for example vmlinux.gz, aka zImage). I guess some maintainers just added bzImage as a make target name because they wanted to have the x86 madness on their arch as well.
I get the result you describe by asking qemu to emulate a different cpu than arm926ej-s. But booting versatilepb with the default cpu works. I've cross-compiled my kernel, and I compiled all the drivers into it (so I don't use initrd).
Just download 100MB arm-eabi toolchain from http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ (it's free but they want your email, like the x86 Intel compiler). It has an installer, just say "next" until it's done, like on Windows. Then add the bin directory to your path:
export PATH=~/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin/:$PATH
Then go back to your kernel source dir and do
make ARCH=arm CROSS_COMPILE=arm-none-eabi- menuconfig
make ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage modules
You can do
sudo make ARCH=arm CROSS_COMPILE=arm-none-eabi- INSTALL_MOD_PATH=path_to_arm_root modules_install
if you can reach your ARM filesystem from the host. If you're using NFS root it's trivial, but if you're using a disk image you need to either:
use a raw disk image and kpartx (depends on your host kernel having dm-multipath) or
qemu-nbd which supports qcow (and depends on host kernel having network block device support)
To boot in qemu with disk you need the right drivers (SYM53C8XX SCSI). The versatile defconfig doesn't select those.

Resources