Difference between revisions of "MAS OS setup"
(→Install MAS binaries) |
(→Boot menu) |
||
Line 111: | Line 111: | ||
== Boot menu == | == Boot menu == | ||
− | + | We need to add the kernel option that causes bigphys to allocate boot memory for our driver. In older versions of MAS (especially ACT's stable release) we also need to disable "acpi". It's a good idea to not run any DSP/MCE commands until all of your kernel options are in place. | |
+ | Having installed the kernel "image" package, the kernel should show up in the boot loader (grub)'s kernel list. | ||
+ | |||
+ | === Editing the kernel list === | ||
As root (or using sudo), edit the file /boot/grub/menu.lst . | As root (or using sudo), edit the file /boot/grub/menu.lst . | ||
sudo pico /boot/grub/menu.lst | sudo pico /boot/grub/menu.lst | ||
− | Go to the list of kernels, below the line "## ## End Default Options ##", and find the kernel block | + | Go to the list of kernels, below the line "## ## End Default Options ##", and find the new kernel entry. On Ubuntu 6.06, it should be the third block (index 2), and look like this: |
− | kernel /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash acpi=off | + | |
+ | title Ubuntu, kernel 2.6.15.7-bigphys | ||
+ | root (hd0,0) | ||
+ | kernel /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash | ||
+ | initrd /initrd.img-2.6.15.7-bigphys | ||
+ | savedefault | ||
+ | boot | ||
+ | |||
+ | Add the kernel options to the "kernel" line, producing either this (recent MAS): | ||
+ | kernel /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash bigphysarea=8192 | ||
+ | or this (old MAS, esp. ACT): | ||
+ | kernel /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash bigphysarea=8192 acpi=off | ||
− | + | Save and close the file, and reboot to test this kernel. If the kernel "works", you can edit menu.lst again and change the value of the "default" option to point to this kernel: | |
default 2 | default 2 | ||
− | + | '''Ubuntu 7.10 and later''': the kernel packages install a bit differently so the block will likely be the first one in the list. The 'kernel' line must change from something like | |
− | kernel /boot/vmlinuz-2.6.22.9-bigphys root=UUID=1b6e7b54-894d-4571-9f0a-527fe0103975 ro quiet splash | + | kernel /boot/vmlinuz-2.6.22.9-bigphys root=UUID=1b6e7b54-894d-4571-9f0a-527fe0103975 ro quiet splash |
− | + | to | |
+ | kernel /boot/vmlinuz-2.6.22.9-bigphys root=UUID=1b6e7b54-894d-4571-9f0a-527fe0103975 ro quiet splash bigphysarea=8192 | ||
+ | Note that the long hexadecimal serial numbers are system specifc and yours are probably different than these ones. Leave them as they are and just add the new kernel options. The "default" option will probably be | ||
default 0 | default 0 | ||
but it's a good idea to count these things out for yourself. | but it's a good idea to count these things out for yourself. |
Revision as of 15:43, 19 November 2008
Ubuntu 6.06 LTS server: This is the most supported OS. The instructions below are mostly for 6.06.
Ubuntu 7.10 server: We can support this now. Patched kernels are available. In the text below, major deviations from the 6.06 installation procedure are identified.
Ubuntu 8.04 LTS server: This version is new enough that the kernel build system isn't producing portable kernel packages. MAS works with 8.04 but I don't want to install too many 8.04 systems until they clean up the build system.
Contents
Install additional ubuntu packages
Disable CDROM seeking
The package manager knows that you have the Ubuntu disk and will say things like
Media change: please insert the disc labeled 'Ubuntu-Server 6.06.1 _Dapper Drake_ - Release i386 (20060807.1)'
To disable this (and download packages from the internet instead), open /etc/apt/sources.list
sudo pico /etc/apt/sources.list
and remove (comment) the line
deb cdrom:[Ubuntu-Server 6.06.1 _Dapper Drake_ - Release i386 (20060807.1)]/ dapper main restricted
Install required packages
sudo apt-get update sudo apt-get install build-essential subversion emacs21 libreadline5-dev
Enable universe repository and install GGV
Uncomment the line in /etc/apt/sources.list so it says
deb http://us.archive.ubuntu.com/ubuntu/ dapper universe
Then run
sudo apt-get update sudo apt-get install gnome-gv
gnome-gv doesn't exist on 7.10, you'll have to settle for
sudo apt-get install gv
Install packages that you shouldn't even want to install (soon to be optional)
sudo apt-get install tcsh
Install desktop manager (optional)
sudo apt-get install ubuntu-desktop gdm
Install python stuff
The 'pyth' branch MAS has experimental support for python using wx and matplotlib:
sudo apt-get install python-dev python-wxglade python-matplotlib python-numarray-ext swig
Install unpackaged libraries
MAS uses libconfig to manage its configuration files. The webpage is here: [ http://www.hyperrealm.com/libconfig/ ]. To install libconfig run the following:
wget http://www.hyperrealm.com/libconfig/libconfig-1.3.tar.gz tar -xzf libconfig-1.3.tar.gz cd libconfig-1.3 ./configure make sudo make install
To make the system aware of this library, add "/usr/local/lib" to /etc/ld.so.conf and run "sudo ldconfig". i.e.
echo /usr/local/lib | sudo tee -a /etc/ld.so.conf sudo ldconfig
On newer systems (Ubuntu 7.10) you can do this instead:
echo /usr/local/include | sudo tee /etc/ld.so.conf.d/libconfig.conf sudo ldconfig
Download and install MAS kernel patch
Download
If you're not compiling the kernel from scratch, download the binary packages from UBC:
wget http://e-mode.phas.ubc.ca/~mhasse/mce/kernel-headers-2.6.15.7-bigphys_10.00.Custom_i386.deb wget http://e-mode.phas.ubc.ca/~mhasse/mce/kernel-image-2.6.15.7-bigphys_10.00.Custom_i386.deb wget http://e-mode.phas.ubc.ca/~mhasse/mce/extras.patch
For Ubuntu 7.10, get these instead:
wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-headers-2.6.22.9-bigphys_10.00.Custom_i386.deb wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-image-2.6.22.9-bigphys_10.00.Custom_i386.deb
On Ubuntu 7.10 machines without PAE hardware (i.e. a maximum of 4G of system memory) use:
wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-headers-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb wget http://e-mode.phas.ubc.ca/~mhasse/mce/linux-image-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
Install
Then, install the packages using dpkg:
sudo dpkg -i kernel-headers-2.6.15.7-bigphys_10.00.Custom_i386.deb sudo dpkg -i kernel-image-2.6.15.7-bigphys_10.00.Custom_i386.deb
The "image" file might complain about symbolic links, no big deal.
On Ubuntu 7.10, instead install these:
sudo dpkg -i linux-headers-2.6.22.9-bigphys_10.00.Custom_i386.deb sudo dpkg -i linux-image-2.6.22.9-bigphys_10.00.Custom_i386.deb
Why are these ones called "linux" instead of "kernel"? I think it's because I got them from Ubuntu repositories instead of kernel.org.
On Ubuntu 7.10 machines without PAE install these:
sudo dpkg -i linux-headers-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb sudo dpkg -i linux-image-2.6.22.14-bigphys_2.6.22.14-bigphys-10.00.Custom_i386.deb
Patch
This makes it possible to compile against the kernel package as though it had been locally compiled originally.
cd /usr/src/kernel-headers-2.6.15.7-bigphys/ sudo patch -p1 < ~/extras.patch
This step is not necessary for Ubuntu 7.10. It may be necessary to link the kernel headers into /lib/modules:
sudo ln -s /usr/src/linux-headers-2.6.22.9-bigphys/ /lib/modules/2.6.22.9-bigphys/build
We need to add the kernel option that causes bigphys to allocate boot memory for our driver. In older versions of MAS (especially ACT's stable release) we also need to disable "acpi". It's a good idea to not run any DSP/MCE commands until all of your kernel options are in place.
Having installed the kernel "image" package, the kernel should show up in the boot loader (grub)'s kernel list.
Editing the kernel list
As root (or using sudo), edit the file /boot/grub/menu.lst .
sudo pico /boot/grub/menu.lst
Go to the list of kernels, below the line "## ## End Default Options ##", and find the new kernel entry. On Ubuntu 6.06, it should be the third block (index 2), and look like this:
title Ubuntu, kernel 2.6.15.7-bigphys root (hd0,0) kernel /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash initrd /initrd.img-2.6.15.7-bigphys savedefault boot
Add the kernel options to the "kernel" line, producing either this (recent MAS):
kernel /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash bigphysarea=8192
or this (old MAS, esp. ACT):
kernel /vmlinuz-2.6.15.7-bigphys root=/dev/sda3 ro quiet splash bigphysarea=8192 acpi=off
Save and close the file, and reboot to test this kernel. If the kernel "works", you can edit menu.lst again and change the value of the "default" option to point to this kernel:
default 2
Ubuntu 7.10 and later: the kernel packages install a bit differently so the block will likely be the first one in the list. The 'kernel' line must change from something like
kernel /boot/vmlinuz-2.6.22.9-bigphys root=UUID=1b6e7b54-894d-4571-9f0a-527fe0103975 ro quiet splash
to
kernel /boot/vmlinuz-2.6.22.9-bigphys root=UUID=1b6e7b54-894d-4571-9f0a-527fe0103975 ro quiet splash bigphysarea=8192
Note that the long hexadecimal serial numbers are system specifc and yours are probably different than these ones. Leave them as they are and just add the new kernel options. The "default" option will probably be
default 0
but it's a good idea to count these things out for yourself.
Configure the system for mce users
Permissions and umask
Set the umask for all users to give write access for their group by default.
Edit /etc/profile and change the "umask 022" line to
umask 002
Edit /etc/login.defs and find the line that start "# UMASK" and change it to
UMASK 002
Any users wishing to use MCE under their own accounts should be added to the "mce" group and should have "mce" as their primary group. Their umask must be set properly, or other users will not be free to manipulate shared files.
To setup additional system users, see the page on MAS user setup.
Folders
This is the sort of thing that should be done by an install script...
Data directory:
sudo mkdir /data sudo chown mce:mce /data sudo chmod g+ws /data mkdir /data/cryo/
Configuration directory:
sudo mkdir /etc/mce sudo chgrp mce /etc/mce sudo chmod g+ws /etc/mce
If necessary, branch MAS and mce_script
You can work with a complete checked-out tree, or not.
In the first case:
svn checkout svn://e-mode.phas.ubc.ca/mas svn copy mas/trunk mas/branch/{your_project_name} svn commit mas
Alternately, do the copy directly on the svn server (it is automatically committed):
svn copy svn://e-mode.phas.ubc.ca/mas/trunk svn://e-mode.phas.ubc.ca/mas/branch/{your_project_name}
For mce_script, replace "mas" with "mce_script".
Then check out the appropriate branch (or the whole tree) on the new machine.
Download (checkout) MAS and mce_script
See the page on MAS svn repository
Compile and install MAS
Build the driver
By default, the driver will build with bigphysarea support enabled. To override build options, create a file Makefile.local in the "driver" folder, and add lines like:
# BIGPHYS=0 disables bigphysarea frame-buffering BIGPHYS = 0
or
# FAKEMCE=1 provides simple emulation of a PCI card/MCE for testing FAKEMCE = 1
or
# REALTIME=1 makes use of realtime interrupt routines REALTIME = 1
In Makefiles, there should not be comments on the same line as the variable definitions. On a system running the bigphys kernel with the correct PCI card, Makefile.local will be created at compile time if it does not already exist. It can be left empty.
Anyway, once Makefile.local is setup, type
cd mas make clean; make
From the driver folder we can test the driver:
cd driver ./reload ./mknodes
Note that since "reload" first unloads the driver if it is present, and then loads the driver from the current folder, it may report an "ERROR" message if the first step fails, even though the driver is successfully loaded. The definitive way to check that the driver is loaded is
cat /proc/mce_dsp
If this file does not exist, the driver isn't loaded. If the cat prints out a bunch of low-level driver information, you're in good shape.
If you're satisfied that the driver works, install the driver with the command
sudo make install
This should put mce_dsp.ko into /lib/modules/2.6.15.7-bigphys/kernel/drivers/misc/, and re-scan the module dependencies. To get the driver to load on boot you must add manually the following lines to /etc/rc.local:
modprobe mce_dsp /home/mce/mas/driver/mknodes sudo -u mce /usr/mce/bin/maslog_server
Install MAS config files
Hardware and binary config files live in /etc/mce/ (created above).
Make sure you use the hardware config (mce_*.cfg) file appropriate for your system. Racks with 4 readout cards should use mce_v1.cfg; small sub-racks with readout card slots should use mce_v2.cfg.
cd ~/mas/config cp mce_v1.cfg /etc/mce/mce.cfg cp mas.cfg /etc/mce/mas.cfg
Install mce_script
The mce_script files are designed so that users can fairly easily run a different set of scripts. We will install a system default set in /usr/mce/mce_script
cd /usr/mce svn checkout svn://e-mode.phas.ubc.ca/mce_script/branch/{your_experiment} mce_script
Current experiments include ACT and SPIDER.
mas_env.bash
To set up the environment and path to use these scripts and idl codes, a user should do "source mas_env.bash". (This file used to live in mas/config, but has been moved into mce_script/template.) Non-developer users can source /usr/mce/mce_script/template/mas_env.bash directly; advanced users may want to keep their own copy (or several different copies) in their home folder.
Note that MAS/mce_script scripts should *not* source mas_env.bash! The whole point of it is that paths should be flexible.
.bashrc
To have bash start up with the MAS variables defined, and the paths ready, add the following lines to .bashrc :
export MAS_ROOT=/usr/mce/mce_script/ source $MAS_ROOT/template/mas_env.bash export IDL_PATH="<IDL_DEFAULT>:$MAS_IDL/mas"
While you're in there, you may want to define a few aliases. In particular, I always uncomment the alias ll='ls-l' line.