Friday, 15 April 2016

KERNEL BUILDING for RPI

KERNEL BUILDING

There are two main methods for building the kernel. You can build locally on a Raspberry Pi which will take a long time; or you can cross-compile, which is much quicker, but requires more setup.

LOCAL BUILDING

On a Raspberry Pi first install the latest version of Raspbian from the downloads page. Then boot your Pi, plug in Ethernet to give you access to the sources, and log in.
First get the sources, which will take some time:
git clone --depth=1 https://github.com/raspberrypi/linux
Add missing dependencies:
sudo apt-get install bc
Configure the kernel - as well as the default configuration you may wish toconfigure your kernel in more detail or apply patches from another source to add or remove required functionality:
Run the following commands depending on your Raspberry Pi version.

RASPBERRY PI 1 (OR COMPUTE MODULE) DEFAULT BUILD CONFIGURATION

cd linux
KERNEL=kernel
make bcmrpi_defconfig

RASPBERRY PI 2/3 DEFAULT BUILD CONFIGURATION

cd linux
KERNEL=kernel7
make bcm2709_defconfig
Build and install the kernel, modules and Device Tree blobs; this step takes a longtime...
make -j4 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo scripts/mkknlimg arch/arm/boot/zImage /boot/$KERNEL.img
Note: On a Raspberry Pi 2/3, the -j4 flag splits the work between all four cores, speeding up compilation significantly.

CROSS-COMPILING

First you are going to require a suitable Linux cross-compilation host. We tend to use Ubuntu; since Raspbian is also a Debian distribution it means using similar command lines and so on.
You can either do this using VirtualBox (or VMWare) on Windows, or install it directly onto your computer. For reference you can follow instructions online at Wikihow.

INSTALL TOOLCHAIN

Use the following command:
git clone https://github.com/raspberrypi/tools
You can then copy the toolchain to a common location such as/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian, and add/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin to your $PATH in the .bashrc in your home directory. For 64-bit host systems, use /tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin. While this step is not strictly necessary, it does make it easier for later command lines!

GET SOURCES

To get the sources, refer to the original GitHub repository for the various branches.
$ git clone --depth=1 https://github.com/raspberrypi/linux

BUILD SOURCES

To build the sources for cross-compilation there may be extra dependencies beyond those you've installed by default with Ubuntu. If you find you need other things please submit a pull request to change the documentation.
Enter the following commands to build the sources and Device Tree files.
For Pi 1 or Compute Module:
cd linux
KERNEL=kernel
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
For Pi 2/3:
cd linux
KERNEL=kernel7
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
Then for both:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
Note: To speed up compilation on multiprocessor systems, and get some improvement on single processor ones, use -j n where n is number of processors * 1.5. Alternatively, feel free to experiment and see what works!

INSTALL DIRECTLY ONTO THE SD CARD

Having built the kernel you need to copy it onto your Raspberry Pi and install the modules; this is best done directly using an SD card reader.
First use lsblk before and after plugging in your SD card to identify which one it is; you should end up with something like this:
sdb
   sdb1
   sdb2
If it is a NOOBS card you should see something like this:
sdb
  sdb1
  sdb2
  sdb3
  sdb5
  sdb6
In the first case sdb1/sdb5 is the FAT partition, and sdb2/sdb6 is the ext4 filesystem image (NOOBS).
Mount these first:
mkdir mnt/fat32
mkdir mnt/ext4
sudo mount /dev/sdb1 mnt/fat32
sudo mount /dev/sdb2 mnt/ext4
Adjust the partition numbers for the NOOBS images.
Next, install the modules:
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install
Finally, copy the kernel and Device Tree blobs onto the SD card, making sure to back up your old kernel:
sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
sudo scripts/mkknlimg arch/arm/boot/zImage mnt/fat32/$KERNEL.img
sudo cp arch/arm/boot/dts/*.dtb mnt/fat32/
sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
sudo cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/
sudo umount mnt/fat32
sudo umount mnt/ext4
Another option is to copy the kernel into the same place, but with a different filename - for instance, kernel-myconfig.img - rather than overwriting the kernel.img file. You can then edit the config.txt file to select the kernel that the Pi will boot into:
kernel=kernel-myconfig.img
This has the advantage of keeping your kernel separate from the kernel image managed by the system and any automatic update tools, and allowing you to easily revert to a stock kernel in the event that your kernel cannot boot.
Finally, plug the card into the Pi and boot it!

Steps to Setup Netapp Cluster

Steps to Setup Netapp Cluster

 Step 1: Hardware setup

     First step is to unpack your package (Hardware Parts). Netapp hardware package will come all parts are individually.

   Separate all the hardware parts and select the position of Racking space from Netapp rack. Then attach the racking kit to the rack and load the chassis.

After Loading the Netapp controllers then attach the disks to it.

  1. Connect controllers to disk shelves (FC/SAS/INFINI BAND connectivity)
  2. NVRAM interconnect to high availability cable between partners (10GbE or INFNI Band)
  3. Connect controllers to network such that each node have exactly two connections to the dedicated cluster network, at least one data connection. Also the well known RLM/BMC/SP connection for troubleshooting purpose.
  4. Connect interconnect switch (most of the cases Cisco MDS) and attach all the cables to provide redundant connection.
Note: Cluster connections must be on a network with dedicated cluster traffic, where as data and management connections are on a distinct network.

Step 2: Power-up


  1. Power on network switches and SAN Switches
  2. Power on disk shelves and wait for 2minutes
  3. Power on storage controllers

Step 3Firmware

  1. During boot process press any key to enter the firmware
  2. Two compact flash images: flash0a and flash0b are available. To 'flash' (put) a new image on primary flash one needs to configure management interface.

Note: For auto option of ifconfig, DHCP or BOOTP server must be available on management network. If it doesn't one must run below command

C::Mode>ifconfig <interface> addr=<ip> mask=<netmask> gw=<gateway>

3. Once the network is configured, ping to test and flash the image; run flash tftp://<tftp_server>/<path_to_image>flash0a

Step4 : Installing ONTAP 8.1

  • Run option 7 to install new software first
  • Enter a URL to ONTAP 8.1 tgz image
  • Allow the system to boot when complete
Note: One can type boot_primary if node stops at firmware prompt

Step5 : Initialize a Node

    First time booting it will ask you to press CTRL+C to enter into the boot menu.
For the First time we have to format all the disks and rebuild as fresh one.


It will reboot the Netapp controller and it will start as fresh
  • Run option 4
  • This initialization clears the three disks that the system uses for the first aggr that it creates and a vol0 root volume on it
  • This must be run on both nodes of each HA pair

Step6 : Cluster setup wizard



After completion of initialization of Netapp ONTAP it will ask you "do you want to create Cluster / Join the Cluster"

For first node you have to say "create" cluster

  • The first node creates the cluster
  • The following information is required for the setup:
-Cluster name
-Cluster network ports and MTU size
-Cluster base license key
-Cluster management port, IP address, netmask, and default gateway
-Node management port, IP adress, netmask, and default gateway
-DNS domain name
-IP address of DNS server

  • Subsequent nodes join the cluster
While booting itself it will ask you enter the Cluster License. You have to enter the Cluster License.

Step7 : Normal boot sequence

  1. Firmware loads the kernel from CF
  2. Kernel mounts "/" root image from rootfs.img on CF
  3. Init is loaded and startup scripts run
  4. NVRAM kernel modules gets loaded
  5. Tmgwd is started
  6. D-blade, N-balde and other components are loaded
  7. vol0 root volume is mounted from local D-blade
  8. CLI and element manager are ready for use

Step8 : Create a cluster after login to the clustershell

CMode::>cluster create -license <name> -clustername <clustername> -mgmt-port <port> -mgmt-ip <mgmtip> -mgmt-netmask <mgmtnetmask> -mgmt-gateway <magmtgateway> -ipaddr1 <clusterip1> -ipaddr2 <clusterip2> -netmask <clusternetmask> -mtu 9000

Step9 : Join a Node to existing Cluster


Run this command from the node that wants to join the cluster

CMode::>cluster join -clusteripaddr <remoteclusterip> -ipaddr <clusterip1> -ipaddr2 <clusterip2> -netmask <clusternetmask> -mtu 9000

Step10 : Add all required Licenses

Below are few licenses we have to add
  1. Base
  2. NFS
  3. CIFS
  4. iSCSI
  5. FCP
  6. SnapMirror_DP
  7. SnapRestore
  8. Flexclone
Note: One can add licenses in the cluster shell; system license add

Step:11 NTP
  • NTP is disabled by default and needs manual set up of date, time and time zone
CMode::>system date modify
  • Verify and monitor

CMode::> system services ntp config show
CMode::> system services ntp server show 


Please Provide your Valuable comments below....