Ensure realpath and gawk are installed

realpath is required for patching linux and gawk is required for the build
User-Agent fix up

Current User-Agent header has a space in it, also doesn't reflect any version information of the ONIE build itself.
Support for Intel Avoton ethernet with Broadcom phy

Reviewed By: curt

This patch adds support for the management port on the Intel Avoton.

Signed-off-by: alanl <alanl@cumulusnetworks.com>
Include strace utility by default

Reviewed By: dustin

The strace(1) utility is very handy when developing and debugging
programs.

As a byproduct of compiling the toolchain using crosstool-ng we have a
cross compiled version of strace available.  This patch adds the
strace utility to the final sysroot image by default.

Individual machines can disable this behaviour by putting the
following into their machine.make file:

  STRACE_ENABLE = no

Testing Done:

Compiled ONIE images for powerpc and x86 machines and exercised the
strace utility.

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Merge pull request #4 from cbrune/strace-utility

Include strace utility by default
Add ldd support to uClibc

Reviewed By: dustin

When debugging dynamically linked C programs it is useful to see which
libraries the executable is loading.  The ldd(1) utility is often used
for this purpose.

This patch enables LDD support in the uClibc configuration for x86 and
powerpc architectures.

At runtime on the target platform you can get basic LDD information by
setting the environment variable LD_TRACE_LOADED_OBJECTS=1.  For
example:

  ONIE:/ # LD_TRACE_LOADED_OBJECTS=1 /usr/bin/grub-mkimage
          libdevmapper.so.1.02 => /usr/lib/libdevmapper.so.1.02 (0x7fc806c29000)
          libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x7fc806a14000)
          libc.so.0 => /lib/libc.so.0 (0x7fc8067c8000)
          libpthread.so.0 => /lib/libpthread.so.0 (0x7fc8065b0000)
          libm.so.0 => /lib/libm.so.0 (0x7fc8063a3000)
          libdl.so.0 => /lib/libdl.so.0 (0x7fc80619f000)
          ld64-uClibc.so.0 => /lib/ld64-uClibc.so.0 (0x7fc806e62000)

In addition the patch adds a new Makefile target, ldd, which you can
use to run a "cross ldd" on your build host.  The utility is provided
by the crosstool-ng project.

For example to inspect the /usr/bin/grub-mkimage binary you would
invoke the Makefile 'ldd' target like this:

  build-04:~/onie/build-config$ gmake -j48 ldd LDD_TARGET=usr/bin/grub-mkimage
          libdevmapper.so.1.02 => /usr/lib/libdevmapper.so.1.02 (0x00000000deadbeef)
          libpthread.so.0 => /lib/libpthread.so.0 (0x00000000deadbeef)
          ld64-uClibc.so.0 => /lib/ld64-uClibc.so.0 (0x00000000deadbeef)
          libdl.so.0 => /lib/libdl.so.0 (0x00000000deadbeef)
          libc.so.0 => /lib/libc.so.0 (0x00000000deadbeef)
          libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00000000deadbeef)
          libm.so.0 => /lib/libm.so.0 (0x00000000deadbeef)

Testing Done:

Built images for powerpc and x86 targets.  Verify the run-time and
build-time LDD information is working.

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Merge pull request #5 from cbrune/ldd

Add ldd support to uClibc
documentation: developer documentation update

Updated the developer documentation to include:

- General patch submission philosophy

- Basic runtime debugging using strace(1) and ldd(1)

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
documentation: clarify architecture as x86_64

Change a x86 reference to x86_64.

Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
Merge pull request #6 from cbrune/docs

Docs
Add newline to end of kernel series file

Add a newline to the end of onie/patches/kernel/series, which was
inadvertently removed by commit
23e5356e56569dd0cabc22854637cde77692d536.

This was preventing proper patching on certain platforms.
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