9
0
Fork 0
Commit Graph

1508 Commits

Author SHA1 Message Date
Sascha Hauer 7fa10256c3 defaultenv: Allow multiple defaultenvironment overlays
We can compile barebox for multiple boards at once, but currently
they all share a single default environment. This patch adds a
defaultenv_append() which boards can call to customize the default
environment during runtime. Each board now generate default environment
snippets using bbenv-y and add them during runtime with defaultenv_append()

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-28 08:14:14 +01:00
Sascha Hauer b850dbad65 move defaultenv-2 to defaultenv/defaultenv-2-*
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-21 17:06:50 +01:00
Sascha Hauer 464a531423 move defaultenv-1 to defaultenv/defaultenv-1
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-21 17:06:46 +01:00
Sascha Hauer 5d22cb3856 defaultenv: Align defaultenv array
The default environment buffer is an unsigned char array and thus
may be unaligned. Some decompression algorithms expect the buffer
to be sufficiently aligned for u32 accesses. We make this sure by
copying the default env to a temporary buffer. Instead of doing this
just add a __aligned(4) to the default environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-20 14:46:33 +01:00
Sascha Hauer 0a2a8f7059 environment: Add function to load envfs from buffer
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-20 14:45:48 +01:00
Sascha Hauer c2428b2287 environment: constify arguments
The directory arguments to envfs_load and envfs_save can
be const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-20 14:43:49 +01:00
Sascha Hauer 0de5aae341 filetype: Add detection for barebox environment
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-20 14:43:43 +01:00
Sascha Hauer e9241844a8 Kconfig: Select default compression type
Instead of asking explicitly for the default environment compression
type ask for the in-barebox default compression type. This also adds
a DEFAULT_COMPRESSION_SUFFIX make variable which can be used together
with the wildcard rules for compressed files to generate compressed
files without explicitly support each compression type.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-19 11:30:26 +01:00
Sascha Hauer 925e5b4b94 defaultenv: use wildcard compression rules
Now that we have wildcard rules for compresed files use them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-18 10:42:20 +01:00
Sascha Hauer 658af1caf3 defaultenv: simplify env dependencies
Finding out whether to rebuild the environment is a difficult task
since we have to track all files in a directory. Instead of trying
this, just rebuild the environment during every build and only if
it differs to the last one overwrite the target. This way make
only sees a change when the environment is changed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-18 10:42:07 +01:00
Sascha Hauer 72230bad19 common/Makefile: reorder targets
Reorder targets alphabetically to make the file look nicer, no
functional change.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-18 08:31:37 +01:00
Sascha Hauer 7e66707c76 input: Add BB_ prefix to KEY_ defines
Our KEY_ defines conflict with the standard Linux KEY_ defines, so
add a BB_ prefix to them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-17 08:23:37 +01:00
Alexander Shiyan 00fa656976 common/kallsyms.c: Fix sparse warning
CHECK   common/kallsyms.c
common/kallsyms.c:170:12: warning: symbol 'kallsyms_lookup' was not declared. Should it be static?

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-17 08:21:22 +01:00
Sascha Hauer b069d6b876 bootm: Return error when devicetree file is not a dtb
We check whether the file passed as devicetree actually is a devicetree,
but we missed to return an error if it's not. Fix this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-13 10:43:52 +01:00
Uwe Kleine-König f97f4b6571 mount: support filesystem options passed via -o
Similar to mount(8) the barebox command mount now supports passing a string
to the file system driver via -o.

This is used in the next commit to let the user specify port numbers for
nfs mounts.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:02:21 +01:00
Lucas Stach 13517cbcf0 common: env: properly propagate error code
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 08:49:55 +01:00
Lucas Stach aa6694b542 remove redundant NULL check on free
free() already checks the pointer to be non
NULL. No need to do it again.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 08:49:55 +01:00
David Vincent 34ab8ddd04 Load PBL into SRAM
This allows to load all the lowlevel init code, including the
uncompressor, inside SRAM and not just the bare init part. This is
useful when pbl is used as a first-stage bootloader but is loaded by an
external firmware.

Signed-off-by: David Vincent <freesilicon@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-09 09:43:33 +01:00
Sascha Hauer adbf51abde Merge branch 'for-next/pxa' 2014-02-03 09:55:55 +01:00
Sascha Hauer 601bf0fcc6 Merge branch 'for-next/misc' 2014-02-03 09:55:54 +01:00
Alexander Shiyan 8462cd6c32 Make generated variables static
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-03 08:58:22 +01:00
Sascha Hauer 706cef7e5b reset_source: add reset_source_get
To get reset_source from C code, not only from shell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-29 12:12:23 +01:00
Sascha Hauer 0099a887c0 reset_source: rename set_reset_source to reset_source_set
To get all reset source related functions into the same function
namespace.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-29 12:12:17 +01:00
Sascha Hauer 5767987b34 env: make path arguments to envfs_load/save const
These functions have no business changing the path argument, so make the
argument const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-27 11:08:44 +01:00
Sascha Hauer 3f02bff2bf environment: Fix wrong Kconfig dependency
DEFAULT_ENVIRONMENT needs ENV_HANDLING, not CMD_LOADENV.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-27 09:27:04 +01:00
Sascha Hauer 25cee7ec17 environment: Use accessor functions for default environment path
default_environment_path only exists when CONFIG_ENV_HANDLING is enabled.
Boards would have to #ifdef this if they wanted to use
default_environment_path. Use accessor functions instead which can
be ifdeffed on a single place.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-27 09:27:02 +01:00
Sascha Hauer dac65f99e8 console: Set Linux console parameter automatically
Linux specifies the linux,stdout-path property in the /chosen node
in the devicetree. Unfortunately this is ignored in most cases.
For cases in which barebox uses this property for its own use we
translate this into a Linux boot arg with:

- the console name provided by the serial driver
- the the instance from the 'serial' alias
- the baudrate from the actual baudrate.

So with this it's for devicetee enabled boards no longer necessary
to manually assign a console= parameter. Should a user not want
to use the automatically assigned parameter it should do:

global.linux.bootargs.console=

in the environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-22 07:53:21 +01:00
Sascha Hauer a1aca01d62 bootm: introduce bootm_load_devicetree helper
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-14 12:36:06 +01:00
Sascha Hauer 76ccd96f4a bootm: introduce bootm_load_initrd helper
Make the bootm handlers simpler by factoring out an initrd load
function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-14 12:36:03 +01:00
Sascha Hauer 9bd67f5e61 bootm: introduce bootm_load_os helper
The common bootm code used to load uImage contents to SDRAM
before calling into the handlers if possible. This makes the
handlers complicated since they have to handle many cases. Instead,
introduce a helper to load the os after the handlers have figured
out a good load address.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-01-10 11:53:18 +01:00
Sascha Hauer f1f5346975 Merge branch 'for-next/poller' 2014-01-07 11:57:51 +01:00
Sascha Hauer 3c46c02c54 poller: Allow to call functions asynchronously
Sometimes execution of a function has to be delayed, for example
when a backlight can only be turned on when the picture has stabilized.
To help in such situations add a convenience function around the poller
stuff to call a function after a delay.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-18 16:47:48 +01:00
Sascha Hauer 6d7fae1e97 Merge branch 'for-next/omap-devicetree-prepare' 2013-12-06 08:23:27 +01:00
Sascha Hauer e9ea6eeaab Merge branch 'for-next/misc'
Conflicts:
	scripts/Makefile
2013-12-06 08:23:24 +01:00
Sascha Hauer 28124d02f2 Merge branch 'for-next/hush' 2013-12-06 08:22:48 +01:00
Michael Grzeschik 1e7f2bd25c scripts: bareboxcrc32 as host and target userspacetool
This patch adds the crc32 command to be build
as host and optionally as target tool.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-04 17:17:06 +01:00
Sascha Hauer a83f635fb2 common Kconfig: disable unused options for SHELL_NONE
Let commandline editing and long help depend on !SHELL_NONE.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-26 17:15:53 +01:00
Sascha Hauer 915976f129 common Kconfig: Add missing depends on
CONFIG_MAXARGS is only used with the simple console support, so add
a 'depends on'. While at it, move it below the shell selection.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-26 17:15:48 +01:00
Sascha Hauer dd04578bb2 ARM: OMAP: Make debug_ll UART Kconfig selectable
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-22 15:34:36 +01:00
Alexander Aring d4aa015033 common: add dependency !SANDBOX on target tools
The build of target tools fails on sandbox architecture.
We don't need any target tools in this case, so add a dependency.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-20 07:21:24 +01:00
Sascha Hauer f5923be4c6 hush: refactor reserved_word()
Save indentation level for easier readability.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:47:15 +01:00
Sascha Hauer b763f01728 hush: use standard ARRAY_SIZE
Use standard ARRAY_SIZE instead of handcrafted NRES.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:47:15 +01:00
Sascha Hauer cc3fc44dbf hush: Be more informative on syntax error
Print the token that led to a syntax error, at least for the common
case.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:47:15 +01:00
Sascha Hauer 671cf43e56 consolidate syntax() and syntax_err()
syntax is defined as syntax_err. Drop syntax_err and call syntax instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:47:15 +01:00
Sascha Hauer 1d8041b03f hush: rename __promptme to interrupt
the name '__promptme' does not make clear what the variable means. rename
it to 'interrupt' which is set to true when the user has hit ctrl-c.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:46:05 +01:00
Sascha Hauer ad560a1797 hush: refactor file_get()
Save indentation level by returning early.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:45:04 +01:00
Sascha Hauer 8875a39679 hush: refactor get_user_input()
Save indentation level by returning early.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:45:03 +01:00
Sascha Hauer 86e7032568 hush: refactor readline call
Don't call readline in if/else, instead setup a variable and call
it once.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:45:03 +01:00
Sascha Hauer 091ef4fcfc hush: fix exit on syntax error behaviour
input.__promptme is no valid indicator that run_shell should be left.
It should be left on executing the 'exit' builtin which is indicated
by a return code < 0 from parse_stream_outer(). Track this with an extra
variable and use it as a condition to return from an interactive shell.

This fixes the weird behaviour that hush exits (and the user finds itself
in the menu) when a syntax error occured.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-12 14:41:07 +01:00
Sascha Hauer b67b2671c2 treewide: Add missing includes
A lot of files rely on include/driver.h including include/of.h (and
this including include/errno.h. include the files explicitly so we can
eventually get rid of including of.h from driver.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:42:04 +01:00
Uwe Kleine-König 6fecd2aaca partitions: dos: parse extended partition
DOS MBRs might contain an extended partition that holds several logical
partitions. Add these to the partitions of the block device.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:38:27 +01:00
Uwe Kleine-König 8ddf910d2f partitions: dos: don't open code get_unaligned_le32
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:28:27 +01:00
Uwe Kleine-König 7399925b38 blspec: fix documention of blspec_scan_directory's return code
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:27:58 +01:00
Uwe Kleine-König e55160fe10 partitions: dos: improve guess of disk size
The code used to ineffectively take the end of the last partition as guess
for the disk size. Better use the end of the partition that has its end
rearmost.

Also return an unsigned type instead of int as the result is always
non-negative.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:27:17 +01:00
Sascha Hauer ded25480d8 Merge branch 'for-next/rpi' 2013-11-07 08:31:47 +01:00
Sascha Hauer 73ef216f0d Merge branch 'for-next/bootspec' 2013-11-07 08:31:47 +01:00
Alexander Aring 29ab38ef1c dlmalloc: fix compiler warning
This patch fix a compiler warning while building sandbox barebox with
gcc version 4.8.2.

common/dlmalloc.c: In function ‘barebox_calloc’:
common/dlmalloc.c:1756:2: warning: ISO C90 forbids mixed declarations
and code [-Wdeclaration-after-statement]
  void *mem = malloc(sz);
  ^

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-07 08:10:44 +01:00
Sascha Hauer d7c1612d65 of: Add a context pointer to fixup functions
If drivers want to fixup their specific instance they need some context
to know which instance they have to fixup.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-06 10:24:46 +01:00
Sascha Hauer 9e26e30af4 blspec: Make error message more clear
"Nothing found on" is a bit unspecific. Make clear that no
bootspec entry is found.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:55 +01:00
Sascha Hauer 21af7e0005 blspec: make cdev optional
the cdev for a given directory can be determined by get_cdev_by_mountpath().
Use this function and remove the cdev argument from blspec_scan_directory().
Also, export the function to make code possible which boots the bootloader
spec entries found in directories.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:55 +01:00
Sascha Hauer d85c580eeb blspec: Let scan functions return the number of entries found
So that callers can detect whether entries are found or not.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:54 +01:00
Sascha Hauer 6b12fb727e blspec: Allow to boot partitions
Instead of only allowing complete devices we now also allow single
partitions to look for bootloader spec entries.

Normally the bootloader spec defines a way to find a partition containing /boot
on a device.  On embedded systems it's often useful instead to have only a
single partition image which contains both the kernel and the root filesystems.
This partition image may be written to the device multiple times. With this
patch they can be booted with 'boot emmc0.<partno>'

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:54 +01:00
Sascha Hauer a58d8ba424 blspec: rename _hwdevice functions to _devicename
Since it's not necessarily the hardware device this seems to
be a more appropriate name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:54 +01:00
Sascha Hauer 2f5d04241c blspec: Push device_detect into blspec_scan_device
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-05 08:37:54 +01:00
Alexander Shiyan 5643fdce0f calloc: Fix possible memory leak
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-22 08:51:44 +02:00
Sascha Hauer 6b8b04c0ab blspec: Fix once/default booting
The default/once files contain the full path to the entries, not
only the filename. This fixes booting the once and default entries.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-21 09:15:45 +02:00
Jan Luebbe 0a45810d29 common: fix possible build problem without password support
In the case where CONFIG_PASSWORD is off, CONFIG_PASSWORD_DEFAULT is
undefined. As undefined is not "", this causes make to call find -type f.
If there is a filename containing a :, make will complain about having
"multiple target patterns"

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-15 08:36:53 +02:00
Sascha Hauer 61cf2b51bc add kernel-install tool for bootloader Spec
This adds a tool for installing kernels according to the bootloader
spec. systemd already has a similar tool, but it is limited to installing
kernels on the currently running system. The barebox kernel-install
tool instead can also be used to install kernels on removable media on a
development host for cross development. It is compiled in two variants,
as 'kernel-install' for the host and as 'kernel-install-target' using
$CROSS_COMPILE.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-14 15:28:06 +02:00
Sascha Hauer ef5dac9c2b Implement bootloader spec support for barebox
The Bootloader Specification describes a way how kernels can
be installed on devices and how they can be started by the bootloader.

The bootloader spec is currently supported by (x86) gummiboot and
by systemd which provides a kernel-install script. With the bootloader
spec it's possible for the Operating system to install a new kernel
without knowing about the bootloader and for the bootloader it's possible
to discover and start Operating Systems on a media without being
configured.

For more details about the spec see:

http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/

This patch adds barebox support for the spec. It enhances the 'boot'
command so that not only boot script names can be given, but also
devices containing bootloader spec entries. With this it's possible
to call the 'boot' command like: 'boot sd emmc net'. It would then
first look for bootloader spec entries on the (removable) sd card,
then, is nothing is found, on the internal emmc and if still
unsuccessful would call the 'net' bootscript.

The bootloader Spec currently doesn't specify which entry should be
default if multiple entries are found on a single device. Therefore
barebox currently has two extensions of the spec. The $BOOT diretory
can contain a file named 'default'. If present, the content of the
file is treated as a filename under $BOOT/loader/entries/ which is
used as default. Similarly if a file named 'once' is present, the
entry is started once and the file is removed afterwards. This is
useful for testing if a newly installed kernel works before making
it the default.

As on ARM and other Architectures a devicetree has to be specified
for the kernel, the 'devicetree' property is used to specify a
devicetree. Like 'kernel' and 'initrd' this also contains a pth
relative to $BOOT.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-14 14:04:20 +02:00
Sascha Hauer 1369bfd44f cdev: store dos partition type in struct cdev
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-14 14:04:20 +02:00
Sascha Hauer ebf9022f2e Merge branch 'for-next/rs485'
Conflicts:
	common/console_common.c
2013-10-07 08:02:14 +02:00
Sascha Hauer d9870d782a Merge branch 'for-next/mount' 2013-10-07 08:00:28 +02:00
Sascha Hauer 33c56e21eb Merge branch 'for-next/misc'
Conflicts:
	commands/Makefile
2013-10-07 08:00:25 +02:00
Sascha Hauer 9aa6dd0270 Merge branch 'for-next/login'
Conflicts:
	include/console.h
2013-10-07 08:00:13 +02:00
Sascha Hauer 574947ef76 Merge branch 'for-next/console' 2013-10-07 07:59:18 +02:00
Sascha Hauer fb0c2ee1ae Merge branch 'for-next/bpkfs' 2013-10-07 07:59:18 +02:00
Sascha Hauer 0546e669a2 bootm: Replace getenv_loadaddr with getenv_ul
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-07 07:57:42 +02:00
Jean-Christophe PLAGNIOL-VILLARD 32d88d9a86 filetype: add Binary PacKage BPK type
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-06 13:26:51 +02:00
Jean-Christophe PLAGNIOL-VILLARD 6a5121f748 console: factorise function to get the first enabled console
rename it to console_get_first_active

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-10-06 13:19:46 +02:00
Sascha Hauer 5ee4ad2229 environment variables: introduce new helpers
This introduces some new environment variable helpers and updates
the existing ones. Newly introduced are:

getenv_bool: read a bool variable
getenv_ul: read an unsigned long variable
getenev_uint: read an unsigned int variable
getenv_nonempty: like normal getenv, but does return NULL instead of an
                 empty string

All new helpers take a pointer to the value. This value is only modified
when the variable exists. This allows the following programming scheme:

	unsigned int myvalue = sanedefault;

	getenv_uint("myvalue", &myvalue);

So without checking the return value myvalue contains the best possible
value.

getenv_ull is updated to this scheme.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-30 10:28:52 +02:00
Sascha Hauer 4dda27ce49 block: Collect block devices on list
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-30 10:18:39 +02:00
Sascha Hauer 28141f9e5a defenv-2: replace boot script with command
This replaces the 'boot' script in the defaultenv-2 with a command
with the same behaviour. A command gives more flexibility for future
externsions

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-30 07:45:04 +02:00
Sascha Hauer 5a968fc81c bootm needs uImage support. Select it
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-30 07:45:04 +02:00
Sascha Hauer 666f12e0c1 introduce runtime loglevel
With this the verbosity of barebox can be controlled during runtime
using the 'loglevel' globalvar.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-29 12:15:40 +02:00
Sascha Hauer 4973077872 globalvar: Do not modify already existing variables
When globalvar_add_simple was called on previously existing variables
then the value was overwritten, even when value was passed as NULL.
Do not overwrite the value in this case which allows us to do a 'global'
on the same variable multiple times without loosing the values.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-27 11:14:45 +02:00
Jean-Christophe PLAGNIOL-VILLARD 651a23a69e console_simple: fix: set f_active
so generic code can check if the console is enabled

and now we can use loadb & loadxy

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:22:50 +02:00
Jean-Christophe PLAGNIOL-VILLARD 050f0d5978 console: introduce console_get_by_dev
so we can get console by it's device

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:21:40 +02:00
Jean-Christophe PLAGNIOL-VILLARD 14e8e0a421 shutdown: add board call back
so if we need to do something switch in the board we can fill this function
pointer (as example on Animeo IP shutdown some rs232 & rs485)

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:21:40 +02:00
Sascha Hauer 45212cdd72 command: Let builtin command take precedence
In theory we can overwrite a builtin command with a script. However,
I don't know a single case where this has been done. Scripts are
often more unflexible than commands so it's unlikely that a script
can extend the functionality of a builtin command. Moreover, the
internal command is no longer accessible once it's overwritten by
a script.

Invert this logic so that a builtin command can overwrite an existing
script. This will help when the 'boot' script is converted to a
builting command. Then with old environments the builtin command will
be used instead of the script.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer 68e6eceae9 bootm: Add dryrun support
This adds support for checking the bootm command without actually booting.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer b15c5eeecf bootm: separate bootm input data and internal data
We used to use struct image_data as the central data structure for bootm and
also as the input data structure. This makes it unclear which of the fields
are actually input data. This patch creates a struct bootm_data which is
exclusively used for input data to make usage clearer.

Also it moves the dispatching of multifile uImage pathnames to the core bootm
code so that the core code gets more flexible and the command code simpler.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer 172fc40f61 bootm: move globalvars from command to common
The globalvars should be available even if the bootm command
is not directly present.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer fc5923d975 bootm: move getenv_loadaddr from command to common
getenv_loadaddr may be used by other code, so move it
from command/ to common/

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer 81e0f84dca bootm: check for os image file
Check if an os image file has been given.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer a0dd2f162a bootm: fix memory leak
data->of_root_node may be allocated from of of_unflatten_dtb.
Free it in this case.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:18 +02:00
Sascha Hauer 3c2df61f63 bootm: fix possible memory leak
fdt is allocated, free it in error case.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-24 09:03:17 +02:00
Jean-Christophe PLAGNIOL-VILLARD 3b2263c865 console_simple: set baudrate at register
as the console is always enable

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-22 16:46:51 +02:00
Jean-Christophe PLAGNIOL-VILLARD e62d425517 console: drop f_caps and check the function pointer getc/putc instead
None of the driver make the difference between STDOUT and STDERR.
So we just need to check if putc or getc are filled in the console_device

save 32 bytes on versatilepb

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-21 09:59:16 +02:00
Jean-Christophe PLAGNIOL-VILLARD 892c005849 login/passwd: add default password support
even if the env is broken you will have a password

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-19 08:49:51 +02:00
Jean-Christophe PLAGNIOL-VILLARD bb89ea62a0 login: disable input console if password wrong
so we guarantee that barebox is secured again user interaction

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-19 08:49:47 +02:00