Mainline Kernel Support

WARNING!

This is a developer only manual and should not be tried by users and in user installations! Following this instructions without in depth information about the hardware and kernel programming skills might leave a dSS in conditions where it needs to be send back for service.

Target of this document

Every once in a week I test the latest greatest kernel of kernel.org on the current dSS 1GB. As this is an easy job that needs to have all the same steps repeated over and over again, I collected most steps in a single script. I even started to adopt the older dSS SD but everything works besides the SD :)

Mainline kernel changes

The changes I made to run the mainline kernel are minimalistic:
There hasn't been changed any line of code in the kernel at all! The mainline build makes full use of the new device tree concept now mandatory for ARM devices.
- There is added a genuine dss11_defconfig that adds all kernel features and modules that are needed to boot up any dSS11 hardware release (SD or 1GB)
- There are two different device-tree files, one for each hardware type, SD-card or 1GB.
- A small script to help setting up things and redo all needed steps every time a new kernel release candidate appears on the scene.

Precausions

- You need to have a recent ARM cross-gcc environment installed. gcc-4.7-arm-linux-gnueabi or above will work fine.
Follow these instructions to get you build environment set up perfectly: https://wiki.ubuntu.com/KernelTeam/ARMKernelCrossCompile
- Assume we work in a directory home/[user]/dss referred to as ~/dss
- The dropbear on the target dSS was enabled and root was permitted to login via SSH.
- The packages putty and putty-tools have been installed on your build machine.

Download and prepare

1) Get the current kernel including dSS11 specific changes from my github repo:

cd ~/dss
git clone :Astralix/linux-rockchip.git -b wip/dss11 linux

This creates a clone of my linux-rockchip mainline kernel, changes to branch wip/dss11 and puts that all in ~/dss/linux

2) First of all we need to switch to ARM mode for compilers and tools, sow lets run the mk.sh script for the first time:

cd linux
source mk.sh setup

This mk.sh is a script that supports you in all steps of building everything from kernel to modules and more. In addition it sets up your exports to tell the kernel make file about compiler and architecture. it exports ARCH=arm and CROSS_COMPILER=arm-bla-bla- If you have a different toolchain, modify the script to your needs.
It is possible to add this inside the script and skip this step, but I prefer to be able to call make clean, make modules or make menuconfig on the command line without the script too.

3) As we do not want to dirten the kernel sources with lots of compilation intermediate files, we prepare out of tree compilation:

mkdir ../dss11
make O=../dss11 dss11_defconfig

Now we have a clean ~/dss/linux directory containing all sources and ~/dss/dss11 directory that carries all compilation results.

4) We work in ~/dss/dss11 so we need to copy mk.sh there and then switch directories

cp mk.sh ../dss12
cd ../dss11

5) One little thing before building...
In my setup I use a TFTP server having the directory under ~/tftpboot to store the bootable kernel. My dSS11 uboot is modified to boot from network instead of NAND FLASH. So every time I reset the dSS, it fetches the kernel from this TFTP server. If you use this mechanism, you might need to edit the mk.sh and adapt the directory setting to your setup, or comment out the line, that copies the file over, if you like to manually apply it to your dSS device.

Build and install

6) Building a latest greatest kernel is easy with mk.sh:

./mk.sh -ckmf 1gb

will do [c]lean [k]ernel [m]odules and [f]irmware for a 1gb model. Use sdc for the SD-card model.

7) Some of you like to have WiFi working with dSS. Lots of binary firmware blobs are needed for that and not all of them are available in the kernel due to GPL and copyright issues. To get at least the most common Realtek binary blobs for all those cheap WiFi USB buttons, call

./mk.sh download

7) On the first boot, the dSS digitalSTROM related services might not start as several modules are missing for the kernel. So we need to transfer the modules to the appropriate directory of the dSS. The kernel is set up to provide everything that is need to get a dSS booting down to the command line and use networks. So we can now use ssh+scp to copy all things over via mk.sh and putty tools:

./mk.sh install [dss-ip-address]

Note: The kernels modules are stored in a directory named after the kernel version. So aborting a kernel experiment and just booting to the kernel from NAND or an oder kernel release from TFTP is pretty well possible:
ls -l /lib/modules/
drwxr-xr-x 3 root root 1424 Apr 2 13:40 3.0.17
drwxr-xr-x 3 root root 1040 Jul 2 13:52 3.16.0-rc3+
drwxr-xr-x 3 root root 1040 Jul 10 14:40 3.16.0-rc4+

9) Finally login to the dSS and do a reboot and you're done:

reboot

With this reboot, the kernel will start again and this time finding all modules needed. All dSS related services should be up and running.

Keeping it up to date

U1) First of all remember to setup your environment to ARM development: So either in ~/dss/linux or ~/dss/dss11 call

source mk.sh setup

U2) As long as I have time and fun, I will keep this git repo updated at least every two weeks to the latest greatest kernel tree (linus/master).
To keep your clone up to date, you:

git fetch origin
git pull origin wip/dss11

U2) Even it is now unlikely but may happen, update your config:

source mk.sh setup
make O=../dss11 dss11_defconfig
cd ../dss11
make menuconfig .. [Exit]->[Save Yes]
./mk.sh -ckmf 1gb
./mk.sh download
./mk.sh install [dss-ip-address]

That's it.