HOW-TO compile Chip's Linux kernel and modules on Chip itself

Da raspibo.
Versione del 21 feb 2016 alle 11:20 di Renzo (discussione | contributi) (This step is crucial, otherwise during the installation phase modules provided by the distribution packets and your own modules can be mixed up and overwritten.)
(diff) ← Versione meno recente | Versione attuale (diff) | Versione più recente → (diff)
Jump to navigation Jump to search

Chip is a tiny workstation. So you do not need any external hardware for its development platform. Software for chip can be developed on chip itself. Including the kernel.

What you need is:

  • a Chip running ChipOS (like a Chip v1 out-of-the-box)
  • a way to connect Chip to the Internet
  • a lot of patience

And it is warmly suggested to have a console cable to recover if something goes wrong during the boot (see how to connect a console cable in my previous posting Chip9$ U-Boot: how to test a new kernel (in a safe way)

Step by Step, 1: get the tools to build a kernel

If your Chip is up, running anc connected in some way to the Internet, you can install all the Debian packets needed. As a first substep upgrade the whole distribution to the latest updates available.

sudo apt-get update   
sudo apt-get upgrade
sudo apt-get install locales
sudo apt-get clean

A reboot at this point is a good idea as maybe the kernel has been updated, too. When your chip is up, running and connected to the Internet again add the require packets:

sudo apt-get install git build-essential zlib1g-dev libncurses5-dev lzop
sudo apt-get clean

Set up a src directory and get the source code

You do not need to be root to compile a Linux Kernel. In this tutorial all the kernel generation procedure will take place in the home directory of the user named "chip".

So log-in as chip (it is the standard situation if you are using the auto-starting graphical interface). Open a terminal (or open an ssh connection to chip). I assume you are using a shell. Create a src directory and enter it. <dir> cd mkdir src cd src

Now download the kernel from git. (The following command downloads just the latest version not the entire history as git would usually do).

git clone --single-branch --branch debian/4.3.0-ntc-4 --depth 1 https://github.com/NextThingCo/CHIP-linux.git

Now configure your kernel. You can either the NTC kernel configuration as a starting point or my kernel configuration. To start from NTC conf:

cp /boot/config-4.3.0 .config

To start from my configuration:

mkdir /tmp/chiplinux4.3.0rd235+
pushd /tmp/chiplinux4.3.0rd235+
wget http://www.raspibo.org/renzo/chiplinux4.3.0rd235+.tgz
tar zxf chiplinux4.3.0rd235+.tgz
popd
cp /tmp/chiplinux4.3.0rd235+/boot/config-4.3.0rd235+ .config

Now configure your kernel:

make menuconfig

N.B. add a local version suffix. Follow the menus:

    General setup  --->
    () Local version - append to kernel release