image discovery x86:  make sure onie_eth_addr is set

Reviewed By: Nike Chen <nike_chen@accton.com>, David Yang <david_yang@accton.com>

During the execution of /bin/exec_installer the variable
'onie_eth_addr' is used in a few places.  On PowerPC platforms this
variable is set on the kernel command line when U-Boot loads and boots
ONIE.

On x86 platforms this variable was not being set correctly.  This
patch corrects that.

If the onie_eth_addr variable is unset then set it using the output of
"onie-sysinfo -e", which returns the MAC address for eth0.

Testing Done:

Compiled images for x86 and PowerPC.  Verified the TFTP waterfall contains
a URL of form:

  tftp://<server>/<MAC_Address>/onie-installer-x86_64-<vendor>_<machine>-r<machine_revision>

Also verified that HTTP requests are setting the ONIE-ETH-ADDR: HTTP
header correctly.
Add support for x86 DIAG partitions

Reviewed By: dustin

This patch adds support to x86 ONIE for handling an external DIAG OS
that resides in its own partition.  The DIAG OS is installed just like
a NOS, with a few additional requirements.

For ONIE the main place where the DIAG OS partition matters is during
the "OS uninstall" operation.  ONIE needs to be careful and not remove
the DIAG OS during this operation.

The requirements of a DIAG OS installer follow.  The "OS uninstall"
operation depends on these requirements being met.

- Install the diag OS into it's own partition.

- When the machine's partition table is GPT:

  + name the diag partition "<SOMETHING>-DIAG".  See the man page for
    sgdisk(8) and the --change-name option.

  + set the GPT 'system partition' attribute bit (bit 0).  See the man
    page for sgdisk(8) and the --attributes option.

  + when creating the file system on the diag partition set the file
    system label to "<SOMETHING>-DIAG", the same string as used for
    the GPT partition label.  See mkfs.ext4(8) and the -L option.

  The "-DIAG" suffix and the 'system partition' bit is how ONIE
  recoginizes that the partition is a DIAG partition.  This
  information also helps a NOS installer recognize the partitions as
  "special" and leave them alone.

- When the machine's partition table is MSDOS (please no one use MSDOS
  partitions):

  + All we can do in this case is use the file system label.  When
    creating the file system on the diag partition set the file system
    label to "<SOMETHING>-DIAG".  See mkfs.ext4(8) and the -L option.

- When installing the diag image, install GRUB into the MBR, just like
  the demo OS does.

- Also install GRUB into the diag partition.  This will allow a NOS to
  "chainload" the diag OS.

- The grub.cfg for the diag partition should contain all menu entries
  the diag OS needs, plus one entry to chainload ONIE.

When provisioning a machine in the factory the order of operations
would be:

1. Install ONIE on the machine

2. From ONIE use any of the regular NOS install methods to install the
   DIAG OS.

Testing Done:

Using the x86_64 virtual machine exercised:

- installing ONIE

- installing a demo DIAG OS

- installing a demo NOS

- invoking the OS uninstall procedure and verifying the demo NOS was
  removed, while leaving the DIAG OS intact.
Add a demo x86 DIAG OS

Reviewed By: dustin

For demonstration purposes this patch adds a "demo DIAG OS" installer
that hardware vendors can study to understand how to write a DIAG OS
installer.

As an implementation detail the original "demo NOS" is now
parameterized to provide both the "demo NOS" and the "demo DIAG OS".
At build time typing "make demo" will compile both the "demo NOS" and
the "demo DIAG OS".

The "demo DIAG OS" demonstrates:

- Installing the diag OS into it's own partition.

- When the machine's partition table is GPT:

  + names the diag GPT partition "ONIE-DEMO-DIAG".

  + set the GPT 'system partition' attribute bit (bit 0).

  + when creating the file system on the diag partition set the file
    system label to "ONIE-DEMO-DIAG", the same string as used for
    the GPT partition label.

- When the machine's partition table is MSDOS (please no one use MSDOS
  partitions):

  + All we can do in this case is use the file system label.  When
    creating the file system on the diag partition set the file system
    label to "ONIE-DEMO-DIAG".

- When installing the diag image, install GRUB into the MBR, just like
  the demo OS does.

- Also install GRUB into the diag partition.  This will allow a NOS to
  "chainload" the diag OS later.

- The grub.cfg for the diag partition contains all menu entries
  the diag OS needs, plus one entry to chainload ONIE.

- The demo DIAG OS grub.cfg also insures that the ONIE entry is the
  default, which it must be.  Out of the factory the machine must boot
  into ONIE installer mode by default.

Testing Done:

Using the x86_64 virtual machine exercised:

Case 1 -- install demo DIAG, followed by demo OS, followed by OS
          uninstall

- installing ONIE

- installing a demo DIAG OS

- installing a demo NOS

- invoking the OS uninstall procedure and verifying the demo NOS was
  removed, while leaving the DIAG OS intact.  The system returns to
  the ONIE installer state.

Case 2 -- install demo OS, followed by OS uninstall

- installing ONIE

- installing a demo NOS

- invoking the OS uninstall procedure and verifying the demo NOS was
  removed.  The system returns to the ONIE installer state.
Add pre and post install hooks

Some platforms may have hardware watchdog enabled
in bios, and with facility to allow software to
set 'next-boot-device'.

The pre and post install hooks added here can
be used for platform specific routines, such as
reset hardware watchdog, set next-boot-device
in bios after successful onie installation.

Testing Done:

Tested on x86_64 platforms.

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Add check for return code for pre and post install hooks.

Testing Done:

Tested on x86_64 platforms.

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Remove hardcode console setting by onie installer

Use "GRUB_SERIAL_COMMAND" and "GRUB_CMDLINE_LINUX" if
defined, otherwise use default settings.

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Remove hardcode of console unit and console speed

This patch allows setting console unit number and console-speed
at image build time. if CONSOLE_UNIT and CONSOLE_SPEED is not
defined, default is 0 and 115200.

This can be set as part of the make command (i.e,
make MACHINE=kvm_x86_64 CONSOLE_SPEED=9600 CONSOLE_UNIT=0 all),
or define in the machine.make file such as,

$ cat machine/kvm_x86_64/machine.make
CONSOLE_SPEED = 9600
CONSOLE_UNIT = 0

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
ONIE Support for Dell Networking S4810-ON

Dell Networking S4810-ON is High-Performance 10/40 GbE top-of-rack switch.

Cross-Compiling ONIE for S4810-ON
=================================

Change directories to ``build-config`` to compile ONIE.

To compile ONIE first change directories to ``build-config`` and then
type ``"make MACHINEROOT=../machine/dell/  MACHINE=dni_7448 all"``.
For example::

  $ cd build-config
  $ make -j4 MACHINEROOT=../machine/dell/ MACHINE=dni_7448 all

When complete, the ONIE binaries are located in``build/images``::

  -rw-r--r-- 4849664 May  7 12:06 onie-dni_7448-r0.bin

For installing, refer to machine/dell/dell_7448/INSTALL documentation.
Add Dell versioning to the U-boot header
Rebranding machine directory to Dell product name S4810-ON.
Remove 32-bit package from debian-prepare-build-host target

The debian-prepare-build-host Makefile target installs needed packages
to prepare a build host for building ONIE.

Along the way we picked up a 32-bit package, which does not work when
the build host is x86_64.

The intent of the build target is more for guidance and reference than
to provide an absolute rule.  For now make the assumption the build
host is a x86_64 machine.
Allow for platform specific hardware init at boot time

Reviewed By: dustin

This patch updates the existing /etc/init.d/init-arch.sh script to
also look for platform specific PRE and POST initialization handlers.

The flow of init-arch.sh is now:

1. run any platform specific PRE handler
2. run the architecture specific handler
3. run any platform specific POST handler

These changes allow for machine specific hardware initialization early
in the boot sequence.

To make use of this feature create a small shell script fragment in
the corresponding machine directory:

  machine/<vendor>/<machine_name>/rootconf/sysroot-lib-onie/init-platform

In this file implement the functions init_platform_pre_arch() and
init_platform_post_arch().

The /etc/init.d/init-arch.sh script will call these routines at boot
time.

Testing Done:

Added no-op (just echos a message) pre and post hanlders to the
kvm_x86_64 and fsl_p2020rdbpca machines.  For both cases verified the
no-op handlers execute during boot up.
kvm_x86_64:  Add platform specific hardware init script

Reviewed By: dustin

This patch exercises the platform specific PRE and POST initialization
mechanism contained in /etc/init.d/init-arch.sh

The flow of init-arch.sh is now:

1. run any platform specific PRE handler
2. run the architecture specific handler
3. run any platform specific POST handler

This patch simply adds no-op handlers that echo a message that can be
easily verified at boot time.
fsl_p2020rdbpca:  Add platform specific hardware init script

Reviewed By: dustin

This patch exercises the platform specific PRE and POST initialization
mechanism contained in /etc/init.d/init-arch.sh

The flow of init-arch.sh is now:

1. run any platform specific PRE handler
2. run the architecture specific handler
3. run any platform specific POST handler

This patch simply adds no-op handlers that echo a message that can be
easily verified at boot time.
remove /etc/init.d/rc.local feature

Reviewed By: dustin

This feature is not being used by any known machines.

The functionality of this feature is now covered by
/etc/init.d/init-arch.sh, which can accommodate two levels of platform
specific initializations.

Testing:

The changes were exercised on the kvm_x86_64 and fsl_p2020rdbpca
machines.
adding sample ISC dhcpd.conf
Merge pull request #9 from cobracmder/master

adding sample ISC dhcpd.conf
Documentation: Update for move to OCP website
Documentation: Update for move to OCP website

Update the documentation to reflect the project moving to the OCP
github repo.
Dell Networking S6000-ON 10/40 GbE top-of-rack switch.

This patch supports adding S6000-ON platform related changed to ONIE ver 2014.05

===============================================================================
Installing ONIE on DELL S6000 Series w/ Intel Atom Centerton (S1220) CPU Module
================================================================================

Cross-Compiling ONIE
====================

To compile ONIE first change directories to ``build-config`` and then
type ``"make MACHINE=dell_s6000_s1220 all"``.  For example::

  $ cd build-config
  $ make -j4 MACHINE=dell_s6000_s1220 all

When complete, the ONIE binaries are located in
``build/images``::

  -rw-r--r-- 10487413 Mar 27 11:01 onie-updater-x86_64-dell_s6000_s1220-r0
  -rw-r--r-- 24620032 Mar 27 11:01 onie-recovery-x86_64-dell_s6000_s1220-r0.efi64.pxe
  -rw-r--r-- 22020096 Mar 27 11:01 onie-recovery-x86_64-dell_s6000_s1220-r0.iso

It builds image for update via ONIE,image for boot via pxe and image for booting via USB.

Complete installation details, refer to machine/dell/dell_s6000_s1220/INSTALL.