Installing CRUX 2.7.1 on a VMIVME-7648 Single Board Computer ============================================================ Create a Bootable CD -------------------- First, download the CRUX 2.7.1 iso from https://crux.nu/Main/Download. To create a bootable CD use OSX and burn the image using the following command: $ hdiutil burn crux-2.7.1.iso Installing CRUX --------------- Now, hook up a CD ROM drive to the SBC and reboot it. Make sure to press F2 to get to the BIOS set up and set the correct date and time, and set the boot order to boot from the USB drive first. I could only get the computer to recognize a keyboard plugged in via USB and not with a PS/2 keyboard, although later during the installation it would only recognize a PS/2 keyboard and not the USB one, so I recommend having both plugged in while installing CRUX. The computer should boot to a CRUX screen with just the word "boot:". Press ENTER and login as root. First we need to partition the hard drive. $ fdisk /dev/sda Delete all existing partitions and then create three partitions for /, swap, and /home. If you are using an 8 GB flash card for storage, I would suggest the following sizes for each partition: - 5 GB for / - 1 GB for swap - the rest for /home After writing the changes: $ mkfs.xfs -f /dev/sda1 $ mkswap /dev/sda2 $ mkfs.xfs -f /dev/sda3 $ mount /dev/sda1 /mnt $ swapon /dev/sda2 $ mkdir /mnt/home $ mount /dev/sda3 /mnt/home $ setup After running setup the CRUX installation should start. Just press ENTER to accept all the default options. Then, $ setup-chroot Now, edit /etc/fstab to look like the following: /dev/sda1 / xfs defaults 0 0 /dev/sda2 swap swap defaults 0 0 /dev/sda3 /home xfs defaults 0 0 Modify /etc/rc.conf: TIMEZONE=EST HOST=sbc SERVICES=(net crond sshd) Modify /etc/rc.d/net and add the ip address of the computer and the gateway. Add DNS servers to /etc/resolv.conf. Add the following to /etc/hosts.allow: sshd sshd1 sshd2 : ALL : ALLOW Now, it's time to compile the kernel. $ cd /usr/src/linux-2.6.39.4 $ make menuconfig Now, we need to enable a few drivers to be built in rather than as modules. Navigate to Device Drivers and then press y on the line labeled Serial ATA and Parallel ATA. Then navigate into that submenu and press y on the line labeled "Intel ESB, ICH, ...". Go back to the main menu and select Processor Type and change it to "Pentium III". Exit and save the changes. Finally edit .config to enable a few more drivers to be built in. $ vim .config and make sure that the following three options look like this: SATA_AHCI=y BLK_DEV_SD=y XFS_FS=y Now, time to compile the kernel: $ make all And go grab a cup of coffee at Tim Hortons. After it finishes: $ make modules_install $ cp arch/i386/boot/bzImage /boot/vmlinuz $ cp System.map /boot/ Finally, edit /etc/lilo.conf to look like: boot=/dev/sda image=/boot/vmlinuz label=CRUX root=/dev/sda1 read-only append="quiet" Run lilo: $ lilo And reboot, remembering to change the boot order back to the HD at the BIOS! Installing the VME Drivers -------------------------- First, we have to install git. Log in as root, download and install git: # curl -O -L https://github.com/git/git/archive/v2.7.0.tar.gz # tar -xzvf v2.7.0.tar.gz # cd git-2.7.0 # make configure # ./configure --prefix=/usr # make all # make install Now, download the VME drivers and install: # git clone https://github.com/mgmarino/VMELinux # cd VMELinux/driver # make # make install If after make install you get a warning about "Device Busy" or something, then you need to edit /etc/rc.d/universe and change the size_to_reserve and reserve_from_address lines. To find out what size and where to reserve from, open up /proc/iomem and look for a large gap in the allocations: $ less /proc/iomem I found a gap in the PCI Bus 0000:00 line. For example: 00000000-0000ffff : reserved 00010000-0009f3ff : System RAM 0009f400-0009ffff : reserved 000a0000-000bffff : PCI Bus 0000:00 000a0000-000bffff : Video RAM area 000c0000-000c7fff : Video ROM 000d0000-000d3fff : PCI Bus 0000:00 000d4000-000d7fff : PCI Bus 0000:00 000d8000-000dbfff : PCI Bus 0000:00 000dc000-000dffff : PCI Bus 0000:00 000e0000-000fffff : reserved 000f0000-000fffff : System ROM 00100000-7f66ffff : System RAM 01000000-012147f0 : Kernel code 012147f1-012ee97f : Kernel data 01334000-01352fff : Kernel bss 7f670000-7f6fffff : ACPI Non-volatile Storage 7f700000-7fffffff : reserved 80000000-febfffff : PCI Bus 0000:00 80000000-801fffff : PCI Bus 0000:05 80200000-803fffff : PCI Bus 0000:04 80400000-805fffff : PCI Bus 0000:02 80600000-807fffff : PCI Bus 0000:01 80800000-809fffff : PCI Bus 0000:01 80a00000-80a00fff : Intel Flush Page d0000000-dfffffff : 0000:00:02.0 In this case, there is a gap at 0x90000000 so I added the following lines to /etc/rc.d/universe: size_to_reserve="size_to_reserve=0x10000000" reserve_from_address="reserve_from_address=0x90000000" Then you should be able to start the universe driver: $ /etc/rc.d/universe start Finally add universe to /etc/rc.conf: SERVICES=(net crond sshd universe) Now, we can install the VME universe API: # cd VMELinux/universe_api # make # make install By default, it installs the header files into /usr/local/universe/include and the library in /usr/local/universe/lib. Test Program ------------ To test if the VME drivers are working properly, here is a short example program to communicate over VME: ```C #include #include #include #define BASE_ADDRESS 0x550000 #define ADDRESS_MODIFIER 0x9 // A32 bit addressing #define DATA_WIDTH 4 // 32 bit data #define REGISTER 0x1900 int main(int argc, char **argv) { TUVMEDevice *dev; uint32_t value; int nbytes; set_hw_byte_swap(1); dev = get_new_device(ADDRESS, ADDRESS_MODIFIER, DATA_WIDTH, 0x10000); if (dev == NULL) { fprintf(stderr, "dev = NULL\n"); return 1; } if ((nbytes = read_device(dev, (char *) &value, DATA_WIDTH, REGISTER)) != DATA_WIDTH) { fprintf(stderr, "read_device returned %i bytes\n", nbytes); return 1; } printf("value = 0x%4.4x\n", value); return 0; } ```