common: fix mbr filetype detection

Sometimes mbr is erroneously recocognised as FAT partion. Due to this the mbr
partition parser is not being called and the partitions on the media are not
detected. This patch should  fix the problem. The checking is done as in the
linux kernel.

I have seen the problem using usb sticks. Although partitioning and formatting
them under linux. The file system type field in the mbr remains there which
causes the wrong detections as FAT32 type and not as mbr.

Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Release v2014.11.0

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Merge branch 'for-next/am335x'
Merge branch 'for-next/dts'
Merge branch 'for-next/fs'
Merge branch 'for-next/imx'
Merge branch 'for-next/led'
Merge branch 'for-next/mips'
Merge branch 'for-next/misc'
Merge branch 'for-next/mxs'
Merge branch 'for-next/nitrogen6x'
Merge branch 'for-next/tegra'
Merge branch 'for-next/xz'
environment: drop unnecessary casts

No Need to cast void pointers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
environment: remove unused variable

fd is unused, remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
environment: refactor saveenv

Collect all files in a list first and iterate over the list
when creating the actual environment image. Makes the next
patches easier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
environment: Only save changes to the defaultenv

Instead of storing the complete files with a 'saveenv' command
only store the files that have changes to the default environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
magicvar: Add support for dynamically added magicvars

Add support to add a new magicvar using the magicvar command.
This is useful for magicvars assigned and used only in the
environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add support for non volatile variables

This adds (back) support for non volatile variables. Non volatile
variables are variables which are stored in the environment over
reboot. They are used in the same way as the global variables, but
with a 'nv' command and device. The variables are stored under
/env/nv/, one variable per file. Adding a nv variable automatically
adds a global variable with the same name. Changing a nv variable
also changes the same global variable, but not the other way round.
This allows for example to configure the username as:

nv user=sha; saveenv

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
libfile: Add copy_recursive

To recursively copy a directory tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>