README: describe the CROSS_COMPILER variable

The build script uses a cross-compiler. The variable CROSS_COMPILE can
be set to select one, or a default value will be assumed.

Reported-by: Victor Weinstein <vweinstein@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Move functions and data to start of file

Future changes will create separate functions for the sub-commands that
tegra-uboot-flasher implements. This change prepares for that by moving
other functions away from what will be the body of some of those
functions.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Separate out validation of config name

This function will be used by multiple sub-commands in the future.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Split list-confignames implementation into a separate function

This moves towards each sub-command being a separate function

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Add parameters to gen_flashcmd_*

This way, they don't rely on global variables, which won't be global
once the flashing code is in a separate function.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Split flashing implementation into a separate function

Now, each sub-command is its own function

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Rework cmdline to use sub-commands

Instead of using options like --list-confignames to select a specific
sub-command/operation to perform, and assuming a default command of flash
if none is specified, use explicit sub-commands.

Old: tegra-uboot-flasher --list-confignames
New: tegra-uboot-flasher list-configs

Old: tegra-uboot-flasher CONFIG
New: tegra-uboot-flasher flash CONFIG

Later changes will introduce more sub-commands, e.g. "exec" to simply
download and execute a bootloader.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Pre-calculate more in find_config_dir()

Set more global variables in find_config_dir(). These remove duplicate
lookups and/or will be re-used by a future "exec" sub-command.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Implement exec sub-command

This mode of operation is a very simple wrapper around tegrarcm, which
eliminates the need to remember which BCT to use for each configuration.
This can be useful for quickly testing changes to U-Boot without writing
it to flash every time.

Signed-off-by: Stephen Warren <swarren@nvidia.com>