summaryrefslogtreecommitdiff
path: root/FlightComputerDrive.mdwn
blob: 296a6969a2eb94eff04e81cba434527425be5e84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# <a name="Flight Computer _CompactFlash &quot;d"></a> Flight Computer CompactFlash "disk" Notes

We're using SanDisk CompactFlash cards as the hard disk for the Flight Computer (FC) and the Launch Tower Computer (LTC). They're just like IDE drives... but apparently more finicky.

## <a name="Debian &quot;Testing&quot; Installation No"></a> Debian "Testing" Installation Notes

- See the [[FlightComputerSoftware2002]] for notes on how to build a fresh Debian system on the CF card.

## <a name="Hooking up and running CF cards"></a><a name="Hooking up and running CF cards "></a> Hooking up and running CF cards on a PC

A few notes:

- As far as we can tell, the CF cards act **exactly** like IDE drives and thus require no specific drivers.
- HOWEVER, their timing requirements may be more stringent than regular IDE disks. When running CF cards on a 1.2GHz PIII, low level programs like dd didn't work very well: we got "hdc: lost interrupt" and freezes when running low level programs like dd. See below for more info. Thus, YOU MIGHT NEED A SLOW COMPUTER. Like a 486, or in our case, a 75MHz Pentium. The reason is that we used a 1.2GHz PIII and the timing was all screwed up - we got "HDC: Lost Interrupt" all the time. Switching to the 75MHz Pentium solved the problem. We hypothesize it's a IDE timing issue, which we think may be related to PCI bus speed.
- On both the FC and LTC, after an initial bootup, the console redirects to the serial port (ttyS0) at 9600bps, 8N1. It may take 10 seconds for the thing to boot up and start spitting out messages, so don't panic if it takes that long. NOTE FOR THE WISE: if you boot a PC with the CF card 'just to test it', then don't forget it will appear to freeze after the boot message since the console is, as we mentioned earlier, being redirected to the serial port. DON'T just shutdown - connect another computer to the serial port, login to the computer, and 'halt' it.

Use the TAPR board with the 0.1" pin header on it, and plug it in with a ribbon cable just like an IDE drive. Note that you'll need the power connector from your floppy drive to power up the board. We always made the board 'hdc' by putting the PC's CD and main disk on the primary IDE interface, and the CF card alone on the secondary interface.

When you boot, make sure Linux recognizes the drive - look at the boot log to verify it ('dmesg | less'). Note that your BIOS doesn't necessarily need to recognize it in order for linux to understand it. In our case, we never had an issue recognizing except for the one time we forgot to power it up. Whoops.

## <a name="Partitioning and Formatting CF C"></a> Partitioning and Formatting CF Cards

Ok, so you have a CF card and you want to make it into a disk. Hook it up as above, and boot to linux. Note that 'x' below means the drive letter, e.g. hdx1 = hdc1 for us.

- Partion the card: run `fdisk /dev/hdx` and add one partition, make it active (bootable), and make it a type '83' ("Linux").
- Format the card as ext2: run `mke2fs /dev/hdx1`

## <a name="Copying over files"></a> Copying over files

First, get files from the existing card or from the CVS image/tar file. To copy from a CF card:

- Mount the drive: `mount -t ext2 /dev/hdx1 /mnt`
- To copy from a CF card to your hard disk, just use `cp -a /mnt/* /mnt/.* /destination` Note the '.\*' is necessary to pick up all hidden files ('.xxx' files) in that root directory.
- If you want to get a zipped TAR file, then do `tar -czf filename.tar.gz /mnt`

_Note:_ `cp` _doesn't copy device files correctly. It may be more appropriate to use:_

- `cd /mnt; tar cf - . | (cd /destination; tar xfp -)`

_--Main.JamesPerkins_

To copy to a CF card:

- Mount it.
- use `cp -a /destination/* /destination/.* /mnt/`
- untaring it: `tar -xzf filename.tar.gz /mnt`

## <a name="Making the CF card bootable"></a> Making the CF card bootable

You'll need a lilo which has a version =&gt; 22.1 (we used 22.5.4) otherwise you'll get a "failure: Map segment too big" error. And note there are some subtleties to this process, since you're marking the CF card, currently /dev/hdx1, to be bootable as /dev/hda1 during a boot up.

Here is the lilo configuration file we used assuming that the CF card is `/dev/hdc1` mounted at `/mnt/disk`:

    lba32
    disk=/dev/hdc
        bios=0x80
    boot=/dev/hdc
    root=/dev/hda1
    # compact
    install=/mnt/disk/boot/boot.b
    map=/mnt/disk/boot/map
    # 3-second delay
    delay=30
    vga=normal
    default=linux

    image=/mnt/disk/vmlinuz
            label=linux
            read-only
            append="console=ttyS0"
    #       restricted

    image=/mnt/disk/vmlinuz.old
            label=old
            read-only
            append="console=ttyS0"
    #       optional
    #       restricted

and then run `lilo -v -s /dev/null -C lilo.conf` to make the CF card bootable.

Note that there's a better way to do this - go Tim go.