Setting up Linux on TCU

There are (at least) two ways to go about for setting up Linux on the TCU. Either an existing kernel is copied to a new SD-card or a kernel is compiled from scratch.

Kernel compilation

The most pure way to set up the TCU is to compile a Linux kernel from scratch, baking in CAN drivers in it. Although there are a number of steps to pass, each requiring some time and focus, this endeavour has all prospects of being a fun and instructive experience, at least once. If you are in the mood for some kernel compilation, there are excellent step-by-step instructions out there, just cross your fingers and follow them.

Image copying

Another method, which is very handy once you already have a CAN-enabled Linux image is to simply copy an existing kernel block by block to the new SD-card. On a Linux desktop, this is easily done using the “dd” command. A note of warning is in place though. The dd-command is very useful but also very brute, so it is very important to set its input/output-directories correctly to avoid overwriting data in wrong places.

To simplify things, we provide our version of the kernel image (as it is), suitable for file-to-SD-card copying.

Instructions for Linux desktops

Here, we go through two closely related alternatives, copying the contents of an existing SD-card to a new one, and creating an image directly from a zip-file.

Coping from card to card

To start with, check what partition names are assigned to the SD-cards:

sudo fdisk -l

and notice the difference between the print-outs when SD-cards are inserted and when they are not. Suppose that a working Linux SD-card has been mounted on /dev/sdd, while the new card is mounted on /dev/mmcblk0. Unmount all SD-partitions and use the ”dd”-command to copy data. Be very careful about setting input (if) and output (of) correctly.

sudo -i
umount /dev/sd1
umount /dev/sd2
umount /dev/mmcblk0p1

dd if=/dev/sdd of=/dev/mmcblk0 

Now give it 30-60 min, depending on your system, and you should have a new CAN-enabled Linux SD-card.

Copying from a file

If using an intermediary storage file instead of directly copying between two SD-cards, just run the following command (assuming that the new SD-card is located at /dev/mmcblk0):

umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
gzip -dc linux-image.gz | dd of=/dev/mmcblk0

As always, have some patience (30-60 min) and it should just work.

If you wish to backup up an SD-card to an image, run dd in the opposite direction:

umount /dev/mmcblk0p1
umount /dev/mmcblk0p2
dd if=/dev/mmcblk0 | gzip > linux-image.gz

 Instructions for Windows desktops

The procedure on Windows systems is quite similar to how it is done in Linux, with the exception that you need to find some disk copying software. Good instructions (and a link to Windows dd-software) can be found here. Just replace the Debian image with our CAN-enable kernel and follow those instructions.