Difference between revisions of "Cavium: SDK Install and build Debian image"

From Define Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by 2 users not shown)
Line 62: Line 62:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== Build a Debian Image ==
+
== Build a basic Debian Image (needs a manual chroot at every boot) ==
  
 
=== Run scripts and set environment variables ===
 
=== Run scripts and set environment variables ===
Line 85: Line 85:
 
[root@mips-host debian]# umount /dev/sdb2
 
[root@mips-host debian]# umount /dev/sdb2
 
</syntaxhighlight>
 
</syntaxhighlight>
'''NB: This process can take a while (~15 minutes) depending on the storage device and the power of the host system'''
+
'''NB: This process can take a while (~15+ minutes) depending on the storage device and the power of the host system'''
 +
 
 +
== Script from Interface Masters (full auto boot) ==
 +
<syntaxhighlight>
 +
#!/bin/bash
 +
#*******************************************************************************
 +
# Procedure of generating Linux Debian images and installing them on USB drive.
 +
#*******************************************************************************
 +
set -x
 +
if test "$OCTEON_ROOT" == ""; then
 +
  echo "OCTEON build environment is not setup"
 +
  exit 1
 +
fi
 +
cd $OCTEON_ROOT/linux
 +
#-------------------------------------------------------------------------------
 +
# Full cleanup
 +
#-------------------------------------------------------------------------------
 +
make clean
 +
make -C debian clean
 +
make -C embedded_rootfs distclean # This will setup default embedded_rootfs/.config file
 +
make -C kernel distclean
 +
 
 +
#-------------------------------------------------------------------------------
 +
# Build Kernel for Debian
 +
#-------------------------------------------------------------------------------
 +
make debian
 +
# During configuration prompt:
 +
# 1. Add Silicon Image SATA support
 +
# 2. Everything else -- use defaults
 +
 
 +
#-------------------------------------------------------------------------------
 +
# Install Debian (Kernel + Root FS) on the USB Disk
 +
# Here: Kingston 32GB USB-3.0 drive is used.
 +
#-------------------------------------------------------------------------------
 +
# 1. Determine the USB Disk using "fdisk -l" (or other disk info) command
 +
# 2. Modify the Makefile
 +
vi debian/Makefile
 +
#    2.1. Remove check for Disk size.
 +
# 3. Install Debian on the chosen Disk (e.g. here = /dev/sdb)
 +
make -C debian DISK=/dev/sdb compact-flash
 +
 
 +
#-------------------------------------------------------------------------------
 +
# Initial modification of the Debian environment
 +
#-------------------------------------------------------------------------------
 +
mount /dev/sdb2 /mnt
 +
vi /mnt/etc/inittab # For N805 change ttyS0 to ttyS1
 +
umount /mnt
 +
</syntaxhighlight>

Latest revision as of 15:17, 25 April 2014

Prerequisits

Host OS dependancies

Ensure you install the following:

yum groupinstall "Development Tools"
yum install patch screen

Obtain the SDK from Cavium

Obtain the following two RPM packages from the Cavium support site:

  • OCTEON-SDK-3.1.0-515.i386.rpm
  • OCTEON-LINUX-3.1.0-515.i386.rpm

A USB storage device <16GB

Connect a USB storage device (e.g. USB flash drive, USB connected CF card, etc).
Identify the USB device (using lsblk in this case):

[root@mips-host ~]# lsblk
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                           8:0    0 931.5G  0 disk 
├─sda1                        8:1    0   500M  0 part /boot
└─sda2                        8:2    0   931G  0 part 
  ├─VolGroup-lv_root (dm-0) 253:0    0    50G  0 lvm  /
  ├─VolGroup-lv_swap (dm-1) 253:1    0   7.9G  0 lvm  [SWAP]
  └─VolGroup-lv_home (dm-2) 253:2    0 873.2G  0 lvm  /home
sdb                           8:16   1   3.8G  0 disk 
├─sdb1                        8:17   1  67.6M  0 part 
└─sdb2                        8:18   1   3.7G  0 part

Installation

Install the two RPM packages:

[root@mips-host ~]# rpm -i --prefix /opt/310 OCTEON-* 

The OCTEON-SDK package has been successfully installed under the
/opt/310 directory.

The installation requires the OCTEON_MODEL environment variable
to be set. To set this environment variable, cd to the
/opt/310/OCTEON-SDK directory, and invoke

	  source env-setup <OCTEON_MODEL>

script. Valid OCTEON_MODELs are listed in octeon-models.txt file
under OCTEON-SDK directory.

You may want to copy the OCTEON-SDK package to your home directory to allow
modification without root privileges.
 
For more information please refer to the online SDK documentation:
file:///opt/310/OCTEON-SDK/docs/html/index.html
 
 

The Linux Kernel has been successfully installed under the directory
/opt/310/OCTEON-SDK/linux

Please refer to file:///opt/310/OCTEON-SDK/docs/html/linux.html
on how to use Linux on the OCTEON.

Build a basic Debian Image (needs a manual chroot at every boot)

Run scripts and set environment variables

Scripts

[root@mips-host ~]# cd /opt/310/OCTEON-SDK/
[root@mips-host OCTEON-SDK]# /opt/310/OCTEON-SDK/env-setup.pl OCTEON_CN66XX
export OCTEON_CPPFLAGS_GLOBAL_ADD=" -DUSE_RUNTIME_MODEL_CHECKS=1 -DCVMX_ENABLE_PARAMETER_CHECKING=0 -DCVMX_ENABLE_CSR_ADDRESS_CHECKING=0 -DCVMX_ENABLE_POW_CHECKS=0" OCTEON_MODEL="OCTEON_CN66XX" OCTEON_ROOT="/opt/310/OCTEON-SDK" ;export OCTEON_LE=

Environment Variables

[root@mips-host OCTEON-SDK]# export OCTEON_CPPFLAGS_GLOBAL_ADD=" -DUSE_RUNTIME_MODEL_CHECKS=1 -DCVMX_ENABLE_PARAMETER_CHECKING=0 -DCVMX_ENABLE_CSR_ADDRESS_CHECKING=0 -DCVMX_ENABLE_POW_CHECKS=0" OCTEON_MODEL="OCTEON_CN66XX" OCTEON_ROOT="/opt/310/OCTEON-SDK" ;export OCTEON_LE=

Start the build

[root@mips-host OCTEON-SDK]# cd linux/debian/
[root@mips-host OCTEON-SDK]# make DISK=/dev/sdb compact-flash
... Much output! ...
[root@mips-host debian]# umount /dev/sdb2

NB: This process can take a while (~15+ minutes) depending on the storage device and the power of the host system

Script from Interface Masters (full auto boot)

#!/bin/bash
#*******************************************************************************
# Procedure of generating Linux Debian images and installing them on USB drive.
#*******************************************************************************
set -x
if test "$OCTEON_ROOT" == ""; then
   echo "OCTEON build environment is not setup"
   exit 1
fi
cd $OCTEON_ROOT/linux
#-------------------------------------------------------------------------------
# Full cleanup
#-------------------------------------------------------------------------------
make clean
make -C debian clean
make -C embedded_rootfs distclean	# This will setup default embedded_rootfs/.config file
make -C kernel distclean

#-------------------------------------------------------------------------------
# Build Kernel for Debian
#-------------------------------------------------------------------------------
make debian
# During configuration prompt:
# 1. Add Silicon Image SATA support 
# 2. Everything else -- use defaults

#-------------------------------------------------------------------------------
# Install Debian (Kernel + Root FS) on the USB Disk
# Here: Kingston 32GB USB-3.0 drive is used.
#-------------------------------------------------------------------------------
# 1. Determine the USB Disk using "fdisk -l" (or other disk info) command
# 2. Modify the Makefile
vi debian/Makefile
#    2.1. Remove check for Disk size.
# 3. Install Debian on the chosen Disk (e.g. here = /dev/sdb)
make -C debian DISK=/dev/sdb compact-flash

#-------------------------------------------------------------------------------
# Initial modification of the Debian environment
#-------------------------------------------------------------------------------
mount /dev/sdb2 /mnt
vi /mnt/etc/inittab	# For N805 change ttyS0 to ttyS1
umount /mnt