TS-4800 Initrd

From Technologic Systems Manuals

When the board first boots you should see output similar to this:

 >> TS-BOOTROM - built Jan 24 2011 12:40:54
 >> Copyright (c) 2010, Technologic Systems
 >> Booting from SD card...
 .
 .
 .
 Finished booting in 1.11 seconds
 Type 'tshelp' for help

This is a busybox shell which presents you with a very minimalistic system. This filesystem is loaded into memory, so none of the changes will be saved unless you type the command

save

or mount a filesystem as read/write. This can also provide a simple mechanism for running your application in an entirely read-only environment. The linuxrc script will be the first thing executed as soon as the kernel is loaded. This sets the default IP address, loads a reloadable FPGA bitstream if one is present, starts the userspace ctl applications, and more. Read the linuxrc for more information.

While busybox itself doesn't contain much functionality, it does mount the Debian partition under /mnt/root/. It will also add common paths and load libraries from the Debian system. Many of the Debian applications will work by default. For example, if you are using the TS-4800 with a video interface (or a touchpanel like the TS-TPC-8390), you will see icewm startup. The linuxrc will determine if the baseboard is one that is recognized with video, and start X11 with icewm from Debian. This is why it has the Debian logo since it uses their theme files, but is not usable as Debian. This is also only provided as a demo of X11 and not intended to be used for development. Whether or not a Debian application will work in fastboot needs to be judged per application. If an application relies on certain paths being in certain places, or running services, you should instead boot to Debian to run them.

If you want to install applications using apt or building them from source you should to Debian for a more complete environment. Most build processes are not designed to work with busybox providing the shell and utilities.

This shell when started on the COM port is what is blocking a Debian boot. If you close it by typing

exit

the boot process will continue. If you are connected through telnet, this will instead open up its own instance of the shell so typing

exit

will only end that session. Through any connection method you can relink the linuxrc to change it to boot by default to Debian.

The initrd has these boot scripts available:

Script Function
linuxrc-fastboot (default) Boots immediately to a shell in ramdisk. This will mount whichever boot medium you have selected to /mnt/root/. When you type 'exit', it will boot to that medium.
linuxrc-sdroot Boots immediately to the Debian stored on SD.
linuxrc-xnandroot Boots immediately to the Debian stored on the XNAND.
Note: Keep in mind the boot medium is selected by the pinout on your baseboard, not through software. The ramdisk and kernel will be loaded before the linuxrc begins execution.

For example, to set the linuxrc to boot immediately to Debian on SD or NAND, you would run this:

rm linuxrc; ln -s /linuxrc-sdroot /linuxrc; save

You can edit the linuxrc-4800 to create more booting methods (NFS, USB, etc).

The small default initrd is only 2Mbyte but there is space for approximately 300 Kbyte of additional user applications. The binaries on the initrd are dynamically linked against embedded Linux's "uclibc" library instead of the more common Linux C library "glibc". "uclibc" is a smaller version of the standard C library optimized for embedded systems and requires a different set of GCC compiler tools which are available here.

 The compiled instance of busybox includes several internal commands listed below:
 BusyBox v1.14.2 (2011-02-03 15:49:11 MST) multi-call binary
 Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
 and others. Licensed under GPLv2.
 See source distribution for full notice.
 
 Usage: busybox [function] [arguments]...
    or: function [arguments]...
 
         BusyBox is a multi-call binary that combines many common Unix
         utilities into a single executable.  Most people will create a
         link to busybox for each function they wish to use and BusyBox
         will act like whatever it was invoked as!
 
 Currently defined functions:
         [, [[, ar, ash, basename, cat, chat, chgrp, chmod, chown, chroot,
         cmp, cp, cpio, cttyhack, cut, date, dd, depmod, devmem, df, dirname,
         dmesg, du, echo, egrep, env, expr, false, fdisk, fgrep, find, grep,
         gunzip, gzip, halt, head, hostname, hush, ifconfig, insmod, kill,
         killall, ln, login, ls, lsmod, md5sum, mdev, mkdir, mknod, modprobe,
         more, mount, msh, mv, netstat, ping, pivot_root, poweroff, printf,
         ps, pwd, reboot, rm, rmdir, rmmod, route, rx, sed, setconsole,
         setsid, sh, sleep, stty, sync, tail, tar, telnetd, test, tftp,
         top, tr, true, udhcpc, umount, uname, unzip, usleep, uudecode,
         uuencode, vi, wget, xargs, yes, zcat

Also on the initrd are the TS specific applications: nandctl, ts4800ctl, and xuartctl. We also provide the ts.subr which provides the following functions:

 bit_set()
 bit_clr()
 bit_get()
 gpio_dir_get()
 gpio_dir_set()
 gpio_data_get()
 gpio_data_set()
 dio_dir_get()
 dio_dir_set()
 dio_data_get()
 dio_data_set()
 usb_on()
 usb_off()
 usb_init()
 usb_numports()
 usb_port_devexists()
 usbload()
 bbclk_on()
 bbclk_off()
 led0()
 led1()
 lcd_on()
 lcd_off()
 backlite_on()
 backlite_off()
 backlite_high()
 backlite_medium()
 backlite_low()
 fix_display()
 touchscreen_on()
 touchscreen_off()
 tpc_up()
 can0_on()
 can0_off()
 can1_on()
 can1_off()
 xuart0_on()
 xuart0_off()
 xuart3_on()
 xuart3_off()
 xuart4_on()
 xuart4_off()
 xuart5_on()
 xuart5_off()
 spi_on()
 spi_off()
 motor_on()
 motor_off()
 snd_on()
 snd_off()
 irq5_on()
 irq5_off()
 irq6_on()
 irq6_off()
 irq7_on()
 irq7_off()
 spk_on()
 spk_off()
 is_ts4800
 mxtime()
 save2sd()
 save2xnand()
 save()
 sd2xnand()
 xnand2sd()
 createxnandboot()
 createxnandroot()
 get_2nd_mac()
 tshelp()
 sdmount()
 help()

By default, linuxrc will not insert the necessary modules into the kernel to mount and use USB devices within the initrd/busybox environment if there is no USB device present upon bootup (USB support is enabled by default within the Debian environment). The quickest way to get a USB device (like a USB thumb drive) to mount in the initrd/busybox environment is to ensure that it is plugged in before the SBC is powered up. In order to get hot-swappable USB devices regardless of device presence at bootup time, you must "modprobe" the necessary modules. This has been done for you in the ts.subr file with the usbload() function.