Page 1 of 1

Cross compiling extra modules

PostPosted: Sat May 14, 2016 1:30 pm
by kirill
This was tested with 2016.3.1 release, but procedure should work for other versions. I assume relatively modern Ubuntu is used as a host platform, tested on 14.04, 64 bit.

First make sure you have needed tools installed on your PC

Code: Select all
sudo apt update
sudo apt install \
      build-essential \
      gcc-arm-linux-gnueabihf \
      libncurses5 \
      fakeroot \
      u-boot-tools \
      git \

Checkout parallella-linux repository somewhere and make sure to use the right branch, currently it's parallella-linux-2016.3

Code: Select all
git clone
cd parallella-linux
git checkout origin/parallella-linux-2016.3 -b parallella-linux-2016.3

Now create some temporary folder and add symlink to the kernel you checked out in the previous step
Code: Select all
cd ~
ln -s ../parallella-linux

In this same folder create a file called with the following content

Code: Select all
: ${CROSS=arm-linux-gnueabihf-}
: ${B=$(pwd)/B}
: ${R=$(pwd)/ROOT}
: ${L=$(pwd)/parallella-linux}

mk_linux () {
    make -C ${L} ARCH=arm CROSS_COMPILE=${CROSS} \
         O=${B} \
         LOADADDR=0x80000 \
         INSTALL_MOD_PATH=${R} \
         INSTALL_HDR_PATH=${R} \

Now source this file

Code: Select all

You now have a new command mk_linux that you can run, you use it like this:

Code: Select all
mk_linux parallella_defconfig
mk_linux menuconfig
mk_linux modules -j4
mk_linux modules_install

When running menuconfig you need to choose which extra modules you want to build. Also, and this is IMPORTANT, you have to go to "General Setup" and uncheck "Automatically append version information to the version string" setting.

All the temporary build files will be placed in the folder ./B and modules will install in the folder ./ROOT. You then transfer modules you are interested in (and all their dependencies) to the parallella. Then on parallella run "sudo depmod -a", you now should be able to "modprobe <some_module_i_wanted>"

When running modules_install take note of the almost last line starting with " DEPMOD", it should read

Code: Select all
  DEPMOD  4.4.0+

Version string you see must match version string of the kernel you use, currently it's "4.4.0+", if it doesn't, module not going to load.