MM

Cross-compiling the linux kernel for the WDMC EX2 Ultra

Prepare your build system

You need to install a cross compiler for the armhf platform on your system. The people from emdebian provide suitable packages for debian jessie on x86_64.

Add the following lines to /etc/apt/sources.list

# cross toolchain packages
deb http://emdebian.org/tools/debian/ jessie main

install the toolchain

apt-key adv --keyserver http-keys.gnupg.net --recv 1804772E
dpkg --add-architecture armhf
aptitude update
aptitude install crossbuild-essential-armhf u-boot-tools

Compile the kernel

After successful installation of the packages download the linux kernel source and unpack it. You need to apply a patch to the kernel for the embedded micro controller to poweroff and reboot the device correctly. The necessary files are in my mcm-daemon git repository. You will need that anyways later on if you don't want to have the fan running at full speed all the time.

# get the kernel
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.8.12.tar.gz
# unpack it
tar xvzf linux-4.8.12.tar.gz
# clone my git repository
git clone https://github.com/c-MM/mcm-daemon.git
# copy the kernel config into the kernel source
cp mcm-daemon/kernel/config-4.8.12.txt linux-4.8.12/.config
# apply my kernel patch for poweroff and reboot
patch -p1 -d linux-4.8.12 < mcm-daemon/kernel/poweroff-restart-4.8.12.diff
# copy the dts file into the kernel tree
cp mcm-daemon/kernel/armada-385-wd.dts linux-4.8.12/arch/arm/boot/dts/

Now everything is prepared to compile a linux kernel for your device. Enter the linux source tree and compile the kernel an modules.

cd linux-4.8.12/
export ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
make oldconfig
make -j4 zImage
make armada-385-wd.dtb
cat arch/arm/boot/zImage arch/arm/boot/dts/armada-385-wd.dtb > zImage

Generate uboot images

The uboot bootloader needs images with some special headers to recognize kernel and ramdisk.

mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Linux WDMC ex2u" -d zImage uImage

Create a tar file with kernel modules

To have kernel modules available for your kernel you will need to manually copy them into your debian system. Create a tar-file and put it on the USB-stick used for booting the installer.

make -j4 modules
mkdir mod_tmp
make modules_install INSTALL_MOD_PATH=./mod_tmp
( cd mod_tmp ; tar cvzf ../modules.tgz lib ; cd .. )
rm -rf mod_tmp

Cross-compiling mcm-daemon for the EX2 Ultra

The fan and some LEDs are attached to an embedded MCU in the system. To access the LEDs and have the fan speed adjusted to the current load, you need install my mcm-damon. It's easy to compile if you have installed the compiler and libs as explained above when compiling the kernel.

git clone https://github.com/c-MM/mcm-daemon.git
cd mcm-daemon
dpkg-buildpackage -uc -us -b -t arm-linux-gnueabihf

Back to installation