Apex I: Flight Computer Kernel Development Log


This is a log of the work I did on modifying the TS-7260's kernel for use in the balloon payload. This took around two weeks of on and off work.

After installing the Debian packages for libax25, ax25-tools and ax25-apps, and attempting to use the “/sbin/kissattach” utility to set up an AX.25 port on the flight computer to talk to the TNC, I got “Error setting line discipline. Are you sure MKISS support is enabled in your kernel?” Predictably, it wasn’t. As such, a kernel recompile was in order. Helpfully, TS provide the source tarball for the 2.4.26-ts11 kernel – the default on the TS-7260 board. However, whilst compiling a kernel on the TS-7260 is possible, it is entirely impractical, as the board does not even have enough disk space to unpack the source.

I had an old Ubuntu 7.04 disc lying around which I booted using an old Pentium 3 desktop machine. I unpacked the source and located the default kernel configuration file for a TS-7260 board. This config had to be modified to enable AX.25 Amateur Radio Protocol Version 2 support as well as the Serial KISS driver. “make config” is the old way to do this, but answering 1300 yes/no prompts did not appeal to me. “make menuconfig” uses a text based menu system, and “make xconfig” attempts to build a configuration window using X. The X option was unusable as it just plainly refused to work, so “make menuconfig” was my only other option. However, this didn’t load either and gave me an error stating the libncurses5 dependency was not satisfied. After messing around with Synaptic Package Manager, I found this was already installed, and was at a loss for a while. A bit of Googling later, I found that I needed “libncurses5-dev” as well. After installing the version matching my libncurses5 version, “make menuconfig” worked.

After modifying the configuration, I attempted to “make vmlinux” which compiled an initial kernel. I also ran “make modules” with its appropriate options, although I initially attempted to use the modules from the default kernel. All of the amateur radio support was compiled into the kernel rather than into modules. I then had to get the flight computer to boot Debian using this new kernel. The bootloader.o kernel module provided by TS uses a device driver at /dev/misc/bootloader to accommodate the hooks needed by the "bootload" program to allow Linux to act as a bootloader for other Linux kernels. I then used the “bootload” command to reboot the Linux system using the new kernel with the command “bootload vmlinux”, along with some extra command line options for the kernel. For some reason, however, the BOOTROM failed saying that the device node “/dev/sdcard0/disc0/part3” did not exist. I cannot understand why, as Debian booted from there perfectly with the default kernel, so the BOOTROM code could definitely access it.

After some more messing around, I decided to give up on “bootload” and to copy (dd) the new kernel to part1 of the SD card. In theory, this is where the kernel sits for a normal boot. The first problem was that Ubuntu 7.04 did not recognise my SD card reader. After a couple of hours, the system was updated and running Ubuntu 8.10, which gave me the first SD card partition at device node “/dev/sdc1”. However, when I got round to testing the SD card with the new kernel on part1, it failed. The kernel loaded, but when trying to follow that up with a full Debian boot, the system just hung. This had me stumped for a long time, until a few days later I was moving files around and happened to open the “linuxrc” file. This is the file that sets up startup options and setting for the bootloader. RC.D is then used for startup options in the operating system itself. This file seemed to show that before loading a kernel, the script checks for the file /boot/vmlinux.bin on part3. If that exists, the system boots that kernel instead of any other. I then did a new kernel compile and put vmlinux.bin in /boot. And it booted!

It did, however, fail to load any modules, and so the system wasn’t really very useful: things like Ethernet, Serial and USB are all modular. I went back to the Ubuntu machine and ran “make modules MOD_INSTALL_PATH=/lib/modules”. This compiled all the modules ready for use. In theory, the command “make modules_install” picks up all these compiled modules and puts them in /lib/modules, along with modules.dep and modules.conf. However, I got the error “version error, /sbin/depmod.old could not be found”. This was because, I found, Ubuntu was running the 2.6 kernel which uses a different set of kernel compile tools to the 2.4 kernel required for the flight computer. I attempted to find an old version of modutils for 2.4 (which includes depmod), but trying to run this on the 2.6 Ubuntu kernel failed. Instead, I found a Perl script called depmod.pl, which is a cross platform module install script, including generation of modules.dep and modules.conf. Happily, this worked. I moved the modules from /lib/modules/kernel-2.4.26-ts11-hkr2/ to the relevant place on the SD card (/dev/sdcard0/disc0/part3/lib/modules/kernel-2.4.26-ts11-hkr2/).

I then put the SD card back into the flight computer and switched on the power. At last, the system booted into Debian with no warnings (or at least, none which mattered). Running the command “uname –r” showed the kernel version as 2.4.26-ts11-hkr2. I appended the “hkr2” bit to differentiate between my own kernel versions. After “hhk1”, “hhk2”, “hkr1” and “hkx1”, the kernel that eventually completed a boot successfully was “hkr2”.