picoTCP for Linux Kernel tinification (Maxime Vincent, Altran (former TASS))

Linux runs on cell phones, but not (yet) on really small devices. In addition, the minimum kernel size (make allnoconfig) is steadily increasing. With tiny, take for instance the STM32F4 cortex M4 board from emCraft – it has 2MB SDRAM and 16MB Flash. You need ucLinux (no MMU), you want XIP to save RAM and because flash can be accessed directly. In 3.17, the ‘make tinyconfig’ option was introduced, which e.g. turns on -Os. But to get it small, you have to disable the TCP/IP stack because that is large.

So replacing the TCP/IP stack is an important step for tinyfication. picoTCP was already portable to many platforms, now you can also use it within Linux.

The TCP/IP stack is removed from the kernel, but the socket interface and netdevices remain, so NET=y and INET=n. That saves 164KB (10% of the kernel size). picoTCP adds 43KB again. It also saves 216KB in runtime RAM usage. New module PICOTCP is added in the tree. The picoTCP stack is standalone so glue logic is needed: proc files, ioctls, register protocol family. Also netdevice has to be modified to call the picoTCP stack. Still have to implement the rtnetlink interface (currently only ioctl interface is supported), which is necessary for e.g. iproute2. Also IPv6 (which is supported by picoTCP) isn’t handled yet.

In this project, the stack is put in the kernel instead of running it in userspace. But if you put it in userspace, you still need a tun or tap device to get it out to other processes. In-kernel it becomes available to any application.

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