Difference between revisions of "Howto.crosscompile for parrot drones"

From PaparazziUAV
Jump to navigation Jump to search
Line 74: Line 74:

=Toolchain in virual box=
=Toolchain in virtual box=

Download the toolchain from here via:
Download the toolchain from here via:

Revision as of 09:52, 3 December 2018


On this page you find one way to compile the drivers for a Parrot Bebop,Bebop2,Disco or who knows... Anafi. Could well work for others also with maybe slight modifications.

For this to work, remember that there are many ways to Rome... This is just one.

TIP: https://www.techrepublic.com/article/how-to-run-virtualbox-virtual-machines-from-the-command-line/


This article is probably 100% right!


Virtual Box

Install virtual box, we used v5.2 at the time of writing this page.

Native cross-compiling 64-bit did not work for us, and we spend quite an allnighter on it. The way it is described, it all worked out, so let's be pragmatic for once...

Install a Virtual machine

Use the ISO of Debian 7 32-bit this worked,

Guest additions

Follow these steps to install the VirtualBox Guest Additions on your Linux Debian virtual machine:

Open terminal and become root (su); if you have sudo enabled, you may also do for example sudo -i; see man sudo for all options):


Update APT cache:

apt-get update

Install the latest security updates: This step will upgrade all your packages, so be wise about it. Try the following steps first and they might be enough to work if not, then perform upgrade and retry.

apt-get upgrade

Install these required packages:

Packages build-essential and module-assistant are both required to be able to compile the kernel modules and so when installing the VirtualBox Linux Guest Additions you must have them. So, this command will get the headers and packages (compilers and libraries) required to work. Notice, that after installing your VirtualBox Linux Guest Additions you will leave behind some packages as well as Linux headers, which you might delete afterwards or not. In my case they didn't hurt, but for the sake of system tidiness, you might want to pick up after playing.

apt-get install build-essential module-assistant

Configure your system for building kernel modules:

m-a prepare

Insert Guest Additions ISO:

Expand menu Devices and click on Insert Guest Additions CD image...

It should mount automatically, but if for any reason it doesn't:

mount /media/cdrom
Run the following script:

sh /media/cdrom/VBoxLinuxAdditions.run

Restart the system:


Shared folder

Handy to transfer your .ko to drone from within host OS


Toolchain in virtual box

Download the toolchain from here via:

wget https://openuas.org/pub/mirrors/gnu/gnu_toolchain/arm-none-linux-gnueabi/arm-2012.03-57-arm-none-linux-gnueabi.bin


Install tools needed via:

$ sudo apt-get install make gcc build-essential

Get Parrot source

git clone https://github.com/Parrot-Developers/disco-opensource.git

Patch Parrot





    diff --git a/sources/linux-3.4.11/linux-3.4.11/drivers/parrot/gpu/mali400/Kbuild b/sources/linux-3.4.11/linux-3.4.11/drivers/parrot/gpu/mali400/Kbuild
   index a4481dd..5c45684 100755
   --- a/sources/linux-3.4.11/linux-3.4.11/drivers/parrot/gpu/mali400/Kbuild
   +++ b/sources/linux-3.4.11/linux-3.4.11/drivers/parrot/gpu/mali400/Kbuild
   @@ -25,21 +25,21 @@ DRIVER_DIR=$(KBUILD_SRC)/$(src)
    # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
    # The ARM proprietary product will only include the license/proprietary directory
    # The GPL product will only include the license/gpl directory
   -ifeq ($(wildcard $(DRIVER_DIR)/linux/license/gpl/*),)
   -    ccflags-y += -I$(DRIVER_DIR)/linux/license/proprietary
   -    ifeq ($(CONFIG_MALI400_PROFILING),y)
   -        $(error Profiling is incompatible with non-GPL license)
   -    endif
   -    ifeq ($(CONFIG_PM_RUNTIME),y)
   -        $(error Runtime PM is incompatible with non-GPL license)
   -    endif
   -    ifeq ($(CONFIG_DMA_SHARED_BUFFER),y)
   -        $(error DMA-BUF is incompatible with non-GPL license)
   -    endif
   -    $(error Linux Device integration is incompatible with non-GPL license)
   -    ccflags-y += -I$(DRIVER_DIR)/linux/license/gpl
   +#ifeq ($(wildcard $(DRIVER_DIR)/linux/license/gpl/*),)
   +#    ccflags-y += -I$(DRIVER_DIR)/linux/license/proprietary
   +#    ifeq ($(CONFIG_MALI400_PROFILING),y)
   +#        $(error Profiling is incompatible with non-GPL license)
   +#    endif
   +#    ifeq ($(CONFIG_PM_RUNTIME),y)
   +#        $(error Runtime PM is incompatible with non-GPL license)
   +#    endif
   +#    ifeq ($(CONFIG_DMA_SHARED_BUFFER),y)
   +#        $(error DMA-BUF is incompatible with non-GPL license)
   +#    endif
   +#    $(error Linux Device integration is incompatible with non-GPL license)
   +ccflags-y += -I$(DRIVER_DIR)/linux/license/gpl
mali-y += \
   linux/mali_osk_atomics.o \


open makefile

nano makefile

add a plus ( + ) to the line




to prevent errors like '/bin/sh: line 0: cd: /drivers/parrot/gpu/mali400: No such file or directory' while compiling, create symlink (stupid, but works)

$ su
# cd /
# ln -s /home/n3yh3hnii/develop/disco-opensource/sources/linux-3.4.11/linux-3.4.11/drivers drivers


  1. rename linux.config to .config
  2. make the changes to .config required for your modules to be included


as root run:

export ARCH=arm
export CROSS_COMPILE=/yourpath/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-
make oldconfig
make clean
make zImage
make modules

Compile the entire kernel first (make zImage), if you don’t do so, the checksums used by Module.symvers (CONFIG_MODVERSIONS) will not match!

Reminter to self

make -C /home/n$USER/develop/allthings_parrot/disco/disco-opensource/sources/linux-3.4.11/linux-3.4.11/ -j8 ARCH=arm CROSS_COMPILE=/opt/extra/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-

Driver info

To get some more info of your comoiled drivers, these example might come in handy

$ readelf -a usbserial.ko
$ file usbserial.ko
$ modinfo usbserial.ko


  • Nothing, feel free to add...