User Tools

Site Tools


code:work:pi:xenomai:start

LVIS-F Live ISO

LVISF Resurrection of LVIS-GH!

Building the LVIS data system from CD / ISO. We are going to create our own “LIVE” ISO that will boot and operate the data system from a read only media. Power can be removed without harming the operating system install. We need to move this ISO to the USB or some other device once this is operational.

Required Items

  • external CD ROM drive attached to USB3 on computer directly
  • fresh blank SSD drive (using CFAST 64 GB drive for OS)
  • 10.04 LTS Server Ubuntu install CD
  • CP932 Kontron ethernet card with ethernet cable plugged into Ethernet 4 (Gig. Ethernet)

Core Install Setup

  1. Configure the embedded computer for system build
    1. Attach the following devices:
      • USB keyboard to either of the front USB2 ports of the SBC
      • USB mouse or trackball to either of the front USB2 ports of the SBC
      • External CDROM attached to the front USB3 port of the SBC
  2. Boot the SBC (it came up on the CDROM with no intervention from me)

Ubuntu Core Install

The SBC will now begin the install process, and you can use the console/screen to finish the installation

  1. Choose a language: English
  2. Choose a country: United States
  3. Detect keyboard layout: No
  4. Origin of keyboard: USA
  5. Keyboard layout: USA
  6. CDROM will scan
  7. DHCP works with gs694-lvisdev.gsfc.nasa.gov as the host for the lab
  8. Hostname: lvisf
  9. Is your timezone correct? No, set to UTC (bottom of the list)
  10. Domain name: (press enter)
  11. Setting up the clock: will not work, as NTP is disabled (need to use local timehost.gsfc.nasa.gov) so CANCEL
  12. Select your time zone: Select from a worldwide list, page to the bottom, select UTC
  13. Partitioning method: Guided, Full Disk
    Use the entire disk
  14. Write changes to the disks? YES
  15. RAID beeped at me two sets of three beeps
  16. Full name for new user: lvis
  17. Username for your account: lvis
  18. Choose a password for the new user:
  19. Encrypt your home directory: No
  20. HTTP proxy information: <ENTER> (non needed)
  21. How do you want to manage upgrades on this system? No automatic updates
  22. Choose software to install:
    1. OpenSSH server
    2. Samba file server
  23. Install the GRUB boot loader to the master boot record? Yes
  24. Installation is complete: Continue
  25. System will reboot and return to normal ubuntu server

Clean Up and Update

  • Add the following lines to /etc/apt/sources.list
    • Edit the file
      sudo nano sources.list
    • Add these lines to enable the old repository (no longer updated!)
      ## EOL upgrade sources.list
      # Required
      deb http://old-releases.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
      deb http://old-releases.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
      deb http://old-releases.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
  • Update the system
    sudo apt-get update
    sudo apt-get upgrade
    sudo reboot ; exit
  • Modify /etc/default/grub so we have serial messages to the console
    sudo nano /etc/default/grub
    • Not going to mess with this right now (it is down below)

Grab Ethernet Driver

  1. Get wget
    sudo apt-get install wget -y
  2. Grab the ethernet driver while you still have access
    1. Current driver is here: https://downloadmirror.intel.com/13663/eng/igb-5.3.5.3.tar.gz
      mkdir ~/download
      cd ~/download
      wget https://downloadmirror.intel.com/13663/eng/igb-5.3.5.3.tar.gz

Configure

LINK: https://wiki.ubuntu.com/KernelTeam/GitKernelBuild ← Good building from GIT help!

NOTE: This should be in the lvis2 cfg and put in the repository and added to the “INSTALL” script assuming it works properly

  1. Installed required packages
    sudo apt-get install build-essential \
                         git-core \
                         jed \
                         kernel-package \
                         libncurses5-dev \
                         md5deep \
                         screen \
                         subversion
  2. Make work environment
    mkdir /home/lvis/src
    mkdir /home/lvis/work
  3. Check out lvisgh source:
    cd ~/work
    svn co svn+ssh://lvis@gs694-lvisdev.gsfc.nasa.gov/srv/svn/lvis2
    svn co svn+ssh://lvis@gs694-lvisdev.gsfc.nasa.gov/srv/svn/sigma
    1. Older Sources (for historical archive)
      cd ~/work
      # old repository
      # svn co svn+ssh://lvis@dev01.sigmaspace.com/srv/svn/lvis2
      # svn co svn+ssh://lvis@dev01.sigmaspace.com/srv/svn/lvis2tarballs
      # svn co svn+ssh://lvis@dev01.sigmaspace.com/srv/svn/sigma
      
      # repository restored from June 2013 code
      svn co svn+ssh://david.rabine@gs694-lvisdev.gsfc.nasa.gov/srv/svn/lvis2
      svn co svn+ssh://david.rabine@gs694-lvisdev.gsfc.nasa.gov/srv/svn/sigma
      
      # currently
      # COPY from the laptop's directory
      # rsync -vaP /home/lvis/src/lvis2/ lvis@10.4.1.122:/home/lvis/work/lvis2/
      # rsync -vaP /home/lvis/src/sigma/ lvis@10.4.1.122:/home/lvis/work/sigma/
      
      # 2016.08.19 lvisf rebuild effort
      rsync -vaP lvis@10.4.1.154:/home/lvis/src/lvis2/ /home/lvis/work/lvis2/
      rsync -vaP lvis@10.4.1.154:/home/lvis/src/sigma/ /home/lvis/work/sigma/
      # symlink into our src directory
      ln -s /home/lvis/work/lvis2 /home/lvis/src/
      ln -s /home/lvis/work/sigma /home/lvis/src/
  4. Check out lvisf source:
    cd /home/lvis/src
    svn co https://svn.yancich.com:8443/svn/NASA/LVIS/trunk lvisf_repo
    ln -s lvisf_repo/* .

Moved this operation into the user home directory, no need to run this all as root.

For the live version, we need aufs and that required me to obtain the kernel source from a git repository and then add aufs into it.

  1. Grab the xenomai we want to use
    mkdir ~/download
    cd ~/download
    wget https://xenomai.org/downloads/xenomai/stable/xenomai-2.6.5.tar.bz2
  2. Unpack xenomai and see what kernel we can use
    cd ~/src
    tar jxvf ~/download/xenomai-2.6.5.tar.bz2
    ls -l xenomai-2.6.5/ksrc/arch/x86/patches/
    # -rw-r--r-- 1 lvis lvis 420990 2016-07-09 06:49 ipipe-core-3.10.32-x86-9.patch
    # -rw-r--r-- 1 lvis lvis 440553 2016-07-09 06:49 ipipe-core-3.14.44-x86-12.patch
    # -rw-r--r-- 1 lvis lvis 439614 2016-07-09 06:49 ipipe-core-3.18.20-x86-7.patch
  3. Grab the latest kernel off this list
    cd ~/download
    wget https://www.kernel.org/pub/linux/kernel/v3.0/linux-3.18.20.tar.gz
  4. Uncompress kernel source and rename it
    cd ~/src
    tar zxf ~/download/linux-3.18.20.tar.gz
    mv linux-3.18.20 linux-3.18.20-ipipe
  5. Patch the kernel
    cd ~/src/xenomai-2.6.5
    ./scripts/prepare-kernel.sh --linux=~/src/linux-3.18.20-ipipe
  6. Make configuration (use the saved one, but here I am editing it by hand) Help here → http://xenomai.org/2014/06/configuring-for-x86-based-dual-kernels/
      * Real-time sub-system  --->
        * Interfaces  --->
          * <*> Native API  --->
            * [*]   Interrupts (CONFIG_XENO_OPT_NATIVE_INTR=y)
      * Processor type and features  --->
        * [ ] Allow for memory compaction OFF (# CONFIG_COMPACTION is not set)
        * [ ] Page migration OFF (# CONFIG_MIGRATION is not set)
        * Processor family (Core 2/newer Xeon)
      * Power management and ACPI options  --->
        * [ ] Suspend to RAM and standby (# CONFIG_SUSPEND is not set)
        * [ ] Hibernation (aka 'suspend to disk') (# CONFIG_HIBERNATION is not set)
        * [*] ACPI (Advanced Configuration and Power Interface) Support  --->
          * < >   Processor (# CONFIG_ACPI_PROCESSOR is not set)
        * CPU Frequency scaling  --->
          * [ ] CPU Frequency scaling (# CONFIG_CPU_FREQ is not set)
        * CPU Idle  --->
          * [ ] CPU idle PM support (# CONFIG_CPU_IDLE is not set)
        * Memory power savings  --->
          * < > Intel chipset idle memory power saving driver (# CONFIG_I7300_IDLE is not set)
      * Device Drivers  --->
        * Network device support  --->
          * Ethernet driver support  --->
            * <*> Intel(R) PRO/1000 Gigabit Ethernet support (CONFIG_E1000=y)
            * <*> Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support (CONFIG_IGB=y)
        * USB support  --->
          * <*> xHCI HCD (USB 3.0) support (enable in kernel USB3) (CONFIG_USB_XHCI_HCD=y)
  7. Unpack our preserved old GIT based AUFS enabled kernel
    cd /home/lvis/src
    tar -zxvf ~/src/lvis2_extras/linux-2.6.38-git-xenomai-2.6.0.tar.gz
  8. Unpack the the Xenomai tarball in /home/lvis/src/: (or your directory of choice)
    cd ~/src
    tar xvfj ~/src/lvis2_extras/xenomai-2.6.0.tar.bz2
  9. Ensure a clean build
    # the time needs to be correct before this works properly with a rsync of the pristine checkout
    sudo ntpdate timehost.gsfc.nasa.gov
    cd ~/src/linux-3.18.20-ipipe
    make-kpkg clean
  10. Fix a bug in the local version code
    sed -rie 's/echo "\+"/#echo "\+"/' scripts/setlocalversion
  11. [EXPERIMENTAL!] Change the kernel options based on this page: https://xenomai.org//2014/06/configuring-for-x86-based-dual-kernels/
    1. [CHANGE] Commented out MSI interrupt attempt in xhci.c driver (under the run function)
    2. [CHANGE] Added USB3 support under Device Drivers → USB support → xHCI HCD (USB 3.0) support (tried putting into kernel directly)
    3. [CHANGE] Made max cpu cores 4 (only 2 actual cores in a single cpu… two is fine)
  12. Build the kernel package (a source send set number of cores + 1 for concurrency level)
    CONCURRENCY_LEVEL=`getconf _NPROCESSORS_ONLN` CLEAN_SOURCE=no fakeroot make-kpkg --initrd --append-to-version -ipipe --revision `date +%Y.%m.%d`.lvisgh kernel_image kernel_headers
  13. Install the packages
    cd ~/src
    sudo  dpkg -i linux-headers-3.18.20-ipipe_`date +%Y.%m.%d`.lvisgh_amd64.deb
    sudo  dpkg -i linux-image-3.18.20-ipipe_`date +%Y.%m.%d`.lvisgh_amd64.deb
    
    ### NOTE ### 
    # if that doesn't work, just do:
    sudo  dpkg -i linux-headers-*.deb
    sudo  dpkg -i linux-image-*.deb
    
    ###### NOTE 2 ######
    # if you want to remove, boot into another kernel first, then
    # you may need to comment out in /etc/default/grub # GRUB_HIDDEN_TIMEOUT=0
    # and then sudo update-grub
    sudo apt-get purge linux-headers-2.6.38-git-xenomai-2.6.0
    sudo apt-get purge linux-image-2.6.38-git-xenomai-2.6.0
    sudo rm -rf /lib/modules/2.6.38-git-xenomai-2.6.0
  14. Update initramfs
    sudo update-initramfs -c -k 3.18.20-ipipe
  15. Update GRUB2
    sudo update-grub2
  16. Reboot the machine
    sudo reboot
  17. Build Xenomai
    cd ~/src/xenomai-2.6.0
    ./configure --enable-smp
    make
    sudo make install

Clear off the original generic kernel to save disk space

  1. Dry run (what will be removed)
    dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get --dry-run remove
  2. Actually removing the old kernels
    dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge

Required Software

gtest

  1. Uncompress the gtest library
    cd ~/src
    tar -jxvf ~/src/lvis2_extras/gtest-1.5.0.tar.bz2
  2. Symlink to the top directory
    cd ~/
    ln -s src/gtest-1.5.0
  3. Compile and install
    cd ~/gtest-1.5.0
    ./configure
    make
    sudo make install
    sudo ldconfig

Drivers

16aio

  1. Compile the driver
    cd /home/lvis/work/lvis2/trunk/src/lib/16aio
    ./make_all clean
    ./make_all

Optional Configuration

  1. Set up the kernel to display on the console on boot by editing /etc/default/grub
    sudo nano /etc/default/grub
    • Change this line
      GRUB_CMDLINE_LINUX_DEFAULT="splash quiet"
    • To
      GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200n8 splash textonly"
    • Then run
      sudo update-grub2
  2. Network configuration
    sudo nano /etc/network/interfaces
    • And replace it all with the following:
      # This file describes the network interfaces available on your system
      # and how to activate them. For more information, see interfaces(5).
      
      # The loopback network interface
      auto lo
      iface lo inet loopback
      
      # A network interface
      auto eth0
      iface eth0 inet static
              address 10.2.1.42
              netmask 255.255.255.0
      
      # A network interface
      auto eth1
      iface eth1 inet static
              address 10.3.1.42
              netmask 255.255.255.0
      
      # The primary network interface
      auto eth2
      iface eth2 inet static
              address 10.4.1.42
              netmask 255.255.255.0
              network 10.4.1.0
              broadcast 10.4.1.255
              gateway 10.4.1.1
              # dns-* options are implemented by the resolvconf package, if installed
              dns-nameservers 8.8.8.8
      
      auto eth2:1
      iface eth2:1 inet static
              address 129.100.0.42
              netmask 255.255.0.0
      
  3. Use this for network code here at GSFC
    # A network interface
    auto eth0
    iface eth0 inet static
            address 10.4.1.2
            netmask 255.255.255.0
            network 10.4.1.0
            broadcast 10.4.1.255
            gateway 10.4.1.1
            # dns-* options are implemented by the resolvconf package, if installed
            dns-nameservers 128.183.10.134 128.183.50.17 8.8.8.8
  4. Configure the system to ignore file system errors of blocks being in the future:
    • Modify /etc/e2fsck.conf and add these lines: (should reboot and then be happy)
      [problems]
      
      # Superblock last mount time is in the future (PR_0_FUTURE_SB_LAST_MOUNT).
      0x000031 = {
          preen_ok = true
          preen_nomessage = true
      }
      
      # Superblock last write time is in the future (PR_0_FUTURE_SB_LAST_WRITE).
      0x000032 = {
          preen_ok = true
          preen_nomessage = true
      }
  • Samba file sharing (FIXME this needs to be added to the repository if you're going to stick with it)
    1. Save the original configuration file
      sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.default
    2. Modify your /etc/samba/smb.conf to contain
      [global]
      workgroup = MSHOME
      server string = %h server (Samba, Copied from Mythbuntu)
      log file = /var/log/samba/log.%m
      max log size = 1000
      syslog = 0
      panic action = /usr/share/samba/panic-action %d
      dns proxy = no
      security = share
      
      [raid]
      comment = RAID Share
      path = /opt/data/raid
      public = yes
      writable = no
      create mask = 0440
      directory mask = 0550
      force user = 999
      force group = 999
  1. Restart the service
    sudo service smbd restart

LVIS Software

Sigma Repository

  1. Compile the libraries
    cd ~/work/sigma/trunk/
    make

LVIS2 Repository

I think there is a header dependency that requires you to do this a second time.

  1. Compile the libraries
    cd ~/work/lvis2/trunk/
    make
    make
  2. Install the system
    # the make directory in the install script doesn't look to work
    sudo rm /opt/lvis2
    sudo mkdir /opt/lvis2
    cd ~/work/lvis2/trunk/
    sudo ./scripts/INSTALL

LVISF Configuration

  1. Edit the file
    sudo nano /etc/ld.so.conf.d/lvisf.conf
  2. Add these lines
    /usr/xenomai/lib
    /home/lvis/work/lvis2/trunk/lib/
    /home/lvis/work/sigma/trunk/lib/
    /home/lvis/src/spectrum/shared/linux/pc64/lib
    /home/lvis/src/MIC3753/linux_driver_source_3.2.7.0_64bit/libs
  3. Reload the library path
    sudo ldconfig

Customize Ubuntu Live CD/USB

This is the source for all of this. Minor tweaks made, but the bulk comes from here: (how to make a live ISO of your current running system)

  1. Prepare the environment (NOTE: DO NOT use ~/ since sudo will be /root/ not /home/lvis )
    1. Create some directories
      mkdir /home/lvis/iso/
      mkdir /home/lvis/iso/tmp
      mkdir /home/lvis/iso/tmp/cd
      mkdir /home/lvis/iso/tmp/worktemp
    2. Set some variables
      export WORK=/home/lvis/iso/tmp/worktemp
      export CD=/home/lvis/iso/tmp/cd
      export FORMAT=squashfs
      export FS_DIR=casper
    3. Create the CD and the WORK directory structure:
      sudo mkdir -p ${CD}/{${FS_DIR},boot/grub} ${WORK}/rootfs
    4. Install some packages on your current system:
      sudo apt-get update
      sudo apt-get install grub2 xorriso squashfs-tools
  2. OPTIONAL! Is your work directory up to date?! SVN check out, compile and install the latest code
    cd ~/work/lvis2
    svn up
    cd ~/work/lvis2/trunk
    make clean
    make
    make
    sudo ./scripts/UNINSTALL
    sudo ./scripts/INSTALL
  3. Make repository directories available in /opt/lvis2/src
    sudo mkdir /opt/lvis2/src/
    cd /opt/lvis2/src/
    sudo svn co svn+ssh://lvis@gs694-lvisdev.gsfc.nasa.gov/srv/svn/lvis2
    sudo svn co svn+ssh://lvis@gs694-lvisdev.gsfc.nasa.gov/srv/svn/sigma
    cd
  4. Copy your installation into the new filesystem.
    sudo rsync -av --one-file-system --exclude=/proc/* --exclude=/dev/* \
    --exclude=/sys/* --exclude=/tmp/* --exclude=/home/* --exclude=/lost+found \
    --exclude=/var/tmp/* --exclude=/boot/grub/* --exclude=/root/* \
    --exclude=/var/mail/* --exclude=/var/spool/* --exclude=/media/* \
    --exclude=/etc/fstab --exclude=/etc/mtab --exclude=/etc/hosts \
    --exclude=/etc/timezone --exclude=/etc/shadow* --exclude=/etc/gshadow* \
    --exclude=/etc/X11/xorg.conf* --exclude=/etc/gdm/custom.conf \
    --exclude=/etc/lightdm/lightdm.conf --exclude=${WORK}/rootfs / ${WORK}/rootfs
  5. Chroot into the new system and modify it:
    1. Chroot into the copied system after mounting proc and dev:
      sudo mount --bind /dev/ ${WORK}/rootfs/dev
      sudo mount -t proc proc ${WORK}/rootfs/proc
      sudo mount -t sysfs sysfs ${WORK}/rootfs/sys
      sudo chroot ${WORK}/rootfs /bin/bash
    2. (chroot) Set this in the chroot environment:
      LANG=
    3. (chroot) Install Packages Essential for live CD:
      apt-get update
      apt-get install casper lupin-casper
    4. (chroot) Update the initramfs:
      depmod -a $(uname -r)
      update-initramfs -u -k $(uname -r)
    5. (chroot) Remove non system users:
      for i in `cat /etc/passwd | awk -F":" '{print $1}'`
      do
      	uid=`cat /etc/passwd | grep "^${i}:" | awk -F":" '{print $3}'`
      	[ "$uid" -gt "998" -a  "$uid" -ne "65534"  ] && userdel --force ${i} 2>/dev/null
      done
    6. (chroot) Clean the system
      apt-get clean
    7. (chroot) Zero out any log files
      find /var/log -type f | while read file
      do
      	cat /dev/null | tee $file
      done
    8. LVIS Specific Modifications
      1. (chroot) Update the user ID and Host name by editing /etc/casper.conf
        nano /etc/casper.conf
        • adding the following lines and comment out the original stuff
          export USERNAME="lvis"
          export USERFULLNAME="LVIS Live"
          export HOST="lvisgh64"
          export BUILD_SYSTEM="Ubuntu 10.04 LTS Xenomai 2.6.0"
          export FLAVOUR="Xenomai"
      2. (chroot) Edit the /etc/rc.local adding the following lines to check the raid before mounting
        nano /etc/rc.local
        • Add this line before the lspci check
          # do a file system check on the raid parition
          /sbin/e2fsck -f -p -v /dev/disk/by-label/LVISRAID
      3. (chroot) Edit the /etc/rc.local adding the following lines to mount the raid by label
        nano /etc/rc.local
        • Add this line after the file system check
          # mount the raid parition
          /bin/mount -L LVISRAID /opt/data/raid
      4. (chroot) Edit the /etc/rc.local adding the following lines to fire off programs automatically
        nano /etc/rc.local
        • Put these near the bottom (uncomment them)
          # fire off lvis2d
          LVIS_RUN_LVIS2D_SCRIPT="/opt/lvis2/run_lvis2d"
          if [ -e $LVIS_RUN_LVIS2D_SCRIPT ]; then
                 /usr/bin/screen -d -m -S "MAIN lvis2d" $LVIS_RUN_LVIS2D_SCRIPT
          fi
          
          # fire off lvisdd
          LVIS_RUN_LVISDD_SCRIPT="/opt/lvis2/run_lvisdd"
          if [ -e $LVIS_RUN_LVISDD_SCRIPT ]; then
                 /usr/bin/screen -d -m -S "DATA lvisdd" $LVIS_RUN_LVISDD_SCRIPT
          fi
      5. (chroot) Edit the /etc/rc.local adding the following lines to kick off the cronjobs
        nano /etc/rc.local
        • Add this line at the end
          # fire off the system wide crontab
          /usr/bin/crontab /etc/crontab
      6. (chroot) Modify /usr/share/initramfs-tools/scripts/casper-bottom/10adduser:
        nano /usr/share/initramfs-tools/scripts/casper-bottom/10adduser
        • Change:
          db_set passwd/user-password-crypted U6aMy0wojraho
        • To our favorite password:
          db_set passwd/user-password-crypted xS76ZozDlCQaM
      7. (chroot) Modify /usr/share/initramfs-tools/scripts/casper-bottom/25configure_init:
        nano /usr/share/initramfs-tools/scripts/casper-bottom/25configure_init
        • Change on about line 25 this:
                                                                                                
          # Arrange for shells on virtual consoles, rather than login prompts
          
          if [ -n "$USERNAME" ]; then
        • To this, and it will remove the auto-login:
          if [ -n "" ]; then
      8. (chroot) Remove the persistent network and cdrom rules from udev
        rm /etc/udev/rules.d/70-persistent-net.rules 
        rm /etc/udev/rules.d/70-persistent-cd.rules  
      9. (chroot) Remove /etc/resolv.conf so it will not try to reverse look up IP address over the network (DNS)
        rm /etc/resolv.conf
      10. (chroot) Edit the /etc/rc.local adding the following lines to symbolically link in source to the lvis user's home directory
        nano /etc/rc.local
        • Add this line at the end
          # LVIS-GH:  UNCOMMENT to symbolic link the source trees into the lvis home directory
          # default user on the ISO is user # 999
          /bin/mkdir /home/lvis/work
          /bin/ln -s /opt/lvis2/src/lvis2 /home/lvis/work/lvis2
          /bin/ln -s /opt/lvis2/src/sigma /home/lvis/work/sigma
          /bin/chown -R 999 /home/lvis/work
      11. (chroot) Clean up files you really do not need for this live ISO image
        1. Delete temporary files and bash history
          rm -rf /tmp/* ~/.bash_history
        2. Delete /usr/share documentation files
          rm -rf /usr/share/doc/*
          # we need to keep copyright files for legal reasons
          rm -rf /usr/share/man/*
          rm -rf /usr/share/groff/*
          rm -rf /usr/share/info/*
          rm -rf /usr/share/lintian/*
          rm -rf /usr/share/linda/*
        3. Delete locale information for anything but English
          find /usr/share/locale -mindepth 1 -maxdepth 1 ! -name 'en' |xargs rm -r
      12. (chroot) Re-run the initram-fs to capture our user and password changes (so they stick)
        depmod -a $(uname -r)
        update-initramfs -u -k $(uname -r)
    9. (chroot) Exit chroot
      exit
  6. Prepare The CD directory tree:
    1. Copy the kernel, the updated initrd and memtest prepared in the chroot:
      export kversion=`cd ${WORK}/rootfs/boot && ls -1 vmlinuz-* | tail -1 | sed 's@vmlinuz-@@'`
      sudo cp -vp ${WORK}/rootfs/boot/vmlinuz-${kversion} ${CD}/${FS_DIR}/vmlinuz
      sudo cp -vp ${WORK}/rootfs/boot/initrd.img-${kversion} ${CD}/${FS_DIR}/initrd.img
      sudo cp -vp ${WORK}/rootfs/boot/memtest86+.bin ${CD}/boot
    2. Unmount bind mounted dirs:
      sudo umount ${WORK}/rootfs/proc
      sudo umount ${WORK}/rootfs/sys
      sudo umount ${WORK}/rootfs/dev
    3. Convert the directory tree into a squashfs:
      sudo mksquashfs ${WORK}/rootfs ${CD}/${FS_DIR}/filesystem.${FORMAT} -noappend
    4. Fix permissions on the squashed file system
      sudo chmod 755 ${CD}/casper/filesystem.squashfs
    5. Make filesystem.size
      echo -n $(sudo du -s --block-size=1 ${WORK}/rootfs | tail -1 | awk '{print $1}') | sudo tee ${CD}/${FS_DIR}/filesystem.size
    6. Calculate MD5
      find ${CD} -type f -print0 | xargs -0 md5sum | sed "s@${CD}@.@" | grep -v md5sum.txt | sudo tee -a ${CD}/md5sum.txt
    7. Make Grub the bootloader of the CD
      1. Use an editor
        sudo nano ${CD}/boot/grub/grub.cfg
      2. Enter the following into the file and save it
        set default="0"
        set timeout=3
         
        menuentry "LVIS-F x86_64 Xenomai-2.6.0 Data System DHCP Network" {
        linux /casper/vmlinuz boot=casper noprompt splash textonly
        initrd /casper/initrd.img
        }
        
         
        menuentry "Memory Test" {
        linux16 /boot/memtest86+.bin
        }
        
         
        menuentry "Boot from the first hard disk" {
        set root=(hd0)
        chainloader +1
        }
        
      3. Options are:
        1. console=ttyS0,115200n8 redirect our messages to/from serial port
        2. ip=frommedia sets the network configuration from our ISO (for static IP, DHCP is the default otherwise)
        3. noprompt do not ask to remove the media before rebooting
        4. splash no idea lol FIXME
        5. textonly for the serial port redirection
        6. toram load the entire file system into ram before running
  7. Build the CD/DVD
    1. Make the ISO file
      sudo grub-mkrescue --output=/home/lvis/iso/lvisgh64_live_`date +%Y.%m.%d`.iso ${CD}

You need to put console directly in the grub.cfg file (under /boot/grub/) in the ISO. Use the example they have for CLI (command line only also) so:

  • remove quiet
  • add console=ttyS0,115200n8
  • add textonly
  • add noapic THIS CAUSES IRQ FOR THE BOARDS TO MOVE. BAD. Crash!!!!

Create Bootable USB

  1. Use fdisk and delete all existing partitions
    sudo fdisk /dev/sdX
    • Then use option 'd' to delete ALL paritions
  2. Create a partition to fill out the device
    • Select option 'n' for new, and fill out the device (take defaults)
  3. Set the bootable flag ON
    • Select option 'a'
  4. Exit fdisk
  5. Format the partition as ext3:
    sudo mkfs.ext3 -L LVISNAND -b 4096 -m 0 /dev/sdX1
  6. Mount the drive
    sudo mount /dev/sdX1 /mnt
    # AND clear it off first, it goes much faster on an empty NAND
    # BE SURE this is the drive you want to wipe... I do a df -h first to make sure it is what I think it is
    sudo rm -rf /mnt/*
  7. Add the Unetbootin repository to our source list, so we can get the latest version (the one that WORKS!)
    sudo nano /etc/apt/sources.list
    • And add the following line at the bottom
      # LVIS-GH added for getting latest Unetbootin
      deb http://ppa.launchpad.net/gezakovacs/ppa/ubuntu lucid main
  8. Install Unetbootin
    sudo apt-get update
    sudo apt-get install unetbootin
  9. Run it (you will need to have logged in with X enabled, log out and do the following
        * First, log into lvis with X <code>
    ssh -X lvis@10.4.1.42
    • Then, you can install with the GUI
      sudo unetbootin
      • Select the ISO
      • Click OK and GO!
      • Reboot!
      • Relax and have a homebrew!

ERRORS and Issues

  • Seeing EDAC errros (PCI Parity) so we are causing system troubles with too much Xenomai load I think
  • lvis2d.exe threads seem HIGH in CPU usage… not sure if there are loops not sleeping enough

KERNEL TESTS

These two things may not do anything, but looking in the kernel options these COULD affect the performance of the Xenomai code:

  1. Xenomai time slice is 1000 microseconds. Maybe that should be 100 or 50 ?
  2. SMI work around:
    1. Under: Real-time sub-system → Machine → SMI Work Around
    2. Enable SMI workaround

Device Tests

Delphi Digitizer ADC3255

DMA Transfer Speed Testing

This program in the test suite will DMA transfer data from the card and calculate an average data rate

sudo ./adc3255_polling -dmarate -s 1000 -n 32000

IDL Testing

Loading the data into IDL and displaying time difference to check timing

cd /Users/david/idl/lvisgh_idl
idl

; IDL
read_lvisgh,h,c,/CFILEONLY
time = lvisf_timeconvert(c.BCTIME_SEC,c.BCTIME_MICROSEC)
plot,diff(time)

Plot temperatures of the Delphi digitizers

tempa = double(c.ADCAREG10) / 16.0
tempb = double(c.ADCBREG10) / 16.0
tempc = double(c.ADCCREG10) / 16.0
plot,c.shot_number,tempa,yrange=[min([tempa,tempb,tempc]),max([tempa,tempb,tempc])]
plots,c.shot_number,tempb,color=100
plots,c.shot_number,tempc,color=200
code/work/pi/xenomai/start.txt · Last modified: 2017/03/03 23:50 by david