IIO Setup

Let me present you the work environment.

Like I mentioned in a previous post, I will be working in the Industrial I/O Subsystem (IIO) of the Linux Kernel. For this, a short setup is needed.

The first step is to download the kernel source tree of IIO and compile it.

git clone https://www.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git

Before compilation you need to create the kernel configuration. At this step you customize your kernel. Within the Linux Kernel there are a lot of implemented drivers but the final kernel image should include only those needed by the OS. This is the moment when we choose which drivers to include in our image. Let’s start from the default configuration:

cd iio/
make defconfig

Now, let’s particularize the configuration to include the IIO Subsystem.
make tool has also a UI available trough this command:

make menuconfig

If you are getting an error from a missing ncurses library, most probably you are missing the libncurses5-dev package. Install it and try again. If everything goes fine, a similar interactive menu should appear.

meke menuconfig

Now search for IIO. To search for a keyword press / key and a prompt asking for the word to be searched will appear. The result should look like this:

settings1

Note that results are numbered and you can select one of them by typing its number. The result that interests us is the first one and is not selected (“[=n]”). Also,  we can see that depends on other 3 modules: RTC_DRV_HID_SENSOR_TIME, RTC_CLASS and USB_HID. The last two are present in the kernel but the first one is not, so, we need to select this one too in order to be able to include IIO in the kernel. After that, IIO will be automatically selected:

settings2

Thus, there are some more auxiliary IIO modules that we need so go to the first result (press 1) and set them accordingly:

settings4

Click Save and you are done with the configuration.

Now compile the kernel and the modules:

make -j `nproc`
make modules

After this step a file called bzImage (the compressed kernel image) will be available: iio/arch/x86/boot/bzImage .

The second step would be to create a virtual machine which runs with a minimal operating system based on our previously compiled kernel. For this, the mentors provided me this archive with a qemu virtual machine. You will need several packages installed in order to run this virtual machine: build-essential, genisoimage, syslinux, qemu, kvm. Also, you will need to create a reference in the qemu directory to the bzImage file resulted from the kernel compilation:

ln -s path_to_iio/iio/arch/x86/boot/bzImage bzImage

Now start the virtual machine:

sudo make

Congratulations ! You completed the setup ! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s