Title: Setting up the TS7300 Boards Author: Craig Duffy 5/10/08, 22/11/10 Module: System on Chip Awards: CSE3, BENG, Robotics 3, MENG
Total Page:16
File Type:pdf, Size:1020Kb
Title: Setting up the TS7300 boards Author: Craig Duffy 5/10/08, 22/11/10 Module: System on Chip Awards: CSE3, BENG, Robotics 3, MENG. Prerequisites: TSboard, SD cards The purpose of this worksheet it to show how the TS7300 board boots up and how to install Linux on it. We will also look at how to configure the Linux installation on the boards. The TS7300 startup The TS7300 has a rather different startup routine from many embedded boards. Like on most boards the CPU, the ARM9, looks for a device to boot from. Rather than using on board FLASH chips the system boots to a small EEPROM on the board. This contains a very small boot strap program, < 2K bytes, this boot strap has a few functions, some to do a basic board initialisation, some to handle the screen and serial ports and a routine to load the boot sector of the first SD card. If there are problems with the SD card the watchdog timer on the board is set up on system initialisation and will force a reboot. If the EEPROM is corrupted then the board is pretty much dead! The EEPROM code should give the message, >> TS-SDBOOT - built Jul 6 2006 >> Copyright (c) 2006, Technologic Systems . The dots (.) represent disk read activity, if there is no disk the system will keep restarting itself every 8 seconds. If there is a SD card in the first slot, the one nearest the ARM CPU, and it has had a boot sector correctly installed, then the system may be able to boot into Linux. The boot sector is a very small program, written in ARM Thumb 16 bit instructions, that will load into memory the first 2 partitions of the SD card. These 2 partitions contain the Linux kernel in partition 1 and an initial RAM disk (initrd) in partition 2. The kernel is loaded in address 0x218000 in RAM and the initrd is loaded at address 0x1000000. The final thing the boot sector program does is to jump to the start of the kernel to execute it. You should then see the initial kernel message, Booting Linux... It is possible that it might go into fastboot mode, in which case you will see the message, Finished booting in 1.66 seconds Type 'exit' for full boot - remove JP6 to make this the default $ exit 1 If you type in exit at this point then the system should boot up into Linux, and see something like this, >> Booting Linux... INIT: version 2.86 booting Creating extra device nodes...done. Started device management daemon v1.3.25 for /dev symbol: "fixscsigenericperms" not found in /lib/devfsd/scsigenericperms.so umount: /initrd: device is busy Checking root file system... fsck 1.37 (21-Mar-2005) e2fsck 1.37 (21-Mar-2005) /dev/sdcard0/disc0/part3: clean, 15437/60000 files, 244038/244224 blocks Cleaning up ifupdown...done. Loading modules: usbcore zd pcipool usb-ohci usb-ohci-ep93xx af_packet Checking all file systems... fsck 1.37 (21-Mar-2005) e2fsck 1.37 (21-Mar-2005) /dev/sdcard0/disc0/part4: clean, 11/93888 files, 2959/187712 blocks ... done. /dev/sdcard0/disc0/part4 on /mnt/part4 type ext2 (rw,noatime) Setting up networking...done. Starting hotplug subsystem: usb isapnp ide scsi. Starting portmap daemon: portmap. Starting portmapper...Mounting remote filesystems... mount: RPC: Remote system error - Network is unreachable Recovering nvi editor sessions... done. INIT: Entering runlevel: 2 Starting internet superserver: inetd. Starting OpenBSD Secure Shell server: sshdCould not load host key: /etc/ssh/sshy Could not load host key: /etc/ssh/ssh_host_dsa_key Disabling protocol version 2. Could not load host key sshd: no hostkeys available -- exiting. Starting NFS common utilities: statd. Starting periodic command scheduler: cron. Debian GNU/Linux 3.1 ts7000 ttyAM0 ts7000 login: If the system requests a password then try logging in with user id root without a password. 2 Go through the output above and try to figure out what the systems is doing – note that there are error messages! Your system may well differ from the above output. Talking to the TS7300 In order to talk to the board the easiest form of connection is through the serial port. You will need a null modem serial cable – there are lots hanging up in the labs. Connect to serial port 1 on the ts7300 – next to the USB port and onto serial port 1 on the desktop PC. The program to manage the connection is called minicom, it is available on most Linux distros, it is installed on the Netlabs Linux. To connect you can type in %minicom -o pup1 The -o stops minicom sending any modem control signals down the wire, the pup1 is a configuration script for the puppeteer boards. These board have the same settings as the ts7300, so we can use their config files. The setting are (if you want to do it manually – no hardware or software flow control, 115200 baud. If you have connected to the 2nd serial port you need to use the pup2 config file. %minicom -o pup2 Connect to the board and boot it up – you should see some of the output mentioned above. To get a minicom menu type ^A (control A). You can follow that by another command - ^AZ shows you a menu of commands, ^AQ quits from minicom. Installing Linux on an SD card It is quite likely that you will need to install Linux onto an SD card or upgrade your version. If you have a laptop, running Linux, with an SD card reader then it is possible to do the installation without using the TS board. Before powering up the board, put the Linux bootable SD card into slot 1 and the new card into slot 2. Power up and boot the system. You should find that the system on boot has found the cards. You can either look in the systems diagnostic messages, using dmesg | more, or by looking in the file /proc/devices. In the dmesg output you should find that it reports the partitions that the disk has, sdcard0: Technologic Systems SD card controller, address 0x13000000 sdcard0: card size 1999872 sectors Partition check: sdcard0a: p1 p2 p3 ..... ...... 3 sdcard1: Technologic Systems SD card controller, address 0x72000020 sdcard1: card size 1999872 sectors sdcard1a: p1 p2 p3 p4 This shows that SD card 0 has 3 sectors and card 1 has 4. It is likely that with a new card that it will have 1 large sector. In order to change this we will need to edit the disk's partition table using the fdisk command. The fdisk command, the commands name is lost in the history of MSDOS, is a fairly bruttal program that is used for editing disks' partition tables. The commands only argument is the name of the disk partition, so to look at SD card 0's partition table printing out the disk sizes in sectors rather than cylinders (much more useful), then type fdisk -lu /dev/discs/disk0/disc This will output root@ts7000:root# fdisk -ul /dev/discs/disc0/disc Disk /dev/discs/disc0/disc: 1023 MB, 1023934464 bytes 4 heads, 16 sectors/track, 31248 cylinders, total 1999872 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System /dev/discs/disc0/part1 16 9855 4920 da Non-FS data /dev/discs/disc0/part2 9856 17727 3936 da Non-FS data /dev/discs/disc0/part3 17728 1999871 991072 83 Linux Copying the Boot sector In order to make an SD card bootable the first sector of the disk must contain some boot loader code as well as the partition. As the boot sector is not part of the mountable file system it is also not available to commands that manipulate those file systems. For example, you can't use a command like cp (copy) to copy the boot sector onto the disc as the boot sector is 'outside' of the file system. Fortunately Linux comes with command that can deal with such situations and the 'raw' disk is made available to developers. The command that is most commonly used is dd. This command reads data from an input stream and copies, with possible transformations, to an output stream. It doesn't sound too exciting but the important point is that it makes no assumptions about the format of the data and isn't restricted where it writes it. In order to copy the boot sector from one SD disk to the other we need to know where they are and how big they are. Finding the boot sectors is fairly easy, they are at the beginning of the raw drives. So for SD card01 the raw disc is /dev/discs/disc0/disc, for 1 is /dev/discs/disc1/disc. 4 Although the boot sector is only 512 bytes, we can copy across the whole sector 1k (1024 bytes). The command to do this is dd if=/dev/discs/disc0/disc of=/dev/discs/disc1/disc bs=1k count=1 Read the manual entry for dd – man dd. Be careful to distinguish between the command name dd and the arguments -l, bs=..,etc, You can use the tab character to automatically complete path names, which may help. So we can see that the input and output files are correct, the block size (bs) to be copied is 1 k and the number of blocks is 1. WARNING – if you get the source and destination mixed up then you could end up with an unbootable disc! You should receive the following (or similar) message on completion, 1+0 records in 1+0 records out 1024 bytes (1.0 kB) copied, 0.0238498 s, 42.9 kB/s As well as copying the boot loader code it will have also have copied across the partition table for the disc.